instruction
string
input
string
output
string
source_file
string
priority
int64
请在Spring Boot框架中完成以下Java代码
public Object aggregateGroupProject() { // 设置聚合条件,按岁数分组,然后求每组用户工资最大值、最小值,然后使用 $project 限制值显示 salaryMax 字段 AggregationOperation group = Aggregation.group("age") .max("salary").as("maxSalary") .min("salary").as("minSalary"); AggregationOperation project = Aggregation.project("maxSalary"); // 将操作加入到聚合对象中 Aggregation aggregation = Aggregation.newAggregation(group, project); // 执行聚合查询 AggregationResults<Map> results = mongoTemplate.aggregate(aggregation, COLLECTION_NAME, Map.class); for (Map result : results.getMappedResults()) { log.info("{}", result); } return results.getMappedResults(); } /** * 使用 $group 和 $unwind 聚合,先使用 $project 进行分组,然后再使用 $unwind 拆分文档中的数组为一条新文档记录 * * @return 聚合结果
*/ public Object aggregateProjectUnwind() { // 设置聚合条件,设置显示`name`、`age`、`title`字段,然后将结果中的多条文档按 title 字段进行拆分 AggregationOperation project = Aggregation.project("name", "age", "title"); AggregationOperation unwind = Aggregation.unwind("title"); // 将操作加入到聚合对象中 Aggregation aggregation = Aggregation.newAggregation(project, unwind); // 执行聚合查询 AggregationResults<Map> results = mongoTemplate.aggregate(aggregation, COLLECTION_NAME, Map.class); for (Map result : results.getMappedResults()) { log.info("{}", result); } return results.getMappedResults(); } }
repos\springboot-demo-master\mongodb\src\main\java\demo\et\mongodb\service\AggregatePipelineService.java
2
请完成以下Java代码
public class HttpStatusReturningLogoutSuccessHandler implements LogoutSuccessHandler { private final HttpStatus httpStatusToReturn; /** * Initialize the {@code HttpStatusLogoutSuccessHandler} with a user-defined * {@link HttpStatus}. * @param httpStatusToReturn Must not be {@code null}. */ public HttpStatusReturningLogoutSuccessHandler(HttpStatus httpStatusToReturn) { Assert.notNull(httpStatusToReturn, "The provided HttpStatus must not be null."); this.httpStatusToReturn = httpStatusToReturn; } /** * Initialize the {@code HttpStatusLogoutSuccessHandler} with the default * {@link HttpStatus#OK}. */ public HttpStatusReturningLogoutSuccessHandler() {
this.httpStatusToReturn = HttpStatus.OK; } /** * Implementation of * {@link LogoutSuccessHandler#onLogoutSuccess(HttpServletRequest, HttpServletResponse, Authentication)} * . Sets the status on the {@link HttpServletResponse}. */ @Override public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, @Nullable Authentication authentication) throws IOException { response.setStatus(this.httpStatusToReturn.value()); response.getWriter().flush(); } }
repos\spring-security-main\web\src\main\java\org\springframework\security\web\authentication\logout\HttpStatusReturningLogoutSuccessHandler.java
1
请完成以下Java代码
public void setPassword(String password) { this.password = password; } public Collection<Role> getRoles() { return roles; } public void setRoles(Collection<Role> roles) { this.roles = roles; } @ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinTable( name = "users_roles", joinColumns = @JoinColumn( name = "user_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn( name = "role_id", referencedColumnName = "id")) private Collection<Role> roles; public User() { } public User(String firstName, String lastName, String email, String password) { this.firstName = firstName; this.lastName = lastName; this.email = email; this.password = password; }
public User(String firstName, String lastName, String email, String password, Collection<Role> roles) { this.firstName = firstName; this.lastName = lastName; this.email = email; this.password = password; this.roles = roles; } public Long getId() { return id; } @Override public String toString() { return "User{" + "id=" + id + ", firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + ", email='" + email + '\'' + ", password='" + "admin123" + '\'' + ", roles=" + roles + '}'; } }
repos\Spring-Boot-Advanced-Projects-main\Springboot-Registration-Project\src\main\java\spring\security\model\User.java
1
请完成以下Java代码
public final class AuthorizationCodeOAuth2AuthorizedClientProvider implements OAuth2AuthorizedClientProvider { /** * Attempt to authorize the {@link OAuth2AuthorizationContext#getClientRegistration() * client} in the provided {@code context}. Returns {@code null} if authorization is * not supported, e.g. the client's * {@link ClientRegistration#getAuthorizationGrantType() authorization grant type} is * not {@link AuthorizationGrantType#AUTHORIZATION_CODE authorization_code} OR the * client is already authorized. * @param context the context that holds authorization-specific state for the client * @return {@code null} if authorization is not supported or the client is already * authorized * @throws ClientAuthorizationRequiredException in order to trigger authorization in * which the {@link OAuth2AuthorizationRequestRedirectFilter} will catch and initiate * the authorization request
*/ @Override @Nullable public OAuth2AuthorizedClient authorize(OAuth2AuthorizationContext context) { Assert.notNull(context, "context cannot be null"); if (AuthorizationGrantType.AUTHORIZATION_CODE.equals( context.getClientRegistration().getAuthorizationGrantType()) && context.getAuthorizedClient() == null) { // ClientAuthorizationRequiredException is caught by // OAuth2AuthorizationRequestRedirectFilter which initiates authorization throw new ClientAuthorizationRequiredException(context.getClientRegistration().getRegistrationId()); } return null; } }
repos\spring-security-main\oauth2\oauth2-client\src\main\java\org\springframework\security\oauth2\client\AuthorizationCodeOAuth2AuthorizedClientProvider.java
1
请完成以下Java代码
protected AutoDeploymentStrategy<AppEngine> getAutoDeploymentStrategy(final String mode) { AutoDeploymentStrategy<AppEngine> result = new DefaultAutoDeploymentStrategy(); for (final AutoDeploymentStrategy<AppEngine> strategy : deploymentStrategies) { if (strategy.handlesMode(mode)) { result = strategy; break; } } return result; } @Override public void start() { synchronized (lifeCycleMonitor) { if (!isRunning()) { enginesBuild.forEach(name -> autoDeployResources(AppEngines.getAppEngine(name))); running = true; } } } public Collection<AutoDeploymentStrategy<AppEngine>> getDeploymentStrategies() { return deploymentStrategies; } public void setDeploymentStrategies(Collection<AutoDeploymentStrategy<AppEngine>> deploymentStrategies) { this.deploymentStrategies = deploymentStrategies; } @Override public void stop() { synchronized (lifeCycleMonitor) { running = false;
} } @Override public boolean isRunning() { return running; } @Override public String getDeploymentName() { return null; } @Override public void setDeploymentName(String deploymentName) { // not supported throw new FlowableException("Setting a deployment name is not supported for apps"); } }
repos\flowable-engine-main\modules\flowable-app-engine-spring\src\main\java\org\flowable\app\spring\SpringAppEngineConfiguration.java
1
请完成以下Java代码
public class ConvertMap { private static final Map<String, String> dataTypes = new HashMap<String, String>(); private static final Map<Pattern, String> pattern2replacement = new IdentityHashMap<Pattern, String>(); public boolean isEmpty() { return pattern2replacement.isEmpty(); } public void addPattern(final String matchPatternStr, final String replacementStr) { Check.assumeNotNull(matchPatternStr, "matchPatternStr not null"); final Pattern matchPattern = Pattern.compile(matchPatternStr, Convert.REGEX_FLAGS); pattern2replacement.put(matchPattern, replacementStr); } public void addDataType(final String dataType, final String dataTypeTo) { Check.assumeNotNull(dataType, "dataType not null"); Check.assumeNotNull(dataTypeTo, "dataTypeTo not null"); dataTypes.put(dataType.toUpperCase(), dataTypeTo); final String matchPatternStr = "\\b" + dataType + "\\b"; addPattern(matchPatternStr, dataTypeTo);
} public Set<Map.Entry<Pattern, String>> getPattern2ReplacementEntries() { return pattern2replacement.entrySet(); } public String getDataTypeReplacement(final String dataTypeUC) { if (dataTypeUC == null) { return dataTypeUC; } return dataTypes.get(dataTypeUC); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\dbPort\ConvertMap.java
1
请完成以下Java代码
public boolean canReceive() { return canReceive; } public boolean canIssue() { return canIssue; } public boolean isBOMLine() { return this == BOMLine_Component || this == BOMLine_Component_Service || this == BOMLine_ByCoProduct; } public boolean isMainProduct() { return this == MainProduct; } public boolean isHUOrHUStorage() { return this == HU_LU || this == HU_TU || this == HU_VHU || this == HU_Storage; }
public static PPOrderLineType ofHUEditorRowType(final HUEditorRowType huType) { final PPOrderLineType type = huType2type.get(huType); if (type == null) { throw new IllegalArgumentException("No type found for " + huType); } return type; } private static final ImmutableMap<HUEditorRowType, PPOrderLineType> huType2type = Stream.of(values()) .filter(type -> type.huType != null) .collect(GuavaCollectors.toImmutableMapByKey(type -> type.huType)); }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\pporder\PPOrderLineType.java
1
请完成以下Java代码
public void setDescription (String Description) { set_Value (COLUMNNAME_Description, Description); } /** Get Description. @return Optional short description of the record */ public String getDescription () { return (String)get_Value(COLUMNNAME_Description); } /** Set Processed. @param Processed The document has been processed */ public void setProcessed (boolean Processed) { set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed)); }
/** Get Processed. @return The document has been processed */ public boolean isProcessed () { Object oo = get_Value(COLUMNNAME_Processed); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_A_Depreciation_Table_Header.java
1
请完成以下Java代码
protected void updateDebugSettings(TenantId tenantId, HasDebugSettings entity, long now) { if (entity.getDebugSettings() != null) { entity.setDebugSettings(entity.getDebugSettings().copy(getMaxDebugAllUntil(tenantId, now))); } else if (entity.isDebugMode()) { entity.setDebugSettings(DebugSettings.failuresOrUntil(getMaxDebugAllUntil(tenantId, now))); entity.setDebugMode(false); } } private long getMaxDebugAllUntil(TenantId tenantId, long now) { return now + TimeUnit.MINUTES.toMillis(DebugModeUtil.getMaxDebugAllDuration(tbTenantProfileCache.get(tenantId).getDefaultProfileConfiguration().getMaxDebugModeDurationMinutes(), defaultDebugDurationMinutes)); } protected <E extends HasId<?> & HasTenantId & HasName> void uniquifyEntityName(E entity, E oldEntity, Consumer<String> setName, EntityType entityType, NameConflictStrategy strategy) { Dao<?> dao = entityDaoRegistry.getDao(entityType); List<EntityInfo> existingEntities = dao.findEntityInfosByNamePrefix(entity.getTenantId(), entity.getName()); Set<String> existingNames = existingEntities.stream() .filter(e -> (oldEntity == null || !e.getId().equals(oldEntity.getId()))) .map(EntityInfo::getName) .collect(Collectors.toSet()); if (existingNames.contains(entity.getName())) { String uniqueName = generateUniqueName(entity.getName(), existingNames, strategy);
setName.accept(uniqueName); } } private String generateUniqueName(String baseName, Set<String> existingNames, NameConflictStrategy strategy) { String newName; int index = 1; String separator = strategy.separator(); boolean isRandom = strategy.uniquifyStrategy() == RANDOM; do { String suffix = isRandom ? StringUtils.randomAlphanumeric(6) : String.valueOf(index++); newName = baseName + separator + suffix; } while (existingNames.contains(newName)); return newName; } }
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\entity\AbstractEntityService.java
1
请完成以下Java代码
public void setTime(Date time) { this.time = time; } @Override public String getProcessInstanceId() { return processInstanceId; } public void setProcessInstanceId(String processInstanceId) { this.processInstanceId = processInstanceId; } public String getType() { return type; } public void setType(String type) { this.type = type; } @Override public String getFullMessage() { return fullMessage; } public void setFullMessage(String fullMessage) { this.fullMessage = fullMessage; } @Override public String getAction() { return action; } public void setAction(String action) { this.action = action; } public String getTenantId() { return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } @Override public String getRootProcessInstanceId() { return rootProcessInstanceId; } public void setRootProcessInstanceId(String rootProcessInstanceId) { this.rootProcessInstanceId = rootProcessInstanceId; }
@Override public Date getRemovalTime() { return removalTime; } public void setRemovalTime(Date removalTime) { this.removalTime = removalTime; } public String toEventMessage(String message) { String eventMessage = message.replaceAll("\\s+", " "); if (eventMessage.length() > 163) { eventMessage = eventMessage.substring(0, 160) + "..."; } return eventMessage; } @Override public String toString() { return this.getClass().getSimpleName() + "[id=" + id + ", type=" + type + ", userId=" + userId + ", time=" + time + ", taskId=" + taskId + ", processInstanceId=" + processInstanceId + ", rootProcessInstanceId=" + rootProcessInstanceId + ", revision= "+ revision + ", removalTime=" + removalTime + ", action=" + action + ", message=" + message + ", fullMessage=" + fullMessage + ", tenantId=" + tenantId + "]"; } @Override public void setRevision(int revision) { this.revision = revision; } @Override public int getRevision() { return revision; } @Override public int getRevisionNext() { return revision + 1; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\CommentEntity.java
1
请完成以下Java代码
public void setLevel (final java.lang.String Level) { set_ValueNoCheck (COLUMNNAME_Level, Level); } @Override public java.lang.String getLevel() { return get_ValueAsString(COLUMNNAME_Level); } @Override public void setModule (final @Nullable java.lang.String Module) { set_Value (COLUMNNAME_Module, Module); } @Override public java.lang.String getModule() { return get_ValueAsString(COLUMNNAME_Module); } @Override public void setMsgText (final @Nullable java.lang.String MsgText) { set_Value (COLUMNNAME_MsgText, MsgText); } @Override public java.lang.String getMsgText() { return get_ValueAsString(COLUMNNAME_MsgText); } @Override public void setSource_Record_ID (final int Source_Record_ID) { if (Source_Record_ID < 1) set_Value (COLUMNNAME_Source_Record_ID, null); else set_Value (COLUMNNAME_Source_Record_ID, Source_Record_ID); } @Override public int getSource_Record_ID() { return get_ValueAsInt(COLUMNNAME_Source_Record_ID); } @Override public void setSource_Table_ID (final int Source_Table_ID) { if (Source_Table_ID < 1) set_Value (COLUMNNAME_Source_Table_ID, null); else set_Value (COLUMNNAME_Source_Table_ID, Source_Table_ID);
} @Override public int getSource_Table_ID() { return get_ValueAsInt(COLUMNNAME_Source_Table_ID); } @Override public void setTarget_Record_ID (final int Target_Record_ID) { if (Target_Record_ID < 1) set_Value (COLUMNNAME_Target_Record_ID, null); else set_Value (COLUMNNAME_Target_Record_ID, Target_Record_ID); } @Override public int getTarget_Record_ID() { return get_ValueAsInt(COLUMNNAME_Target_Record_ID); } @Override public void setTarget_Table_ID (final int Target_Table_ID) { if (Target_Table_ID < 1) set_Value (COLUMNNAME_Target_Table_ID, null); else set_Value (COLUMNNAME_Target_Table_ID, Target_Table_ID); } @Override public int getTarget_Table_ID() { return get_ValueAsInt(COLUMNNAME_Target_Table_ID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_BusinessRule_Log.java
1
请在Spring Boot框架中完成以下Java代码
public void removeProductQtyFromHU( final Properties ctx, final I_M_HU hu, PackingItemParts parts) { final ITrxManager trxManager = Services.get(ITrxManager.class); trxManager.runInNewTrx((TrxRunnable)localTrxName -> { final IContextAware contextProvider = PlainContextAware.newWithTrxName(ctx, localTrxName); final IMutableHUContext huContext = Services.get(IHandlingUnitsBL.class).createMutableHUContext(contextProvider); for (final PackingItemPart part : parts.toList()) { removeProductQtyFromHU(huContext, hu, part); } }); } private void removeProductQtyFromHU( final IHUContext huContext, final I_M_HU hu, final PackingItemPart part) { final ShipmentScheduleId shipmentScheduleId = part.getShipmentScheduleId(); final I_M_ShipmentSchedule schedule = Services.get(IShipmentSchedulePA.class).getById(shipmentScheduleId); // // Allocation Request final IAllocationRequest request = AllocationUtils.createQtyRequest( huContext, part.getProductId(), part.getQty(), SystemTime.asZonedDateTime(), schedule, // reference model
false // forceQtyAllocation ); // // Allocation Destination final ShipmentScheduleQtyPickedProductStorage shipmentScheduleQtyPickedStorage = new ShipmentScheduleQtyPickedProductStorage(schedule); final IAllocationDestination destination = new GenericAllocationSourceDestination(shipmentScheduleQtyPickedStorage, schedule); // // Allocation Source final IAllocationSource source = HUListAllocationSourceDestination.of(hu); // // Move Qty from HU to shipment schedule (i.e. un-pick) final IAllocationResult result = HULoader.of(source, destination) .load(request); // Make sure result is completed // NOTE: this issue could happen if we want to take out more then we have in our HU if (!result.isCompleted()) { final String errmsg = MessageFormat.format(PackingService.ERR_CANNOT_FULLY_UNLOAD_RESULT, hu, result); throw new AdempiereException(errmsg); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\picking\service\impl\PackingService.java
2
请在Spring Boot框架中完成以下Java代码
public Date getDuedate() { return job.getDuedate(); } @Override public String getProcessInstanceId() { return job.getProcessInstanceId(); } @Override public String getExecutionId() { return job.getExecutionId(); } @Override public String getProcessDefinitionId() { return job.getProcessDefinitionId(); } @Override public String getCategory() { return job.getCategory(); } @Override public String getJobType() { return job.getJobType(); } @Override public String getElementId() { return job.getElementId(); } @Override public String getElementName() { return job.getElementName(); } @Override public String getScopeId() { return job.getScopeId(); } @Override public String getSubScopeId() { return job.getSubScopeId(); } @Override public String getScopeType() { return job.getScopeType(); } @Override public String getScopeDefinitionId() { return job.getScopeDefinitionId(); } @Override public String getCorrelationId() { return job.getCorrelationId(); } @Override public boolean isExclusive() { return job.isExclusive(); } @Override public Date getCreateTime() { return job.getCreateTime(); } @Override public String getId() { return job.getId(); } @Override public int getRetries() { return job.getRetries(); }
@Override public String getExceptionMessage() { return job.getExceptionMessage(); } @Override public String getTenantId() { return job.getTenantId(); } @Override public String getJobHandlerType() { return job.getJobHandlerType(); } @Override public String getJobHandlerConfiguration() { return job.getJobHandlerConfiguration(); } @Override public String getCustomValues() { return job.getCustomValues(); } @Override public String getLockOwner() { return job.getLockOwner(); } @Override public Date getLockExpirationTime() { return job.getLockExpirationTime(); } @Override public String toString() { return new StringJoiner(", ", AcquiredExternalWorkerJobImpl.class.getSimpleName() + "[", "]") .add("job=" + job) .toString(); } }
repos\flowable-engine-main\modules\flowable-job-service\src\main\java\org\flowable\job\service\impl\AcquiredExternalWorkerJobImpl.java
2
请完成以下Java代码
public static DocumentFilterDescriptorsProvider createFilterDescriptorsProvider() { return ImmutableDocumentFilterDescriptorsProvider.of( PickingSlotViewFilters.createPickingSlotBarcodeFilters(), createBPartnerFilter()); } private static DocumentFilterDescriptor createBPartnerFilter() { final LookupDescriptor bpartnerLookupDescriptor = LookupDescriptorProviders.sharedInstance().sql() .setCtxColumnName(I_C_BPartner.COLUMNNAME_C_BPartner_ID) .setDisplayType(DisplayType.Search) .buildForDefaultScope(); return DocumentFilterDescriptor.builder() .setFilterId(FILTER_ID_BPartner) .setFrequentUsed(true) .addParameter(DocumentFilterParamDescriptor.builder() .fieldName(PARAM_C_BPartner_ID) .displayName(Services.get(IMsgBL.class).translatable(PARAM_C_BPartner_ID)) .mandatory(true) .widgetType(DocumentFieldWidgetType.Lookup)
.lookupDescriptor(bpartnerLookupDescriptor)) .build(); } public static PickingSlotQRCode getPickingSlotQRCode(final DocumentFilterList filters) { return PickingSlotViewFilters.getPickingSlotQRCode(filters); } public static BPartnerId getBPartnerId(final DocumentFilterList filters) { return BPartnerId.ofRepoIdOrNull(filters.getParamValueAsInt(FILTER_ID_BPartner, PARAM_C_BPartner_ID, -1)); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\pickingslotsClearing\PickingSlotsClearingViewFilters.java
1
请完成以下Java代码
public final class FieldGroupVO { public static final FieldGroupVO build(final String fieldGroupName, final FieldGroupType fieldGroupType, final boolean collapsedByDefault) { // Optimization: if we were asked for a "null" field group, reuse our null instance if (Check.isEmpty(fieldGroupName) && (fieldGroupType == null || fieldGroupType == NULL.getFieldGroupType())) { return NULL; } return new FieldGroupVO(fieldGroupName, fieldGroupType, collapsedByDefault); } public static final FieldGroupVO NULL = new FieldGroupVO(null, null, false); /** Field group type */ public static enum FieldGroupType { /** Not collapsible panel */ Label /** Collapsible panel */ , Collapsible /** Horizontal tab */ , Tab; /** * Gets the {@link FieldGroupType} of given code. * * @param code {@link X_AD_FieldGroup#FIELDGROUPTYPE_Label}, {@link X_AD_FieldGroup#FIELDGROUPTYPE_Tab}, {@link X_AD_FieldGroup#FIELDGROUPTYPE_Collapse} etc * @param defaultType * @return field group type or <code>defaultType</code> if no type was found for code. */ public static final FieldGroupType forCodeOrDefault(final String code, final FieldGroupType defaultType) { final FieldGroupType type = code2type.get(code); return type == null ? defaultType : type; } private static final ImmutableMap<String, FieldGroupType> code2type = ImmutableMap.<String, FieldGroupType> builder() .put(X_AD_FieldGroup.FIELDGROUPTYPE_Label, Label) .put(X_AD_FieldGroup.FIELDGROUPTYPE_Tab, Tab) .put(X_AD_FieldGroup.FIELDGROUPTYPE_Collapse, Collapsible) .build(); } private final String fieldGroupName;
private final FieldGroupType fieldGroupType; private final boolean collapsedByDefault; private FieldGroupVO(final String fieldGroupName, final FieldGroupType fieldGroupType, final boolean collapsedByDefault) { super(); this.fieldGroupName = fieldGroupName == null ? "" : fieldGroupName; this.fieldGroupType = fieldGroupType == null ? FieldGroupType.Label : fieldGroupType; this.collapsedByDefault = collapsedByDefault; } @Override public String toString() { return MoreObjects.toStringHelper(this) .add("name", fieldGroupName) .add("type", fieldGroupType) .add("collapsedByDefault", collapsedByDefault) .toString(); } public String getFieldGroupName() { return fieldGroupName; } public FieldGroupType getFieldGroupType() { return fieldGroupType; } public boolean isCollapsedByDefault() { return collapsedByDefault; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\FieldGroupVO.java
1
请完成以下Java代码
public void afterPropertiesSet() { Assert.notNull(this.marshaller, "Property 'marshaller' is required"); Assert.notNull(this.unmarshaller, "Property 'unmarshaller' is required"); } /** * Marshals the given object to a {@link Message}. */ @Override protected Message createMessage(Object object, MessageProperties messageProperties) throws MessageConversionException { try { if (this.contentType != null) { messageProperties.setContentType(this.contentType); } ByteArrayOutputStream bos = new ByteArrayOutputStream(); StreamResult streamResult = new StreamResult(bos); this.marshaller.marshal(object, streamResult); return new Message(bos.toByteArray(), messageProperties); } catch (XmlMappingException ex) { throw new MessageConversionException("Could not marshal [" + object + "]", ex); } catch (IOException ex) { throw new MessageConversionException("Could not marshal [" + object + "]", ex); } } /**
* Unmarshals the given {@link Message} into an object. */ @Override public Object fromMessage(Message message) throws MessageConversionException { try { ByteArrayInputStream bis = new ByteArrayInputStream(message.getBody()); StreamSource source = new StreamSource(bis); return this.unmarshaller.unmarshal(source); } catch (IOException ex) { throw new MessageConversionException("Could not access message content: " + message, ex); } catch (XmlMappingException ex) { throw new MessageConversionException("Could not unmarshal message: " + message, ex); } } }
repos\spring-amqp-main\spring-amqp\src\main\java\org\springframework\amqp\support\converter\MarshallingMessageConverter.java
1
请在Spring Boot框架中完成以下Java代码
public List<RestVariable> getVariables() { return variables; } public void setVariables(List<RestVariable> variables) { this.variables = variables; } public void addVariable(RestVariable variable) { variables.add(variable); } @ApiModelProperty(example = "null") public String getTenantId() { return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } public String getFormKey() { return formKey; } public void setFormKey(String formKey) { this.formKey = formKey; } @ApiModelProperty(example = "123") public String getPropagatedStageInstanceId() { return propagatedStageInstanceId; } public void setPropagatedStageInstanceId(String propagatedStageInstanceId) { this.propagatedStageInstanceId = propagatedStageInstanceId; } @ApiModelProperty(example = "123") public String getExecutionId() { return executionId; }
public void setExecutionId(String executionId) { this.executionId = executionId; } @ApiModelProperty(example = "123") public String getProcessInstanceId() { return processInstanceId; } public void setProcessInstanceId(String processInstanceId) { this.processInstanceId = processInstanceId; } @ApiModelProperty(example = "123") public String getProcessDefinitionId() { return processDefinitionId; } public void setProcessDefinitionId(String processDefinitionId) { this.processDefinitionId = processDefinitionId; } }
repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\runtime\task\TaskResponse.java
2
请完成以下Java代码
public class ScriptTaskActivityBehavior extends TaskActivityBehavior { protected ExecutableScript script; protected String resultVariable; public ScriptTaskActivityBehavior(ExecutableScript script, String resultVariable) { this.script = script; this.resultVariable = resultVariable; } @Override public void performExecution(final ActivityExecution execution) throws Exception { executeWithErrorPropagation(execution, new Callable<Void>() { @Override public Void call() throws Exception { ScriptInvocation invocation = new ScriptInvocation(script, execution); Context.getProcessEngineConfiguration().getDelegateInterceptor().handleInvocation(invocation); Object result = invocation.getInvocationResult(); if (result != null && resultVariable != null) { execution.setVariable(resultVariable, result); } leave(execution); return null; } }); } /** * Searches recursively through the exception to see if the exception itself * or one of its causes is a {@link BpmnError}. * * @param e
* the exception to check * @return the BpmnError that was the cause of this exception or null if no * BpmnError was found */ protected BpmnError checkIfCauseOfExceptionIsBpmnError(Throwable e) { if (e instanceof BpmnError) { return (BpmnError) e; } else if (e.getCause() == null) { return null; } return checkIfCauseOfExceptionIsBpmnError(e.getCause()); } public ExecutableScript getScript() { return script; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\bpmn\behavior\ScriptTaskActivityBehavior.java
1
请完成以下Java代码
public class OrderTotal { private String _id; private long total; private long sumTotal; public String get_id() { return _id; } public void set_id(String _id) { this._id = _id; } public long getTotal() { return total; }
public void setTotal(long total) { this.total = total; } public long getSumTotal() { return sumTotal; } public void setSumTotal(long sumTotal) { this.sumTotal = sumTotal; } @Override public String toString() { return ToStringBuilder.reflectionToString(this); } }
repos\spring-boot-leaning-master\2.x_data\2-5 MongoDB 分布式计算 Aggregate VS Mapreduce\spring-boot-mongodb-aggregate\src\main\java\com\neo\result\OrderTotal.java
1
请完成以下Java代码
public void setTitle(final org.compiere.model.I_AD_User user) { if (user.getC_Title_ID() > 0) { final String title = extractTitle(user); user.setTitle(title); } else { user.setTitle(""); } } private String extractTitle(org.compiere.model.I_AD_User user) { String userTitle = ""; final Optional<Language> languageForModel = bpPartnerService.getLanguageForModel(user); final Title title = titleRepository.getByIdAndLang(TitleId.ofRepoId(user.getC_Title_ID()), languageForModel.orElse(null)); if (title != null) { userTitle = title.getTitle(); } return userTitle; } @ModelChange(timings = { ModelValidator.TYPE_AFTER_NEW, ModelValidator.TYPE_AFTER_CHANGE }, ifUIAction = true) public void afterSave(@NonNull final I_AD_User userRecord) { final BPartnerId bPartnerId = BPartnerId.ofRepoIdOrNull(userRecord.getC_BPartner_ID()); if (bPartnerId == null) { //nothing to do return; } bpPartnerService.updateNameAndGreetingFromContacts(bPartnerId);
} @ModelChange(timings = {ModelValidator.TYPE_BEFORE_DELETE}, ifUIAction = true) public void beforeDelete_UIAction(@NonNull final I_AD_User userRecord) { final UserId loggedInUserId = Env.getLoggedUserIdIfExists().orElse(null); if (loggedInUserId != null && loggedInUserId.getRepoId() == userRecord.getAD_User_ID()) { throw new AdempiereException(MSG_UserDelete) .setParameter("AD_User_ID", userRecord.getAD_User_ID()) .setParameter("Name", userRecord.getName()); } userBL.deleteUserDependency(userRecord); } @ModelChange(timings = { ModelValidator.TYPE_AFTER_DELETE }, ifUIAction = true) public void afterDelete(@NonNull final I_AD_User userRecord) { final BPartnerId bPartnerId = BPartnerId.ofRepoIdOrNull(userRecord.getC_BPartner_ID()); if (bPartnerId == null) { //nothing to do return; } bpPartnerService.updateNameAndGreetingFromContacts(bPartnerId); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\adempiere\modelvalidator\AD_User.java
1
请完成以下Java代码
public void setPort(int port) { this.port = port; } @Override public Transport transport() { return transport; } public void setTransport(Transport transport) { this.transport = transport; } @Override public boolean isStartTlsEnabled() { return startTlsEnabled; } public void setStartTlsEnabled(boolean startTlsEnabled) { this.startTlsEnabled = startTlsEnabled; }
@Override public String user() { return user; } public void setUser(String user) { this.user = user; } @Override public String password() { return password; } public void setPassword(String password) { this.password = password; } }
repos\flowable-engine-main\modules\flowable-mail\src\main\java\org\flowable\mail\common\impl\BaseMailHostServerConfiguration.java
1
请完成以下Java代码
public void setC_Job_ID (int C_Job_ID) { if (C_Job_ID < 1) set_ValueNoCheck (COLUMNNAME_C_Job_ID, null); else set_ValueNoCheck (COLUMNNAME_C_Job_ID, Integer.valueOf(C_Job_ID)); } /** Get Position. @return Job Position */ public int getC_Job_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_C_Job_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Description. @param Description Optional short description of the record */ public void setDescription (String Description) { set_Value (COLUMNNAME_Description, Description); } /** Get Description. @return Optional short description of the record */ public String getDescription () { return (String)get_Value(COLUMNNAME_Description); } /** Set Comment/Help. @param Help Comment or Hint */ public void setHelp (String Help) { set_Value (COLUMNNAME_Help, Help); } /** Get Comment/Help. @return Comment or Hint */ public String getHelp () { return (String)get_Value(COLUMNNAME_Help); } /** Set Employee. @param IsEmployee Indicates if this Business Partner is an employee
*/ public void setIsEmployee (boolean IsEmployee) { set_Value (COLUMNNAME_IsEmployee, Boolean.valueOf(IsEmployee)); } /** Get Employee. @return Indicates if this Business Partner is an employee */ public boolean isEmployee () { Object oo = get_Value(COLUMNNAME_IsEmployee); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Name. @param Name Alphanumeric identifier of the entity */ public void setName (String Name) { set_Value (COLUMNNAME_Name, Name); } /** Get Name. @return Alphanumeric identifier of the entity */ public String getName () { return (String)get_Value(COLUMNNAME_Name); } /** Get Record ID/ColumnName @return ID/ColumnName pair */ public KeyNamePair getKeyNamePair() { return new KeyNamePair(get_ID(), getName()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Job.java
1
请在Spring Boot框架中完成以下Java代码
public HikariDataSource configureDataSource() { HikariConfig config = new HikariConfig(); config.setDriverClassName(driver); config.setJdbcUrl(url); config.setUsername(username); config.setPassword(password); config.setMaximumPoolSize(maximumPoolSize); config.setConnectionTimeout(60000); config.setIdleTimeout(60000); config.setLeakDetectionThreshold(60000); return new HikariDataSource(config); } @Bean(name = "entityManagerFactory") public LocalContainerEntityManagerFactoryBean configureEntityManagerFactory() { LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); entityManagerFactoryBean.setDataSource(configureDataSource());
entityManagerFactoryBean.setPackagesToScan("com.urunov"); entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); Properties jpaProperties = new Properties(); jpaProperties.put(org.hibernate.cfg.Environment.DIALECT, dialect); jpaProperties.put(org.hibernate.cfg.Environment.HBM2DDL_AUTO, hbm2ddlAuto); entityManagerFactoryBean.setJpaProperties(jpaProperties); return entityManagerFactoryBean; } @Bean(name = "transactionManager") public PlatformTransactionManager annotationDrivenTransactionManager() { return new JpaTransactionManager(); } }
repos\SpringBoot-Projects-FullStack-master\Part-9.SpringBoot-React-Projects\Project-2.SpringBoot-React-ShoppingMall\fullstack\backend\src\main\java\com\urunov\configure\JpaConfig.java
2
请完成以下Java代码
public void setA_Purchase_Option_Credit (int A_Purchase_Option_Credit) { set_Value (COLUMNNAME_A_Purchase_Option_Credit, Integer.valueOf(A_Purchase_Option_Credit)); } /** Get Purchase Option Credit. @return Purchase Option Credit */ public int getA_Purchase_Option_Credit () { Integer ii = (Integer)get_Value(COLUMNNAME_A_Purchase_Option_Credit); if (ii == null) return 0; return ii.intValue(); } /** Set Purchase Option Credit %. @param A_Purchase_Option_Credit_Per Purchase Option Credit % */ public void setA_Purchase_Option_Credit_Per (BigDecimal A_Purchase_Option_Credit_Per) { set_Value (COLUMNNAME_A_Purchase_Option_Credit_Per, A_Purchase_Option_Credit_Per); } /** Get Purchase Option Credit %. @return Purchase Option Credit % */ public BigDecimal getA_Purchase_Option_Credit_Per () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_A_Purchase_Option_Credit_Per); if (bd == null) return Env.ZERO; return bd; } /** Set Option Purchase Price. @param A_Purchase_Price Option Purchase Price */ public void setA_Purchase_Price (BigDecimal A_Purchase_Price) { set_Value (COLUMNNAME_A_Purchase_Price, A_Purchase_Price); } /** Get Option Purchase Price. @return Option Purchase Price */ public BigDecimal getA_Purchase_Price () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_A_Purchase_Price); if (bd == null) return Env.ZERO; return bd;
} /** Set Business Partner . @param C_BPartner_ID Identifies a Business Partner */ public void setC_BPartner_ID (int C_BPartner_ID) { if (C_BPartner_ID < 1) set_Value (COLUMNNAME_C_BPartner_ID, null); else set_Value (COLUMNNAME_C_BPartner_ID, Integer.valueOf(C_BPartner_ID)); } /** Get Business Partner . @return Identifies a Business Partner */ public int getC_BPartner_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_C_BPartner_ID); if (ii == null) return 0; return ii.intValue(); } /** 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_Fin.java
1
请完成以下Java代码
public void setCamundaType(String camundaType) { camundaTypeAttribute.setValue(this, camundaType); } public String getCamundaDatePattern() { return camundaDatePatternAttribute.getValue(this); } public void setCamundaDatePattern(String camundaDatePattern) { camundaDatePatternAttribute.setValue(this, camundaDatePattern); } public String getCamundaDefaultValue() { return camundaDefaultValueAttribute.getValue(this); } public void setCamundaDefaultValue(String camundaDefaultValue) { camundaDefaultValueAttribute.setValue(this, camundaDefaultValue); } public CamundaProperties getCamundaProperties() { return camundaPropertiesChild.getChild(this); }
public void setCamundaProperties(CamundaProperties camundaProperties) { camundaPropertiesChild.setChild(this, camundaProperties); } public CamundaValidation getCamundaValidation() { return camundaValidationChild.getChild(this); } public void setCamundaValidation(CamundaValidation camundaValidation) { camundaValidationChild.setChild(this, camundaValidation); } public Collection<CamundaValue> getCamundaValues() { return camundaValueCollection.get(this); } }
repos\camunda-bpm-platform-master\model-api\bpmn-model\src\main\java\org\camunda\bpm\model\bpmn\impl\instance\camunda\CamundaFormFieldImpl.java
1
请在Spring Boot框架中完成以下Java代码
public class ExternalSystemOtherConfigParameterId implements RepoIdAware { @JsonCreator public static ExternalSystemOtherConfigParameterId ofRepoId(final int repoId) { return new ExternalSystemOtherConfigParameterId(repoId); } @Nullable public static ExternalSystemOtherConfigParameterId ofRepoIdOrNull(final int repoId) { return repoId > 0 ? new ExternalSystemOtherConfigParameterId(repoId) : null; } public static int toRepoId(@Nullable final ExternalSystemOtherConfigParameterId externalSystemOtherConfigParameterId) {
return externalSystemOtherConfigParameterId != null ? externalSystemOtherConfigParameterId.getRepoId() : -1; } int repoId; private ExternalSystemOtherConfigParameterId(final int repoId) { this.repoId = Check.assumeGreaterThanZero(repoId, "ExternalSystem_Other_ConfigParameter_ID"); } @Override @JsonValue public int getRepoId() { return repoId; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java\de\metas\externalsystem\other\ExternalSystemOtherConfigParameterId.java
2
请完成以下Java代码
public int getPinCode() { return pinCode; } public void setPinCode(int pinCode) { this.pinCode = pinCode; } public long getContactNumber() { return contactNumber; } public void setContactNumber(long contactNumber) { this.contactNumber = contactNumber; } public float getHeight() { return height; } public void setHeight(float height) { this.height = height; } public double getWeight() { return weight; } public void setWeight(double weight) { this.weight = weight; } public char getGender() { return gender;
} public void setGender(char gender) { this.gender = gender; } public boolean isActive() { return active; } public void setActive(boolean active) { this.active = active; } }
repos\tutorials-master\core-java-modules\core-java-reflection\src\main\java\com\baeldung\reflection\access\privatefields\Person.java
1
请完成以下Java代码
public class AuthorityRuleCorrectEntity implements RuleEntity { private Long id; private String app; private String ip; private Integer port; private String limitApp; private String resource; private Date gmtCreate; private Date gmtModified; private int strategy; @Override public Long getId() { return id; } @Override public void setId(Long id) { this.id = id; } @Override public String getApp() { return app; } public void setApp(String app) { this.app = app; } @Override public String getIp() { return ip; } public void setIp(String ip) { this.ip = ip; } @Override public Integer getPort() { return port; } public void setPort(Integer port) { this.port = port; }
public String getLimitApp() { return limitApp; } public void setLimitApp(String limitApp) { this.limitApp = limitApp; } public String getResource() { return resource; } public void setResource(String resource) { this.resource = resource; } @Override public Date getGmtCreate() { return gmtCreate; } public void setGmtCreate(Date gmtCreate) { this.gmtCreate = gmtCreate; } public Date getGmtModified() { return gmtModified; } public void setGmtModified(Date gmtModified) { this.gmtModified = gmtModified; } public int getStrategy() { return strategy; } public void setStrategy(int strategy) { this.strategy = strategy; } @Override public Rule toRule(){ AuthorityRule rule=new AuthorityRule(); return rule; } }
repos\JeecgBoot-main\jeecg-boot\jeecg-server-cloud\jeecg-visual\jeecg-cloud-sentinel\src\main\java\com\alibaba\csp\sentinel\dashboard\rule\nacos\entity\AuthorityRuleCorrectEntity.java
1
请完成以下Java代码
private static Point getEllipseIntersection(Shape shape, Line2D.Double line) { double angle = Math.atan2(line.y2 - line.y1, line.x2 - line.x1); double x = (shape.getBounds2D().getWidth() / 2) * Math.cos(angle) + shape.getBounds2D().getCenterX(); double y = (shape.getBounds2D().getHeight() / 2) * Math.sin(angle) + shape.getBounds2D().getCenterY(); Point p = new Point(); p.setLocation(x, y); return p; } /** * This method calculates shape intersection with line. * @param shape * @param line * @return Intersection point */ private static Point getShapeIntersection(Shape shape, Line2D.Double line) { PathIterator it = shape.getPathIterator(null); double[] coords = new double[6]; double[] pos = new double[2]; Line2D.Double l = new Line2D.Double(); while (!it.isDone()) { int type = it.currentSegment(coords); switch (type) { case PathIterator.SEG_MOVETO: pos[0] = coords[0]; pos[1] = coords[1]; break; case PathIterator.SEG_LINETO: l = new Line2D.Double(pos[0], pos[1], coords[0], coords[1]); if (line.intersectsLine(l)) { return getLinesIntersection(line, l); } pos[0] = coords[0]; pos[1] = coords[1]; break; case PathIterator.SEG_CLOSE: break; default: // whatever } it.next(); }
return null; } /** * This method calculates intersections of two lines. * @param a Line 1 * @param b Line 2 * @return Intersection point */ private static Point getLinesIntersection(Line2D a, Line2D b) { double d = (a.getX1() - a.getX2()) * (b.getY2() - b.getY1()) - (a.getY1() - a.getY2()) * (b.getX2() - b.getX1()); double da = (a.getX1() - b.getX1()) * (b.getY2() - b.getY1()) - (a.getY1() - b.getY1()) * (b.getX2() - b.getX1()); double ta = da / d; Point p = new Point(); p.setLocation(a.getX1() + ta * (a.getX2() - a.getX1()), a.getY1() + ta * (a.getY2() - a.getY1())); return p; } }
repos\Activiti-develop\activiti-core\activiti-image-generator\src\main\java\org\activiti\image\impl\DefaultProcessDiagramCanvas.java
1
请完成以下Java代码
public static class FormPart { protected String fieldName; protected String contentType; protected String textContent; protected String fileName; protected byte[] binaryContent; public FormPart(FileItemStream stream) { fieldName = stream.getFieldName(); contentType = stream.getContentType(); binaryContent = readBinaryContent(stream); fileName = stream.getName(); if(contentType == null || contentType.contains(MediaType.TEXT_PLAIN)) { textContent = new String(binaryContent, StandardCharsets.UTF_8); } } public FormPart() { } protected byte[] readBinaryContent(FileItemStream stream) { InputStream inputStream = getInputStream(stream); return IoUtil.readInputStream(inputStream, stream.getFieldName()); } protected InputStream getInputStream(FileItemStream stream) { try { return stream.openStream(); } catch (IOException e) { throw new RestException(Status.INTERNAL_SERVER_ERROR, e); } } public String getFieldName() { return fieldName;
} public String getContentType() { return contentType; } public String getTextContent() { return textContent; } public byte[] getBinaryContent() { return binaryContent; } public String getFileName() { return fileName; } } }
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\mapper\MultipartFormData.java
1
请完成以下Java代码
protected void cdiConfig(CamundaEngineRecorder recorder, BeanContainerBuildItem beanContainer) { recorder.configureProcessEngineCdiBeans(beanContainer.getValue()); } @Consume(AdditionalBeanBuildItem.class) @BuildStep @Record(RUNTIME_INIT) protected void processEngineConfiguration(CamundaEngineRecorder recorder, BeanContainerBuildItem beanContainerBuildItem, CamundaEngineConfig camundaEngineConfig, BuildProducer<ProcessEngineConfigurationBuildItem> configurationProducer) { BeanContainer beanContainer = beanContainerBuildItem.getValue(); recorder.configureProcessEngineCdiBeans(beanContainer); RuntimeValue<ProcessEngineConfigurationImpl> processEngineConfiguration = recorder.createProcessEngineConfiguration(beanContainer, camundaEngineConfig); configurationProducer.produce(new ProcessEngineConfigurationBuildItem(processEngineConfiguration)); } @BuildStep @Record(RUNTIME_INIT) protected void processEngine(CamundaEngineRecorder recorder, ProcessEngineConfigurationBuildItem processEngineConfigurationBuildItem, BuildProducer<ProcessEngineBuildItem> processEngineProducer) { RuntimeValue<ProcessEngineConfigurationImpl> processEngineConfiguration = processEngineConfigurationBuildItem.getProcessEngineConfiguration(); processEngineProducer.produce(new ProcessEngineBuildItem( recorder.createProcessEngine(processEngineConfiguration)));
} @Consume(ProcessEngineBuildItem.class) @BuildStep @Record(RUNTIME_INIT) protected void deployProcessEngineResources(CamundaEngineRecorder recorder) { recorder.fireCamundaEngineStartEvent(); } @BuildStep @Record(RUNTIME_INIT) protected void shutdown(CamundaEngineRecorder recorder, ProcessEngineBuildItem processEngine, ShutdownContextBuildItem shutdownContext) { recorder.registerShutdownTask(shutdownContext, processEngine.getProcessEngine()); } }
repos\camunda-bpm-platform-master\quarkus-extension\engine\deployment\src\main\java\org\camunda\bpm\quarkus\engine\extension\deployment\impl\CamundaEngineProcessor.java
1
请完成以下Java代码
public void setMSV3_BestellungAntwort(de.metas.vertical.pharma.vendor.gateway.msv3.model.I_MSV3_BestellungAntwort MSV3_BestellungAntwort) { set_ValueFromPO(COLUMNNAME_MSV3_BestellungAntwort_ID, de.metas.vertical.pharma.vendor.gateway.msv3.model.I_MSV3_BestellungAntwort.class, MSV3_BestellungAntwort); } /** Set MSV3_BestellungAntwort. @param MSV3_BestellungAntwort_ID MSV3_BestellungAntwort */ @Override public void setMSV3_BestellungAntwort_ID (int MSV3_BestellungAntwort_ID) { if (MSV3_BestellungAntwort_ID < 1) set_Value (COLUMNNAME_MSV3_BestellungAntwort_ID, null); else set_Value (COLUMNNAME_MSV3_BestellungAntwort_ID, Integer.valueOf(MSV3_BestellungAntwort_ID)); } /** Get MSV3_BestellungAntwort. @return MSV3_BestellungAntwort */ @Override public int getMSV3_BestellungAntwort_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_MSV3_BestellungAntwort_ID); if (ii == null) return 0; return ii.intValue(); } @Override public de.metas.vertical.pharma.vendor.gateway.msv3.model.I_MSV3_FaultInfo getMSV3_FaultInfo() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_MSV3_FaultInfo_ID, de.metas.vertical.pharma.vendor.gateway.msv3.model.I_MSV3_FaultInfo.class); } @Override public void setMSV3_FaultInfo(de.metas.vertical.pharma.vendor.gateway.msv3.model.I_MSV3_FaultInfo MSV3_FaultInfo) {
set_ValueFromPO(COLUMNNAME_MSV3_FaultInfo_ID, de.metas.vertical.pharma.vendor.gateway.msv3.model.I_MSV3_FaultInfo.class, MSV3_FaultInfo); } /** Set MSV3_FaultInfo. @param MSV3_FaultInfo_ID MSV3_FaultInfo */ @Override public void setMSV3_FaultInfo_ID (int MSV3_FaultInfo_ID) { if (MSV3_FaultInfo_ID < 1) set_Value (COLUMNNAME_MSV3_FaultInfo_ID, null); else set_Value (COLUMNNAME_MSV3_FaultInfo_ID, Integer.valueOf(MSV3_FaultInfo_ID)); } /** Get MSV3_FaultInfo. @return MSV3_FaultInfo */ @Override public int getMSV3_FaultInfo_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_MSV3_FaultInfo_ID); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.vendor.gateway.msv3\src\main\java-gen\de\metas\vertical\pharma\vendor\gateway\msv3\model\X_MSV3_Bestellung_Transaction.java
1
请完成以下Java代码
public void setM_Material_Tracking_Report_Line_ID (int M_Material_Tracking_Report_Line_ID) { if (M_Material_Tracking_Report_Line_ID < 1) set_ValueNoCheck (COLUMNNAME_M_Material_Tracking_Report_Line_ID, null); else set_ValueNoCheck (COLUMNNAME_M_Material_Tracking_Report_Line_ID, Integer.valueOf(M_Material_Tracking_Report_Line_ID)); } /** Get M_Material_Tracking_Report_Line. @return M_Material_Tracking_Report_Line */ @Override public int getM_Material_Tracking_Report_Line_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_Material_Tracking_Report_Line_ID); if (ii == null) return 0; return ii.intValue(); } @Override public org.compiere.model.I_M_Product getM_Product() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_M_Product_ID, org.compiere.model.I_M_Product.class); } @Override public void setM_Product(org.compiere.model.I_M_Product M_Product) { set_ValueFromPO(COLUMNNAME_M_Product_ID, org.compiere.model.I_M_Product.class, M_Product); } /** Set Produkt. @param M_Product_ID Produkt, Leistung, Artikel */ @Override public void setM_Product_ID (int M_Product_ID) { if (M_Product_ID < 1) set_Value (COLUMNNAME_M_Product_ID, null); else set_Value (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID)); } /** Get Produkt. @return Produkt, Leistung, Artikel */ @Override public int getM_Product_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID); if (ii == null)
return 0; return ii.intValue(); } /** Set Ausgelagerte Menge. @param QtyIssued Ausgelagerte Menge */ @Override public void setQtyIssued (java.math.BigDecimal QtyIssued) { set_Value (COLUMNNAME_QtyIssued, QtyIssued); } /** Get Ausgelagerte Menge. @return Ausgelagerte Menge */ @Override public java.math.BigDecimal getQtyIssued () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyIssued); if (bd == null) return Env.ZERO; return bd; } /** Set Empfangene Menge. @param QtyReceived Empfangene Menge */ @Override public void setQtyReceived (java.math.BigDecimal QtyReceived) { set_Value (COLUMNNAME_QtyReceived, QtyReceived); } /** Get Empfangene Menge. @return Empfangene Menge */ @Override public java.math.BigDecimal getQtyReceived () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyReceived); if (bd == null) return Env.ZERO; return bd; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java-gen\de\metas\materialtracking\ch\lagerkonf\model\X_M_Material_Tracking_Report_Line.java
1
请在Spring Boot框架中完成以下Java代码
BeanMetadataElement getIntrospector(Element element) { String introspectorRef = element.getAttribute(INTROSPECTOR_REF); if (StringUtils.hasLength(introspectorRef)) { return new RuntimeBeanReference(introspectorRef); } String introspectionUri = element.getAttribute(INTROSPECTION_URI); String clientId = element.getAttribute(CLIENT_ID); String clientSecret = element.getAttribute(CLIENT_SECRET); BeanDefinitionBuilder introspectorBuilder = BeanDefinitionBuilder .rootBeanDefinition(SpringOpaqueTokenIntrospector.class); introspectorBuilder.addConstructorArgValue(introspectionUri); introspectorBuilder.addConstructorArgValue(clientId); introspectorBuilder.addConstructorArgValue(clientSecret); return introspectorBuilder.getBeanDefinition(); } } static final class StaticAuthenticationManagerResolver implements AuthenticationManagerResolver<HttpServletRequest> { private final AuthenticationManager authenticationManager; StaticAuthenticationManagerResolver(AuthenticationManager authenticationManager) { this.authenticationManager = authenticationManager; } @Override public AuthenticationManager resolve(HttpServletRequest context) { return this.authenticationManager; } } static final class NimbusJwtDecoderJwkSetUriFactoryBean implements FactoryBean<JwtDecoder> { private final String jwkSetUri; NimbusJwtDecoderJwkSetUriFactoryBean(String jwkSetUri) { this.jwkSetUri = jwkSetUri; } @Override public JwtDecoder getObject() { return NimbusJwtDecoder.withJwkSetUri(this.jwkSetUri).build(); } @Override public Class<?> getObjectType() { return JwtDecoder.class; } } static final class BearerTokenRequestMatcher implements RequestMatcher { private final BearerTokenResolver bearerTokenResolver; BearerTokenRequestMatcher(BearerTokenResolver bearerTokenResolver) { Assert.notNull(bearerTokenResolver, "bearerTokenResolver cannot be null"); this.bearerTokenResolver = bearerTokenResolver; } @Override public boolean matches(HttpServletRequest request) { try { return this.bearerTokenResolver.resolve(request) != null; } catch (OAuth2AuthenticationException ex) {
return false; } } } static final class BearerTokenAuthenticationRequestMatcher implements RequestMatcher { private final AuthenticationConverter authenticationConverter; BearerTokenAuthenticationRequestMatcher() { this.authenticationConverter = new BearerTokenAuthenticationConverter(); } BearerTokenAuthenticationRequestMatcher(AuthenticationConverter authenticationConverter) { Assert.notNull(authenticationConverter, "authenticationConverter cannot be null"); this.authenticationConverter = authenticationConverter; } @Override public boolean matches(HttpServletRequest request) { try { return this.authenticationConverter.convert(request) != null; } catch (OAuth2AuthenticationException ex) { return false; } } } }
repos\spring-security-main\config\src\main\java\org\springframework\security\config\http\OAuth2ResourceServerBeanDefinitionParser.java
2
请在Spring Boot框架中完成以下Java代码
public Message create(Message message) { System.out.println("message===="+message.toString()); message = this.messageRepository.save(message); return message; } @ApiOperation( value = "修改消息", notes = "根据参数修改消息" ) @PutMapping(value = "message") @ApiResponses({ @ApiResponse(code = 100, message = "请求参数有误"), @ApiResponse(code = 101, message = "未授权"), @ApiResponse(code = 103, message = "禁止访问"), @ApiResponse(code = 104, message = "请求路径不存在"), @ApiResponse(code = 200, message = "服务器内部错误") }) public Message modify(Message message) { Message messageResult=this.messageRepository.update(message); return messageResult; } @PatchMapping(value="/message/text")
public BaseResult<Message> patch(Message message) { Message messageResult=this.messageRepository.updateText(message); return BaseResult.successWithData(messageResult); } @GetMapping(value = "message/{id}") public Message get(@PathVariable Long id) { Message message = this.messageRepository.findMessage(id); return message; } @DeleteMapping(value = "message/{id}") public void delete(@PathVariable("id") Long id) { this.messageRepository.deleteMessage(id); } }
repos\spring-boot-leaning-master\2.x_42_courses\第 2-9 课:Spring Boot 中使用 Swagger2 构建 RESTful APIs\spring-boot-swagger\src\main\java\com\neo\controller\MessageController.java
2
请在Spring Boot框架中完成以下Java代码
public @Nullable String determinePassword() { if (StringUtils.hasText(this.password)) { return this.password; } if (EmbeddedDatabaseConnection.isEmbedded(findDriverClassName(), determineUrl())) { return ""; } return null; } public @Nullable String getJndiName() { return this.jndiName; } /** * Allows the DataSource to be managed by the container and obtained through JNDI. The * {@code URL}, {@code driverClassName}, {@code username} and {@code password} fields * will be ignored when using JNDI lookups. * @param jndiName the JNDI name */ public void setJndiName(@Nullable String jndiName) { this.jndiName = jndiName; } public EmbeddedDatabaseConnection getEmbeddedDatabaseConnection() { return this.embeddedDatabaseConnection; } public void setEmbeddedDatabaseConnection(EmbeddedDatabaseConnection embeddedDatabaseConnection) { this.embeddedDatabaseConnection = embeddedDatabaseConnection; } public ClassLoader getClassLoader() { return this.classLoader; } public Xa getXa() { return this.xa; } public void setXa(Xa xa) { this.xa = xa; } /** * XA Specific datasource settings. */ public static class Xa { /** * XA datasource fully qualified name. */ private @Nullable String dataSourceClassName; /** * Properties to pass to the XA data source. */ private Map<String, String> properties = new LinkedHashMap<>(); public @Nullable String getDataSourceClassName() { return this.dataSourceClassName; } public void setDataSourceClassName(@Nullable String dataSourceClassName) { this.dataSourceClassName = dataSourceClassName;
} public Map<String, String> getProperties() { return this.properties; } public void setProperties(Map<String, String> properties) { this.properties = properties; } } static class DataSourceBeanCreationException extends BeanCreationException { private final DataSourceProperties properties; private final EmbeddedDatabaseConnection connection; DataSourceBeanCreationException(String message, DataSourceProperties properties, EmbeddedDatabaseConnection connection) { super(message); this.properties = properties; this.connection = connection; } DataSourceProperties getProperties() { return this.properties; } EmbeddedDatabaseConnection getConnection() { return this.connection; } } }
repos\spring-boot-4.0.1\module\spring-boot-jdbc\src\main\java\org\springframework\boot\jdbc\autoconfigure\DataSourceProperties.java
2
请完成以下Java代码
public Integer getLevel() { return level; } public void setLevel(Integer level) { this.level = level; } 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
请在Spring Boot框架中完成以下Java代码
public class ConditionRestServiceImpl extends AbstractRestProcessEngineAware implements ConditionRestService { public ConditionRestServiceImpl(String engineName, ObjectMapper objectMapper) { super(engineName, objectMapper); } @Override public List<ProcessInstanceDto> evaluateCondition(EvaluationConditionDto conditionDto) { if (conditionDto.getTenantId() != null && conditionDto.isWithoutTenantId()) { throw new InvalidRequestException(Status.BAD_REQUEST, "Parameter 'tenantId' cannot be used together with parameter 'withoutTenantId'."); } ConditionEvaluationBuilder builder = createConditionEvaluationBuilder(conditionDto); List<ProcessInstance> processInstances = builder.evaluateStartConditions(); List<ProcessInstanceDto> result = new ArrayList<>(); for (ProcessInstance processInstance : processInstances) { result.add(ProcessInstanceDto.fromProcessInstance(processInstance)); } return result; } protected ConditionEvaluationBuilder createConditionEvaluationBuilder(EvaluationConditionDto conditionDto) { RuntimeService runtimeService = getProcessEngine().getRuntimeService(); ObjectMapper objectMapper = getObjectMapper(); VariableMap variables = VariableValueDto.toMap(conditionDto.getVariables(), getProcessEngine(), objectMapper);
ConditionEvaluationBuilder builder = runtimeService.createConditionEvaluation(); if (variables != null && !variables.isEmpty()) { builder.setVariables(variables); } if (conditionDto.getBusinessKey() != null) { builder.processInstanceBusinessKey(conditionDto.getBusinessKey()); } if (conditionDto.getProcessDefinitionId() != null) { builder.processDefinitionId(conditionDto.getProcessDefinitionId()); } if (conditionDto.getTenantId() != null) { builder.tenantId(conditionDto.getTenantId()); } else if (conditionDto.isWithoutTenantId()) { builder.withoutTenantId(); } return builder; } }
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\impl\ConditionRestServiceImpl.java
2
请在Spring Boot框架中完成以下Java代码
public class ServerDeployController { private final ServerDeployService serverDeployService; @ApiOperation("导出服务器数据") @GetMapping(value = "/download") @PreAuthorize("@el.check('serverDeploy:list')") public void exportServerDeploy(HttpServletResponse response, ServerDeployQueryCriteria criteria) throws IOException { serverDeployService.download(serverDeployService.queryAll(criteria), response); } @ApiOperation(value = "查询服务器") @GetMapping @PreAuthorize("@el.check('serverDeploy:list')") public ResponseEntity<PageResult<ServerDeployDto>> queryServerDeploy(ServerDeployQueryCriteria criteria, Pageable pageable){ return new ResponseEntity<>(serverDeployService.queryAll(criteria,pageable),HttpStatus.OK); } @Log("新增服务器") @ApiOperation(value = "新增服务器") @PostMapping @PreAuthorize("@el.check('serverDeploy:add')") public ResponseEntity<Object> createServerDeploy(@Validated @RequestBody ServerDeploy resources){ serverDeployService.create(resources); return new ResponseEntity<>(HttpStatus.CREATED); }
@Log("修改服务器") @ApiOperation(value = "修改服务器") @PutMapping @PreAuthorize("@el.check('serverDeploy:edit')") public ResponseEntity<Object> updateServerDeploy(@Validated @RequestBody ServerDeploy resources){ serverDeployService.update(resources); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @Log("删除服务器") @ApiOperation(value = "删除Server") @DeleteMapping @PreAuthorize("@el.check('serverDeploy:del')") public ResponseEntity<Object> deleteServerDeploy(@RequestBody Set<Long> ids){ serverDeployService.delete(ids); return new ResponseEntity<>(HttpStatus.OK); } @Log("测试连接服务器") @ApiOperation(value = "测试连接服务器") @PostMapping("/testConnect") @PreAuthorize("@el.check('serverDeploy:add')") public ResponseEntity<Object> testConnectServerDeploy(@Validated @RequestBody ServerDeploy resources){ return new ResponseEntity<>(serverDeployService.testConnect(resources),HttpStatus.CREATED); } }
repos\eladmin-master\eladmin-system\src\main\java\me\zhengjie\modules\maint\rest\ServerDeployController.java
2
请完成以下Java代码
protected Integer provideCodeBySupplier(Supplier<Integer> builtinSupplier, Supplier<Integer> customSupplier, int initialCode) { boolean assignedByDelegationCode = initialCode != BuiltinExceptionCode.FALLBACK.getCode(); boolean builtinProviderConfigured = builtinExceptionCodeProvider != null; if (builtinProviderConfigured) { Integer providedCode = builtinSupplier.get(); if (providedCode != null) { if (assignedByDelegationCode) { LOG.warnResetToBuiltinCode(providedCode, initialCode); } return providedCode; } } boolean customProviderConfigured = customExceptionCodeProvider != null; if (customProviderConfigured && !assignedByDelegationCode) { Integer providedCode = customSupplier.get(); if (providedCode != null && builtinProviderConfigured) { return tryResetReservedCode(providedCode); } else { return providedCode; } } else if (builtinProviderConfigured) { return tryResetReservedCode(initialCode); } return null; } protected Integer provideCode(ProcessEngineException pex, int initialCode) { SQLException sqlException = ExceptionUtil.unwrapException(pex); Supplier<Integer> builtinSupplier = null; Supplier<Integer> customSupplier = null; if (sqlException != null) { builtinSupplier = () -> builtinExceptionCodeProvider.provideCode(sqlException); customSupplier = () -> customExceptionCodeProvider.provideCode(sqlException);
} else { builtinSupplier = () -> builtinExceptionCodeProvider.provideCode(pex); customSupplier = () -> customExceptionCodeProvider.provideCode(pex); } return provideCodeBySupplier(builtinSupplier, customSupplier, initialCode); } /** * Resets codes to the {@link BuiltinExceptionCode#FALLBACK} * in case they are < {@link #MIN_CUSTOM_CODE} or > {@link #MAX_CUSTOM_CODE}. * No log is written when code is {@link BuiltinExceptionCode#FALLBACK}. */ protected Integer tryResetReservedCode(Integer code) { if (codeReserved(code)) { LOG.warnReservedErrorCode(code); return BuiltinExceptionCode.FALLBACK.getCode(); } else { return code; } } protected boolean codeReserved(Integer code) { return code != null && code != BuiltinExceptionCode.FALLBACK.getCode() && (code < MIN_CUSTOM_CODE || code > MAX_CUSTOM_CODE); } protected void assignCodeToException(ProcessEngineException pex) { int initialCode = pex.getCode(); Integer providedCode = provideCode(pex, initialCode); if (providedCode != null) { pex.setCode(providedCode); } } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\interceptor\ExceptionCodeInterceptor.java
1
请完成以下Java代码
public class KafkaRecordReceiverContext extends ReceiverContext<ConsumerRecord<?, ?>> { private final String listenerId; private final @Nullable String clientId; private final @Nullable String groupId; private final ConsumerRecord<?, ?> record; /** * Construct a kafka record receiver context. * @param record the consumer record. * @param listenerId the container listener id. * @param clusterId the kafka cluster id. */ public KafkaRecordReceiverContext(ConsumerRecord<?, ?> record, String listenerId, Supplier<String> clusterId) { this(record, listenerId, null, null, clusterId); } /** * Construct a kafka record receiver context. * @param record the consumer record. * @param listenerId the container listener id. * @param clientId the kafka client id. * @param groupId the consumer group id. * @param clusterId the kafka cluster id. * @since 3.2 */ @SuppressWarnings("this-escape") public KafkaRecordReceiverContext(ConsumerRecord<?, ?> record, String listenerId, @Nullable String clientId, @Nullable String groupId, Supplier<String> clusterId) { super((carrier, key) -> { Header header = carrier.headers().lastHeader(key); if (header == null || header.value() == null) { return null; } return new String(header.value(), StandardCharsets.UTF_8); }); setCarrier(record); this.record = record; this.listenerId = listenerId; this.clientId = clientId; this.groupId = groupId; String cluster = clusterId.get(); setRemoteServiceName("Apache Kafka" + (cluster != null ? ": " + cluster : "")); } /** * Return the listener id. * @return the listener id. */ public String getListenerId() { return this.listenerId; } /** * Return the consumer group id. * @return the consumer group id. * @since 3.2 */ public @Nullable String getGroupId() { return this.groupId;
} /** * Return the client id. * @return the client id. * @since 3.2 */ @Nullable public String getClientId() { return this.clientId; } /** * Return the source topic. * @return the source. */ public String getSource() { return this.record.topic(); } /** * Return the consumer record. * @return the record. * @since 3.0.6 */ public ConsumerRecord<?, ?> getRecord() { return this.record; } /** * Return the partition. * @return the partition. * @since 3.2 */ public String getPartition() { return Integer.toString(this.record.partition()); } /** * Return the offset. * @return the offset. * @since 3.2 */ public String getOffset() { return Long.toString(this.record.offset()); } }
repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\support\micrometer\KafkaRecordReceiverContext.java
1
请在Spring Boot框架中完成以下Java代码
public class HistoricCaseActivityInstanceRestServiceImpl implements HistoricCaseActivityInstanceRestService { protected ProcessEngine processEngine; protected ObjectMapper objectMapper; public HistoricCaseActivityInstanceRestServiceImpl(ObjectMapper objectMapper, ProcessEngine processEngine) { this.objectMapper = objectMapper; this.processEngine = processEngine; } @Override public HistoricCaseActivityInstanceResource getHistoricCaseInstance(String caseActivityInstanceId) { return new HistoricCaseActivityInstanceResourceImpl(processEngine, caseActivityInstanceId); } @Override public List<HistoricCaseActivityInstanceDto> getHistoricCaseActivityInstances(UriInfo uriInfo, Integer firstResult, Integer maxResults) { HistoricCaseActivityInstanceQueryDto queryHistoricCaseActivityInstanceDto = new HistoricCaseActivityInstanceQueryDto(objectMapper, uriInfo.getQueryParameters()); return queryHistoricCaseActivityInstances(queryHistoricCaseActivityInstanceDto, firstResult, maxResults); } public List<HistoricCaseActivityInstanceDto> queryHistoricCaseActivityInstances(HistoricCaseActivityInstanceQueryDto queryDto, Integer firstResult, Integer maxResults) { HistoricCaseActivityInstanceQuery query = queryDto.toQuery(processEngine); List<HistoricCaseActivityInstance> matchingHistoricCaseActivityInstances = QueryUtil.list(query, firstResult, maxResults); List<HistoricCaseActivityInstanceDto> historicCaseActivityInstanceResults = new ArrayList<HistoricCaseActivityInstanceDto>(); for (HistoricCaseActivityInstance historicCaseActivityInstance : matchingHistoricCaseActivityInstances) { HistoricCaseActivityInstanceDto resultHistoricCaseActivityInstance = HistoricCaseActivityInstanceDto.fromHistoricCaseActivityInstance(historicCaseActivityInstance); historicCaseActivityInstanceResults.add(resultHistoricCaseActivityInstance); } return historicCaseActivityInstanceResults; }
@Override public CountResultDto getHistoricCaseActivityInstancesCount(UriInfo uriInfo) { HistoricCaseActivityInstanceQueryDto queryDto = new HistoricCaseActivityInstanceQueryDto(objectMapper, uriInfo.getQueryParameters()); return queryHistoricCaseActivityInstancesCount(queryDto); } public CountResultDto queryHistoricCaseActivityInstancesCount(HistoricCaseActivityInstanceQueryDto queryDto) { HistoricCaseActivityInstanceQuery query = queryDto.toQuery(processEngine); long count = query.count(); return new CountResultDto(count); } }
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\impl\history\HistoricCaseActivityInstanceRestServiceImpl.java
2
请在Spring Boot框架中完成以下Java代码
public PrintOptions getPrintOptions() { return printOptions; } /** * Sets the value of the printOptions property. * * @param value * allowed object is * {@link PrintOptions } * */ public void setPrintOptions(PrintOptions value) { this.printOptions = value; } /** * Gets the value of the order property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the order property. * * <p> * For example, to add a new item, do as follows: * <pre>
* getOrder().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link ShipmentServiceData } * * */ public List<ShipmentServiceData> getOrder() { if (order == null) { order = new ArrayList<ShipmentServiceData>(); } return this.order; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.dpd\src\main\java-xjc\com\dpd\common\service\types\shipmentservice\_3\StoreOrders.java
2
请完成以下Java代码
public final Doc<?> getOrNull( @NonNull final AcctDocRequiredServicesFacade services, @NonNull final List<AcctSchema> acctSchemas, @NonNull final TableRecordReference documentRef) { final String tableName = documentRef.getTableName(); final AcctDocFactory docFactory = docFactoriesByTableName.get(tableName); if (docFactory == null) { return null; } return docFactory.createAcctDoc(AcctDocContext.builder() .services(services) .acctSchemas(acctSchemas) .documentModel(retrieveDocumentModel(documentRef)) .build()); } private AcctDocModel retrieveDocumentModel(final TableRecordReference documentRef) {
final PO po = TableModelLoader.instance.getPO( Env.getCtx(), documentRef.getTableName(), documentRef.getRecord_ID(), ITrx.TRXNAME_ThreadInherited); if (po == null) { throw new AdempiereException("No document found for " + documentRef); } return new POAcctDocModel(po); } @FunctionalInterface protected interface AcctDocFactory { Doc<?> createAcctDoc(AcctDocContext ctx); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\doc\AcctDocProviderTemplate.java
1
请在Spring Boot框架中完成以下Java代码
public String getPhone() { return phone; } /** * Sets the value of the phone property. * * @param value * allowed object is * {@link String } * */ public void setPhone(String value) { this.phone = value; } /** * Deprecated. Please supply the email address in Contact/Email. * * @return * possible object is * {@link String } * */ public String getEmail() { return email; } /** * Sets the value of the email property. * * @param value * allowed object is * {@link String } * */ public void setEmail(String value) { this.email = value; } /** * Global Location Number of the party. * * @return * possible object is * {@link String } * */ public String getGLN() { return gln; } /** * Sets the value of the gln property. * * @param value * allowed object is * {@link String } * */ public void setGLN(String value) { this.gln = value; } /** * Further contact details. * * @return
* possible object is * {@link ContactType } * */ public ContactType getContact() { return contact; } /** * Sets the value of the contact property. * * @param value * allowed object is * {@link ContactType } * */ public void setContact(ContactType value) { this.contact = value; } /** * Address details of the party. * * @return * possible object is * {@link AddressType } * */ public AddressType getAddress() { return address; } /** * Sets the value of the address property. * * @param value * allowed object is * {@link AddressType } * */ public void setAddress(AddressType value) { this.address = value; } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\BusinessEntityType.java
2
请完成以下Java代码
public void setC_ReferenceNo_Type_ID (int C_ReferenceNo_Type_ID) { if (C_ReferenceNo_Type_ID < 1) set_ValueNoCheck (COLUMNNAME_C_ReferenceNo_Type_ID, null); else set_ValueNoCheck (COLUMNNAME_C_ReferenceNo_Type_ID, Integer.valueOf(C_ReferenceNo_Type_ID)); } /** Get Reference No Type. @return Reference No Type */ @Override public int getC_ReferenceNo_Type_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_C_ReferenceNo_Type_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Java-Klasse. @param Classname Java-Klasse */ @Override public void setClassname (java.lang.String Classname) { set_Value (COLUMNNAME_Classname, Classname); } /** Get Java-Klasse. @return Java-Klasse */ @Override public java.lang.String getClassname () { return (java.lang.String)get_Value(COLUMNNAME_Classname); } /** Set Beschreibung. @param Description Beschreibung */ @Override public void setDescription (java.lang.String Description) { set_Value (COLUMNNAME_Description, Description); } /** Get Beschreibung. @return Beschreibung */ @Override public java.lang.String getDescription () { return (java.lang.String)get_Value(COLUMNNAME_Description); } /** * EntityType AD_Reference_ID=389 * Reference name: _EntityTypeNew */ public static final int ENTITYTYPE_AD_Reference_ID=389; /** Set Entitäts-Art. @param EntityType Dictionary Entity Type; Determines ownership and synchronization */ @Override public void setEntityType (java.lang.String EntityType) { set_Value (COLUMNNAME_EntityType, EntityType); } /** Get Entitäts-Art. @return Dictionary Entity Type; Determines ownership and synchronization */ @Override public java.lang.String getEntityType () { return (java.lang.String)get_Value(COLUMNNAME_EntityType); } /** Set Name.
@param Name Alphanumeric identifier of the entity */ @Override public void setName (java.lang.String Name) { set_Value (COLUMNNAME_Name, Name); } /** Get Name. @return Alphanumeric identifier of the entity */ @Override public java.lang.String getName () { return (java.lang.String)get_Value(COLUMNNAME_Name); } /** Set Suchschlüssel. @param Value Suchschlüssel für den Eintrag im erforderlichen Format - muss eindeutig sein */ @Override public void setValue (java.lang.String Value) { set_Value (COLUMNNAME_Value, Value); } /** Get Suchschlüssel. @return Suchschlüssel für den Eintrag im erforderlichen Format - muss eindeutig sein */ @Override public java.lang.String getValue () { return (java.lang.String)get_Value(COLUMNNAME_Value); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.document.refid\src\main\java-gen\de\metas\document\refid\model\X_C_ReferenceNo_Type.java
1
请完成以下Java代码
public CompanyType getCompany() { return company; } /** * Sets the value of the company property. * * @param value * allowed object is * {@link CompanyType } * */ public void setCompany(CompanyType value) { this.company = value; } /** * Gets the value of the person property. * * @return * possible object is * {@link PersonType } * */
public PersonType getPerson() { return person; } /** * Sets the value of the person property. * * @param value * allowed object is * {@link PersonType } * */ public void setPerson(PersonType value) { this.person = value; } }
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_440_request\src\main\java-xjc\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_440\request\EsrAddressType.java
1
请完成以下Java代码
public void setSupplier_GTIN_CU (final @Nullable java.lang.String Supplier_GTIN_CU) { set_ValueNoCheck (COLUMNNAME_Supplier_GTIN_CU, Supplier_GTIN_CU); } @Override public java.lang.String getSupplier_GTIN_CU() { return get_ValueAsString(COLUMNNAME_Supplier_GTIN_CU); } @Override public void setTaxAmtInfo (final @Nullable BigDecimal TaxAmtInfo) { set_Value (COLUMNNAME_TaxAmtInfo, TaxAmtInfo); } @Override public BigDecimal getTaxAmtInfo() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_TaxAmtInfo); return bd != null ? bd : BigDecimal.ZERO; } @Override public void settaxfree (final boolean taxfree) { set_Value (COLUMNNAME_taxfree, taxfree); } @Override public boolean istaxfree() { return get_ValueAsBoolean(COLUMNNAME_taxfree); } @Override public void setUPC_CU (final @Nullable java.lang.String UPC_CU)
{ set_ValueNoCheck (COLUMNNAME_UPC_CU, UPC_CU); } @Override public java.lang.String getUPC_CU() { return get_ValueAsString(COLUMNNAME_UPC_CU); } @Override public void setUPC_TU (final @Nullable java.lang.String UPC_TU) { set_ValueNoCheck (COLUMNNAME_UPC_TU, UPC_TU); } @Override public java.lang.String getUPC_TU() { return get_ValueAsString(COLUMNNAME_UPC_TU); } @Override public void setValue (final @Nullable java.lang.String Value) { set_Value (COLUMNNAME_Value, Value); } @Override public java.lang.String getValue() { return get_ValueAsString(COLUMNNAME_Value); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.edi\src\main\java-gen\de\metas\esb\edi\model\X_EDI_cctop_invoic_500_v.java
1
请完成以下Java代码
public java.lang.String getFrequency () { return (java.lang.String)get_Value(COLUMNNAME_Frequency); } /** Set Repeat. @param IsRepeat Repeat */ @Override public void setIsRepeat (boolean IsRepeat) { set_Value (COLUMNNAME_IsRepeat, Boolean.valueOf(IsRepeat)); } /** Get Repeat. @return Repeat */ @Override public boolean isRepeat () { Object oo = get_Value(COLUMNNAME_IsRepeat); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false;
} /** Set Name. @param Name Alphanumeric identifier of the entity */ @Override public void setName (java.lang.String Name) { set_Value (COLUMNNAME_Name, Name); } /** Get Name. @return Alphanumeric identifier of the entity */ @Override public java.lang.String getName () { return (java.lang.String)get_Value(COLUMNNAME_Name); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_NonBusinessDay.java
1
请在Spring Boot框架中完成以下Java代码
class DocLine_Movement extends DocLine<Doc_Movement> { public DocLine_Movement(final I_M_MovementLine movementLine, final Doc_Movement doc) { super(InterfaceWrapperHelper.getPO(movementLine), doc); setQty(Quantity.of(movementLine.getMovementQty(), getProductStockingUOM()), false); setReversalLine_ID(movementLine.getReversalLine_ID()); } private OrgId getFromOrgId() { return Services.get(IWarehouseDAO.class).retrieveOrgIdByLocatorId(getM_Locator_ID()); } private OrgId getToOrgId() { return Services.get(IWarehouseDAO.class).retrieveOrgIdByLocatorId(getM_LocatorTo_ID()); } public final int getM_LocatorTo_ID() { final I_M_MovementLine movementLine = getModel(I_M_MovementLine.class); return movementLine.getM_LocatorTo_ID(); } @Value @Builder private static class MovementLineCostAmounts { AggregatedCostAmount outboundCosts; AggregatedCostAmount inboundCosts; } public final MoveCostsResult getCreateCosts(@NonNull final AcctSchema as) { if (isReversalLine()) { final AggregatedCostAmount outboundCosts = services.createReversalCostDetails( CostDetailReverseRequest.builder() .acctSchemaId(as.getId()) .reversalDocumentRef(CostingDocumentRef.ofOutboundMovementLineId(get_ID()))
.initialDocumentRef(CostingDocumentRef.ofOutboundMovementLineId(getReversalLine_ID())) .date(getDateAcctAsInstant()) .build()) .toAggregatedCostAmount(); final AggregatedCostAmount inboundCosts = services.createReversalCostDetails( CostDetailReverseRequest.builder() .acctSchemaId(as.getId()) .reversalDocumentRef(CostingDocumentRef.ofInboundMovementLineId(get_ID())) .initialDocumentRef(CostingDocumentRef.ofInboundMovementLineId(getReversalLine_ID())) .date(getDateAcctAsInstant()) .build()) .toAggregatedCostAmount(); return MoveCostsResult.builder() .outboundCosts(outboundCosts) .inboundCosts(inboundCosts) .build(); } else { return services.moveCosts(MoveCostsRequest.builder() .acctSchemaId(as.getId()) .clientId(getClientId()) .date(getDateAcctAsInstant()) // .costElement(null) // all cost elements .productId(getProductId()) .attributeSetInstanceId(getAttributeSetInstanceId()) .qtyToMove(getQty()) // .outboundOrgId(getFromOrgId()) .outboundDocumentRef(CostingDocumentRef.ofOutboundMovementLineId(get_ID())) // .inboundOrgId(getToOrgId()) .inboundDocumentRef(CostingDocumentRef.ofInboundMovementLineId(get_ID())) // .build()); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java-legacy\org\compiere\acct\DocLine_Movement.java
2
请完成以下Java代码
public class QuadristateButtonModel extends DefaultButtonModel { /** * */ private static final long serialVersionUID = -3876388376253061011L; public enum State { UNCHECKED, CHECKED, GREY_CHECKED, GREY_UNCHECKED } public QuadristateButtonModel() { super(); setState(State.UNCHECKED); } /** Filter: No one may change the armed status except us. */ @Override public void setArmed(boolean b) { } // public void setSelected(boolean b) { // if (b) { // setState(State.CHECKED); // } else { // setState(State.UNCHECKED); // } // } public void setState(State state) { switch (state) { case UNCHECKED: super.setArmed(false); setPressed(false); setSelected(false); break; case CHECKED: super.setArmed(false); setPressed(false); setSelected(true); break; case GREY_UNCHECKED: super.setArmed(true); setPressed(true); setSelected(false); break; case GREY_CHECKED: super.setArmed(true); setPressed(true);
setSelected(true); break; } } /** * The current state is embedded in the selection / armed state of the * model. We return the CHECKED state when the checkbox is selected but * not armed, GREY_CHECKED state when the checkbox is selected and armed * (grey) and UNCHECKED when the checkbox is deselected. */ public State getState() { if (isSelected() && !isArmed()) { // CHECKED return State.CHECKED; } else if (isSelected() && isArmed()) { // GREY_CHECKED return State.GREY_CHECKED; } else if (!isSelected() && isArmed()) { // GREY_UNCHECKED return State.GREY_UNCHECKED; } else { // (!isSelected() && !isArmed()){ // UNCHECKED return State.UNCHECKED; } } /** * We rotate between UNCHECKED, CHECKED, GREY_UNCHECKED, GREY_CHECKED. */ public void nextState() { switch (getState()) { case UNCHECKED: setState(State.CHECKED); break; case CHECKED: setState(State.GREY_UNCHECKED); break; case GREY_UNCHECKED: setState(State.GREY_CHECKED); break; case GREY_CHECKED: setState(State.UNCHECKED); break; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\it\cnr\imaa\essi\lablib\gui\checkboxtree\QuadristateButtonModel.java
1
请完成以下Java代码
public boolean isInSelection(final PInstanceId selectionId, final int id) { return getSelectionIds(selectionId).contains(id); } public Set<Integer> getSelectionIds(final PInstanceId selectionId) { final Set<Integer> selection = selectionId2selection.get(selectionId); return selection != null ? selection : ImmutableSet.of(); } public void dumpSelections() { StringBuilder sb = new StringBuilder(); sb.append("=====================[ SELECTIONS ]============================================================"); for (final PInstanceId selectionId : selectionId2selection.keySet()) { sb.append("\n\t").append(selectionId).append(": ").append(selectionId2selection.get(selectionId)); } sb.append("\n"); System.out.println(sb); }
/** * @return new database restore point. */ public POJOLookupMapRestorePoint createRestorePoint() { return new POJOLookupMapRestorePoint(this); } @Override public void addImportInterceptor(String importTableName, IImportInterceptor listener) { // nothing } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\wrapper\POJOLookupMap.java
1
请完成以下Java代码
public void onFailure(Throwable t) { log.info("removeLatest onFailure [{}][{}][{}]", entityId, query.getKey(), query, t); } }, MoreExecutors.directExecutor()); } return future; } @Override public ListenableFuture<Optional<TsKvEntry>> findLatestOpt(TenantId tenantId, EntityId entityId, String key) { log.trace("findLatestOpt"); return doFindLatest(tenantId, entityId, key); } @Override public ListenableFuture<TsKvEntry> findLatest(TenantId tenantId, EntityId entityId, String key) { return Futures.transform(doFindLatest(tenantId, entityId, key), x -> sqlDao.wrapNullTsKvEntry(key, x.orElse(null)), MoreExecutors.directExecutor()); } public ListenableFuture<Optional<TsKvEntry>> doFindLatest(TenantId tenantId, EntityId entityId, String key) { final TsLatestCacheKey cacheKey = new TsLatestCacheKey(entityId, key); ListenableFuture<TbCacheValueWrapper<TsKvEntry>> cacheFuture = cacheExecutorService.submit(() -> cache.get(cacheKey)); return Futures.transformAsync(cacheFuture, (cacheValueWrap) -> { if (cacheValueWrap != null) { final TsKvEntry tsKvEntry = cacheValueWrap.get(); log.debug("findLatest cache hit [{}][{}][{}]", entityId, key, tsKvEntry); return Futures.immediateFuture(Optional.ofNullable(tsKvEntry)); } log.debug("findLatest cache miss [{}][{}]", entityId, key); ListenableFuture<Optional<TsKvEntry>> daoFuture = sqlDao.findLatestOpt(tenantId, entityId, key); return Futures.transform(daoFuture, daoValue -> { cache.put(cacheKey, daoValue.orElse(null)); return daoValue; }, MoreExecutors.directExecutor());
}, MoreExecutors.directExecutor()); } @Override public ListenableFuture<List<TsKvEntry>> findAllLatest(TenantId tenantId, EntityId entityId) { return sqlDao.findAllLatest(tenantId, entityId); } @Override public List<String> findAllKeysByDeviceProfileId(TenantId tenantId, DeviceProfileId deviceProfileId) { return sqlDao.findAllKeysByDeviceProfileId(tenantId, deviceProfileId); } @Override public List<String> findAllKeysByEntityIds(TenantId tenantId, List<EntityId> entityIds) { return sqlDao.findAllKeysByEntityIds(tenantId, entityIds); } @Override public ListenableFuture<List<String>> findAllKeysByEntityIdsAsync(TenantId tenantId, List<EntityId> entityIds) { return sqlDao.findAllKeysByEntityIdsAsync(tenantId, entityIds); } }
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\sqlts\CachedRedisSqlTimeseriesLatestDao.java
1
请完成以下Java代码
protected POInfo initPO (Properties ctx) { POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName()); return poi; } public String toString() { StringBuffer sb = new StringBuffer ("X_C_Withholding_Acct[") .append(get_ID()).append("]"); return sb.toString(); } public I_C_AcctSchema getC_AcctSchema() throws RuntimeException { return (I_C_AcctSchema)MTable.get(getCtx(), I_C_AcctSchema.Table_Name) .getPO(getC_AcctSchema_ID(), get_TrxName()); } /** Set Accounting Schema. @param C_AcctSchema_ID Rules for accounting */ public void setC_AcctSchema_ID (int C_AcctSchema_ID) { if (C_AcctSchema_ID < 1) set_ValueNoCheck (COLUMNNAME_C_AcctSchema_ID, null); else set_ValueNoCheck (COLUMNNAME_C_AcctSchema_ID, Integer.valueOf(C_AcctSchema_ID)); } /** Get Accounting Schema. @return Rules for accounting */ public int getC_AcctSchema_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_C_AcctSchema_ID); if (ii == null) return 0; return ii.intValue(); } public I_C_Withholding getC_Withholding() throws RuntimeException { return (I_C_Withholding)MTable.get(getCtx(), I_C_Withholding.Table_Name) .getPO(getC_Withholding_ID(), get_TrxName()); } /** Set Withholding. @param C_Withholding_ID Withholding type defined */ public void setC_Withholding_ID (int C_Withholding_ID) { if (C_Withholding_ID < 1) set_ValueNoCheck (COLUMNNAME_C_Withholding_ID, null); else set_ValueNoCheck (COLUMNNAME_C_Withholding_ID, Integer.valueOf(C_Withholding_ID)); } /** Get Withholding. @return Withholding type defined */ public int getC_Withholding_ID ()
{ Integer ii = (Integer)get_Value(COLUMNNAME_C_Withholding_ID); if (ii == null) return 0; return ii.intValue(); } public I_C_ValidCombination getWithholding_A() throws RuntimeException { return (I_C_ValidCombination)MTable.get(getCtx(), I_C_ValidCombination.Table_Name) .getPO(getWithholding_Acct(), get_TrxName()); } /** Set Withholding. @param Withholding_Acct Account for Withholdings */ public void setWithholding_Acct (int Withholding_Acct) { set_Value (COLUMNNAME_Withholding_Acct, Integer.valueOf(Withholding_Acct)); } /** Get Withholding. @return Account for Withholdings */ public int getWithholding_Acct () { Integer ii = (Integer)get_Value(COLUMNNAME_Withholding_Acct); 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_C_Withholding_Acct.java
1
请完成以下Java代码
public void setC_Flatrate_Transition_ID (final int C_Flatrate_Transition_ID) { if (C_Flatrate_Transition_ID < 1) set_Value (COLUMNNAME_C_Flatrate_Transition_ID, null); else set_Value (COLUMNNAME_C_Flatrate_Transition_ID, C_Flatrate_Transition_ID); } @Override public int getC_Flatrate_Transition_ID() { return get_ValueAsInt(COLUMNNAME_C_Flatrate_Transition_ID); } @Override public void setM_PricingSystem_ID (final int M_PricingSystem_ID) { if (M_PricingSystem_ID < 1) set_Value (COLUMNNAME_M_PricingSystem_ID, null); else set_Value (COLUMNNAME_M_PricingSystem_ID, M_PricingSystem_ID); } @Override public int getM_PricingSystem_ID() { return get_ValueAsInt(COLUMNNAME_M_PricingSystem_ID); } @Override public void setM_Product_Category_Matching_ID (final int M_Product_Category_Matching_ID) { if (M_Product_Category_Matching_ID < 1) set_Value (COLUMNNAME_M_Product_Category_Matching_ID, null); else set_Value (COLUMNNAME_M_Product_Category_Matching_ID, M_Product_Category_Matching_ID); } @Override public int getM_Product_Category_Matching_ID() { return get_ValueAsInt(COLUMNNAME_M_Product_Category_Matching_ID); } @Override public void setM_Product_ID (final int M_Product_ID) { if (M_Product_ID < 1) set_Value (COLUMNNAME_M_Product_ID, null); else set_Value (COLUMNNAME_M_Product_ID, M_Product_ID); }
@Override public int getM_Product_ID() { return get_ValueAsInt(COLUMNNAME_M_Product_ID); } @Override public void setQtyPerDelivery (final BigDecimal QtyPerDelivery) { set_Value (COLUMNNAME_QtyPerDelivery, QtyPerDelivery); } @Override public BigDecimal getQtyPerDelivery() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyPerDelivery); 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_Matching.java
1
请完成以下Java代码
public String getCountInsertsIntoTargetTableString() { return counterToString(getCountInsertsIntoTargetTable()); } public String getCountUpdatesIntoTargetTableString() { return counterToString(getCountUpdatesIntoTargetTable()); } private static String counterToString(final OptionalInt counter) { return counter.isPresent() ? String.valueOf(counter.getAsInt()) : "N/A"; } public boolean hasErrors() {
return !getErrors().isEmpty(); } public int getCountErrors() { return getErrors().size(); } @Value @Builder public static class Error { @NonNull String message; @NonNull AdIssueId adIssueId; @Nullable transient Throwable exception; int affectedImportRecordsCount; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\impexp\ActualImportRecordsResult.java
1
请完成以下Java代码
public void recordPlanItemInstanceExit(PlanItemInstanceEntity planItemInstanceEntity) { for (CmmnHistoryManager historyManager : historyManagers) { historyManager.recordPlanItemInstanceExit(planItemInstanceEntity); } } @Override public void updateCaseDefinitionIdInHistory(CaseDefinition caseDefinition, CaseInstanceEntity caseInstance) { for (CmmnHistoryManager historyManager : historyManagers) { historyManager.updateCaseDefinitionIdInHistory(caseDefinition, caseInstance); } } @Override public void recordHistoricUserTaskLogEntry(HistoricTaskLogEntryBuilder taskLogEntryBuilder) {
for (CmmnHistoryManager historyManager : historyManagers) { historyManager.recordHistoricUserTaskLogEntry(taskLogEntryBuilder); } } @Override public void deleteHistoricUserTaskLogEntry(long logNumber) { for (CmmnHistoryManager historyManager : historyManagers) { historyManager.deleteHistoricUserTaskLogEntry(logNumber); } } public void addHistoryManager(CmmnHistoryManager historyManager) { historyManagers.add(historyManager); } }
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\history\CompositeCmmnHistoryManager.java
1
请完成以下Java代码
public void setProcessed (final boolean Processed) { set_Value (COLUMNNAME_Processed, Processed); } @Override public boolean isProcessed() { return get_ValueAsBoolean(COLUMNNAME_Processed); } @Override public void setProcessing (final boolean Processing) { set_Value (COLUMNNAME_Processing, Processing); } @Override public boolean isProcessing()
{ return get_ValueAsBoolean(COLUMNNAME_Processing); } @Override public void setValue (final @Nullable java.lang.String Value) { set_Value (COLUMNNAME_Value, Value); } @Override public java.lang.String getValue() { return get_ValueAsString(COLUMNNAME_Value); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_I_ElementValue.java
1
请完成以下Java代码
public SendResult syncSend(Integer id) throws ExecutionException, InterruptedException { // 创建 Demo07Message 消息 Demo07Message message = new Demo07Message(); message.setId(id); // 同步发送消息 return kafkaTemplate.send(Demo07Message.TOPIC, message).get(); } public String syncSendInTransaction(Integer id, Runnable runner) throws ExecutionException, InterruptedException { return kafkaTemplate.executeInTransaction(new KafkaOperations.OperationsCallback<Object, Object, String>() { @Override public String doInOperations(KafkaOperations<Object, Object> kafkaOperations) { // 创建 Demo07Message 消息 Demo07Message message = new Demo07Message(); message.setId(id); try { SendResult<Object, Object> sendResult = kafkaOperations.send(Demo07Message.TOPIC, message).get(); logger.info("[doInOperations][发送编号:[{}] 发送结果:[{}]]", id, sendResult);
} catch (Exception e) { throw new RuntimeException(e); } // 本地业务逻辑... biubiubiu runner.run(); // 返回结果 return "success"; } }); } }
repos\SpringBoot-Labs-master\lab-03-kafka\lab-03-kafka-demo-transaction\src\main\java\cn\iocoder\springboot\lab03\kafkademo\producer\Demo07Producer.java
1
请完成以下Java代码
public boolean contains(Object o) { return false; } @Override public Iterator<T> iterator() { return null; } @Override public Object[] toArray() { return new Object[0]; } @Override public <T1> T1[] toArray(T1[] a) { return null; } @Override public boolean add(T t) { return false; } @Override public boolean remove(Object o) { return false; } @Override public boolean containsAll(Collection<?> c) { return false; }
@Override public boolean addAll(Collection<? extends T> c) { return false; } @Override public boolean removeAll(Collection<?> c) { return false; } @Override public boolean retainAll(Collection<?> c) { return false; } @Override public void clear() { } }
repos\tutorials-master\core-java-modules\core-java-streams-5\src\main\java\com\baeldung\streams\parallelstream\MyBookContainer.java
1
请完成以下Java代码
public void save(final I_M_HU_Storage storage) { InterfaceWrapperHelper.save(storage); } @Override public List<I_M_HU_Storage> retrieveStorages(final I_M_HU hu) { final List<I_M_HU_Storage> huStorages = Services.get(IQueryBL.class) .createQueryBuilder(I_M_HU_Storage.class, hu) .filter(new EqualsQueryFilter<I_M_HU_Storage>(I_M_HU_Storage.COLUMNNAME_M_HU_ID, hu.getM_HU_ID())) .create() .setOnlyActiveRecords(true) .list(I_M_HU_Storage.class); // Optimization: set parent link for (final I_M_HU_Storage huStorage : huStorages) { huStorage.setM_HU(hu); } return huStorages; } @Override public I_M_HU_Item_Storage retrieveItemStorage(final I_M_HU_Item huItem, @NonNull final ProductId productId) { return Services.get(IQueryBL.class).createQueryBuilder(I_M_HU_Item_Storage.class, huItem) .filter(new EqualsQueryFilter<I_M_HU_Item_Storage>(I_M_HU_Item_Storage.COLUMNNAME_M_HU_Item_ID, huItem.getM_HU_Item_ID())) .filter(new EqualsQueryFilter<I_M_HU_Item_Storage>(I_M_HU_Item_Storage.COLUMNNAME_M_Product_ID, productId)) .create() .setOnlyActiveRecords(true) .firstOnly(I_M_HU_Item_Storage.class); } @Override public List<I_M_HU_Item_Storage> retrieveItemStorages(final I_M_HU_Item huItem) { final IQueryBuilder<I_M_HU_Item_Storage> queryBuilder = Services.get(IQueryBL.class) .createQueryBuilder(I_M_HU_Item_Storage.class, huItem) .filter(new EqualsQueryFilter<I_M_HU_Item_Storage>(I_M_HU_Item_Storage.COLUMNNAME_M_HU_Item_ID, huItem.getM_HU_Item_ID())); queryBuilder.orderBy() .addColumn(I_M_HU_Item_Storage.COLUMNNAME_M_HU_Item_Storage_ID); // predictive order final List<I_M_HU_Item_Storage> huItemStorages = queryBuilder .create() .setOnlyActiveRecords(true) .list(I_M_HU_Item_Storage.class);
// Optimization: set parent link for (final I_M_HU_Item_Storage huItemStorage : huItemStorages) { huItemStorage.setM_HU_Item(huItem); } return huItemStorages; } @Override public void save(final I_M_HU_Item_Storage storageLine) { InterfaceWrapperHelper.save(storageLine); } @Override public void save(final I_M_HU_Item item) { InterfaceWrapperHelper.save(item); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\storage\impl\HUStorageDAO.java
1
请在Spring Boot框架中完成以下Java代码
public @Nullable Map<String, String> getDefaultDimensions() { return this.defaultDimensions; } public void setDefaultDimensions(@Nullable Map<String, String> defaultDimensions) { this.defaultDimensions = defaultDimensions; } public boolean isEnrichWithDynatraceMetadata() { return this.enrichWithDynatraceMetadata; } public void setEnrichWithDynatraceMetadata(Boolean enrichWithDynatraceMetadata) { this.enrichWithDynatraceMetadata = enrichWithDynatraceMetadata; } public @Nullable String getMetricKeyPrefix() { return this.metricKeyPrefix; } public void setMetricKeyPrefix(@Nullable String metricKeyPrefix) { this.metricKeyPrefix = metricKeyPrefix; }
public boolean isUseDynatraceSummaryInstruments() { return this.useDynatraceSummaryInstruments; } public void setUseDynatraceSummaryInstruments(boolean useDynatraceSummaryInstruments) { this.useDynatraceSummaryInstruments = useDynatraceSummaryInstruments; } public boolean isExportMeterMetadata() { return this.exportMeterMetadata; } public void setExportMeterMetadata(boolean exportMeterMetadata) { this.exportMeterMetadata = exportMeterMetadata; } } }
repos\spring-boot-4.0.1\module\spring-boot-micrometer-metrics\src\main\java\org\springframework\boot\micrometer\metrics\autoconfigure\export\dynatrace\DynatraceProperties.java
2
请完成以下Java代码
protected org.compiere.model.POInfo initPO(Properties ctx) { return org.compiere.model.POInfo.getPOInfo(Table_Name); } @Override public org.compiere.model.I_AD_Tab getAD_Tab() { return get_ValueAsPO(COLUMNNAME_AD_Tab_ID, org.compiere.model.I_AD_Tab.class); } @Override public void setAD_Tab(org.compiere.model.I_AD_Tab AD_Tab) { set_ValueFromPO(COLUMNNAME_AD_Tab_ID, org.compiere.model.I_AD_Tab.class, AD_Tab); } @Override public void setAD_Tab_ID (int AD_Tab_ID) { if (AD_Tab_ID < 1) set_ValueNoCheck (COLUMNNAME_AD_Tab_ID, null); else set_ValueNoCheck (COLUMNNAME_AD_Tab_ID, Integer.valueOf(AD_Tab_ID)); } @Override public int getAD_Tab_ID() { return get_ValueAsInt(COLUMNNAME_AD_Tab_ID); } @Override public void setAD_UI_Section_ID (int AD_UI_Section_ID) { if (AD_UI_Section_ID < 1) set_ValueNoCheck (COLUMNNAME_AD_UI_Section_ID, null); else set_ValueNoCheck (COLUMNNAME_AD_UI_Section_ID, Integer.valueOf(AD_UI_Section_ID)); } @Override public int getAD_UI_Section_ID() { return get_ValueAsInt(COLUMNNAME_AD_UI_Section_ID); } @Override public void setDescription (java.lang.String Description) { set_Value (COLUMNNAME_Description, Description); } @Override public java.lang.String getDescription() { return (java.lang.String)get_Value(COLUMNNAME_Description); } @Override public void setHelp (java.lang.String Help) {
set_Value (COLUMNNAME_Help, Help); } @Override public java.lang.String getHelp() { return (java.lang.String)get_Value(COLUMNNAME_Help); } @Override public void setName (java.lang.String Name) { set_Value (COLUMNNAME_Name, Name); } @Override public java.lang.String getName() { return (java.lang.String)get_Value(COLUMNNAME_Name); } @Override public void setSeqNo (int SeqNo) { set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo)); } @Override public int getSeqNo() { return get_ValueAsInt(COLUMNNAME_SeqNo); } @Override public void setUIStyle (java.lang.String UIStyle) { set_Value (COLUMNNAME_UIStyle, UIStyle); } @Override public java.lang.String getUIStyle() { return (java.lang.String)get_Value(COLUMNNAME_UIStyle); } @Override public void setValue (java.lang.String Value) { set_Value (COLUMNNAME_Value, Value); } @Override public java.lang.String getValue() { return (java.lang.String)get_Value(COLUMNNAME_Value); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_UI_Section.java
1
请完成以下Java代码
public static ReturnResponse<Object> success(Object content) { return new ReturnResponse<>(SUCCESS_CODE, SUCCESS_MSG, content); } public boolean isSuccess(){ return SUCCESS_CODE == code; } public boolean isFailure(){ return !isSuccess(); } public int getCode() { return code; } public void setCode(int code) { this.code = code;
} public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public T getContent() { return content; } public void setContent(T content) { this.content = content; } }
repos\kkFileView-master\server\src\main\java\cn\keking\model\ReturnResponse.java
1
请完成以下Java代码
public int getC_Print_Package_ID() { return get_ValueAsInt(COLUMNNAME_C_Print_Package_ID); } @Override public void setPackageInfoCount (int PackageInfoCount) { throw new IllegalArgumentException ("PackageInfoCount is virtual column"); } @Override public int getPackageInfoCount() { return get_ValueAsInt(COLUMNNAME_PackageInfoCount); } @Override public void setPageCount (int PageCount) { set_Value (COLUMNNAME_PageCount, Integer.valueOf(PageCount)); } @Override public int getPageCount()
{ return get_ValueAsInt(COLUMNNAME_PageCount); } @Override public void setTransactionID (java.lang.String TransactionID) { set_Value (COLUMNNAME_TransactionID, TransactionID); } @Override public java.lang.String getTransactionID() { return (java.lang.String)get_Value(COLUMNNAME_TransactionID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.printing\de.metas.printing.base\src\main\java-gen\de\metas\printing\model\X_C_Print_Package.java
1
请完成以下Java代码
public void setAD_Alert_ID (int AD_Alert_ID) { if (AD_Alert_ID < 1) set_ValueNoCheck (COLUMNNAME_AD_Alert_ID, null); else set_ValueNoCheck (COLUMNNAME_AD_Alert_ID, Integer.valueOf(AD_Alert_ID)); } /** Get Alert. @return Adempiere Alert */ public int getAD_Alert_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_AD_Alert_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Alert Recipient. @param AD_AlertRecipient_ID Recipient of the Alert Notification */ public void setAD_AlertRecipient_ID (int AD_AlertRecipient_ID) { if (AD_AlertRecipient_ID < 1) set_ValueNoCheck (COLUMNNAME_AD_AlertRecipient_ID, null); else set_ValueNoCheck (COLUMNNAME_AD_AlertRecipient_ID, Integer.valueOf(AD_AlertRecipient_ID)); } /** Get Alert Recipient. @return Recipient of the Alert Notification */ public int getAD_AlertRecipient_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_AD_AlertRecipient_ID); if (ii == null) return 0; return ii.intValue(); } 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_Value (COLUMNNAME_AD_Role_ID, null); else set_Value (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_AD_User getAD_User() throws RuntimeException { return (I_AD_User)MTable.get(getCtx(), I_AD_User.Table_Name) .getPO(getAD_User_ID(), get_TrxName()); } /** Set User/Contact. @param AD_User_ID User within the system - Internal or Business Partner Contact */ public void setAD_User_ID (int AD_User_ID) { if (AD_User_ID < 1) set_Value (COLUMNNAME_AD_User_ID, null); else set_Value (COLUMNNAME_AD_User_ID, Integer.valueOf(AD_User_ID)); } /** Get User/Contact. @return User within the system - Internal or Business Partner Contact */ public int getAD_User_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_ID); if (ii == null) return 0; return ii.intValue(); } /** Get Record ID/ColumnName @return ID/ColumnName pair */ public KeyNamePair getKeyNamePair() { return new KeyNamePair(get_ID(), String.valueOf(getAD_User_ID())); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_AlertRecipient.java
1
请完成以下Java代码
public void setSuspenseError_A(org.compiere.model.I_C_ValidCombination SuspenseError_A) { set_ValueFromPO(COLUMNNAME_SuspenseError_Acct, org.compiere.model.I_C_ValidCombination.class, SuspenseError_A); } /** Set CpD-Fehlerkonto. @param SuspenseError_Acct CpD-Fehlerkonto */ @Override public void setSuspenseError_Acct (int SuspenseError_Acct) { set_Value (COLUMNNAME_SuspenseError_Acct, Integer.valueOf(SuspenseError_Acct)); } /** Get CpD-Fehlerkonto. @return CpD-Fehlerkonto */ @Override public int getSuspenseError_Acct () { Integer ii = (Integer)get_Value(COLUMNNAME_SuspenseError_Acct); if (ii == null) return 0; return ii.intValue(); } /** Set Wähungsunterschiede verbuchen. @param UseCurrencyBalancing Sollen Währungsdifferenzen verbucht werden? */ @Override public void setUseCurrencyBalancing (boolean UseCurrencyBalancing) { set_Value (COLUMNNAME_UseCurrencyBalancing, Boolean.valueOf(UseCurrencyBalancing)); } /** Get Wähungsunterschiede verbuchen. @return Sollen Währungsdifferenzen verbucht werden? */ @Override public boolean isUseCurrencyBalancing () { Object oo = get_Value(COLUMNNAME_UseCurrencyBalancing); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set doppelte Buchführung.
@param UseSuspenseBalancing Verwendet doppelte Buchführung über Zwischenkonto bei manuellen Buchungen. */ @Override public void setUseSuspenseBalancing (boolean UseSuspenseBalancing) { set_Value (COLUMNNAME_UseSuspenseBalancing, Boolean.valueOf(UseSuspenseBalancing)); } /** Get doppelte Buchführung. @return Verwendet doppelte Buchführung über Zwischenkonto bei manuellen Buchungen. */ @Override public boolean isUseSuspenseBalancing () { Object oo = get_Value(COLUMNNAME_UseSuspenseBalancing); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set CpD-Fehlerkonto verwenden. @param UseSuspenseError CpD-Fehlerkonto verwenden */ @Override public void setUseSuspenseError (boolean UseSuspenseError) { set_Value (COLUMNNAME_UseSuspenseError, Boolean.valueOf(UseSuspenseError)); } /** Get CpD-Fehlerkonto verwenden. @return CpD-Fehlerkonto verwenden */ @Override public boolean isUseSuspenseError () { Object oo = get_Value(COLUMNNAME_UseSuspenseError); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_AcctSchema_GL.java
1
请完成以下Java代码
protected org.compiere.model.POInfo initPO(final Properties ctx) { return org.compiere.model.POInfo.getPOInfo(Table_Name); } @Override public void setAD_ChangeLog_Config_ID (final int AD_ChangeLog_Config_ID) { if (AD_ChangeLog_Config_ID < 1) set_ValueNoCheck (COLUMNNAME_AD_ChangeLog_Config_ID, null); else set_ValueNoCheck (COLUMNNAME_AD_ChangeLog_Config_ID, AD_ChangeLog_Config_ID); } @Override public int getAD_ChangeLog_Config_ID() { return get_ValueAsInt(COLUMNNAME_AD_ChangeLog_Config_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 setKeepChangeLogsDays (final int KeepChangeLogsDays) { set_Value (COLUMNNAME_KeepChangeLogsDays, KeepChangeLogsDays); } @Override public int getKeepChangeLogsDays() { return get_ValueAsInt(COLUMNNAME_KeepChangeLogsDays); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_ChangeLog_Config.java
1
请完成以下Java代码
public class OnlineBaseExtApiFallback implements IOnlineBaseExtApi { @Setter private Throwable cause; @Override public String cgformPostCrazyForm(String tableName, JSONObject jsonObject) { return null; } @Override public String cgformPutCrazyForm(String tableName, JSONObject jsonObject) { return null; } @Override public JSONObject cgformQueryAllDataByTableName(String tableName, String dataIds) { return null; }
@Override public String cgformDeleteDataByCode(String cgformCode, String dataIds) { return null; } @Override public Map<String, Object> cgreportGetData(String code, String forceKey, String dataList) { return null; } @Override public List<DictModel> cgreportGetDataPackage(String code, String dictText, String dictCode, String dataList) { return null; } }
repos\JeecgBoot-main\jeecg-boot\jeecg-module-system\jeecg-system-api\jeecg-system-cloud-api\src\main\java\org\jeecg\common\online\api\fallback\OnlineBaseExtApiFallback.java
1
请完成以下Java代码
public String toString() { return entityState + " " + dbEntity.getClass().getSimpleName() + "["+dbEntity.getId()+"]"; } public void determineEntityReferences() { if (dbEntity instanceof HasDbReferences) { flushRelevantEntityReferences = ((HasDbReferences) dbEntity).getReferencedEntityIds(); } else { flushRelevantEntityReferences = Collections.emptySet(); } } public boolean areFlushRelevantReferencesDetermined() { return flushRelevantEntityReferences != null; } public Set<String> getFlushRelevantEntityReferences() { return flushRelevantEntityReferences; } // getters / setters //////////////////////////// public DbEntity getEntity() { return dbEntity; } public void setEntity(DbEntity dbEntity) {
this.dbEntity = dbEntity; } public DbEntityState getEntityState() { return entityState; } public void setEntityState(DbEntityState entityState) { this.entityState = entityState; } public Class<? extends DbEntity> getEntityType() { return dbEntity.getClass(); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\db\entitymanager\cache\CachedDbEntity.java
1
请完成以下Spring Boot application配置
spring.ai.anthropic.api-key=${ANTHROPIC_API_KEY} spring.ai.anthropic.chat.options.model=claude-3-5-sonnet-20241022 spring.ai.bedrock.aws.access-key=${AWS_ACCESS_KEY} spring.ai.bedrock.aws.secret-key=${AWS_SECRET_KEY} spring.ai.bedrock.aws.reg
ion=${AWS_REGION} spring.ai.bedrock.converse.chat.options.model=anthropic.claude-3-5-sonnet-20241022-v2:0
repos\tutorials-master\spring-ai-modules\spring-ai-2\src\main\resources\application-anthropic.properties
2
请在Spring Boot框架中完成以下Java代码
public void setProductCode(String productCode) { this.productCode = productCode == null ? null : productCode.trim(); } public String getProductName() { return productName; } public void setProductName(String productName) { this.productName = productName == null ? null : productName.trim(); } public String getUserNo() { return userNo; } public void setUserNo(String userNo) { this.userNo = userNo == null ? null : userNo.trim(); } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName == null ? null : userName.trim(); } public Integer getRiskDay() { return riskDay;
} public void setRiskDay(Integer riskDay) { this.riskDay = riskDay; } public String getAuditStatusDesc() { return PublicEnum.getEnum(this.getAuditStatus()).getDesc(); } public String getFundIntoTypeDesc() { return FundInfoTypeEnum.getEnum(this.getFundIntoType()).getDesc(); } public String getSecurityRating() { return securityRating; } public void setSecurityRating(String securityRating) { this.securityRating = securityRating; } public String getMerchantServerIp() { return merchantServerIp; } public void setMerchantServerIp(String merchantServerIp) { this.merchantServerIp = merchantServerIp; } }
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\user\entity\RpUserPayConfig.java
2
请在Spring Boot框架中完成以下Java代码
public class OrderResponse { @JsonProperty("bpartnerId") BPartnerId bpartnerId; @JsonProperty("orderId") Id orderId; @JsonProperty("supportId") SupportIDType supportId; @JsonProperty("nightOperation") boolean nightOperation; @JsonProperty("orderPackages") List<OrderResponsePackage> orderPackages; @Builder private OrderResponse( @JsonProperty("bpartnerId") @NonNull final BPartnerId bpartnerId, @JsonProperty("orderId") @NonNull final Id orderId, @JsonProperty("supportId") @NonNull final SupportIDType supportId, @JsonProperty("nightOperation") @NonNull final Boolean nightOperation, @JsonProperty("orderPackages") @NonNull @Singular final List<OrderResponsePackage> orderPackages) { this.bpartnerId = bpartnerId; this.orderId = orderId; this.supportId = supportId; this.nightOperation = nightOperation;
this.orderPackages = ImmutableList.copyOf(orderPackages); } public FaultInfo getSingleOrderFaultInfo() { return getSingleOrderPackage().getFaultInfo(); } private OrderResponsePackage getSingleOrderPackage() { final List<OrderResponsePackage> responseOrders = getOrderPackages(); if (responseOrders.size() != 1) { throw new IllegalStateException("Only one order was expected but we have: " + responseOrders); } return responseOrders.get(0); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.msv3.commons\src\main\java\de\metas\vertical\pharma\msv3\protocol\order\OrderResponse.java
2
请完成以下Java代码
public static final Object[] applyUISubClassID(final String uiSubClassID, final Object[] keyValueList) { if (keyValueList == null || keyValueList.length <= 0) { return keyValueList; } Check.assumeNotEmpty(uiSubClassID, "uiSubClassID not empty"); final Object[] keyValueListConverted = new Object[keyValueList.length]; for (int i = 0, max = keyValueList.length; i < max; i += 2) { final Object keyOrig = keyValueList[i]; final Object value = keyValueList[i + 1]; final Object key; if (keyOrig instanceof String)
{ key = buildUIDefaultsKey(uiSubClassID, (String)keyOrig); } else { key = keyOrig; } keyValueListConverted[i] = key; keyValueListConverted[i + 1] = value; } return keyValueListConverted; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\plaf\UISubClassIDHelper.java
1
请完成以下Java代码
public String getParentId() { return null; } public boolean isOnlyChildExecutions() { return onlyChildExecutions; } public boolean isOnlyProcessInstanceExecutions() { return onlyProcessInstanceExecutions; } public boolean isOnlySubProcessExecutions() { return onlySubProcessExecutions; } public Date getStartedBefore() { return startedBefore; } public void setStartedBefore(Date startedBefore) { this.startedBefore = startedBefore; } public Date getStartedAfter() { return startedAfter; } public void setStartedAfter(Date startedAfter) { this.startedAfter = startedAfter;
} public String getStartedBy() { return startedBy; } public void setStartedBy(String startedBy) { this.startedBy = startedBy; } public List<String> getInvolvedGroups() { return involvedGroups; } public ProcessInstanceQuery involvedGroupsIn(List<String> involvedGroups) { if (involvedGroups == null || involvedGroups.isEmpty()) { throw new ActivitiIllegalArgumentException("Involved groups list is null or empty."); } if (inOrStatement) { this.currentOrQueryObject.involvedGroups = involvedGroups; } else { this.involvedGroups = involvedGroups; } return this; } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\ProcessInstanceQueryImpl.java
1
请完成以下Java代码
public List<EventLogEntry> getEventLogEntries(Long startLogNr, Long pageSize) { return commandExecutor.execute(new GetEventLogEntriesCmd(startLogNr, pageSize)); } @Override public List<EventLogEntry> getEventLogEntriesByProcessInstanceId(String processInstanceId) { return commandExecutor.execute(new GetEventLogEntriesCmd(processInstanceId)); } @Override public void deleteEventLogEntry(long logNr) { commandExecutor.execute(new DeleteEventLogEntry(logNr)); } @Override public ExternalWorkerJobAcquireBuilder createExternalWorkerJobAcquireBuilder() { return new ExternalWorkerJobAcquireBuilderImpl(commandExecutor, configuration.getJobServiceConfiguration()); } @Override public ExternalWorkerJobFailureBuilder createExternalWorkerJobFailureBuilder(String externalJobId, String workerId) { return new ExternalWorkerJobFailureBuilderImpl(externalJobId, workerId, commandExecutor, configuration.getJobServiceConfiguration()); } @Override public ExternalWorkerCompletionBuilder createExternalWorkerCompletionBuilder(String externalJobId, String workerId) { return new ExternalWorkerCompletionBuilderImpl(commandExecutor, externalJobId, workerId, configuration.getJobServiceConfiguration());
} @Override public void unacquireExternalWorkerJob(String jobId, String workerId) { commandExecutor.execute(new UnacquireExternalWorkerJobCmd(jobId, workerId, configuration.getJobServiceConfiguration())); } @Override public void unacquireAllExternalWorkerJobsForWorker(String workerId) { commandExecutor.execute(new UnacquireAllExternalWorkerJobsForWorkerCmd(workerId, null, configuration.getJobServiceConfiguration())); } @Override public void unacquireAllExternalWorkerJobsForWorker(String workerId, String tenantId) { commandExecutor.execute(new UnacquireAllExternalWorkerJobsForWorkerCmd(workerId, tenantId, configuration.getJobServiceConfiguration())); } @Override public ChangeTenantIdBuilder createChangeTenantIdBuilder(String fromTenantId, String toTenantId) { return new ChangeTenantIdBuilderImpl(fromTenantId, toTenantId, configuration.getChangeTenantIdManager()); } }
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\ManagementServiceImpl.java
1
请在Spring Boot框架中完成以下Java代码
public class PayPalOrderId implements RepoIdAware { @JsonCreator public static PayPalOrderId ofRepoId(final int repoId) { return new PayPalOrderId(repoId); } public static PayPalOrderId ofRepoIdOrNull(final int repoId) { return repoId > 0 ? new PayPalOrderId(repoId) : null; } public static int toRepoId(@Nullable final PayPalOrderId orderId) { return orderId != null ? orderId.getRepoId() : -1; }
int repoId; private PayPalOrderId(final int repoId) { this.repoId = Check.assumeGreaterThanZero(repoId, "PayPal_Order_ID"); } @Override @JsonValue public int getRepoId() { return repoId; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.paypal\src\main\java\de\metas\payment\paypal\client\PayPalOrderId.java
2
请完成以下Java代码
public boolean isOpen() { return Running.equals(this) || NotStarted.equals(this) || Suspended.equals(this); } /** * State is Not Running * * @return true if not running (not started, suspended) */ public boolean isNotRunning() { return NotStarted.equals(this) || Suspended.equals(this); } // isNotRunning /** * State is Closed * * @return true if closed (completed, aborted, terminated) */ public boolean isClosed() { return Completed.equals(this) || Aborted.equals(this) || Terminated.equals(this); } public boolean isNotStarted() { return NotStarted.equals(this); } // isNotStarted public boolean isRunning() { return Running.equals(this); } public boolean isSuspended() { return Suspended.equals(this); } public boolean isCompleted() { return Completed.equals(this); } public boolean isError() { return isAborted() || isTerminated(); } /** * @return true if state is Aborted (Environment/Setup issue) */ public boolean isAborted() { return Aborted.equals(this); } /** * @return true if state is Terminated (Execution issue) */ public boolean isTerminated() { return Terminated.equals(this); } /** * Get New State Options based on current State */
private WFState[] getNewStateOptions() { if (isNotStarted()) return new WFState[] { Running, Aborted, Terminated }; else if (isRunning()) return new WFState[] { Suspended, Completed, Aborted, Terminated }; else if (isSuspended()) return new WFState[] { Running, Aborted, Terminated }; else return new WFState[] {}; } /** * Is the new State valid based on current state * * @param newState new state * @return true valid new state */ public boolean isValidNewState(final WFState newState) { final WFState[] options = getNewStateOptions(); for (final WFState option : options) { if (option.equals(newState)) return true; } return false; } /** * @return true if the action is valid based on current state */ public boolean isValidAction(final WFAction action) { final WFAction[] options = getActionOptions(); for (final WFAction option : options) { if (option.equals(action)) { return true; } } return false; } /** * @return valid actions based on current State */ private WFAction[] getActionOptions() { if (isNotStarted()) return new WFAction[] { WFAction.Start, WFAction.Abort, WFAction.Terminate }; if (isRunning()) return new WFAction[] { WFAction.Suspend, WFAction.Complete, WFAction.Abort, WFAction.Terminate }; if (isSuspended()) return new WFAction[] { WFAction.Resume, WFAction.Abort, WFAction.Terminate }; else return new WFAction[] {}; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\workflow\WFState.java
1
请完成以下Java代码
public int getPageTo() { if (pageTo != null) { return pageTo; } return initialPageTo; } public boolean isPageRange() { return I_AD_PrinterRouting.ROUTINGTYPE_PageRange.equals(routingType); } public boolean isLastPages()
{ return I_AD_PrinterRouting.ROUTINGTYPE_LastPages.equals(routingType); } public boolean isQueuedForExternalSystems() { return isMatchingOutputType(OutputType.Queue) && printer.getExternalSystemParentConfigId() != null; } public boolean isMatchingOutputType(@NonNull OutputType outputType) { return OutputType.equals(printer.getOutputType(), outputType); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.printing\de.metas.printing.base\src\main\java\de\metas\printing\printingdata\PrintingSegment.java
1
请在Spring Boot框架中完成以下Java代码
public void addToNewGroupIfFeasible(@NonNull final AddToResultGroupRequest request) { boolean addedToAtLeastOneGroup = false; for (final AvailableToPromiseResultBucket bucket : buckets) { if (bucket.addToNewGroupIfFeasible(request)) { addedToAtLeastOneGroup = true; break; } } if (!addedToAtLeastOneGroup) { final AvailableToPromiseResultBucket bucket = newBucket(request); if (!bucket.addToNewGroupIfFeasible(request)) { throw new AdempiereException("Internal error: cannot add " + request + " to newly created bucket: " + bucket); } } } private AvailableToPromiseResultBucket newBucket(final AddToResultGroupRequest request) { final AvailableToPromiseResultBucket bucket = AvailableToPromiseResultBucket.builder() .warehouse(WarehouseClassifier.specificOrAny(request.getWarehouseId())) .bpartner(request.getBpartner())
.product(ProductClassifier.specific(request.getProductId().getRepoId())) .storageAttributesKeyMatcher(AttributesKeyPatternsUtil.matching(request.getStorageAttributesKey())) .build(); buckets.add(bucket); return bucket; } @VisibleForTesting ImmutableList<AvailableToPromiseResultBucket> getBuckets() { return ImmutableList.copyOf(buckets); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.material\dispo-commons\src\main\java\de\metas\material\dispo\commons\repository\atp\AvailableToPromiseResultBuilder.java
2
请完成以下Java代码
public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public String getVertifyMan() { return vertifyMan; } public void setVertifyMan(String vertifyMan) { this.vertifyMan = vertifyMan; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public String getDetail() { return detail; }
public void setDetail(String detail) { this.detail = detail; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); sb.append(", productId=").append(productId); sb.append(", createTime=").append(createTime); sb.append(", vertifyMan=").append(vertifyMan); sb.append(", status=").append(status); sb.append(", detail=").append(detail); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); } }
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\PmsProductVertifyRecord.java
1
请在Spring Boot框架中完成以下Java代码
public class ValuesApp { @Value("string value") private String stringValue; @Value("${value.from.file}") private String valueFromFile; @Value("${systemValue}") private String systemValue; @Value("${unknown_param:some default}") private String someDefault; @Value("${priority}") private String prioritySystemProperty; @Value("${listOfValues}") private String[] valuesArray; @Value("#{systemProperties['priority']}") private String spelValue; @Value("#{systemProperties['unknown'] ?: 'some default'}") private String spelSomeDefault; @Value("#{someBean.someValue}") private Integer someBeanValue; @Value("#{'${listOfValues}'.split(',')}") private List<String> valuesList; @Value("#{${valuesMap}}") private Map<String, Integer> valuesMap; @Value("#{${valuesMap}.key1}") private Integer valuesMapKey1; @Value("#{${valuesMap}['unknownKey']}") private Integer unknownMapKey; @Value("#{${unknownMap : {key1:'1', key2 : '2'}}}") private Map<String, Integer> unknownMap; @Value("#{${valuesMap}['unknownKey'] ?: 5}") private Integer unknownMapKeyWithDefaultValue; @Value("#{${valuesMap}.?[value>'1']}") private Map<String, Integer> valuesMapFiltered; @Value("#{systemProperties}") private Map<String, String> systemPropertiesMap;
public static void main(String[] args) { System.setProperty("systemValue", "Some system parameter value"); System.setProperty("priority", "System property"); ApplicationContext applicationContext = new AnnotationConfigApplicationContext(ValuesApp.class); } @Bean public SomeBean someBean() { return new SomeBean(10); } @PostConstruct public void afterInitialize() { System.out.println(stringValue); System.out.println(valueFromFile); System.out.println(systemValue); System.out.println(someDefault); System.out.println(prioritySystemProperty); System.out.println(Arrays.toString(valuesArray)); System.out.println(spelValue); System.out.println(spelSomeDefault); System.out.println(someBeanValue); System.out.println(valuesList); System.out.println(valuesMap); System.out.println(valuesMapKey1); System.out.println(unknownMapKey); System.out.println(unknownMap); System.out.println(unknownMapKeyWithDefaultValue); System.out.println(valuesMapFiltered); System.out.println(systemPropertiesMap); } }
repos\tutorials-master\spring-boot-modules\spring-boot-properties\src\main\java\com\baeldung\value\ValuesApp.java
2
请在Spring Boot框架中完成以下Java代码
public @Nullable String getPassword() { return this.password; } public void setPassword(@Nullable String password) { this.password = password; } public Duration getPushRate() { return this.pushRate; } public void setPushRate(Duration pushRate) { this.pushRate = pushRate; } public @Nullable String getJob() { return this.job; } public void setJob(@Nullable String job) { this.job = job; } public Map<String, String> getGroupingKey() { return this.groupingKey; } public void setGroupingKey(Map<String, String> groupingKey) { this.groupingKey = groupingKey; } public ShutdownOperation getShutdownOperation() { return this.shutdownOperation; } public void setShutdownOperation(ShutdownOperation shutdownOperation) { this.shutdownOperation = shutdownOperation; } public Scheme getScheme() { return this.scheme; } public void setScheme(Scheme scheme) { this.scheme = scheme; } public @Nullable String getToken() { return this.token; } public void setToken(@Nullable String token) { this.token = token; } public Format getFormat() { return this.format; }
public void setFormat(Format format) { this.format = format; } public enum Format { /** * Push metrics in text format. */ TEXT, /** * Push metrics in protobuf format. */ PROTOBUF } public enum Scheme { /** * Use HTTP to push metrics. */ HTTP, /** * Use HTTPS to push metrics. */ HTTPS } } }
repos\spring-boot-4.0.1\module\spring-boot-micrometer-metrics\src\main\java\org\springframework\boot\micrometer\metrics\autoconfigure\export\prometheus\PrometheusProperties.java
2
请完成以下Java代码
protected void deleteExceptionByteArrayRef(DeadLetterJobEntity jobEntity) { ByteArrayRef exceptionByteArrayRef = jobEntity.getExceptionByteArrayRef(); if (exceptionByteArrayRef != null) { exceptionByteArrayRef.delete(); } } protected DeadLetterJobEntity createDeadLetterJob(AbstractJobEntity job) { DeadLetterJobEntity newJobEntity = create(); newJobEntity.setJobHandlerConfiguration(job.getJobHandlerConfiguration()); newJobEntity.setJobHandlerType(job.getJobHandlerType()); newJobEntity.setExclusive(job.isExclusive()); newJobEntity.setRepeat(job.getRepeat()); newJobEntity.setRetries(job.getRetries()); newJobEntity.setEndDate(job.getEndDate()); newJobEntity.setExecutionId(job.getExecutionId());
newJobEntity.setProcessInstanceId(job.getProcessInstanceId()); newJobEntity.setProcessDefinitionId(job.getProcessDefinitionId()); // Inherit tenant newJobEntity.setTenantId(job.getTenantId()); newJobEntity.setJobType(job.getJobType()); return newJobEntity; } protected DeadLetterJobDataManager getDataManager() { return jobDataManager; } public void setJobDataManager(DeadLetterJobDataManager jobDataManager) { this.jobDataManager = jobDataManager; } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\persistence\entity\DeadLetterJobEntityManagerImpl.java
1
请完成以下Java代码
public class AbstractHistoricManager extends AbstractManager { protected static final EnginePersistenceLogger LOG = ProcessEngineLogger.PERSISTENCE_LOGGER; protected HistoryLevel historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel(); protected boolean isHistoryEnabled = !historyLevel.equals(HistoryLevel.HISTORY_LEVEL_NONE); protected boolean isHistoryLevelFullEnabled = historyLevel.equals(HistoryLevel.HISTORY_LEVEL_FULL); protected void checkHistoryEnabled() { if (!isHistoryEnabled) { throw LOG.disabledHistoryException(); } } public boolean isHistoryEnabled() { return isHistoryEnabled; } public boolean isHistoryLevelFullEnabled() { return isHistoryLevelFullEnabled; }
protected static boolean isPerformUpdate(Set<String> entities, Class<?> entityClass) { return entities == null || entities.isEmpty() || entities.contains(entityClass.getName()); } protected static boolean isPerformUpdateOnly(Set<String> entities, Class<?> entityClass) { return entities != null && entities.size() == 1 && entities.contains(entityClass.getName()); } protected static void addOperation(DbOperation operation, Map<Class<? extends DbEntity>, DbOperation> operations) { operations.put(operation.getEntityType(), operation); } protected static void addOperation(Collection<DbOperation> newOperations, Map<Class<? extends DbEntity>, DbOperation> operations) { newOperations.forEach(operation -> operations.put(operation.getEntityType(), operation)); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\AbstractHistoricManager.java
1
请完成以下Java代码
public Map<ObjectIdentity, Acl> readAclsById(List<ObjectIdentity> objects, List<Sid> sids) throws NotFoundException { Map<ObjectIdentity, Acl> result = this.lookupStrategy.readAclsById(objects, sids); // Check every requested object identity was found (throw NotFoundException if // needed) for (ObjectIdentity oid : objects) { if (!result.containsKey(oid)) { throw new NotFoundException("Unable to find ACL information for object identity '" + oid + "'"); } } return result; } /** * Allows customization of the SQL query used to find child object identities. * @param findChildrenSql */ public void setFindChildrenQuery(String findChildrenSql) { this.findChildrenSql = findChildrenSql; } public void setAclClassIdSupported(boolean aclClassIdSupported) { this.aclClassIdSupported = aclClassIdSupported; if (aclClassIdSupported) { // Change the default children select if it hasn't been overridden if (this.findChildrenSql.equals(DEFAULT_SELECT_ACL_WITH_PARENT_SQL)) { this.findChildrenSql = DEFAULT_SELECT_ACL_WITH_PARENT_SQL_WITH_CLASS_ID_TYPE;
} else { log.debug("Find children statement has already been overridden, so not overridding the default"); } } } public void setConversionService(ConversionService conversionService) { this.aclClassIdUtils = new AclClassIdUtils(conversionService); } public void setObjectIdentityGenerator(ObjectIdentityGenerator objectIdentityGenerator) { Assert.notNull(objectIdentityGenerator, "objectIdentityGenerator cannot be null"); this.objectIdentityGenerator = objectIdentityGenerator; } protected boolean isAclClassIdSupported() { return this.aclClassIdSupported; } }
repos\spring-security-main\acl\src\main\java\org\springframework\security\acls\jdbc\JdbcAclService.java
1
请在Spring Boot框架中完成以下Java代码
public Collection<Object> getRows() { return rowsSupplier.get(); } protected Collection<Object> retrieveRows() { final List<Object> result = new LinkedList<>(); PreparedStatement pstmt = null; ResultSet rs = null; try { pstmt = DB.prepareStatement(sql, ITrx.TRXNAME_None); rs = pstmt.executeQuery(); while (rs.next()) { final Map<String, Object> row = retrieveRow(rs); result.add(row); } } catch (final SQLException e) { final Object[] sqlParams = new Object[] {}; throw new DBException(e, sql, sqlParams); } finally { DB.close(rs, pstmt); } return result; } private Map<String, Object> retrieveRow(final ResultSet rs) throws SQLException { final Map<String, Object> row = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); final ResultSetMetaData rsMetaData = rs.getMetaData(); final int columnCount = rsMetaData.getColumnCount(); for (int columnIndex = 1; columnIndex <= columnCount; columnIndex++) { final String columnName = rsMetaData.getColumnName(columnIndex); Object cellValue = rs.getObject(columnIndex); if (rs.wasNull()) { cellValue = null; }
row.put(columnName, cellValue); } return row; } @Override public Optional<String> getSuggestedFilename() { final Collection<Object> rows = getRows(); if (rows.isEmpty()) { return Optional.empty(); } @SuppressWarnings("unchecked") final Map<String, Object> row = (Map<String, Object>)rows.iterator().next(); final Object reportFileNameObj = row.get(COLUMNNAME_ReportFileName); if (reportFileNameObj == null) { return Optional.empty(); } final String reportFileName = StringUtils.trimBlankToNull(reportFileNameObj.toString()); if (reportFileName == null) { return Optional.empty(); } return Optional.of(reportFileName); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.report\metasfresh-report-service\src\main\java\de\metas\report\xls\engine\JdbcXlsDataSource.java
2
请完成以下Java代码
public ResponseEntity<?> addFilter(@RequestParam(name = "instanceId", required = false) String instanceId, @RequestParam(name = "applicationName", required = false) String name, @RequestParam(name = "ttl", required = false) Long ttl) { if (hasText(instanceId) || hasText(name)) { NotificationFilter filter = createFilter(hasText(instanceId) ? InstanceId.of(instanceId) : null, name, ttl); filteringNotifier.addFilter(filter); return ResponseEntity.ok(filter); } else { return ResponseEntity.badRequest().body("Either 'instanceId' or 'applicationName' must be set"); } } @DeleteMapping(path = "/notifications/filters/{id}") public ResponseEntity<Void> deleteFilter(@PathVariable("id") String id) { NotificationFilter deleted = filteringNotifier.removeFilter(id); if (deleted != null) { return ResponseEntity.ok().build();
} else { return ResponseEntity.notFound().build(); } } private NotificationFilter createFilter(@Nullable InstanceId id, String name, @Nullable Long ttl) { Instant expiry = ((ttl != null) && (ttl >= 0)) ? Instant.now().plusMillis(ttl) : null; if (id != null) { return new InstanceIdNotificationFilter(id, expiry); } else { return new ApplicationNameNotificationFilter(name, expiry); } } }
repos\spring-boot-admin-master\spring-boot-admin-server\src\main\java\de\codecentric\boot\admin\server\notify\filter\web\NotificationFilterController.java
1
请完成以下Java代码
public static long downloadFileWithResume(String downloadUrl, String saveAsFileName) throws IOException, URISyntaxException { File outputFile = new File(saveAsFileName); URLConnection downloadFileConnection = addFileResumeFunctionality(downloadUrl, outputFile); return transferDataAndGetBytesDownloaded(downloadFileConnection, outputFile); } private static URLConnection addFileResumeFunctionality(String downloadUrl, File outputFile) throws IOException, URISyntaxException, ProtocolException, ProtocolException { long existingFileSize = 0L; URLConnection downloadFileConnection = new URI(downloadUrl).toURL() .openConnection(); if (outputFile.exists() && downloadFileConnection instanceof HttpURLConnection) { HttpURLConnection httpFileConnection = (HttpURLConnection) downloadFileConnection; HttpURLConnection tmpFileConn = (HttpURLConnection) new URI(downloadUrl).toURL()
.openConnection(); tmpFileConn.setRequestMethod("HEAD"); long fileLength = tmpFileConn.getContentLengthLong(); existingFileSize = outputFile.length(); if (existingFileSize < fileLength) { httpFileConnection.setRequestProperty("Range", "bytes=" + existingFileSize + "-" + fileLength); } else { throw new IOException("File Download already completed."); } } return downloadFileConnection; } }
repos\tutorials-master\core-java-modules\core-java-networking\src\main\java\com\baeldung\download\ResumableDownload.java
1
请在Spring Boot框架中完成以下Java代码
public class HelloWorldService { private final HelloWorldRepository repository; private final Cache<String, String> simpleHelloWorldCache; private final Cache<String, String> expiringHelloWorldCache; private final Cache<String, String> evictingHelloWorldCache; private final Cache<String, String> passivatingHelloWorldCache; public HelloWorldService(HelloWorldRepository repository, CacheListener listener, Cache<String, String> simpleHelloWorldCache, Cache<String, String> expiringHelloWorldCache, Cache<String, String> evictingHelloWorldCache, Cache<String, String> passivatingHelloWorldCache) { this.repository = repository; this.simpleHelloWorldCache = simpleHelloWorldCache; this.expiringHelloWorldCache = expiringHelloWorldCache; this.evictingHelloWorldCache = evictingHelloWorldCache; this.passivatingHelloWorldCache = passivatingHelloWorldCache; } public String findSimpleHelloWorld() { String cacheKey = "simple-hello"; return simpleHelloWorldCache.computeIfAbsent(cacheKey, k -> repository.getHelloWorld()); } public String findExpiringHelloWorld() { String cacheKey = "expiring-hello"; String helloWorld = simpleHelloWorldCache.get(cacheKey); if (helloWorld == null) { helloWorld = repository.getHelloWorld(); simpleHelloWorldCache.put(cacheKey, helloWorld, 1, TimeUnit.SECONDS); } return helloWorld; } public String findIdleHelloWorld() { String cacheKey = "idle-hello"; String helloWorld = simpleHelloWorldCache.get(cacheKey); if (helloWorld == null) { helloWorld = repository.getHelloWorld(); simpleHelloWorldCache.put(cacheKey, helloWorld, -1, TimeUnit.SECONDS, 10, TimeUnit.SECONDS); } return helloWorld;
} public String findSimpleHelloWorldInExpiringCache() { String cacheKey = "simple-hello"; String helloWorld = expiringHelloWorldCache.get(cacheKey); if (helloWorld == null) { helloWorld = repository.getHelloWorld(); expiringHelloWorldCache.put(cacheKey, helloWorld); } return helloWorld; } public String findEvictingHelloWorld(String key) { String value = evictingHelloWorldCache.get(key); if (value == null) { value = repository.getHelloWorld(); evictingHelloWorldCache.put(key, value); } return value; } public String findPassivatingHelloWorld(String key) { return passivatingHelloWorldCache.computeIfAbsent(key, k -> repository.getHelloWorld()); } }
repos\tutorials-master\libraries-data-2\src\main\java\com\baeldung\infinispan\service\HelloWorldService.java
2
请完成以下Java代码
public int getPickFrom_HU_ID() { return get_ValueAsInt(COLUMNNAME_PickFrom_HU_ID); } @Override public void setPickFrom_HUQRCode (final @Nullable java.lang.String PickFrom_HUQRCode) { set_Value (COLUMNNAME_PickFrom_HUQRCode, PickFrom_HUQRCode); } @Override public java.lang.String getPickFrom_HUQRCode() { return get_ValueAsString(COLUMNNAME_PickFrom_HUQRCode); } /** * PickingJobAggregationType AD_Reference_ID=541931 * Reference name: PickingJobAggregationType */ public static final int PICKINGJOBAGGREGATIONTYPE_AD_Reference_ID=541931; /** sales_order = sales_order */ public static final String PICKINGJOBAGGREGATIONTYPE_Sales_order = "sales_order"; /** product = product */ public static final String PICKINGJOBAGGREGATIONTYPE_Product = "product"; /** delivery_location = delivery_location */ public static final String PICKINGJOBAGGREGATIONTYPE_Delivery_location = "delivery_location"; @Override public void setPickingJobAggregationType (final java.lang.String PickingJobAggregationType) { set_Value (COLUMNNAME_PickingJobAggregationType, PickingJobAggregationType); } @Override public java.lang.String getPickingJobAggregationType() { return get_ValueAsString(COLUMNNAME_PickingJobAggregationType); } @Override
public void setPicking_User_ID (final int Picking_User_ID) { if (Picking_User_ID < 1) set_Value (COLUMNNAME_Picking_User_ID, null); else set_Value (COLUMNNAME_Picking_User_ID, Picking_User_ID); } @Override public int getPicking_User_ID() { return get_ValueAsInt(COLUMNNAME_Picking_User_ID); } @Override public void setPreparationDate (final @Nullable java.sql.Timestamp PreparationDate) { set_Value (COLUMNNAME_PreparationDate, PreparationDate); } @Override public java.sql.Timestamp getPreparationDate() { return get_ValueAsTimestamp(COLUMNNAME_PreparationDate); } @Override public void setProcessed (final boolean Processed) { set_Value (COLUMNNAME_Processed, Processed); } @Override public boolean isProcessed() { return get_ValueAsBoolean(COLUMNNAME_Processed); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java-gen\de\metas\handlingunits\model\X_M_Picking_Job.java
1
请完成以下Java代码
public class ExpressionBasedAnnotationAttributeFactory implements PrePostInvocationAttributeFactory { private final Object parserLock = new Object(); private @Nullable ExpressionParser parser; private MethodSecurityExpressionHandler handler; public ExpressionBasedAnnotationAttributeFactory(MethodSecurityExpressionHandler handler) { Assert.notNull(handler, "handler cannot be null"); this.handler = handler; } @Override public PreInvocationAttribute createPreInvocationAttribute(String preFilterAttribute, String filterObject, String preAuthorizeAttribute) { try { // TODO: Optimization of permitAll ExpressionParser parser = getParser(); Expression preAuthorizeExpression = (preAuthorizeAttribute != null) ? parser.parseExpression(preAuthorizeAttribute) : parser.parseExpression("permitAll"); Expression preFilterExpression = (preFilterAttribute != null) ? parser.parseExpression(preFilterAttribute) : null; return new PreInvocationExpressionAttribute(preFilterExpression, filterObject, preAuthorizeExpression); } catch (ParseException ex) { throw new IllegalArgumentException("Failed to parse expression '" + ex.getExpressionString() + "'", ex); } } @Override public @Nullable PostInvocationAttribute createPostInvocationAttribute(String postFilterAttribute, String postAuthorizeAttribute) { try { ExpressionParser parser = getParser(); Expression postAuthorizeExpression = (postAuthorizeAttribute != null) ? parser.parseExpression(postAuthorizeAttribute) : null; Expression postFilterExpression = (postFilterAttribute != null) ? parser.parseExpression(postFilterAttribute) : null; if (postFilterExpression != null || postAuthorizeExpression != null) { return new PostInvocationExpressionAttribute(postFilterExpression, postAuthorizeExpression);
} } catch (ParseException ex) { throw new IllegalArgumentException("Failed to parse expression '" + ex.getExpressionString() + "'", ex); } return null; } /** * Delay the lookup of the {@link ExpressionParser} to prevent SEC-2136 * @return */ private ExpressionParser getParser() { if (this.parser != null) { return this.parser; } synchronized (this.parserLock) { this.parser = this.handler.getExpressionParser(); this.handler = null; } return this.parser; } }
repos\spring-security-main\access\src\main\java\org\springframework\security\access\expression\method\ExpressionBasedAnnotationAttributeFactory.java
1
请完成以下Java代码
public String getFromEmail() { return fromEmail; } public void setFromEmail(String fromEmail) { this.fromEmail = fromEmail; } public String getFromName() { return fromName; } public void setFromName(String fromName) { this.fromName = fromName; } public HydrationAlertNotification getHydrationAlertNotification() { return hydrationAlertNotification; } public void setHydrationAlertNotification(HydrationAlertNotification hydrationAlertNotification) { this.hydrationAlertNotification = hydrationAlertNotification; } class HydrationAlertNotification {
@NotBlank(message = "Template-id must be configured") @Pattern(regexp = "^d-[a-f0-9]{32}$", message = "Invalid template ID format") private String templateId; public String getTemplateId() { return templateId; } public void setTemplateId(String templateId) { this.templateId = templateId; } } }
repos\tutorials-master\saas-modules\sendgrid\src\main\java\com\baeldung\sendgrid\SendGridConfigurationProperties.java
1
请完成以下Java代码
default IMutableHUContext createMutableHUContextForProcessing() { return createMutableHUContextForProcessing(PlainContextAware.newWithThreadInheritedTrx()); } /** * Creates a mutable context with the given <code>ctx</code> (may not be <code>null</code>) and <code>trxName</code> = {@link ITrx#TRXNAME_None}. * * @return mutable HU context */ IMutableHUContext createMutableHUContext( @NonNull Properties ctx, @NonNull ClientAndOrgId clientAndOrgId); /** * Creates a mutable context with the given <code>ctx</code> and <code>trxName</code>. * * @return mutable HU context */ IMutableHUContext createMutableHUContext(Properties ctx, @NonNull String trxName); default IMutableHUContext createMutableHUContext()
{ return createMutableHUContext(PlainContextAware.newWithThreadInheritedTrx()); } /** * @return mutable HU context for <code>contextProvider</code> */ IMutableHUContext createMutableHUContext(IContextAware contextProvider); /** * Create an identical context but with our given "trxName". * * @return newly created context */ IHUContext deriveWithTrxName(IHUContext context, String trxName); }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\IHUContextFactory.java
1
请完成以下Java代码
private static final class EffectiveValuesEvaluatee implements Evaluatee2 { public static final EffectiveValuesEvaluatee extractFrom(final Collection<String> parameters, final Evaluatee ctx, final boolean failIfNotFound) { if (parameters == null || parameters.isEmpty()) { return EMPTY; } HashMap<String, String> values = null; for (final String parameterName : parameters) { final String value = extractParameter(ctx, parameterName); // // Handle variable not found if (value == null) { if (failIfNotFound) { throw ExpressionEvaluationException.newWithTranslatableMessage("@NotFound@: " + parameterName); } continue; } // // Add value to the map if (values == null) { values = new HashMap<>(); } values.put(parameterName, value); } return EffectiveValuesEvaluatee.of(values); } /** * @return extracted parameter or null if does not exist */ private static String extractParameter(final Evaluatee ctx, final String parameterName) { if (ctx instanceof Evaluatee2) { final Evaluatee2 ctx2 = (Evaluatee2)ctx; if (!ctx2.has_Variable(parameterName)) { return null; } return ctx2.get_ValueAsString(parameterName); } else { final String value = ctx.get_ValueAsString(parameterName); if (Env.isPropertyValueNull(parameterName, value)) { return null; } return value; } } public static final EffectiveValuesEvaluatee of(@Nullable final Map<String, String> values) { if (values == null || values.isEmpty()) { return EMPTY; } return new EffectiveValuesEvaluatee(ImmutableMap.copyOf(values)); } public static final EffectiveValuesEvaluatee EMPTY = new EffectiveValuesEvaluatee(ImmutableMap.of()); private final ImmutableMap<String, String> values; private EffectiveValuesEvaluatee(final ImmutableMap<String, String> values) { this.values = values; } @Override public String toString() { return MoreObjects.toStringHelper(this) .addValue(values) .toString(); }
@Override public int hashCode() { return Objects.hash(values); } @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!getClass().equals(obj.getClass())) { return false; } final EffectiveValuesEvaluatee other = (EffectiveValuesEvaluatee)obj; return values.equals(other.values); } @Override public String get_ValueAsString(final String variableName) { return values.get(variableName); } @Override public boolean has_Variable(final String variableName) { return values.containsKey(variableName); } @Override public String get_ValueOldAsString(final String variableName) { // TODO Auto-generated method stub return null; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\expression\api\impl\CachedStringExpression.java
1
请完成以下Java代码
public Set<String> getResourceIds() { return stringToSet(resourceIds); } /** * 获取回调地址 * * @return redirectUrl */ @Override public Set<String> getRegisteredRedirectUri() { return stringToSet(redirectUrl); } /** * 这里需要提一下 * 个人觉得这里应该是客户端所有的权限 * 但是已经有 scope 的存在可以很好的对客户端的权限进行认证了 * 那么在 oauth2 的四个角色中,这里就有可能是资源服务器的权限 * 但是一般资源服务器都有自己的权限管理机制,比如拿到用户信息后做 RBAC * 所以在 spring security 的默认实现中直接给的是空的一个集合 * 这里我们也给他一个空的把 * * @return GrantedAuthority */ @Override public Collection<GrantedAuthority> getAuthorities() { return Collections.emptyList(); } /** * 判断是否自动授权 * * @param scope scope * @return 结果 */ @Override public boolean isAutoApprove(String scope) { if (autoApproveScopes == null || autoApproveScopes.isEmpty()) { return false; } Set<String> authorizationSet = stringToSet(authorizations); for (String auto : authorizationSet) { if ("true".equalsIgnoreCase(auto) || scope.matches(auto)) {
return true; } } return false; } /** * additional information 是 spring security 的保留字段 * 暂时用不到,直接给个空的即可 * * @return map */ @Override public Map<String, Object> getAdditionalInformation() { return Collections.emptyMap(); } private Set<String> stringToSet(String s) { return Arrays.stream(s.split(",")).collect(Collectors.toSet()); } }
repos\spring-boot-demo-master\demo-oauth\oauth-authorization-server\src\main\java\com\xkcoding\oauth\entity\SysClientDetails.java
1
请完成以下Java代码
public String getGrammarFileName() { return "LabeledExpr.g4"; } @Override public String[] getRuleNames() { return ruleNames; } @Override public String getSerializedATN() { return _serializedATN; } @Override public String[] getChannelNames() { return channelNames; } @Override public String[] getModeNames() { return modeNames; } @Override public ATN getATN() { return _ATN; } public static final String _serializedATN = "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\r=\b\1\4\2\t\2\4"+ "\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t"+ "\13\4\f\t\f\3\2\3\2\3\3\3\3\3\4\3\4\3\5\3\5\3\6\3\6\3\7\3\7\3\b\3\b\3"+ "\t\6\t)\n\t\r\t\16\t*\3\n\6\n.\n\n\r\n\16\n/\3\13\5\13\63\n\13\3\13\3"+ "\13\3\f\6\f8\n\f\r\f\16\f9\3\f\3\f\2\2\r\3\3\5\4\7\5\t\6\13\7\r\b\17\t"+ "\21\n\23\13\25\f\27\r\3\2\5\4\2C\\c|\3\2\62;\4\2\13\13\"\"\2@\2\3\3\2"+ "\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17"+ "\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2\3\31\3\2"+ "\2\2\5\33\3\2\2\2\7\35\3\2\2\2\t\37\3\2\2\2\13!\3\2\2\2\r#\3\2\2\2\17"+
"%\3\2\2\2\21(\3\2\2\2\23-\3\2\2\2\25\62\3\2\2\2\27\67\3\2\2\2\31\32\7"+ "?\2\2\32\4\3\2\2\2\33\34\7*\2\2\34\6\3\2\2\2\35\36\7+\2\2\36\b\3\2\2\2"+ "\37 \7,\2\2 \n\3\2\2\2!\"\7\61\2\2\"\f\3\2\2\2#$\7-\2\2$\16\3\2\2\2%&"+ "\7/\2\2&\20\3\2\2\2\')\t\2\2\2(\'\3\2\2\2)*\3\2\2\2*(\3\2\2\2*+\3\2\2"+ "\2+\22\3\2\2\2,.\t\3\2\2-,\3\2\2\2./\3\2\2\2/-\3\2\2\2/\60\3\2\2\2\60"+ "\24\3\2\2\2\61\63\7\17\2\2\62\61\3\2\2\2\62\63\3\2\2\2\63\64\3\2\2\2\64"+ "\65\7\f\2\2\65\26\3\2\2\2\668\t\4\2\2\67\66\3\2\2\289\3\2\2\29\67\3\2"+ "\2\29:\3\2\2\2:;\3\2\2\2;<\b\f\2\2<\30\3\2\2\2\7\2*/\629\3\b\2\2"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); } } }
repos\springboot-demo-master\ANTLR\src\main\java\com\et\antlr\LabeledExprLexer.java
1
请完成以下Java代码
public void setByteArrayValue(byte[] bytes) { byteArrayField.setByteArrayValue(bytes); } public String getName() { return getVariableName(); } // entity lifecycle ///////////////////////////////////////////////////////// public void postLoad() { // make sure the serializer is initialized typedValueField.postLoad(); } // getters and setters ////////////////////////////////////////////////////// public String getTypeName() { return typedValueField.getTypeName(); } public String getVariableTypeName() { return getTypeName(); } public Date getTime() { return timestamp; } @Override public String toString() { return this.getClass().getSimpleName()
+ "[variableName=" + variableName + ", variableInstanceId=" + variableInstanceId + ", revision=" + revision + ", serializerName=" + serializerName + ", longValue=" + longValue + ", doubleValue=" + doubleValue + ", textValue=" + textValue + ", textValue2=" + textValue2 + ", byteArrayId=" + byteArrayId + ", activityInstanceId=" + activityInstanceId + ", eventType=" + eventType + ", executionId=" + executionId + ", id=" + id + ", processDefinitionId=" + processDefinitionId + ", processInstanceId=" + processInstanceId + ", taskId=" + taskId + ", timestamp=" + timestamp + "]"; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\HistoricDetailVariableInstanceUpdateEntity.java
1
请完成以下Java代码
public void validate(@NonNull final I_C_NonBusinessDay record) { if (!record.isActive()) { return; } toNonBusinessDay(record); } @Override @NonNull public I_C_Calendar getDefaultCalendar(@NonNull final OrgId orgId) { final I_C_Calendar calendar = queryBL.createQueryBuilder(I_C_Calendar.class) .addEqualsFilter(I_C_Calendar.COLUMNNAME_IsDefault, true) .addInArrayFilter(I_C_Calendar.COLUMNNAME_AD_Org_ID, ImmutableList.of(orgId, OrgId.ANY)) .orderByDescending(I_C_Calendar.COLUMNNAME_AD_Org_ID) .create() .first(); if (calendar == null) { throw new AdempiereException(CalendarBL.MSG_SET_DEFAULT_OR_ORG_CALENDAR); } return calendar; }
@Nullable @Override public String getName(final CalendarId calendarId) { final List<String> calendarNames = queryBL.createQueryBuilder(I_C_Calendar.class) .addOnlyActiveRecordsFilter() .addEqualsFilter(I_C_Calendar.COLUMNNAME_C_Calendar_ID, calendarId) .create() .listDistinct(I_C_Calendar.COLUMNNAME_Name, String.class); if (calendarNames.isEmpty()) { return null; } return calendarNames.get(0); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\calendar\impl\AbstractCalendarDAO.java
1
请完成以下Java代码
public final class NimbusJwkSetEndpointFilter extends OncePerRequestFilter { /** * The default endpoint {@code URI} for JWK Set requests. */ private static final String DEFAULT_JWK_SET_ENDPOINT_URI = "/oauth2/jwks"; private final JWKSource<SecurityContext> jwkSource; private final JWKSelector jwkSelector; private final RequestMatcher requestMatcher; /** * Constructs a {@code NimbusJwkSetEndpointFilter} using the provided parameters. * @param jwkSource the {@code com.nimbusds.jose.jwk.source.JWKSource} */ public NimbusJwkSetEndpointFilter(JWKSource<SecurityContext> jwkSource) { this(jwkSource, DEFAULT_JWK_SET_ENDPOINT_URI); } /** * Constructs a {@code NimbusJwkSetEndpointFilter} using the provided parameters. * @param jwkSource the {@code com.nimbusds.jose.jwk.source.JWKSource} * @param jwkSetEndpointUri the endpoint {@code URI} for JWK Set requests */ public NimbusJwkSetEndpointFilter(JWKSource<SecurityContext> jwkSource, String jwkSetEndpointUri) { Assert.notNull(jwkSource, "jwkSource cannot be null"); Assert.hasText(jwkSetEndpointUri, "jwkSetEndpointUri cannot be empty"); this.jwkSource = jwkSource; this.jwkSelector = new JWKSelector(new JWKMatcher.Builder().build()); this.requestMatcher = PathPatternRequestMatcher.withDefaults().matcher(HttpMethod.GET, jwkSetEndpointUri); } @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
if (!this.requestMatcher.matches(request)) { filterChain.doFilter(request, response); return; } JWKSet jwkSet; try { jwkSet = new JWKSet(this.jwkSource.get(this.jwkSelector, null)); } catch (Exception ex) { throw new IllegalStateException("Failed to select the JWK(s) -> " + ex.getMessage(), ex); } response.setContentType(MediaType.APPLICATION_JSON_VALUE); try (Writer writer = response.getWriter()) { writer.write(jwkSet.toString()); // toString() excludes private keys } } }
repos\spring-security-main\oauth2\oauth2-authorization-server\src\main\java\org\springframework\security\oauth2\server\authorization\web\NimbusJwkSetEndpointFilter.java
1