instruction
string
input
string
output
string
source_file
string
priority
int64
请完成以下Java代码
public class UpdateCaseDefinitionHistoryTimeToLiveCmd implements Command<Void>, Serializable { private static final long serialVersionUID = 1L; protected String caseDefinitionId; protected Integer historyTimeToLive; public UpdateCaseDefinitionHistoryTimeToLiveCmd(String caseDefinitionId, Integer historyTimeToLive) { this.caseDefinitionId = caseDefinitionId; this.historyTimeToLive = historyTimeToLive; } @Override public Void execute(CommandContext context) { ensureNotNull(BadUserRequestException.class, "caseDefinitionId", caseDefinitionId); if (historyTimeToLive != null) { ensureGreaterThanOrEqual(BadUserRequestException.class, "", "historyTimeToLive", historyTimeToLive, 0); } validate(historyTimeToLive, context); CaseDefinitionEntity caseDefinitionEntity = context.getCaseDefinitionManager().findLatestDefinitionById(caseDefinitionId); for (CommandChecker checker : context.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkUpdateCaseDefinition(caseDefinitionEntity); } logUserOperation(context, caseDefinitionEntity); caseDefinitionEntity.setHistoryTimeToLive(historyTimeToLive); return null; } protected void logUserOperation(CommandContext commandContext, CaseDefinitionEntity caseDefinitionEntity) { List<PropertyChange> propertyChanges = new ArrayList<>();
propertyChanges.add(new PropertyChange("historyTimeToLive", caseDefinitionEntity.getHistoryTimeToLive(), historyTimeToLive)); propertyChanges.add(new PropertyChange("caseDefinitionKey", null, caseDefinitionEntity.getKey())); commandContext.getOperationLogManager() .logCaseDefinitionOperation(UserOperationLogEntry.OPERATION_TYPE_UPDATE_HISTORY_TIME_TO_LIVE, caseDefinitionId, caseDefinitionEntity.getTenantId(), propertyChanges); } protected void validate(Integer historyTimeToLive, CommandContext context) { HistoryTimeToLiveParser parser = HistoryTimeToLiveParser.create(context); parser.validate(historyTimeToLive); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmmn\cmd\UpdateCaseDefinitionHistoryTimeToLiveCmd.java
1
请完成以下Java代码
public static ContextSnapshotFactory selectInstance(@Nullable ContextSnapshotFactory factory) { if (factory != null) { return factory; } return sharedInstance; } /** * Save the {@code ContextSnapshotFactory} in the given {@link Context}. * @param factory the instance to save * @param context the context to save the instance to * @return a new context with the saved instance */ public static Context saveInstance(ContextSnapshotFactory factory, Context context) { return context.put(CONTEXT_SNAPSHOT_FACTORY_KEY, factory); } /** * Save the {@code ContextSnapshotFactory} in the given {@link Context}. * @param factory the instance to save * @param context the context to save the instance to */ public static void saveInstance(ContextSnapshotFactory factory, GraphQLContext context) { context.put(CONTEXT_SNAPSHOT_FACTORY_KEY, factory); } /** * Access the {@code ContextSnapshotFactory} from the given {@link ContextView} * or return a shared, static instance. * @param contextView the context where the instance is saved * @return the instance to use */ public static ContextSnapshotFactory getInstance(ContextView contextView) { ContextSnapshotFactory factory = contextView.getOrDefault(CONTEXT_SNAPSHOT_FACTORY_KEY, null); return selectInstance(factory); } /** * Access the {@code ContextSnapshotFactory} from the given {@link GraphQLContext} * or return a shared, static instance. * @param context the context where the instance is saved * @return the instance to use */ public static ContextSnapshotFactory getInstance(GraphQLContext context) { ContextSnapshotFactory factory = context.get(CONTEXT_SNAPSHOT_FACTORY_KEY);
return selectInstance(factory); } /** * Shortcut to obtain the {@code ContextSnapshotFactory} instance, and to * capture from the given {@link ContextView}. * @param contextView the context to capture from * @return a snapshot from the capture */ public static ContextSnapshot captureFrom(ContextView contextView) { ContextSnapshotFactory factory = getInstance(contextView); return selectInstance(factory).captureFrom(contextView); } /** * Shortcut to obtain the {@code ContextSnapshotFactory} instance, and to * capture from the given {@link GraphQLContext}. * @param context the context to capture from * @return a snapshot from the capture */ public static ContextSnapshot captureFrom(GraphQLContext context) { ContextSnapshotFactory factory = getInstance(context); return selectInstance(factory).captureFrom(context); } }
repos\spring-graphql-main\spring-graphql\src\main\java\org\springframework\graphql\execution\ContextPropagationHelper.java
1
请完成以下Java代码
public java.lang.String getLabelCertificationAuthority () { return (java.lang.String)get_Value(COLUMNNAME_LabelCertificationAuthority); } @Override public org.compiere.model.I_M_Label getM_Label() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_M_Label_ID, org.compiere.model.I_M_Label.class); } @Override public void setM_Label(org.compiere.model.I_M_Label M_Label) { set_ValueFromPO(COLUMNNAME_M_Label_ID, org.compiere.model.I_M_Label.class, M_Label); } /** Set Label List. @param M_Label_ID Label List */ @Override public void setM_Label_ID (int M_Label_ID) { if (M_Label_ID < 1) set_Value (COLUMNNAME_M_Label_ID, null); else set_Value (COLUMNNAME_M_Label_ID, Integer.valueOf(M_Label_ID)); } /** Get Label List. @return Label List */ @Override public int getM_Label_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_Label_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Label_ID. @param M_Product_Certificate_ID Label_ID */ @Override public void setM_Product_Certificate_ID (int M_Product_Certificate_ID) { if (M_Product_Certificate_ID < 1) set_ValueNoCheck (COLUMNNAME_M_Product_Certificate_ID, null); else set_ValueNoCheck (COLUMNNAME_M_Product_Certificate_ID, Integer.valueOf(M_Product_Certificate_ID)); } /** Get Label_ID. @return Label_ID */ @Override public int getM_Product_Certificate_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_Certificate_ID); if (ii == null) return 0; return ii.intValue(); } @Override public org.compiere.model.I_M_Product getM_Product() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_M_Product_ID, org.compiere.model.I_M_Product.class); }
@Override public void setM_Product(org.compiere.model.I_M_Product M_Product) { set_ValueFromPO(COLUMNNAME_M_Product_ID, org.compiere.model.I_M_Product.class, M_Product); } /** Set Produkt. @param M_Product_ID Produkt, Leistung, Artikel */ @Override public void setM_Product_ID (int M_Product_ID) { if (M_Product_ID < 1) set_Value (COLUMNNAME_M_Product_ID, null); else set_Value (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID)); } /** Get Produkt. @return Produkt, Leistung, Artikel */ @Override public int getM_Product_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Product_Certificate.java
1
请在Spring Boot框架中完成以下Java代码
public Date getCollectDate() { return collectDate; } /** * 汇总日期 * * @param collectDate */ public void setCollectDate(Date collectDate) { this.collectDate = collectDate; } /** * 汇总类型(参考枚举:SettDailyCollectTypeEnum) * * @return */ public String getCollectType() { return collectType; } /** * 汇总类型(参考枚举:SettDailyCollectTypeEnum) * * @param collectType */ public void setCollectType(String collectType) { this.collectType = collectType; } /** * 结算批次号(结算之后再回写过来) * * @return */ public String getBatchNo() { return batchNo; } /** * 结算批次号(结算之后再回写过来) * * @param batchNo */ public void setBatchNo(String batchNo) { this.batchNo = batchNo == null ? null : batchNo.trim(); } /** * 交易总金额 * * @return */ public BigDecimal getTotalAmount() { return totalAmount; } /** * 交易总金额 * * @param totalAmount */ public void setTotalAmount(BigDecimal totalAmount) { this.totalAmount = totalAmount; } /** * 交易总笔数 * * @return */ public Integer getTotalCount() { return totalCount;
} /** * 交易总笔数 * * @param totalCount */ public void setTotalCount(Integer totalCount) { this.totalCount = totalCount; } /** * 结算状态(参考枚举:SettDailyCollectStatusEnum) * * @return */ public String getSettStatus() { return settStatus; } /** * 结算状态(参考枚举:SettDailyCollectStatusEnum) * * @param settStatus */ public void setSettStatus(String settStatus) { this.settStatus = settStatus; } /** * 风险预存期 */ public Integer getRiskDay() { return riskDay; } /** * 风险预存期 */ public void setRiskDay(Integer riskDay) { this.riskDay = riskDay; } }
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\account\entity\RpSettDailyCollect.java
2
请完成以下Java代码
public void setM_AttributeValue_ID (int M_AttributeValue_ID) { if (M_AttributeValue_ID < 1) set_Value (COLUMNNAME_M_AttributeValue_ID, null); else set_Value (COLUMNNAME_M_AttributeValue_ID, Integer.valueOf(M_AttributeValue_ID)); } /** Get Merkmals-Wert. @return Product Attribute Value */ @Override public int getM_AttributeValue_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_AttributeValue_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Suchschlüssel. @param Value Search key for the record in the format required - must be unique */ @Override public void setValue (java.lang.String Value) { set_Value (COLUMNNAME_Value, Value); } /** Get Suchschlüssel. @return Search key for the record in the format required - must be unique */ @Override public java.lang.String getValue () { return (java.lang.String)get_Value(COLUMNNAME_Value); } /** Set Datum. @param ValueDate Datum */ @Override public void setValueDate (java.sql.Timestamp ValueDate) {
set_Value (COLUMNNAME_ValueDate, ValueDate); } /** Get Datum. @return Datum */ @Override public java.sql.Timestamp getValueDate () { return (java.sql.Timestamp)get_Value(COLUMNNAME_ValueDate); } /** Set Zahlwert. @param ValueNumber Numeric Value */ @Override public void setValueNumber (java.math.BigDecimal ValueNumber) { set_Value (COLUMNNAME_ValueNumber, ValueNumber); } /** Get Zahlwert. @return Numeric Value */ @Override public java.math.BigDecimal getValueNumber () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_ValueNumber); if (bd == null) return BigDecimal.ZERO; return bd; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_AttributeInstance.java
1
请完成以下Spring Boot application配置
management: endpoint: # Health 端点配置项,对应 HealthProperties 配置类 health: show-details: ALWAYS # 何时显示完整的健康信息。默认为 NEVER 都不展示。可选 WHEN_AUTHORIZED 当经过授权的用户;可选 ALWAYS 总是展示。 endpoints: # Actuator HTTP 配置项,对应 WebEndpointProperties
配置类 web: exposure: include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
repos\SpringBoot-Labs-master\labx-05-spring-cloud-alibaba-nacos-config\labx-05-sca-nacos-config-demo-actuator\src\main\resources\application.yaml
2
请完成以下Java代码
private IQueryBuilder<I_C_Invoice_Candidate> createICQueryBuilder() { // Get the user selection filter (i.e. what user filtered in his window) final IQueryFilter<I_C_Invoice_Candidate> userSelectionFilter; if (Ini.isSwingClient()) { // In case of Swing, preserve the old functionality, i.e. if no where clause then select all userSelectionFilter = getProcessInfo().getQueryFilterOrElseFalse(); } else { userSelectionFilter = getProcessInfo().getQueryFilterOrElse(null); if (userSelectionFilter == null) { throw new AdempiereException("@NoSelection@"); } } return createICQueryBuilder(userSelectionFilter); } private IQueryBuilder<I_C_Invoice_Candidate> createICQueryBuilder(final IQueryFilter<I_C_Invoice_Candidate> userSelectionFilter) { final IQueryBuilder<I_C_Invoice_Candidate> queryBuilder = Services.get(IQueryBL.class) .createQueryBuilder(I_C_Invoice_Candidate.class, getCtx(), ITrx.TRXNAME_None) .filter(userSelectionFilter) .addOnlyActiveRecordsFilter() .addOnlyContextClient() // // NOTE: we are not filtering by IsToClear, Processed etc // because we want to allow the enqueuer do do that // because enqueuer will also log an message about why it was excluded (=> transparant for user) // .addEqualsFilter(I_C_Invoice_Candidate.COLUMN_IsToClear, false) // .addEqualsFilter(I_C_Invoice_Candidate.COLUMNNAME_Processed, false) not filtering by processed, because the IC might be invalid (08343)
// .addEqualsFilter(I_C_Invoice_Candidate.COLUMNNAME_IsError, false) // .addEqualsFilter(I_C_Invoice_Candidate.COLUMNNAME_IsInDispute, false) // ; // // Consider only approved invoices (if we were asked to do so) if (invoicingParams != null && invoicingParams.isOnlyApprovedForInvoicing()) { queryBuilder.addEqualsFilter(I_C_Invoice_Candidate.COLUMNNAME_ApprovalForInvoicing, true); } return queryBuilder; } @Nullable private ProcessCaptionMapper processCaptionMapper(final IQueryFilter<I_C_Invoice_Candidate> selectionFilter) { final IQuery<I_C_Invoice_Candidate> query = prepareNetAmountsToInvoiceForSelectionQuery(selectionFilter); return processCaptionMapperHelper.getProcessCaptionMapperForNetAmountsFromQuery(query); } private IQuery<I_C_Invoice_Candidate> prepareNetAmountsToInvoiceForSelectionQuery(final IQueryFilter<I_C_Invoice_Candidate> selectionFilter) { return createICQueryBuilder(selectionFilter) .addNotNull(I_C_Invoice_Candidate.COLUMNNAME_C_Currency_ID) .create(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\process\C_Invoice_Candidate_EnqueueSelectionForInvoicing.java
1
请在Spring Boot框架中完成以下Java代码
public String getLicencePic() { return licencePic; } public void setLicencePic(String licencePic) { this.licencePic = licencePic; } public Timestamp getRegisterTime() { return registerTime; } public void setRegisterTime(Timestamp registerTime) { this.registerTime = registerTime; } public UserTypeEnum getUserTypeEnum() { return userTypeEnum; } public void setUserTypeEnum(UserTypeEnum userTypeEnum) { this.userTypeEnum = userTypeEnum; } public UserStateEnum getUserStateEnum() { return userStateEnum; } public void setUserStateEnum(UserStateEnum userStateEnum) { this.userStateEnum = userStateEnum; } public RoleEntity getRoleEntity() { return roleEntity; }
public void setRoleEntity(RoleEntity roleEntity) { this.roleEntity = roleEntity; } @Override public String toString() { return "UserEntity{" + "id='" + id + '\'' + ", username='" + username + '\'' + ", password='" + password + '\'' + ", phone='" + phone + '\'' + ", mail='" + mail + '\'' + ", licencePic='" + licencePic + '\'' + ", registerTime=" + registerTime + ", userTypeEnum=" + userTypeEnum + ", userStateEnum=" + userStateEnum + ", roleEntity=" + roleEntity + '}'; } }
repos\SpringBoot-Dubbo-Docker-Jenkins-master\Gaoxi-Common-Service-Facade\src\main\java\com\gaoxi\entity\user\UserEntity.java
2
请完成以下Java代码
public class CmmnDeployer extends AbstractDefinitionDeployer<CaseDefinitionEntity> { public static final String[] CMMN_RESOURCE_SUFFIXES = new String[] { "cmmn11.xml", "cmmn10.xml", "cmmn" }; protected ExpressionManager expressionManager; protected CmmnTransformer transformer; @Override protected String[] getResourcesSuffixes() { return CMMN_RESOURCE_SUFFIXES; } @Override protected List<CaseDefinitionEntity> transformDefinitions(DeploymentEntity deployment, ResourceEntity resource, Properties properties) { return transformer.createTransform().deployment(deployment).resource(resource).transform(); } @Override protected CaseDefinitionEntity findDefinitionByDeploymentAndKey(String deploymentId, String definitionKey) { return getCaseDefinitionManager().findCaseDefinitionByDeploymentAndKey(deploymentId, definitionKey); } @Override protected CaseDefinitionEntity findLatestDefinitionByKeyAndTenantId(String definitionKey, String tenantId) { return getCaseDefinitionManager().findLatestCaseDefinitionByKeyAndTenantId(definitionKey, tenantId); } @Override protected void persistDefinition(CaseDefinitionEntity definition) { getCaseDefinitionManager().insertCaseDefinition(definition); } @Override protected void addDefinitionToDeploymentCache(DeploymentCache deploymentCache, CaseDefinitionEntity definition) { deploymentCache.addCaseDefinition(definition); }
// context /////////////////////////////////////////////////////////////////////////////////////////// protected CaseDefinitionManager getCaseDefinitionManager() { return getCommandContext().getCaseDefinitionManager(); } // getters/setters /////////////////////////////////////////////////////////////////////////////////// public ExpressionManager getExpressionManager() { return expressionManager; } public void setExpressionManager(ExpressionManager expressionManager) { this.expressionManager = expressionManager; } public CmmnTransformer getTransformer() { return transformer; } public void setTransformer(CmmnTransformer transformer) { this.transformer = transformer; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmmn\deployer\CmmnDeployer.java
1
请在Spring Boot框架中完成以下Java代码
public class Application { @Bean InitializingBean usersAndGroupsInitializer(final IdentityService identityService) { return new InitializingBean() { @Override public void afterPropertiesSet() throws Exception { // install groups & users Group group = identityService.newGroup("user"); group.setName("users"); group.setType("security-role"); identityService.saveGroup(group);
User josh = identityService.newUser("jlong"); josh.setFirstName("Josh"); josh.setLastName("Long"); josh.setPassword("password"); identityService.saveUser(josh); identityService.createMembership("jlong", "user"); } }; } public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
repos\flowable-engine-main\modules\flowable-spring-boot\flowable-spring-boot-samples\flowable-spring-boot-sample-rest-api\src\main\java\flowable\Application.java
2
请完成以下Java代码
public final class Application { private final String name; @Nullable private final BuildVersion buildVersion; private final String status; private final Instant statusTimestamp; private final List<Instance> instances; @lombok.Builder(builderClassName = "Builder", toBuilder = true) private Application(String name, @Nullable BuildVersion buildVersion, @Nullable String status, @Nullable Instant statusTimestamp, List<Instance> instances) { Assert.notNull(name, "'name' must not be null"); this.name = name; this.buildVersion = buildVersion; this.status = (status != null) ? status : StatusInfo.STATUS_UNKNOWN; this.statusTimestamp = (statusTimestamp != null) ? statusTimestamp : Instant.now(); if (instances.isEmpty()) { this.instances = Collections.emptyList(); }
else { this.instances = new ArrayList<>(instances); } } public static Application.Builder create(String name) { return builder().name(name); } public static class Builder { // Will be generated by lombok } }
repos\spring-boot-admin-master\spring-boot-admin-server\src\main\java\de\codecentric\boot\admin\server\domain\entities\Application.java
1
请在Spring Boot框架中完成以下Java代码
public String getElementId() { return elementId; } public String getElementName() { return elementName; } public String getScopeId() { return scopeId; } public boolean isWithoutScopeId() { return withoutScopeId; } public String getSubScopeId() { return subScopeId; } public String getScopeType() { return scopeType; } public boolean isWithoutScopeType() { return withoutScopeType; } public String getScopeDefinitionId() { return scopeDefinitionId; } public String getCaseDefinitionKey() { return caseDefinitionKey; } public String getCorrelationId() {
return correlationId; } public boolean isOnlyTimers() { return onlyTimers; } public boolean isOnlyMessages() { return onlyMessages; } public boolean isExecutable() { return executable; } public boolean isOnlyExternalWorkers() { return onlyExternalWorkers; } public Date getDuedateHigherThan() { return duedateHigherThan; } public Date getDuedateLowerThan() { return duedateLowerThan; } public Date getDuedateHigherThanOrEqual() { return duedateHigherThanOrEqual; } public Date getDuedateLowerThanOrEqual() { return duedateLowerThanOrEqual; } }
repos\flowable-engine-main\modules\flowable-job-service\src\main\java\org\flowable\job\service\impl\DeadLetterJobQueryImpl.java
2
请完成以下Java代码
private static ITranslatableString buildMessage( @Nullable final ProductId productId, @Nullable final UomId fromUomId, @Nullable final UomId toUomId) { return TranslatableStrings.builder() .appendADMessage(MSG) .append(" ").appendADElement("M_Product_ID").append(": ").append(extractProductName(productId)) .append(" ").appendADElement("C_UOM_ID").append(": ").append(extractUOMSymbol(fromUomId)) .append(" ").appendADElement("C_UOM_To_ID").append(": ").append(extractUOMSymbol(toUomId)) .build(); } private static String extractProductName(@Nullable final ProductId productId) { if (productId == null) { return "<none>"; } return Services.get(IProductBL.class).getProductValueAndName(productId); } private static String extractUOMSymbol(@Nullable final UomId uomId) { if (uomId == null) { return "<none>"; }
try { final I_C_UOM uom = Services.get(IUOMDAO.class).getById(uomId); if (uom == null) { return "<" + uomId.getRepoId() + ">"; } return uom.getUOMSymbol(); } catch (final Exception ex) { return "<" + uomId.getRepoId() + ">"; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\adempiere\exceptions\NoUOMConversionException.java
1
请完成以下Java代码
public void setTradgPty(PartyIdentification43 value) { this.tradgPty = value; } /** * Gets the value of the prtry property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the prtry property. * * <p> * For example, to add a new item, do as follows: * <pre> * getPrtry().add(newItem);
* </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link ProprietaryParty3 } * * */ public List<ProprietaryParty3> getPrtry() { if (prtry == null) { prtry = new ArrayList<ProprietaryParty3>(); } return this.prtry; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_04\TransactionParties3.java
1
请完成以下Java代码
public void setSecurityContextHolderStrategy(SecurityContextHolderStrategy strategy) { this.securityContextHolderStrategy = () -> strategy; } /** * Filter a {@code returnedObject} using the {@link PostFilter} annotation that the * {@link MethodInvocation} specifies. * @param mi the {@link MethodInvocation} to check check * @return filtered {@code returnedObject} */ @Override public @Nullable Object invoke(MethodInvocation mi) throws Throwable { Object returnedObject = mi.proceed(); ExpressionAttribute attribute = this.registry.getAttribute(mi); if (attribute == null) { return returnedObject;
} MethodSecurityExpressionHandler expressionHandler = this.registry.getExpressionHandler(); EvaluationContext ctx = expressionHandler.createEvaluationContext(this::getAuthentication, mi); return expressionHandler.filter(returnedObject, attribute.getExpression(), ctx); } private Authentication getAuthentication() { Authentication authentication = this.securityContextHolderStrategy.get().getContext().getAuthentication(); if (authentication == null) { throw new AuthenticationCredentialsNotFoundException( "An Authentication object was not found in the SecurityContext"); } return authentication; } }
repos\spring-security-main\core\src\main\java\org\springframework\security\authorization\method\PostFilterAuthorizationMethodInterceptor.java
1
请完成以下Java代码
public static int sizeUsingJava7(final Iterable data) { if (data instanceof Collection) { return ((Collection<?>) data).size(); } int counter = 0; for (final Object i : data) { counter++; } return counter; } /** * Get the size of {@code Iterable} using Java 8. * * @param data the iterable * @return the size of the iterable */ public static long sizeUsingJava8(final Iterable data) { return StreamSupport.stream(data.spliterator(), false).count(); }
/** * Get the size of {@code Iterable} using Apache Collections. * * @param data the iterable * @return the size of the iterable */ public static int sizeUsingApacheCollections(final Iterable data) { return IterableUtils.size(data); } /** * Get the size of {@code Iterable} using Google Guava. * * @param data the iterable * @return the size of the iterable */ public static int sizeUsingGoogleGuava(final Iterable data) { return Iterables.size(data); } }
repos\tutorials-master\core-java-modules\core-java-collections-2\src\main\java\com\baeldung\collections\iterablesize\IterableSize.java
1
请完成以下Java代码
public CountResultDto getUserCount(UriInfo uriInfo) { UserQueryDto queryDto = new UserQueryDto(getObjectMapper(), uriInfo.getQueryParameters()); return getUserCount(queryDto); } protected CountResultDto getUserCount(UserQueryDto queryDto) { UserQuery query = queryDto.toQuery(getProcessEngine()); long count = query.count(); return new CountResultDto(count); } @Override public void createUser(UserDto userDto) { final IdentityService identityService = getIdentityService(); if(identityService.isReadOnly()) { throw new InvalidRequestException(Status.FORBIDDEN, "Identity service implementation is read-only."); } UserProfileDto profile = userDto.getProfile(); if(profile == null || profile.getId() == null) { throw new InvalidRequestException(Status.BAD_REQUEST, "request object must provide profile information with valid id."); } User newUser = identityService.newUser(profile.getId()); profile.update(newUser); if(userDto.getCredentials() != null) { newUser.setPassword(userDto.getCredentials().getPassword()); } identityService.saveUser(newUser); } @Override public ResourceOptionsDto availableOperations(UriInfo context) { final IdentityService identityService = getIdentityService(); UriBuilder baseUriBuilder = context.getBaseUriBuilder() .path(relativeRootResourcePath) .path(UserRestService.PATH); ResourceOptionsDto resourceOptionsDto = new ResourceOptionsDto();
// GET / URI baseUri = baseUriBuilder.build(); resourceOptionsDto.addReflexiveLink(baseUri, HttpMethod.GET, "list"); // GET /count URI countUri = baseUriBuilder.clone().path("/count").build(); resourceOptionsDto.addReflexiveLink(countUri, HttpMethod.GET, "count"); // POST /create if(!identityService.isReadOnly() && isAuthorized(CREATE)) { URI createUri = baseUriBuilder.clone().path("/create").build(); resourceOptionsDto.addReflexiveLink(createUri, HttpMethod.POST, "create"); } return resourceOptionsDto; } // utility methods ////////////////////////////////////// protected IdentityService getIdentityService() { return getProcessEngine().getIdentityService(); } }
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\impl\UserRestServiceImpl.java
1
请完成以下Java代码
public List<CostElement> getActiveMaterialCostingElements(@NonNull final ClientId clientId) { return getIndexedCostElements() .streamByClientId(clientId) .filter(CostElement::isMaterial) .collect(ImmutableList.toImmutableList()); } @Override public Set<CostElementId> getActiveCostElementIds() { return getIndexedCostElements() .stream() .map(CostElement::getId) .collect(ImmutableSet.toImmutableSet()); } private Stream<CostElement> streamByCostingMethod(@NonNull final CostingMethod costingMethod) { final ClientId clientId = ClientId.ofRepoId(Env.getAD_Client_ID(Env.getCtx())); return getIndexedCostElements() .streamByClientId(clientId) .filter(ce -> ce.getCostingMethod() == costingMethod); } private static class IndexedCostElements { private final ImmutableMap<CostElementId, CostElement> costElementsById;
private IndexedCostElements(final Collection<CostElement> costElements) { costElementsById = Maps.uniqueIndex(costElements, CostElement::getId); } public Optional<CostElement> getById(final CostElementId id) { return Optional.ofNullable(costElementsById.get(id)); } public Stream<CostElement> streamByClientId(@NonNull final ClientId clientId) { return stream().filter(ce -> ClientId.equals(ce.getClientId(), clientId)); } public Stream<CostElement> streamByClientIdAndCostingMethod(@NonNull final ClientId clientId, @NonNull final CostingMethod costingMethod) { return streamByClientId(clientId).filter(ce -> costingMethod.equals(ce.getCostingMethod())); } public Stream<CostElement> stream() { return costElementsById.values().stream(); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\costing\impl\CostElementRepository.java
1
请完成以下Java代码
public String getContent() { return content; } public void setContent(final String content) { this.content = content; } public String getLanguage() { return language; } public void setLanguage(final String language) { this.language = language; } @Override public String toString() { return "News{" + "id=" + id + ", title='" + title + '\'' + ", content='" + content + '\'' + ", language=" + language + '}'; } @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final Article article = (Article) o; if (!Objects.equals(id, article.id)) {
return false; } if (!Objects.equals(title, article.title)) { return false; } if (!Objects.equals(content, article.content)) { return false; } return Objects.equals(language, article.language); } @Override public int hashCode() { int result = id != null ? id.hashCode() : 0; result = 31 * result + (title != null ? title.hashCode() : 0); result = 31 * result + (content != null ? content.hashCode() : 0); result = 31 * result + (language != null ? language.hashCode() : 0); return result; } }
repos\tutorials-master\persistence-modules\spring-data-jpa-query-3\src\main\java\com\baeldung\spring\data\jpa\spel\entity\Article.java
1
请完成以下Java代码
public Object setDynAttribute(final String attributeName, final Object value) { Check.assumeNotEmpty(attributeName, "attributeName not empty"); final int recordId = getGridTab().getRecord_ID(); Map<String, Object> dynAttributes = recordId2dynAttributes.get(recordId); if (dynAttributes == null) { dynAttributes = new HashMap<>(); recordId2dynAttributes.put(recordId, dynAttributes); } final Object valueOld = dynAttributes.put(attributeName, value); // Cleanup old entries because in most of the cases we won't use them removeOldDynAttributesEntries(recordId); // // return the old value return valueOld; } private void removeOldDynAttributesEntries(final int recordIdToKeep) { for (final Iterator<Integer> recordIds = recordId2dynAttributes.keySet().iterator(); recordIds.hasNext();) { final Integer dynAttribute_recordId = recordIds.next(); if (dynAttribute_recordId != null && dynAttribute_recordId == recordIdToKeep) { continue; }
recordIds.remove(); } } public final IModelInternalAccessor getModelInternalAccessor() { return modelInternalAccessorSupplier.get(); } public final boolean isOldValues() { return useOldValues; } public static final boolean isOldValues(final Object model) { final GridTabWrapper wrapper = getWrapper(model); return wrapper == null ? false : wrapper.isOldValues(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\adempiere\model\GridTabWrapper.java
1
请完成以下Java代码
public static InventoryLineId ofRepoId(final int repoId) { return new InventoryLineId(repoId); } public static InventoryLineId ofRepoIdOrNull(final int repoId) { return repoId > 0 ? ofRepoId(repoId) : null; } @JsonCreator @Nullable public static InventoryLineId ofNullableObject(@Nullable final Object obj) { return RepoIdAwares.ofObjectOrNull(obj, InventoryLineId.class, InventoryLineId::ofRepoIdOrNull); }
@NonNull public static InventoryLineId ofObject(@NonNull final Object obj) { return RepoIdAwares.ofObject(obj, InventoryLineId.class, InventoryLineId::ofRepoId); } @Override @JsonValue public int getRepoId() { return repoId; } public static boolean equals(@Nullable final InventoryLineId id1, @Nullable final InventoryLineId id2) {return Objects.equals(id1, id2);} }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\inventory\InventoryLineId.java
1
请完成以下Java代码
public class CompressByteArrayUtil { public static byte[] compress(byte[] input) { Deflater deflater = new Deflater(); deflater.setInput(input); deflater.finish(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; while (!deflater.finished()) { int compressedSize = deflater.deflate(buffer); outputStream.write(buffer, 0, compressedSize); } return outputStream.toByteArray(); } public static byte[] compressWithCustomLevel(byte[] input, int level) { Deflater deflater = new Deflater(); deflater.setInput(input); deflater.setLevel(level); deflater.finish(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; while (!deflater.finished()) { int compressedSize = deflater.deflate(buffer); outputStream.write(buffer, 0, compressedSize); } return outputStream.toByteArray(); } public static byte[] decompress(byte[] input) throws DataFormatException { Inflater inflater = new Inflater(); inflater.setInput(input); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; while (!inflater.finished()) {
int decompressedSize = inflater.inflate(buffer); outputStream.write(buffer, 0, decompressedSize); } return outputStream.toByteArray(); } public static void main(String[] args) throws Exception { String inputString = "Baeldung helps developers explore the Java ecosystem and simply be better engineers. " + "We publish to-the-point guides and courses, with a strong focus on building web applications, Spring, " + "Spring Security, and RESTful APIs"; byte[] input = inputString.getBytes(); // Compression byte[] compressedData = compress(input); // Decompression byte[] decompressedData = decompress(compressedData); System.out.println("Original: " + input.length + " bytes"); System.out.println("Compressed: " + compressedData.length + " bytes"); System.out.println("Decompressed: " + decompressedData.length + " bytes"); } }
repos\tutorials-master\core-java-modules\core-java-lang-7\src\main\java\com\baeldung\compressbytes\CompressByteArrayUtil.java
1
请完成以下Java代码
private final boolean hasTextToCopy() { final JTextComponent textComponent = getTextComponent(); if (textComponent == null) { return false; } // Document document = textComponent.getDocument(); // final JComboBox<?> comboBox = getComboBox(); // final ComboBoxEditor editor = comboBox.getEditor(); // comboBox.getClass().getMethod("getDisplay").invoke(comboBox); final String selectedText = textComponent.getSelectedText(); return selectedText != null && !selectedText.isEmpty(); } private final boolean isEmpty() { final JTextComponent textComponent = getTextComponent(); if (textComponent == null) { return false; } final String text = textComponent.getText(); return Check.isEmpty(text, false); } private void doCopy() { final JTextComponent textComponent = getTextComponent(); if (textComponent == null) { return; } textComponent.copy(); } private void doCut() { final JTextComponent textComponent = getTextComponent(); if (textComponent == null) { return; }
textComponent.cut(); } private void doPaste() { final JTextComponent textComponent = getTextComponent(); if (textComponent == null) { return; } textComponent.paste(); } private void doSelectAll() { final JTextComponent textComponent = getTextComponent(); if (textComponent == null) { return; } // NOTE: we need to request focus first because it seems in some case the code below is not working when the component does not have the focus. textComponent.requestFocus(); textComponent.selectAll(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ui\editor\JComboBoxCopyPasteSupportEditor.java
1
请完成以下Java代码
public int getQtyDemand_QtySupply_V_ID() { return get_ValueAsInt(COLUMNNAME_QtyDemand_QtySupply_V_ID); } @Override public void setQtyForecasted (final @Nullable BigDecimal QtyForecasted) { set_ValueNoCheck (COLUMNNAME_QtyForecasted, QtyForecasted); } @Override public BigDecimal getQtyForecasted() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyForecasted); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setQtyReserved (final @Nullable BigDecimal QtyReserved) { set_ValueNoCheck (COLUMNNAME_QtyReserved, QtyReserved); } @Override public BigDecimal getQtyReserved() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyReserved); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setQtyStock (final @Nullable BigDecimal QtyStock) { set_ValueNoCheck (COLUMNNAME_QtyStock, QtyStock); } @Override public BigDecimal getQtyStock() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyStock); return bd != null ? bd : BigDecimal.ZERO; } @Override
public void setQtyToMove (final @Nullable BigDecimal QtyToMove) { set_ValueNoCheck (COLUMNNAME_QtyToMove, QtyToMove); } @Override public BigDecimal getQtyToMove() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyToMove); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setQtyToProduce (final @Nullable BigDecimal QtyToProduce) { set_ValueNoCheck (COLUMNNAME_QtyToProduce, QtyToProduce); } @Override public BigDecimal getQtyToProduce() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyToProduce); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setQtyUnconfirmedBySupplier (final @Nullable BigDecimal QtyUnconfirmedBySupplier) { set_ValueNoCheck (COLUMNNAME_QtyUnconfirmedBySupplier, QtyUnconfirmedBySupplier); } @Override public BigDecimal getQtyUnconfirmedBySupplier() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyUnconfirmedBySupplier); return bd != null ? bd : BigDecimal.ZERO; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.material\cockpit\src\main\java-gen\de\metas\material\cockpit\model\X_QtyDemand_QtySupply_V.java
1
请在Spring Boot框架中完成以下Java代码
public String getExpDate() { return expDate; } public void setExpDate(String expDate) { this.expDate = expDate; } public String getIsDefault() { return isDefault; } public void setIsDefault(String isDefault) { this.isDefault = isDefault; } public String getIsAuth() {
return isAuth; } public void setIsAuth(String isAuth) { this.isAuth = isAuth; } public String getStatusDesc() { if (StringUtil.isEmpty(this.getStatus())) { return ""; } else { return PublicStatusEnum.getEnum(this.getStatus()).getDesc(); } } }
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\user\entity\RpUserQuickPayBankAccount.java
2
请完成以下Java代码
public long getId() { return id; } public void setId(long id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; }
public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } @Override public String toString() { return "Customer [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + "]"; } }
repos\tutorials-master\docker-modules\docker-spring-boot-postgres\src\main\java\com\baeldung\docker\Customer.java
1
请完成以下Java代码
public KafkaAdmin getAdmin() { return kafkaAdmin; } protected Properties toAdminProps() { Properties props = toProps(); props.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, servers); props.put(AdminClientConfig.RETRIES_CONFIG, retries); return props; } private Map<String, List<TbProperty>> parseTopicPropertyList(String inlineProperties) { Map<String, List<String>> grouped = PropertyUtils.getGroupedProps(inlineProperties); Map<String, List<TbProperty>> result = new HashMap<>(); grouped.forEach((topic, entries) -> {
Map<String, String> merged = new LinkedHashMap<>(); for (String entry : entries) { String[] kv = entry.split("=", 2); if (kv.length == 2) { merged.put(kv[0].trim(), kv[1].trim()); } } List<TbProperty> props = merged.entrySet().stream() .map(e -> new TbProperty(e.getKey(), e.getValue())) .toList(); result.put(topic, props); }); return result; } }
repos\thingsboard-master\common\queue\src\main\java\org\thingsboard\server\queue\kafka\TbKafkaSettings.java
1
请完成以下Java代码
public XMLGregorianCalendar getEndezeit() { return endezeit; } /** * Sets the value of the endezeit property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setEndezeit(XMLGregorianCalendar value) { this.endezeit = value; } /** * Gets the value of the hauptbestellzeit property. * * @return * possible object is * {@link VertragsdatenHauptbestellzeit } *
*/ public VertragsdatenHauptbestellzeit getHauptbestellzeit() { return hauptbestellzeit; } /** * Sets the value of the hauptbestellzeit property. * * @param value * allowed object is * {@link VertragsdatenHauptbestellzeit } * */ public void setHauptbestellzeit(VertragsdatenHauptbestellzeit value) { this.hauptbestellzeit = value; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.msv3.schema.v1\src\main\java-xjc\de\metas\vertical\pharma\vendor\gateway\msv3\schema\v1\VertragsdatenBestellfenster.java
1
请完成以下Java代码
public boolean reportException(Throwable failure) { FailureAnalysis analysis = analyze(failure, this.analyzers); return report(analysis); } private @Nullable FailureAnalysis analyze(Throwable failure, List<FailureAnalyzer> analyzers) { for (FailureAnalyzer analyzer : analyzers) { try { FailureAnalysis analysis = analyzer.analyze(failure); if (analysis != null) { return analysis; } } catch (Throwable ex) { logger.trace(LogMessage.format("FailureAnalyzer %s failed", analyzer), ex); }
} return null; } private boolean report(@Nullable FailureAnalysis analysis) { List<FailureAnalysisReporter> reporters = this.springFactoriesLoader.load(FailureAnalysisReporter.class); if (analysis == null || reporters.isEmpty()) { return false; } for (FailureAnalysisReporter reporter : reporters) { reporter.report(analysis); } return true; } }
repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\diagnostics\FailureAnalyzers.java
1
请完成以下Java代码
private IAllocationRequest createAllocationRequest(final IProductStorage productStorage) { return AllocationUtils.builder() .setHUContext(huContext) .setProduct(productStorage.getProductId()) .setQuantity(productStorage.getQty()) .setDate(getHUIterator().getDate()) .setFromReferencedModel(null) .setForceQtyAllocation(false) .create(); } @Override public Result beforeHUItemStorage(final IMutable<IHUItemStorage> itemStorage) { // don't go downstream because we don't care what's there return Result.SKIP_DOWNSTREAM; } @Override public Result afterHUItemStorage(final IHUItemStorage itemStorage) { final ZonedDateTime date = getHUIterator().getDate(); final I_M_HU_Item huItem = itemStorage.getM_HU_Item(); //noinspection UnnecessaryLocalVariable final I_M_HU_Item referenceModel = huItem; for (final IProductStorage productStorage : itemStorage.getProductStorages(date)) { final IAllocationRequest productStorageRequest = createAllocationRequest(productStorage); final IAllocationSource productStorageAsSource = new GenericAllocationSourceDestination( productStorage, huItem, referenceModel); final IAllocationResult productStorageResult = productStorageAsSource.unload(productStorageRequest); result.add(ImmutablePair.of(productStorageRequest, productStorageResult)); } return Result.CONTINUE; } }; final HUIterator iterator = new HUIterator(); iterator.setDate(huContext.getDate()); iterator.setStorageFactory(huContext.getHUStorageFactory()); iterator.setListener(huIteratorListener); iterator.iterate(hu); return result; } @Override public void unloadComplete(final IHUContext huContext) { performDestroyEmptyHUsIfNeeded(huContext); } private void performDestroyEmptyHUsIfNeeded(final IHUContext huContext) {
if (!destroyEmptyHUs) { return; } for (final I_M_HU hu : sourceHUs) { // Skip it if already destroyed if (handlingUnitsBL.isDestroyed(hu)) { continue; } handlingUnitsBL.destroyIfEmptyStorage(huContext, hu); } } private void createHUSnapshotsIfRequired(final IHUContext huContext) { if (!createHUSnapshots) { return; } // Make sure no snapshots were already created // shall not happen if (snapshotId != null) { throw new IllegalStateException("Snapshot was already created: " + snapshotId); } snapshotId = Services.get(IHUSnapshotDAO.class) .createSnapshot() .setContext(huContext) .addModels(sourceHUs) .createSnapshots() .getSnapshotId(); } public I_M_HU getSingleSourceHU() { return CollectionUtils.singleElement(sourceHUs); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\allocation\impl\HUListAllocationSourceDestination.java
1
请完成以下Java代码
public static IdentityLinkServiceConfiguration getIdentityLinkServiceConfiguration() { return getIdentityLinkServiceConfiguration(getCommandContext()); } public static IdentityLinkServiceConfiguration getIdentityLinkServiceConfiguration(CommandContext commandContext) { return getAppEngineConfiguration(commandContext).getIdentityLinkServiceConfiguration(); } public static IdentityLinkService getIdentityLinkService() { return getIdentityLinkService(getCommandContext()); } public static IdentityLinkService getIdentityLinkService(CommandContext commandContext) { return getIdentityLinkServiceConfiguration(commandContext).getIdentityLinkService(); } public static VariableServiceConfiguration getVariableServiceConfiguration() { return getVariableServiceConfiguration(getCommandContext()); } public static VariableServiceConfiguration getVariableServiceConfiguration(CommandContext commandContext) { return getAppEngineConfiguration(commandContext).getVariableServiceConfiguration(); } public static DbSqlSession getDbSqlSession() { return getDbSqlSession(getCommandContext()); } public static DbSqlSession getDbSqlSession(CommandContext commandContext) { return commandContext.getSession(DbSqlSession.class);
} public static EntityCache getEntityCache() { return getEntityCache(getCommandContext()); } public static EntityCache getEntityCache(CommandContext commandContext) { return commandContext.getSession(EntityCache.class); } public static CommandContext getCommandContext() { return Context.getCommandContext(); } }
repos\flowable-engine-main\modules\flowable-app-engine\src\main\java\org\flowable\app\engine\impl\util\CommandContextUtil.java
1
请完成以下Java代码
default void setLocaleCharsetMappings(Map<Locale, Charset> localeCharsetMappings) { getSettings().setLocaleCharsetMappings(localeCharsetMappings); } /** * Sets the init parameters that are applied to the container's * {@link ServletContext}. * @param initParameters the init parameters */ default void setInitParameters(Map<String, String> initParameters) { getSettings().setInitParameters(initParameters); } /** * Sets {@link CookieSameSiteSupplier CookieSameSiteSuppliers} that should be used to * obtain the {@link SameSite} attribute of any added cookie. This method will replace * any previously set or added suppliers. * @param cookieSameSiteSuppliers the suppliers to add * @see #addCookieSameSiteSuppliers */ default void setCookieSameSiteSuppliers(List<? extends CookieSameSiteSupplier> cookieSameSiteSuppliers) { getSettings().setCookieSameSiteSuppliers(cookieSameSiteSuppliers); }
/** * Add {@link CookieSameSiteSupplier CookieSameSiteSuppliers} to those that should be * used to obtain the {@link SameSite} attribute of any added cookie. * @param cookieSameSiteSuppliers the suppliers to add * @see #setCookieSameSiteSuppliers */ default void addCookieSameSiteSuppliers(CookieSameSiteSupplier... cookieSameSiteSuppliers) { getSettings().addCookieSameSiteSuppliers(cookieSameSiteSuppliers); } @Override default void addWebListeners(String... webListenerClassNames) { getSettings().addWebListenerClassNames(webListenerClassNames); } }
repos\spring-boot-4.0.1\module\spring-boot-web-server\src\main\java\org\springframework\boot\web\server\servlet\ConfigurableServletWebServerFactory.java
1
请完成以下Java代码
public Builder addIncludedRow(@NonNull final HUEditorRow includedRow) { if (includedRows == null) { includedRows = new ArrayList<>(); } includedRows.add(includedRow); return this; } private List<HUEditorRow> buildIncludedRows() { if (includedRows == null || includedRows.isEmpty()) { return ImmutableList.of(); } return ImmutableList.copyOf(includedRows); } public Builder setReservedForOrderLine(@Nullable final OrderLineId orderLineId) { orderLineReservation = orderLineId; huReserved = orderLineId != null; return this; } public Builder setClearanceStatus(@Nullable final JSONLookupValue clearanceStatusLookupValue) { clearanceStatus = clearanceStatusLookupValue; return this; } public Builder setCustomProcessApplyPredicate(@Nullable final BiPredicate<HUEditorRow, ProcessDescriptor> processApplyPredicate) { this.customProcessApplyPredicate = processApplyPredicate; return this; } @Nullable private BiPredicate<HUEditorRow, ProcessDescriptor> getCustomProcessApplyPredicate() { return this.customProcessApplyPredicate; }
/** * @param currentRow the row that is currently constructed using this builder */ private ImmutableMultimap<OrderLineId, HUEditorRow> prepareIncludedOrderLineReservations(@NonNull final HUEditorRow currentRow) { final ImmutableMultimap.Builder<OrderLineId, HUEditorRow> includedOrderLineReservationsBuilder = ImmutableMultimap.builder(); for (final HUEditorRow includedRow : buildIncludedRows()) { includedOrderLineReservationsBuilder.putAll(includedRow.getIncludedOrderLineReservations()); } if (orderLineReservation != null) { includedOrderLineReservationsBuilder.put(orderLineReservation, currentRow); } return includedOrderLineReservationsBuilder.build(); } } @lombok.Builder @lombok.Value public static class HUEditorRowHierarchy { @NonNull HUEditorRow cuRow; @Nullable HUEditorRow parentRow; @Nullable HUEditorRow topLevelRow; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\HUEditorRow.java
1
请完成以下Java代码
public ResponseEntity<JsonError> InvalidIdentifierException(@NonNull final InvalidIdentifierException e) { final String msg = "Invalid identifier: " + e.getMessage(); final HttpStatus status = e.getMessage().startsWith("tea") ? HttpStatus.I_AM_A_TEAPOT // whohoo, finally found a reason! : HttpStatus.NOT_FOUND; return logAndCreateError( e, msg, status); } @ExceptionHandler(DBUniqueConstraintException.class) public ResponseEntity<JsonError> handleDBUniqueConstraintException(@NonNull final DBUniqueConstraintException e) { return logAndCreateError( e, "At least one record already existed in the system:" + e.getMessage(), HttpStatus.UNPROCESSABLE_ENTITY); } @ExceptionHandler(Exception.class) public ResponseEntity<JsonError> handleException(@NonNull final Exception e) { final ResponseStatus responseStatus = e.getClass().getAnnotation(ResponseStatus.class); if (responseStatus != null) { return logAndCreateError(e, responseStatus.reason(), responseStatus.code()); } return logAndCreateError(e, HttpStatus.UNPROCESSABLE_ENTITY);
} private ResponseEntity<JsonError> logAndCreateError( @NonNull final Exception e, @NonNull final HttpStatus status) { return logAndCreateError(e, null, status); } private ResponseEntity<JsonError> logAndCreateError( @NonNull final Exception e, @Nullable final String detail, @NonNull final HttpStatus status) { final String logMessage = coalesceSuppliers( () -> detail, e::getMessage, () -> e.getClass().getSimpleName()); Loggables.withFallbackToLogger(logger, Level.ERROR).addLog(logMessage, e); final String adLanguage = Env.getADLanguageOrBaseLanguage(); final JsonError error = JsonError.builder() .error(JsonErrors.ofThrowable(e, adLanguage, TranslatableStrings.constant(detail))) .build(); return new ResponseEntity<>(error, status); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.util.web\src\main\java\de\metas\util\web\exception\RestResponseEntityExceptionHandler.java
1
请完成以下Java代码
public boolean isFullyMoved() { return !steps.isEmpty() && steps.stream().allMatch(DistributionJobStep::isDroppedToLocator); } private static WFActivityStatus computeStatusFromSteps(final @NonNull List<DistributionJobStep> steps) { return steps.isEmpty() ? WFActivityStatus.NOT_STARTED : WFActivityStatus.computeStatusFromLines(steps, DistributionJobStep::getStatus); } public DDOrderLineId getDdOrderLineId() {return id.toDDOrderLineId();} public DistributionJobLine withNewStep(final DistributionJobStep stepToAdd) { final ArrayList<DistributionJobStep> changedSteps = new ArrayList<>(this.steps); boolean added = false; boolean changed = false; for (final DistributionJobStep step : steps) { if (DistributionJobStepId.equals(step.getId(), stepToAdd.getId())) { changedSteps.add(stepToAdd); added = true; if (!Objects.equals(step, stepToAdd)) { changed = true; } } else { changedSteps.add(step); } } if (!added) { changedSteps.add(stepToAdd); changed = true; } return changed ? toBuilder().steps(ImmutableList.copyOf(changedSteps)).build() : this; }
public DistributionJobLine withChangedSteps(@NonNull final UnaryOperator<DistributionJobStep> stepMapper) { final ImmutableList<DistributionJobStep> changedSteps = CollectionUtils.map(steps, stepMapper); return changedSteps.equals(steps) ? this : toBuilder().steps(changedSteps).build(); } public DistributionJobLine removeStep(@NonNull final DistributionJobStepId stepId) { final ImmutableList<DistributionJobStep> updatedStepCollection = steps.stream() .filter(step -> !step.getId().equals(stepId)) .collect(ImmutableList.toImmutableList()); return updatedStepCollection.equals(steps) ? this : toBuilder().steps(updatedStepCollection).build(); } @NonNull public Optional<DistributionJobStep> getStepById(@NonNull final DistributionJobStepId stepId) { return getSteps().stream().filter(step -> step.getId().equals(stepId)).findFirst(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.distribution.rest-api\src\main\java\de\metas\distribution\mobileui\job\model\DistributionJobLine.java
1
请完成以下Java代码
public String getTenantId() { return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } public void forceUpdate() { this.forcedUpdate = true; } public Object getPersistentState() { Map<String, Object> persistentState = new HashMap<String, Object>(); persistentState.put("satisfied", isSatisfied()); if (forcedUpdate) { persistentState.put("forcedUpdate", Boolean.TRUE); } return persistentState; } // helper //////////////////////////////////////////////////////////////////// protected CaseExecutionEntity findCaseExecutionById(String caseExecutionId) { return Context .getCommandContext()
.getCaseExecutionManager() .findCaseExecutionById(caseExecutionId); } @Override public Set<String> getReferencedEntityIds() { Set<String> referencedEntityIds = new HashSet<String>(); return referencedEntityIds; } @Override public Map<String, Class> getReferencedEntitiesIdAndClass() { Map<String, Class> referenceIdAndClass = new HashMap<String, Class>(); if (caseExecutionId != null) { referenceIdAndClass.put(caseExecutionId, CaseExecutionEntity.class); } if (caseInstanceId != null) { referenceIdAndClass.put(caseInstanceId, CaseExecutionEntity.class); } return referenceIdAndClass; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmmn\entity\runtime\CaseSentryPartEntity.java
1
请完成以下Java代码
public String getId() { return id; } public long getInstances() { return instances; } public long getCanceled() { return canceled; } public long getFinished() { return finished; } public long getCompleteScope() { return completeScope; } public long getOpenIncidents() { return openIncidents; } public long getResolvedIncidents() { return resolvedIncidents; } public long getDeletedIncidents() { return deletedIncidents; } public static HistoricActivityStatisticsDto fromHistoricActivityStatistics(HistoricActivityStatistics statistics) {
HistoricActivityStatisticsDto result = new HistoricActivityStatisticsDto(); result.id = statistics.getId(); result.instances = statistics.getInstances(); result.canceled = statistics.getCanceled(); result.finished = statistics.getFinished(); result.completeScope = statistics.getCompleteScope(); result.openIncidents = statistics.getOpenIncidents(); result.resolvedIncidents = statistics.getResolvedIncidents(); result.deletedIncidents = statistics.getDeletedIncidents(); return result; } }
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\history\HistoricActivityStatisticsDto.java
1
请完成以下Java代码
protected Device toDevice() { Device device = new Device(new DeviceId(getUuid())); device.setCreatedTime(createdTime); device.setVersion(version); if (tenantId != null) { device.setTenantId(TenantId.fromUUID(tenantId)); } if (customerId != null) { device.setCustomerId(new CustomerId(customerId)); } if (deviceProfileId != null) { device.setDeviceProfileId(new DeviceProfileId(deviceProfileId)); } if (firmwareId != null) { device.setFirmwareId(new OtaPackageId(firmwareId));
} if (softwareId != null) { device.setSoftwareId(new OtaPackageId(softwareId)); } device.setDeviceData(JacksonUtil.convertValue(deviceData, DeviceData.class)); device.setName(name); device.setType(type); device.setLabel(label); device.setAdditionalInfo(additionalInfo); if (externalId != null) { device.setExternalId(new DeviceId(externalId)); } return device; } }
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\model\sql\AbstractDeviceEntity.java
1
请完成以下Java代码
public void handleTransportError(WebSocketSession session, Throwable exception) throws Exception { logger.info("[handleTransportError][session({}) 发生异常]", session, exception); } @Override public void afterPropertiesSet() throws Exception { // 通过 ApplicationContext 获得所有 MessageHandler Bean applicationContext.getBeansOfType(MessageHandler.class).values() // 获得所有 MessageHandler Bean .forEach(messageHandler -> HANDLERS.put(messageHandler.getType(), messageHandler)); // 添加到 handlers 中 logger.info("[afterPropertiesSet][消息处理器数量:{}]", HANDLERS.size()); } private Class<? extends Message> getMessageClass(MessageHandler handler) { // 获得 Bean 对应的 Class 类名。因为有可能被 AOP 代理过。 Class<?> targetClass = AopProxyUtils.ultimateTargetClass(handler); // 获得接口的 Type 数组 Type[] interfaces = targetClass.getGenericInterfaces(); Class<?> superclass = targetClass.getSuperclass(); while ((Objects.isNull(interfaces) || 0 == interfaces.length) && Objects.nonNull(superclass)) { // 此处,是以父类的接口为准 interfaces = superclass.getGenericInterfaces(); superclass = targetClass.getSuperclass(); } if (Objects.nonNull(interfaces)) { // 遍历 interfaces 数组 for (Type type : interfaces) { // 要求 type 是泛型参数
if (type instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) type; // 要求是 MessageHandler 接口 if (Objects.equals(parameterizedType.getRawType(), MessageHandler.class)) { Type[] actualTypeArguments = parameterizedType.getActualTypeArguments(); // 取首个元素 if (Objects.nonNull(actualTypeArguments) && actualTypeArguments.length > 0) { return (Class<Message>) actualTypeArguments[0]; } else { throw new IllegalStateException(String.format("类型(%s) 获得不到消息类型", handler)); } } } } } throw new IllegalStateException(String.format("类型(%s) 获得不到消息类型", handler)); } }
repos\SpringBoot-Labs-master\lab-25\lab-websocket-25-02\src\main\java\cn\iocoder\springboot\lab25\springwebsocket\websocket\DemoWebSocketHandler.java
1
请完成以下Java代码
public String getTextMsg () { return (String)get_Value(COLUMNNAME_TextMsg); } /** Set Valid from. @param ValidFrom Valid from including this date (first day) */ public void setValidFrom (Timestamp ValidFrom) { set_Value (COLUMNNAME_ValidFrom, ValidFrom); } /** Get Valid from. @return Valid from including this date (first day) */ public Timestamp getValidFrom () { return (Timestamp)get_Value(COLUMNNAME_ValidFrom); } /** Set Valid to. @param ValidTo
Valid to including this date (last day) */ public void setValidTo (Timestamp ValidTo) { set_Value (COLUMNNAME_ValidTo, ValidTo); } /** Get Valid to. @return Valid to including this date (last day) */ public Timestamp getValidTo () { return (Timestamp)get_Value(COLUMNNAME_ValidTo); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_HR_Attribute.java
1
请在Spring Boot框架中完成以下Java代码
public class GracefulShutdownManager implements DisposableBean { @Autowired private MQManager mqManager; @Autowired private GracefulShutdownFilter shutdownFilter; @Override public void destroy() throws Exception { // reject requests shutdownFilter.startShutdown(); // unsubscribe MQ mqManager.unsubscribeFromMQ();
// Dubbo service offline //dubboManager.unregisterDubboServices(); // Nacos service offline // nacosManager.deregisterFromNacos(); // wait all task finish waitForTasksToComplete(); } private void waitForTasksToComplete() { System.out.println("Waiting for tasks to complete..."); // use CountDownLatch or other } }
repos\springboot-demo-master\rabbitmq\src\main\java\com\et\rabbitmq\config\GracefulShutdownManager.java
2
请在Spring Boot框架中完成以下Java代码
public class TopicRabbitConfig { final static String message = "topic.message"; final static String messages = "topic.messages"; @Bean public Queue queueMessage() { return new Queue(TopicRabbitConfig.message); } @Bean public Queue queueMessages() { return new Queue(TopicRabbitConfig.messages); }
@Bean TopicExchange exchange() { return new TopicExchange("topicExchange"); } @Bean Binding bindingExchangeMessage(Queue queueMessage, TopicExchange exchange) { return BindingBuilder.bind(queueMessage).to(exchange).with("topic.message"); } @Bean Binding bindingExchangeMessages(Queue queueMessages, TopicExchange exchange) { return BindingBuilder.bind(queueMessages).to(exchange).with("topic.#"); } }
repos\spring-boot-leaning-master\1.x\第11课:RabbitMQ 详解\spring-boot-rabbitmq\src\main\java\com\neo\rabbit\TopicRabbitConfig.java
2
请在Spring Boot框架中完成以下Java代码
public BigDecimal getAmount() { return amount; } public void setAmount(BigDecimal amount) { this.amount = amount; } public InsuranceContractMaxPermanentPrescriptionPeriod timePeriod(BigDecimal timePeriod) { this.timePeriod = timePeriod; return this; } /** * Zeitintervall (Unbekannt &#x3D; 0, Minute &#x3D; 1, Stunde &#x3D; 2, Tag &#x3D; 3, Woche &#x3D; 4, Monat &#x3D; 5, Quartal &#x3D; 6, Halbjahr &#x3D; 7, Jahr &#x3D; 8) * @return timePeriod **/ @Schema(example = "6", description = "Zeitintervall (Unbekannt = 0, Minute = 1, Stunde = 2, Tag = 3, Woche = 4, Monat = 5, Quartal = 6, Halbjahr = 7, Jahr = 8)") public BigDecimal getTimePeriod() { return timePeriod; } public void setTimePeriod(BigDecimal timePeriod) { this.timePeriod = timePeriod; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } InsuranceContractMaxPermanentPrescriptionPeriod insuranceContractMaxPermanentPrescriptionPeriod = (InsuranceContractMaxPermanentPrescriptionPeriod) o; return Objects.equals(this.amount, insuranceContractMaxPermanentPrescriptionPeriod.amount) && Objects.equals(this.timePeriod, insuranceContractMaxPermanentPrescriptionPeriod.timePeriod); } @Override public int hashCode() {
return Objects.hash(amount, timePeriod); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class InsuranceContractMaxPermanentPrescriptionPeriod {\n"); sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); sb.append(" timePeriod: ").append(toIndentedString(timePeriod)).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\InsuranceContractMaxPermanentPrescriptionPeriod.java
2
请完成以下Java代码
public BigDecimal getQtyReserved () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyReserved); if (bd == null) return Env.ZERO; return bd; } /** Set Revenue Recognition Amt. @param RRAmt Revenue Recognition Amount */ public void setRRAmt (BigDecimal RRAmt) { set_Value (COLUMNNAME_RRAmt, RRAmt); } /** Get Revenue Recognition Amt. @return Revenue Recognition Amount */ public BigDecimal getRRAmt () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_RRAmt); if (bd == null) return Env.ZERO; return bd; } /** Set Revenue Recognition Start. @param RRStartDate Revenue Recognition Start Date */ public void setRRStartDate (Timestamp RRStartDate) { set_Value (COLUMNNAME_RRStartDate, RRStartDate); } /** Get Revenue Recognition Start. @return Revenue Recognition Start Date */ public Timestamp getRRStartDate () { return (Timestamp)get_Value(COLUMNNAME_RRStartDate); } public org.compiere.model.I_C_OrderLine getRef_OrderLine() throws RuntimeException { return (org.compiere.model.I_C_OrderLine)MTable.get(getCtx(), org.compiere.model.I_C_OrderLine.Table_Name) .getPO(getRef_OrderLine_ID(), get_TrxName()); } /** Set Referenced Order Line. @param Ref_OrderLine_ID Reference to corresponding Sales/Purchase Order */ public void setRef_OrderLine_ID (int Ref_OrderLine_ID) { if (Ref_OrderLine_ID < 1) set_Value (COLUMNNAME_Ref_OrderLine_ID, null);
else set_Value (COLUMNNAME_Ref_OrderLine_ID, Integer.valueOf(Ref_OrderLine_ID)); } /** Get Referenced Order Line. @return Reference to corresponding Sales/Purchase Order */ public int getRef_OrderLine_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_Ref_OrderLine_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Ressourcenzuordnung. @param S_ResourceAssignment_ID Ressourcenzuordnung */ public void setS_ResourceAssignment_ID (int S_ResourceAssignment_ID) { if (S_ResourceAssignment_ID < 1) set_Value (COLUMNNAME_S_ResourceAssignment_ID, null); else set_Value (COLUMNNAME_S_ResourceAssignment_ID, Integer.valueOf(S_ResourceAssignment_ID)); } /** Get Ressourcenzuordnung. @return Ressourcenzuordnung */ public int getS_ResourceAssignment_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_S_ResourceAssignment_ID); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\org\adempiere\model\X_RV_C_OrderLine_Overview.java
1
请完成以下Java代码
public void setDelegateAsyncAfterUpdate(AsyncAfterUpdate delegateAsyncAfterUpdate) { this.delegateAsyncAfterUpdate = delegateAsyncAfterUpdate; } /** * Delegate interface for the asyncBefore property update. */ public interface AsyncBeforeUpdate { /** * Method which is called if the asyncBefore property should be updated. * * @param asyncBefore the new value for the asyncBefore flag * @param exclusive the exclusive flag */ public void updateAsyncBefore(boolean asyncBefore, boolean exclusive);
} /** * Delegate interface for the asyncAfter property update */ public interface AsyncAfterUpdate { /** * Method which is called if the asyncAfter property should be updated. * * @param asyncAfter the new value for the asyncBefore flag * @param exclusive the exclusive flag */ public void updateAsyncAfter(boolean asyncAfter, boolean exclusive); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\pvm\process\ActivityImpl.java
1
请在Spring Boot框架中完成以下Java代码
public Integer getRiskDay() { return riskDay; } public void setRiskDay(Integer riskDay) { this.riskDay = riskDay; } public String getAuditStatusDesc() { return PublicEnum.getEnum(this.getAuditStatus()).getDesc(); } public String getFundIntoTypeDesc() { return FundInfoTypeEnum.getEnum(this.getFundIntoType()).getDesc(); }
public String getSecurityRating() { return securityRating; } public void setSecurityRating(String securityRating) { this.securityRating = securityRating; } public String getMerchantServerIp() { return merchantServerIp; } public void setMerchantServerIp(String merchantServerIp) { this.merchantServerIp = merchantServerIp; } }
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\user\entity\RpUserPayConfig.java
2
请完成以下Java代码
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
请在Spring Boot框架中完成以下Java代码
private DataImportConfigsCollection getCollection() { return cache.getOrLoad(0, this::retrieveCollection); } private DataImportConfigsCollection retrieveCollection() { final ImmutableList<DataImportConfig> configs = Services.get(IQueryBL.class) .createQueryBuilderOutOfTrx(I_C_DataImport.class) .addOnlyActiveRecordsFilter() .create() .stream() .map(record -> toDataImportConfig(record)) .collect(ImmutableList.toImmutableList()); return new DataImportConfigsCollection(configs); } private static DataImportConfig toDataImportConfig(@NonNull final I_C_DataImport record) { return DataImportConfig.builder() .id(DataImportConfigId.ofRepoId(record.getC_DataImport_ID())) .internalName(StringUtils.trimBlankToNull(record.getInternalName())) .impFormatId(ImpFormatId.ofRepoId(record.getAD_ImpFormat_ID())) .build(); } private static class DataImportConfigsCollection { private final ImmutableMap<DataImportConfigId, DataImportConfig> configsById; private final ImmutableMap<String, DataImportConfig> configsByInternalName; public DataImportConfigsCollection(final Collection<DataImportConfig> configs) { configsById = Maps.uniqueIndex(configs, DataImportConfig::getId); configsByInternalName = configs.stream() .filter(config -> config.getInternalName() != null) .collect(GuavaCollectors.toImmutableMapByKey(DataImportConfig::getInternalName));
} public DataImportConfig getById(@NonNull final DataImportConfigId id) { final DataImportConfig config = configsById.get(id); if (config == null) { throw new AdempiereException("@NotFound@ @C_DataConfig_ID@: " + id); } return config; } public Optional<DataImportConfig> getByInternalName(final String internalName) { Check.assumeNotEmpty(internalName, "internalName is not empty"); return Optional.ofNullable(configsByInternalName.get(internalName)); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\impexp\config\DataImportConfigRepository.java
2
请完成以下Java代码
public GLDistributionBuilder setCurrencyId(final CurrencyId currencyId) { _currencyId = currencyId; _precision = null; return this; } private CurrencyId getCurrencyId() { Check.assumeNotNull(_currencyId, "currencyId not null"); return _currencyId; } private CurrencyPrecision getPrecision() { if (_precision == null) { _precision = currencyDAO.getStdPrecision(getCurrencyId()); } return _precision; } public GLDistributionBuilder setAmountToDistribute(final BigDecimal amountToDistribute) { _amountToDistribute = amountToDistribute; return this; } private BigDecimal getAmountToDistribute() { Check.assumeNotNull(_amountToDistribute, "amountToDistribute not null"); return _amountToDistribute; } public GLDistributionBuilder setAmountSign(@NonNull final Sign amountSign) { _amountSign = amountSign; return this; }
private Sign getAmountSign() { Check.assumeNotNull(_amountSign, "amountSign not null"); return _amountSign; } public GLDistributionBuilder setQtyToDistribute(final BigDecimal qtyToDistribute) { _qtyToDistribute = qtyToDistribute; return this; } private BigDecimal getQtyToDistribute() { Check.assumeNotNull(_qtyToDistribute, "qtyToDistribute not null"); return _qtyToDistribute; } public GLDistributionBuilder setAccountDimension(final AccountDimension accountDimension) { _accountDimension = accountDimension; return this; } private AccountDimension getAccountDimension() { Check.assumeNotNull(_accountDimension, "_accountDimension not null"); return _accountDimension; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\gldistribution\GLDistributionBuilder.java
1
请完成以下Java代码
public static final UserPreferenceLevelConstraint forPreferenceType(@NonNull final String preferenceType) { final UserPreferenceLevelConstraint constraint = preferenceType2constraint.get(preferenceType); if (constraint == null) { throw new IllegalArgumentException("No " + UserPreferenceLevelConstraint.class + " found for " + preferenceType); } return constraint; } public static final UserPreferenceLevelConstraint CLIENT = new UserPreferenceLevelConstraint(X_AD_Role.PREFERENCETYPE_Client); public static final UserPreferenceLevelConstraint ORGANIZATION = new UserPreferenceLevelConstraint(X_AD_Role.PREFERENCETYPE_Organization); public static final UserPreferenceLevelConstraint USER = new UserPreferenceLevelConstraint(X_AD_Role.PREFERENCETYPE_User); public static final UserPreferenceLevelConstraint NONE = new UserPreferenceLevelConstraint(X_AD_Role.PREFERENCETYPE_None); private static final Map<String, UserPreferenceLevelConstraint> preferenceType2constraint = ImmutableMap.<String, UserPreferenceLevelConstraint> builder() .put(CLIENT.getPreferenceType(), CLIENT) .put(ORGANIZATION.getPreferenceType(), ORGANIZATION) .put(USER.getPreferenceType(), USER) .put(NONE.getPreferenceType(), NONE) .build(); private final String preferenceType; private UserPreferenceLevelConstraint(final String preferenceType) { Check.assumeNotEmpty(preferenceType, "preferenceType not empty"); this.preferenceType = preferenceType; } @Override public String toString() { // NOTE: we are making it translateable friendly because it's displayed in Prefereces->Info->Rollen final String preferenceTypeName; if (this == NONE) { preferenceTypeName = "@None@"; } else if (this == CLIENT) { preferenceTypeName = "@AD_Client_ID@"; } else if (this == ORGANIZATION) { preferenceTypeName = "@AD_Org_ID@"; } else if (this == USER) { preferenceTypeName = "@AD_User_ID@"; } else { // shall not happen preferenceTypeName = preferenceType; } return "@PreferenceType@: " + preferenceTypeName;
} /** @return false, i.e. never inherit this constraint because it shall be defined by current role itself */ @Override public boolean isInheritable() { return false; } /** * @return preference type (see X_AD_Role.PREFERENCETYPE_*) */ public String getPreferenceType() { return preferenceType; } /** * Show (Value) Preference Menu * * @return true if preference type is not {@link #NONE}. */ public boolean isShowPreference() { return !isNone(); } public boolean isNone() { return this == NONE; } public boolean isClient() { return this == CLIENT; } public boolean isOrganization() { return this == ORGANIZATION; } public boolean isUser() { return this == USER; } /** * * @return true if this level allows user to view table record change log (i.e. this level is {@link #CLIENT}) */ public boolean canViewRecordChangeLog() { return isClient(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\security\permissions\UserPreferenceLevelConstraint.java
1
请完成以下Java代码
public class ParseExceptionDto extends ExceptionDto { protected Map<String, ResourceReportDto> details = new HashMap<>(); // transformer ///////////////////////////// public static ParseExceptionDto fromException(ParseException exception) { ParseExceptionDto dto = new ParseExceptionDto(); dto.setType(ParseException.class.getSimpleName()); dto.setMessage(exception.getMessage()); for (ResourceReport report : exception.getResorceReports()) { List<ProblemDto> errorDtos = new ArrayList<>(); for (Problem error : report.getErrors()) { errorDtos.add(ProblemDto.fromProblem(error)); } List<ProblemDto> warningDtos = new ArrayList<>(); for (Problem warning : report.getWarnings()) { warningDtos.add(ProblemDto.fromProblem(warning));
} ResourceReportDto resourceReportDto = new ResourceReportDto(errorDtos, warningDtos); dto.details.put(report.getResourceName(), resourceReportDto); } return dto; } // getter / setters //////////////////////// public Map<String, ResourceReportDto> getDetails() { return details; } public void setDetails(Map<String, ResourceReportDto> details) { this.details = details; } }
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\ParseExceptionDto.java
1
请在Spring Boot框架中完成以下Java代码
public class JacksonCustomizations { @Bean public Module realWorldModules() { return new RealWorldModules(); } public static class RealWorldModules extends SimpleModule { public RealWorldModules() { addSerializer(DateTime.class, new DateTimeSerializer()); } } public static class DateTimeSerializer extends StdSerializer<DateTime> {
protected DateTimeSerializer() { super(DateTime.class); } @Override public void serialize(DateTime value, JsonGenerator gen, SerializerProvider provider) throws IOException { if (value == null) { gen.writeNull(); } else { gen.writeString(ISODateTimeFormat.dateTime().withZoneUTC().print(value)); } } } }
repos\spring-boot-realworld-example-app-master\src\main\java\io\spring\JacksonCustomizations.java
2
请在Spring Boot框架中完成以下Java代码
public String getOutcome() { return outcome; } public void setOutcome(String outcome) { this.outcome = outcome; } public void setVariables(List<RestVariable> variables) { this.variables = variables; } @ApiModelProperty(value = "If action is complete, you can use this parameter to set variables ") @JsonTypeInfo(use = Id.CLASS, defaultImpl = RestVariable.class) public List<RestVariable> getVariables() { return variables; } @ApiModelProperty(value = "If action is complete, you can use this parameter to set transient variables ") public List<RestVariable> getTransientVariables() {
return transientVariables; } @JsonTypeInfo(use = Id.CLASS, defaultImpl = RestVariable.class) public void setTransientVariables(List<RestVariable> transientVariables) { this.transientVariables = transientVariables; } @Override @ApiModelProperty(value = "Action to perform: Either complete, claim, delegate or resolve", example = "complete", required = true) public String getAction() { return super.getAction(); } }
repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\runtime\task\TaskActionRequest.java
2
请完成以下Java代码
public String getActivityType() { return activityType; } public void setActivityType(String activityType) { this.activityType = activityType; } public String getActivityName() { return activityName; } public void setActivityName(String activityName) { this.activityName = activityName; } @Override public String[] getIncidentIds() { return incidentIds; } public void setIncidentIds(String[] incidentIds) { this.incidentIds = incidentIds; } @Override public Incident[] getIncidents() { return incidents; }
public void setIncidents(Incident[] incidents) { this.incidents = incidents; } public void setSubProcessInstanceId(String subProcessInstanceId) { this.subProcessInstanceId = subProcessInstanceId; } public String getSubProcessInstanceId() { return subProcessInstanceId; } public String toString() { return this.getClass().getSimpleName() + "[executionId=" + executionId + ", targetActivityId=" + activityId + ", activityName=" + activityName + ", activityType=" + activityType + ", id=" + id + ", parentActivityInstanceId=" + parentActivityInstanceId + ", processInstanceId=" + processInstanceId + ", processDefinitionId=" + processDefinitionId + ", incidentIds=" + Arrays.toString(incidentIds) + ", incidents=" + Arrays.toString(incidents) + "]"; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\TransitionInstanceImpl.java
1
请完成以下Java代码
public List<Account> getAccounts() { return accountService.findAccountList(); } @RequestMapping(value = "/{id}", method = RequestMethod.GET) public Account getAccountById(@PathVariable("id") int id) { return accountService.findAccount(id); } @RequestMapping(value = "/{id}", method = RequestMethod.PUT) public String updateAccount(@PathVariable("id") int id, @RequestParam(value = "name", required = true) String name, @RequestParam(value = "money", required = true) double money) { int t= accountService.update(name,money,id); if(t==1) { return "success"; }else { return "fail"; } } @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) public String delete(@PathVariable(value = "id")int id) { int t= accountService.delete(id); if(t==1) { return "success"; }else { return "fail"; } }
@RequestMapping(value = "", method = RequestMethod.POST) public String postAccount(@RequestParam(value = "name") String name, @RequestParam(value = "money") double money) { int t= accountService.add(name,money); if(t==1) { return "success"; }else { return "fail"; } } }
repos\SpringBootLearning-master\springboot-mybatis-tx\src\main\java\com\forezp\web\AccountController.java
1
请完成以下Java代码
public static void registerType(ModelBuilder modelBuilder) { ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Font.class, DC_ELEMENT_FONT) .namespaceUri(DC_NS) .instanceProvider(new ModelTypeInstanceProvider<Font>() { public Font newInstance(ModelTypeInstanceContext instanceContext) { return new FontImpl(instanceContext); } }); nameAttribute = typeBuilder.stringAttribute(DC_ATTRIBUTE_NAME) .build(); sizeAttribute = typeBuilder.doubleAttribute(DC_ATTRIBUTE_SIZE) .build(); isBoldAttribute = typeBuilder.booleanAttribute(DC_ATTRIBUTE_IS_BOLD) .build(); isItalicAttribute = typeBuilder.booleanAttribute(DC_ATTRIBUTE_IS_ITALIC) .build(); isUnderlineAttribute = typeBuilder.booleanAttribute(DC_ATTRIBUTE_IS_UNDERLINE) .build(); isStrikeTroughAttribute = typeBuilder.booleanAttribute(DC_ATTRIBUTE_IS_STRIKE_THROUGH) .build(); typeBuilder.build(); } public FontImpl(ModelTypeInstanceContext instanceContext) { super(instanceContext); } public String getName() { return nameAttribute.getValue(this); } public void setName(String name) { nameAttribute.setValue(this, name); } public Double getSize() { return sizeAttribute.getValue(this); } public void setSize(Double size) { sizeAttribute.setValue(this, size); } public Boolean isBold() { return isBoldAttribute.getValue(this); }
public void setBold(boolean isBold) { isBoldAttribute.setValue(this, isBold); } public Boolean isItalic() { return isItalicAttribute.getValue(this); } public void setItalic(boolean isItalic) { isItalicAttribute.setValue(this, isItalic); } public Boolean isUnderline() { return isUnderlineAttribute.getValue(this); } public void SetUnderline(boolean isUnderline) { isUnderlineAttribute.setValue(this, isUnderline); } public Boolean isStrikeThrough() { return isStrikeTroughAttribute.getValue(this); } public void setStrikeTrough(boolean isStrikeTrough) { isStrikeTroughAttribute.setValue(this, isStrikeTrough); } }
repos\camunda-bpm-platform-master\model-api\bpmn-model\src\main\java\org\camunda\bpm\model\bpmn\impl\instance\dc\FontImpl.java
1
请完成以下Java代码
public class DemoWorkflowImpl implements DemoWorkflow { private List<CloudEvent> eventList = new ArrayList<>(); private DemoActivities demoActivities = Workflow.newActivityStub(DemoActivities.class, ActivityOptions.newBuilder() .setStartToCloseTimeout(Duration.ofSeconds(2)) .build()); @Override // WorkflowMethod public CloudEvent exec(CloudEvent cloudEvent) { eventList.add(cloudEvent); demoActivities.before(cloudEvent); // wait for second event Workflow.await(() -> eventList.size() == 2); demoActivities.after(cloudEvent); // return demo result CE ObjectMapper mapper = new ObjectMapper(); JsonNode node = mapper.createObjectNode(); ((ObjectNode)node).putArray("events"); for(CloudEvent c : eventList) { ((ArrayNode)node.get("events")).add(c.getId()); } ((ObjectNode)node).put("outcome", "done"); return CloudEventBuilder.v1()
.withId(String.valueOf(Workflow.newRandom().nextInt(1000 - 1 + 1) + 1)) .withType("example.demo.result") .withSource(URI.create("http://temporal.io")) .withData( "application/json", node.toPrettyString().getBytes(StandardCharsets.UTF_8)) .build(); } @Override // SignalMethod public void addEvent(CloudEvent cloudEvent) { eventList.add(cloudEvent); } @Override // QueryMethod public CloudEvent getLastEvent() { if (eventList == null || eventList.isEmpty()) { return null; } return eventList.get(eventList.size() - 1); } }
repos\spring-boot-demo-main\src\main\java\com\temporal\demos\temporalspringbootdemo\workflows\DemoWorkflowImpl.java
1
请完成以下Java代码
public class UiExtensionsScanner { private static final Logger log = LoggerFactory.getLogger(UiExtensionsScanner.class); private final ResourcePatternResolver resolver; public UiExtensionsScanner(ResourcePatternResolver resolver) { this.resolver = resolver; } public UiExtensions scan(String... locations) throws IOException { List<UiExtension> extensions = new ArrayList<>(); for (String location : locations) { for (Resource resource : resolveAssets(location)) { String resourcePath = this.getResourcePath(location, resource); if (resourcePath != null && resource.isReadable()) { UiExtension extension = new UiExtension(resourcePath, location + resourcePath); log.debug("Found UiExtension {}", extension); extensions.add(extension); } } } return new UiExtensions(extensions); } private List<Resource> resolveAssets(String location) throws IOException { String widerLocation = toPattern(location); return Stream .concat(Arrays.stream(this.resolver.getResources(widerLocation + "**/*.js")), Arrays.stream(this.resolver.getResources(widerLocation + "**/*.css"))) .toList();
} private String toPattern(String location) { // replace the classpath pattern to search all locations and not just the first return location.replace("classpath:", "classpath*:"); } @Nullable private String getResourcePath(String location, Resource resource) throws IOException { String locationWithoutPrefix = location.replaceFirst("^[^:]+:", ""); Matcher m = Pattern.compile(Pattern.quote(locationWithoutPrefix) + "(.+)$") .matcher(resource.getURI().toString()); if (m.find()) { return m.group(1); } else { return null; } } }
repos\spring-boot-admin-master\spring-boot-admin-server-ui\src\main\java\de\codecentric\boot\admin\server\ui\extensions\UiExtensionsScanner.java
1
请完成以下Java代码
public void setIsOwned (boolean IsOwned) { set_Value (COLUMNNAME_IsOwned, Boolean.valueOf(IsOwned)); } /** Get Owned. @return The asset is owned by the organization */ public boolean isOwned () { Object oo = get_Value(COLUMNNAME_IsOwned); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Track Issues. @param IsTrackIssues Enable tracking issues for this asset */ public void setIsTrackIssues (boolean IsTrackIssues) { set_Value (COLUMNNAME_IsTrackIssues, Boolean.valueOf(IsTrackIssues)); } /** Get Track Issues. @return Enable tracking issues for this asset */ public boolean isTrackIssues () { Object oo = get_Value(COLUMNNAME_IsTrackIssues); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
return "Y".equals(oo); } return false; } /** 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); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_A_Asset_Group.java
1
请完成以下Java代码
public List<String> getProcessInstanceIds() { return processInstanceIds; } public void setProcessInstanceIds(List<String> processInstanceIds) { this.processInstanceIds = processInstanceIds; } public ProcessInstanceQueryDto getProcessInstanceQuery() { return processInstanceQuery; } public void setProcessInstanceQuery(ProcessInstanceQueryDto processInstanceQuery) { this.processInstanceQuery = processInstanceQuery; } public String getDeleteReason() { return deleteReason; } public void setDeleteReason(String deleteReason) { this.deleteReason = deleteReason; } public boolean isSkipCustomListeners() { return skipCustomListeners; } public void setSkipCustomListeners(boolean skipCustomListeners) { this.skipCustomListeners = skipCustomListeners; }
public void setHistoricProcessInstanceQuery(HistoricProcessInstanceQueryDto historicProcessInstanceQuery) { this.historicProcessInstanceQuery = historicProcessInstanceQuery; } public HistoricProcessInstanceQueryDto getHistoricProcessInstanceQuery() { return historicProcessInstanceQuery; } public boolean isSkipSubprocesses() { return skipSubprocesses; } public void setSkipSubprocesses(Boolean skipSubprocesses) { this.skipSubprocesses = skipSubprocesses; } public boolean isSkipIoMappings() { return skipIoMappings; } public void setSkipIoMappings(boolean skipIoMappings) { this.skipIoMappings = skipIoMappings; } }
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\runtime\batch\DeleteProcessInstancesDto.java
1
请完成以下Java代码
public Object getValue() { return m_value; } // getValue private AttributeSetInstanceId getAttributeSetInstanceId() { final Object valueObj = getValue(); if (valueObj == null || (valueObj.getClass().equals(Object.class)) // initial value ) { return AttributeSetInstanceId.NONE; } if (valueObj instanceof Number) { final int asiId = ((Number)valueObj).intValue(); return AttributeSetInstanceId.ofRepoIdOrNone(asiId); } log.warn("Invalid M_AttributeSetInstance_ID value '{}'. Returning {}.", valueObj, AttributeConstants.M_AttributeSetInstance_ID_None); return AttributeSetInstanceId.NONE; } @Override public String getDisplay() { return m_text.getText(); } // getDisplay @Override public void setField(final GridField mField) { // To determine behavior m_GridField = mField; m_mField = mField; // if (m_mField != null) // FieldRecordInfo.addMenu(this, popupMenu); // // (re)Initialize our attribute context because we want to make sure // it is using exactly the same context as the GridField it is using when it's exporting the values to context. // If we are not doing this it might be (in some cases) that different contexts are used // (e.g. process parameters panel, when using Product Attribute field won't find the M_Product_ID because it's in a different context instance) // For more info, see 08723. if (mField != null) { attributeContext = VPAttributeWindowContext.of(mField); } EditorContextPopupMenu.onGridFieldSet(this); } // setField @Override public GridField getField() { return m_mField; } private String getTableName() { final GridField gridField = getField(); return gridField == null ? null : gridField.getTableName(); } private int getAD_Column_ID() { final GridField gridField = getField(); return gridField == null ? -1 : gridField.getAD_Column_ID(); } @Override public void addActionListener(final ActionListener listener)
{ } // addActionListener @Override public void actionPerformed(final ActionEvent e) { try { if (e.getSource() == m_button) { actionButton(); } } catch (final Exception ex) { Services.get(IClientUI.class).error(attributeContext.getWindowNo(), ex); } } // actionPerformed private void actionButton() { if (!m_button.isEnabled()) { return; } throw new UnsupportedOperationException(); } @Override public void propertyChange(final PropertyChangeEvent evt) { final String propertyName = evt.getPropertyName(); if (propertyName.equals(org.compiere.model.GridField.PROPERTY)) { setValue(evt.getNewValue()); } else if (propertyName.equals(org.compiere.model.GridField.REQUEST_FOCUS)) { requestFocus(); } } @Override public boolean isAutoCommit() { return true; } @Override public void addMouseListener(final MouseListener l) { m_text.addMouseListener(l); } } // VPAttribute
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\grid\ed\VPAttribute.java
1
请完成以下Java代码
public void add(final K key, final V value) { List<V> values = map.get(key); if (values == null) { values = newValuesList(); map.put(key, values); } values.add(value); } protected List<V> newValuesList() { return new ArrayList<V>(); } /** * Set the given single value under the given key. * * @param key the key * @param value the value to set */ public void set(final K key, final V value) { List<V> values = map.get(key); if (values == null) { values = new ArrayList<V>(); map.put(key, values); } else { values.clear(); } values.add(value); } @Override public List<V> remove(final Object key) { return map.remove(key);
} @Override public void putAll(Map<? extends K, ? extends List<V>> m) { map.putAll(m); } @Override public void clear() { map.clear(); } @Override public Set<K> keySet() { return map.keySet(); } @Override public Collection<List<V>> values() { return map.values(); } @Override public Set<Map.Entry<K, List<V>>> entrySet() { return map.entrySet(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\de\metas\util\collections\MultiValueMap.java
1
请完成以下Java代码
public static MaxEntModel create(ByteArray byteArray) { MaxEntModel m = new MaxEntModel(); m.correctionConstant = byteArray.nextInt(); // correctionConstant m.correctionParam = byteArray.nextDouble(); // getCorrectionParameter // label int numOutcomes = byteArray.nextInt(); String[] outcomeLabels = new String[numOutcomes]; m.outcomeNames = outcomeLabels; for (int i = 0; i < numOutcomes; i++) outcomeLabels[i] = byteArray.nextString(); // pattern int numOCTypes = byteArray.nextInt(); int[][] outcomePatterns = new int[numOCTypes][]; for (int i = 0; i < numOCTypes; i++) { int length = byteArray.nextInt(); int[] infoInts = new int[length]; for (int j = 0; j < length; j++) { infoInts[j] = byteArray.nextInt(); } outcomePatterns[i] = infoInts; } // feature int NUM_PREDS = byteArray.nextInt(); String[] predLabels = new String[NUM_PREDS]; m.pmap = new DoubleArrayTrie<Integer>(); for (int i = 0; i < NUM_PREDS; i++) { predLabels[i] = byteArray.nextString(); } Integer[] v = new Integer[NUM_PREDS]; for (int i = 0; i < v.length; i++) { v[i] = byteArray.nextInt(); } m.pmap.load(byteArray, v); // params Context[] params = new Context[NUM_PREDS]; int pid = 0; for (int i = 0; i < outcomePatterns.length; i++) { int[] outcomePattern = new int[outcomePatterns[i].length - 1]; for (int k = 1; k < outcomePatterns[i].length; k++) { outcomePattern[k - 1] = outcomePatterns[i][k]; } for (int j = 0; j < outcomePatterns[i][0]; j++) {
double[] contextParameters = new double[outcomePatterns[i].length - 1]; for (int k = 1; k < outcomePatterns[i].length; k++) { contextParameters[k - 1] = byteArray.nextDouble(); } params[pid] = new Context(outcomePattern, contextParameters); pid++; } } // prior m.prior = new UniformPrior(); m.prior.setLabels(outcomeLabels); // eval m.evalParams = new EvalParameters(params, m.correctionParam, m.correctionConstant, outcomeLabels.length); return m; } /** * 加载最大熵模型<br> * 如果存在缓存的话,优先读取缓存,否则读取txt,并且建立缓存 * @param txtPath txt的路径,即使不存在.txt,只存在.bin,也应传入txt的路径,方法内部会自动加.bin后缀 * @return */ public static MaxEntModel load(String txtPath) { ByteArray byteArray = ByteArray.createByteArray(txtPath + Predefine.BIN_EXT); if (byteArray != null) return create(byteArray); return create(txtPath); } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\model\maxent\MaxEntModel.java
1
请完成以下Java代码
public void ensureOneContract(@NonNull final I_C_Flatrate_Term term) { ensureOneContractOfGivenType(term); } @DocValidate(timings = ModelValidator.TIMING_BEFORE_COMPLETE) public void ensureOneContractBeforeComplete(@NonNull final I_C_Flatrate_Term term) { ensureOneContractOfGivenType(term); } private void ensureOneContractOfGivenType(@NonNull final I_C_Flatrate_Term term) { flatrateBL.ensureOneContractOfGivenType(term, TypeConditions.MARGIN_COMMISSION); final TypeConditions contractType = TypeConditions.ofCode(term.getType_Conditions()); switch (contractType) { case MEDIATED_COMMISSION: case MARGIN_COMMISSION: case LICENSE_FEE: flatrateBL.ensureOneContractOfGivenType(term, contractType);
default: logger.debug("Skipping ensureOneContractOfGivenType check for 'Type_Conditions' =" + contractType); } } @DocValidate(timings = { ModelValidator.TIMING_BEFORE_COMPLETE }) public void setC_Flatrate_Term_Master(@NonNull final I_C_Flatrate_Term term) { if (term.getC_Flatrate_Term_Master_ID() <= 0) { final I_C_Flatrate_Term ancestor = flatrateDAO.retrieveAncestorFlatrateTerm(term); if (ancestor == null) { term.setC_Flatrate_Term_Master_ID(term.getC_Flatrate_Term_ID()); } } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\interceptor\C_Flatrate_Term.java
1
请完成以下Java代码
public class Article { private UUID id; private String title; private String content; private Date createdAt; private Area area; public Area getArea() { return area; } public void setArea(Area area) { this.area = area; } public Date getCreatedAt() { return createdAt; } public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; } public UUID getId() { return id; } public void setId(UUID id) { this.id = id;
} public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } }
repos\tutorials-master\json-modules\json-2\src\main\java\com\baeldung\jsonschemageneration\simple\Article.java
1
请完成以下Java代码
public class R_Request { @CalloutMethod(columnNames = I_R_Request.COLUMNNAME_R_MailText_ID) public void onR_MailText_ID(final I_R_Request request, final ICalloutField calloutField) { final MailTemplateId mailTemplateId = MailTemplateId.ofRepoIdOrNull(request.getR_MailText_ID()); if (mailTemplateId == null) { return; } final MailService mailService = Adempiere.getBean(MailService.class); final MailTextBuilder mailTextBuilder = mailService.newMailTextBuilder(mailTemplateId); final UserId contactId = UserId.ofRepoIdOrNull(request.getAD_User_ID()); if (contactId != null) { final I_AD_User contact = Services.get(IUserDAO.class).getById(contactId); mailTextBuilder.bpartnerContact(contact); } final BPartnerId bpartnerId = BPartnerId.ofRepoIdOrNull(request.getC_BPartner_ID()); if (bpartnerId != null) { final I_C_BPartner bpartner = Services.get(IBPartnerDAO.class).getById(bpartnerId); mailTextBuilder.bpartner(bpartner); } final Properties ctx = calloutField.getCtx(); String txt = mailTextBuilder.getMailText(); txt = Env.parseContext(ctx, calloutField.getWindowNo(), txt, false, true); request.setResult(txt); } @CalloutMethod(columnNames = I_R_Request.COLUMNNAME_R_StandardResponse_ID)
public void onR_StandardResponse_ID(final I_R_Request request, final ICalloutField calloutField) { final I_R_StandardResponse standardResponse = request.getR_StandardResponse(); if (standardResponse == null) { return; } String txt = standardResponse.getResponseText(); txt = Env.parseContext(calloutField.getCtx(), calloutField.getWindowNo(), txt, false, true); request.setResult(txt); } @CalloutMethod(columnNames = I_R_Request.COLUMNNAME_R_RequestType_ID) public void onR_RequestType_ID(final I_R_Request request) { request.setR_Status(null); final int R_RequestType_ID = request.getR_RequestType_ID(); if (R_RequestType_ID <= 0) { return; } final Properties ctx = InterfaceWrapperHelper.getCtx(request); final MRequestType requestType = MRequestType.get(ctx, R_RequestType_ID); final int R_Status_ID = requestType.getDefaultR_Status_ID(); if (R_Status_ID > 0) { request.setR_Status_ID(R_Status_ID); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\request\callout\R_Request.java
1
请完成以下Java代码
public String getPayloadExtractorDelegateExpression() { return payloadExtractorDelegateExpression; } public void setPayloadExtractorDelegateExpression(String payloadExtractorDelegateExpression) { this.payloadExtractorDelegateExpression = payloadExtractorDelegateExpression; } public String getHeaderExtractorDelegateExpression() { return headerExtractorDelegateExpression; } public void setHeaderExtractorDelegateExpression(String headerExtractorDelegateExpression) { this.headerExtractorDelegateExpression = headerExtractorDelegateExpression; } public String getEventTransformerDelegateExpression() { return eventTransformerDelegateExpression; } public void setEventTransformerDelegateExpression(String eventTransformerDelegateExpression) { this.eventTransformerDelegateExpression = eventTransformerDelegateExpression; } public String getPipelineDelegateExpression() { return pipelineDelegateExpression; } public void setPipelineDelegateExpression(String pipelineDelegateExpression) { this.pipelineDelegateExpression = pipelineDelegateExpression; } public ChannelEventKeyDetection getChannelEventKeyDetection() { return channelEventKeyDetection; } public void setChannelEventKeyDetection(ChannelEventKeyDetection channelEventKeyDetection) { this.channelEventKeyDetection = channelEventKeyDetection; } public ChannelEventTenantIdDetection getChannelEventTenantIdDetection() { return channelEventTenantIdDetection; } public void setChannelEventTenantIdDetection(ChannelEventTenantIdDetection channelEventTenantIdDetection) {
this.channelEventTenantIdDetection = channelEventTenantIdDetection; } public Object getInboundEventProcessingPipeline() { return inboundEventProcessingPipeline; } public void setInboundEventProcessingPipeline(Object inboundEventProcessingPipeline) { this.inboundEventProcessingPipeline = inboundEventProcessingPipeline; } public Object getInboundEventChannelAdapter() { return inboundEventChannelAdapter; } public void setInboundEventChannelAdapter(Object inboundEventChannelAdapter) { this.inboundEventChannelAdapter = inboundEventChannelAdapter; } }
repos\flowable-engine-main\modules\flowable-event-registry-model\src\main\java\org\flowable\eventregistry\model\InboundChannelModel.java
1
请完成以下Java代码
public Class< ? > getCommonPropertyType(ELContext context, Object base) { return getWrappedResolver().getCommonPropertyType(wrapContext(context), base); } @Override public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) { return getWrappedResolver().getFeatureDescriptors(wrapContext(context), base); } @Override public Class< ? > getType(ELContext context, Object base, Object property) { return getWrappedResolver().getType(wrapContext(context), base, property); } @Override public Object getValue(ELContext context, Object base, Object property) { //we need to resolve a bean only for the first "member" of expression, e.g. bean.property1.property2 if (base == null) { Object result = ProgrammaticBeanLookup.lookup(property.toString(), getBeanManager()); if (result != null) { context.setPropertyResolved(true); } return result; } else { return null; } } @Override public boolean isReadOnly(ELContext context, Object base, Object property) { return getWrappedResolver().isReadOnly(wrapContext(context), base, property); }
@Override public void setValue(ELContext context, Object base, Object property, Object value) { getWrappedResolver().setValue(wrapContext(context), base, property, value); } @Override public Object invoke(ELContext context, Object base, Object method, java.lang.Class< ? >[] paramTypes, Object[] params) { return getWrappedResolver().invoke(wrapContext(context), base, method, paramTypes, params); } protected javax.el.ELContext wrapContext(ELContext context) { return new ElContextDelegate(context, getWrappedResolver()); } }
repos\camunda-bpm-platform-master\engine-cdi\core\src\main\java\org\camunda\bpm\engine\cdi\impl\el\CdiResolver.java
1
请完成以下Java代码
protected boolean beforeDelete() { if (isPosted()) { MPeriod.testPeriodOpen(getCtx(), getDateTrx(), DocBaseType.MatchPO, getAD_Org_ID()); setPosted(false); Services.get(IFactAcctDAO.class).deleteForDocumentModel(this); } final ICostingService costDetailService = Adempiere.getBean(ICostingService.class); costDetailService.voidAndDeleteForDocument(CostingDocumentRef.ofMatchPOId(getM_MatchPO_ID())); return true; } @Override protected boolean afterDelete(final boolean success) { if (!success) { return success; } // Order Delivered/Invoiced // (Reserved in VMatch and MInOut.completeIt) final I_C_OrderLine orderLine = getC_OrderLine(); if (orderLine != null) { if (getM_InOutLine_ID() > 0) {
orderLine.setQtyDelivered(orderLine.getQtyDelivered().subtract(getQty())); } if (getC_InvoiceLine_ID() > 0) { orderLine.setQtyInvoiced(orderLine.getQtyInvoiced().subtract(getQty())); } InterfaceWrapperHelper.save(orderLine); } return true; } @Override public String toString() { return new StringBuilder("MMatchPO[") .append(getM_MatchPO_ID()) .append(",Qty=").append(getQty()) .append(",C_OrderLine_ID=").append(getC_OrderLine_ID()) .append(",M_InOutLine_ID=").append(getM_InOutLine_ID()) .append(",C_InvoiceLine_ID=").append(getC_InvoiceLine_ID()) .append("]") .toString(); } } // MMatchPO
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\MMatchPO.java
1
请完成以下Java代码
boolean empty() { return (_size == 0); } /** * 缓冲区大小 * @return 大小 */ int size() { return _size; } /** * 清空缓存 */ void clear() { resize(0); _buf = null; _size = 0; _capacity = 0; } /** * 在末尾加一个值 * @param value 值 */ void add(byte value) { if (_size == _capacity) { resizeBuf(_size + 1); } _buf[_size++] = value; } /** * 将最后一个值去掉 */ void deleteLast() { --_size; } /** * 重设大小 * @param size 大小 */ void resize(int size) { if (size > _capacity) { resizeBuf(size); } _size = size; } /** * 重设大小,并且在末尾加一个值 * @param size 大小 * @param value 值 */ void resize(int size, byte value) { if (size > _capacity)
{ resizeBuf(size); } while (_size < size) { _buf[_size++] = value; } } /** * 增加容量 * @param size 容量 */ void reserve(int size) { if (size > _capacity) { resizeBuf(size); } } /** * 设置缓冲区大小 * @param size 大小 */ private void resizeBuf(int size) { int capacity; if (size >= _capacity * 2) { capacity = size; } else { capacity = 1; while (capacity < size) { capacity <<= 1; } } byte[] buf = new byte[capacity]; if (_size > 0) { System.arraycopy(_buf, 0, buf, 0, _size); } _buf = buf; _capacity = capacity; } /** * 缓冲区 */ private byte[] _buf; /** * 大小 */ private int _size; /** * 容量 */ private int _capacity; }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\collection\dartsclone\details\AutoBytePool.java
1
请完成以下Java代码
public static char getDefaultBeginEndModifier() { return begin_end_modifier; } /** What the end modifier should be */ public static char getDefaultEndEndModifier() { return end_end_modifier; } /* What character should we use for quoting attributes. */ public static char getDefaultAttributeQuoteChar() { return attribute_quote_char; } /* Should we wrap quotes around an attribute? */ public static boolean getDefaultAttributeQuote() { return attribute_quote; } /** Does this element need a closing tag? */ public static boolean getDefaultEndElement() { return end_element; } /** What codeset are we going to use the default is 8859_1 */ public static String getDefaultCodeset() { return codeset; } /** position of tag relative to start and end. */ public static int getDefaultPosition() {
return position; } /** Default value to set case type */ public static int getDefaultCaseType() { return case_type; } public static char getDefaultStartTag() { return start_tag; } public static char getDefaultEndTag() { return end_tag; } /** Should we print html in a more readable format? */ public static boolean getDefaultPrettyPrint() { return pretty_print; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\tools\src\main\java-legacy\org\apache\ecs\ECSDefaults.java
1
请完成以下Java代码
public Object getParameterValue(final int index, final boolean returnValueTo) { return null; } @Override public String[] getWhereClauses(final List<Object> params) { return new String[0]; } @Override public String getText() { return null; } @Override public void save(final Properties ctx, final int windowNo, final IInfoWindowGridRowBuilders builders) { for (final IHUPackingAware record : packingInfos.values()) { // We need to create a key that depends on both the product and the PIIP. // Note that we assume that both columns are read-only and therefore won't change! // Keep in sync with the other controllers in this package! // It's 1:17am, it has to be rolled out tomorrow and i *won't* make it any nicer tonight. // Future generations will have to live with this shit or rewrite it. final int recordId = new HashCodeBuilder() .append(record.getM_Product_ID()) .append(record.getM_HU_PI_Item_Product_ID()) .toHashCode(); final OrderLineHUPackingGridRowBuilder builder = new OrderLineHUPackingGridRowBuilder(); builder.setSource(record); builders.addGridTabRowBuilder(recordId, builder); } } /** * Gets existing {@link IHUPackingAware} record for given row (wrapped as IHUPackingAware) or null. * * @param rowIndexModel * @return {@link IHUPackingAware} or null */ private IHUPackingAware getSavedHUPackingAware(final IHUPackingAware rowRecord) { final ArrayKey key = mkKey(rowRecord); return packingInfos.get(key);
} @Override public void prepareEditor(final CEditor editor, final Object value, final int rowIndexModel, final int columnIndexModel) { // nothing } @Override public String getProductCombinations() { final List<Integer> piItemProductIds = new ArrayList<Integer>(); for (final IHUPackingAware record : packingInfos.values()) { piItemProductIds.add(record.getM_HU_PI_Item_Product_ID()); } if (!piItemProductIds.isEmpty() && piItemProductIds != null) { final StringBuilder sb = new StringBuilder(piItemProductIds.get(0).toString()); for (int i = 1; i < piItemProductIds.size(); i++) { sb.append(", " + piItemProductIds.get(i).toString()); } return " AND (" + M_HU_PI_Item_Product_table_alias + "." + I_M_HU_PI_Item_Product.COLUMNNAME_M_HU_PI_Item_Product_ID + " IN " + " ( " + sb + " ) " + " OR " + M_HU_PI_Item_Product_table_alias + "." + I_M_HU_PI_Item_Product.COLUMNNAME_M_HU_PI_Item_Product_ID + " IS NULL" + ") "; } return null; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\adempiere\gui\search\InfoProductQtyPacksController.java
1
请在Spring Boot框架中完成以下Java代码
public void setDTEXT1(DTEXT1 value) { this.dtext1 = value; } /** * Gets the value of the dpric1 property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the dpric1 property. * * <p> * For example, to add a new item, do as follows: * <pre> * getDPRIC1().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link DPRIC1 } * * */ public List<DPRIC1> getDPRIC1() { if (dpric1 == null) { dpric1 = new ArrayList<DPRIC1>(); } return this.dpric1; } /** * Gets the value of the drefe1 property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the drefe1 property. * * <p> * For example, to add a new item, do as follows: * <pre> * getDREFE1().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link DREFE1 } * * */ public List<DREFE1> getDREFE1() { if (drefe1 == null) { drefe1 = new ArrayList<DREFE1>(); } return this.drefe1;
} /** * Gets the value of the dtaxi1 property. * * @return * possible object is * {@link DTAXI1 } * */ public DTAXI1 getDTAXI1() { return dtaxi1; } /** * Sets the value of the dtaxi1 property. * * @param value * allowed object is * {@link DTAXI1 } * */ public void setDTAXI1(DTAXI1 value) { this.dtaxi1 = value; } /** * Gets the value of the dalch1 property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the dalch1 property. * * <p> * For example, to add a new item, do as follows: * <pre> * getDALCH1().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link DALCH1 } * * */ public List<DALCH1> getDALCH1() { if (dalch1 == null) { dalch1 = new ArrayList<DALCH1>(); } return this.dalch1; } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_stepcom_invoic\de\metas\edi\esb\jaxb\stepcom\invoic\DETAILXrech.java
2
请在Spring Boot框架中完成以下Java代码
public class ExternalSystemOtherConfigRepository { private final IQueryBL queryBL = Services.get(IQueryBL.class); @NonNull public ExternalSystemOtherConfig getById(@NonNull final ExternalSystemOtherConfigId externalSystemOtherConfigId) { final List<ExternalSystemOtherConfigParameter> parameters = queryBL.createQueryBuilder(I_ExternalSystem_Other_ConfigParameter.class) .addOnlyActiveRecordsFilter() .addEqualsFilter(I_ExternalSystem_Other_ConfigParameter.COLUMNNAME_ExternalSystem_Config_ID, externalSystemOtherConfigId.getRepoId()) .create() .list() .stream() .map(this::recordToParameterModel) .collect(ImmutableList.toImmutableList()); return ExternalSystemOtherConfig.builder()
.id(externalSystemOtherConfigId) .parameters(parameters) .build(); } @NonNull private ExternalSystemOtherConfigParameter recordToParameterModel(@NonNull final I_ExternalSystem_Other_ConfigParameter configParameter) { return ExternalSystemOtherConfigParameter.builder() .id(ExternalSystemOtherConfigParameterId.ofRepoId(configParameter.getExternalSystem_Other_ConfigParameter_ID())) .name(configParameter.getName()) .value(configParameter.getValue()) .build(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java\de\metas\externalsystem\other\ExternalSystemOtherConfigRepository.java
2
请完成以下Java代码
public class FeelTypedVariableMapper extends VariableMapper { public static final FeelEngineLogger LOG = FeelLogger.ENGINE_LOGGER; protected ExpressionFactory expressionFactory; protected VariableContext variableContext; public FeelTypedVariableMapper(ExpressionFactory expressionFactory, VariableContext variableContext) { this.expressionFactory = expressionFactory; this.variableContext = variableContext; } public ValueExpression resolveVariable(String variable) { if (variableContext.containsVariable(variable)) { Object value = unpackVariable(variable); return expressionFactory.createValueExpression(value, Object.class); } else { throw LOG.unknownVariable(variable); }
} public ValueExpression setVariable(String variable, ValueExpression expression) { throw LOG.variableMapperIsReadOnly(); } public Object unpackVariable(String variable) { TypedValue valueTyped = variableContext.resolve(variable); if(valueTyped != null) { return valueTyped.getValue(); } return null; } }
repos\camunda-bpm-platform-master\engine-dmn\feel-juel\src\main\java\org\camunda\bpm\dmn\feel\impl\juel\el\FeelTypedVariableMapper.java
1
请在Spring Boot框架中完成以下Java代码
public class BPartnerQuickInputAttributesRepository { private final BPQuickInputAttributes1RecordAdapter attributes1RecordAdapter = new BPQuickInputAttributes1RecordAdapter(); private final BPQuickInputAttributes2RecordAdapter attributes2RecordAdapter = new BPQuickInputAttributes2RecordAdapter(); private final BPQuickInputAttributes3RecordAdapter attributes3RecordAdapter = new BPQuickInputAttributes3RecordAdapter(); private final BPQuickInputAttributes4RecordAdapter attributes4RecordAdapter = new BPQuickInputAttributes4RecordAdapter(); private final BPQuickInputAttributes5RecordAdapter attributes5RecordAdapter = new BPQuickInputAttributes5RecordAdapter(); public BPartnerAttributes getByBPartnerQuickInputId(@NonNull final BPartnerQuickInputId bpartnerQuickInputId) { return BPartnerAttributes.builder() .attributesSet1(attributes1RecordAdapter.getAttributes(bpartnerQuickInputId)) .attributesSet2(attributes2RecordAdapter.getAttributes(bpartnerQuickInputId)) .attributesSet3(attributes3RecordAdapter.getAttributes(bpartnerQuickInputId)) .attributesSet4(attributes4RecordAdapter.getAttributes(bpartnerQuickInputId))
.attributesSet5(attributes5RecordAdapter.getAttributes(bpartnerQuickInputId)) .build(); } public void saveAttributes( @NonNull final BPartnerAttributes bpartnerAttributes, @NonNull final BPartnerQuickInputId bpartnerQuickInputId) { attributes1RecordAdapter.saveAttributes(bpartnerAttributes.getAttributesSet1(), bpartnerQuickInputId); attributes2RecordAdapter.saveAttributes(bpartnerAttributes.getAttributesSet2(), bpartnerQuickInputId); attributes3RecordAdapter.saveAttributes(bpartnerAttributes.getAttributesSet3(), bpartnerQuickInputId); attributes4RecordAdapter.saveAttributes(bpartnerAttributes.getAttributesSet4(), bpartnerQuickInputId); attributes5RecordAdapter.saveAttributes(bpartnerAttributes.getAttributesSet5(), bpartnerQuickInputId); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\bpartner\quick_input\service\BPartnerQuickInputAttributesRepository.java
2
请完成以下Java代码
public Object invokeParent(final Method method, final Object[] methodArgs) throws Exception { return POWrapper.this.invokeParent(method, methodArgs); } @Override public boolean invokeEquals(final Object[] methodArgs) { return POWrapper.this.invokeEquals(methodArgs); } @Override public Object getValue(final String columnName, final int idx, final Class<?> returnType) { return POWrapper.this.getValue(columnName, idx, returnType); } @Override public Object getValue(final String columnName, final Class<?> returnType) { final int columnIndex = POWrapper.this.getColumnIndex(columnName); return POWrapper.this.getValue(columnName, columnIndex, returnType); } @Override public Object getReferencedObject(final String columnName, final Method interfaceMethod) throws Exception { return POWrapper.this.getReferencedObject(columnName, interfaceMethod); } @Override public Set<String> getColumnNames() { return POWrapper.this.getColumnNames(); } @Override public int getColumnIndex(final String columnName)
{ return POWrapper.this.getColumnIndex(columnName); } @Override public boolean isVirtualColumn(final String columnName) { return POWrapper.this.isVirtualColumn(columnName); } @Override public boolean isKeyColumnName(final String columnName) { return POWrapper.this.isKeyColumnName(columnName); } ; @Override public boolean isCalculated(final String columnName) { return POWrapper.this.isCalculated(columnName); } @Override public boolean hasColumnName(final String columnName) { return POWrapper.this.hasColumnName(columnName); } }; }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\adempiere\model\POWrapper.java
1
请完成以下Java代码
protected DataRedisConnectionDetails getDockerComposeConnectionDetails(DockerComposeConnectionSource source) { return new RedisDockerComposeConnectionDetails(source.getRunningService()); } /** * {@link DataRedisConnectionDetails} backed by a {@code redis} * {@link RunningService}. */ static class RedisDockerComposeConnectionDetails extends DockerComposeConnectionDetails implements DataRedisConnectionDetails { private final Standalone standalone; private final @Nullable SslBundle sslBundle; RedisDockerComposeConnectionDetails(RunningService service) { super(service);
this.standalone = Standalone.of(service.host(), service.ports().get(REDIS_PORT)); this.sslBundle = getSslBundle(service); } @Override public @Nullable SslBundle getSslBundle() { return this.sslBundle; } @Override public Standalone getStandalone() { return this.standalone; } } }
repos\spring-boot-4.0.1\module\spring-boot-data-redis\src\main\java\org\springframework\boot\data\redis\docker\compose\RedisDockerComposeConnectionDetailsFactory.java
1
请完成以下Java代码
public boolean isProcessed () { Object oo = get_Value(COLUMNNAME_Processed); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Zusagbar. @param QtyPromised Zusagbar */ @Override public void setQtyPromised (java.math.BigDecimal QtyPromised) { set_Value (COLUMNNAME_QtyPromised, QtyPromised); } /** Get Zusagbar. @return Zusagbar */ @Override public java.math.BigDecimal getQtyPromised () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyPromised); if (bd == null) return BigDecimal.ZERO; return bd; } /** Set Menge angefragt. @param QtyRequiered Menge angefragt */ @Override public void setQtyRequiered (java.math.BigDecimal QtyRequiered) {
set_ValueNoCheck (COLUMNNAME_QtyRequiered, QtyRequiered); } /** Get Menge angefragt. @return Menge angefragt */ @Override public java.math.BigDecimal getQtyRequiered () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyRequiered); if (bd == null) return BigDecimal.ZERO; return bd; } /** Set Use line quantity. @param UseLineQty Use line quantity */ @Override public void setUseLineQty (boolean UseLineQty) { set_Value (COLUMNNAME_UseLineQty, Boolean.valueOf(UseLineQty)); } /** Get Use line quantity. @return Use line quantity */ @Override public boolean isUseLineQty () { Object oo = get_Value(COLUMNNAME_UseLineQty); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.rfq\src\main\java-gen\de\metas\rfq\model\X_C_RfQResponseLine.java
1
请完成以下Java代码
public class ApprovalCommentDTO implements Serializable { private static final long serialVersionUID = 1L; /** * 任务ID */ private String taskId; /** * 任务名称 */ private String taskName; /** * 审批人ID */ private String approverId;
/** * 审批人姓名 */ private String approverName; /** * 审批意见 */ private String approvalComment; /** * 审批时间 */ private Date approvalTime; }
repos\JeecgBoot-main\jeecg-boot\jeecg-boot-base-core\src\main\java\org\jeecg\common\api\dto\ApprovalCommentDTO.java
1
请在Spring Boot框架中完成以下Java代码
public class ActivitiAnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser { private final String processEngineAttribute = "process-engine"; public BeanDefinition parse(Element element, ParserContext parserContext) { registerProcessScope(element, parserContext); registerStateHandlerAnnotationBeanFactoryPostProcessor(element, parserContext); registerProcessStartAnnotationBeanPostProcessor(element, parserContext); return null; } private void configureProcessEngine(AbstractBeanDefinition abstractBeanDefinition, Element element) { String procEngineRef = element.getAttribute(processEngineAttribute); if (StringUtils.hasText(procEngineRef)) abstractBeanDefinition.getPropertyValues().add(Conventions.attributeNameToPropertyName(processEngineAttribute), new RuntimeBeanReference(procEngineRef)); } private void registerStateHandlerAnnotationBeanFactoryPostProcessor(Element element, ParserContext context) { Class clz = StateHandlerAnnotationBeanFactoryPostProcessor.class; BeanDefinitionBuilder postProcessorBuilder = BeanDefinitionBuilder.genericBeanDefinition(clz.getName()); BeanDefinitionHolder postProcessorHolder = new BeanDefinitionHolder( postProcessorBuilder.getBeanDefinition(), ActivitiContextUtils.ANNOTATION_STATE_HANDLER_BEAN_FACTORY_POST_PROCESSOR_BEAN_NAME); configureProcessEngine(postProcessorBuilder.getBeanDefinition(), element); BeanDefinitionReaderUtils.registerBeanDefinition(postProcessorHolder, context.getRegistry()); } private void registerProcessScope(Element element, ParserContext parserContext) { Class clz = ProcessScope.class; BeanDefinitionBuilder processScopeBDBuilder = BeanDefinitionBuilder.genericBeanDefinition(clz); AbstractBeanDefinition scopeBeanDefinition = processScopeBDBuilder.getBeanDefinition(); scopeBeanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); configureProcessEngine(scopeBeanDefinition, element); String beanName = baseBeanName(clz); parserContext.getRegistry().registerBeanDefinition(beanName, scopeBeanDefinition); }
private void registerProcessStartAnnotationBeanPostProcessor(Element element, ParserContext parserContext) { Class clz = ProcessStartAnnotationBeanPostProcessor.class; BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder.genericBeanDefinition(clz); AbstractBeanDefinition beanDefinition = beanDefinitionBuilder.getBeanDefinition(); beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); configureProcessEngine(beanDefinition, element); String beanName = baseBeanName(clz); parserContext.getRegistry().registerBeanDefinition(beanName, beanDefinition); } private String baseBeanName(Class cl) { return cl.getName().toLowerCase(); } }
repos\camunda-bpm-platform-master\engine-spring\core\src\main\java\org\camunda\bpm\engine\spring\components\config\xml\ActivitiAnnotationDrivenBeanDefinitionParser.java
2
请完成以下Java代码
public void setExternalSystem_Config_ID (final int ExternalSystem_Config_ID) { if (ExternalSystem_Config_ID < 1) set_Value (COLUMNNAME_ExternalSystem_Config_ID, null); else set_Value (COLUMNNAME_ExternalSystem_Config_ID, ExternalSystem_Config_ID); } @Override public int getExternalSystem_Config_ID() { return get_ValueAsInt(COLUMNNAME_ExternalSystem_Config_ID); } @Override public void setExternalSystem_RuntimeParameter_ID (final int ExternalSystem_RuntimeParameter_ID) { if (ExternalSystem_RuntimeParameter_ID < 1) set_ValueNoCheck (COLUMNNAME_ExternalSystem_RuntimeParameter_ID, null); else set_ValueNoCheck (COLUMNNAME_ExternalSystem_RuntimeParameter_ID, ExternalSystem_RuntimeParameter_ID); } @Override public int getExternalSystem_RuntimeParameter_ID() { return get_ValueAsInt(COLUMNNAME_ExternalSystem_RuntimeParameter_ID); } @Override public void setName (final String Name) { set_Value (COLUMNNAME_Name, Name); }
@Override public String getName() { return get_ValueAsString(COLUMNNAME_Name); } @Override public void setValue (final @Nullable String Value) { set_Value (COLUMNNAME_Value, Value); } @Override public String getValue() { return get_ValueAsString(COLUMNNAME_Value); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java-gen\de\metas\externalsystem\model\X_ExternalSystem_RuntimeParameter.java
1
请完成以下Java代码
void includeTab(final GridController detail) { final GridTab gridTab = detail.getMTab(); final int adTabId = gridTab.getAD_Tab_ID(); // // Add this included grid controller to our internal list. // If we are not able to add it now, we will add it later in "addField". if (!includedTabList.containsKey(adTabId)) { includedTabList.put(adTabId, detail); } final VPanelFieldGroup groupPanel = includedGroupPanelsByTabId.get(adTabId); if (groupPanel == null) { // the field group was not created yet. // Do nothing. We expect this to be solved, later in "addField". return; } final APanel panel = new APanel(detail, getWindowNo()); panel.setBorder(BorderFactory.createEmptyBorder()); detail.setAPanel(panel); // metas: 02553: set the actual panel to be used and who will receive events final String name = gridTab.getName(); groupPanel.setTitle(name); final JPanel groupPanelContent = groupPanel.getContentPane(); groupPanelContent.removeAll(); // make sure the panel is empty groupPanelContent.setLayout(new BorderLayout()); groupPanelContent.add(panel, BorderLayout.CENTER); // // When the find panel is expended, scroll the outer scroll pane, // in order to have the actual included tab content (single row panel or table) visible to user. // NOTE: usually the included tabs are the last field groups so the effect would be to scroll a bit down. final FindPanelContainer findPanel = detail.getFindPanel(); if (findPanel != null) { findPanel.runOnExpandedStateChange(new Runnable() { @Override public void run() { // Skip if the find panel is not expanded if (!findPanel.isExpanded()) { return; } // NOTE: because when the change event is triggered only the collapsed state is changed, and the actual component layout is happening later, // we are enqueuing an event to be processed in next EDT round.
SwingUtilities.invokeLater(new Runnable() { @Override public void run() { detail.scrollToVisible(); } }); } }); } } public VEditor getEditor(final String columnName) { return columnName2editor.get(columnName); } public final List<String> getEditorColumnNames() { return new ArrayList<>(columnName2editor.keySet()); } public final CLabel getEditorLabel(final String columnName) { return columnName2label.get(columnName); } public final void updateVisibleFieldGroups() { for (final VPanelFieldGroup panel : fieldGroupPanels) { panel.updateVisible(); } } } // VPanel
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\org\compiere\grid\VPanel.java
1
请完成以下Java代码
public void onSuccess(Void msg) { responseWriter.setResult(new ResponseEntity<>(HttpStatus.OK)); } @Override public void onError(Throwable e) { responseWriter.setResult(new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR)); } } @RequiredArgsConstructor private static class HttpSessionListener implements SessionMsgListener { private final DeferredResult<ResponseEntity> responseWriter; private final TransportService transportService; private final SessionInfoProto sessionInfo; @Override public void onGetAttributesResponse(GetAttributeResponseMsg msg) { responseWriter.setResult(new ResponseEntity<>(JsonConverter.toJson(msg).toString(), HttpStatus.OK)); } @Override public void onAttributeUpdate(UUID sessionId, AttributeUpdateNotificationMsg msg) { log.trace("[{}] Received attributes update notification to device", sessionId); responseWriter.setResult(new ResponseEntity<>(JsonConverter.toJson(msg).toString(), HttpStatus.OK)); } @Override public void onRemoteSessionCloseCommand(UUID sessionId, SessionCloseNotificationProto sessionCloseNotification) { log.trace("[{}] Received the remote command to close the session: {}", sessionId, sessionCloseNotification.getMessage()); responseWriter.setResult(new ResponseEntity<>(HttpStatus.REQUEST_TIMEOUT)); }
@Override public void onToDeviceRpcRequest(UUID sessionId, ToDeviceRpcRequestMsg msg) { log.trace("[{}] Received RPC command to device", sessionId); responseWriter.setResult(new ResponseEntity<>(JsonConverter.toJson(msg, true).toString(), HttpStatus.OK)); transportService.process(sessionInfo, msg, RpcStatus.DELIVERED, TransportServiceCallback.EMPTY); } @Override public void onToServerRpcResponse(ToServerRpcResponseMsg msg) { responseWriter.setResult(new ResponseEntity<>(JsonConverter.toJson(msg).toString(), HttpStatus.OK)); } @Override public void onDeviceDeleted(DeviceId deviceId) { UUID sessionId = new UUID(sessionInfo.getSessionIdMSB(), sessionInfo.getSessionIdLSB()); log.trace("[{}] Received device deleted notification for device with id: {}",sessionId, deviceId); responseWriter.setResult(new ResponseEntity<>("Device was deleted!", HttpStatus.FORBIDDEN)); } } private static MediaType parseMediaType(String contentType) { try { return MediaType.parseMediaType(contentType); } catch (Exception e) { return MediaType.APPLICATION_OCTET_STREAM; } } @Override public String getName() { return DataConstants.HTTP_TRANSPORT_NAME; } }
repos\thingsboard-master\common\transport\http\src\main\java\org\thingsboard\server\transport\http\DeviceApiController.java
1
请完成以下Java代码
public class GenericEventListenerActivityBehaviour extends CoreCmmnTriggerableActivityBehavior implements PlanItemActivityBehavior { @Override public void onStateTransition(CommandContext commandContext, DelegatePlanItemInstance planItemInstance, String transition) { } @Override public void execute(CommandContext commandContext, PlanItemInstanceEntity planItemInstanceEntity) { RepetitionRule repetitionRule = ExpressionUtil.getRepetitionRule(planItemInstanceEntity); if (repetitionRule != null && ExpressionUtil.evaluateRepetitionRule(commandContext, planItemInstanceEntity, planItemInstanceEntity.getStagePlanItemInstanceEntity())) { PlanItemInstanceEntity eventPlanItemInstanceEntity = PlanItemInstanceUtil.copyAndInsertPlanItemInstance(commandContext, planItemInstanceEntity, false, false); CmmnEngineAgenda agenda = CommandContextUtil.getAgenda(commandContext); agenda.planCreatePlanItemInstanceWithoutEvaluationOperation(eventPlanItemInstanceEntity); agenda.planOccurPlanItemInstanceOperation(eventPlanItemInstanceEntity);
CommandContextUtil.getCmmnEngineConfiguration(commandContext).getListenerNotificationHelper().executeLifecycleListeners( commandContext, planItemInstanceEntity, PlanItemInstanceState.ACTIVE, PlanItemInstanceState.AVAILABLE); } else { CommandContextUtil.getAgenda(commandContext).planOccurPlanItemInstanceOperation(planItemInstanceEntity); } } @Override public void trigger(CommandContext commandContext, PlanItemInstanceEntity planItemInstanceEntity) { execute(commandContext, planItemInstanceEntity); } }
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\behavior\impl\GenericEventListenerActivityBehaviour.java
1
请完成以下Java代码
public Object getParameterComponent(final int index) { return null; } @Override public Object getParameterToComponent(final int index) { return null; } @Override public Object getParameterValue(final int index, final boolean returnValueTo) { return null; } @Override public String[] getWhereClauses(final List<Object> params) { return new String[0]; } @Override public String getText() { return null; } @Override public void save(final Properties ctx, final int windowNo, final IInfoWindowGridRowBuilders builders) { for (final IHUPackingAware record : packingInfos.values()) { // We need to create a key that depends on both the product and the PIIP. // Note that we assume that both columns are read-only and therefore won't change! // Keep in sync with the other controllers in this package! // It's 1:17am, it has to be rolled out tomorrow and i *won't* make it any nicer tonight. // Future generations will have to live with this shit or rewrite it. final int recordId = new HashCodeBuilder() .append(record.getM_Product_ID()) .append(record.getM_HU_PI_Item_Product_ID()) .toHashCode(); final OrderLineHUPackingGridRowBuilder builder = new OrderLineHUPackingGridRowBuilder(); builder.setSource(record); builders.addGridTabRowBuilder(recordId, builder); } } /** * Gets existing {@link IHUPackingAware} record for given row (wrapped as IHUPackingAware) or null. * * @param rowIndexModel * @return {@link IHUPackingAware} or null */ private IHUPackingAware getSavedHUPackingAware(final IHUPackingAware rowRecord)
{ final ArrayKey key = mkKey(rowRecord); return packingInfos.get(key); } @Override public void prepareEditor(final CEditor editor, final Object value, final int rowIndexModel, final int columnIndexModel) { // nothing } @Override public String getProductCombinations() { final List<Integer> piItemProductIds = new ArrayList<Integer>(); for (final IHUPackingAware record : packingInfos.values()) { piItemProductIds.add(record.getM_HU_PI_Item_Product_ID()); } if (!piItemProductIds.isEmpty() && piItemProductIds != null) { final StringBuilder sb = new StringBuilder(piItemProductIds.get(0).toString()); for (int i = 1; i < piItemProductIds.size(); i++) { sb.append(", " + piItemProductIds.get(i).toString()); } return " AND (" + M_HU_PI_Item_Product_table_alias + "." + I_M_HU_PI_Item_Product.COLUMNNAME_M_HU_PI_Item_Product_ID + " IN " + " ( " + sb + " ) " + " OR " + M_HU_PI_Item_Product_table_alias + "." + I_M_HU_PI_Item_Product.COLUMNNAME_M_HU_PI_Item_Product_ID + " IS NULL" + ") "; } return null; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\adempiere\gui\search\InfoProductQtyPacksController.java
1
请完成以下Java代码
public String getPlaceholder() { return placeholder; } public void setPlaceholder(String placeholder) { this.placeholder = placeholder; } public LayoutDefinition getLayout() { return layout; } public void setLayout(LayoutDefinition layout) { this.layout = layout; } @JsonInclude(Include.NON_EMPTY) public Map<String, Object> getParams() {
return params; } public void setParams(Map<String, Object> params) { this.params = params; } @JsonIgnore public Object getParam(String name) { if (params != null) { return params.get(name); } return null; } }
repos\flowable-engine-main\modules\flowable-form-model\src\main\java\org\flowable\form\model\FormField.java
1
请在Spring Boot框架中完成以下Java代码
public class CaseDefinitionUtil { public static CaseDefinition getCaseDefinition(String caseDefinitionId) { CmmnDeploymentManager deploymentManager = CommandContextUtil.getCmmnEngineConfiguration().getDeploymentManager(); CaseDefinitionCacheEntry cacheEntry = deploymentManager.getCaseDefinitionCache().get(caseDefinitionId); return getCaseDefinition(caseDefinitionId, deploymentManager, cacheEntry); } public static String getDefinitionDeploymentId(String caseDefinitionId) { return getDefinitionDeploymentId(caseDefinitionId, CommandContextUtil.getCmmnEngineConfiguration()); } public static String getDefinitionDeploymentId(String caseDefinitionId, CmmnEngineConfiguration cmmnEngineConfiguration) { CmmnDeploymentManager deploymentManager = cmmnEngineConfiguration.getDeploymentManager(); CaseDefinitionCacheEntry cacheEntry = deploymentManager.getCaseDefinitionCache().get(caseDefinitionId); CaseDefinition caseDefinition = getCaseDefinition(caseDefinitionId, deploymentManager, cacheEntry); return getDefinitionDeploymentId(caseDefinition, cmmnEngineConfiguration); } public static String getDefinitionDeploymentId(CaseDefinition caseDefinition, CmmnEngineConfiguration cmmnEngineConfiguration) { CmmnDeploymentManager deploymentManager = cmmnEngineConfiguration.getDeploymentManager(); CmmnDeploymentEntity caseDeployment = deploymentManager.getDeploymentEntityManager().findById(caseDefinition.getDeploymentId()); if (StringUtils.isEmpty(caseDeployment.getParentDeploymentId())) { return caseDefinition.getDeploymentId(); } return caseDeployment.getParentDeploymentId(); } protected static CaseDefinition getCaseDefinition(String caseDefinitionId, CmmnDeploymentManager deploymentManager, CaseDefinitionCacheEntry cacheEntry) { if (cacheEntry != null) { return cacheEntry.getCaseDefinition();
} return deploymentManager.findDeployedCaseDefinitionById(caseDefinitionId); } public static CmmnModel getCmmnModel(String caseDefinitionId) { CmmnDeploymentManager deploymentManager = CommandContextUtil.getCmmnEngineConfiguration().getDeploymentManager(); CaseDefinitionCacheEntry cacheEntry = deploymentManager.getCaseDefinitionCache().get(caseDefinitionId); if (cacheEntry != null) { return cacheEntry.getCmmnModel(); } deploymentManager.findDeployedCaseDefinitionById(caseDefinitionId); return deploymentManager.getCaseDefinitionCache().get(caseDefinitionId).getCmmnModel(); } public static Case getCase(String caseDefinitionId) { return getCmmnModel(caseDefinitionId).getPrimaryCase(); } }
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\repository\CaseDefinitionUtil.java
2
请在Spring Boot框架中完成以下Java代码
public class PickingJobStepEvent { @Builder.Default @NonNull Instant timestamp = SystemTime.asInstant(); @NonNull PickingJobLineId pickingLineId; @Nullable PickingJobStepId pickingStepId; @Nullable PickingJobStepPickFromKey pickFromKey; @NonNull PickingJobStepEventType eventType; // // Common @NonNull ScannedCode qrCode; // // Event Type: PICK @Nullable BigDecimal qtyPicked; @Nullable BigDecimal qtyRejected; @Nullable QtyRejectedReasonCode qtyRejectedReasonCode; @Nullable BigDecimal catchWeight; boolean isPickWholeTU; @Builder.Default boolean checkIfAlreadyPacked = true; boolean isSetBestBeforeDate; @Nullable LocalDate bestBeforeDate; boolean isSetLotNo; @Nullable String lotNo; boolean isCloseTarget;
// // Event Type: UNPICK @Nullable HUQRCode unpickToTargetQRCode; public static Collection<PickingJobStepEvent> removeDuplicates(@NonNull final Collection<PickingJobStepEvent> events) { return events .stream() .collect(ImmutableMap.toImmutableMap( event -> Util.ArrayKey.of(event.getPickingLineId(), event.getPickingStepId(), event.getPickFromKey()), event -> event, PickingJobStepEvent::latest)) .values(); } private static PickingJobStepEvent latest(@NonNull final PickingJobStepEvent e1, @NonNull final PickingJobStepEvent e2) { return e1.getTimestamp().isAfter(e2.getTimestamp()) ? e1 : e2; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\job\model\PickingJobStepEvent.java
2
请完成以下Java代码
public void setInvoicableQtyBasedOn (final @Nullable java.lang.String InvoicableQtyBasedOn) { set_ValueNoCheck (COLUMNNAME_InvoicableQtyBasedOn, InvoicableQtyBasedOn); } @Override public java.lang.String getInvoicableQtyBasedOn() { return get_ValueAsString(COLUMNNAME_InvoicableQtyBasedOn); } @Override public void setM_InOut_ID (final int M_InOut_ID) { if (M_InOut_ID < 1) set_ValueNoCheck (COLUMNNAME_M_InOut_ID, null); else set_ValueNoCheck (COLUMNNAME_M_InOut_ID, M_InOut_ID); } @Override public int getM_InOut_ID() { return get_ValueAsInt(COLUMNNAME_M_InOut_ID); } @Override public void setMovementDate (final @Nullable java.sql.Timestamp MovementDate) { set_ValueNoCheck (COLUMNNAME_MovementDate, MovementDate); } @Override public java.sql.Timestamp getMovementDate() { return get_ValueAsTimestamp(COLUMNNAME_MovementDate); } @Override public void setPOReference (final @Nullable java.lang.String POReference) { set_ValueNoCheck (COLUMNNAME_POReference, POReference); } @Override public java.lang.String getPOReference() { return get_ValueAsString(COLUMNNAME_POReference); } @Override public void 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_ValueNoCheck (COLUMNNAME_Processing, Processing); } @Override public boolean isProcessing() { return get_ValueAsBoolean(COLUMNNAME_Processing); } @Override public void setSumDeliveredInStockingUOM (final @Nullable BigDecimal SumDeliveredInStockingUOM) { set_ValueNoCheck (COLUMNNAME_SumDeliveredInStockingUOM, SumDeliveredInStockingUOM); } @Override public BigDecimal getSumDeliveredInStockingUOM() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_SumDeliveredInStockingUOM); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setSumOrderedInStockingUOM (final @Nullable BigDecimal SumOrderedInStockingUOM) { set_ValueNoCheck (COLUMNNAME_SumOrderedInStockingUOM, SumOrderedInStockingUOM); } @Override public BigDecimal getSumOrderedInStockingUOM() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_SumOrderedInStockingUOM); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setUserFlag (final @Nullable java.lang.String UserFlag) { set_ValueNoCheck (COLUMNNAME_UserFlag, UserFlag); } @Override public java.lang.String getUserFlag() { return get_ValueAsString(COLUMNNAME_UserFlag); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.edi\src\main\java-gen\de\metas\esb\edi\model\X_M_InOut_Desadv_V.java
1
请完成以下Java代码
private final void save(final I_M_HU_Trx_Attribute huTrxAttribute) { if (!saveTrxAttributes) { return; // don't save it } InterfaceWrapperHelper.save(huTrxAttribute); } /** * Process given {@link I_M_HU_Trx_Attribute} by calling the actual processor. * * @param huTrxAttribute */ private void process0(final I_M_HU_Trx_Attribute huTrxAttribute) { final Object referencedModel = getReferencedObject(huTrxAttribute); final IHUTrxAttributeProcessor trxAttributeProcessor = getHUTrxAttributeProcessor(referencedModel); final HUTransactionAttributeOperation operation = HUTransactionAttributeOperation.ofCode(huTrxAttribute.getOperation()); if (HUTransactionAttributeOperation.SAVE.equals(operation)) { trxAttributeProcessor.processSave(huContext, huTrxAttribute, referencedModel);
} else if (HUTransactionAttributeOperation.DROP.equals(operation)) { trxAttributeProcessor.processDrop(huContext, huTrxAttribute, referencedModel); } else { throw new InvalidAttributeValueException("Invalid operation on trx attribute (" + operation + "): " + huTrxAttribute); } } @Override public void reverseTrxAttributes(final I_M_HU_Trx_Line reversalTrxLine, final I_M_HU_Trx_Line trxLine) { // TODO implement trx line attributes reversal final AdempiereException ex = new AdempiereException("attribute transactions reversal not implemented"); logger.warn(ex.getLocalizedMessage() + ". Skip it for now", ex); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\attribute\impl\HUTransactionAttributeProcessor.java
1
请完成以下Java代码
public int getRevisionNext() { return 0; } @Override public void setName(String name) {} @Override public void setProcessInstanceId(String processInstanceId) {} @Override public void setExecutionId(String executionId) {} @Override public Object getValue() { return variableValue; } @Override public void setValue(Object value) { variableValue = value; } @Override public String getTypeName() { return TYPE_TRANSIENT;
} @Override public void setTypeName(String typeName) {} @Override public String getProcessInstanceId() { return null; } @Override public String getTaskId() { return null; } @Override public void setTaskId(String taskId) {} @Override public String getExecutionId() { return null; } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\persistence\entity\TransientVariableInstance.java
1
请完成以下Java代码
public void setLockedDate (Timestamp LockedDate) { set_Value (COLUMNNAME_LockedDate, LockedDate); } /** Get Locked Date. @return Date when this record was locked */ public Timestamp getLockedDate () { return (Timestamp)get_Value(COLUMNNAME_LockedDate); } /** Set Phone. @param Phone Identifies a telephone number */ public void setPhone (String Phone) { throw new IllegalArgumentException ("Phone is virtual column"); } /** Get Phone. @return Identifies a telephone number */ public String getPhone () { return (String)get_Value(COLUMNNAME_Phone); } public I_R_Group getR_Group() throws RuntimeException { return (I_R_Group)MTable.get(getCtx(), I_R_Group.Table_Name) .getPO(getR_Group_ID(), get_TrxName()); } /** Set Group. @param R_Group_ID Request Group */ public void setR_Group_ID (int R_Group_ID) { if (R_Group_ID < 1) set_ValueNoCheck (COLUMNNAME_R_Group_ID, null); else set_ValueNoCheck (COLUMNNAME_R_Group_ID, Integer.valueOf(R_Group_ID)); } /** Get Group. @return Request Group */ public int getR_Group_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_R_Group_ID); if (ii == null) return 0; return ii.intValue();
} public I_R_Request getR_Request() throws RuntimeException { return (I_R_Request)MTable.get(getCtx(), I_R_Request.Table_Name) .getPO(getR_Request_ID(), get_TrxName()); } /** Set Request. @param R_Request_ID Request from a Business Partner or Prospect */ public void setR_Request_ID (int R_Request_ID) { if (R_Request_ID < 1) set_Value (COLUMNNAME_R_Request_ID, null); else set_Value (COLUMNNAME_R_Request_ID, Integer.valueOf(R_Request_ID)); } /** Get Request. @return Request from a Business Partner or Prospect */ public int getR_Request_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_R_Request_ID); if (ii == null) return 0; return ii.intValue(); } public I_R_Status getR_Status() throws RuntimeException { return (I_R_Status)MTable.get(getCtx(), I_R_Status.Table_Name) .getPO(getR_Status_ID(), get_TrxName()); } /** Set Status. @param R_Status_ID Request Status */ public void setR_Status_ID (int R_Status_ID) { throw new IllegalArgumentException ("R_Status_ID is virtual column"); } /** Get Status. @return Request Status */ public int getR_Status_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_R_Status_ID); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\de\metas\callcenter\model\X_R_Group_Prospect.java
1
请完成以下Java代码
public String getDownloadUrl() { return downloadUrl; } public void setDownloadUrl(String downloadUrl) { this.downloadUrl = downloadUrl; } public String getAppName() { return appName; } public void setAppName(String appName) { this.appName = appName; } public String getVersion() { return version; } public void setVersion(String version) { this.version = version; }
public String getTips() { return tips; } public void setTips(String tips) { this.tips = tips; } public Date getPublishtime() { return publishtime; } public void setPublishtime(Date publishtime) { this.publishtime = publishtime; } }
repos\SpringBootBucket-master\springboot-swagger2\src\main\java\com\xncoding\jwt\api\model\VersionResult.java
1
请完成以下Java代码
public int hashCode() { return Objects.hash(this.settings); } @Override public String toString() { return "AbstractSettings {" + "settings=" + this.settings + '}'; } /** * A builder for subclasses of {@link AbstractSettings}. * * @param <T> the type of object * @param <B> the type of the builder */ protected abstract static class AbstractBuilder<T extends AbstractSettings, B extends AbstractBuilder<T, B>> { private final Map<String, Object> settings = new HashMap<>(); protected AbstractBuilder() { } /** * Sets a configuration setting. * @param name the name of the setting * @param value the value of the setting * @return the {@link AbstractBuilder} for further configuration */ public B setting(String name, Object value) { Assert.hasText(name, "name cannot be empty"); Assert.notNull(value, "value cannot be null"); getSettings().put(name, value); return getThis(); } /** * A {@code Consumer} of the configuration settings {@code Map} allowing the * ability to add, replace, or remove. * @param settingsConsumer a {@link Consumer} of the configuration settings
* {@code Map} * @return the {@link AbstractBuilder} for further configuration */ public B settings(Consumer<Map<String, Object>> settingsConsumer) { settingsConsumer.accept(getSettings()); return getThis(); } public abstract T build(); protected final Map<String, Object> getSettings() { return this.settings; } @SuppressWarnings("unchecked") protected final B getThis() { return (B) this; } } }
repos\spring-security-main\oauth2\oauth2-authorization-server\src\main\java\org\springframework\security\oauth2\server\authorization\settings\AbstractSettings.java
1
请完成以下Java代码
public OriginalBusinessQuery1 getOrgnlBizQry() { return orgnlBizQry; } /** * Sets the value of the orgnlBizQry property. * * @param value * allowed object is * {@link OriginalBusinessQuery1 } * */ public void setOrgnlBizQry(OriginalBusinessQuery1 value) { this.orgnlBizQry = value; } /** * Gets the value of the addtlInf property. * * @return * possible object is * {@link String } * */ public String getAddtlInf() {
return addtlInf; } /** * Sets the value of the addtlInf property. * * @param value * allowed object is * {@link String } * */ public void setAddtlInf(String value) { this.addtlInf = value; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_04\GroupHeader58.java
1
请完成以下Java代码
public void setIsWriteOff (boolean IsWriteOff) { set_Value (COLUMNNAME_IsWriteOff, Boolean.valueOf(IsWriteOff)); } /** Get Massenaustritt. @return Massenaustritt */ @Override public boolean isWriteOff () { Object oo = get_Value(COLUMNNAME_IsWriteOff); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Name. @param Name Alphanumeric identifier of the entity */ @Override public void setName (java.lang.String Name) { set_Value (COLUMNNAME_Name, Name); } /** Get Name. @return Alphanumeric identifier of the entity */ @Override public java.lang.String getName () { return (java.lang.String)get_Value(COLUMNNAME_Name); } /** Set Notiz. @param Note Optional additional user defined information */ @Override public void setNote (java.lang.String Note) { set_Value (COLUMNNAME_Note, Note); } /** Get Notiz. @return Optional additional user defined information */ @Override public java.lang.String getNote () {
return (java.lang.String)get_Value(COLUMNNAME_Note); } /** Set Notiz Header. @param NoteHeader Optional weitere Information für ein Dokument */ @Override public void setNoteHeader (java.lang.String NoteHeader) { set_Value (COLUMNNAME_NoteHeader, NoteHeader); } /** Get Notiz Header. @return Optional weitere Information für ein Dokument */ @Override public java.lang.String getNoteHeader () { return (java.lang.String)get_Value(COLUMNNAME_NoteHeader); } /** Set Drucktext. @param PrintName The label text to be printed on a document or correspondence. */ @Override public void setPrintName (java.lang.String PrintName) { set_Value (COLUMNNAME_PrintName, PrintName); } /** Get Drucktext. @return The label text to be printed on a document or correspondence. */ @Override public java.lang.String getPrintName () { return (java.lang.String)get_Value(COLUMNNAME_PrintName); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_DunningLevel.java
1
请完成以下Java代码
public String getAsyncExecutorLockOwner() { return asyncExecutorLockOwner; } public ProcessEngineConfigurationImpl setAsyncExecutorLockOwner(String asyncExecutorLockOwner) { this.asyncExecutorLockOwner = asyncExecutorLockOwner; return this; } public int getAsyncExecutorTimerLockTimeInMillis() { return asyncExecutorTimerLockTimeInMillis; } public ProcessEngineConfigurationImpl setAsyncExecutorTimerLockTimeInMillis(int asyncExecutorTimerLockTimeInMillis) { this.asyncExecutorTimerLockTimeInMillis = asyncExecutorTimerLockTimeInMillis; return this; } public int getAsyncExecutorAsyncJobLockTimeInMillis() {
return asyncExecutorAsyncJobLockTimeInMillis; } public ProcessEngineConfigurationImpl setAsyncExecutorAsyncJobLockTimeInMillis(int asyncExecutorAsyncJobLockTimeInMillis) { this.asyncExecutorAsyncJobLockTimeInMillis = asyncExecutorAsyncJobLockTimeInMillis; return this; } public int getAsyncExecutorLockRetryWaitTimeInMillis() { return asyncExecutorLockRetryWaitTimeInMillis; } public ProcessEngineConfigurationImpl setAsyncExecutorLockRetryWaitTimeInMillis(int asyncExecutorLockRetryWaitTimeInMillis) { this.asyncExecutorLockRetryWaitTimeInMillis = asyncExecutorLockRetryWaitTimeInMillis; return this; } }
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\cfg\ProcessEngineConfigurationImpl.java
1
请完成以下Java代码
public List<? extends IViewRow> getIncludedRows() { return ImmutableList.of(); } final void assertEditable() { if (!editable) { throw new AdempiereException("Row is not editable"); } } public PricingConditionsRow copyAndChangeToEditable() { if (editable) { return this; } return toBuilder().editable(true).build(); } public LookupValuesPage getFieldTypeahead(final String fieldName, final String query) { return lookups.getFieldTypeahead(fieldName, query); } public LookupValuesList getFieldDropdown(final String fieldName) {
return lookups.getFieldDropdown(fieldName); } public BPartnerId getBpartnerId() { return BPartnerId.ofRepoId(bpartner.getIdAsInt()); } public String getBpartnerDisplayName() { return bpartner.getDisplayName(); } public boolean isVendor() { return !isCustomer(); } public CurrencyId getCurrencyId() { return CurrencyId.ofRepoId(currency.getIdAsInt()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\order\pricingconditions\view\PricingConditionsRow.java
1
请在Spring Boot框架中完成以下Java代码
private EntityExportData toData(String data) { return JacksonUtil.fromString(data, EntityExportData.class); } private static String getRelativePath(EntityType entityType, EntityId entityId) { String path = entityType.name().toLowerCase(); if (entityId != null) { path += "/" + entityId + ".json"; } return path; } private static PrepareMsg getCommitPrepareMsg(User user, VersionCreateRequest request) { return PrepareMsg.newBuilder().setCommitMsg(request.getVersionName()) .setBranchName(request.getBranch()).setAuthorName(getAuthorName(user)).setAuthorEmail(user.getEmail()).build(); } private static String getAuthorName(User user) { List<String> parts = new ArrayList<>(); if (StringUtils.isNotBlank(user.getFirstName())) { parts.add(user.getFirstName()); } if (StringUtils.isNotBlank(user.getLastName())) { parts.add(user.getLastName()); } if (parts.isEmpty()) { parts.add(user.getName()); } return String.join(" ", parts);
} private ToVersionControlServiceMsg.Builder newRequestProto(PendingGitRequest<?> request, RepositorySettings settings) { var tenantId = request.getTenantId(); var requestId = request.getRequestId(); var builder = ToVersionControlServiceMsg.newBuilder() .setNodeId(serviceInfoProvider.getServiceId()) .setTenantIdMSB(tenantId.getId().getMostSignificantBits()) .setTenantIdLSB(tenantId.getId().getLeastSignificantBits()) .setRequestIdMSB(requestId.getMostSignificantBits()) .setRequestIdLSB(requestId.getLeastSignificantBits()); RepositorySettings vcSettings = settings; if (vcSettings == null && request.requiresSettings()) { vcSettings = entitiesVersionControlService.getVersionControlSettings(tenantId); } if (vcSettings != null) { builder.setVcSettings(ProtoUtils.toProto(vcSettings)); } else if (request.requiresSettings()) { throw new RuntimeException("No entity version control settings provisioned!"); } return builder; } private CommitRequestMsg.Builder buildCommitRequest(CommitGitRequest commit) { return CommitRequestMsg.newBuilder().setTxId(commit.getTxId().toString()); } }
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\sync\vc\DefaultGitVersionControlQueueService.java
2