instruction
string
input
string
output
string
source_file
string
priority
int64
请完成以下Java代码
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Particle other = (Particle) obj; if (Double.doubleToLongBits(bestFitness) != Double.doubleToLongBits(other.bestFitness)) return false; if (!Arrays.equals(bestPosition, other.bestPosition)) return false; if (Double.doubleToLongBits(fitness) != Double.doubleToLongBits(other.fitness)) return false; if (!Arrays.equals(position, other.position)) return false; if (!Arrays.equals(speed, other.speed))
return false; return true; } /* * (non-Javadoc) * * @see java.lang.Object#toString() */ @Override public String toString() { return "Particle [position=" + Arrays.toString(position) + ", speed=" + Arrays.toString(speed) + ", fitness=" + fitness + ", bestPosition=" + Arrays.toString(bestPosition) + ", bestFitness=" + bestFitness + "]"; } }
repos\tutorials-master\algorithms-modules\algorithms-miscellaneous-4\src\main\java\com\baeldung\algorithms\multiswarm\Particle.java
1
请在Spring Boot框架中完成以下Java代码
public AiModel save(AiModel model, User user) { var actionType = model.getId() == null ? ActionType.ADDED : ActionType.UPDATED; var tenantId = user.getTenantId(); model.setTenantId(tenantId); AiModel savedModel; try { savedModel = aiModelService.save(model); autoCommit(user, savedModel.getId()); } catch (Exception e) { logEntityActionService.logEntityAction(tenantId, requireNonNullElseGet(model.getId(), () -> emptyId(EntityType.AI_MODEL)), model, actionType, user, e); throw e; } logEntityActionService.logEntityAction(tenantId, savedModel.getId(), savedModel, actionType, user); return savedModel; } @Override public boolean delete(AiModel model, User user) { var actionType = ActionType.DELETED; var tenantId = user.getTenantId(); var modelId = model.getId(); boolean deleted;
try { deleted = aiModelService.deleteByTenantIdAndId(tenantId, modelId); } catch (Exception e) { logEntityActionService.logEntityAction(tenantId, modelId, model, actionType, user, e, modelId.toString()); throw e; } if (deleted) { logEntityActionService.logEntityAction(tenantId, modelId, model, actionType, user, modelId.toString()); } return deleted; } }
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\entitiy\ai\DefaultTbAiModelService.java
2
请完成以下Java代码
public String getElementId() { return elementId; } public void setElementId(String elementId) { this.elementId = elementId; } @Override public String getElementName() { return elementName; } public void setElementName(String elementName) { this.elementName = elementName; } @Override public String getScopeId() { return scopeId; } public void setScopeId(String scopeId) { this.scopeId = scopeId; } @Override public String getSubScopeId() { return subScopeId; } public void setSubScopeId(String subScopeId) { this.subScopeId = subScopeId; } @Override public String getScopeType() { return scopeType; } public void setScopeType(String scopeType) { this.scopeType = scopeType; } @Override public String getScopeDefinitionId() { return scopeDefinitionId; } public void setScopeDefinitionId(String scopeDefinitionId) { this.scopeDefinitionId = scopeDefinitionId; } @Override public String getJobHandlerType() { return jobHandlerType; }
public void setJobHandlerType(String jobHandlerType) { this.jobHandlerType = jobHandlerType; } @Override public String getJobHandlerConfiguration() { return jobHandlerConfiguration; } public void setJobHandlerConfiguration(String jobHandlerConfiguration) { this.jobHandlerConfiguration = jobHandlerConfiguration; } public String getRepeat() { return repeat; } public void setRepeat(String repeat) { this.repeat = repeat; } public Date getEndDate() { return endDate; } public void setEndDate(Date endDate) { this.endDate = endDate; } @Override public String getExceptionMessage() { return exceptionMessage; } public void setExceptionMessage(String exceptionMessage) { this.exceptionMessage = StringUtils.abbreviate(exceptionMessage, MAX_EXCEPTION_MESSAGE_LENGTH); } @Override public String getTenantId() { return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } @Override public String getCorrelationId() { // v5 Jobs have no correlationId return null; } }
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\persistence\entity\AbstractJobEntity.java
1
请完成以下Java代码
public void setProcessing (boolean Processing) { set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing)); } /** Get Verarbeiten. @return Verarbeiten */ @Override public boolean isProcessing () { Object oo = get_Value(COLUMNNAME_Processing); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } @Override public org.compiere.model.I_C_ElementValue getUser1() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_User1_ID, org.compiere.model.I_C_ElementValue.class); } @Override public void setUser1(org.compiere.model.I_C_ElementValue User1) { set_ValueFromPO(COLUMNNAME_User1_ID, org.compiere.model.I_C_ElementValue.class, User1); } /** Set Nutzer 1. @param User1_ID User defined list element #1 */ @Override public void setUser1_ID (int User1_ID) { if (User1_ID < 1) set_Value (COLUMNNAME_User1_ID, null); else set_Value (COLUMNNAME_User1_ID, Integer.valueOf(User1_ID)); } /** Get Nutzer 1. @return User defined list element #1 */ @Override public int getUser1_ID () {
Integer ii = (Integer)get_Value(COLUMNNAME_User1_ID); if (ii == null) return 0; return ii.intValue(); } @Override public org.compiere.model.I_C_ElementValue getUser2() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_User2_ID, org.compiere.model.I_C_ElementValue.class); } @Override public void setUser2(org.compiere.model.I_C_ElementValue User2) { set_ValueFromPO(COLUMNNAME_User2_ID, org.compiere.model.I_C_ElementValue.class, User2); } /** Set Nutzer 2. @param User2_ID User defined list element #2 */ @Override public void setUser2_ID (int User2_ID) { if (User2_ID < 1) set_Value (COLUMNNAME_User2_ID, null); else set_Value (COLUMNNAME_User2_ID, Integer.valueOf(User2_ID)); } /** Get Nutzer 2. @return User defined list element #2 */ @Override public int getUser2_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_User2_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_GL_Distribution.java
1
请在Spring Boot框架中完成以下Java代码
public class ForecastLineDimensionFactory implements DimensionFactory<I_M_ForecastLine> { @Override public String getHandledTableName() { return I_M_ForecastLine.Table_Name; } @Override @NonNull public Dimension getFromRecord(@NonNull final I_M_ForecastLine record) { return Dimension.builder() .projectId(ProjectId.ofRepoIdOrNull(record.getC_Project_ID())) .campaignId(record.getC_Campaign_ID()) .activityId(ActivityId.ofRepoIdOrNull(record.getC_Activity_ID())) .userElementString1(record.getUserElementString1()) .userElementString2(record.getUserElementString2()) .userElementString3(record.getUserElementString3()) .userElementString4(record.getUserElementString4()) .userElementString5(record.getUserElementString5()) .userElementString6(record.getUserElementString6())
.userElementString7(record.getUserElementString7()) .build(); } @Override public void updateRecord(final I_M_ForecastLine record, final Dimension from) { record.setC_Project_ID(ProjectId.toRepoId(from.getProjectId())); record.setC_Campaign_ID(from.getCampaignId()); record.setC_Activity_ID(ActivityId.toRepoId(from.getActivityId())); record.setUserElementString1(from.getUserElementString1()); record.setUserElementString2(from.getUserElementString2()); record.setUserElementString3(from.getUserElementString3()); record.setUserElementString4(from.getUserElementString4()); record.setUserElementString5(from.getUserElementString5()); record.setUserElementString6(from.getUserElementString6()); record.setUserElementString7(from.getUserElementString7()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\document\dimension\ForecastLineDimensionFactory.java
2
请在Spring Boot框架中完成以下Java代码
MapReactiveUserDetailsService reactiveUserDetailsService(SecurityProperties properties, ObjectProvider<PasswordEncoder> passwordEncoder) { SecurityProperties.User user = properties.getUser(); UserDetails userDetails = getUserDetails(user, getOrDeducePassword(user, passwordEncoder.getIfAvailable())); return new MapReactiveUserDetailsService(userDetails); } private UserDetails getUserDetails(SecurityProperties.User user, String password) { List<String> roles = user.getRoles(); return User.withUsername(user.getName()).password(password).roles(StringUtils.toStringArray(roles)).build(); } private String getOrDeducePassword(SecurityProperties.User user, @Nullable PasswordEncoder encoder) { String password = user.getPassword(); if (user.isPasswordGenerated()) { logger.info(String.format("%n%nUsing generated security password: %s%n", user.getPassword())); } if (encoder != null || PASSWORD_ALGORITHM_PATTERN.matcher(password).matches()) { return password; } return NOOP_PASSWORD_PREFIX + password; } static class RSocketEnabledOrReactiveWebApplication extends AnyNestedCondition {
RSocketEnabledOrReactiveWebApplication() { super(ConfigurationPhase.REGISTER_BEAN); } @ConditionalOnBean(RSocketMessageHandler.class) static class RSocketSecurityEnabledCondition { } @ConditionalOnWebApplication(type = Type.REACTIVE) static class ReactiveWebApplicationCondition { } } }
repos\spring-boot-4.0.1\module\spring-boot-security\src\main\java\org\springframework\boot\security\autoconfigure\ReactiveUserDetailsServiceAutoConfiguration.java
2
请完成以下Java代码
public abstract class AbstractVariableCmd implements Command<Void>, Serializable { private static final long serialVersionUID = 1L; protected CommandContext commandContext; protected String entityId; protected boolean isLocal; protected boolean preventLogUserOperation = false; public AbstractVariableCmd(String entityId, boolean isLocal) { this.entityId = entityId; this.isLocal = isLocal; } public AbstractVariableCmd disableLogUserOperation() { this.preventLogUserOperation = true; return this; } public Void execute(CommandContext commandContext) { this.commandContext = commandContext; AbstractVariableScope scope = getEntity(); if (scope != null) { executeOperation(scope); onSuccess(scope);
if(!preventLogUserOperation) { logVariableOperation(scope); } } return null; }; protected abstract AbstractVariableScope getEntity(); protected abstract ExecutionEntity getContextExecution(); protected abstract void logVariableOperation(AbstractVariableScope scope); protected abstract void executeOperation(AbstractVariableScope scope); protected abstract String getLogEntryOperation(); protected void onSuccess(AbstractVariableScope scope) { ExecutionEntity contextExecution = getContextExecution(); if (contextExecution != null) { contextExecution.dispatchDelayedEventsAndPerformOperation((Callback<PvmExecutionImpl, Void>) null); } } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmd\AbstractVariableCmd.java
1
请完成以下Java代码
public String toString() { return MoreObjects.toStringHelper(this) .add("onVariableNotFound", onVariableNotFound) .add("params", params) .toString(); } /** * Gets parameter value from context * * @return value or {@link #VALUE_NotFound} */ @Nullable public String getValue(final Object operand) throws ExpressionEvaluationException { // // Case: we deal with a parameter (which we will need to get it from context/source) if (operand instanceof CtxName) { final CtxName ctxName = (CtxName)operand; if (ctxNameValues == null) { ctxNameValues = new LinkedHashMap<>(); } final String value = ctxNameValues.computeIfAbsent(ctxName, this::resolveCtxName); logger.trace("Evaluated context variable {}={}", ctxName, value); return value; } // // Case: we deal with a constant value else { String value = operand.toString(); // we can trim whitespaces in this case; if user really wants to have spaces at the beginning/ending of the // string, he/she shall quote it value = value.trim(); value = stripQuotes(value); return value; } } private String resolveCtxName(final CtxName ctxName) { final String value = ctxName.getValueAsString(params); final boolean valueNotFound = Env.isPropertyValueNull(ctxName.getName(), value); // Give it another try in case it's and ID (backward compatibility) // Handling of ID compare (null => 0) if (valueNotFound && Env.isNumericPropertyName(ctxName.getName())) { final String defaultValue = "0"; logger.trace("Evaluated {}={} (default value)", ctxName, defaultValue);
return defaultValue; } if (valueNotFound) { if (onVariableNotFound == OnVariableNotFound.ReturnNoResult) { // i.e. !ignoreUnparsable logger.trace("Evaluated {}=<value not found>", ctxName); return VALUE_NotFound; } else if (onVariableNotFound == OnVariableNotFound.Fail) { throw ExpressionEvaluationException.newWithPlainMessage("Parameter '" + ctxName.getName() + "' not found in context" + "\n Context: " + params + "\n Evaluator: " + this); } else { throw ExpressionEvaluationException.newWithPlainMessage("Unknown " + OnVariableNotFound.class + " value: " + onVariableNotFound); } } return value; } @Nullable public Map<CtxName, String> getUsedParameters() { return ctxNameValues; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\expression\api\impl\LogicExpressionEvaluator.java
1
请在Spring Boot框架中完成以下Java代码
public MediatedCommissionSettings getById(@NonNull final MediatedCommissionSettingsId commissionSettingsId) { final I_C_MediatedCommissionSettings mediatedCommissionSettings = InterfaceWrapperHelper.load(commissionSettingsId, I_C_MediatedCommissionSettings.class); return toMediatedCommissionSettings(mediatedCommissionSettings); } @NonNull private MediatedCommissionSettings toMediatedCommissionSettings(@NonNull final I_C_MediatedCommissionSettings record) { final ImmutableList<MediatedCommissionSettingsLine> lines = queryBL.createQueryBuilder(I_C_MediatedCommissionSettingsLine.class) .addOnlyActiveRecordsFilter() .addEqualsFilter(I_C_MediatedCommissionSettings.COLUMNNAME_C_MediatedCommissionSettings_ID, record.getC_MediatedCommissionSettings_ID()) .create() .stream() .map(this::toMediatedCommissionLine) .collect(ImmutableList.toImmutableList()); return MediatedCommissionSettings.builder() .commissionSettingsId(MediatedCommissionSettingsId.ofRepoId(record.getC_MediatedCommissionSettings_ID())) .commissionProductId(ProductId.ofRepoId(record.getCommission_Product_ID()))
.orgId(OrgId.ofRepoId(record.getAD_Org_ID())) .pointsPrecision(record.getPointsPrecision()) .lines(lines) .build(); } @NonNull private MediatedCommissionSettingsLine toMediatedCommissionLine(@NonNull final I_C_MediatedCommissionSettingsLine record) { final MediatedCommissionSettingsId settingsId = MediatedCommissionSettingsId.ofRepoId(record.getC_MediatedCommissionSettings_ID()); return MediatedCommissionSettingsLine.builder() .mediatedCommissionSettingsLineId(MediatedCommissionSettingsLineId.ofRepoId(record.getC_MediatedCommissionSettingsLine_ID(), settingsId)) .orgId(OrgId.ofRepoId(record.getAD_Org_ID())) .percentOfBasedPoints(Percent.of(record.getPercentOfBasePoints())) .seqNo(record.getSeqNo()) .productCategoryId(ProductCategoryId.ofRepoIdOrNull(record.getM_Product_Category_ID())) .build(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\commission\mediated\repository\MediatedCommissionSettingsRepo.java
2
请完成以下Java代码
public static class ActivitiCacheProperties { private boolean enabled = true; private CacheProperties.Caffeine caffeine = new CacheProperties.Caffeine(); public CacheProperties.Caffeine getCaffeine() { return this.caffeine; } public void setCaffeine(CacheProperties.Caffeine caffeine) { this.caffeine = caffeine; } public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } } public static class CaffeineCacheProviderProperties { private boolean allowNullValues = true; private boolean useSystemScheduler = true; private String defaultSpec = ""; public boolean isAllowNullValues() { return allowNullValues; }
public String getDefaultSpec() { return defaultSpec; } public void setAllowNullValues(boolean allowNullValues) { this.allowNullValues = allowNullValues; } public void setDefaultSpec(String defaultSpec) { this.defaultSpec = defaultSpec; } public boolean isUseSystemScheduler() { return useSystemScheduler; } public void setUseSystemScheduler(boolean useSystemScheduler) { this.useSystemScheduler = useSystemScheduler; } } public static class SimpleCacheProviderProperties { private boolean allowNullValues = true; public boolean isAllowNullValues() { return allowNullValues; } public void setAllowNullValues(boolean allowNullValues) { this.allowNullValues = allowNullValues; } } }
repos\Activiti-develop\activiti-core-common\activiti-spring-cache-manager\src\main\java\org\activiti\spring\cache\ActivitiSpringCacheManagerProperties.java
1
请完成以下Java代码
public Date getCreateTime() { return createTime; } @Override public void setCreateTime(Date createTime) { this.createTime = createTime; } @Override public String getResourceName() { return resourceName; } @Override public void setResourceName(String resourceName) { this.resourceName = resourceName; }
@Override public String getTenantId() { return tenantId; } @Override public void setTenantId(String tenantId) { this.tenantId = tenantId; } @Override public String toString() { return "ChannelDefinitionEntity[" + id + "]"; } }
repos\flowable-engine-main\modules\flowable-event-registry\src\main\java\org\flowable\eventregistry\impl\persistence\entity\ChannelDefinitionEntityImpl.java
1
请完成以下Java代码
public static String getObjectUrl(String bucketName, String objectName, Integer expires) { initMinio(minioUrl, minioName,minioPass); try{ // 代码逻辑说明: 获取文件外链报错提示method不能为空,导致文件下载和预览失败---- GetPresignedObjectUrlArgs objectArgs = GetPresignedObjectUrlArgs.builder().object(objectName) .bucket(bucketName) .expiry(expires).method(Method.GET).build(); String url = minioClient.getPresignedObjectUrl(objectArgs); return URLDecoder.decode(url,"UTF-8"); }catch (Exception e){ log.info("文件路径获取失败" + e.getMessage()); } return null; } /** * 初始化客户端 * @param minioUrl * @param minioName * @param minioPass * @return */ private static MinioClient initMinio(String minioUrl, String minioName,String minioPass) { if (minioClient == null) { try { minioClient = MinioClient.builder() .endpoint(minioUrl) .credentials(minioName, minioPass) .build(); } catch (Exception e) { e.printStackTrace();
} } return minioClient; } /** * 上传文件到minio * @param stream * @param relativePath * @return */ public static String upload(InputStream stream,String relativePath) throws Exception { initMinio(minioUrl, minioName,minioPass); if(minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build())) { log.info("Bucket already exists."); } else { // 创建一个名为ota的存储桶 minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build()); log.info("create a new bucket."); } PutObjectArgs objectArgs = PutObjectArgs.builder().object(relativePath) .bucket(bucketName) .contentType("application/octet-stream") .stream(stream,stream.available(),-1).build(); minioClient.putObject(objectArgs); stream.close(); return minioUrl+bucketName+"/"+relativePath; } }
repos\JeecgBoot-main\jeecg-boot\jeecg-boot-base-core\src\main\java\org\jeecg\common\util\MinioUtil.java
1
请在Spring Boot框架中完成以下Java代码
public class PasswordEncoderParser { static final String ATT_REF = "ref"; public static final String ATT_HASH = "hash"; static final String OPT_HASH_BCRYPT = "bcrypt"; private static final Map<String, Class<?>> ENCODER_CLASSES = Collections.singletonMap(OPT_HASH_BCRYPT, BCryptPasswordEncoder.class); private BeanMetadataElement passwordEncoder; public PasswordEncoderParser(Element element, ParserContext parserContext) { parse(element, parserContext); } private void parse(Element element, ParserContext parserContext) { if (element == null) { if (parserContext.getRegistry().containsBeanDefinition("passwordEncoder")) { this.passwordEncoder = parserContext.getRegistry().getBeanDefinition("passwordEncoder"); } return; } String hash = element.getAttribute(ATT_HASH);
String ref = element.getAttribute(ATT_REF); if (StringUtils.hasText(ref)) { this.passwordEncoder = new RuntimeBeanReference(ref); } else { this.passwordEncoder = createPasswordEncoderBeanDefinition(hash); ((RootBeanDefinition) this.passwordEncoder).setSource(parserContext.extractSource(element)); } } public static BeanDefinition createPasswordEncoderBeanDefinition(String hash) { Class<?> beanClass = ENCODER_CLASSES.get(hash); BeanDefinitionBuilder beanBldr = BeanDefinitionBuilder.rootBeanDefinition(beanClass); return beanBldr.getBeanDefinition(); } public BeanMetadataElement getPasswordEncoder() { return this.passwordEncoder; } }
repos\spring-security-main\config\src\main\java\org\springframework\security\config\authentication\PasswordEncoderParser.java
2
请完成以下Java代码
public KPIDataResult retrieveData() { final Stopwatch duration = Stopwatch.createStarted(); logger.trace("Loading data for {}", timeRange); final KPIDataResult.Builder data = KPIDataResult.builder() .range(timeRange); final String sql = createSelectSql(); logger.trace("Running SQL: {}", sql); PreparedStatement pstmt = null; ResultSet rs = null; try { pstmt = DB.prepareStatement(sql, ITrx.TRXNAME_ThreadInherited); rs = pstmt.executeQuery(); while (rs.next()) { rowLoader.loadRowToResult(data, rs); } } catch (final SQLException ex) { throw new DBException(ex, sql); } finally { DB.close(rs, pstmt); } return data .datasetsComputeDuration(duration.elapsed()) .build(); } private String createSelectSql() { final Evaluatee evalCtx = createEvaluationContext(); String sql = datasource
.getSqlSelect() .evaluate(evalCtx, IExpressionEvaluator.OnVariableNotFound.Preserve); if (datasource.isApplySecuritySettings()) { sql = permissionsProvider.addAccessSQL(sql, datasource.getSourceTableName(), context); } return sql; } private Evaluatee createEvaluationContext() { return Evaluatees.mapBuilder() .put("MainFromMillis", DB.TO_DATE(timeRange.getFrom())) .put("MainToMillis", DB.TO_DATE(timeRange.getTo())) .put("FromMillis", DB.TO_DATE(timeRange.getFrom())) .put("ToMillis", DB.TO_DATE(timeRange.getTo())) .put(KPIDataContext.CTXNAME_AD_User_ID, UserId.toRepoId(context.getUserId())) .put(KPIDataContext.CTXNAME_AD_Role_ID, RoleId.toRepoId(context.getRoleId())) .put(KPIDataContext.CTXNAME_AD_Client_ID, ClientId.toRepoId(context.getClientId())) .put(KPIDataContext.CTXNAME_AD_Org_ID, OrgId.toRepoId(context.getOrgId())) .put("#Date", DB.TO_DATE(SystemTime.asZonedDateTime())) .build(); } public KPIZoomIntoDetailsInfo getKPIZoomIntoDetailsInfo() { final String sqlWhereClause = datasource .getSqlDetailsWhereClause() .evaluate(createEvaluationContext(), IExpressionEvaluator.OnVariableNotFound.Fail); return KPIZoomIntoDetailsInfo.builder() .filterCaption(kpiCaption) .targetWindowId(datasource.getTargetWindowId()) .tableName(datasource.getSourceTableName()) .sqlWhereClause(sqlWhereClause) .build(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\kpi\data\sql\SQLKPIDataLoader.java
1
请完成以下Java代码
public static class UpdateAssignmentResult { public static final UpdateAssignmentResult updateDone( @NonNull final AssignableInvoiceCandidate candidate, @NonNull final List<AssignableInvoiceCandidate> additionalChangedCandidates) { return new UpdateAssignmentResult(true, candidate, additionalChangedCandidates); } public static final UpdateAssignmentResult noUpdateDone(@NonNull final AssignableInvoiceCandidate candidate) { return new UpdateAssignmentResult(false, candidate, ImmutableList.of()); } /** {@code false} means that no update was required since the data as loaded from the DB was already up to date. */ boolean updateWasDone; /** The result, as loaded from the DB. */ AssignableInvoiceCandidate assignableInvoiceCandidate; List<AssignableInvoiceCandidate> additionalChangedCandidates; } @lombok.Value @lombok.Builder(toBuilder = true) public static class UnassignResult
{ /** * The assignable candidate after the unassignment. * Note that this candidate has no assignments anymore. */ @NonNull AssignableInvoiceCandidate assignableCandidate; /** * Each pair's {@link AssignCandidatesRequest#getAssignableInvoiceCandidate()} is this result's {@link #assignableCandidate}. */ @Singular List<UnassignedPairOfCandidates> unassignedPairs; /** * Further candidates whose assignments also changed due to the unassignment. */ @Singular("additionalChangedCandidate") List<AssignableInvoiceCandidate> additionalChangedCandidates; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\refund\CandidateAssignmentService.java
1
请完成以下Java代码
private static class JwtClaimIssuerConverter implements Converter<BearerTokenAuthenticationToken, String> { @Override public String convert(@NonNull BearerTokenAuthenticationToken authentication) { String token = authentication.getToken(); try { String issuer = JWTParser.parse(token).getJWTClaimsSet().getIssuer(); if (issuer != null) { return issuer; } } catch (Exception cause) { AuthenticationException ex = new InvalidBearerTokenException(cause.getMessage(), cause); ex.setAuthenticationRequest(authentication); throw ex; } AuthenticationException ex = new InvalidBearerTokenException("Missing issuer"); ex.setAuthenticationRequest(authentication); throw ex; } } static class TrustedIssuerJwtAuthenticationManagerResolver implements AuthenticationManagerResolver<String> { private final Log logger = LogFactory.getLog(getClass()); private final Map<String, AuthenticationManager> authenticationManagers = new ConcurrentHashMap<>();
private final Predicate<String> trustedIssuer; TrustedIssuerJwtAuthenticationManagerResolver(Predicate<String> trustedIssuer) { this.trustedIssuer = trustedIssuer; } @Override public AuthenticationManager resolve(String issuer) { if (this.trustedIssuer.test(issuer)) { AuthenticationManager authenticationManager = this.authenticationManagers.computeIfAbsent(issuer, (k) -> { this.logger.debug("Constructing AuthenticationManager"); JwtDecoder jwtDecoder = JwtDecoders.fromIssuerLocation(issuer); return new JwtAuthenticationProvider(jwtDecoder)::authenticate; }); this.logger.debug(LogMessage.format("Resolved AuthenticationManager for issuer '%s'", issuer)); return authenticationManager; } else { this.logger.debug("Did not resolve AuthenticationManager since issuer is not trusted"); } return null; } } }
repos\spring-security-main\oauth2\oauth2-resource-server\src\main\java\org\springframework\security\oauth2\server\resource\authentication\JwtIssuerAuthenticationManagerResolver.java
1
请在Spring Boot框架中完成以下Java代码
public class FooController { @Autowired private ApplicationEventPublisher eventPublisher; public FooController() { super(); } // API // read - single @RequestMapping(value = "/{id}", method = RequestMethod.GET) @ResponseBody public Foo findById(@PathVariable("id") final Long id, final UriComponentsBuilder uriBuilder, final HttpServletResponse response) { return new Foo(randomAlphabetic(6)); }
// read - multiple @RequestMapping(method = RequestMethod.GET) @ResponseBody public List<Foo> findAll() { return Arrays.asList(new Foo(randomAlphabetic(6))); } // write - just for test @RequestMapping(method = RequestMethod.POST) @ResponseStatus(HttpStatus.CREATED) @ResponseBody public Foo create(@RequestBody final Foo foo) { return foo; } }
repos\tutorials-master\spring-security-modules\spring-security-web-mvc-custom\src\main\java\com\baeldung\web\controller\FooController.java
2
请完成以下Java代码
public void recordContextVariableUsed(final ContextPath path, final String contextVariable, boolean wasFound) { reportedMissingButNotUsed.remove(path, contextVariable); final boolean isKnownAsMissing = isKnownAsMissing(path, contextVariable); if (wasFound) { if (isKnownAsMissing) { reportedMissingButExists.put(path, contextVariable); } } else // not found { if (!isKnownAsMissing) { foundMissing.put(path, contextVariable); } } } public boolean isKnownAsMissing(final ContextPath path, String contextVariable) { return all.containsEntry(path, contextVariable); } public JsonContextVariablesResponse toJsonContextVariablesResponse()
{ return JsonContextVariablesResponse.builder() .missing(toKeyAndCommaSeparatedValues(foundMissing, adWindowIdsInScope)) .reportedMissingButNotUsed(toKeyAndCommaSeparatedValues(reportedMissingButNotUsed, adWindowIdsInScope)) .reportedMissingButExists(toKeyAndCommaSeparatedValues(reportedMissingButExists, adWindowIdsInScope)) .build(); } private static Map<String, String> toKeyAndCommaSeparatedValues( @NonNull final SetMultimap<ContextPath, String> multimap, @Nullable final AdWindowIdSelection adWindowIdsInScope) { final ImmutableMap.Builder<String, String> result = ImmutableMap.builder(); multimap.asMap().forEach((path, values) -> { if (adWindowIdsInScope != null && !adWindowIdsInScope.contains(path)) { return; } result.put(path.toJson(), Joiner.on(',').join(values)); }); return result.build(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\health\MissingContextVariables.java
1
请完成以下Java代码
public String getTagValue(@NonNull final String tagName) { return Check.assumeNotEmpty( getTagValueOrNull(tagName), "This attachmentEntry needs to have a tag with name={} and a value; this={}", tagName, this); } public String getTagValueOrNull(String tagName) { return tags.get(tagName); } public boolean hasAllTagsSetToAnyValue(@NonNull final List<String> tagNames) { for (final String tagName : tagNames) { if (getTagValueOrNull(tagName) == null) { return false; } } return true; } public AttachmentTags withTag(@NonNull final String tagName, @NonNull final String tagValue) { if (hasTagSetToString(tagName, tagValue))
{ return this; } else { final HashMap<String, String> map = new HashMap<>(this.tags); map.put(tagName, tagValue); return new AttachmentTags(map); } } public AttachmentTags withoutTags(@NonNull final AttachmentTags tagsToRemove) { final HashMap<String, String> tmp = new HashMap<>(this.tags); tmp.keySet().removeAll(tagsToRemove.tags.keySet()); return new AttachmentTags(tmp); } public AttachmentTags withTags(@NonNull final AttachmentTags additionalTags) { final HashMap<String, String> tmp = new HashMap<>(this.tags); tmp.putAll(additionalTags.tags); return new AttachmentTags(tmp); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\attachments\AttachmentTags.java
1
请完成以下Java代码
public void setC_Flatrate_DataEntry_ID (final int C_Flatrate_DataEntry_ID) { if (C_Flatrate_DataEntry_ID < 1) set_ValueNoCheck (COLUMNNAME_C_Flatrate_DataEntry_ID, null); else set_ValueNoCheck (COLUMNNAME_C_Flatrate_DataEntry_ID, C_Flatrate_DataEntry_ID); } @Override public int getC_Flatrate_DataEntry_ID() { return get_ValueAsInt(COLUMNNAME_C_Flatrate_DataEntry_ID); } @Override public void setC_UOM_ID (final int C_UOM_ID) { if (C_UOM_ID < 1) set_Value (COLUMNNAME_C_UOM_ID, null); else set_Value (COLUMNNAME_C_UOM_ID, C_UOM_ID); } @Override public int getC_UOM_ID() { return get_ValueAsInt(COLUMNNAME_C_UOM_ID); } @Override public org.compiere.model.I_M_AttributeSetInstance getM_AttributeSetInstance() { return get_ValueAsPO(COLUMNNAME_M_AttributeSetInstance_ID, org.compiere.model.I_M_AttributeSetInstance.class); } @Override public void setM_AttributeSetInstance(final org.compiere.model.I_M_AttributeSetInstance M_AttributeSetInstance) { set_ValueFromPO(COLUMNNAME_M_AttributeSetInstance_ID, org.compiere.model.I_M_AttributeSetInstance.class, M_AttributeSetInstance); } @Override public void setM_AttributeSetInstance_ID (final int M_AttributeSetInstance_ID) { if (M_AttributeSetInstance_ID < 0) set_Value (COLUMNNAME_M_AttributeSetInstance_ID, null); else set_Value (COLUMNNAME_M_AttributeSetInstance_ID, M_AttributeSetInstance_ID);
} @Override public int getM_AttributeSetInstance_ID() { return get_ValueAsInt(COLUMNNAME_M_AttributeSetInstance_ID); } @Override public void setQty_Reported (final @Nullable BigDecimal Qty_Reported) { set_Value (COLUMNNAME_Qty_Reported, Qty_Reported); } @Override public BigDecimal getQty_Reported() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty_Reported); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setSeqNo (final int SeqNo) { set_Value (COLUMNNAME_SeqNo, SeqNo); } @Override public int getSeqNo() { return get_ValueAsInt(COLUMNNAME_SeqNo); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java-gen\de\metas\contracts\model\X_C_Flatrate_DataEntry_Detail.java
1
请完成以下Java代码
public void setPriceActual (final @Nullable BigDecimal PriceActual) { set_Value (COLUMNNAME_PriceActual, PriceActual); } @Override public BigDecimal getPriceActual() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PriceActual); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setPriceEntered (final @Nullable BigDecimal PriceEntered) { set_Value (COLUMNNAME_PriceEntered, PriceEntered); } @Override public BigDecimal getPriceEntered() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PriceEntered); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setPrice_UOM_ID (final int Price_UOM_ID) { if (Price_UOM_ID < 1) set_Value (COLUMNNAME_Price_UOM_ID, null); else set_Value (COLUMNNAME_Price_UOM_ID, Price_UOM_ID); } @Override public int getPrice_UOM_ID() { return get_ValueAsInt(COLUMNNAME_Price_UOM_ID); } @Override public void setQty (final @Nullable BigDecimal Qty) { set_Value (COLUMNNAME_Qty, Qty); } @Override public BigDecimal getQty()
{ final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setQtyEnteredInPriceUOM (final @Nullable BigDecimal QtyEnteredInPriceUOM) { set_Value (COLUMNNAME_QtyEnteredInPriceUOM, QtyEnteredInPriceUOM); } @Override public BigDecimal getQtyEnteredInPriceUOM() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyEnteredInPriceUOM); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setSeqNo (final int SeqNo) { set_Value (COLUMNNAME_SeqNo, SeqNo); } @Override public int getSeqNo() { return get_ValueAsInt(COLUMNNAME_SeqNo); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Invoice_Detail.java
1
请完成以下Java代码
public void validate(MigratingActivityInstance migratingInstance, MigratingProcessInstance migratingProcessInstance, MigratingActivityInstanceValidationReportImpl instanceReport) { ScopeImpl sourceScope = migratingInstance.getSourceScope(); ScopeImpl targetScope = migratingInstance.getTargetScope(); if (migratingInstance.migrates()) { boolean becomesNonScope = sourceScope.isScope() && !targetScope.isScope(); if (becomesNonScope) { Map<String, List<MigratingVariableInstance>> dependentVariablesByName = getMigratingVariableInstancesByName(migratingInstance); for (String variableName : dependentVariablesByName.keySet()) { if (dependentVariablesByName.get(variableName).size() > 1) { instanceReport.addFailure("The variable '" + variableName + "' exists in both, this scope and " + "concurrent local in the parent scope. " + "Migrating to a non-scope activity would overwrite one of them."); } } }
} } protected Map<String, List<MigratingVariableInstance>> getMigratingVariableInstancesByName(MigratingActivityInstance activityInstance) { Map<String, List<MigratingVariableInstance>> result = new HashMap<String, List<MigratingVariableInstance>>(); for (MigratingInstance migratingInstance : activityInstance.getMigratingDependentInstances()) { if (migratingInstance instanceof MigratingVariableInstance) { MigratingVariableInstance migratingVariableInstance = (MigratingVariableInstance) migratingInstance; CollectionUtil.addToMapOfLists(result, migratingVariableInstance.getVariableName(), migratingVariableInstance); } } return result; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\migration\validation\instance\VariableConflictActivityInstanceValidator.java
1
请在Spring Boot框架中完成以下Java代码
public CmmnEngineFactoryBean cmmnEngine(SpringCmmnEngineConfiguration cmmnEngineConfiguration) { CmmnEngineFactoryBean factory = new CmmnEngineFactoryBean(); factory.setCmmnEngineConfiguration(cmmnEngineConfiguration); invokeConfigurers(cmmnEngineConfiguration); return factory; } } @Bean public CmmnRuntimeService cmmnRuntimeService(CmmnEngine cmmnEngine) { return cmmnEngine.getCmmnRuntimeService(); } @Bean public DynamicCmmnService dynamicCmmnService(CmmnEngine cmmnEngine) { return cmmnEngine.getDynamicCmmnService(); } @Bean public CmmnTaskService cmmnTaskService(CmmnEngine cmmnEngine) { return cmmnEngine.getCmmnTaskService(); } @Bean
public CmmnManagementService cmmnManagementService(CmmnEngine cmmnEngine) { return cmmnEngine.getCmmnManagementService(); } @Bean public CmmnRepositoryService cmmnRepositoryService(CmmnEngine cmmnEngine) { return cmmnEngine.getCmmnRepositoryService(); } @Bean public CmmnHistoryService cmmnHistoryService(CmmnEngine cmmnEngine) { return cmmnEngine.getCmmnHistoryService(); } @Bean public CmmnMigrationService cmmnMigrationService(CmmnEngine cmmnEngine) { return cmmnEngine.getCmmnMigrationService(); } }
repos\flowable-engine-main\modules\flowable-spring-boot\flowable-spring-boot-starters\flowable-spring-boot-autoconfigure\src\main\java\org\flowable\spring\boot\cmmn\CmmnEngineServicesAutoConfiguration.java
2
请完成以下Java代码
public BigInteger getGeschaeftsvorfallCode() { return geschaeftsvorfallCode; } public void setGeschaeftsvorfallCode(BigInteger geschaeftsvorfallCode) { this.geschaeftsvorfallCode = geschaeftsvorfallCode; } public String getBuchungstext() { return buchungstext; } public void setBuchungstext(String buchungstext) { this.buchungstext = buchungstext; } public String getPrimanotennummer() { return primanotennummer; } public void setPrimanotennummer(String primanotennummer) { this.primanotennummer = primanotennummer; } public String getVerwendungszweck() { return verwendungszweck; } public void setVerwendungszweck(String verwendungszweck) { this.verwendungszweck = verwendungszweck; } public String getPartnerBlz() { return partnerBlz; }
public void setPartnerBlz(String partnerBlz) { this.partnerBlz = partnerBlz; } public String getPartnerKtoNr() { return partnerKtoNr; } public void setPartnerKtoNr(String partnerKtoNr) { this.partnerKtoNr = partnerKtoNr; } public String getPartnerName() { return partnerName; } public void setPartnerName(String partnerName) { this.partnerName = partnerName; } public String getTextschluessel() { return textschluessel; } public void setTextschluessel(String textschluessel) { this.textschluessel = textschluessel; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.base\src\main\java\de\schaeffer\compiere\mt940\BankstatementLine.java
1
请在Spring Boot框架中完成以下Java代码
public Object createCollectionFixedSize() { // 设置集合名称 String collectionName = "users2"; // 设置集合参数 long size = 1024L; long max = 5L; // 创建固定大小集合 CollectionOptions collectionOptions = CollectionOptions.empty() // 创建固定集合。固定集合是指有着固定大小的集合,当达到最大值时,它会自动覆盖最早的文档。 .capped() // 固定集合指定一个最大值,以千字节计(KB),如果 capped 为 true,也需要指定该字段。 .size(size) // 指定固定集合中包含文档的最大数量。 .maxDocuments(max); // 执行创建集合 mongoTemplate.createCollection(collectionName, collectionOptions); // 检测新的集合是否存在,返回创建结果 return mongoTemplate.collectionExists(collectionName) ? "创建视图成功" : "创建视图失败"; } /** * 创建【验证文档数据】的集合 * * 创建集合并在文档"插入"与"更新"时进行数据效验,如果符合创建集合设置的条件就进允许更新与插入,否则则按照设置的设置的策略进行处理。 * * * 效验级别: * - off:关闭数据校验。 * - strict:(默认值) 对所有的文档"插入"与"更新"操作有效。 * - moderate:仅对"插入"和满足校验规则的"文档"做"更新"操作有效。对已存在的不符合校验规则的"文档"无效。 * * 执行策略: * - error:(默认值) 文档必须满足校验规则,才能被写入。 * - warn:对于"文档"不符合校验规则的 MongoDB 允许写入,但会记录一条告警到 mongod.log 中去。日志内容记录报错信息以及该"文档"的完整记录。 * * @return 创建集合结果 */ public Object createCollectionValidation() {
// 设置集合名称 String collectionName = "users3"; // 设置验证条件,只允许岁数大于20的用户信息插入 CriteriaDefinition criteria = Criteria.where("age").gt(20); // 设置集合选项验证对象 CollectionOptions collectionOptions = CollectionOptions.empty() .validator(Validator.criteria(criteria)) // 设置效验级别 .strictValidation() // 设置效验不通过后执行的动作 .failOnValidationError(); // 执行创建集合 mongoTemplate.createCollection(collectionName, collectionOptions); // 检测新的集合是否存在,返回创建结果 return mongoTemplate.collectionExists(collectionName) ? "创建集合成功" : "创建集合失败"; } }
repos\springboot-demo-master\mongodb\src\main\java\demo\et\mongodb\service\CreateCollectionService.java
2
请在Spring Boot框架中完成以下Java代码
public @Nullable LongSerializationPolicy getLongSerializationPolicy() { return this.longSerializationPolicy; } public void setLongSerializationPolicy(@Nullable LongSerializationPolicy longSerializationPolicy) { this.longSerializationPolicy = longSerializationPolicy; } public @Nullable FieldNamingPolicy getFieldNamingPolicy() { return this.fieldNamingPolicy; } public void setFieldNamingPolicy(@Nullable FieldNamingPolicy fieldNamingPolicy) { this.fieldNamingPolicy = fieldNamingPolicy; } public @Nullable Boolean getPrettyPrinting() { return this.prettyPrinting; } public void setPrettyPrinting(@Nullable Boolean prettyPrinting) { this.prettyPrinting = prettyPrinting; } public @Nullable Strictness getStrictness() { return this.strictness; } public void setStrictness(@Nullable Strictness strictness) { this.strictness = strictness; } public void setLenient(@Nullable Boolean lenient) { setStrictness((lenient != null && lenient) ? Strictness.LENIENT : Strictness.STRICT); } public @Nullable Boolean getDisableHtmlEscaping() { return this.disableHtmlEscaping; } public void setDisableHtmlEscaping(@Nullable Boolean disableHtmlEscaping) { this.disableHtmlEscaping = disableHtmlEscaping; } public @Nullable String getDateFormat() { return this.dateFormat; } public void setDateFormat(@Nullable String dateFormat) { this.dateFormat = dateFormat; } /**
* Enumeration of levels of strictness. Values are the same as those on * {@link com.google.gson.Strictness} that was introduced in Gson 2.11. To maximize * backwards compatibility, the Gson enum is not used directly. */ public enum Strictness { /** * Lenient compliance. */ LENIENT, /** * Strict compliance with some small deviations for legacy reasons. */ LEGACY_STRICT, /** * Strict compliance. */ STRICT } }
repos\spring-boot-4.0.1\module\spring-boot-gson\src\main\java\org\springframework\boot\gson\autoconfigure\GsonProperties.java
2
请完成以下Java代码
public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; }
public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public int getStock() { return stock; } public void setStock(int stock) { this.stock = stock; } }
repos\tutorials-master\persistence-modules\spring-data-elasticsearch\src\main\java\com\baeldung\elasticsearch\importcsv\Product.java
1
请完成以下Java代码
protected void addError(List<ValidationError> validationErrors, String problem, Process process, BaseElement baseElement, String description, boolean isWarning) { addError(validationErrors, problem, process, null, baseElement, description, isWarning); } protected void addError(List<ValidationError> validationErrors, String problem, Process process, FlowElement flowElement, BaseElement baseElement, String description, boolean isWarning) { ValidationError error = new ValidationError(); error.setWarning(isWarning); if (process != null) { error.setProcessDefinitionId(process.getId()); error.setProcessDefinitionName(process.getName()); } if (baseElement != null) { error.setXmlLineNumber(baseElement.getXmlRowNumber()); error.setXmlColumnNumber(baseElement.getXmlColumnNumber()); } error.setProblem(problem); error.setDefaultDescription(description); if (flowElement == null && baseElement instanceof FlowElement) { flowElement = (FlowElement) baseElement; } if (flowElement != null) {
error.setActivityId(flowElement.getId()); error.setActivityName(flowElement.getName()); } addError(validationErrors, error); } protected void addError(List<ValidationError> validationErrors, String problem, Process process, String id, String description) { ValidationError error = new ValidationError(); if (process != null) { error.setProcessDefinitionId(process.getId()); error.setProcessDefinitionName(process.getName()); } error.setProblem(problem); error.setDefaultDescription(description); error.setActivityId(id); addError(validationErrors, error); } }
repos\flowable-engine-main\modules\flowable-process-validation\src\main\java\org\flowable\validation\validator\ValidatorImpl.java
1
请在Spring Boot框架中完成以下Java代码
public HuId resolveHUId(@NonNull final ScannedCode scannedCode) { final HUQRCode huQRCode = resolveHUQRCode(scannedCode); return huQRCodesService.getHuIdByQRCode(huQRCode); } public PackToHUsProducer newPackToHUsProducer() { return PackToHUsProducer.builder() .handlingUnitsBL(handlingUnitsBL) .huPIItemProductBL(hupiItemProductBL) .uomConversionBL(uomConversionBL) .inventoryService(inventoryService) .build(); } public IAutoCloseable newContext() { return HUContextHolder.temporarySet(handlingUnitsBL.createMutableHUContextForProcessing()); } public ProductId getSingleProductId(@NonNull final HUQRCode huQRCode) { final HuId huId = huQRCodesService.getHuIdByQRCode(huQRCode); return getSingleHUProductStorage(huId).getProductId(); } public IHUProductStorage getSingleHUProductStorage(@NonNull final HuId huId) { return handlingUnitsBL.getSingleHUProductStorage(huId); }
public Quantity getProductQuantity(@NonNull final HuId huId, @NonNull ProductId productId) { return getHUProductStorage(huId, productId) .map(IHUProductStorage::getQty) .filter(Quantity::isPositive) .orElseThrow(() -> new AdempiereException(PRODUCT_DOES_NOT_MATCH)); } private Optional<IHUProductStorage> getHUProductStorage(final @NotNull HuId huId, final @NotNull ProductId productId) { final I_M_HU hu = handlingUnitsBL.getById(huId); final IHUStorageFactory storageFactory = handlingUnitsBL.getStorageFactory(); return Optional.ofNullable(storageFactory.getStorage(hu).getProductStorageOrNull(productId)); } public void assetHUContainsProduct(@NonNull final HUQRCode huQRCode, @NonNull final ProductId productId) { final HuId huId = huQRCodesService.getHuIdByQRCode(huQRCode); getProductQuantity(huId, productId); // shall throw exception if no qty found } public void deleteReservationsByDocumentRefs(final ImmutableSet<HUReservationDocRef> huReservationDocRefs) { huReservationService.deleteReservationsByDocumentRefs(huReservationDocRefs); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.distribution.rest-api\src\main\java\de\metas\distribution\mobileui\external_services\hu\DistributionHUService.java
2
请完成以下Java代码
public void setReason (java.lang.String Reason) { set_Value (COLUMNNAME_Reason, Reason); } /** Get Grund. @return Grund */ @Override public java.lang.String getReason () { return (java.lang.String)get_Value(COLUMNNAME_Reason); } /** Set Sachbearbeiter. @param ResponsiblePerson Sachbearbeiter */ @Override public void setResponsiblePerson (java.lang.String ResponsiblePerson) { set_Value (COLUMNNAME_ResponsiblePerson, ResponsiblePerson); } /** Get Sachbearbeiter. @return Sachbearbeiter */ @Override public java.lang.String getResponsiblePerson () { return (java.lang.String)get_Value(COLUMNNAME_ResponsiblePerson); }
/** Set Status. @param Status Status */ @Override public void setStatus (java.lang.String Status) { set_Value (COLUMNNAME_Status, Status); } /** Get Status. @return Status */ @Override public java.lang.String getStatus () { return (java.lang.String)get_Value(COLUMNNAME_Status); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Invoice_Rejection_Detail.java
1
请完成以下Java代码
public class ApplicationContextPathUtil { public static String getApplicationPathByProcessDefinitionId(ProcessEngine engine, String processDefinitionId) { ProcessDefinition processDefinition = engine.getRepositoryService().getProcessDefinition(processDefinitionId); if (processDefinition == null) { return null; } return getApplicationPathForDeployment(engine, processDefinition.getDeploymentId()); } public static String getApplicationPathByCaseDefinitionId(ProcessEngine engine, String caseDefinitionId) { CaseDefinition caseDefinition = engine.getRepositoryService().getCaseDefinition(caseDefinitionId); if (caseDefinition == null) { return null; } return getApplicationPathForDeployment(engine, caseDefinition.getDeploymentId()); } public static String getApplicationPathForDeployment(ProcessEngine engine, String deploymentId) { // get the name of the process application that made the deployment String processApplicationName = null; IdentityService identityService = engine.getIdentityService(); Authentication currentAuthentication = identityService.getCurrentAuthentication();
try { identityService.clearAuthentication(); processApplicationName = engine.getManagementService().getProcessApplicationForDeployment(deploymentId); } finally { identityService.setAuthentication(currentAuthentication); } if (processApplicationName == null) { // no a process application deployment return null; } else { ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService(); ProcessApplicationInfo processApplicationInfo = processApplicationService.getProcessApplicationInfo(processApplicationName); return processApplicationInfo.getProperties().get(ProcessApplicationInfo.PROP_SERVLET_CONTEXT_PATH); } } }
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\util\ApplicationContextPathUtil.java
1
请完成以下Java代码
public String getEnd() { return end; } public void setEnd(String end) { this.end = end; } public String getQrcantonid() { return qrcantonid; } public void setQrcantonid(String qrcantonid) { this.qrcantonid = qrcantonid; }
public String getDeclare() { return declare; } public void setDeclare(String declare) { this.declare = declare; } public String getDeclareisend() { return declareisend; } public void setDeclareisend(String declareisend) { this.declareisend = declareisend; } }
repos\SpringBootBucket-master\springboot-batch\src\main\java\com\xncoding\trans\modules\canton\Canton.java
1
请完成以下Java代码
private static PaymentDirection extractPaymentDirection(final I_C_Payment payment) { return PaymentDirection.ofReceiptFlag(payment.isReceipt()); } private Amount extractPayAmt(@NonNull final I_C_Payment payment) { final CurrencyId currencyId = CurrencyId.ofRepoId(payment.getC_Currency_ID()); return moneyService.toAmount(payment.getPayAmt(), currencyId); } private void markAsMultiplePayments(final I_C_BankStatementLine bankStatementLine) { bankStatementLine.setIsReconciled(true); bankStatementLine.setIsMultiplePaymentOrInvoice(true); bankStatementLine.setIsMultiplePayment(true); bankStatementLine.setC_BPartner_ID(-1); bankStatementLine.setC_Payment_ID(-1); bankStatementLine.setC_Invoice_ID(-1); bankStatementDAO.save(bankStatementLine); } private void createBankStatementLineRef( @NonNull final PaymentToLink paymentToLink, @NonNull final I_C_BankStatementLine bankStatementLine, final int lineNo) { final PaymentId paymentId = paymentToLink.getPaymentId(); final I_C_Payment payment = getPaymentById(paymentId); final BankStatementLineReference lineRef = bankStatementDAO.createBankStatementLineRef(BankStatementLineRefCreateRequest.builder() .bankStatementId(BankStatementId.ofRepoId(bankStatementLine.getC_BankStatement_ID())) .bankStatementLineId(BankStatementLineId.ofRepoId(bankStatementLine.getC_BankStatementLine_ID())) .processed(bankStatementLine.isProcessed()) // .orgId(OrgId.ofRepoId(bankStatementLine.getAD_Org_ID())) // .lineNo(lineNo) //
.paymentId(paymentId) .bpartnerId(BPartnerId.ofRepoId(payment.getC_BPartner_ID())) .invoiceId(InvoiceId.ofRepoIdOrNull(payment.getC_Invoice_ID())) // .trxAmt(moneyService.toMoney(paymentToLink.getStatementLineAmt())) // .build()); // // Mark payment as reconciled if (doReconcilePayments) { paymentBL.markReconciledAndSave( payment, PaymentReconcileReference.bankStatementLineRef(lineRef.getId())); } // linkedPayments.add(PaymentLinkResult.builder() .bankStatementId(lineRef.getBankStatementId()) .bankStatementLineId(lineRef.getBankStatementLineId()) .bankStatementLineRefId(lineRef.getBankStatementLineRefId()) .paymentId(lineRef.getPaymentId()) .statementTrxAmt(lineRef.getTrxAmt()) .paymentMarkedAsReconciled(payment.isReconciled()) .build()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.base\src\main\java\de\metas\banking\payment\impl\BankStatementLineMultiPaymentLinkCommand.java
1
请完成以下Java代码
public static String toHumanReadableByNumOfLeadingZeros(long size) { if (size < 0) throw new IllegalArgumentException("Invalid file size: " + size); if (size < 1024) return size + " Bytes"; int unitIdx = (63 - Long.numberOfLeadingZeros(size)) / 10; return formatSize(size, 1L << (unitIdx * 10), " KMGTPE".charAt(unitIdx) + "iB"); } enum SizeUnitBinaryPrefixes { Bytes(1L), KiB(Bytes.unitBase << 10), MiB(KiB.unitBase << 10), GiB(MiB.unitBase << 10), TiB(GiB.unitBase << 10), PiB(TiB.unitBase << 10), EiB(PiB.unitBase << 10); private final Long unitBase; public static List<SizeUnitBinaryPrefixes> unitsInDescending() { List<SizeUnitBinaryPrefixes> list = Arrays.asList(values()); Collections.reverse(list); return list; } public Long getUnitBase() { return unitBase; } SizeUnitBinaryPrefixes(long unitBase) { this.unitBase = unitBase; } } enum SizeUnitSIPrefixes { Bytes(1L), KB(Bytes.unitBase * 1000), MB(KB.unitBase * 1000), GB(MB.unitBase * 1000), TB(GB.unitBase * 1000),
PB(TB.unitBase * 1000), EB(PB.unitBase * 1000); private final Long unitBase; public static List<SizeUnitSIPrefixes> unitsInDescending() { List<SizeUnitSIPrefixes> list = Arrays.asList(values()); Collections.reverse(list); return list; } public Long getUnitBase() { return unitBase; } SizeUnitSIPrefixes(long unitBase) { this.unitBase = unitBase; } } }
repos\tutorials-master\core-java-modules\core-java-numbers-4\src\main\java\com\baeldung\humanreadablebytes\FileSizeFormatUtil.java
1
请完成以下Java代码
public void mouseExited(final MouseEvent e) { } /** * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent) * @param e */ @Override public void mousePressed(final MouseEvent e) { } /** * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent) * @param e */ @Override public void mouseReleased(final MouseEvent e) { } /** * Set Title * * @param title title */ @Override public void setTitle(String title) { if (title != null) { final int pos = title.indexOf('&'); if (pos != -1 && title.length() > pos) // We have a nemonic { final int mnemonic = title.toUpperCase().charAt(pos + 1); if (mnemonic != ' ') { title = title.substring(0, pos) + title.substring(pos + 1); } } } super.setTitle(title); } // setTitle /** Dispose Action Name */ protected static String ACTION_DISPOSE = "CDialogDispose"; /** Action */ protected static DialogAction s_dialogAction = new DialogAction(ACTION_DISPOSE); /** ALT-EXCAPE */ protected static KeyStroke s_disposeKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_PAUSE, InputEvent.ALT_MASK); /** * Adempiere Dialog Action * * @author Jorg Janke * @version $Id: CDialog.java,v 1.3 2006/07/30 00:52:24 jjanke Exp $ */ static class DialogAction extends AbstractAction { /** * */ private static final long serialVersionUID = -1502992970807699945L; DialogAction(final String actionName) { super(actionName); putValue(Action.ACTION_COMMAND_KEY, actionName);
} // DialogAction /** * Action Listener * * @param e event */ @Override public void actionPerformed(final ActionEvent e) { if (ACTION_DISPOSE.equals(e.getActionCommand())) { Object source = e.getSource(); while (source != null) { if (source instanceof Window) { ((Window)source).dispose(); return; } if (source instanceof Container) { source = ((Container)source).getParent(); } else { source = null; } } } else { System.out.println("Action: " + e); } } // actionPerformed } // DialogAction } // CDialog
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\swing\CDialog.java
1
请在Spring Boot框架中完成以下Java代码
public void delete(Long id) { this.pmsMenuDao.delete(id); } /** * 根据角色id串获取菜单 * * @param roleIdsStr * @return */ @SuppressWarnings("rawtypes") public List listByRoleIds(String roleIdsStr) { return this.pmsMenuDao.listByRoleIds(roleIdsStr); } /** * 根据菜单ID查找菜单(可用于判断菜单下是否还有子菜单). * * @param parentId * . * @return menuList. */ public List<PmsMenu> listByParentId(Long parentId) { return pmsMenuDao.listByParentId(parentId); } /*** * 根据名称和是否叶子节点查询数据 * * @param isLeaf * 是否是叶子节点 * @param name * 节点名称 * @return */ public List<PmsMenu> getMenuByNameAndIsLeaf(Map<String, Object> map) { return pmsMenuDao.getMenuByNameAndIsLeaf(map); } /**
* 根据菜单ID获取菜单. * * @param pid * @return */ public PmsMenu getById(Long pid) { return pmsMenuDao.getById(pid); } /** * 更新菜单. * * @param menu */ public void update(PmsMenu menu) { pmsMenuDao.update(menu); } /** * 根据角色查找角色对应的菜单ID集 * * @param roleId * @return */ public String getMenuIdsByRoleId(Long roleId) { List<PmsMenuRole> menuList = pmsMenuRoleDao.listByRoleId(roleId); StringBuffer menuIds = new StringBuffer(""); if (menuList != null && !menuList.isEmpty()) { for (PmsMenuRole rm : menuList) { menuIds.append(rm.getMenuId()).append(","); } } return menuIds.toString(); } }
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\permission\service\impl\PmsMenuServiceImpl.java
2
请完成以下Java代码
public void setMD_AvailableForSales_Config_ID (final int MD_AvailableForSales_Config_ID) { if (MD_AvailableForSales_Config_ID < 1) set_ValueNoCheck (COLUMNNAME_MD_AvailableForSales_Config_ID, null); else set_ValueNoCheck (COLUMNNAME_MD_AvailableForSales_Config_ID, MD_AvailableForSales_Config_ID); } @Override public int getMD_AvailableForSales_Config_ID() { return get_ValueAsInt(COLUMNNAME_MD_AvailableForSales_Config_ID); } @Override public void setSalesOrderLookBehindHours (final int SalesOrderLookBehindHours) { set_Value (COLUMNNAME_SalesOrderLookBehindHours, SalesOrderLookBehindHours); } @Override public int getSalesOrderLookBehindHours()
{ return get_ValueAsInt(COLUMNNAME_SalesOrderLookBehindHours); } @Override public void setShipmentDateLookAheadHours (final int ShipmentDateLookAheadHours) { set_Value (COLUMNNAME_ShipmentDateLookAheadHours, ShipmentDateLookAheadHours); } @Override public int getShipmentDateLookAheadHours() { return get_ValueAsInt(COLUMNNAME_ShipmentDateLookAheadHours); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.material\cockpit\src\main\java-gen\de\metas\material\cockpit\model\X_MD_AvailableForSales_Config.java
1
请完成以下Java代码
protected boolean afterSave(final boolean newRecord, final boolean success) { if (newRecord && success) { // Trees insert_Tree(MTree_Base.TREETYPE_BPartner); // Accounting insert_Accounting("C_BP_Customer_Acct", "C_BP_Group_Acct", "p.C_BP_Group_ID=" + getC_BP_Group_ID()); insert_Accounting("C_BP_Vendor_Acct", "C_BP_Group_Acct", "p.C_BP_Group_ID=" + getC_BP_Group_ID()); insert_Accounting("C_BP_Employee_Acct", "C_AcctSchema_Default", null); } // Value/Name change if (success && !newRecord && (is_ValueChanged("Value") || is_ValueChanged("Name"))) { MAccount.updateValueDescription(getCtx(), "C_BPartner_ID=" + getC_BPartner_ID(), get_TrxName()); } return success; } // afterSave /** * Before Delete * * @return true */
@Override protected boolean beforeDelete() { return delete_Accounting("C_BP_Customer_Acct") && delete_Accounting("C_BP_Vendor_Acct") && delete_Accounting("C_BP_Employee_Acct"); } // beforeDelete /** * After Delete * * @param success * @return deleted */ @Override protected boolean afterDelete(final boolean success) { if (success) { delete_Tree(MTree_Base.TREETYPE_BPartner); } return success; } // afterDelete } // MBPartner
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MBPartner.java
1
请完成以下Java代码
public Object postProcessAfterInitialization(final Object bean, final String beanName) throws BeansException { // first sift through and get all the methods // then get all the annotations // then build the metadata and register the metadata final Class<?> targetClass = AopUtils.getTargetClass(bean); final org.camunda.bpm.engine.spring.annotations.ProcessEngineComponent component = targetClass.getAnnotation(org.camunda.bpm.engine.spring.annotations.ProcessEngineComponent.class); ReflectionUtils.doWithMethods(targetClass, new ReflectionUtils.MethodCallback() { @SuppressWarnings("unchecked") public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { State state = AnnotationUtils.getAnnotation(method, State.class); String processName = component.processKey(); if (StringUtils.hasText(state.process())) { processName = state.process(); } String stateName = state.state(); if (!StringUtils.hasText(stateName)) { stateName = state.value(); } Assert.notNull(stateName, "You must provide a stateName!"); Map<Integer, String> vars = new HashMap<Integer, String>(); Annotation[][] paramAnnotationsArray = method.getParameterAnnotations(); int ctr = 0; int pvMapIndex = -1; int procIdIndex = -1;
for (Annotation[] paramAnnotations : paramAnnotationsArray) { ctr += 1; for (Annotation pa : paramAnnotations) { if (pa instanceof ProcessVariable) { ProcessVariable pv = (ProcessVariable) pa; String pvName = pv.value(); vars.put(ctr, pvName); } else if (pa instanceof ProcessVariables) { pvMapIndex = ctr; } else if (pa instanceof ProcessId ) { procIdIndex = ctr; } } } ActivitiStateHandlerRegistration registration = new ActivitiStateHandlerRegistration(vars, method, bean, stateName, beanName, pvMapIndex, procIdIndex, processName); registry.registerActivitiStateHandler(registration); } }, new ReflectionUtils.MethodFilter() { public boolean matches(Method method) { return null != AnnotationUtils.getAnnotation(method, State.class); } }); return bean; } }
repos\camunda-bpm-platform-master\engine-spring\core\src\main\java\org\camunda\bpm\engine\spring\components\aop\ActivitiStateAnnotationBeanPostProcessor.java
1
请完成以下Java代码
public void setM_ShipmentSchedule_ID (final int M_ShipmentSchedule_ID) { if (M_ShipmentSchedule_ID < 1) set_ValueNoCheck (COLUMNNAME_M_ShipmentSchedule_ID, null); else set_ValueNoCheck (COLUMNNAME_M_ShipmentSchedule_ID, M_ShipmentSchedule_ID); } @Override public int getM_ShipmentSchedule_ID() { return get_ValueAsInt(COLUMNNAME_M_ShipmentSchedule_ID); } @Override public void setProcessed (final boolean Processed) { set_Value (COLUMNNAME_Processed, Processed); } @Override public boolean isProcessed() { return get_ValueAsBoolean(COLUMNNAME_Processed);
} @Override public void setQtyToPick (final BigDecimal QtyToPick) { set_Value (COLUMNNAME_QtyToPick, QtyToPick); } @Override public BigDecimal getQtyToPick() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyToPick); return bd != null ? bd : BigDecimal.ZERO; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\de\metas\inoutcandidate\model\X_M_Picking_Job_Schedule.java
1
请在Spring Boot框架中完成以下Java代码
public String getSubScopeId() { return subScopeId; } public void setSubScopeId(String subScopeId) { this.subScopeId = subScopeId; } public String getScopeType() { return scopeType; } public void setScopeType(String scopeType) { this.scopeType = scopeType; } public Date getCreated() { return created; } public void setCreated(Date created) { this.created = created;
} public String getConfiguration() { return configuration; } public void setConfiguration(String configuration) { this.configuration = configuration; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } public String getTenantId() { return tenantId; } }
repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\runtime\caze\EventSubscriptionResponse.java
2
请完成以下Java代码
public String toString() { StringBuffer sb = new StringBuffer ("X_CM_AccessListRole[") .append(get_ID()).append("]"); return sb.toString(); } public I_AD_Role getAD_Role() throws RuntimeException { return (I_AD_Role)MTable.get(getCtx(), I_AD_Role.Table_Name) .getPO(getAD_Role_ID(), get_TrxName()); } /** Set Role. @param AD_Role_ID Responsibility Role */ public void setAD_Role_ID (int AD_Role_ID) { if (AD_Role_ID < 0) set_ValueNoCheck (COLUMNNAME_AD_Role_ID, null); else set_ValueNoCheck (COLUMNNAME_AD_Role_ID, Integer.valueOf(AD_Role_ID)); } /** Get Role. @return Responsibility Role */ public int getAD_Role_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_AD_Role_ID); if (ii == null) return 0; return ii.intValue(); } public I_CM_AccessProfile getCM_AccessProfile() throws RuntimeException {
return (I_CM_AccessProfile)MTable.get(getCtx(), I_CM_AccessProfile.Table_Name) .getPO(getCM_AccessProfile_ID(), get_TrxName()); } /** Set Web Access Profile. @param CM_AccessProfile_ID Web Access Profile */ public void setCM_AccessProfile_ID (int CM_AccessProfile_ID) { if (CM_AccessProfile_ID < 1) set_ValueNoCheck (COLUMNNAME_CM_AccessProfile_ID, null); else set_ValueNoCheck (COLUMNNAME_CM_AccessProfile_ID, Integer.valueOf(CM_AccessProfile_ID)); } /** Get Web Access Profile. @return Web Access Profile */ public int getCM_AccessProfile_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_CM_AccessProfile_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_CM_AccessListRole.java
1
请完成以下Java代码
public class RodCuttingProblem { static int maxRevenueG; public static int usingRecursion(int[] prices, int n) { if (n <= 0) { return 0; } int maxRevenue = Integer.MIN_VALUE; for (int i = 1; i <= n; i++) { maxRevenue = Math.max(maxRevenue, prices[i - 1] + usingRecursion(prices, n - i)); } return maxRevenue; } public static int usingMemoizedRecursion(int[] prices, int n) { int[] memo = new int[n + 1]; Arrays.fill(memo, -1); return memoizedHelper(prices, n, memo); } private static int memoizedHelper(int[] prices, int n, int[] memo) { if (n <= 0) { return 0; } if (memo[n] != -1) { return memo[n]; } int maxRevenue = Integer.MIN_VALUE; for (int i = 1; i <= n; i++) { maxRevenue = Math.max(maxRevenue, prices[i - 1] + memoizedHelper(prices, n - i, memo)); } memo[n] = maxRevenue; return maxRevenue; } public static int usingDynamicProgramming(int[] prices, int n) { int[] dp = new int[n + 1]; for (int i = 1; i <= n; i++) { int maxRevenue = Integer.MIN_VALUE;
for (int j = 1; j <= i; j++) { maxRevenue = Math.max(maxRevenue, prices[j - 1] + dp[i - j]); } dp[i] = maxRevenue; } return dp[n]; } public static int usingUnboundedKnapsack(int[] prices, int n) { int[] dp = new int[n + 1]; for (int i = 1; i <= n; i++) { for (int j = 0; j < prices.length; j++) { if (j + 1 <= i) { dp[i] = Math.max(dp[i], dp[i - (j + 1)] + prices[j]); } } } return dp[n]; } }
repos\tutorials-master\core-java-modules\core-java-lang-math-4\src\main\java\com\baeldung\math\rodcutting\RodCuttingProblem.java
1
请完成以下Java代码
private void moveTUToLU(final int tuId, final HUEditorRow luRow, final HUEditorRow tuRow) { final I_M_HU newTU = create(Env.getCtx(), tuId, I_M_HU.class, ITrx.TRXNAME_ThreadInherited); newHUTransformation().tuToExistingLU(newTU, QtyTU.ONE, luRow.getM_HU()); } private void assignSerialNumbersToCUs(final Set<HuId> cuIDs, final List<String> availableSerialNumbers) { final List<HuId> listOfCUIDs = ImmutableList.copyOf(cuIDs); final int numberOfCUs = listOfCUIDs.size(); for (int i = 0; i < numberOfCUs; i++) { if (availableSerialNumbers.isEmpty()) { return; } assignSerialNumberToCU(listOfCUIDs.get(i), availableSerialNumbers.remove(0)); } } private void assignSerialNumberToCU(final HuId huId, final String serialNo) { final I_M_HU hu = handlingUnitsRepo.getById(huId); final IContextAware ctxAware = getContextAware(hu); final IHUContext huContext = handlingUnitsBL.createMutableHUContext(ctxAware); final IAttributeStorage attributeStorage = getAttributeStorage(huContext, hu); Check.errorUnless(attributeStorage.hasAttribute(AttributeConstants.ATTR_SerialNo), "There is no SerialNo attribute {} defined for the handling unit {}", AttributeConstants.ATTR_SerialNo, hu); attributeStorage.setValue(AttributeConstants.ATTR_SerialNo, serialNo.trim()); attributeStorage.saveChangesIfNeeded(); } private boolean isAggregateHU(final HUEditorRow huRow) { final I_M_HU hu = huRow.getM_HU(); return handlingUnitsBL.isAggregateHU(hu); } private final IAttributeStorage getAttributeStorage(final IHUContext huContext, final I_M_HU hu) { final IAttributeStorageFactory attributeStorageFactory = huContext.getHUAttributeStorageFactory(); final IAttributeStorage attributeStorage = attributeStorageFactory.getAttributeStorage(hu); return attributeStorage; }
private final HUTransformService newHUTransformation() { return HUTransformService.builder() .referencedObjects(getContextDocumentLines()) .build(); } /** * @return context document/lines (e.g. the receipt schedules) */ private List<TableRecordReference> getContextDocumentLines() { if (view == null) { return ImmutableList.of(); } return view.getReferencingDocumentPaths() .stream() .map(referencingDocumentPath -> documentCollections.getTableRecordReference(referencingDocumentPath)) .collect(GuavaCollectors.toImmutableList()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\process\WEBUIHUCreationWithSerialNumberService.java
1
请完成以下Java代码
protected ListQueryParameterObject configureParameterizedQuery(Object parameter) { return getTenantManager().configureQuery(parameter); } @Override public ProcessDefinitionEntity findLatestDefinitionByKey(String key) { return findLatestProcessDefinitionByKey(key); } @Override public ProcessDefinitionEntity findLatestDefinitionById(String id) { return findLatestProcessDefinitionById(id); } @Override public ProcessDefinitionEntity getCachedResourceDefinitionEntity(String definitionId) { return getDbEntityManager().getCachedEntity(ProcessDefinitionEntity.class, definitionId); } @Override public ProcessDefinitionEntity findLatestDefinitionByKeyAndTenantId(String definitionKey, String tenantId) { return findLatestProcessDefinitionByKeyAndTenantId(definitionKey, tenantId); }
@Override public ProcessDefinitionEntity findDefinitionByKeyVersionAndTenantId(String definitionKey, Integer definitionVersion, String tenantId) { return findProcessDefinitionByKeyVersionAndTenantId(definitionKey, definitionVersion, tenantId); } @Override public ProcessDefinitionEntity findDefinitionByKeyVersionTagAndTenantId(String definitionKey, String definitionVersionTag, String tenantId) { return findProcessDefinitionByKeyVersionTagAndTenantId(definitionKey, definitionVersionTag, tenantId); } @Override public ProcessDefinitionEntity findDefinitionByDeploymentAndKey(String deploymentId, String definitionKey) { return findProcessDefinitionByDeploymentAndKey(deploymentId, definitionKey); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\ProcessDefinitionManager.java
1
请完成以下Java代码
public void updateInventoryLineByRecord(final I_M_InventoryLine inventoryLineRecord, UnaryOperator<InventoryLine> updater) { trxManager.runInThreadInheritedTrx(() -> newLoaderAndSaver().updateInventoryLineByRecord(inventoryLineRecord, updater)); } public Inventory updateById(final InventoryId inventoryId, UnaryOperator<Inventory> updater) { return trxManager.callInThreadInheritedTrx(() -> newLoaderAndSaver().updateById(inventoryId, updater)); } public void updateByQuery(@NonNull final InventoryQuery query, @NonNull final UnaryOperator<Inventory> updater) { trxManager.runInThreadInheritedTrx(() -> newLoaderAndSaver().updateByQuery(query, updater)); } public Stream<InventoryReference> streamReferences(@NonNull final InventoryQuery query) { return newLoaderAndSaver().streamReferences(query); } public void setQtyCountToQtyBookForInventory(@NonNull final InventoryId inventoryId) { // update M_InventoryLine
final ICompositeQueryUpdater<org.compiere.model.I_M_InventoryLine> updaterInventoryLine = queryBL.createCompositeQueryUpdater(org.compiere.model.I_M_InventoryLine.class) .addSetColumnFromColumn(org.compiere.model.I_M_InventoryLine.COLUMNNAME_QtyCount, ModelColumnNameValue.forColumnName(org.compiere.model.I_M_InventoryLine.COLUMNNAME_QtyBook)); queryBL.createQueryBuilder(org.compiere.model.I_M_InventoryLine.class) .addEqualsFilter(org.compiere.model.I_M_InventoryLine.COLUMNNAME_M_Inventory_ID, inventoryId) .create().update(updaterInventoryLine); // update M_InventoryLine_HU final ICompositeQueryUpdater<I_M_InventoryLine_HU> updaterInventoryLineHU = queryBL.createCompositeQueryUpdater(I_M_InventoryLine_HU.class) .addSetColumnFromColumn(I_M_InventoryLine_HU.COLUMNNAME_QtyCount, ModelColumnNameValue.forColumnName(I_M_InventoryLine_HU.COLUMNNAME_QtyBook)); queryBL.createQueryBuilder(I_M_InventoryLine_HU.class) .addEqualsFilter(I_M_InventoryLine_HU.COLUMNNAME_M_Inventory_ID, inventoryId) .create().update(updaterInventoryLineHU); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\inventory\InventoryRepository.java
1
请完成以下Java代码
class PMMPricingAware_PurchaseCandidate implements IPMMPricingAware { public static PMMPricingAware_PurchaseCandidate of(final I_PMM_PurchaseCandidate candidate) { return new PMMPricingAware_PurchaseCandidate(candidate); } private final I_PMM_PurchaseCandidate candidate; private PMMPricingAware_PurchaseCandidate(final I_PMM_PurchaseCandidate candidate) { super(); Check.assumeNotNull(candidate, "candidate not null"); this.candidate = candidate; } @Override public String toString() { return MoreObjects.toStringHelper(this) .add("candidate", candidate) .toString(); } @Override public Properties getCtx() { return InterfaceWrapperHelper.getCtx(candidate); } @Override public I_C_BPartner getC_BPartner() { return candidate.getC_BPartner(); } @Override public boolean isContractedProduct() { final I_C_Flatrate_DataEntry flatrateDataEntry = getC_Flatrate_DataEntry(); if (flatrateDataEntry == null) { return false; } // Consider that we have a contracted product only if the data entry has the Price or the QtyPlanned set (FRESH-568) return Services.get(IPMMContractsBL.class).hasPriceOrQty(flatrateDataEntry); } @Override public I_M_Product getM_Product() { return candidate.getM_Product(); } @Override public int getProductId() { return candidate.getM_Product_ID(); } @Override public I_C_UOM getC_UOM() { return candidate.getC_UOM(); }
@Override public I_C_Flatrate_Term getC_Flatrate_Term() { final I_C_Flatrate_DataEntry flatrateDataEntry = getC_Flatrate_DataEntry(); if(flatrateDataEntry == null) { return null; } return flatrateDataEntry.getC_Flatrate_Term(); } @Override public I_C_Flatrate_DataEntry getC_Flatrate_DataEntry() { return InterfaceWrapperHelper.create(candidate.getC_Flatrate_DataEntry(), I_C_Flatrate_DataEntry.class); } @Override public Object getWrappedModel() { return candidate; } @Override public Timestamp getDate() { return candidate.getDatePromised(); } @Override public BigDecimal getQty() { // TODO: shall we use QtyToOrder instead... but that could affect our price (if we have some prices defined on breaks) return candidate.getQtyPromised(); } @Override public void setM_PricingSystem_ID(int M_PricingSystem_ID) { candidate.setM_PricingSystem_ID(M_PricingSystem_ID); } @Override public void setM_PriceList_ID(int M_PriceList_ID) { candidate.setM_PriceList_ID(M_PriceList_ID); } @Override public void setCurrencyId(final CurrencyId currencyId) { candidate.setC_Currency_ID(CurrencyId.toRepoId(currencyId)); } @Override public void setPrice(BigDecimal priceStd) { candidate.setPrice(priceStd); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.procurement.base\src\main\java\de\metas\procurement\base\order\impl\PMMPricingAware_PurchaseCandidate.java
1
请完成以下Java代码
public int size() { return map.size(); } @Override public boolean isEmpty() { return map.isEmpty(); } @Override public boolean containsKey(@Nullable final Object key) { return map.containsKey(key); } @Override public boolean containsValue(final Object value) { for (final List<V> values : map.values()) { if (values == null || values.isEmpty()) { continue; } if (values.contains(value)) { return true; } } return false; } @Override public List<V> get(final Object key) { return map.get(key); } @Override public List<V> put(final K key, final List<V> value) { return map.put(key, value); } /** * Add the given single value to the current list of values for the given key. * * @param key the key * @param value the value to be added */ 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 AlarmComment saveAlarmComment(TenantId tenantId, AlarmComment alarmComment) { log.debug("Saving Alarm Comment: {}", alarmComment); alarmCommentDataValidator.validate(alarmComment, c -> tenantId); AlarmComment result = alarmCommentDao.save(tenantId, alarmComment); eventPublisher.publishEvent(DeleteEntityEvent.builder().tenantId(tenantId).entity(result) .entityId(result.getAlarmId()).build()); return result; } @Override public PageData<AlarmCommentInfo> findAlarmComments(TenantId tenantId, AlarmId alarmId, PageLink pageLink) { log.trace("Executing findAlarmComments by alarmId [{}]", alarmId); return alarmCommentDao.findAlarmComments(tenantId, alarmId, pageLink); } @Override public ListenableFuture<AlarmComment> findAlarmCommentByIdAsync(TenantId tenantId, AlarmCommentId alarmCommentId) { log.trace("Executing findAlarmCommentByIdAsync by alarmCommentId [{}]", alarmCommentId); validateId(alarmCommentId, id -> "Incorrect alarmCommentId " + id); return alarmCommentDao.findAlarmCommentByIdAsync(tenantId, alarmCommentId.getId()); } @Override public AlarmComment findAlarmCommentById(TenantId tenantId, AlarmCommentId alarmCommentId) { log.trace("Executing findAlarmCommentByIdAsync by alarmCommentId [{}]", alarmCommentId); validateId(alarmCommentId, id -> "Incorrect alarmCommentId " + id); return alarmCommentDao.findById(tenantId, alarmCommentId.getId()); } private AlarmComment createAlarmComment(TenantId tenantId, AlarmComment alarmComment) { log.debug("New Alarm comment : {}", alarmComment); if (alarmComment.getType() == null) { alarmComment.setType(AlarmCommentType.OTHER); } return alarmCommentDao.save(tenantId, alarmComment); }
private AlarmComment updateAlarmComment(TenantId tenantId, AlarmComment newAlarmComment) { log.debug("Update Alarm comment : {}", newAlarmComment); AlarmComment existing = alarmCommentDao.findAlarmCommentById(tenantId, newAlarmComment.getId().getId()); if (existing != null) { if (newAlarmComment.getComment() != null) { JsonNode comment = newAlarmComment.getComment(); ((ObjectNode) comment).put("edited", "true"); ((ObjectNode) comment).put("editedOn", System.currentTimeMillis()); existing.setComment(comment); } return alarmCommentDao.save(tenantId, existing); } return null; } }
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\alarm\BaseAlarmCommentService.java
1
请完成以下Java代码
public class KerberosServiceAuthenticationProvider implements AuthenticationProvider, InitializingBean { private static final Log LOG = LogFactory.getLog(KerberosServiceAuthenticationProvider.class); private KerberosTicketValidator ticketValidator; private UserDetailsService userDetailsService; private UserDetailsChecker userDetailsChecker = new AccountStatusUserDetailsChecker(); @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { KerberosServiceRequestToken auth = (KerberosServiceRequestToken) authentication; byte[] token = auth.getToken(); LOG.debug("Try to validate Kerberos Token"); KerberosTicketValidation ticketValidation = this.ticketValidator.validateTicket(token); LOG.debug("Successfully validated " + ticketValidation.username()); UserDetails userDetails = this.userDetailsService.loadUserByUsername(ticketValidation.username()); this.userDetailsChecker.check(userDetails); additionalAuthenticationChecks(userDetails, auth); KerberosServiceRequestToken responseAuth = new KerberosServiceRequestToken(userDetails, ticketValidation, userDetails.getAuthorities(), token); responseAuth.setDetails(authentication.getDetails()); return responseAuth; } @Override public boolean supports(Class<? extends Object> auth) { return KerberosServiceRequestToken.class.isAssignableFrom(auth); } @Override public void afterPropertiesSet() throws Exception { Assert.notNull(this.ticketValidator, "ticketValidator must be specified"); Assert.notNull(this.userDetailsService, "userDetailsService must be specified"); }
/** * The <code>UserDetailsService</code> to use, for loading the user properties and the * <code>GrantedAuthorities</code>. * @param userDetailsService the new user details service */ public void setUserDetailsService(UserDetailsService userDetailsService) { this.userDetailsService = userDetailsService; } /** * The <code>KerberosTicketValidator</code> to use, for validating the Kerberos/SPNEGO * tickets. * @param ticketValidator the new ticket validator */ public void setTicketValidator(KerberosTicketValidator ticketValidator) { this.ticketValidator = ticketValidator; } /** * Allows subclasses to perform any additional checks of a returned * <code>UserDetails</code> for a given authentication request. * @param userDetails as retrieved from the {@link UserDetailsService} * @param authentication validated {@link KerberosServiceRequestToken} * @throws AuthenticationException AuthenticationException if the credentials could * not be validated (generally a <code>BadCredentialsException</code>, an * <code>AuthenticationServiceException</code>) */ protected void additionalAuthenticationChecks(UserDetails userDetails, KerberosServiceRequestToken authentication) throws AuthenticationException { } }
repos\spring-security-main\kerberos\kerberos-core\src\main\java\org\springframework\security\kerberos\authentication\KerberosServiceAuthenticationProvider.java
1
请完成以下Java代码
public class StringFormType extends SimpleFormFieldType { public final static String TYPE_NAME = "string"; public String getName() { return TYPE_NAME; } public TypedValue convertValue(TypedValue propertyValue) { if(propertyValue instanceof StringValue) { return propertyValue; } else { Object value = propertyValue.getValue(); if(value == null) { return Variables.stringValue(null, propertyValue.isTransient()); } else {
return Variables.stringValue(value.toString(), propertyValue.isTransient()); } } } // deprecated //////////////////////////////////////////////////////////// public Object convertFormValueToModelValue(Object propertyValue) { return propertyValue.toString(); } public String convertModelValueToFormValue(Object modelValue) { return (String) modelValue; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\form\type\StringFormType.java
1
请完成以下Java代码
public class AD_Process_Para { @CalloutMethod(columnNames = I_AD_Process_Para.COLUMNNAME_AD_Element_ID) public void onAD_Element_ID(final I_AD_Process_Para pp) { if (pp.getAD_Element_ID() <= 0) { return; } final boolean centrallyMaintained = pp.isCentrallyMaintained(); final I_AD_Element adElement = pp.getAD_Element(); final String elementColumnName = adElement.getColumnName(); Check.assumeNotNull(elementColumnName, "The element {} does not have a column name set", adElement); pp.setColumnName(elementColumnName); if (centrallyMaintained || Check.isEmpty(pp.getName())) pp.setName(adElement.getName()); if (centrallyMaintained || Check.isEmpty(pp.getDescription())) pp.setDescription(adElement.getDescription());
if (centrallyMaintained || Check.isEmpty(pp.getHelp())) pp.setHelp(adElement.getHelp()); String entityType = adElement.getEntityType(); if ("D".equals(entityType)) { final I_AD_Process process = pp.getAD_Process(); entityType = process.getEntityType(); } if (!"D".equals(entityType)) { pp.setEntityType(entityType); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\process\callout\AD_Process_Para.java
1
请完成以下Java代码
public class MybatisPrivilegeMappingDataManager extends AbstractIdmDataManager<PrivilegeMappingEntity> implements PrivilegeMappingDataManager { public MybatisPrivilegeMappingDataManager(IdmEngineConfiguration idmEngineConfiguration) { super(idmEngineConfiguration); } @Override public PrivilegeMappingEntity create() { return new PrivilegeMappingEntityImpl(); } @Override public Class<? extends PrivilegeMappingEntity> getManagedEntityClass() { return PrivilegeMappingEntityImpl.class; } @Override public void deleteByPrivilegeId(String privilegeId) { getDbSqlSession().delete("deleteByPrivilegeId", privilegeId, getManagedEntityClass()); } @Override public void deleteByPrivilegeIdAndUserId(String privilegeId, String userId) { Map<String, String> params = new HashMap<>(); params.put("privilegeId", privilegeId); params.put("userId", userId); getDbSqlSession().delete("deleteByPrivilegeIdAndUserId", params, getManagedEntityClass()); }
@Override public void deleteByPrivilegeIdAndGroupId(String privilegeId, String groupId) { Map<String, String> params = new HashMap<>(); params.put("privilegeId", privilegeId); params.put("groupId", groupId); getDbSqlSession().delete("deleteByPrivilegeIdAndGroupId", params, getManagedEntityClass()); } @Override @SuppressWarnings("unchecked") public List<PrivilegeMapping> getPrivilegeMappingsByPrivilegeId(String privilegeId) { return (List<PrivilegeMapping>) getDbSqlSession().selectList("selectPrivilegeMappingsByPrivilegeId", privilegeId); } }
repos\flowable-engine-main\modules\flowable-idm-engine\src\main\java\org\flowable\idm\engine\impl\persistence\entity\data\impl\MybatisPrivilegeMappingDataManager.java
1
请完成以下Java代码
public boolean isDisallowPostingForOrg(@NonNull final OrgId orgId) { return !isAllowPostingForOrg(orgId); } public boolean isElementEnabled(@NonNull final AcctSchemaElementType elementType) { return getSchemaElements().isElementEnabled(elementType); } public AcctSchemaElement getSchemaElementByType(@NonNull final AcctSchemaElementType elementType) { return getSchemaElements().getByElementType(elementType); }
public ImmutableSet<AcctSchemaElementType> getSchemaElementTypes() { return getSchemaElements().getElementTypes(); } public ChartOfAccountsId getChartOfAccountsId() { return getSchemaElements().getChartOfAccountsId(); } public boolean isAccountingCurrency(@NonNull final CurrencyId currencyId) { return CurrencyId.equals(this.currencyId, currencyId); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\acct\api\AcctSchema.java
1
请完成以下Java代码
private ADRefTable getSourceTableRefInfoOrNull() { if (sourceTableRefInfo == null) { sourceTableRefInfo = retrieveTableRefInfo(getSource_Reference_ID()); } return sourceTableRefInfo; } @Nullable private ADRefTable retrieveTableRefInfo(final ReferenceId adReferenceId) { final ADRefTable tableRefInfo = adReferenceService.retrieveTableRefInfo(adReferenceId); if (tableRefInfo == null) { return null; } return tableRefInfo.mapWindowIds(this::getCustomizationWindowId); } @Nullable private AdWindowId getCustomizationWindowId(@Nullable final AdWindowId adWindowId) { return adWindowId != null ? customizedWindowInfoMap.getCustomizedWindowInfo(adWindowId).map(CustomizedWindowInfo::getCustomizationWindowId).orElse(adWindowId) : null; } public Builder setSourceRoleDisplayName(final ITranslatableString sourceRoleDisplayName) { this.sourceRoleDisplayName = sourceRoleDisplayName; return this; } public Builder setTarget_Reference_AD(final int targetReferenceId) { this.targetReferenceId = ReferenceId.ofRepoIdOrNull(targetReferenceId); targetTableRefInfo = null; // lazy return this; } private ReferenceId getTarget_Reference_ID() { return Check.assumeNotNull(targetReferenceId, "targetReferenceId is set"); } private ADRefTable getTargetTableRefInfoOrNull() {
if (targetTableRefInfo == null) { targetTableRefInfo = retrieveTableRefInfo(getTarget_Reference_ID()); } return targetTableRefInfo; } public Builder setTargetRoleDisplayName(final ITranslatableString targetRoleDisplayName) { this.targetRoleDisplayName = targetRoleDisplayName; return this; } public ITranslatableString getTargetRoleDisplayName() { return targetRoleDisplayName; } public Builder setIsTableRecordIdTarget(final boolean isReferenceTarget) { isTableRecordIDTarget = isReferenceTarget; return this; } private boolean isTableRecordIdTarget() { return isTableRecordIDTarget; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\document\references\related_documents\relation_type\SpecificRelationTypeRelatedDocumentsProvider.java
1
请完成以下Java代码
/* package */final class CompositeRfQEventListener implements IRfQEventListener { private static final Logger logger = LogManager.getLogger(CompositeRfQEventListener.class); private final CopyOnWriteArrayList<IRfQEventListener> listeners = new CopyOnWriteArrayList<>(); public void addListener(final IRfQEventListener listener) { Check.assumeNotNull(listener, "listener not null"); final boolean added = listeners.addIfAbsent(listener); if (!added) { logger.warn("Skip adding {} because it was already added", listener); } } @Override public void onBeforeComplete(final I_C_RfQ rfq) { for (final IRfQEventListener listener : listeners) { listener.onBeforeComplete(rfq); } } @Override public void onAfterComplete(final I_C_RfQ rfq) { for (final IRfQEventListener listener : listeners) { listener.onAfterComplete(rfq); } } @Override public void onBeforeClose(final I_C_RfQ rfq) { for (final IRfQEventListener listener : listeners) { listener.onBeforeClose(rfq); } } @Override public void onAfterClose(final I_C_RfQ rfq) { for (final IRfQEventListener listener : listeners) { listener.onAfterClose(rfq); } } @Override public void onDraftCreated(final I_C_RfQResponse rfqResponse) { for (final IRfQEventListener listener : listeners) { listener.onDraftCreated(rfqResponse); } } @Override public void onBeforeComplete(final I_C_RfQResponse rfqResponse) { for (final IRfQEventListener listener : listeners) { listener.onBeforeComplete(rfqResponse); } } @Override public void onAfterComplete(final I_C_RfQResponse rfqResponse) { for (final IRfQEventListener listener : listeners) { listener.onAfterComplete(rfqResponse); } } @Override public void onBeforeClose(final I_C_RfQResponse rfqResponse) { for (final IRfQEventListener listener : listeners) { listener.onBeforeClose(rfqResponse); }
} @Override public void onAfterClose(final I_C_RfQResponse rfqResponse) { for (final IRfQEventListener listener : listeners) { listener.onAfterClose(rfqResponse); } } @Override public void onBeforeUnClose(final I_C_RfQ rfq) { for (final IRfQEventListener listener : listeners) { listener.onBeforeUnClose(rfq); } } @Override public void onAfterUnClose(final I_C_RfQ rfq) { for (final IRfQEventListener listener : listeners) { listener.onAfterUnClose(rfq); } } @Override public void onBeforeUnClose(final I_C_RfQResponse rfqResponse) { for (final IRfQEventListener listener : listeners) { listener.onBeforeUnClose(rfqResponse); } } @Override public void onAfterUnClose(final I_C_RfQResponse rfqResponse) { for (final IRfQEventListener listener : listeners) { listener.onAfterUnClose(rfqResponse); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.rfq\src\main\java\de\metas\rfq\event\impl\CompositeRfQEventListener.java
1
请完成以下Java代码
public void setRequiredDecision(Decision requiredDecision) { requiredDecisionRef.setReferenceTargetElement(this, requiredDecision); } public InputData getRequiredInput() { return requiredInputRef.getReferenceTargetElement(this); } public void setRequiredInput(InputData requiredInput) { requiredInputRef.setReferenceTargetElement(this, requiredInput); } public static void registerType(ModelBuilder modelBuilder) { ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(InformationRequirement.class, DMN_ELEMENT_INFORMATION_REQUIREMENT) .namespaceUri(LATEST_DMN_NS) .instanceProvider(new ModelTypeInstanceProvider<InformationRequirement>() { public InformationRequirement newInstance(ModelTypeInstanceContext instanceContext) { return new InformationRequirementImpl(instanceContext); } });
SequenceBuilder sequenceBuilder = typeBuilder.sequence(); requiredDecisionRef = sequenceBuilder.element(RequiredDecisionReference.class) .uriElementReference(Decision.class) .build(); requiredInputRef = sequenceBuilder.element(RequiredInputReference.class) .uriElementReference(InputData.class) .build(); typeBuilder.build(); } }
repos\camunda-bpm-platform-master\model-api\dmn-model\src\main\java\org\camunda\bpm\model\dmn\impl\instance\InformationRequirementImpl.java
1
请完成以下Java代码
public void setA_New_Used (boolean A_New_Used) { set_Value (COLUMNNAME_A_New_Used, Boolean.valueOf(A_New_Used)); } /** Get Purchased New?. @return Purchased New? */ public boolean isA_New_Used () { Object oo = get_Value(COLUMNNAME_A_New_Used); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Account State. @param A_State State of the Credit Card or Account holder */ public void setA_State (String A_State) { set_Value (COLUMNNAME_A_State, A_State); } /** Get Account State. @return State of the Credit Card or Account holder */ public String getA_State () { return (String)get_Value(COLUMNNAME_A_State); } /** Set Tax Entity. @param A_Tax_Entity Tax Entity */ public void setA_Tax_Entity (String A_Tax_Entity)
{ set_Value (COLUMNNAME_A_Tax_Entity, A_Tax_Entity); } /** Get Tax Entity. @return Tax Entity */ public String getA_Tax_Entity () { return (String)get_Value(COLUMNNAME_A_Tax_Entity); } /** Set Text Message. @param TextMsg Text Message */ public void setTextMsg (String TextMsg) { set_Value (COLUMNNAME_TextMsg, TextMsg); } /** Get Text Message. @return Text Message */ public String getTextMsg () { return (String)get_Value(COLUMNNAME_TextMsg); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_A_Asset_Info_Tax.java
1
请完成以下Java代码
public static MRegion[] getRegions (Properties ctx, int C_Country_ID) { if (s_regions == null || s_regions.size() == 0) loadAllRegions(ctx); ArrayList<MRegion> list = new ArrayList<MRegion>(); Iterator<MRegion> it = s_regions.values().iterator(); while (it.hasNext()) { MRegion r = it.next(); if (r.getC_Country_ID() == C_Country_ID) list.add(r); } // Sort it MRegion[] retValue = new MRegion[list.size()]; list.toArray(retValue); Arrays.sort(retValue, new MRegion(ctx, 0, null)); return retValue; } // getRegions /** Region Cache */ private static CCache<String,MRegion> s_regions = null; /** Default Region */ private static MRegion s_default = null; /** Static Logger */ private static Logger s_log = LogManager.getLogger(MRegion.class); /************************************************************************** * Create empty Region * @param ctx context * @param C_Region_ID id * @param trxName transaction */ public MRegion (Properties ctx, int C_Region_ID, String trxName) { super (ctx, C_Region_ID, trxName); if (C_Region_ID == 0) { } } // MRegion /** * Create Region from current row in ResultSet * @param ctx context * @param rs result set * @param trxName transaction */ public MRegion (Properties ctx, ResultSet rs, String trxName) { super(ctx, rs, trxName); } // MRegion /** * Parent Constructor * @param country country
* @param regionName Region Name */ public MRegion (MCountry country, String regionName) { super (country.getCtx(), 0, country.get_TrxName()); setC_Country_ID(country.getC_Country_ID()); setName(regionName); } // MRegion /** * Return Name * @return Name */ @Override public String toString() { return getName(); } // toString /** * Compare * @param o1 object 1 * @param o2 object 2 * @return -1,0, 1 */ @Override public int compare(Object o1, Object o2) { String s1 = o1.toString(); if (s1 == null) s1 = ""; String s2 = o2.toString(); if (s2 == null) s2 = ""; return s1.compareTo(s2); } // compare } // MRegion
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MRegion.java
1
请完成以下Java代码
public int getPMM_PurchaseCandidate_OrderLine_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_PMM_PurchaseCandidate_OrderLine_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Bestellte Menge. @param QtyOrdered Bestellte Menge */ @Override public void setQtyOrdered (java.math.BigDecimal QtyOrdered) { set_Value (COLUMNNAME_QtyOrdered, QtyOrdered); } /** Get Bestellte Menge. @return Bestellte Menge */ @Override public java.math.BigDecimal getQtyOrdered () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyOrdered); if (bd == null) return Env.ZERO; return bd; }
/** Set Bestellte Menge (TU). @param QtyOrdered_TU Bestellte Menge (TU) */ @Override public void setQtyOrdered_TU (java.math.BigDecimal QtyOrdered_TU) { set_Value (COLUMNNAME_QtyOrdered_TU, QtyOrdered_TU); } /** Get Bestellte Menge (TU). @return Bestellte Menge (TU) */ @Override public java.math.BigDecimal getQtyOrdered_TU () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyOrdered_TU); if (bd == null) return Env.ZERO; return bd; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.procurement.base\src\main\java-gen\de\metas\procurement\base\model\X_PMM_PurchaseCandidate_OrderLine.java
1
请完成以下Java代码
public org.compiere.model.I_AD_PInstance getAD_PInstance() { return get_ValueAsPO(COLUMNNAME_AD_PInstance_ID, org.compiere.model.I_AD_PInstance.class); } @Override public void setAD_PInstance(final org.compiere.model.I_AD_PInstance AD_PInstance) { set_ValueFromPO(COLUMNNAME_AD_PInstance_ID, org.compiere.model.I_AD_PInstance.class, AD_PInstance); } @Override public void setAD_PInstance_ID (final int AD_PInstance_ID) { if (AD_PInstance_ID < 1) set_ValueNoCheck (COLUMNNAME_AD_PInstance_ID, null); else set_ValueNoCheck (COLUMNNAME_AD_PInstance_ID, AD_PInstance_ID); } @Override public int getAD_PInstance_ID() { return get_ValueAsInt(COLUMNNAME_AD_PInstance_ID); } @Override public void setAD_PInstance_Log_ID (final int AD_PInstance_Log_ID) { if (AD_PInstance_Log_ID < 1) set_ValueNoCheck (COLUMNNAME_AD_PInstance_Log_ID, null); else set_ValueNoCheck (COLUMNNAME_AD_PInstance_Log_ID, AD_PInstance_Log_ID); } @Override public int getAD_PInstance_Log_ID() { return get_ValueAsInt(COLUMNNAME_AD_PInstance_Log_ID); } @Override public void setAD_Table_ID (final int AD_Table_ID) { if (AD_Table_ID < 1) set_Value (COLUMNNAME_AD_Table_ID, null); else set_Value (COLUMNNAME_AD_Table_ID, AD_Table_ID); } @Override public int getAD_Table_ID() { return get_ValueAsInt(COLUMNNAME_AD_Table_ID); } @Override public void setLog_ID (final int Log_ID) { if (Log_ID < 1) set_ValueNoCheck (COLUMNNAME_Log_ID, null); else set_ValueNoCheck (COLUMNNAME_Log_ID, Log_ID); } @Override public int getLog_ID() { return get_ValueAsInt(COLUMNNAME_Log_ID); } @Override public void setP_Date (final @Nullable java.sql.Timestamp P_Date) { set_ValueNoCheck (COLUMNNAME_P_Date, P_Date); } @Override public java.sql.Timestamp getP_Date() { return get_ValueAsTimestamp(COLUMNNAME_P_Date); }
@Override public void setP_Msg (final @Nullable java.lang.String P_Msg) { set_ValueNoCheck (COLUMNNAME_P_Msg, P_Msg); } @Override public java.lang.String getP_Msg() { return get_ValueAsString(COLUMNNAME_P_Msg); } @Override public void setP_Number (final @Nullable BigDecimal P_Number) { set_ValueNoCheck (COLUMNNAME_P_Number, P_Number); } @Override public BigDecimal getP_Number() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_P_Number); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setRecord_ID (final int Record_ID) { if (Record_ID < 0) set_Value (COLUMNNAME_Record_ID, null); else set_Value (COLUMNNAME_Record_ID, Record_ID); } @Override public int getRecord_ID() { return get_ValueAsInt(COLUMNNAME_Record_ID); } @Override public void setWarnings (final @Nullable java.lang.String Warnings) { set_Value (COLUMNNAME_Warnings, Warnings); } @Override public java.lang.String getWarnings() { return get_ValueAsString(COLUMNNAME_Warnings); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_PInstance_Log.java
1
请在Spring Boot框架中完成以下Java代码
private void execute0() { orderPayScheduleService.deleteByOrderId(OrderId.ofRepoId(orderRecord.getC_Order_ID())); final OrderSchedulingContext context = orderPayScheduleService.extractContext(orderRecord); if (context == null) { return; // Nothing to schedule } if (!context.getPaymentTerm().isComplex() ) { return; // Nothing to schedule } final List<PaymentTermBreak> termBreaks = context.getPaymentTerm().getSortedBreaks(); final ImmutableList.Builder<OrderPayScheduleCreateRequest.Line> linesBuilder = ImmutableList.builder(); Money totalScheduledAmount = Money.zero(context.getGrandTotal().getCurrencyId()); for (int i = 0; i < termBreaks.size() - 1; i++) { final PaymentTermBreak termBreak = termBreaks.get(i); // Calculate amount by percent final Money lineDueAmount = context.getGrandTotal().multiply(termBreak.getPercent(), context.getPrecision()); final OrderPayScheduleCreateRequest.Line line = toOrderPayScheduleCreateRequestLine( context, termBreak, lineDueAmount ); linesBuilder.add(line); totalScheduledAmount = totalScheduledAmount.add(lineDueAmount); } final PaymentTermBreak lastTermBreak = termBreaks.get(termBreaks.size() - 1); // Calculate the exact amount needed for the last line: Grand Total - accumulated total final Money lastLineDueAmount = context.getGrandTotal().subtract(totalScheduledAmount); final OrderPayScheduleCreateRequest.Line lastLine = toOrderPayScheduleCreateRequestLine( context, lastTermBreak, lastLineDueAmount
); linesBuilder.add(lastLine); final OrderPayScheduleCreateRequest request = OrderPayScheduleCreateRequest.builder() .orderId(context.getOrderId()) .lines(linesBuilder.build()) .build(); orderPayScheduleService.create(request); } private static OrderPayScheduleCreateRequest.Line toOrderPayScheduleCreateRequestLine( @NonNull final OrderSchedulingContext context, @NonNull final PaymentTermBreak termBreak, @NonNull final Money dueAmount) { final DueDateAndStatus result = context.computeDueDate(termBreak); return OrderPayScheduleCreateRequest.Line.builder() .dueDate(result.getDueDate()) .dueAmount(dueAmount) .paymentTermBreakId(termBreak.getId()) .referenceDateType(termBreak.getReferenceDateType()) .percent(termBreak.getPercent()) .orderPayScheduleStatus(result.getStatus()) .offsetDays(termBreak.getOffsetDays()) .build(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\order\paymentschedule\service\OrderPayScheduleCreateCommand.java
2
请完成以下Java代码
public CaseDefinitionQuery createCaseDefinitionQuery() { return new CaseDefinitionQueryImpl(engineConfiguration.getCommandExecutor()); } @Override public List<CaseDefinition> findCaseDefinitionsByQueryCriteria(CaseDefinitionQuery caseDefinitionQuery) { return dataManager.findCaseDefinitionsByQueryCriteria((CaseDefinitionQueryImpl) caseDefinitionQuery); } @Override public long findCaseDefinitionCountByQueryCriteria(CaseDefinitionQuery caseDefinitionQuery) { return dataManager.findCaseDefinitionCountByQueryCriteria((CaseDefinitionQueryImpl) caseDefinitionQuery); } protected CaseInstanceEntityManager getCaseInstanceEntityManager() { return engineConfiguration.getCaseInstanceEntityManager(); } protected HistoricIdentityLinkEntityManager getHistoricIdentityLinkEntityManager() { return engineConfiguration.getIdentityLinkServiceConfiguration().getHistoricIdentityLinkEntityManager(); } protected HistoricMilestoneInstanceEntityManager getHistoricMilestoneInstanceEntityManager() { return engineConfiguration.getHistoricMilestoneInstanceEntityManager();
} protected HistoricTaskInstanceEntityManager getHistoricTaskInstanceEntityManager() { return engineConfiguration.getTaskServiceConfiguration().getHistoricTaskInstanceEntityManager(); } protected HistoricPlanItemInstanceEntityManager getHistoricPlanItemInstanceEntityManager() { return engineConfiguration.getHistoricPlanItemInstanceEntityManager(); } protected HistoricCaseInstanceEntityManager getHistoricCaseInstanceEntityManager() { return engineConfiguration.getHistoricCaseInstanceEntityManager(); } }
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\persistence\entity\CaseDefinitionEntityManagerImpl.java
1
请完成以下Java代码
public ProcessDefinitionEntity getCurrentProcessDefinition() { return currentProcessDefinition; } public void setCurrentProcessDefinition(ProcessDefinitionEntity currentProcessDefinition) { this.currentProcessDefinition = currentProcessDefinition; } public FlowElement getCurrentFlowElement() { return currentFlowElement; } public void setCurrentFlowElement(FlowElement currentFlowElement) { this.currentFlowElement = currentFlowElement; } public Process getCurrentProcess() { return currentProcess;
} public void setCurrentProcess(Process currentProcess) { this.currentProcess = currentProcess; } public void setCurrentSubProcess(SubProcess subProcess) { currentSubprocessStack.push(subProcess); } public SubProcess getCurrentSubProcess() { return currentSubprocessStack.peek(); } public void removeCurrentSubProcess() { currentSubprocessStack.pop(); } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\bpmn\parser\BpmnParse.java
1
请完成以下Java代码
public class SignalThrowingEventListener extends BaseDelegateEventListener { protected String signalName; protected boolean processInstanceScope = true; @Override public void onEvent(ActivitiEvent event) { if (isValidEvent(event)) { if (event.getProcessInstanceId() == null && processInstanceScope) { throw new ActivitiIllegalArgumentException( "Cannot throw process-instance scoped signal, since the dispatched event is not part of an ongoing process instance" ); } CommandContext commandContext = Context.getCommandContext(); EventSubscriptionEntityManager eventSubscriptionEntityManager = commandContext.getEventSubscriptionEntityManager(); List<SignalEventSubscriptionEntity> subscriptionEntities = null; if (processInstanceScope) { subscriptionEntities = eventSubscriptionEntityManager.findSignalEventSubscriptionsByProcessInstanceAndEventName( event.getProcessInstanceId(), signalName ); } else { String tenantId = null; if (event.getProcessDefinitionId() != null) { ProcessDefinition processDefinition = commandContext .getProcessEngineConfiguration() .getDeploymentManager() .findDeployedProcessDefinitionById(event.getProcessDefinitionId()); tenantId = processDefinition.getTenantId(); } subscriptionEntities = eventSubscriptionEntityManager.findSignalEventSubscriptionsByEventName(
signalName, tenantId ); } for (SignalEventSubscriptionEntity signalEventSubscriptionEntity : subscriptionEntities) { eventSubscriptionEntityManager.eventReceived(signalEventSubscriptionEntity, null, false); } } } public void setSignalName(String signalName) { this.signalName = signalName; } public void setProcessInstanceScope(boolean processInstanceScope) { this.processInstanceScope = processInstanceScope; } @Override public boolean isFailOnException() { return true; } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\bpmn\helper\SignalThrowingEventListener.java
1
请完成以下Java代码
public class Book { private UUID id; private String title; private String author; private String subject; private String publisher; Book() { } public Book(UUID id, String title, String author, String subject) { this.id = id; this.title = title; this.author = author; this.subject = subject; } 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 getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public String getSubject() { return subject; } public void setSubject(String subject) { this.subject = subject; } public String getPublisher() { return publisher; } public void setPublisher(String publisher) { this.publisher = publisher; } }
repos\tutorials-master\persistence-modules\java-cassandra\src\main\java\com\baeldung\cassandra\java\client\domain\Book.java
1
请完成以下Java代码
public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getIsbn() { return isbn; } public void setIsbn(String isbn) { this.isbn = isbn; } public int getPages() {
return pages; } public void setPages(int pages) { this.pages = pages; } public List<Chapter> getChapters() { return chapters; } public void setChapters(List<Chapter> chapters) { this.chapters = chapters; } }
repos\Hibernate-SpringBoot-master\HibernateSpringBootDatabaseTriggers\src\main\java\com\bookstore\entity\Book.java
1
请完成以下Java代码
public void setQtyOrdered_TU(BigDecimal qtyOrdered_TU) { this.qtyOrdered_TU = qtyOrdered_TU; } public BigDecimal getQtyPromised() { return qtyPromised; } public void setQtyPromised(BigDecimal qtyPromised) { this.qtyPromised = qtyPromised; } public BigDecimal getQtyPromised_TU() { return qtyPromised_TU; } public void setQtyPromised_TU(BigDecimal qtyPromised_TU) { this.qtyPromised_TU = qtyPromised_TU; } public BigDecimal getQtyDelivered() { return qtyDelivered; } public void setQtyDelivered(BigDecimal qtyDelivered) { this.qtyDelivered = qtyDelivered; } public static final class Builder { private Integer C_BPartner_ID; private Integer M_Product_ID; private Integer M_AttributeSetInstance_ID; private Integer M_HU_PI_Item_Product_ID; private int C_Flatrate_DataEntry_ID = -1; // private Date date; // private BigDecimal qtyPromised = BigDecimal.ZERO; private BigDecimal qtyPromised_TU = BigDecimal.ZERO; private BigDecimal qtyOrdered = BigDecimal.ZERO; private BigDecimal qtyOrdered_TU = BigDecimal.ZERO; private BigDecimal qtyDelivered = BigDecimal.ZERO; private Builder() { super(); } public PMMBalanceChangeEvent build() { return new PMMBalanceChangeEvent(this); } public Builder setC_BPartner_ID(final int C_BPartner_ID) { this.C_BPartner_ID = C_BPartner_ID;
return this; } public Builder setM_Product_ID(final int M_Product_ID) { this.M_Product_ID = M_Product_ID; return this; } public Builder setM_AttributeSetInstance_ID(final int M_AttributeSetInstance_ID) { this.M_AttributeSetInstance_ID = M_AttributeSetInstance_ID; return this; } public Builder setM_HU_PI_Item_Product_ID(final int M_HU_PI_Item_Product_ID) { this.M_HU_PI_Item_Product_ID = M_HU_PI_Item_Product_ID; return this; } public Builder setC_Flatrate_DataEntry_ID(int C_Flatrate_DataEntry_ID) { this.C_Flatrate_DataEntry_ID = C_Flatrate_DataEntry_ID; return this; } public Builder setDate(final Date date) { this.date = date; return this; } public Builder setQtyPromised(final BigDecimal qtyPromised, final BigDecimal qtyPromised_TU) { this.qtyPromised = qtyPromised; this.qtyPromised_TU = qtyPromised_TU; return this; } public Builder setQtyOrdered(final BigDecimal qtyOrdered, final BigDecimal qtyOrdered_TU) { this.qtyOrdered = qtyOrdered; this.qtyOrdered_TU = qtyOrdered_TU; return this; } public Builder setQtyDelivered(BigDecimal qtyDelivered) { this.qtyDelivered = qtyDelivered; return this; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.procurement.base\src\main\java\de\metas\procurement\base\balance\PMMBalanceChangeEvent.java
1
请完成以下Java代码
public static void registerType(ModelBuilder modelBuilder) { ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(LinkEventDefinition.class, BPMN_ELEMENT_LINK_EVENT_DEFINITION) .namespaceUri(BPMN20_NS) .extendsType(EventDefinition.class) .instanceProvider(new ModelTypeInstanceProvider<LinkEventDefinition>() { public LinkEventDefinition newInstance(ModelTypeInstanceContext instanceContext) { return new LinkEventDefinitionImpl(instanceContext); } }); nameAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_NAME) .required() .build(); SequenceBuilder sequenceBuilder = typeBuilder.sequence(); sourceCollection = sequenceBuilder.elementCollection(Source.class) .qNameElementReferenceCollection(LinkEventDefinition.class) .build(); targetChild = sequenceBuilder.element(Target.class) .qNameElementReference(LinkEventDefinition.class) .build(); typeBuilder.build(); } public LinkEventDefinitionImpl(ModelTypeInstanceContext context) { super(context); } public String getName() { return nameAttribute.getValue(this); }
public void setName(String name) { nameAttribute.setValue(this, name); } public Collection<LinkEventDefinition> getSources() { return sourceCollection.getReferenceTargetElements(this); } public LinkEventDefinition getTarget() { return targetChild.getReferenceTargetElement(this); } public void setTarget(LinkEventDefinition target) { targetChild.setReferenceTargetElement(this, target); } }
repos\camunda-bpm-platform-master\model-api\bpmn-model\src\main\java\org\camunda\bpm\model\bpmn\impl\instance\LinkEventDefinitionImpl.java
1
请完成以下Java代码
protected void writeTransition(TransitionInstance transition, StringWriter writer, String prefix, boolean isTail) { writer.append(prefix); if(isTail) { writer.append("└── "); } else { writer.append("├── "); } writer.append("transition to/from " + transition.getActivityId() + ":" + transition.getId() + "\n"); } public String toString() { StringWriter writer = new StringWriter(); writeTree(writer, "", true); return writer.toString(); } public ActivityInstance[] getActivityInstances(String activityId) { EnsureUtil.ensureNotNull("activityId", activityId); List<ActivityInstance> instances = new ArrayList<ActivityInstance>(); collectActivityInstances(activityId, instances); return instances.toArray(new ActivityInstance[instances.size()]); } protected void collectActivityInstances(String activityId, List<ActivityInstance> instances) { if (this.activityId.equals(activityId)) { instances.add(this); } else { for (ActivityInstance childInstance : childActivityInstances) { ((ActivityInstanceImpl) childInstance).collectActivityInstances(activityId, instances); } } } public TransitionInstance[] getTransitionInstances(String activityId) { EnsureUtil.ensureNotNull("activityId", activityId); List<TransitionInstance> instances = new ArrayList<TransitionInstance>(); collectTransitionInstances(activityId, instances); return instances.toArray(new TransitionInstance[instances.size()]); } protected void collectTransitionInstances(String activityId, List<TransitionInstance> instances) {
boolean instanceFound = false; for (TransitionInstance childTransitionInstance : childTransitionInstances) { if (activityId.equals(childTransitionInstance.getActivityId())) { instances.add(childTransitionInstance); instanceFound = true; } } if (!instanceFound) { for (ActivityInstance childActivityInstance : childActivityInstances) { ((ActivityInstanceImpl) childActivityInstance).collectTransitionInstances(activityId, instances); } } } public void setSubProcessInstanceId(String id) { subProcessInstanceId = id; } public String getSubProcessInstanceId() { return subProcessInstanceId; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\ActivityInstanceImpl.java
1
请在Spring Boot框架中完成以下Java代码
public UnreadNotificationsUpdate createFullUpdate() { return UnreadNotificationsUpdate.builder() .cmdId(getSubscriptionId()) .notifications(getSortedNotifications()) .totalUnreadCount(totalUnreadCounter.get()) .sequenceNumber(sequence.incrementAndGet()) .build(); } public List<Notification> getSortedNotifications() { return latestUnreadNotifications.values().stream() .sorted(Comparator.comparing(BaseData::getCreatedTime, Comparator.reverseOrder())) .collect(Collectors.toList()); } public UnreadNotificationsUpdate createPartialUpdate(Notification notification) { return UnreadNotificationsUpdate.builder()
.cmdId(getSubscriptionId()) .update(notification) .totalUnreadCount(totalUnreadCounter.get()) .sequenceNumber(sequence.incrementAndGet()) .build(); } public UnreadNotificationsUpdate createCountUpdate() { return UnreadNotificationsUpdate.builder() .cmdId(getSubscriptionId()) .totalUnreadCount(totalUnreadCounter.get()) .sequenceNumber(sequence.incrementAndGet()) .build(); } }
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\ws\notification\sub\NotificationsSubscription.java
2
请在Spring Boot框架中完成以下Java代码
public class SwaggerConfig { @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2)// .select()// .apis(RequestHandlerSelectors.any())// .paths(Predicates.not(PathSelectors.regex("/error")))// .build()// .apiInfo(metadata())// .useDefaultResponseMessages(false)// .securitySchemes( new ArrayList<>(Arrays.asList(new ApiKey("Bearer %token", "Authorization", "Header"))))// .tags(new Tag("users", "Operations about users"))// .tags(new Tag("ping", "Just a ping"))// .genericModelSubstitutes(Optional.class);
} private ApiInfo metadata() { return new ApiInfoBuilder()// .title("JSON Web Token Authentication API")// .description( "This is a sample JWT authentication service. You can find out more about JWT at [https://jwt.io/](https://jwt.io/). For this sample, you can use the `admin` or `client` users (password: admin and client respectively) to test the authorization filters. Once you have successfully logged in and obtained the token, you should click on the right top button `Authorize` and introduce it with the prefix \"Bearer \".")// .version("1.0.0")// .license("MIT License").licenseUrl("http://opensource.org/licenses/MIT")// .contact(new Contact(null, null, "vector4wang@qq.com"))// .build(); } }
repos\spring-boot-quick-master\quick-jwt\src\main\java\com\quick\jwt\config\SwaggerConfig.java
2
请完成以下Java代码
public int getDatevAcctExportLine_ID() { return get_ValueAsInt(COLUMNNAME_DatevAcctExportLine_ID); } @Override public void setDatev_Kost1 (final int Datev_Kost1) { set_Value (COLUMNNAME_Datev_Kost1, Datev_Kost1); } @Override public int getDatev_Kost1() { return get_ValueAsInt(COLUMNNAME_Datev_Kost1); } @Override public void setDatev_Kost2 (final int Datev_Kost2) { set_Value (COLUMNNAME_Datev_Kost2, Datev_Kost2); } @Override public int getDatev_Kost2() { return get_ValueAsInt(COLUMNNAME_Datev_Kost2); } @Override public void setDatum (final @Nullable java.lang.String Datum) { set_Value (COLUMNNAME_Datum, Datum); } @Override public java.lang.String getDatum() { return get_ValueAsString(COLUMNNAME_Datum); } @Override public void setFS (final int FS) { set_Value (COLUMNNAME_FS, FS); } @Override public int getFS() { return get_ValueAsInt(COLUMNNAME_FS); } @Override public void setGegenkonto (final @Nullable java.lang.String Gegenkonto) { set_Value (COLUMNNAME_Gegenkonto, Gegenkonto); } @Override public java.lang.String getGegenkonto() { return get_ValueAsString(COLUMNNAME_Gegenkonto); } @Override public void setKonto (final @Nullable java.lang.String Konto) { set_Value (COLUMNNAME_Konto, Konto); } @Override public java.lang.String getKonto() { return get_ValueAsString(COLUMNNAME_Konto); } @Override public void setLeistungsdatum (final @Nullable java.lang.String Leistungsdatum) {
set_Value (COLUMNNAME_Leistungsdatum, Leistungsdatum); } @Override public java.lang.String getLeistungsdatum() { return get_ValueAsString(COLUMNNAME_Leistungsdatum); } @Override public void setSkonto (final @Nullable java.lang.String Skonto) { set_Value (COLUMNNAME_Skonto, Skonto); } @Override public java.lang.String getSkonto() { return get_ValueAsString(COLUMNNAME_Skonto); } @Override public void setUmsatz (final @Nullable java.lang.String Umsatz) { set_Value (COLUMNNAME_Umsatz, Umsatz); } @Override public java.lang.String getUmsatz() { return get_ValueAsString(COLUMNNAME_Umsatz); } @Override public void setZI_Art (final @Nullable java.lang.String ZI_Art) { set_Value (COLUMNNAME_ZI_Art, ZI_Art); } @Override public java.lang.String getZI_Art() { return get_ValueAsString(COLUMNNAME_ZI_Art); } @Override public void setZI_Inhalt (final @Nullable java.lang.String ZI_Inhalt) { set_Value (COLUMNNAME_ZI_Inhalt, ZI_Inhalt); } @Override public java.lang.String getZI_Inhalt() { return get_ValueAsString(COLUMNNAME_ZI_Inhalt); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_DatevAcctExportLine.java
1
请完成以下Java代码
protected static void addFeatureThenClear(StringBuilder rawFeature, List<Integer> featureVector, FeatureMap featureMap) { int id = featureMap.idOf(rawFeature.toString()); if (id != -1) { featureVector.add(id); } rawFeature.setLength(0); } /** * 根据标注集还原字符形式的标签 * * @param tagSet * @return */ public String[] tags(TagSet tagSet) { assert tagArray != null; String[] tags = new String[tagArray.length]; for (int i = 0; i < tags.length; i++) { tags[i] = tagSet.stringOf(tagArray[i]);
} return tags; } /** * 实例大小(有多少个要预测的元素) * * @return */ public int size() { return featureMatrix.length; } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\model\perceptron\instance\Instance.java
1
请完成以下Java代码
protected Optional<Resource> getResource() { return Optional.ofNullable(this.resource.get()); } /** * Decorates the given {@link OutputStream} by adding buffering capabilities. * * @param outputStream {@link OutputStream} to decorate. * @return the decorated {@link OutputStream}. * @see #newFileOutputStream() * @see java.io.OutputStream */ protected @NonNull OutputStream decorate(@Nullable OutputStream outputStream) { return outputStream instanceof BufferedOutputStream ? outputStream : outputStream != null ? new BufferedOutputStream(outputStream, getBufferSize()) : newFileOutputStream(); } /** * Tries to construct a new {@link File} based {@link OutputStream} from the {@literal target} {@link Resource}. * * By default, the constructed {@link OutputStream} is also buffered (e.g. {@link BufferedOutputStream}). * * @return a {@link OutputStream} writing to a {@link File} identified by the {@literal target} {@link Resource}. * @throws IllegalStateException if the {@literal target} {@link Resource} cannot be handled as a {@link File}. * @throws DataAccessResourceFailureException if the {@link OutputStream} could not be created. * @see java.io.BufferedOutputStream * @see java.io.OutputStream * @see #getBufferSize() * @see #getOpenOptions() * @see #getResource() */ protected OutputStream newFileOutputStream() { return getResource()
.filter(this::isAbleToHandle) .map(resource -> { try { OutputStream fileOutputStream = Files.newOutputStream(resource.getFile().toPath(), getOpenOptions()); return new BufferedOutputStream(fileOutputStream, getBufferSize()); } catch (IOException cause) { String message = String.format("Failed to access the Resource [%s] as a file", resource.getDescription()); throw new ResourceDataAccessException(message, cause); } }) .orElseThrow(() -> newIllegalStateException("Resource [%s] is not a file based resource", getResource().map(Resource::getDescription).orElse(null))); } }
repos\spring-boot-data-geode-main\spring-geode-project\spring-geode\src\main\java\org\springframework\geode\core\io\support\FileResourceWriter.java
1
请完成以下Java代码
public String getSummary() { final StringBuilder sb = new StringBuilder(); sb.append(getDocumentNo()); sb.append(": "); sb.append(Services.get(IMsgBL.class).translate(getCtx(), "ApprovalAmt")).append("=").append(getApprovalAmt()); // - Description final String description = getDescription(); if (!Check.isEmpty(description, true)) { sb.append(" - ").append(description.trim()); } return sb.toString(); } @Override public LocalDate getDocumentDate() { return TimeUtil.asLocalDate(getMovementDate()); } /** * @return <code>null</code> */ @Override @Deprecated public String getProcessMsg() { return null; } /** * Get Document Owner (Responsible) * * @return AD_User_ID */
@Override public int getDoc_User_ID() { return getUpdatedBy(); } /** * Get Document Currency * * @return C_Currency_ID */ @Override public int getC_Currency_ID() { // MPriceList pl = MPriceList.get(getCtx(), getM_PriceList_ID()); // return pl.getC_Currency_ID(); return 0; } public boolean isComplete() { String ds = getDocStatus(); return DOCSTATUS_Completed.equals(ds) || DOCSTATUS_Closed.equals(ds) || DOCSTATUS_Reversed.equals(ds); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\MInventory.java
1
请在Spring Boot框架中完成以下Java代码
public String getScopeDefinitionId() { return scopeDefinitionId; } @ApiParam("Only return jobs with the given scopeDefinitionId") public void setScopeDefinitionId(String scopeDefinitionId) { this.scopeDefinitionId = scopeDefinitionId; } @ApiParam("Only return jobs with the given scope type") public String getScopeType() { return scopeType; } public void setScopeType(String scopeType) { this.scopeType = scopeType; } public String getElementId() { return elementId; } @ApiParam("Only return jobs with the given elementId") public void setElementId(String elementId) { this.elementId = elementId; } public String getElementName() { return elementName; } @ApiParam("Only return jobs with the given elementName") public void setElementName(String elementName) { this.elementName = elementName; } public boolean isWithException() { return withException; } @ApiParam("Only return jobs with an exception") public void setWithException(boolean withException) { this.withException = withException; } public String getExceptionMessage() { return exceptionMessage; } @ApiParam("Only return jobs with the given exception message") public void setExceptionMessage(String exceptionMessage) { this.exceptionMessage = exceptionMessage; } public String getTenantId() { return tenantId; } @ApiParam("Only return jobs with the given tenant id") public void setTenantId(String tenantId) { this.tenantId = tenantId; } public String getTenantIdLike() {
return tenantIdLike; } @ApiParam("Only return jobs with a tenantId like the given value") public void setTenantIdLike(String tenantIdLike) { this.tenantIdLike = tenantIdLike; } public boolean isWithoutTenantId() { return withoutTenantId; } @ApiParam("Only return jobs without a tenantId") public void setWithoutTenantId(boolean withoutTenantId) { this.withoutTenantId = withoutTenantId; } public boolean isLocked() { return locked; } @ApiParam("Only return jobs that are locked") public void setLocked(boolean locked) { this.locked = locked; } public boolean isUnlocked() { return unlocked; } @ApiParam("Only return jobs that are unlocked") public void setUnlocked(boolean unlocked) { this.unlocked = unlocked; } public boolean isWithoutScopeType() { return withoutScopeType; } @ApiParam("Only return jobs without a scope type") public void setWithoutScopeType(boolean withoutScopeType) { this.withoutScopeType = withoutScopeType; } }
repos\flowable-engine-main\modules\flowable-external-job-rest\src\main\java\org\flowable\external\job\rest\service\api\query\ExternalWorkerJobQueryRequest.java
2
请完成以下Java代码
public static CoreDictionary.Attribute getAttribute(Term term) { return getAttribute(term.word); } /** * 获取某个单词的词频 * @param word * @return */ public static int getFrequency(String word) { CoreDictionary.Attribute attribute = getAttribute(word); if (attribute == null) return 0; return attribute.totalFrequency; } /** * 设置某个单词的属性 * @param word * @param attribute * @return */ public static boolean setAttribute(String word, CoreDictionary.Attribute attribute) { if (attribute == null) return false; if (CoreDictionary.trie.set(word, attribute)) return true; if (CustomDictionary.DEFAULT.dat.set(word, attribute)) return true; if (CustomDictionary.DEFAULT.trie == null) { CustomDictionary.add(word); } CustomDictionary.DEFAULT.trie.put(word, attribute); return true; } /** * 设置某个单词的属性 * @param word * @param natures * @return */ public static boolean setAttribute(String word, Nature... natures) { if (natures == null) return false; CoreDictionary.Attribute attribute = new CoreDictionary.Attribute(natures, new int[natures.length]); Arrays.fill(attribute.frequency, 1); return setAttribute(word, attribute); } /** * 设置某个单词的属性 * @param word * @param natures * @return */ public static boolean setAttribute(String word, String... natures) { if (natures == null) return false; Nature[] natureArray = new Nature[natures.length]; for (int i = 0; i < natureArray.length; i++) { natureArray[i] = Nature.create(natures[i]); }
return setAttribute(word, natureArray); } /** * 设置某个单词的属性 * @param word * @param natureWithFrequency * @return */ public static boolean setAttribute(String word, String natureWithFrequency) { CoreDictionary.Attribute attribute = CoreDictionary.Attribute.create(natureWithFrequency); return setAttribute(word, attribute); } /** * 将字符串词性转为Enum词性 * @param name 词性名称 * @param customNatureCollector 一个收集集合 * @return 转换结果 */ public static Nature convertStringToNature(String name, LinkedHashSet<Nature> customNatureCollector) { Nature nature = Nature.fromString(name); if (nature == null) { nature = Nature.create(name); if (customNatureCollector != null) customNatureCollector.add(nature); } return nature; } /** * 将字符串词性转为Enum词性 * @param name 词性名称 * @return 转换结果 */ public static Nature convertStringToNature(String name) { return convertStringToNature(name, null); } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\utility\LexiconUtility.java
1
请完成以下Java代码
public Quantity min(final Quantity otherQty) { return valueAsInt <= otherQty.valueAsInt ? this : otherQty; } public Quantity min(final int otherQty) { return valueAsInt <= otherQty ? this : Quantity.of(otherQty); } public BigDecimal getValueAsBigDecimal() { return BigDecimal.valueOf(valueAsInt); } @JsonValue public int toJson()
{ return valueAsInt; } public boolean isZero() { return valueAsInt == 0; } @Override public int compareTo(@NonNull final Quantity other) { return this.valueAsInt - other.valueAsInt; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.msv3.commons\src\main\java\de\metas\vertical\pharma\msv3\protocol\types\Quantity.java
1
请在Spring Boot框架中完成以下Java代码
public int hashCode() { return Objects.hash(taxAddress, taxIdentifier, username); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Buyer {\n"); sb.append(" taxAddress: ").append(toIndentedString(taxAddress)).append("\n"); sb.append(" taxIdentifier: ").append(toIndentedString(taxIdentifier)).append("\n"); sb.append(" username: ").append(toIndentedString(username)).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(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\de-metas-camel-ebay\ebay-api-client\src\main\java\de\metas\camel\externalsystems\ebay\api\model\Buyer.java
2
请完成以下Java代码
public int getM_Attribute_ID() { return get_ValueAsInt(COLUMNNAME_M_Attribute_ID); } @Override public org.compiere.model.I_M_AttributeSet_IncludedTab getM_AttributeSet_IncludedTab() { return get_ValueAsPO(COLUMNNAME_M_AttributeSet_IncludedTab_ID, org.compiere.model.I_M_AttributeSet_IncludedTab.class); } @Override public void setM_AttributeSet_IncludedTab(final org.compiere.model.I_M_AttributeSet_IncludedTab M_AttributeSet_IncludedTab) { set_ValueFromPO(COLUMNNAME_M_AttributeSet_IncludedTab_ID, org.compiere.model.I_M_AttributeSet_IncludedTab.class, M_AttributeSet_IncludedTab); } @Override public void setM_AttributeSet_IncludedTab_ID (final int M_AttributeSet_IncludedTab_ID) { if (M_AttributeSet_IncludedTab_ID < 1) set_ValueNoCheck (COLUMNNAME_M_AttributeSet_IncludedTab_ID, null); else set_ValueNoCheck (COLUMNNAME_M_AttributeSet_IncludedTab_ID, M_AttributeSet_IncludedTab_ID); } @Override public int getM_AttributeSet_IncludedTab_ID() { return get_ValueAsInt(COLUMNNAME_M_AttributeSet_IncludedTab_ID); } @Override public void setM_AttributeValue_ID (final int M_AttributeValue_ID) { if (M_AttributeValue_ID < 1) set_Value (COLUMNNAME_M_AttributeValue_ID, null); else set_Value (COLUMNNAME_M_AttributeValue_ID, M_AttributeValue_ID); } @Override public int getM_AttributeValue_ID() { return get_ValueAsInt(COLUMNNAME_M_AttributeValue_ID); } @Override public void setRecord_Attribute_ID (final int Record_Attribute_ID) { if (Record_Attribute_ID < 1) set_ValueNoCheck (COLUMNNAME_Record_Attribute_ID, null); else set_ValueNoCheck (COLUMNNAME_Record_Attribute_ID, Record_Attribute_ID); } @Override public int getRecord_Attribute_ID() { return get_ValueAsInt(COLUMNNAME_Record_Attribute_ID); } @Override
public void setRecord_ID (final int Record_ID) { if (Record_ID < 0) set_ValueNoCheck (COLUMNNAME_Record_ID, null); else set_ValueNoCheck (COLUMNNAME_Record_ID, Record_ID); } @Override public int getRecord_ID() { return get_ValueAsInt(COLUMNNAME_Record_ID); } @Override public void setValueDate (final @Nullable java.sql.Timestamp ValueDate) { set_Value (COLUMNNAME_ValueDate, ValueDate); } @Override public java.sql.Timestamp getValueDate() { return get_ValueAsTimestamp(COLUMNNAME_ValueDate); } @Override public void setValueNumber (final @Nullable BigDecimal ValueNumber) { set_Value (COLUMNNAME_ValueNumber, ValueNumber); } @Override public BigDecimal getValueNumber() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_ValueNumber); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setValueString (final @Nullable java.lang.String ValueString) { set_Value (COLUMNNAME_ValueString, ValueString); } @Override public java.lang.String getValueString() { return get_ValueAsString(COLUMNNAME_ValueString); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_Record_Attribute.java
1
请完成以下Java代码
public static String removeLeadingZeroesWithGuavaTrimLeadingFrom(String s) { String stripped = CharMatcher.is('0') .trimLeadingFrom(s); if (stripped.isEmpty() && !s.isEmpty()) { return "0"; } return stripped; } public static String removeTrailingZeroesWithGuavaTrimTrailingFrom(String s) { String stripped = CharMatcher.is('0') .trimTrailingFrom(s);
if (stripped.isEmpty() && !s.isEmpty()) { return "0"; } return stripped; } public static String removeLeadingZeroesWithRegex(String s) { return s.replaceAll("^0+(?!$)", ""); } public static String removeTrailingZeroesWithRegex(String s) { return s.replaceAll("(?!^)0+$", ""); } }
repos\tutorials-master\core-java-modules\core-java-string-algorithms-2\src\main\java\com\baeldung\removeleadingtrailingchar\RemoveLeadingAndTrailingZeroes.java
1
请完成以下Java代码
public String getProcessRefExpression() { return processRefExpression; } public void setProcessRefExpression(String processRefExpression) { this.processRefExpression = processRefExpression; } public String getProcessRef() { return processRef; } public void setProcessRef(String processRef) { this.processRef = processRef; } public Process getProcess() { return process; } public void setProcess(Process process) { this.process = process; } public void setFallbackToDefaultTenant(Boolean fallbackToDefaultTenant) { this.fallbackToDefaultTenant = fallbackToDefaultTenant;
} public Boolean getFallbackToDefaultTenant() { return fallbackToDefaultTenant; } public boolean isSameDeployment() { return sameDeployment; } public void setSameDeployment(boolean sameDeployment) { this.sameDeployment = sameDeployment; } public String getProcessInstanceIdVariableName() { return processInstanceIdVariableName; } public void setProcessInstanceIdVariableName(String processInstanceIdVariableName) { this.processInstanceIdVariableName = processInstanceIdVariableName; } }
repos\flowable-engine-main\modules\flowable-cmmn-model\src\main\java\org\flowable\cmmn\model\ProcessTask.java
1
请在Spring Boot框架中完成以下Java代码
public float getSum(@PathVariable("number1") float number1, @PathVariable("number2") float number2) { return arithmeticService.add(number1, number2); } @GetMapping("/subtract/{number1}/{number2}") public float getDifference(@PathVariable("number1") float number1, @PathVariable("number2") float number2) { return arithmeticService.subtract(number1, number2); } @GetMapping("/multiply/{number1}/{number2}") public float getMultiplication(@PathVariable("number1") float number1, @PathVariable("number2") float number2) { return arithmeticService.multiply(number1, number2); } @GetMapping("/divide/{number1}/{number2}") public float getDivision(@PathVariable("number1") float number1, @PathVariable("number2") float number2) { return arithmeticService.divide(number1, number2); } @GetMapping("/memory") public String getMemoryStatus() { MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
String memoryStats = ""; String init = String.format( "Initial: %.2f GB \n", (double)memoryBean.getHeapMemoryUsage().getInit() /1073741824); String usedHeap = String.format("Used: %.2f GB \n", (double)memoryBean.getHeapMemoryUsage().getUsed() /1073741824); String maxHeap = String.format("Max: %.2f GB \n", (double)memoryBean.getHeapMemoryUsage().getMax() /1073741824); String committed = String.format("Committed: %.2f GB \n", (double)memoryBean.getHeapMemoryUsage().getCommitted() /1073741824); memoryStats += init; memoryStats += usedHeap; memoryStats += maxHeap; memoryStats += committed; return memoryStats; } }
repos\tutorials-master\spring-boot-modules\spring-boot-mvc-3\src\main\java\com\baeldung\micronaut\vs\springboot\controller\ArithmeticController.java
2
请完成以下Java代码
protected Collection<MigrationContext> nextElements() { Collection<MigrationContext> nextElements = new LinkedList<MigrationContext>(); MigrationContext currentElement = getCurrentElement(); // continue migration for non-leaf instances (i.e. scopes) if (currentElement.processElementInstance instanceof MigratingScopeInstance) { // Child instances share the same scope instance branch; // This ensures "once-per-parent" instantiation semantics, // i.e. if a new parent scope is added to more than one child, all those children // will share the same new parent instance. // By changing the way how the branches are created here, it should be possible // to implement other strategies, e.g. "once-per-child" semantics MigratingScopeInstanceBranch childrenScopeBranch = currentElement.scopeInstanceBranch.copy(); MigratingScopeInstanceBranch childrenCompensationScopeBranch = currentElement.scopeInstanceBranch.copy(); MigratingScopeInstance scopeInstance = (MigratingScopeInstance) currentElement.processElementInstance; childrenScopeBranch.visited(scopeInstance); childrenCompensationScopeBranch.visited(scopeInstance); for (MigratingProcessElementInstance child : scopeInstance.getChildren()) { MigratingScopeInstanceBranch instanceBranch = null; // compensation and non-compensation scopes cannot share the same scope instance branch // e.g. when adding a sub process, we want to create a new activity instance as well // as a new event scope instance for that sub process if (child instanceof MigratingEventScopeInstance || child instanceof MigratingCompensationEventSubscriptionInstance) { instanceBranch = childrenCompensationScopeBranch; } else { instanceBranch = childrenScopeBranch; } nextElements.add(new MigrationContext( child, instanceBranch)); }
} return nextElements; } public static class MigrationContext { protected MigratingProcessElementInstance processElementInstance; protected MigratingScopeInstanceBranch scopeInstanceBranch; public MigrationContext(MigratingProcessElementInstance processElementInstance, MigratingScopeInstanceBranch scopeInstanceBranch) { this.processElementInstance = processElementInstance; this.scopeInstanceBranch = scopeInstanceBranch; } public MigratingProcessElementInstance getProcessElementInstance() { return processElementInstance; } public MigratingScopeInstanceBranch getScopeInstanceBranch() { return scopeInstanceBranch; } } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\migration\instance\MigratingProcessElementInstanceTopDownWalker.java
1
请完成以下Java代码
private final POWrapper getParentPOWrapper() { final POWrapper poWrapper = parentPOWrapperRef.getValue(); if (poWrapper == null) { throw new AdempiereException("POWrapper reference expired"); } return poWrapper; } @Override protected Properties getParentCtx() { return getParentPOWrapper().getCtx(); } @Override protected String getParentTrxName() { return getParentPOWrapper().getTrxName();
} @Override protected int getId() { return getParentPOWrapper().getValueAsInt(parentColumnIndex); } @Override protected boolean setId(int id) { getParentPOWrapper().setValue(getParentColumnName(), id); return true; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\model\POWrapperCacheLocal.java
1
请在Spring Boot框架中完成以下Java代码
public Queue delayQueue4Queue() { return QueueBuilder.durable(DELAY_QUEUE_NAME) .withArgument("x-dead-letter-exchange", PROCESS_EXCHANGE_NAME) // DLX .withArgument("x-dead-letter-routing-key", ROUTING_KEY) // dead letter携带的routing key .withArgument("x-message-ttl", 3000) // 设置队列的过期时间 .build(); } @Bean Binding delayQueueBind() { return BindingBuilder.bind(delayQueue4Queue()) .to(delayQueueExchange()) .with(ROUTING_KEY); } @Bean public Queue helloQueue() { return new Queue("helloQueue"); } @Bean public Queue msgQueue() { return new Queue("msgQueue"); } //===============以下是验证topic Exchange的队列========== @Bean public Queue queueMessage() { return new Queue("topic.message"); } @Bean public Queue queueMessages() { return new Queue("topic.messages"); } //===============以上是验证topic Exchange的队列========== //===============以下是验证Fanout Exchange的队列========== @Bean public Queue AMessage() { return new Queue("fanout.A"); } @Bean public Queue BMessage() { return new Queue("fanout.B"); } @Bean public Queue CMessage() { return new Queue("fanout.C"); } //===============以上是验证Fanout Exchange的队列========== @Bean TopicExchange exchange() { return new TopicExchange("exchange");
} @Bean FanoutExchange fanoutExchange() { return new FanoutExchange("fanoutExchange"); } /** * 将队列topic.message与exchange绑定,binding_key为topic.message,就是完全匹配 * @param queueMessage * @param exchange * @return */ @Bean Binding bindingExchangeMessage(Queue queueMessage, TopicExchange exchange) { return BindingBuilder.bind(queueMessage).to(exchange).with("topic.message"); } /** * 将队列topic.messages与exchange绑定,binding_key为topic.#,模糊匹配 * @param queueMessages * @param exchange * @return */ @Bean Binding bindingExchangeMessages(Queue queueMessages, TopicExchange exchange) { return BindingBuilder.bind(queueMessages).to(exchange).with("topic.#"); } @Bean Binding bindingExchangeA(Queue AMessage, FanoutExchange fanoutExchange) { return BindingBuilder.bind(AMessage).to(fanoutExchange); } @Bean Binding bindingExchangeB(Queue BMessage, FanoutExchange fanoutExchange) { return BindingBuilder.bind(BMessage).to(fanoutExchange); } @Bean Binding bindingExchangeC(Queue CMessage, FanoutExchange fanoutExchange) { return BindingBuilder.bind(CMessage).to(fanoutExchange); } @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) //必须是prototype类型 public RabbitTemplate rabbitTemplate() { RabbitTemplate template = new RabbitTemplate(connectionFactory()); return template; } }
repos\spring-boot-quick-master\quick-rabbitmq\src\main\java\com\quick\mq\config\RabbitConfig.java
2
请在Spring Boot框架中完成以下Java代码
public String getOrderIp() { return orderIp; } public void setOrderIp(String orderIp) { this.orderIp = orderIp; } public String getOrderDate() { return orderDate; } public void setOrderDate(String orderDate) { this.orderDate = orderDate; } public String getOrderTime() { return orderTime; } public void setOrderTime(String orderTime) { this.orderTime = orderTime; } public Integer getOrderPeriod() { return orderPeriod; } public void setOrderPeriod(Integer orderPeriod) { this.orderPeriod = orderPeriod; } public String getReturnUrl() { return returnUrl; } public void setReturnUrl(String returnUrl) { this.returnUrl = returnUrl; } public String getNotifyUrl() { return notifyUrl; } public void setNotifyUrl(String notifyUrl) { this.notifyUrl = notifyUrl; } public String getSign() { return sign; } public void setSign(String sign) { this.sign = sign; }
public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public String getPayType() { return payType; } public void setPayType(String payType) { this.payType = payType; } public Integer getNumberOfStages() { return numberOfStages; } public void setNumberOfStages(Integer numberOfStages) { this.numberOfStages = numberOfStages; } @Override public String toString() { return "ScanPayRequestBo{" + "payKey='" + payKey + '\'' + ", productName='" + productName + '\'' + ", orderNo='" + orderNo + '\'' + ", orderPrice=" + orderPrice + ", orderIp='" + orderIp + '\'' + ", orderDate='" + orderDate + '\'' + ", orderTime='" + orderTime + '\'' + ", orderPeriod=" + orderPeriod + ", returnUrl='" + returnUrl + '\'' + ", notifyUrl='" + notifyUrl + '\'' + ", sign='" + sign + '\'' + ", remark='" + remark + '\'' + ", payType='" + payType + '\'' + ", numberOfStages=" + numberOfStages + '}'; } }
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\trade\bo\ScanPayRequestBo.java
2
请在Spring Boot框架中完成以下Java代码
private void registerDefaultEntryPoint(B http, RequestMatcher preferredMatcher) { ExceptionHandlingConfigurer<B> exceptionHandling = http.getConfigurer(ExceptionHandlingConfigurer.class); if (exceptionHandling == null) { return; } AuthenticationEntryPoint entryPoint = postProcess(this.authenticationEntryPoint); exceptionHandling.defaultAuthenticationEntryPointFor(entryPoint, preferredMatcher); exceptionHandling.defaultDeniedHandlerForMissingAuthority( (ep) -> ep.addEntryPointFor(entryPoint, preferredMatcher), FactorGrantedAuthority.PASSWORD_AUTHORITY); } private void registerDefaultLogoutSuccessHandler(B http, RequestMatcher preferredMatcher) { LogoutConfigurer<B> logout = http.getConfigurer(LogoutConfigurer.class); if (logout == null) { return; } LogoutConfigurer<B> handler = logout.defaultLogoutSuccessHandlerFor( postProcess(new HttpStatusReturningLogoutSuccessHandler(HttpStatus.NO_CONTENT)), preferredMatcher); } @Override public void configure(B http) { AuthenticationManager authenticationManager = http.getSharedObject(AuthenticationManager.class); BasicAuthenticationFilter basicAuthenticationFilter = new BasicAuthenticationFilter(authenticationManager, this.authenticationEntryPoint);
if (this.authenticationDetailsSource != null) { basicAuthenticationFilter.setAuthenticationDetailsSource(this.authenticationDetailsSource); } if (this.securityContextRepository != null) { basicAuthenticationFilter.setSecurityContextRepository(this.securityContextRepository); } RememberMeServices rememberMeServices = http.getSharedObject(RememberMeServices.class); if (rememberMeServices != null) { basicAuthenticationFilter.setRememberMeServices(rememberMeServices); } basicAuthenticationFilter.setSecurityContextHolderStrategy(getSecurityContextHolderStrategy()); basicAuthenticationFilter = postProcess(basicAuthenticationFilter); http.addFilter(basicAuthenticationFilter); } }
repos\spring-security-main\config\src\main\java\org\springframework\security\config\annotation\web\configurers\HttpBasicConfigurer.java
2
请完成以下Java代码
public T execute(CommandContext commandContext) { ProcessDefinitionEntity processDefinition = ProcessDefinitionUtil.getProcessDefinitionFromDatabase( processDefinitionId ); if (processDefinition == null) { throw new ActivitiObjectNotFoundException( "No process definition found for id = '" + processDefinitionId + "'", ProcessDefinition.class ); } if (processDefinition.isSuspended()) { throw new ActivitiException( "Cannot execute operation because process definition '" +
processDefinition.getName() + "' (id=" + processDefinition.getId() + ") is suspended" ); } return execute(commandContext, processDefinition); } /** * Subclasses should implement this. The provided {@link ProcessDefinition} is guaranteed to be an active process definition (ie. not suspended). */ protected abstract T execute(CommandContext commandContext, ProcessDefinitionEntity processDefinition); }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\cmd\NeedsActiveProcessDefinitionCmd.java
1
请完成以下Java代码
public java.sql.Timestamp getPreparationTime_5() { return get_ValueAsTimestamp(COLUMNNAME_PreparationTime_5); } @Override public void setPreparationTime_6 (final @Nullable java.sql.Timestamp PreparationTime_6) { set_Value (COLUMNNAME_PreparationTime_6, PreparationTime_6); } @Override public java.sql.Timestamp getPreparationTime_6() { return get_ValueAsTimestamp(COLUMNNAME_PreparationTime_6); } @Override public void setPreparationTime_7 (final @Nullable java.sql.Timestamp PreparationTime_7) { set_Value (COLUMNNAME_PreparationTime_7, PreparationTime_7); } @Override public java.sql.Timestamp getPreparationTime_7() { return get_ValueAsTimestamp(COLUMNNAME_PreparationTime_7); } @Override public void setReminderTimeInMin (final int ReminderTimeInMin)
{ set_Value (COLUMNNAME_ReminderTimeInMin, ReminderTimeInMin); } @Override public int getReminderTimeInMin() { return get_ValueAsInt(COLUMNNAME_ReminderTimeInMin); } @Override public void setValidFrom (final java.sql.Timestamp ValidFrom) { set_Value (COLUMNNAME_ValidFrom, ValidFrom); } @Override public java.sql.Timestamp getValidFrom() { return get_ValueAsTimestamp(COLUMNNAME_ValidFrom); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.purchasecandidate.base\src\main\java-gen\de\metas\purchasecandidate\model\X_C_BP_PurchaseSchedule.java
1
请完成以下Java代码
public String getPredefinedCaseInstanceId() { return predefinedCaseInstanceId; } @Override public String getName() { return name; } @Override public String getBusinessKey() { return businessKey; } @Override public String getBusinessStatus() { return businessStatus; } @Override public Map<String, Object> getVariables() { return variables; } @Override public Map<String, Object> getTransientVariables() { return transientVariables; } @Override public String getTenantId() { return tenantId; } @Override public String getOwner() { return ownerId; } @Override public String getAssignee() { return assigneeId; } @Override public String getOverrideDefinitionTenantId() { return overrideDefinitionTenantId; } @Override public String getOutcome() { return outcome; } @Override public Map<String, Object> getStartFormVariables() { return startFormVariables; } @Override public String getCallbackId() {
return this.callbackId; } @Override public String getCallbackType() { return this.callbackType; } @Override public String getReferenceId() { return referenceId; } @Override public String getReferenceType() { return referenceType; } @Override public String getParentId() { return this.parentId; } @Override public boolean isFallbackToDefaultTenant() { return this.fallbackToDefaultTenant; } @Override public boolean isStartWithForm() { return this.startWithForm; } }
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\runtime\CaseInstanceBuilderImpl.java
1
请在Spring Boot框架中完成以下Java代码
public AuthorizePayloadsSpec authenticated() { return access(AuthenticatedReactiveAuthorizationManager.authenticated()); } public AuthorizePayloadsSpec hasAuthority(String authority) { return access(AuthorityReactiveAuthorizationManager.hasAuthority(authority)); } public AuthorizePayloadsSpec hasRole(String role) { return access(AuthorityReactiveAuthorizationManager.hasRole(role)); } public AuthorizePayloadsSpec hasAnyRole(String... roles) { return access(AuthorityReactiveAuthorizationManager.hasAnyRole(roles)); } public AuthorizePayloadsSpec permitAll() { return access((a, ctx) -> Mono.just(new AuthorizationDecision(true))); }
public AuthorizePayloadsSpec hasAnyAuthority(String... authorities) { return access(AuthorityReactiveAuthorizationManager.hasAnyAuthority(authorities)); } public AuthorizePayloadsSpec access( ReactiveAuthorizationManager<PayloadExchangeAuthorizationContext> authorization) { AuthorizePayloadsSpec.this.authzBuilder .add(new PayloadExchangeMatcherEntry<>(this.matcher, authorization)); return AuthorizePayloadsSpec.this; } public AuthorizePayloadsSpec denyAll() { return access((a, ctx) -> Mono.just(new AuthorizationDecision(false))); } } } }
repos\spring-security-main\config\src\main\java\org\springframework\security\config\annotation\rsocket\RSocketSecurity.java
2
请完成以下Java代码
public boolean isWithoutTenantId() { return withoutTenantId; } public String getActivePlanItemDefinitionId() { return activePlanItemDefinitionId; } public Set<String> getActivePlanItemDefinitionIds() { return activePlanItemDefinitionIds; } public String getInvolvedUser() { return involvedUser; } public IdentityLinkQueryObject getInvolvedUserIdentityLink() { return involvedUserIdentityLink; } public Set<String> getInvolvedGroups() { return involvedGroups; } public IdentityLinkQueryObject getInvolvedGroupIdentityLink() { return involvedGroupIdentityLink; } public boolean isIncludeCaseVariables() { return includeCaseVariables; } public Collection<String> getVariableNamesToInclude() { return variableNamesToInclude; } public List<HistoricCaseInstanceQueryImpl> getOrQueryObjects() { return orQueryObjects; } public String getDeploymentId() { return deploymentId; } public List<String> getDeploymentIds() { return deploymentIds;
} public Set<String> getCaseInstanceIds() { return caseInstanceIds; } public boolean isNeedsCaseDefinitionOuterJoin() { if (isNeedsPaging()) { if (AbstractEngineConfiguration.DATABASE_TYPE_ORACLE.equals(databaseType) || AbstractEngineConfiguration.DATABASE_TYPE_DB2.equals(databaseType) || AbstractEngineConfiguration.DATABASE_TYPE_MSSQL.equals(databaseType)) { // When using oracle, db2 or mssql we don't need outer join for the process definition join. // It is not needed because the outer join order by is done by the row number instead return false; } } return hasOrderByForColumn(HistoricCaseInstanceQueryProperty.CASE_DEFINITION_KEY.getName()); } public List<List<String>> getSafeCaseInstanceIds() { return safeCaseInstanceIds; } public void setSafeCaseInstanceIds(List<List<String>> safeCaseInstanceIds) { this.safeCaseInstanceIds = safeCaseInstanceIds; } public List<List<String>> getSafeInvolvedGroups() { return safeInvolvedGroups; } public void setSafeInvolvedGroups(List<List<String>> safeInvolvedGroups) { this.safeInvolvedGroups = safeInvolvedGroups; } public String getRootScopeId() { return rootScopeId; } public String getParentScopeId() { return parentScopeId; } }
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\history\HistoricCaseInstanceQueryImpl.java
1
请完成以下Java代码
public List<CaseInstance> executeList(CommandContext commandContext, Page page) { checkQueryOk(); ensureVariablesInitialized(); return commandContext .getCaseExecutionManager() .findCaseInstanceByQueryCriteria(this, page); } //getters ///////////////////////////////////////////////////////////////// public String getCaseInstanceId() { return caseExecutionId; } public String getCaseExecutionId() { return caseExecutionId; } public String getActivityId() { return null; } public String getBusinessKey() { return businessKey; } public String getCaseDefinitionId() { return caseDefinitionId; } public String getCaseDefinitionKey() { return caseDefinitionKey; } public String getDeploymentId() { return deploymentId; } public CaseExecutionState getState() { return state; } public boolean isCaseInstancesOnly() { return true; }
public String getSuperProcessInstanceId() { return superProcessInstanceId; } public String getSubProcessInstanceId() { return subProcessInstanceId; } public String getSuperCaseInstanceId() { return superCaseInstanceId; } public String getSubCaseInstanceId() { return subCaseInstanceId; } public Boolean isRequired() { return required; } public Boolean isRepeatable() { return repeatable; } public Boolean isRepetition() { return repetition; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmmn\entity\runtime\CaseInstanceQueryImpl.java
1
请在Spring Boot框架中完成以下Java代码
public class OptimisticLockingCourse { @Id private Long id; private String name; @ManyToOne @JoinTable(name = "optimistic_student_course") private OptimisticLockingStudent student; public OptimisticLockingCourse(Long id, String name) { this.id = id; this.name = name; } public OptimisticLockingCourse() { } public Long getId() { return id; } public void setId(Long id) { this.id = id;
} public String getName() { return name; } public void setName(String name) { this.name = name; } public OptimisticLockingStudent getStudent() { return student; } public void setStudent(OptimisticLockingStudent student) { this.student = student; } }
repos\tutorials-master\persistence-modules\hibernate-jpa\src\main\java\com\baeldung\hibernate\optimisticlocking\OptimisticLockingCourse.java
2
请完成以下Java代码
public static <T> T executeWithinProcessApplication(Callable<T> callback, ProcessApplicationReference processApplicationReference, InvocationContext invocationContext) { String paName = processApplicationReference.getName(); try { ProcessApplicationInterface processApplication = processApplicationReference.getProcessApplication(); setCurrentProcessApplication(processApplicationReference); try { // wrap callback ProcessApplicationClassloaderInterceptor<T> wrappedCallback = new ProcessApplicationClassloaderInterceptor<T>(callback); // execute wrapped callback return processApplication.execute(wrappedCallback, invocationContext); } catch (Exception e) { // unwrap exception
if(e.getCause() != null && e.getCause() instanceof RuntimeException) { throw (RuntimeException) e.getCause(); }else { throw new ProcessEngineException("Unexpected exeption while executing within process application ", e); } } finally { removeCurrentProcessApplication(); } } catch (ProcessApplicationUnavailableException e) { throw new ProcessEngineException("Cannot switch to process application '"+paName+"' for execution: "+e.getMessage(), e); } } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\context\Context.java
1
请完成以下Java代码
public void setSponsorID(int sponsorID) { this.sponsorID = sponsorID; } public String getSponsorNo() { return sponsorNo; } public void setSponsorNo(String sponsorNo) { this.sponsorNo = sponsorNo; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getStringRepresentation() { return stringRepresentation; } public void setStringRepresentation(String stringRepresentation) { this.stringRepresentation = stringRepresentation; } @Override public boolean equals(Object obj)
{ if (!(obj instanceof SponsorNoObject)) return false; if (this == obj) return true; // SponsorNoObject sno = (SponsorNoObject)obj; return this.sponsorNo == sno.sponsorNo; } @Override public String toString() { String str = getStringRepresentation(); if (str != null) return str; return sponsorNo + ", " + name; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\adempiere\gui\search\SponsorNoObject.java
1
请完成以下Java代码
public boolean saveTxtTo(String path) { if ("=".equals(delimeter)) { LinkedList<TermFrequency> termFrequencyLinkedList = new LinkedList<TermFrequency>(); for (Map.Entry<String, TermFrequency> entry : trie.entrySet()) { termFrequencyLinkedList.add(entry.getValue()); } return IOUtil.saveCollectionToTxt(termFrequencyLinkedList, path); } else { ArrayList<String> outList = new ArrayList<String>(size()); for (Map.Entry<String, TermFrequency> entry : trie.entrySet()) { outList.add(entry.getKey() + delimeter + entry.getValue().getFrequency()); } return IOUtil.saveCollectionToTxt(outList, path); } } /** * 仅仅将值保存到文件 * @param path * @return */ public boolean saveKeyTo(String path)
{ LinkedList<String> keyList = new LinkedList<String>(); for (Map.Entry<String, TermFrequency> entry : trie.entrySet()) { keyList.add(entry.getKey()); } return IOUtil.saveCollectionToTxt(keyList, path); } /** * 按照频率从高到低排序的条目 * @return */ public TreeSet<TermFrequency> values() { TreeSet<TermFrequency> set = new TreeSet<TermFrequency>(Collections.reverseOrder()); for (Map.Entry<String, TermFrequency> entry : entrySet()) { set.add(entry.getValue()); } return set; } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\corpus\dictionary\TFDictionary.java
1
请完成以下Java代码
public final VPanelFieldGroup newCollapsibleFieldGroupPanel(final FieldGroupVO fieldGroup) { final boolean createCollapsibleContainer = fieldGroup != FieldGroupVO.NULL; final VPanelFieldGroup panel = new VPanelFieldGroup(layoutFactory, createCollapsibleContainer); panel.setFieldGroupName(fieldGroup.getFieldGroupName()); panel.setCollapsed(fieldGroup.isCollapsedByDefault()); panel.setCollapsible(fieldGroup.getFieldGroupType() == FieldGroupType.Collapsible); // Set content pane border. // top/bottom=0 because it seems the JXTaskPane is already adding those panel.getContentPane().setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); // top, left, bottom, right return panel; } public final VPanelFieldGroup newHorizontalFieldGroupPanel(final String fieldGroupName) { final boolean zeroInsets = false;
final JPanel contentPanel = layoutFactory.createFieldsPanel(zeroInsets); contentPanel.setName(fieldGroupName); final VPanelLayoutCallback layoutCallback = layoutFactory.createFieldsPanelLayoutCallback(); VPanelLayoutCallback.setup(contentPanel, layoutCallback); final VPanelFieldGroup panel = new VPanelFieldGroup(layoutFactory, contentPanel); panel.setFieldGroupName(fieldGroupName); return panel; } public VPanelFieldGroupFactory setLayoutFactory(final VPanelLayoutFactory layoutFactory) { Check.assumeNotNull(layoutFactory, "layoutFactory not null"); this.layoutFactory = layoutFactory; return this; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\org\compiere\grid\VPanelFieldGroupFactory.java
1