instruction
string
input
string
output
string
source_file
string
priority
int64
请完成以下Java代码
public long executeCount(CommandContext commandContext) { return CommandContextUtil.getHistoricMilestoneInstanceEntityManager(commandContext).findHistoricMilestoneInstanceCountByQueryCriteria(this); } @Override public List<HistoricMilestoneInstance> executeList(CommandContext commandContext) { return CommandContextUtil.getHistoricMilestoneInstanceEntityManager(commandContext).findHistoricMilestoneInstancesByQueryCriteria(this); } @Override public String getId() { return id; } public String getName() { return name; } public String getCaseInstanceId() { return caseInstanceId; } public String getCaseDefinitionId() { return caseDefinitionId; } public Date getReachedBefore() { return reachedBefore; }
public Date getReachedAfter() { return reachedAfter; } public String getTenantId() { return tenantId; } public String getTenantIdLike() { return tenantIdLike; } public boolean isWithoutTenantId() { return withoutTenantId; } }
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\history\HistoricMilestoneInstanceQueryImpl.java
1
请完成以下Java代码
public class Graph { /** * 顶点 */ public Vertex[] vertexes; /** * 边,到达下标i */ public List<EdgeFrom>[] edgesTo; /** * 将一个词网转为词图 * @param vertexes 顶点数组 */ public Graph(Vertex[] vertexes) { int size = vertexes.length; this.vertexes = vertexes; edgesTo = new List[size]; for (int i = 0; i < size; ++i) { edgesTo[i] = new LinkedList<EdgeFrom>(); } } /** * 连接两个节点 * @param from 起点 * @param to 终点 * @param weight 花费 */ public void connect(int from, int to, double weight) { edgesTo[to].add(new EdgeFrom(from, weight, vertexes[from].word + '@' + vertexes[to].word)); } /** * 获取到达顶点to的边列表 * @param to 到达顶点to * @return 到达顶点to的边列表 */ public List<EdgeFrom> getEdgeListTo(int to) { return edgesTo[to]; } @Override public String toString() { return "Graph{" + "vertexes=" + Arrays.toString(vertexes) + ", edgesTo=" + Arrays.toString(edgesTo) + '}'; } public String printByTo() { StringBuffer sb = new StringBuffer(); sb.append("========按终点打印========\n"); for (int to = 0; to < edgesTo.length; ++to) { List<EdgeFrom> edgeFromList = edgesTo[to]; for (EdgeFrom edgeFrom : edgeFromList) { sb.append(String.format("to:%3d, from:%3d, weight:%05.2f, word:%s\n", to, edgeFrom.from, edgeFrom.weight, edgeFrom.name)); } } return sb.toString(); } /** * 根据节点下标数组解释出对应的路径 * @param path
* @return */ public List<Vertex> parsePath(int[] path) { List<Vertex> vertexList = new LinkedList<Vertex>(); for (int i : path) { vertexList.add(vertexes[i]); } return vertexList; } /** * 从一个路径中转换出空格隔开的结果 * @param path * @return */ public static String parseResult(List<Vertex> path) { if (path.size() < 2) { throw new RuntimeException("路径节点数小于2:" + path); } StringBuffer sb = new StringBuffer(); for (int i = 1; i < path.size() - 1; ++i) { Vertex v = path.get(i); sb.append(v.getRealWord() + " "); } return sb.toString(); } public Vertex[] getVertexes() { return vertexes; } public List<EdgeFrom>[] getEdgesTo() { return edgesTo; } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\seg\common\Graph.java
1
请完成以下Java代码
public static String getHost(String urlStr) { try { URL url = new URL(urlStr); return url.getHost().toLowerCase(); } catch (MalformedURLException ignored) { } return null; } /** * 获取 session 中的 String 属性 * @param request 请求 * @return 属性值 */ public static String getSessionAttr(HttpServletRequest request, String key) { HttpSession session = request.getSession(); if (session == null) { return null; } Object value = session.getAttribute(key); if (value == null) { return null; } return value.toString(); } /** * 获取 session 中的 long 属性 * @param request 请求 * @param key 属性名 * @return 属性值 */ public static long getLongSessionAttr(HttpServletRequest request, String key) {
String value = getSessionAttr(request, key); if (value == null) { return 0; } return Long.parseLong(value); } /** * session 中设置属性 * @param request 请求 * @param key 属性名 */ public static void setSessionAttr(HttpServletRequest request, String key, Object value) { HttpSession session = request.getSession(); if (session == null) { return; } session.setAttribute(key, value); } /** * 移除 session 中的属性 * @param request 请求 * @param key 属性名 */ public static void removeSessionAttr(HttpServletRequest request, String key) { HttpSession session = request.getSession(); if (session == null) { return; } session.removeAttribute(key); } }
repos\kkFileView-master\server\src\main\java\cn\keking\utils\WebUtils.java
1
请完成以下Java代码
public SqlLookupDescriptorFactory setAdValRuleIds(@NonNull final Map<LookupDescriptorProvider.LookupScope, AdValRuleId> adValRuleIds) { this.filtersBuilder.setAdValRuleIds(adValRuleIds); return this; } private CompositeSqlLookupFilter getFilters() { return filtersBuilder.getOrBuild(); } private static boolean computeIsHighVolume(@NonNull final ReferenceId diplayType) { final int displayTypeInt = diplayType.getRepoId(); return DisplayType.TableDir != displayTypeInt && DisplayType.Table != displayTypeInt && DisplayType.List != displayTypeInt && DisplayType.Button != displayTypeInt; } /** * Advice the lookup to show all records on which current user has at least read only access */ public SqlLookupDescriptorFactory setReadOnlyAccess() { this.requiredAccess = Access.READ; return this; } private Access getRequiredAccess(@NonNull final TableName tableName) { if (requiredAccess != null) { return requiredAccess; }
// AD_Client_ID/AD_Org_ID (security fields): shall display only those entries on which current user has read-write access if (I_AD_Client.Table_Name.equals(tableName.getAsString()) || I_AD_Org.Table_Name.equals(tableName.getAsString())) { return Access.WRITE; } // Default: all entries on which current user has at least readonly access return Access.READ; } SqlLookupDescriptorFactory addValidationRules(final Collection<IValidationRule> validationRules) { this.filtersBuilder.addFilter(validationRules, null); return this; } SqlLookupDescriptorFactory setPageLength(final Integer pageLength) { this.pageLength = pageLength; return this; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\descriptor\sql\SqlLookupDescriptorFactory.java
1
请完成以下Java代码
public static class Builder { private ImmutableList.Builder<SqlDocumentFilterConverter> converters = null; private Builder() { } public SqlDocumentFilterConvertersList build() { if (converters == null) { return EMPTY; } final ImmutableList<SqlDocumentFilterConverter> converters = this.converters.build(); if (converters.isEmpty()) { return EMPTY; } return new SqlDocumentFilterConvertersList(converters); } public Builder converter(@NonNull final SqlDocumentFilterConverter converter) { if (converters == null) { converters = ImmutableList.builder(); } converters.add(converter);
return this; } public Builder converters(@NonNull final Collection<SqlDocumentFilterConverter> converters) { if (converters.isEmpty()) { return this; } if (this.converters == null) { this.converters = ImmutableList.builder(); } this.converters.addAll(converters); return this; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\document\filter\sql\SqlDocumentFilterConvertersList.java
1
请在Spring Boot框架中完成以下Java代码
public @Nullable String getApiKey() { return this.apiKey; } public void setApiKey(@Nullable String apiKey) { this.apiKey = apiKey; } public @Nullable String getApplicationKey() { return this.applicationKey; } public void setApplicationKey(@Nullable String applicationKey) { this.applicationKey = applicationKey; } public boolean isDescriptions() { return this.descriptions; } public void setDescriptions(boolean descriptions) { this.descriptions = descriptions;
} public String getHostTag() { return this.hostTag; } public void setHostTag(String hostTag) { this.hostTag = hostTag; } public String getUri() { return this.uri; } public void setUri(String uri) { this.uri = uri; } }
repos\spring-boot-4.0.1\module\spring-boot-micrometer-metrics\src\main\java\org\springframework\boot\micrometer\metrics\autoconfigure\export\datadog\DatadogProperties.java
2
请完成以下Java代码
public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getTaskId() { return taskId; } public void setTaskId(String taskId) { this.taskId = taskId; } public String getProcessInstanceId() { return processInstanceId; } public void setProcessInstanceId(String processInstanceId) { this.processInstanceId = processInstanceId; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getContentId() { return contentId; }
public void setContentId(String contentId) { this.contentId = contentId; } public ByteArrayEntity getContent() { return content; } public void setContent(ByteArrayEntity content) { this.content = content; } public void setUserId(String userId) { this.userId = userId; } public String getUserId() { return userId; } public Date getTime() { return time; } public void setTime(Date time) { this.time = time; } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\persistence\entity\AttachmentEntityImpl.java
1
请完成以下Java代码
public MessageCorrelationAsyncBuilder processInstanceIds(List<String> ids) { ensureNotNull("processInstanceIds", ids); this.processInstanceIds = ids; return this; } @Override public MessageCorrelationAsyncBuilder processInstanceQuery(ProcessInstanceQuery processInstanceQuery) { ensureNotNull("processInstanceQuery", processInstanceQuery); this.processInstanceQuery = processInstanceQuery; return this; } @Override public MessageCorrelationAsyncBuilder historicProcessInstanceQuery(HistoricProcessInstanceQuery historicProcessInstanceQuery) { ensureNotNull("historicProcessInstanceQuery", historicProcessInstanceQuery); this.historicProcessInstanceQuery = historicProcessInstanceQuery; return this; } public MessageCorrelationAsyncBuilder setVariable(String variableName, Object variableValue) { ensureNotNull("variableName", variableName); ensurePayloadProcessInstanceVariablesInitialized(); payloadProcessInstanceVariables.put(variableName, variableValue); return this; } public MessageCorrelationAsyncBuilder setVariables(Map<String, Object> variables) { if (variables != null) { ensurePayloadProcessInstanceVariablesInitialized(); payloadProcessInstanceVariables.putAll(variables); } return this; } protected void ensurePayloadProcessInstanceVariablesInitialized() { if (payloadProcessInstanceVariables == null) { payloadProcessInstanceVariables = new VariableMapImpl();
} } @Override public Batch correlateAllAsync() { return commandExecutor.execute(new CorrelateAllMessageBatchCmd(this)); } // getters ////////////////////////////////// public CommandExecutor getCommandExecutor() { return commandExecutor; } public String getMessageName() { return messageName; } public List<String> getProcessInstanceIds() { return processInstanceIds; } public ProcessInstanceQuery getProcessInstanceQuery() { return processInstanceQuery; } public HistoricProcessInstanceQuery getHistoricProcessInstanceQuery() { return historicProcessInstanceQuery; } public Map<String, Object> getPayloadProcessInstanceVariables() { return payloadProcessInstanceVariables; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\MessageCorrelationAsyncBuilderImpl.java
1
请完成以下Java代码
public static TransactionCreatedEvent cast(@NonNull final AbstractTransactionEvent event) { return (TransactionCreatedEvent)event; } public static final String TYPE = "TransactionCreatedEvent"; @JsonCreator @Builder private TransactionCreatedEvent( @JsonProperty("eventDescriptor") final EventDescriptor eventDescriptor, @JsonProperty("materialDescriptor") final MaterialDescriptor materialDescriptor, @JsonProperty("minMaxDescriptor") @Nullable final MinMaxDescriptor minMaxDescriptor, @JsonProperty("receiptScheduleIdsQtys") @Singular final Map<Integer, BigDecimal> receiptScheduleIdsQtys, @JsonProperty("receiptId") final InOutAndLineId receiptId, @JsonProperty("shipmentId") final InOutAndLineId shipmentId, @JsonProperty("ppOrderId") final int ppOrderId, @JsonProperty("ppOrderLineId") final int ppOrderLineId, @JsonProperty("ddOrderId") final int ddOrderId, @JsonProperty("ddOrderLineId") final int ddOrderLineId, @JsonProperty("inventoryId") final int inventoryId, @JsonProperty("inventoryLineId") final int inventoryLineId, @JsonProperty("transactionId") final int transactionId, @JsonProperty("directMovementWarehouse") final boolean directMovementWarehouse, @JsonProperty("huOnHandQtyChangeDescriptor") @Singular final List<HUDescriptor> huOnHandQtyChangeDescriptors) { super(eventDescriptor, materialDescriptor, minMaxDescriptor, receiptScheduleIdsQtys, receiptId, shipmentId, ppOrderId, ppOrderLineId, ddOrderId, ddOrderLineId, inventoryId,
inventoryLineId, transactionId, directMovementWarehouse, huOnHandQtyChangeDescriptors); } /** * @return our material descriptor's quantity, i.e. the {@code MovementQty} if the underlying {@code M_Transaction}. */ @Override public BigDecimal getQuantity() { return getMaterialDescriptor().getQuantity(); } @Override public BigDecimal getQuantityDelta() { return getQuantity(); } @Override public String getEventName() {return TYPE;} }
repos\metasfresh-new_dawn_uat\backend\de.metas.material\event\src\main\java\de\metas\material\event\transactions\TransactionCreatedEvent.java
1
请完成以下Java代码
public void reportFormPropertiesSubmitted(ExecutionEntity processInstance, Map<String, String> properties, String taskId) { if (isHistoryLevelAtLeast(HistoryLevel.AUDIT)) { for (String propertyId : properties.keySet()) { String propertyValue = properties.get(propertyId); HistoricFormPropertyEntity historicFormProperty = new HistoricFormPropertyEntity(processInstance, propertyId, propertyValue, taskId); getDbSqlSession().insert(historicFormProperty); } } } // Identity link related history /* * (non-Javadoc) * * @see org.activiti5.engine.impl.history.HistoryManagerInterface#recordIdentityLinkCreated(org.activiti5.engine.impl.persistence.entity.IdentityLinkEntity) */ @Override public void recordIdentityLinkCreated(IdentityLinkEntity identityLink) { // It makes no sense storing historic counterpart for an identity-link that is related // to a process-definition only as this is never kept in history if (isHistoryLevelAtLeast(HistoryLevel.AUDIT) && (identityLink.getProcessInstanceId() != null || identityLink.getTaskId() != null)) { HistoricIdentityLinkEntity historicIdentityLinkEntity = new HistoricIdentityLinkEntity(identityLink); getDbSqlSession().insert(historicIdentityLinkEntity); } } /* * (non-Javadoc) * * @see org.activiti5.engine.impl.history.HistoryManagerInterface#deleteHistoricIdentityLink(java.lang.String) */ @Override public void deleteHistoricIdentityLink(String id) {
if (isHistoryLevelAtLeast(HistoryLevel.AUDIT)) { getHistoricIdentityLinkEntityManager().deleteHistoricIdentityLink(id); } } /* * (non-Javadoc) * * @see org.activiti5.engine.impl.history.HistoryManagerInterface#updateProcessBusinessKeyInHistory(org.activiti5.engine.impl.persistence.entity.ExecutionEntity) */ @Override public void updateProcessBusinessKeyInHistory(ExecutionEntity processInstance) { if (isHistoryEnabled()) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("updateProcessBusinessKeyInHistory : {}", processInstance.getId()); } if (processInstance != null) { HistoricProcessInstanceEntity historicProcessInstance = getDbSqlSession().selectById(HistoricProcessInstanceEntity.class, processInstance.getId()); if (historicProcessInstance != null) { historicProcessInstance.setBusinessKey(processInstance.getProcessBusinessKey()); getDbSqlSession().update(historicProcessInstance); } } } } }
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\history\DefaultHistoryManager.java
1
请完成以下Java代码
private Comparable<?> getComparableKey(@NonNull final PickingJobField field, @NonNull final Context pickingJob) { //noinspection SwitchStatementWithTooFewBranches switch (field.getField()) { case RUESTPLATZ_NR: { return getRuestplatz(pickingJob) .map(value -> NumberUtils.asInteger(value, null)) // we assume Ruestplantz is number so we want to sort it as numbers .orElse(null); } default: { return null; } } } @Nullable private static AddressDisplaySequence getAddressDisplaySequence(final PickingJobField field) { final String pattern = StringUtils.trimBlankToNull(field.getPattern()); if (pattern == null) { return null; } return AddressDisplaySequence.ofNullable(pattern); } private Optional<String> getRuestplatz(@NonNull final Context pickingJob) { final BPartnerLocationId deliveryLocationId = pickingJob.getDeliveryLocationId(); if (deliveryLocationId == null) { return Optional.empty(); } return ruestplatzCache.computeIfAbsent(deliveryLocationId, this::retrieveRuestplatz); } private Optional<String> retrieveRuestplatz(final BPartnerLocationId deliveryLocationId) { return extractRuestplatz(bpartnerService.getBPartnerLocationByIdEvenInactive(deliveryLocationId)); } private static Optional<String> extractRuestplatz(@Nullable final I_C_BPartner_Location location) { return Optional.ofNullable(location) .map(I_C_BPartner_Location::getSetup_Place_No) .map(StringUtils::trimBlankToNull); } @Nullable private String getHandoverAddress(@NonNull final Context pickingJob, @Nullable AddressDisplaySequence displaySequence) {
final BPartnerLocationId bpLocationId = pickingJob.getHandoverLocationIdWithFallback(); return bpLocationId != null ? renderedAddressProvider.getAddress(bpLocationId, displaySequence) : null; } @Nullable private String getDeliveryAddress(@NonNull final Context context, @Nullable AddressDisplaySequence displaySequence) { final BPartnerLocationId bpLocationId = context.getDeliveryLocationId(); return bpLocationId != null ? renderedAddressProvider.getAddress(bpLocationId, displaySequence) : null; } @Value @Builder private static class Context { @Nullable String salesOrderDocumentNo; @Nullable String customerName; @Nullable ZonedDateTime preparationDate; @Nullable BPartnerLocationId deliveryLocationId; @Nullable BPartnerLocationId handoverLocationId; @Nullable ITranslatableString productName; @Nullable Quantity qtyToDeliver; @Nullable public BPartnerLocationId getHandoverLocationIdWithFallback() { return handoverLocationId != null ? handoverLocationId : deliveryLocationId; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.picking.rest-api\src\main\java\de\metas\picking\workflow\DisplayValueProvider.java
1
请在Spring Boot框架中完成以下Java代码
public class M_ShippingPackage { final MPackageRepository packageRepo = SpringContextHolder.instance.getBean(MPackageRepository.class); @Init public void setupCaching() { final CacheMgt cacheMgt = CacheMgt.get(); cacheMgt.enableRemoteCacheInvalidationForTableName(I_M_ShippingPackage.Table_Name); } @ModelChange(timings = ModelValidator.TYPE_BEFORE_CHANGE, ifColumnsChanged = I_M_ShippingPackage.COLUMNNAME_C_Order_ID) public void closePackageOnOrderDelete(final I_M_ShippingPackage shippingPackage) { final int orderRecordId = shippingPackage.getC_Order_ID(); if (orderRecordId > 0) { // nothing to do return;
} final PackageId packageId = PackageId.ofRepoId(shippingPackage.getM_Package_ID()); packageRepo.closeMPackage(packageId); } @ModelChange(timings = ModelValidator.TYPE_BEFORE_DELETE) public void closePackageOnDelete(final I_M_ShippingPackage shippingPackage) { final int orderRecordId = shippingPackage.getC_Order_ID(); if (orderRecordId <= 0) { // nothing to do return; } final PackageId mPackageId = PackageId.ofRepoId(shippingPackage.getM_Package_ID()); packageRepo.closeMPackage(mPackageId); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\shipping\model\validator\M_ShippingPackage.java
2
请完成以下Java代码
abstract class BeanSupport { // For testing purposes only. static BeanSupport beanSupport; static { // Only intended for unit tests. Not intended to be part of public API. boolean doNotCacheInstance = Boolean.getBoolean("jakarta.el.BeanSupport.doNotCacheInstance"); if (doNotCacheInstance) { beanSupport = null; } else { beanSupport = createInstance(); } } private static BeanSupport createInstance() { // Only intended for unit tests. Not intended to be part of public API. boolean useFull = !Boolean.getBoolean("jakarta.el.BeanSupport.useStandalone"); if (useFull) { // If not explicitly configured to use standalone, use the full implementation unless it is not available. try { Class.forName("java.beans.BeanInfo");
} catch (Exception e) { // Ignore: Expected if using modules and java.desktop module is not present useFull = false; } } if (useFull) { // The full implementation provided by the java.beans package return new BeanSupportFull(); } else { // The cut-down local implementation that does not depend on the java.beans package return new BeanSupportStandalone(); } } static BeanSupport getInstance() { if (beanSupport == null) { return createInstance(); } return beanSupport; } abstract BeanELResolver.BeanProperties getBeanProperties(Class<?> type); }
repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\javax\el\BeanSupport.java
1
请在Spring Boot框架中完成以下Java代码
public ListenableFuture<Void> processAlarmCommentMsgFromEdge(TenantId tenantId, EdgeId edgeId, AlarmCommentUpdateMsg alarmCommentUpdateMsg) { log.trace("[{}] processAlarmCommentMsgFromEdge [{}]", tenantId, alarmCommentUpdateMsg); try { edgeSynchronizationManager.getEdgeId().set(edgeId); return processAlarmCommentMsg(tenantId, alarmCommentUpdateMsg); } finally { edgeSynchronizationManager.getEdgeId().remove(); } } @Override public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); switch (edgeEvent.getAction()) { case ADDED_COMMENT: case UPDATED_COMMENT: case DELETED_COMMENT: AlarmComment alarmComment = JacksonUtil.convertValue(edgeEvent.getBody(), AlarmComment.class); if (alarmComment != null) { return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addAlarmCommentUpdateMsg(EdgeMsgConstructorUtils.constructAlarmCommentUpdatedMsg(msgType, alarmComment)) .build(); } default: return null; } }
@Override public ListenableFuture<Void> processEntityNotification(TenantId tenantId, TransportProtos.EdgeNotificationMsgProto edgeNotificationMsg) { EdgeEventActionType actionType = EdgeEventActionType.valueOf(edgeNotificationMsg.getAction()); AlarmId alarmId = new AlarmId(new UUID(edgeNotificationMsg.getEntityIdMSB(), edgeNotificationMsg.getEntityIdLSB())); EdgeId originatorEdgeId = safeGetEdgeId(edgeNotificationMsg.getOriginatorEdgeIdMSB(), edgeNotificationMsg.getOriginatorEdgeIdLSB()); AlarmComment alarmComment = JacksonUtil.fromString(edgeNotificationMsg.getBody(), AlarmComment.class); if (alarmComment == null) { return Futures.immediateFuture(null); } Alarm alarmById = edgeCtx.getAlarmService().findAlarmById(tenantId, new AlarmId(alarmComment.getAlarmId().getId())); List<ListenableFuture<Void>> delFutures = pushEventToAllRelatedEdges(tenantId, alarmById.getOriginator(), alarmId, actionType, JacksonUtil.valueToTree(alarmComment), originatorEdgeId, EdgeEventType.ALARM_COMMENT); return Futures.transform(Futures.allAsList(delFutures), voids -> null, dbCallbackExecutorService); } @Override public EdgeEventType getEdgeEventType() { return EdgeEventType.ALARM_COMMENT; } }
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\edge\rpc\processor\alarm\comment\AlarmCommentEdgeProcessor.java
2
请在Spring Boot框架中完成以下Java代码
public class Project implements Serializable { @Id @Column(name = "project_id") @GeneratedValue private Long projectId; @Column(name = "title") private String title; @ManyToMany(mappedBy = "projects") private Set<Employee> employees = new HashSet<Employee>(); public Project() { super(); } public Project(String title) { this.title = title; } public Long getProjectId() { return projectId; } public void setProjectId(Long projectId) { this.projectId = projectId; }
public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public Set<Employee> getEmployees() { return employees; } public void setEmployees(Set<Employee> employees) { this.employees = employees; } }
repos\tutorials-master\persistence-modules\hibernate-mapping\src\main\java\com\baeldung\hibernate\manytomany\model\Project.java
2
请完成以下Java代码
public static String getIpAddr(HttpServletRequest request) { String ip = null; try { ip = request.getHeader("x-forwarded-for"); if (StringUtils.isEmpty(ip) || CommonConstant.UNKNOWN.equalsIgnoreCase(ip)) { ip = request.getHeader("Proxy-Client-IP"); } if (StringUtils.isEmpty(ip) || ip.length() == 0 ||CommonConstant.UNKNOWN.equalsIgnoreCase(ip)) { ip = request.getHeader("WL-Proxy-Client-IP"); } if (StringUtils.isEmpty(ip) || CommonConstant.UNKNOWN.equalsIgnoreCase(ip)) { ip = request.getHeader("HTTP_CLIENT_IP"); } if (StringUtils.isEmpty(ip) || CommonConstant.UNKNOWN.equalsIgnoreCase(ip)) { ip = request.getHeader("HTTP_X_FORWARDED_FOR"); } if (StringUtils.isEmpty(ip) || CommonConstant.UNKNOWN.equalsIgnoreCase(ip)) { ip = request.getRemoteAddr(); } } catch (Exception e) { logger.error("IPUtils ERROR ", e); } //logger.info("获取客户端 ip:{} ", ip); // 使用代理,则获取第一个IP地址 if (StringUtils.isNotEmpty(ip) && ip.length() > 15) { if (ip.indexOf(",") > 0) { //ip = ip.substring(0, ip.indexOf(",")); String[] ipAddresses = ip.split(","); for (String ipAddress : ipAddresses) { ipAddress = ipAddress.trim(); if (isValidIpAddress(ipAddress)) { return ipAddress; } } } }
return ip; } /** * 判断是否是IP格式 * @param ipAddress * @return */ public static boolean isValidIpAddress(String ipAddress) { String ipPattern = "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"; Pattern pattern = Pattern.compile(ipPattern); Matcher matcher = pattern.matcher(ipAddress); return matcher.matches(); } /** * 获取服务器上的ip * @return */ public static String getServerIp(){ InetAddress inetAddress = null; try { inetAddress = InetAddress.getLocalHost(); String ipAddress = inetAddress.getHostAddress(); //System.out.println("IP地址: " + ipAddress); return ipAddress; } catch (UnknownHostException e) { logger.error("获取ip地址失败", e); } return ""; } }
repos\JeecgBoot-main\jeecg-boot\jeecg-boot-base-core\src\main\java\org\jeecg\common\util\IpUtils.java
1
请完成以下Java代码
public Map<String, String> getTemplateData() { return mapOf( "action", action, "assigneeTitle", User.getTitle(assigneeEmail, assigneeFirstName, assigneeLastName), "assigneeFirstName", assigneeFirstName, "assigneeLastName", assigneeLastName, "assigneeEmail", assigneeEmail, "assigneeId", assigneeId != null ? assigneeId.toString() : null, "userTitle", User.getTitle(userEmail, userFirstName, userLastName), "userEmail", userEmail, "userFirstName", userFirstName, "userLastName", userLastName, "alarmType", alarmType, "alarmId", alarmId.toString(), "alarmSeverity", alarmSeverity.name().toLowerCase(), "alarmStatus", alarmStatus.toString(), "alarmOriginatorEntityType", alarmOriginator.getEntityType().getNormalName(), "alarmOriginatorId", alarmOriginator.getId().toString(), "alarmOriginatorName", alarmOriginatorName, "alarmOriginatorLabel", alarmOriginatorLabel ); } @Override public CustomerId getAffectedCustomerId() { return alarmCustomerId;
} @Override public UserId getAffectedUserId() { return assigneeId; } @Override public EntityId getStateEntityId() { return alarmOriginator; } @Override public DashboardId getDashboardId() { return dashboardId; } }
repos\thingsboard-master\common\data\src\main\java\org\thingsboard\server\common\data\notification\info\AlarmAssignmentNotificationInfo.java
1
请完成以下Java代码
public RetoureGrund getRetouregrund() { return retouregrund; } /** * Sets the value of the retouregrund property. * * @param value * allowed object is * {@link RetoureGrund } * */ public void setRetouregrund(RetoureGrund value) { this.retouregrund = value; } /** * Gets the value of the charge property. * * @return * possible object is * {@link String } * */ public String getCharge() { return charge; } /** * Sets the value of the charge property. * * @param value * allowed object is * {@link String } * */ public void setCharge(String value) { this.charge = value; }
/** * Gets the value of the verfalldatum property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getVerfalldatum() { return verfalldatum; } /** * Sets the value of the verfalldatum property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setVerfalldatum(XMLGregorianCalendar value) { this.verfalldatum = value; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.msv3.schema.v2\src\main\java-xjc\de\metas\vertical\pharma\vendor\gateway\msv3\schema\v2\RetourePositionType.java
1
请完成以下Java代码
private Comparator<JsonResponseLocation> createShipToLocationComparator() { return Comparator .<JsonResponseLocation, Boolean>comparing(l -> !l.isShipTo() /* shipTo=true first */) .thenComparing(l -> !l.isShipToDefault() /* shipToDefault=true first */); } public JsonResponseBPartner getJsonBPartnerById(@Nullable final String orgCode, @NonNull final BPartnerId bpartnerId) { final ResponseEntity<JsonResponseComposite> bpartner = bpartnerRestController.retrieveBPartner( orgCode, Integer.toString(bpartnerId.getRepoId())); return bpartner.getBody().getBpartner(); } public JsonResponseLocation getJsonBPartnerLocationById(@Nullable final String orgCode, @NonNull final BPartnerLocationId bpartnerLocationId) {
final ResponseEntity<JsonResponseLocation> location = bpartnerRestController.retrieveBPartnerLocation( orgCode, Integer.toString(bpartnerLocationId.getBpartnerId().getRepoId()), Integer.toString(bpartnerLocationId.getRepoId())); return location.getBody(); } public JsonResponseContact getJsonBPartnerContactById(@Nullable final String orgCode, @NonNull final BPartnerContactId bpartnerContactId) { final ResponseEntity<JsonResponseContact> contact = bpartnerRestController.retrieveBPartnerContact( orgCode, Integer.toString(bpartnerContactId.getBpartnerId().getRepoId()), Integer.toString(bpartnerContactId.getRepoId())); return contact.getBody(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business.rest-api-impl\src\main\java\de\metas\rest_api\v1\ordercandidates\impl\BPartnerEndpointAdapter.java
1
请完成以下Spring Boot application配置
# Replace the properties below with proper values for your environment spring.sql.init.mode=ALWAYS #spring.datasource.url=jdbc:postgresql://some-postgresql-host/some-postgresql-database #spring.datasourc
e.username=your-postgresql-username #spring.datasource.password=your-postgresql-password
repos\tutorials-master\messaging-modules\postgres-notify\src\main\resources\application.properties
2
请在Spring Boot框架中完成以下Java代码
public BigDecimal getPercentage() { return percentage; } /** * Sets the value of the percentage property. * * @param value * allowed object is * {@link BigDecimal } * */ public void setPercentage(BigDecimal value) { this.percentage = value; } /** * The discount amount. The discount amount is calculated by: Base amount x percentage = discount amount. In case both, percentage and discount amount, are provided, discount amount is normative. * * @return * possible object is * {@link BigDecimal } * */ public BigDecimal getAmount() { return amount; } /** * Sets the value of the amount property. * * @param value * allowed object is
* {@link BigDecimal } * */ public void setAmount(BigDecimal value) { this.amount = value; } /** * Free text comment field for the given discount. * * @return * possible object is * {@link String } * */ public String getComment() { return comment; } /** * Sets the value of the comment property. * * @param value * allowed object is * {@link String } * */ public void setComment(String value) { this.comment = value; } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\DiscountType.java
2
请完成以下Java代码
public String getVariable() { return variable; } public void setVariable(String variable) { this.variable = variable; } public String getType() { return type; } public String getDefaultExpression() { return defaultExpression; } public void setDefaultExpression(String defaultExpression) { this.defaultExpression = defaultExpression; } public void setType(String type) { this.type = type; } public String getDatePattern() { return datePattern; } public void setDatePattern(String datePattern) { this.datePattern = datePattern; } public boolean isReadable() { return readable; } public void setReadable(boolean readable) { this.readable = readable; } public boolean isWriteable() { return writeable; } public void setWriteable(boolean writeable) { this.writeable = writeable; } public boolean isRequired() { return required; } public void setRequired(boolean required) { this.required = required; }
public List<FormValue> getFormValues() { return formValues; } public void setFormValues(List<FormValue> formValues) { this.formValues = formValues; } public FormProperty clone() { FormProperty clone = new FormProperty(); clone.setValues(this); return clone; } public void setValues(FormProperty otherProperty) { super.setValues(otherProperty); setName(otherProperty.getName()); setExpression(otherProperty.getExpression()); setVariable(otherProperty.getVariable()); setType(otherProperty.getType()); setDefaultExpression(otherProperty.getDefaultExpression()); setDatePattern(otherProperty.getDatePattern()); setReadable(otherProperty.isReadable()); setWriteable(otherProperty.isWriteable()); setRequired(otherProperty.isRequired()); formValues = new ArrayList<FormValue>(); if (otherProperty.getFormValues() != null && !otherProperty.getFormValues().isEmpty()) { for (FormValue formValue : otherProperty.getFormValues()) { formValues.add(formValue.clone()); } } } }
repos\Activiti-develop\activiti-core\activiti-bpmn-model\src\main\java\org\activiti\bpmn\model\FormProperty.java
1
请完成以下Java代码
public long getExpirationTime() { return expirationTime; } public void setExpirationTime(long expirationTime) { this.expirationTime = expirationTime; } public LDAPGroupCacheListener getLdapCacheListener() { return ldapCacheListener; } public void setLdapCacheListener(LDAPGroupCacheListener ldapCacheListener) { this.ldapCacheListener = ldapCacheListener; } // Helper classes //////////////////////////////////// static class LDAPGroupCacheEntry { protected Date timestamp; protected List<Group> groups; public LDAPGroupCacheEntry() { } public LDAPGroupCacheEntry(Date timestamp, List<Group> groups) { this.timestamp = timestamp; this.groups = groups; } public Date getTimestamp() { return timestamp; } public void setTimestamp(Date timestamp) { this.timestamp = timestamp; }
public List<Group> getGroups() { return groups; } public void setGroups(List<Group> groups) { this.groups = groups; } } // Cache listeners. Currently not yet exposed (only programmatically for the // moment) // Experimental stuff! public static interface LDAPGroupCacheListener { void cacheHit(String userId); void cacheMiss(String userId); void cacheEviction(String userId); void cacheExpired(String userId); } }
repos\flowable-engine-main\modules\flowable-ldap\src\main\java\org\flowable\ldap\LDAPGroupCache.java
1
请完成以下Java代码
public void setSQL_Select (final @Nullable java.lang.String SQL_Select) { set_Value (COLUMNNAME_SQL_Select, SQL_Select); } @Override public java.lang.String getSQL_Select() { return get_ValueAsString(COLUMNNAME_SQL_Select); } @Override public void setUOMSymbol (final @Nullable java.lang.String UOMSymbol) { set_Value (COLUMNNAME_UOMSymbol, UOMSymbol); } @Override public java.lang.String getUOMSymbol() { return get_ValueAsString(COLUMNNAME_UOMSymbol); } @Override public void setWEBUI_KPI_Field_ID (final int WEBUI_KPI_Field_ID) { if (WEBUI_KPI_Field_ID < 1) set_ValueNoCheck (COLUMNNAME_WEBUI_KPI_Field_ID, null); else set_ValueNoCheck (COLUMNNAME_WEBUI_KPI_Field_ID, WEBUI_KPI_Field_ID); } @Override public int getWEBUI_KPI_Field_ID() { return get_ValueAsInt(COLUMNNAME_WEBUI_KPI_Field_ID); } @Override
public de.metas.ui.web.base.model.I_WEBUI_KPI getWEBUI_KPI() { return get_ValueAsPO(COLUMNNAME_WEBUI_KPI_ID, de.metas.ui.web.base.model.I_WEBUI_KPI.class); } @Override public void setWEBUI_KPI(final de.metas.ui.web.base.model.I_WEBUI_KPI WEBUI_KPI) { set_ValueFromPO(COLUMNNAME_WEBUI_KPI_ID, de.metas.ui.web.base.model.I_WEBUI_KPI.class, WEBUI_KPI); } @Override public void setWEBUI_KPI_ID (final int WEBUI_KPI_ID) { if (WEBUI_KPI_ID < 1) set_ValueNoCheck (COLUMNNAME_WEBUI_KPI_ID, null); else set_ValueNoCheck (COLUMNNAME_WEBUI_KPI_ID, WEBUI_KPI_ID); } @Override public int getWEBUI_KPI_ID() { return get_ValueAsInt(COLUMNNAME_WEBUI_KPI_ID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java-gen\de\metas\ui\web\base\model\X_WEBUI_KPI_Field.java
1
请在Spring Boot框架中完成以下Java代码
public String getJobId() { return jobId; } public void setJobId(String jobId) { this.jobId = jobId; } public JobInfoEntityManager<? extends JobInfoEntity> getJobEntityManager() { return jobEntityManager; } public void setJobEntityManager(JobInfoEntityManager<? extends JobInfoEntity> jobEntityManager) { this.jobEntityManager = jobEntityManager; } public JobServiceConfiguration getJobServiceConfiguration() { return jobServiceConfiguration;
} public void setJobServiceConfiguration(JobServiceConfiguration jobServiceConfiguration) { this.jobServiceConfiguration = jobServiceConfiguration; } public boolean isUnlock() { return unlock; } public void setUnlock(boolean unlock) { this.unlock = unlock; } }
repos\flowable-engine-main\modules\flowable-job-service\src\main\java\org\flowable\job\service\impl\cmd\ExecuteAsyncRunnableJobCmd.java
2
请完成以下Java代码
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; } @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; } public String getResource() { return resource; } public void setResource(String resource) { this.resource = resource; } public String getLimitApp() { return limitApp; } public void setLimitApp(String limitApp) { this.limitApp = limitApp; } public Double getCount() { return count; }
public void setCount(Double count) { this.count = count; } public Integer getTimeWindow() { return timeWindow; } public void setTimeWindow(Integer timeWindow) { this.timeWindow = timeWindow; } public Integer getGrade() { return grade; } public void setGrade(Integer grade) { this.grade = grade; } @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; } @Override public DegradeRule toRule() { DegradeRule rule = new DegradeRule(); rule.setResource(resource); rule.setLimitApp(limitApp); rule.setCount(count); rule.setTimeWindow(timeWindow); rule.setGrade(grade); return rule; } }
repos\spring-boot-student-master\spring-boot-student-sentinel-dashboard\src\main\java\com\alibaba\csp\sentinel\dashboard\datasource\entity\rule\DegradeRuleEntity.java
1
请完成以下Java代码
private Optional<FAOpenItemTrxInfo> computeTrxInfoFromAllocation(final FAOpenItemTrxInfoComputeRequest request) { final PaymentAllocationLineId paymentAllocationLineId = PaymentAllocationLineId.ofRepoId(request.getRecordId(), request.getLineId()); final AccountConceptualName accountConceptualName = request.getAccountConceptualName(); if (accountConceptualName == null) { return Optional.empty(); } else if (accountConceptualName.isAnyOf(V_Liability, C_Receivable)) { // TODO handle the case when we have invoice-to-invoice allocation return allocationBL.getInvoiceId(paymentAllocationLineId) .map(invoiceId -> FAOpenItemTrxInfo.clearing(FAOpenItemKey.invoice(invoiceId, accountConceptualName))); } else if (accountConceptualName.isAnyOf(V_Prepayment, C_Prepayment)) { // TODO handle the case when we have payment-to-payment allocation return allocationBL.getPaymentId(paymentAllocationLineId) .map(paymentId -> FAOpenItemTrxInfo.clearing(FAOpenItemKey.payment(paymentId, accountConceptualName))); } else { return Optional.empty(); } } private Optional<FAOpenItemTrxInfo> computeTrxInfoFromPayment(final FAOpenItemTrxInfoComputeRequest request) { final PaymentId paymentId = PaymentId.ofRepoId(request.getRecordId()); final AccountConceptualName accountConceptualName = request.getAccountConceptualName(); if (accountConceptualName == null) { return Optional.empty(); } else if (accountConceptualName.isAnyOf(V_Prepayment, C_Prepayment)) { return Optional.of(FAOpenItemTrxInfo.opening(FAOpenItemKey.payment(paymentId, accountConceptualName))); } else { return Optional.empty(); } }
@Override public void onGLJournalLineCompleted(final SAPGLJournalLine line) {updateDocumentAllocatedAndPaidFlags(line);} @Override public void onGLJournalLineReactivated(final SAPGLJournalLine line) {updateDocumentAllocatedAndPaidFlags(line);} private void updateDocumentAllocatedAndPaidFlags(final SAPGLJournalLine line) { final FAOpenItemTrxInfo openItemTrxInfo = line.getOpenItemTrxInfo(); if (openItemTrxInfo == null) { // shall not happen return; } final AccountConceptualName accountConceptualName = openItemTrxInfo.getAccountConceptualName(); if (accountConceptualName == null) { return; } if (accountConceptualName.isAnyOf(V_Liability, C_Receivable)) { openItemTrxInfo.getKey().getInvoiceId().ifPresent(invoiceBL::scheduleUpdateIsPaid); } else if (accountConceptualName.isAnyOf(V_Prepayment, C_Prepayment)) { openItemTrxInfo.getKey().getPaymentId().ifPresent(paymentBL::scheduleUpdateIsAllocated); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\open_items\handlers\BPartnerOIHandler.java
1
请完成以下Java代码
public class IoMapping { protected List<InputParameter> inputParameters; protected List<OutputParameter> outputParameters; public void executeInputParameters(AbstractVariableScope variableScope) { for (InputParameter inputParameter : getInputParameters()) { inputParameter.execute(variableScope); } } public void executeOutputParameters(AbstractVariableScope variableScope) { for (OutputParameter outputParameter : getOutputParameters()) { outputParameter.execute(variableScope); } } public void addInputParameter(InputParameter param) { if(inputParameters == null) { inputParameters = new ArrayList<InputParameter>(); } inputParameters.add(param); } public void addOutputParameter(OutputParameter param) { if(outputParameters == null) { outputParameters = new ArrayList<OutputParameter>(); } outputParameters.add(param); } public List<InputParameter> getInputParameters() { if(inputParameters == null) { return Collections.emptyList(); } else { return inputParameters; } }
public void setInputParameters(List<InputParameter> inputParameters) { this.inputParameters = inputParameters; } public List<OutputParameter> getOutputParameters() { if(outputParameters == null) { return Collections.emptyList(); } else { return outputParameters; } } public void setOuputParameters(List<OutputParameter> outputParameters) { this.outputParameters = outputParameters; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\core\variable\mapping\IoMapping.java
1
请完成以下Java代码
public void setProfileInfo (String ProfileInfo) { set_ValueNoCheck (COLUMNNAME_ProfileInfo, ProfileInfo); } /** Get Profile. @return Information to help profiling the system for solving support issues */ public String getProfileInfo () { return (String)get_Value(COLUMNNAME_ProfileInfo); } /** Set Issue System. @param R_IssueSystem_ID System creating the issue */ public void setR_IssueSystem_ID (int R_IssueSystem_ID) { if (R_IssueSystem_ID < 1) set_ValueNoCheck (COLUMNNAME_R_IssueSystem_ID, null); else set_ValueNoCheck (COLUMNNAME_R_IssueSystem_ID, Integer.valueOf(R_IssueSystem_ID)); } /** Get Issue System. @return System creating the issue */ public int getR_IssueSystem_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_R_IssueSystem_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Statistics. @param StatisticsInfo Information to help profiling the system for solving support issues */ public void setStatisticsInfo (String StatisticsInfo) { set_ValueNoCheck (COLUMNNAME_StatisticsInfo, StatisticsInfo); } /** Get Statistics. @return Information to help profiling the system for solving support issues */ public String getStatisticsInfo () { return (String)get_Value(COLUMNNAME_StatisticsInfo);
} /** SystemStatus AD_Reference_ID=374 */ public static final int SYSTEMSTATUS_AD_Reference_ID=374; /** Evaluation = E */ public static final String SYSTEMSTATUS_Evaluation = "E"; /** Implementation = I */ public static final String SYSTEMSTATUS_Implementation = "I"; /** Production = P */ public static final String SYSTEMSTATUS_Production = "P"; /** Set System Status. @param SystemStatus Status of the system - Support priority depends on system status */ public void setSystemStatus (String SystemStatus) { set_Value (COLUMNNAME_SystemStatus, SystemStatus); } /** Get System Status. @return Status of the system - Support priority depends on system status */ public String getSystemStatus () { return (String)get_Value(COLUMNNAME_SystemStatus); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_R_IssueSystem.java
1
请完成以下Java代码
public Builder setEmail(final String email) { setAttribute(VAR_EMail, email); return this; } public Builder setCCEmail(final String ccEmail) { setAttribute(VAR_CC_EMail, ccEmail); return this; } public Builder setAD_Org_ID(final int adOrgId) { setAttribute(VAR_AD_Org_ID, adOrgId); return this; } public Builder setCustomAttribute(final String attributeName, final Object value) { setAttribute(attributeName, value); return this; } } } public interface SourceDocument { String NAME = "__SourceDocument"; default int getWindowNo() { return Env.WINDOW_None; } boolean hasFieldValue(String fieldName); Object getFieldValue(String fieldName); default int getFieldValueAsInt(final String fieldName, final int defaultValue) { final Object value = getFieldValue(fieldName); return value != null ? (int)value : defaultValue; } @Nullable default <T extends RepoIdAware> T getFieldValueAsRepoId(final String fieldName, final Function<Integer, T> idMapper) { final int id = getFieldValueAsInt(fieldName, -1); if (id > 0) { return idMapper.apply(id); } else { return null; } } static SourceDocument toSourceDocumentOrNull(final Object obj) { if (obj == null) { return null; } if (obj instanceof SourceDocument) { return (SourceDocument)obj; } final PO po = getPO(obj); return new POSourceDocument(po); } } @AllArgsConstructor private static final class POSourceDocument implements SourceDocument { @NonNull
private final PO po; @Override public boolean hasFieldValue(final String fieldName) { return po.get_ColumnIndex(fieldName) >= 0; } @Override public Object getFieldValue(final String fieldName) { return po.get_Value(fieldName); } } @AllArgsConstructor private static final class GridTabSourceDocument implements SourceDocument { @NonNull private final GridTab gridTab; @Override public boolean hasFieldValue(final String fieldName) { return gridTab.getField(fieldName) != null; } @Override public Object getFieldValue(final String fieldName) { return gridTab.getValue(fieldName); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\letters\model\MADBoilerPlate.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_B_Buyer[") .append(get_ID()).append("]"); return sb.toString(); } 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_ValueNoCheck (COLUMNNAME_AD_User_ID, null); else set_ValueNoCheck (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(); } /** 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 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()); } /** Set Valid to. @param ValidTo Valid to including this date (last day) */ public void setValidTo (Timestamp ValidTo) { set_Value (COLUMNNAME_ValidTo, ValidTo); } /** Get Valid to. @return Valid to including this date (last day) */ public Timestamp getValidTo () { return (Timestamp)get_Value(COLUMNNAME_ValidTo); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_B_Buyer.java
1
请完成以下Java代码
public int getRowCount() { return m_printData.getRowCount(); } @Override public boolean isColumnPrinted(final int col) { MPrintFormatItem item = m_printFormat.getItem(col); return item.isPrinted(); } @Override public boolean isPageBreak(final int row, final int col) { PrintDataElement pde = getPDE(row, col); return pde != null ? pde.isPageBreak() : false; } @Override public boolean isFunctionRow(final int row) { return m_printData.isFunctionRow(row); } @Override protected void formatPage(final Sheet sheet) { super.formatPage(sheet); MPrintPaper paper = MPrintPaper.get(this.m_printFormat.getAD_PrintPaper_ID()); // // Set paper size: short paperSize = -1; MediaSizeName mediaSizeName = paper.getMediaSize().getMediaSizeName(); if (MediaSizeName.NA_LETTER.equals(mediaSizeName)) { paperSize = PrintSetup.LETTER_PAPERSIZE; } else if (MediaSizeName.NA_LEGAL.equals(mediaSizeName)) { paperSize = PrintSetup.LEGAL_PAPERSIZE; } else if (MediaSizeName.EXECUTIVE.equals(mediaSizeName)) { paperSize = PrintSetup.EXECUTIVE_PAPERSIZE; } else if (MediaSizeName.ISO_A4.equals(mediaSizeName)) { paperSize = PrintSetup.A4_PAPERSIZE; } else if (MediaSizeName.ISO_A5.equals(mediaSizeName)) { paperSize = PrintSetup.A5_PAPERSIZE; } else if (MediaSizeName.NA_NUMBER_10_ENVELOPE.equals(mediaSizeName)) { paperSize = PrintSetup.ENVELOPE_10_PAPERSIZE; }
// else if (MediaSizeName..equals(mediaSizeName)) { // paperSize = PrintSetup.ENVELOPE_DL_PAPERSIZE; // } // else if (MediaSizeName..equals(mediaSizeName)) { // paperSize = PrintSetup.ENVELOPE_CS_PAPERSIZE; // } else if (MediaSizeName.MONARCH_ENVELOPE.equals(mediaSizeName)) { paperSize = PrintSetup.ENVELOPE_MONARCH_PAPERSIZE; } if (paperSize != -1) { sheet.getPrintSetup().setPaperSize(paperSize); } // // Set Landscape/Portrait: sheet.getPrintSetup().setLandscape(paper.isLandscape()); // // Set Paper Margin: sheet.setMargin(Sheet.TopMargin, ((double)paper.getMarginTop()) / 72); sheet.setMargin(Sheet.RightMargin, ((double)paper.getMarginRight()) / 72); sheet.setMargin(Sheet.LeftMargin, ((double)paper.getMarginLeft()) / 72); sheet.setMargin(Sheet.BottomMargin, ((double)paper.getMarginBottom()) / 72); // } @Override protected List<CellValue> getNextRow() { final ArrayList<CellValue> result = new ArrayList<>(); for (int i = 0; i < getColumnCount(); i++) { result.add(getValueAt(rowNumber, i)); } rowNumber++; return result; } @Override protected boolean hasNextRow() { return rowNumber < getRowCount(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\adempiere\print\export\PrintDataExcelExporter.java
1
请完成以下Java代码
public void setRmtLctnMtd(RemittanceLocationMethod2Code value) { this.rmtLctnMtd = value; } /** * Gets the value of the rmtLctnElctrncAdr property. * * @return * possible object is * {@link String } * */ public String getRmtLctnElctrncAdr() { return rmtLctnElctrncAdr; } /** * Sets the value of the rmtLctnElctrncAdr property. * * @param value * allowed object is * {@link String } * */ public void setRmtLctnElctrncAdr(String value) { this.rmtLctnElctrncAdr = value; } /** * Gets the value of the rmtLctnPstlAdr property. * * @return * possible object is * {@link NameAndAddress10 } *
*/ public NameAndAddress10 getRmtLctnPstlAdr() { return rmtLctnPstlAdr; } /** * Sets the value of the rmtLctnPstlAdr property. * * @param value * allowed object is * {@link NameAndAddress10 } * */ public void setRmtLctnPstlAdr(NameAndAddress10 value) { this.rmtLctnPstlAdr = value; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_02\RemittanceLocation2.java
1
请在Spring Boot框架中完成以下Java代码
public void scheduleFixedDelayTaskUsingExpression() { } @Scheduled(fixedDelay = 1000, initialDelay = 2000) public void scheduleFixedDelayWithInitialDelayTask() { } @Scheduled(fixedRate = 1000) public void scheduleFixedRateTask() { } @Scheduled(fixedRateString = "${fixedRate.in.milliseconds}") public void scheduleFixedRateTaskUsingExpression() { } @Scheduled(fixedDelay = 1000, initialDelay = 1000) public void scheduleFixedRateWithInitialDelayTask() {
long now = System.currentTimeMillis() / 1000; System.out.println("Fixed rate task with one second initial delay - " + now); } /** * Scheduled task is executed at 10:15 AM on the 15th day of every month */ @Scheduled(cron = "0 15 10 15 * ?") public void scheduleTaskUsingCronExpression() { long now = System.currentTimeMillis() / 1000; System.out.println("schedule tasks using cron jobs - " + now); } @Scheduled(cron = "${cron.expression}") public void scheduleTaskUsingExternalizedCronExpression() { } }
repos\tutorials-master\spring-scheduling\src\main\java\com\baeldung\scheduling\ScheduledAnnotationExample.java
2
请完成以下Java代码
public void setRecord_ID (final int Record_ID) { if (Record_ID < 0) set_Value (COLUMNNAME_Record_ID, null); else set_Value (COLUMNNAME_Record_ID, Record_ID); } @Override public int getRecord_ID() { return get_ValueAsInt(COLUMNNAME_Record_ID); } @Override public void setTrxName (final @Nullable java.lang.String TrxName) { set_Value (COLUMNNAME_TrxName, TrxName); } @Override public java.lang.String getTrxName() { return get_ValueAsString(COLUMNNAME_TrxName); } /** * Type AD_Reference_ID=541329 * Reference name: TypeList */
public static final int TYPE_AD_Reference_ID=541329; /** Created = Created */ public static final String TYPE_Created = "Created"; /** Updated = Updated */ public static final String TYPE_Updated = "Updated"; /** Deleted = Deleted */ public static final String TYPE_Deleted = "Deleted"; @Override public void setType (final @Nullable java.lang.String Type) { set_Value (COLUMNNAME_Type, Type); } @Override public java.lang.String getType() { return get_ValueAsString(COLUMNNAME_Type); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_API_Request_Audit_Log.java
1
请完成以下Java代码
public LookupValue retrieveLookupValueById(final @NonNull LookupDataSourceContext evalCtx) { final Object id = evalCtx.getSingleIdToFilterAsObject(); final NamePair valueNP = attributeValuesProvider.getAttributeValueOrNull(evalCtx, id); return LookupValue.fromNamePair(valueNP, evalCtx.getAD_Language(), LOOKUPVALUE_NULL, getTooltipType(evalCtx)); } @NonNull private static TooltipType getTooltipType(final @NotNull LookupDataSourceContext evalCtx) { final String tableName = evalCtx.getTableName(); return tableName != null ? TableIdsCache.instance.getTooltipType(tableName) : TooltipType.DEFAULT; } @Override public LookupDataSourceContext.Builder newContextForFetchingList() { return prepareNewContext() .requiresParameters(dependsOnContextVariables) .requiresFilterAndLimit(); } private LookupDataSourceContext.Builder prepareNewContext() { return LookupDataSourceContext.builder(CONTEXT_LookupTableName); } @Override public LookupValuesPage retrieveEntities(final LookupDataSourceContext evalCtx) { final LookupValueFilterPredicate filter = evalCtx.getFilterPredicate(); final int limit = evalCtx.getLimit(Integer.MAX_VALUE); final int offset = evalCtx.getOffset(0); return attributeValuesProvider.getAvailableValues(evalCtx) .stream() .map(namePair -> StringLookupValue.of(
namePair.getID(), TranslatableStrings.constant(namePair.getName()), TranslatableStrings.constant(namePair.getDescription()))) .filter(filter) .collect(LookupValuesList.collect()) .pageByOffsetAndLimit(offset, limit); } @Override public Optional<WindowId> getZoomIntoWindowId() { return Optional.empty(); } @Override public SqlForFetchingLookupById getSqlForFetchingLookupByIdExpression() { if (attributeValuesProvider instanceof DefaultAttributeValuesProvider) { final DefaultAttributeValuesProvider defaultAttributeValuesProvider = (DefaultAttributeValuesProvider)attributeValuesProvider; final AttributeId attributeId = defaultAttributeValuesProvider.getAttributeId(); return SqlForFetchingLookupById.builder() .keyColumnNameFQ(ColumnNameFQ.ofTableAndColumnName(I_M_AttributeValue.Table_Name, I_M_AttributeValue.COLUMNNAME_Value)) .numericKey(false) .displayColumn(ConstantStringExpression.of(I_M_AttributeValue.COLUMNNAME_Name)) .descriptionColumn(ConstantStringExpression.of(I_M_AttributeValue.COLUMNNAME_Description)) .activeColumn(ColumnNameFQ.ofTableAndColumnName(I_M_AttributeValue.Table_Name, I_M_AttributeValue.COLUMNNAME_IsActive)) .sqlFrom(ConstantStringExpression.of(I_M_AttributeValue.Table_Name)) .additionalWhereClause(I_M_AttributeValue.Table_Name + "." + I_M_AttributeValue.COLUMNNAME_M_Attribute_ID + "=" + attributeId.getRepoId()) .build(); } else { return null; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\pattribute\ASILookupDescriptor.java
1
请在Spring Boot框架中完成以下Java代码
public void putToCache(String cacheName, String key, String value) { cacheManager.getCache(cacheName).put(key, value); } public String getFromCache(String cacheName, String key) { String value = null; if (cacheManager.getCache(cacheName).get(key) != null) { value = cacheManager.getCache(cacheName).get(key).get().toString(); } return value; } @CacheEvict(value = "first", key = "#cacheKey") public void evictSingleCacheValue(String cacheKey) { } @CacheEvict(value = "first", allEntries = true) public void evictAllCacheValues() { } public void evictSingleCacheValue(String cacheName, String cacheKey) {
cacheManager.getCache(cacheName).evict(cacheKey); } public void evictAllCacheValues(String cacheName) { cacheManager.getCache(cacheName).clear(); } public void evictAllCaches() { cacheManager.getCacheNames() .parallelStream() .forEach(cacheName -> cacheManager.getCache(cacheName).clear()); } @Scheduled(fixedRate = 6000) public void evictAllcachesAtIntervals() { evictAllCaches(); } }
repos\tutorials-master\spring-boot-modules\spring-boot-caching\src\main\java\com\baeldung\caching\eviction\service\CachingService.java
2
请完成以下Java代码
public I_AD_JavaClass retriveJavaClassOrNull( @CacheCtx final Properties ctx, final int adJavaClassId) { if (adJavaClassId <= 0) { return null; } return Services.get(IQueryBL.class).createQueryBuilder(I_AD_JavaClass.class, ctx, ITrx.TRXNAME_None) .filter(new EqualsQueryFilter<I_AD_JavaClass>(I_AD_JavaClass.COLUMNNAME_AD_JavaClass_ID, adJavaClassId)) .create() .firstOnly(I_AD_JavaClass.class); } @Override public List<I_AD_JavaClass> retrieveJavaClasses( @CacheCtx final Properties ctx, final String javaClassTypeInternalName) { if (javaClassTypeInternalName == null) { return Collections.emptyList(); } final IQueryBL queryBL = Services.get(IQueryBL.class);
return queryBL.createQueryBuilder(I_AD_JavaClass_Type.class, ctx, ITrx.TRXNAME_None) .addOnlyActiveRecordsFilter() .addEqualsFilter(I_AD_JavaClass_Type.COLUMNNAME_InternalName, javaClassTypeInternalName) .andCollectChildren(I_AD_JavaClass.COLUMN_AD_JavaClass_Type_ID, I_AD_JavaClass.class) .addOnlyActiveRecordsFilter() .create() .list(); } @Override @Cached(cacheName = I_AD_JavaClass_Type.Table_Name + "#by#" + I_AD_JavaClass_Type.COLUMNNAME_InternalName) public I_AD_JavaClass_Type retrieveJavaClassTypeOrNull( @CacheCtx final Properties ctx, final String internalName) { final IQueryBL queryBL = Services.get(IQueryBL.class); return queryBL.createQueryBuilder(I_AD_JavaClass_Type.class, ctx, ITrx.TRXNAME_None) .addOnlyActiveRecordsFilter() .addEqualsFilter(I_AD_JavaClass_Type.COLUMNNAME_InternalName, internalName) .create() .firstOnly(I_AD_JavaClass_Type.class); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\javaclasses\impl\JavaClassDAO.java
1
请完成以下Java代码
public ModelQuery modelWithoutTenantId() { this.withoutTenantId = true; return this; } // sorting //////////////////////////////////////////// @Override public ModelQuery orderByModelCategory() { return orderBy(ModelQueryProperty.MODEL_CATEGORY); } @Override public ModelQuery orderByModelId() { return orderBy(ModelQueryProperty.MODEL_ID); } @Override public ModelQuery orderByModelKey() { return orderBy(ModelQueryProperty.MODEL_KEY); } @Override public ModelQuery orderByModelVersion() { return orderBy(ModelQueryProperty.MODEL_VERSION); } @Override public ModelQuery orderByModelName() { return orderBy(ModelQueryProperty.MODEL_NAME); } @Override public ModelQuery orderByCreateTime() { return orderBy(ModelQueryProperty.MODEL_CREATE_TIME); } @Override public ModelQuery orderByLastUpdateTime() { return orderBy(ModelQueryProperty.MODEL_LAST_UPDATE_TIME); } @Override public ModelQuery orderByTenantId() { return orderBy(ModelQueryProperty.MODEL_TENANT_ID); } // results //////////////////////////////////////////// @Override public long executeCount(CommandContext commandContext) { return CommandContextUtil.getModelEntityManager(commandContext).findModelCountByQueryCriteria(this); } @Override public List<Model> executeList(CommandContext commandContext) { return CommandContextUtil.getModelEntityManager(commandContext).findModelsByQueryCriteria(this); } // getters //////////////////////////////////////////// public String getId() { return id; } public String getName() { return name; } public String getNameLike() { return nameLike; } public Integer getVersion() { return version; } public String getCategory() { return category; } public String getCategoryLike() { return categoryLike; } public String getCategoryNotEquals() {
return categoryNotEquals; } public static long getSerialversionuid() { return serialVersionUID; } public String getKey() { return key; } public boolean isLatest() { return latest; } public String getDeploymentId() { return deploymentId; } public boolean isNotDeployed() { return notDeployed; } public boolean isDeployed() { return deployed; } public String getTenantId() { return tenantId; } public String getTenantIdLike() { return tenantIdLike; } public boolean isWithoutTenantId() { return withoutTenantId; } }
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\ModelQueryImpl.java
1
请完成以下Java代码
private static void loadSpace() { for (int i = Character.MIN_CODE_POINT; i <= Character.MAX_CODE_POINT; i++) { if (Character.isWhitespace(i) || Character.isSpaceChar(i)) { CONVERT[i] = ' '; } } } private static boolean loadBin(String path) { try { ObjectInputStream in = new ObjectInputStream(IOUtil.newInputStream(path)); CONVERT = (char[]) in.readObject(); in.close(); } catch (Exception e) { logger.warning("字符正规化表缓存加载失败,原因如下:" + e); return false; } return true; } /** * 将一个字符正规化 * @param c 字符 * @return 正规化后的字符 */ public static char convert(char c) { return CONVERT[c]; } public static char[] convert(char[] charArray) { char[] result = new char[charArray.length]; for (int i = 0; i < charArray.length; i++) { result[i] = CONVERT[charArray[i]]; } return result; } public static String convert(String sentence) { assert sentence != null; char[] result = new char[sentence.length()]; convert(sentence, result);
return new String(result); } public static void convert(String charArray, char[] result) { for (int i = 0; i < charArray.length(); i++) { result[i] = CONVERT[charArray.charAt(i)]; } } /** * 正规化一些字符(原地正规化) * @param charArray 字符 */ public static void normalization(char[] charArray) { assert charArray != null; for (int i = 0; i < charArray.length; i++) { charArray[i] = CONVERT[charArray[i]]; } } public static void normalize(Sentence sentence) { for (IWord word : sentence) { if (word instanceof CompoundWord) { for (Word w : ((CompoundWord) word).innerList) { w.value = convert(w.value); } } else word.setValue(word.getValue()); } } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\dictionary\other\CharTable.java
1
请完成以下Java代码
public void deleteWidgetTypesByTenantId(TenantId tenantId) { log.trace("Executing deleteWidgetTypesByTenantId, tenantId [{}]", tenantId); Validator.validateId(tenantId, id -> INCORRECT_TENANT_ID + id); tenantWidgetTypeRemover.removeEntities(tenantId, tenantId); } @Override public void deleteWidgetTypesByBundleId(TenantId tenantId, WidgetsBundleId bundleId) { log.trace("Executing deleteWidgetTypesByBundleId, tenantId [{}], bundleId [{}]", tenantId, bundleId); bundleWidgetTypesRemover.removeEntities(tenantId, bundleId); } @Override public PageData<WidgetTypeId> findAllWidgetTypesIds(PageLink pageLink) { return widgetTypeDao.findAllWidgetTypesIds(pageLink); } @Override public void deleteByTenantId(TenantId tenantId) { deleteWidgetTypesByTenantId(tenantId); } @Override public Optional<HasId<?>> findEntity(TenantId tenantId, EntityId entityId) { return Optional.ofNullable(findWidgetTypeById(tenantId, new WidgetTypeId(entityId.getId()))); } @Override public FluentFuture<Optional<HasId<?>>> findEntityAsync(TenantId tenantId, EntityId entityId) { return FluentFuture.from(widgetTypeDao.findByIdAsync(tenantId, entityId.getId())) .transform(Optional::ofNullable, directExecutor()); } @Override public EntityType getEntityType() { return EntityType.WIDGET_TYPE; } private final PaginatedRemover<TenantId, WidgetTypeInfo> tenantWidgetTypeRemover = new PaginatedRemover<>() { @Override protected PageData<WidgetTypeInfo> findEntities(TenantId tenantId, TenantId id, PageLink pageLink) { return widgetTypeDao.findTenantWidgetTypesByTenantId( WidgetTypeFilter.builder() .tenantId(id) .fullSearch(false) .deprecatedFilter(DeprecatedFilter.ALL) .widgetTypes(null).build(),
pageLink); } @Override protected void removeEntity(TenantId tenantId, WidgetTypeInfo entity) { deleteWidgetType(tenantId, new WidgetTypeId(entity.getUuidId())); } }; private final PaginatedRemover<WidgetsBundleId, WidgetTypeInfo> bundleWidgetTypesRemover = new PaginatedRemover<>() { @Override protected PageData<WidgetTypeInfo> findEntities(TenantId tenantId, WidgetsBundleId widgetsBundleId, PageLink pageLink) { return findWidgetTypesInfosByWidgetsBundleId(tenantId, widgetsBundleId, false, DeprecatedFilter.ALL, null, pageLink); } @Override protected void removeEntity(TenantId tenantId, WidgetTypeInfo widgetTypeInfo) { deleteWidgetType(tenantId, widgetTypeInfo.getId()); } }; }
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\widget\WidgetTypeServiceImpl.java
1
请完成以下Java代码
public void setC_OrderLine_ID (final int C_OrderLine_ID) { if (C_OrderLine_ID < 1) set_ValueNoCheck (COLUMNNAME_C_OrderLine_ID, null); else set_ValueNoCheck (COLUMNNAME_C_OrderLine_ID, C_OrderLine_ID); } @Override public int getC_OrderLine_ID() { return get_ValueAsInt(COLUMNNAME_C_OrderLine_ID); } /** * DocStatus AD_Reference_ID=131 * Reference name: _Document Status */ public static final int DOCSTATUS_AD_Reference_ID=131; /** Drafted = DR */ public static final String DOCSTATUS_Drafted = "DR"; /** Completed = CO */ public static final String DOCSTATUS_Completed = "CO"; /** Approved = AP */ public static final String DOCSTATUS_Approved = "AP"; /** NotApproved = NA */ public static final String DOCSTATUS_NotApproved = "NA"; /** Voided = VO */ public static final String DOCSTATUS_Voided = "VO"; /** Invalid = IN */ public static final String DOCSTATUS_Invalid = "IN"; /** Reversed = RE */ public static final String DOCSTATUS_Reversed = "RE"; /** Closed = CL */ public static final String DOCSTATUS_Closed = "CL"; /** Unknown = ?? */ public static final String DOCSTATUS_Unknown = "??"; /** InProgress = IP */ public static final String DOCSTATUS_InProgress = "IP"; /** WaitingPayment = WP */ public static final String DOCSTATUS_WaitingPayment = "WP"; /** WaitingConfirmation = WC */ public static final String DOCSTATUS_WaitingConfirmation = "WC"; @Override public void setDocStatus (final @Nullable java.lang.String DocStatus)
{ throw new IllegalArgumentException ("DocStatus is virtual column"); } @Override public java.lang.String getDocStatus() { return get_ValueAsString(COLUMNNAME_DocStatus); } @Override public void setQtyOrdered (final BigDecimal QtyOrdered) { set_Value (COLUMNNAME_QtyOrdered, QtyOrdered); } @Override public BigDecimal getQtyOrdered() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyOrdered); return bd != null ? bd : BigDecimal.ZERO; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.salescandidate.base\src\main\java-gen\de\metas\ordercandidate\model\X_C_Order_Line_Alloc.java
1
请完成以下Java代码
protected static ObjectNode getProcessDefinitionInfoNode(String processDefinitionId) { Map<String, ObjectNode> bpmnOverrideMap = getBpmnOverrideContext(); if (!bpmnOverrideMap.containsKey(processDefinitionId)) { ProcessDefinitionInfoCacheObject cacheObject = getProcessEngineConfiguration() .getDeploymentManager() .getProcessDefinitionInfoCache() .get(processDefinitionId); addBpmnOverrideElement(processDefinitionId, cacheObject.getInfoNode()); } return getBpmnOverrideContext().get(processDefinitionId); } protected static Map<String, ObjectNode> getBpmnOverrideContext() { Map<String, ObjectNode> bpmnOverrideMap = bpmnOverrideContextThreadLocal.get(); if (bpmnOverrideMap == null) { bpmnOverrideMap = new HashMap<String, ObjectNode>(); } return bpmnOverrideMap; } protected static void addBpmnOverrideElement(String id, ObjectNode infoNode) { Map<String, ObjectNode> bpmnOverrideMap = bpmnOverrideContextThreadLocal.get(); if (bpmnOverrideMap == null) { bpmnOverrideMap = new HashMap<String, ObjectNode>(); bpmnOverrideContextThreadLocal.set(bpmnOverrideMap); } bpmnOverrideMap.put(id, infoNode); } public static class ResourceBundleControl extends ResourceBundle.Control { @Override
public List<Locale> getCandidateLocales(String baseName, Locale locale) { return super.getCandidateLocales(baseName, locale); } } public static ProcessDefinitionHelper getProcessDefinitionHelper() { return processDefinitionHelperThreadLocal.get(); } public static void setProcessDefinitionHelper(ProcessDefinitionHelper processDefinitionHelper) { processDefinitionHelperThreadLocal.set(processDefinitionHelper); } public static void removeProcessDefinitionHelper() { processDefinitionHelperThreadLocal.remove(); } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\context\Context.java
1
请完成以下Java代码
public java.lang.String getSKU () { return (java.lang.String)get_Value(COLUMNNAME_SKU); } /** Set Symbol. @param UOMSymbol Symbol for a Unit of Measure */ @Override public void setUOMSymbol (java.lang.String UOMSymbol) { set_ValueNoCheck (COLUMNNAME_UOMSymbol, UOMSymbol); } /** Get Symbol. @return Symbol for a Unit of Measure */ @Override public java.lang.String getUOMSymbol () { return (java.lang.String)get_Value(COLUMNNAME_UOMSymbol); }
/** Set UPC/EAN. @param UPC Bar Code (Universal Product Code or its superset European Article Number) */ @Override public void setUPC (java.lang.String UPC) { set_ValueNoCheck (COLUMNNAME_UPC, UPC); } /** Get UPC/EAN. @return Bar Code (Universal Product Code or its superset European Article Number) */ @Override public java.lang.String getUPC () { return (java.lang.String)get_Value(COLUMNNAME_UPC); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.rfq\src\main\java-gen\de\metas\rfq\model\X_C_RfQResponseLine_v.java
1
请完成以下Java代码
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 Reihenfolge.
@param SeqNo Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst */ @Override public void setSeqNo (int SeqNo) { set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo)); } /** Get Reihenfolge. @return Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst */ @Override public int getSeqNo () { Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_User_SortPref_Line_Product.java
1
请在Spring Boot框架中完成以下Java代码
public boolean isOnlyExternalWorkers() { return onlyExternalWorkers; } public Date getDuedateHigherThan() { return duedateHigherThan; } public Date getDuedateLowerThan() { return duedateLowerThan; } public Date getDuedateHigherThanOrEqual() { return duedateHigherThanOrEqual; } public Date getDuedateLowerThanOrEqual() { return duedateLowerThanOrEqual;
} public boolean isNoRetriesLeft() { return noRetriesLeft; } public boolean isExecutable() { return executable; } public boolean isRetriesLeft() { return retriesLeft; } }
repos\flowable-engine-main\modules\flowable-job-service\src\main\java\org\flowable\job\service\impl\SuspendedJobQueryImpl.java
2
请完成以下Java代码
public static DistributionFacetsCollection ofCollection(final Collection<DistributionFacet> collection) { return !collection.isEmpty() ? new DistributionFacetsCollection(ImmutableSet.copyOf(collection)) : EMPTY; } @Override @NonNull public Iterator<DistributionFacet> iterator() {return set.iterator();} public boolean isEmpty() {return set.isEmpty();} public WorkflowLaunchersFacetGroupList toWorkflowLaunchersFacetGroupList(@Nullable ImmutableSet<WorkflowLaunchersFacetId> activeFacetIds) { if (isEmpty()) { return WorkflowLaunchersFacetGroupList.EMPTY; } final HashMap<WorkflowLaunchersFacetGroupId, WorkflowLaunchersFacetGroupBuilder> groupBuilders = new HashMap<>(); for (final DistributionFacet distributionFacet : set) { final WorkflowLaunchersFacet facet = distributionFacet.toWorkflowLaunchersFacet(activeFacetIds); groupBuilders.computeIfAbsent(facet.getGroupId(), k -> distributionFacet.newWorkflowLaunchersFacetGroupBuilder()) .facet(facet); } final ImmutableList<WorkflowLaunchersFacetGroup> groups = groupBuilders.values() .stream() .map(WorkflowLaunchersFacetGroupBuilder::build)
.sorted(orderByGroupSeqNo()) .collect(ImmutableList.toImmutableList()); return WorkflowLaunchersFacetGroupList.ofList(groups); } private static Comparator<? super WorkflowLaunchersFacetGroup> orderByGroupSeqNo() { return Comparator.comparingInt(DistributionFacetsCollection::getGroupSeqNo); } private static int getGroupSeqNo(final WorkflowLaunchersFacetGroup group) { return DistributionFacetGroupType.ofWorkflowLaunchersFacetGroupId(group.getId()).getSeqNo(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.distribution.rest-api\src\main\java\de\metas\distribution\mobileui\launchers\facets\DistributionFacetsCollection.java
1
请完成以下Java代码
public class GLJournalBL implements IGLJournalBL { private final IDocTypeDAO docTypeDAO = Services.get(IDocTypeDAO.class); private static final AdMessageKey MSG_HeaderAndLinePeriodMismatchError = AdMessageKey.of("GL_Journal.HeaderAndLinePeriodMismatch"); @Override public boolean isComplete(final I_GL_Journal glJournal) { final String ds = glJournal.getDocStatus(); return X_GL_Journal.DOCSTATUS_Completed.equals(ds) || X_GL_Journal.DOCSTATUS_Closed.equals(ds) || X_GL_Journal.DOCSTATUS_Reversed.equals(ds); } @Override public void unpost(final I_GL_Journal glJournal) { // Make sure the period is open final Properties ctx = InterfaceWrapperHelper.getCtx(glJournal); MPeriod.testPeriodOpen(ctx, glJournal.getDateAcct(), glJournal.getC_DocType_ID(), glJournal.getAD_Org_ID()); Services.get(IFactAcctDAO.class).deleteForDocumentModel(glJournal); glJournal.setPosted(false); InterfaceWrapperHelper.save(glJournal); } @Override public DocTypeId getDocTypeGLJournal(@NonNull final ClientId clientId, @NonNull final OrgId orgId) { final DocTypeQuery docTypeQuery = DocTypeQuery.builder() .adClientId(clientId.getRepoId()) .adOrgId(orgId.getRepoId()) .docBaseType(DocBaseType.GLJournal) .build();
return docTypeDAO .getDocTypeId(docTypeQuery); } @Override public void assertSamePeriod( @NonNull final I_GL_Journal journal, @NonNull final I_GL_JournalLine line) { assertSamePeriod(journal, ImmutableList.of(line)); } @Override public void assertSamePeriod( @NonNull final I_GL_Journal journal, @NonNull final List<I_GL_JournalLine> lines) { final Properties ctx = InterfaceWrapperHelper.getCtx(journal); final int headerPeriodId = MPeriod.getOrFail(ctx, journal.getDateAcct(), journal.getAD_Org_ID()).getC_Period_ID(); for (final I_GL_JournalLine line : lines) { final int linePeriodId = MPeriod.getOrFail(ctx, line.getDateAcct(), line.getAD_Org_ID()).getC_Period_ID(); if (headerPeriodId != linePeriodId) { throw new AdempiereException(MSG_HeaderAndLinePeriodMismatchError, line.getLine()); } } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\gljournal\impl\GLJournalBL.java
1
请完成以下Spring Boot application配置
server.port=9090 management.server.port=8081 management.server.address=127.0.0.1 management.endpoints.web.exposure.include=* logging.level.org.springframework=INFO #Dynamic Endpoint spring.main.allow-bean-definition-overriding=true dynamic.endpoint.config.location=file:extra.properties spring.properties.refreshDelay=1 # ProblemDetails logging.level.org.springframework.web=DEBUG logging.level.org.springframework.web.servlet.mvc=TRACE # Either extend global exception handler from ResponseE
ntityExceptionHandler # Else use this property to enable problemdetails # spring.mvc.problemdetails.enabled=true # Mail spring.mail.host=localhost spring.mail.port=1025 spring.mail.username= spring.mail.password=
repos\tutorials-master\spring-boot-modules\spring-boot-mvc-5\src\main\resources\application.properties
2
请完成以下Java代码
public void setAvailableInAPI (final boolean AvailableInAPI) { set_Value (COLUMNNAME_AvailableInAPI, AvailableInAPI); } @Override public boolean isAvailableInAPI() { return get_ValueAsBoolean(COLUMNNAME_AvailableInAPI); } @Override public void setDataEntry_Section_ID (final int DataEntry_Section_ID) { if (DataEntry_Section_ID < 1) set_ValueNoCheck (COLUMNNAME_DataEntry_Section_ID, null); else set_ValueNoCheck (COLUMNNAME_DataEntry_Section_ID, DataEntry_Section_ID); } @Override public int getDataEntry_Section_ID() { return get_ValueAsInt(COLUMNNAME_DataEntry_Section_ID); } @Override public de.metas.dataentry.model.I_DataEntry_SubTab getDataEntry_SubTab() { return get_ValueAsPO(COLUMNNAME_DataEntry_SubTab_ID, de.metas.dataentry.model.I_DataEntry_SubTab.class); } @Override public void setDataEntry_SubTab(final de.metas.dataentry.model.I_DataEntry_SubTab DataEntry_SubTab) { set_ValueFromPO(COLUMNNAME_DataEntry_SubTab_ID, de.metas.dataentry.model.I_DataEntry_SubTab.class, DataEntry_SubTab); } @Override public void setDataEntry_SubTab_ID (final int DataEntry_SubTab_ID) { if (DataEntry_SubTab_ID < 1) set_Value (COLUMNNAME_DataEntry_SubTab_ID, null); else set_Value (COLUMNNAME_DataEntry_SubTab_ID, DataEntry_SubTab_ID); } @Override public int getDataEntry_SubTab_ID() { return get_ValueAsInt(COLUMNNAME_DataEntry_SubTab_ID); } @Override public void setDescription (final java.lang.String Description) { set_Value (COLUMNNAME_Description, Description); } @Override public java.lang.String getDescription() { return get_ValueAsString(COLUMNNAME_Description); }
@Override public void setIsInitiallyClosed (final boolean IsInitiallyClosed) { set_Value (COLUMNNAME_IsInitiallyClosed, IsInitiallyClosed); } @Override public boolean isInitiallyClosed() { return get_ValueAsBoolean(COLUMNNAME_IsInitiallyClosed); } @Override public void setName (final java.lang.String Name) { set_Value (COLUMNNAME_Name, Name); } @Override public java.lang.String getName() { return get_ValueAsString(COLUMNNAME_Name); } @Override public void setSectionName (final java.lang.String SectionName) { set_Value (COLUMNNAME_SectionName, SectionName); } @Override public java.lang.String getSectionName() { return get_ValueAsString(COLUMNNAME_SectionName); } @Override public void setSeqNo (final int SeqNo) { set_Value (COLUMNNAME_SeqNo, SeqNo); } @Override public int getSeqNo() { return get_ValueAsInt(COLUMNNAME_SeqNo); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\de\metas\dataentry\model\X_DataEntry_Section.java
1
请完成以下Java代码
public Flux<String> getIndexKafka() { Map<String, Object> producerProps = new HashMap<>(); producerProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092"); producerProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, IntegerSerializer.class); producerProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class); SenderOptions<Integer, String> senderOptions = SenderOptions.create(producerProps); KafkaSender<Integer, String> sender = KafkaSender.create(senderOptions); Flux<SenderRecord<Integer, String, Integer>> outboundFlux = Flux.range(1, 10) .map(i -> SenderRecord.create(new ProducerRecord<>("reactive-test", i, "Message_" + i), i)); sender.send(outboundFlux) .subscribe(); Map<String, Object> consumerProps = new HashMap<>(); consumerProps.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092"); consumerProps.put(ConsumerConfig.CLIENT_ID_CONFIG, "my-consumer"); consumerProps.put(ConsumerConfig.GROUP_ID_CONFIG, "my-group"); consumerProps.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, IntegerDeserializer.class); consumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class); consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); ReceiverOptions<Integer, String> receiverOptions = ReceiverOptions.create(consumerProps); receiverOptions.subscription(Collections.singleton("reactive-test")); KafkaReceiver<Integer, String> receiver = KafkaReceiver.create(receiverOptions); Flux<ReceiverRecord<Integer, String>> inboundFlux = receiver.receive(); inboundFlux.subscribe(r -> { logger.info("Received message: {}", r.value()); r.receiverOffset() .acknowledge();
}); return Flux.fromIterable(getThreads()); } @GetMapping("/index") public Mono<String> getIndex() { return Mono.just("Hello world!"); } private List<String> getThreads() { return Thread.getAllStackTraces() .keySet() .stream() .map(t -> String.format("%-20s \t %s \t %d \t %s\n", t.getName(), t.getState(), t.getPriority(), t.isDaemon() ? "Daemon" : "Normal")) .collect(Collectors.toList()); } }
repos\tutorials-master\spring-reactive-modules\spring-reactive\src\main\java\com\baeldung\reactive\concurrency\Controller.java
1
请在Spring Boot框架中完成以下Java代码
public class EdgeCommunicationFailureTriggerProcessor implements NotificationRuleTriggerProcessor<EdgeCommunicationFailureTrigger, EdgeCommunicationFailureNotificationRuleTriggerConfig> { @Override public boolean matchesFilter(EdgeCommunicationFailureTrigger trigger, EdgeCommunicationFailureNotificationRuleTriggerConfig triggerConfig) { if (CollectionUtils.isNotEmpty(triggerConfig.getEdges())) { return !triggerConfig.getEdges().contains(trigger.getEdgeId().getId()); } return true; } @Override public RuleOriginatedNotificationInfo constructNotificationInfo(EdgeCommunicationFailureTrigger trigger) { return EdgeCommunicationFailureNotificationInfo.builder() .tenantId(trigger.getTenantId()) .edgeId(trigger.getEdgeId()) .customerId(trigger.getCustomerId()) .edgeName(trigger.getEdgeName()) .failureMsg(truncateFailureMsg(trigger.getFailureMsg())) .build();
} @Override public NotificationRuleTriggerType getTriggerType() { return NotificationRuleTriggerType.EDGE_COMMUNICATION_FAILURE; } private String truncateFailureMsg(String input) { int maxLength = 500; if (input != null && input.length() > maxLength) { return input.substring(0, maxLength); } return input; } }
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\notification\rule\trigger\EdgeCommunicationFailureTriggerProcessor.java
2
请完成以下Java代码
public static final class Page<E> { public static <E> Page<E> ofRows(final List<E> rows) { final Integer lastRow = null; return new Page<>(rows, lastRow); } public static <E> Page<E> ofRowsOrNull(final List<E> rows) { return rows != null && !rows.isEmpty() ? ofRows(rows) : null; } public static <E> Page<E> ofRowsAndLastRowIndex(final List<E> rows, final int lastRowZeroBased) { return new Page<>(rows, lastRowZeroBased); } private final List<E> rows; private final Integer lastRowZeroBased;
private Page(final List<E> rows, final Integer lastRowZeroBased) { Check.assumeNotEmpty(rows, "rows is not empty"); Check.assume(lastRowZeroBased == null || lastRowZeroBased >= 0, "lastRow shall be null, positive or zero"); this.rows = rows; this.lastRowZeroBased = lastRowZeroBased; } } /** Loads and provides the requested page */ @FunctionalInterface public interface PageFetcher<E> { /** * @param firstRow (first page is ZERO) * @param pageSize max rows to return * @return page or null in case there is no page */ Page<E> getPage(int firstRow, int pageSize); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\de\metas\util\collections\PagedIterator.java
1
请在Spring Boot框架中完成以下Java代码
static Configuration of(List<String> bootstrapServers, @Nullable SslBundle sslBundle, @Nullable String securityProtocol) { return new Configuration() { @Override public List<String> getBootstrapServers() { return bootstrapServers; } @Override public @Nullable SslBundle getSslBundle() { return sslBundle; } @Override public @Nullable String getSecurityProtocol() { return securityProtocol; } }; } /** * Returns the list of bootstrap servers. * @return the list of bootstrap servers */
List<String> getBootstrapServers(); /** * Returns the SSL bundle. * @return the SSL bundle */ default @Nullable SslBundle getSslBundle() { return null; } /** * Returns the security protocol. * @return the security protocol */ default @Nullable String getSecurityProtocol() { return null; } } }
repos\spring-boot-4.0.1\module\spring-boot-kafka\src\main\java\org\springframework\boot\kafka\autoconfigure\KafkaConnectionDetails.java
2
请在Spring Boot框架中完成以下Java代码
public class InstanceProfileAwsApplication { private static final Logger logger = LoggerFactory.getLogger(InstanceProfileAwsApplication.class); private static final String applicationConfig = "spring.config.name:application-instance-profile"; private static String bucketName; private static String fileName = "sample-file.txt"; private static void setupResources() { bucketName = "baeldung-test-" + UUID.randomUUID() .toString(); try { Files.write(Paths.get(fileName), "Hello World!".getBytes()); } catch (IOException e) { logger.error(e.getMessage(), e); } } public static void main(String[] args) { setupResources(); if (!new File(fileName).exists()) { logger.warn("Not able to create {} file. Check your folder permissions.", fileName);
System.exit(1); } SpringApplication application = new SpringApplicationBuilder(InstanceProfileAwsApplication.class).properties(applicationConfig) .build(); ConfigurableApplicationContext context = application.run(args); SpringCloudS3Service service = context.getBean(SpringCloudS3Service.class); // S3 bucket operations service.createBucket(bucketName); service.uploadObject(bucketName, fileName); service.downloadObject(bucketName, fileName); service.deleteBucket(bucketName); } }
repos\tutorials-master\spring-cloud-modules\spring-cloud-aws\src\main\java\com\baeldung\spring\cloud\aws\InstanceProfileAwsApplication.java
2
请完成以下Java代码
void skippingFirstElementInMapWithStreamSkip(Map<String, String> stringMap) { stringMap.entrySet().stream().skip(1).forEach(this::process); } void skippingFirstElementInListWithSubList(List<String> stringList) { for (final String element : stringList.subList(1, stringList.size())) { process(element); } } void skippingFirstElementInListWithForLoopWithAdditionalCheck(List<String> stringList) { for (int i = 0; i < stringList.size(); i++) { if (i == 0) { // do something else } else { process(stringList.get(i)); } } } void skippingFirstElementInListWithWhileLoopWithCounter(List<String> stringList) { int counter = 0; while (counter < stringList.size()) { if (counter != 0) { process(stringList.get(counter)); } ++counter;
} } void skippingFirstElementInListWithReduce(List<String> stringList) { stringList.stream().reduce((skip, element) -> { process(element); return element; }); } protected void process(String string) { System.out.println(string); } protected void process(Entry<String, String> mapEntry) { System.out.println(mapEntry); } }
repos\tutorials-master\core-java-modules\core-java-collections-5\src\main\java\com\baeldung\skippingfirstelement\SkipFirstElementExample.java
1
请完成以下Java代码
public Void execute(CommandContext commandContext) { JobEntity jobToDelete = null; for (String jobId : jobIds) { jobToDelete = commandContext .getJobEntityManager() .findJobById(jobId); if (jobToDelete != null) { if (commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) { commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent( ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.JOB_CANCELED, jobToDelete), EngineConfigurationConstants.KEY_PROCESS_ENGINE_CONFIG); } jobToDelete.delete(); } else {
TimerJobEntity timerJobToDelete = commandContext.getTimerJobEntityManager().findJobById(jobId); if (timerJobToDelete != null) { if (commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) { commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent( ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.JOB_CANCELED, timerJobToDelete), EngineConfigurationConstants.KEY_PROCESS_ENGINE_CONFIG); } timerJobToDelete.delete(); } } } return null; } }
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\cmd\CancelJobsCmd.java
1
请完成以下Java代码
protected void registerPermission(Permission perm, String permissionName) { Assert.notNull(perm, "Permission required"); Assert.hasText(permissionName, "Permission name required"); Integer mask = perm.getMask(); // Ensure no existing Permission uses this integer or code Assert.isTrue(!this.registeredPermissionsByInteger.containsKey(mask), () -> "An existing Permission already provides mask " + mask); Assert.isTrue(!this.registeredPermissionsByName.containsKey(permissionName), () -> "An existing Permission already provides name '" + permissionName + "'"); // Register the new Permission this.registeredPermissionsByInteger.put(mask, perm); this.registeredPermissionsByName.put(permissionName, perm); } @Override public Permission buildFromMask(int mask) { if (this.registeredPermissionsByInteger.containsKey(mask)) { // The requested mask has an exact match against a statically-defined // Permission, so return it return this.registeredPermissionsByInteger.get(mask); } // To get this far, we have to use a CumulativePermission CumulativePermission permission = new CumulativePermission(); for (int i = 0; i < 32; i++) { int permissionToCheck = 1 << i; if ((mask & permissionToCheck) == permissionToCheck) { Permission p = this.registeredPermissionsByInteger.get(permissionToCheck); Assert.state(p != null, () -> "Mask '" + permissionToCheck + "' does not have a corresponding static Permission"); permission.set(p); } } return permission; }
@Override public Permission buildFromName(String name) { Permission p = this.registeredPermissionsByName.get(name); Assert.notNull(p, "Unknown permission '" + name + "'"); return p; } @Override public List<Permission> buildFromNames(List<String> names) { if ((names == null) || names.isEmpty()) { return Collections.emptyList(); } List<Permission> permissions = new ArrayList<>(names.size()); for (String name : names) { permissions.add(buildFromName(name)); } return permissions; } }
repos\spring-security-main\acl\src\main\java\org\springframework\security\acls\domain\DefaultPermissionFactory.java
1
请完成以下Java代码
public String toString() { return "ImmutablePair [left=" + left + ", right=" + right + "]"; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((left == null) ? 0 : left.hashCode()); result = prime * result + ((right == null) ? 0 : right.hashCode()); return result; } @Override public boolean equals(final Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final ImmutablePair<?, ?> other = (ImmutablePair<?, ?>)obj; if (left == null) { if (other.left != null) return false; } else if (!left.equals(other.left)) return false; if (right == null) {
if (other.right != null) return false; } else if (!right.equals(other.right)) return false; return true; } @Override public LT getLeft() { return left; } @Override public RT getRight() { return right; } }
repos\metasfresh-new_dawn_uat\misc\de-metas-common\de-metas-common-util\src\main\java\de\metas\common\util\pair\ImmutablePair.java
1
请完成以下Java代码
private boolean isFailIfNoHUs() { return _failIfNoHUs; } public HUMoveToDirectWarehouseService setDocumentsCollection(final DocumentCollection documentsCollection) { this.documentsCollection = documentsCollection; return this; } public HUMoveToDirectWarehouseService setHUView(final HUEditorView huView) { this.huView = huView; return this; } private void notifyHUMoved(final I_M_HU hu) { final HuId huId = HuId.ofRepoId(hu.getM_HU_ID()); // // Invalidate all documents which are about this HU. if (documentsCollection != null) { try { documentsCollection.invalidateDocumentByRecordId(I_M_HU.Table_Name, huId.getRepoId()); } catch (final Exception ex) {
logger.warn("Failed invalidating documents for M_HU_ID={}. Ignored", huId, ex); } } // // Remove this HU from the view // Don't invalidate. We will do it at the end of all processing. // // NOTE/Later edit: we decided to not remove it anymore // because in some views it might make sense to keep it there. // The right way would be to check if after moving it, the HU is still elgible for view's filters. // // if (huView != null) { huView.removeHUIds(ImmutableSet.of(huId)); } } /** * @return target warehouse where the HUs will be moved to. */ @NonNull private LocatorId getTargetLocatorId() { if (_targetLocatorId == null) { _targetLocatorId = huMovementBL.getDirectMoveLocatorId(); } return _targetLocatorId; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\process\HUMoveToDirectWarehouseService.java
1
请完成以下Java代码
default java.util.Date get_ValueAsDate(final String variableName, @Nullable final java.util.Date defaultValue) { final Object valueObj = get_ValueAsObject(variableName); return convertToDate(variableName, valueObj, defaultValue); } /* private */ @Nullable static java.util.Date convertToDate(final String variableName, @Nullable final Object valueObj, @Nullable final java.util.Date defaultValue) { if (valueObj == null) { return defaultValue; } else if (TimeUtil.isDateOrTimeObject(valueObj)) { return TimeUtil.asDate(valueObj); } else { final String valueStr = valueObj.toString(); if (valueStr == null || valueStr.isEmpty()) { return defaultValue; } try { final Timestamp value = Env.parseTimestamp(valueStr); return value == null ? defaultValue : value; } catch (final Exception e) { LogManager.getLogger(Evaluatee.class).warn("Failed converting {}={} to Date. Returning default value: {}", variableName, valueStr, defaultValue, e); return defaultValue; } } } default Optional<Object> get_ValueIfExists(@NonNull final String variableName, @NonNull final Class<?> targetType) { if (Integer.class.equals(targetType) || int.class.equals(targetType)) { final Integer valueInt = get_ValueAsInt(variableName, null); return Optional.ofNullable(valueInt); } else if (java.util.Date.class.equals(targetType)) {
final java.util.Date valueDate = get_ValueAsDate(variableName, null); return Optional.ofNullable(valueDate); } else if (Timestamp.class.equals(targetType)) { final Timestamp valueDate = TimeUtil.asTimestamp(get_ValueAsDate(variableName, null)); return Optional.ofNullable(valueDate); } else if (Boolean.class.equals(targetType)) { final Boolean valueBoolean = get_ValueAsBoolean(variableName, null); return Optional.ofNullable(valueBoolean); } else { final Object valueObj = get_ValueAsObject(variableName); return Optional.ofNullable(valueObj); } } default Evaluatee andComposeWith(final Evaluatee other) { return Evaluatees.compose(this, other); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\util\Evaluatee.java
1
请完成以下Java代码
public <T> T execute(final CommandConfig config, final Command<T> command) { LOGGER.debug("Running command with propagation {}", config.getTransactionPropagation()); TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager); transactionTemplate.setPropagationBehavior(getPropagation(config)); T result = transactionTemplate.execute( new TransactionCallback<T>() { public T doInTransaction(TransactionStatus status) { return next.execute(config, command); } } ); return result; }
private int getPropagation(CommandConfig config) { switch (config.getTransactionPropagation()) { case NOT_SUPPORTED: return TransactionTemplate.PROPAGATION_NOT_SUPPORTED; case REQUIRED: return TransactionTemplate.PROPAGATION_REQUIRED; case REQUIRES_NEW: return TransactionTemplate.PROPAGATION_REQUIRES_NEW; default: throw new ActivitiIllegalArgumentException( "Unsupported transaction propagation: " + config.getTransactionPropagation() ); } } }
repos\Activiti-develop\activiti-core\activiti-spring\src\main\java\org\activiti\spring\SpringTransactionInterceptor.java
1
请在Spring Boot框架中完成以下Java代码
public void setQosEnabled(@Nullable Boolean qosEnabled) { this.qosEnabled = qosEnabled; } public @Nullable Duration getReceiveTimeout() { return this.receiveTimeout; } public void setReceiveTimeout(@Nullable Duration receiveTimeout) { this.receiveTimeout = receiveTimeout; } public Session getSession() { return this.session; } public static class Session { /** * Acknowledge mode used when creating sessions. */ private AcknowledgeMode acknowledgeMode = AcknowledgeMode.AUTO; /** * Whether to use transacted sessions. */ private boolean transacted; public AcknowledgeMode getAcknowledgeMode() { return this.acknowledgeMode; } public void setAcknowledgeMode(AcknowledgeMode acknowledgeMode) { this.acknowledgeMode = acknowledgeMode; } public boolean isTransacted() { return this.transacted; }
public void setTransacted(boolean transacted) { this.transacted = transacted; } } } public enum DeliveryMode { /** * Does not require that the message be logged to stable storage. This is the * lowest-overhead delivery mode but can lead to lost of message if the broker * goes down. */ NON_PERSISTENT(1), /* * Instructs the JMS provider to log the message to stable storage as part of the * client's send operation. */ PERSISTENT(2); private final int value; DeliveryMode(int value) { this.value = value; } public int getValue() { return this.value; } } }
repos\spring-boot-4.0.1\module\spring-boot-jms\src\main\java\org\springframework\boot\jms\autoconfigure\JmsProperties.java
2
请完成以下Java代码
private PPOrderCost toPPOrderCost(final I_PP_Order_Cost record) { final IProductCostingBL productCostingBL = Services.get(IProductCostingBL.class); final IAcctSchemaDAO acctSchemasRepo = Services.get(IAcctSchemaDAO.class); final AcctSchema acctSchema = acctSchemasRepo.getById(AcctSchemaId.ofRepoId(record.getC_AcctSchema_ID())); final ProductId productId = ProductId.ofRepoId(record.getM_Product_ID()); final CostSegmentAndElement costSegmentAndElement = CostSegmentAndElement.builder() .costingLevel(productCostingBL.getCostingLevel(productId, acctSchema)) .acctSchemaId(acctSchema.getId()) .costTypeId(acctSchema.getCosting().getCostTypeId()) .clientId(ClientId.ofRepoId(record.getAD_Client_ID())) .orgId(OrgId.ofRepoId(record.getAD_Org_ID())) .productId(productId) .attributeSetInstanceId(AttributeSetInstanceId.ofRepoIdOrNone(record.getM_AttributeSetInstance_ID())) .costElementId(CostElementId.ofRepoId(record.getM_CostElement_ID())) .build(); final PPOrderCostTrxType trxType = PPOrderCostTrxType.ofCode(record.getPP_Order_Cost_TrxType()); final Percent coProductCostDistributionPercent = trxType.isCoProduct() ? Percent.of(record.getCostDistributionPercent()) : null; final I_C_UOM uom = extractUOM(record); final CurrencyId currencyId = acctSchema.getCurrencyId(); return PPOrderCost.builder() .id(PPOrderCostId.ofRepoId(record.getPP_Order_Cost_ID()))
.trxType(trxType) .costSegmentAndElement(costSegmentAndElement) .price(CostPrice.builder() .ownCostPrice(CostAmount.of(record.getCurrentCostPrice(), currencyId)) .componentsCostPrice(CostAmount.of(record.getCurrentCostPriceLL(), currencyId)) .uomId(UomId.ofRepoId(uom.getC_UOM_ID())) .build()) .accumulatedAmount(CostAmount.of(record.getCumulatedAmt(), currencyId)) .accumulatedQty(Quantity.of(record.getCumulatedQty(), uom)) .postCalculationAmount(CostAmount.of(record.getPostCalculationAmt(), currencyId)) .coProductCostDistributionPercent(coProductCostDistributionPercent) .build(); } private I_C_UOM extractUOM(final I_PP_Order_Cost record) { return uomDAO.getById(record.getC_UOM_ID()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\api\impl\PPOrderCostDAO.java
1
请完成以下Java代码
public class KeycloakUserApiProvider implements RealmResourceProvider { private final KeycloakSession session; public KeycloakUserApiProvider(KeycloakSession session) { this.session = session; } public void close() { } public Object getResource() { return this; } @GET @Produces({ MediaType.APPLICATION_JSON }) public Stream<UserRepresentation> searchUsersByGroupAndRoleName(@QueryParam("groupName") @NotNull String groupName, @QueryParam("roleName") @NotBlank String roleName) {
RealmModel realm = session.getContext().getRealm(); Optional<GroupModel> groupByName = session.groups() .getGroupsStream(realm) .filter(group -> group.getName().equals(groupName)) .findAny(); GroupModel group = groupByName.orElseThrow(() -> new NotFoundException("Group not found with name " + groupName)); return session.users() .getGroupMembersStream(realm, group) .filter(user -> user.getRealmRoleMappingsStream().anyMatch(role -> role.getName().equals(roleName))) .map(user -> ModelToRepresentation.toBriefRepresentation(user)); } }
repos\tutorials-master\spring-boot-modules\spring-boot-keycloak-2\src\main\java\com\baeldung\keycloak\customendpoint\KeycloakUserApiProvider.java
1
请完成以下Java代码
public ProcessPreconditionsResolution checkPreconditionsApplicable(final IProcessPreconditionsContext context) { // Allow only single selection if (context.isNoSelection()) { return ProcessPreconditionsResolution.rejectBecauseNoSelection(); } else if (!context.isSingleSelection()) { return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection(); } return ProcessPreconditionsResolution.accept(); } @Param(parameterName = "AD_Image_ID", mandatory = true) private int p_AD_Image_ID; @Override protected String doIt() throws Exception {
final I_M_ReceiptSchedule receiptSchedule = getRecord(I_M_ReceiptSchedule.class); final MImage adImage = MImage.get(getCtx(), p_AD_Image_ID); if (adImage == null || adImage.getAD_Image_ID() <= 0) { throw new EntityNotFoundException("@NotFound@ @AD_Image_ID@: " + p_AD_Image_ID); } final String name = adImage.getName(); final byte[] data = adImage.getData(); final BufferedImage image = ImageIO.read(new ByteArrayInputStream(data)); Services.get(IHUReceiptScheduleBL.class).attachPhoto(receiptSchedule, name, image); return MSG_OK; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\process\WEBUI_M_ReceiptSchedule_AttachPhoto.java
1
请完成以下Java代码
public void close() throws Exception { if (scheduler != null && !scheduler.isShutdown()) { scheduler.shutdown(); } } private void createWatcherThread(CountDownLatch latch) { log.debug("creating watcher thread"); this.scheduler = Executors.newScheduledThreadPool(1); scheduler.scheduleAtFixedRate(() -> { try { log.trace("watcher: waiting for lock on possible pendingTag"); synchronized (pendingTag) { log.debug("watcher: checking pendingTag #{}/{}", pendingTag, scheduler.toString()); if (pendingTag.get() == 0) { return; } try { channel.basicAck(pendingTag.get(), true); log.info("watcher: acked up to #{}", pendingTag.get()); pendingTag.set(0); } catch (IOException e) { log.error("watcher error: acking up to #{}", pendingTag); } } } finally {
if (latch != null) { latch.countDown(); } } }, WATCHER_INTERVAL_SECONDS, WATCHER_INTERVAL_SECONDS, TimeUnit.SECONDS); } private boolean process(String message, long deliveryTag) { try { UUID.fromString(message); log.debug("* [#{}] processed: {}", deliveryTag, message); } catch (IllegalArgumentException e) { log.warn("* [#{}] invalid: {}", deliveryTag, message); return false; } return true; } }
repos\tutorials-master\messaging-modules\rabbitmq\src\main\java\com\baeldung\consumerackspubconfirms\UuidConsumer.java
1
请完成以下Java代码
static SslBundle systemDefault() { try { KeyManagerFactory keyManagerFactory = KeyManagerFactory .getInstance(KeyManagerFactory.getDefaultAlgorithm()); keyManagerFactory.init(null, null); TrustManagerFactory trustManagerFactory = TrustManagerFactory .getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init((KeyStore) null); SSLContext sslContext = SSLContext.getDefault(); return of(null, null, null, null, new SslManagerBundle() { @Override public KeyManagerFactory getKeyManagerFactory() { return keyManagerFactory; } @Override public TrustManagerFactory getTrustManagerFactory() {
return trustManagerFactory; } @Override public SSLContext createSslContext(String protocol) { return sslContext; } }); } catch (NoSuchAlgorithmException | KeyStoreException | UnrecoverableKeyException ex) { throw new IllegalStateException("Could not initialize system default SslBundle: " + ex.getMessage(), ex); } } }
repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\ssl\SslBundle.java
1
请完成以下Spring Boot application配置
server: port: 8088 minio: endpoint: http://127.0.0.1:9000 #Minio服务所在地址 bucketName: testbucket #存储桶名称 accessKey: rqvdgzBpBAYLpu9GzYdg #访问的k
ey secretKey: a00kFRjiyOks4D8Ms52cSxRHYiGx6cysbCpeI8p4 #访问的秘钥
repos\springboot-demo-master\minio\src\main\resources\application.yaml
2
请在Spring Boot框架中完成以下Java代码
public void setTenantId(String tenantId) { this.tenantId = tenantId; } @ApiModelProperty(example = "2") public String getDeploymentId() { return deploymentId; } public void setDeploymentId(String deploymentId) { this.deploymentId = deploymentId; } @ApiModelProperty(example = "http://localhost:8081/cmmn-repository/deployments/2") public String getDeploymentUrl() { return deploymentUrl; } public void setDeploymentUrl(String deploymentUrl) { this.deploymentUrl = deploymentUrl; } @ApiModelProperty(example = "Examples") public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } public void setResource(String resource) { this.resource = resource; } @ApiModelProperty(example = "http://localhost:8182/cmmn-repository/deployments/2/resources/testCase.cmmn", value = "Contains the actual deployed CMMN 1.1 xml.") public String getResource() { return resource; } @ApiModelProperty(example = "This is a case for testing purposes") public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public void setDiagramResource(String diagramResource) { this.diagramResource = diagramResource;
} @ApiModelProperty(example = "http://localhost:8182/cmmn-repository/deployments/2/resources/testProcess.png", value = "Contains a graphical representation of the case, null when no diagram is available.") public String getDiagramResource() { return diagramResource; } public void setGraphicalNotationDefined(boolean graphicalNotationDefined) { this.graphicalNotationDefined = graphicalNotationDefined; } @ApiModelProperty(value = "Indicates the case definition contains graphical information (CMMN DI).") public boolean isGraphicalNotationDefined() { return graphicalNotationDefined; } public void setStartFormDefined(boolean startFormDefined) { this.startFormDefined = startFormDefined; } public boolean isStartFormDefined() { return startFormDefined; } }
repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\repository\CaseDefinitionResponse.java
2
请完成以下Java代码
public static FormEngineConfigurationApi getFormEngineConfiguration(AbstractEngineConfiguration engineConfiguration) { return (FormEngineConfigurationApi) engineConfiguration.getEngineConfigurations().get(EngineConfigurationConstants.KEY_FORM_ENGINE_CONFIG); } public static FormRepositoryService getFormRepositoryService(ProcessEngineConfiguration processEngineConfiguration) { FormRepositoryService formRepositoryService = null; FormEngineConfigurationApi formEngineConfiguration = getFormEngineConfiguration(processEngineConfiguration); if (formEngineConfiguration != null) { formRepositoryService = formEngineConfiguration.getFormRepositoryService(); } return formRepositoryService; } public static FormService getFormService(AbstractEngineConfiguration engineConfiguration) { FormService formService = null; FormEngineConfigurationApi formEngineConfiguration = getFormEngineConfiguration(engineConfiguration); if (formEngineConfiguration != null) { formService = formEngineConfiguration.getFormService(); } return formService; } public static FormManagementService getFormManagementService(AbstractEngineConfiguration engineConfiguration) { FormManagementService formManagementService = null; FormEngineConfigurationApi formEngineConfiguration = getFormEngineConfiguration(engineConfiguration); if (formEngineConfiguration != null) { formManagementService = formEngineConfiguration.getFormManagementService();
} return formManagementService; } // CONTENT ENGINE public static ContentEngineConfigurationApi getContentEngineConfiguration(AbstractEngineConfiguration engineConfiguration) { return (ContentEngineConfigurationApi) engineConfiguration.getEngineConfigurations().get(EngineConfigurationConstants.KEY_CONTENT_ENGINE_CONFIG); } public static ContentService getContentService(AbstractEngineConfiguration engineConfiguration) { ContentService contentService = null; ContentEngineConfigurationApi contentEngineConfiguration = getContentEngineConfiguration(engineConfiguration); if (contentEngineConfiguration != null) { contentService = contentEngineConfiguration.getContentService(); } return contentService; } }
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\util\EngineServiceUtil.java
1
请完成以下Java代码
private String toStringObject(Object value, String indent) { return isPdxInstance(value) ? toString((PdxInstance) value, indent) : isArray(value) ? toStringArray(value, indent) : String.valueOf(value); } private String formatFieldValue(String fieldName, Object fieldValue) { return String.format(FIELD_TYPE_VALUE, fieldName, nullSafeType(fieldValue), fieldValue); } private boolean hasText(String value) { return value != null && !value.trim().isEmpty(); }
private boolean isArray(Object value) { return Objects.nonNull(value) && value.getClass().isArray(); } private boolean isPdxInstance(Object value) { return value instanceof PdxInstance; } private <T> List<T> nullSafeList(List<T> list) { return list != null ? list : Collections.emptyList(); } private Class<?> nullSafeType(Object value) { return value != null ? value.getClass() : Object.class; } }
repos\spring-boot-data-geode-main\spring-geode-project\apache-geode-extensions\src\main\java\org\springframework\geode\pdx\PdxInstanceWrapper.java
1
请完成以下Spring Boot application配置
server: port: 8081 servlet: context-path: / spring: application: name: product-service springdoc: api-docs: enabled: true path: /product/v3/ap
i-docs swagger-ui: enabled: true path: /product/swagger-ui.html
repos\tutorials-master\spring-cloud-modules\spring-cloud-gateway-3\spring-backend-service\src\main\resources\application.yml
2
请在Spring Boot框架中完成以下Java代码
public long getProfileWarnThreshold(ApiUsageRecordKey key) { return tenantProfileData.getConfiguration().getWarnThreshold(key); } private Pair<ApiFeature, ApiUsageStateValue> checkStateUpdatedDueToThreshold(ApiFeature feature) { ApiUsageStateValue featureValue = ApiUsageStateValue.ENABLED; for (ApiUsageRecordKey recordKey : ApiUsageRecordKey.getKeys(feature)) { long value = get(recordKey); boolean featureEnabled = getProfileFeatureEnabled(recordKey); ApiUsageStateValue tmpValue; if (featureEnabled) { long threshold = getProfileThreshold(recordKey); long warnThreshold = getProfileWarnThreshold(recordKey); if (threshold == 0 || value == 0 || value < warnThreshold) { tmpValue = ApiUsageStateValue.ENABLED; } else if (value < threshold) { tmpValue = ApiUsageStateValue.WARNING; } else { tmpValue = ApiUsageStateValue.DISABLED; } } else { tmpValue = ApiUsageStateValue.DISABLED; } featureValue = ApiUsageStateValue.toMoreRestricted(featureValue, tmpValue); } return setFeatureValue(feature, featureValue) ? Pair.of(feature, featureValue) : null; } public Map<ApiFeature, ApiUsageStateValue> checkStateUpdatedDueToThresholds() { return checkStateUpdatedDueToThreshold(new HashSet<>(Arrays.asList(ApiFeature.values())));
} public Map<ApiFeature, ApiUsageStateValue> checkStateUpdatedDueToThreshold(Set<ApiFeature> features) { Map<ApiFeature, ApiUsageStateValue> result = new HashMap<>(); for (ApiFeature feature : features) { Pair<ApiFeature, ApiUsageStateValue> tmp = checkStateUpdatedDueToThreshold(feature); if (tmp != null) { result.put(tmp.getFirst(), tmp.getSecond()); } } return result; } @Override public EntityType getEntityType() { return EntityType.TENANT; } }
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\apiusage\TenantApiUsageState.java
2
请在Spring Boot框架中完成以下Java代码
public void process(Exchange exchange) throws Exception { // NOTE: use the Header FILE_NAME instead of our context property // because that's dynamic and also the filename is not set when creating the context from CamelContext exchange.setProperty(Exchange.FILE_NAME, headerFileName.evaluate(exchange, String.class)); // exchange.setProperty(CONTEXT_EDIMessageDatePattern, EDIMessageDatePattern); exchange.setProperty(CONTEXT_AD_Client_Value, AD_Client_Value); exchange.setProperty(CONTEXT_AD_Org_ID, AD_Org_ID); exchange.setProperty(CONTEXT_ADInputDataDestination_InternalName, ADInputDataDestination_InternalName); exchange.setProperty(CONTEXT_ADInputDataSourceID, ADInputDataSourceID); exchange.setProperty(CONTEXT_ADUserEnteredByID, ADUserEnteredByID); exchange.setProperty(CONTEXT_DELIVERY_RULE, DeliveryRule); exchange.setProperty(CONTEXT_DELIVERY_VIA_RULE, DeliveryViaRule); // exchange.setProperty(CONTEXT_CurrencyISOCode, currencyISOCode); } }; } /** @return Excel filename which is currently imported */ public String getCamelFileName() { return CamelFileName; } // public String getEDIMessageDatePattern() // { // return EDIMessageDatePattern; // } public String getAD_Client_Value() { return AD_Client_Value; } public int getAD_Org_ID() { return AD_Org_ID; } public String getADInputDataDestination_InternalName()
{ return ADInputDataDestination_InternalName; } public BigInteger getADInputDataSourceID() { return ADInputDataSourceID; } public BigInteger getADUserEnteredByID() { return ADUserEnteredByID; } public String getDeliveryRule() { return DeliveryRule; } public String getDeliveryViaRule() { return DeliveryViaRule; } public String getCurrencyISOCode() { return currencyISOCode; } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java\de\metas\edi\esb\excelimport\ExcelConfigurationContext.java
2
请完成以下Java代码
public void setCarrier_ShipmentOrder_ID (final int Carrier_ShipmentOrder_ID) { if (Carrier_ShipmentOrder_ID < 1) set_Value (COLUMNNAME_Carrier_ShipmentOrder_ID, null); else set_Value (COLUMNNAME_Carrier_ShipmentOrder_ID, Carrier_ShipmentOrder_ID); } @Override public int getCarrier_ShipmentOrder_ID() { return get_ValueAsInt(COLUMNNAME_Carrier_ShipmentOrder_ID); } @Override public void setCarrier_ShipmentOrder_Log_ID (final int Carrier_ShipmentOrder_Log_ID) { if (Carrier_ShipmentOrder_Log_ID < 1) set_ValueNoCheck (COLUMNNAME_Carrier_ShipmentOrder_Log_ID, null); else set_ValueNoCheck (COLUMNNAME_Carrier_ShipmentOrder_Log_ID, Carrier_ShipmentOrder_Log_ID); } @Override public int getCarrier_ShipmentOrder_Log_ID() { return get_ValueAsInt(COLUMNNAME_Carrier_ShipmentOrder_Log_ID); } @Override public void setDurationMillis (final int DurationMillis) { set_Value (COLUMNNAME_DurationMillis, DurationMillis); } @Override public int getDurationMillis() { return get_ValueAsInt(COLUMNNAME_DurationMillis); } @Override public void setIsError (final boolean IsError) {
set_Value (COLUMNNAME_IsError, IsError); } @Override public boolean isError() { return get_ValueAsBoolean(COLUMNNAME_IsError); } @Override public void setRequestID (final java.lang.String RequestID) { set_Value (COLUMNNAME_RequestID, RequestID); } @Override public java.lang.String getRequestID() { return get_ValueAsString(COLUMNNAME_RequestID); } @Override public void setRequestMessage (final @Nullable java.lang.String RequestMessage) { set_Value (COLUMNNAME_RequestMessage, RequestMessage); } @Override public java.lang.String getRequestMessage() { return get_ValueAsString(COLUMNNAME_RequestMessage); } @Override public void setResponseMessage (final @Nullable java.lang.String ResponseMessage) { set_Value (COLUMNNAME_ResponseMessage, ResponseMessage); } @Override public java.lang.String getResponseMessage() { return get_ValueAsString(COLUMNNAME_ResponseMessage); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_Carrier_ShipmentOrder_Log.java
1
请完成以下Java代码
public boolean removeAll(Collection<?> c) { for (Object o : c) { if (!remove(o)) return false; } return true; } @Override public boolean retainAll(Collection<?> c) { return termFrequencyMap.values().retainAll(c); } @Override public void clear() { termFrequencyMap.clear(); } /** * 提取关键词(非线程安全) * * @param termList * @param size * @return */ @Override public List<String> getKeywords(List<Term> termList, int size) { clear(); add(termList); Collection<TermFrequency> topN = top(size); List<String> r = new ArrayList<String>(topN.size()); for (TermFrequency termFrequency : topN) {
r.add(termFrequency.getTerm()); } return r; } /** * 提取关键词(线程安全) * * @param document 文档内容 * @param size 希望提取几个关键词 * @return 一个列表 */ public static List<String> getKeywordList(String document, int size) { return new TermFrequencyCounter().getKeywords(document, size); } @Override public String toString() { final int max = 100; return top(Math.min(max, size())).toString(); } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\mining\word\TermFrequencyCounter.java
1
请完成以下Java代码
public void setDocumentNo (String DocumentNo) { set_Value (COLUMNNAME_DocumentNo, DocumentNo); } /** Get Document No. @return Document sequence number of the document */ public String getDocumentNo () { return (String)get_Value(COLUMNNAME_DocumentNo); } /** Get Record ID/ColumnName @return ID/ColumnName pair */ public KeyNamePair getKeyNamePair() { return new KeyNamePair(get_ID(), getDocumentNo()); } /** 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); } /** 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; }
/** Set Process Now. @param Processing Process Now */ public void setProcessing (boolean Processing) { set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing)); } /** Get Process Now. @return Process Now */ public boolean isProcessing () { Object oo = get_Value(COLUMNNAME_Processing); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Processing date. @param ProcessingDate Processing date */ public void setProcessingDate (Timestamp ProcessingDate) { set_Value (COLUMNNAME_ProcessingDate, ProcessingDate); } /** Get Processing date. @return Processing date */ public Timestamp getProcessingDate () { return (Timestamp)get_Value(COLUMNNAME_ProcessingDate); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_PaymentBatch.java
1
请完成以下Java代码
public class SecurityPolicy { private String name; private List<String> groups; private List<String> users; private String serviceName; private SecurityPolicyAccess access; private List<String> keys; public String getName() { return name; } public void setName(String name) { this.name = name; } public List<String> getGroups() { return groups; } public void setGroups(List<String> groups) { this.groups = groups; } public List<String> getUsers() { return users; } public void setUsers(List<String> users) { this.users = users;
} public String getServiceName() { return serviceName; } public void setServiceName(String serviceName) { this.serviceName = serviceName; } public SecurityPolicyAccess getAccess() { return access; } public void setAccess(SecurityPolicyAccess access) { this.access = access; } public List<String> getKeys() { return keys; } public void setKeys(List<String> keys) { this.keys = keys; } }
repos\Activiti-develop\activiti-core-common\activiti-spring-security-policies\src\main\java\org\activiti\core\common\spring\security\policies\SecurityPolicy.java
1
请完成以下Java代码
protected final SslBundle getSslBundle() { return WebServerSslBundle.get(this.ssl, this.sslBundles); } protected final Map<String, SslBundle> getServerNameSslBundles() { Assert.state(this.ssl != null, "'ssl' must not be null"); return this.ssl.getServerNameBundles() .stream() .collect(Collectors.toMap(ServerNameSslBundle::serverName, (serverNameSslBundle) -> { Assert.state(this.sslBundles != null, "'sslBundles' must not be null"); return this.sslBundles.getBundle(serverNameSslBundle.bundle()); })); } /** * Return the absolute temp dir for given web server. * @param prefix server name
* @return the temp dir for given server. */ protected final File createTempDir(String prefix) { try { File tempDir = Files.createTempDirectory(prefix + "." + getPort() + ".").toFile(); tempDir.deleteOnExit(); return tempDir; } catch (IOException ex) { throw new WebServerException( "Unable to create tempDir. java.io.tmpdir is set to " + System.getProperty("java.io.tmpdir"), ex); } } }
repos\spring-boot-4.0.1\module\spring-boot-web-server\src\main\java\org\springframework\boot\web\server\AbstractConfigurableWebServerFactory.java
1
请完成以下Java代码
public void addModelEditorSource(String modelId, byte[] bytes) { commandExecutor.execute(new AddEditorSourceForModelCmd(modelId, bytes)); } @Override public void addModelEditorSourceExtra(String modelId, byte[] bytes) { commandExecutor.execute(new AddEditorSourceExtraForModelCmd(modelId, bytes)); } @Override public ModelQuery createModelQuery() { return new ModelQueryImpl(commandExecutor); } @Override public NativeModelQuery createNativeModelQuery() { return new NativeModelQueryImpl(commandExecutor); } @Override public Model getModel(String modelId) { return commandExecutor.execute(new GetModelCmd(modelId)); } @Override public byte[] getModelEditorSource(String modelId) { return commandExecutor.execute(new GetModelEditorSourceCmd(modelId)); } @Override public byte[] getModelEditorSourceExtra(String modelId) { return commandExecutor.execute(new GetModelEditorSourceExtraCmd(modelId)); } @Override public void addCandidateStarterUser(String processDefinitionId, String userId) { commandExecutor.execute(new AddIdentityLinkForProcessDefinitionCmd(processDefinitionId, userId, null)); } @Override public void addCandidateStarterGroup(String processDefinitionId, String groupId) { commandExecutor.execute(new AddIdentityLinkForProcessDefinitionCmd(processDefinitionId, null, groupId)); } @Override public void deleteCandidateStarterGroup(String processDefinitionId, String groupId) { commandExecutor.execute(new DeleteIdentityLinkForProcessDefinitionCmd(processDefinitionId, null, groupId)); }
@Override public void deleteCandidateStarterUser(String processDefinitionId, String userId) { commandExecutor.execute(new DeleteIdentityLinkForProcessDefinitionCmd(processDefinitionId, userId, null)); } @Override public List<IdentityLink> getIdentityLinksForProcessDefinition(String processDefinitionId) { return commandExecutor.execute(new GetIdentityLinksForProcessDefinitionCmd(processDefinitionId)); } @Override public List<ValidationError> validateProcess(BpmnModel bpmnModel) { return commandExecutor.execute(new ValidateBpmnModelCmd(bpmnModel)); } @Override public List<DmnDecision> getDecisionsForProcessDefinition(String processDefinitionId) { return commandExecutor.execute(new GetDecisionsForProcessDefinitionCmd(processDefinitionId)); } @Override public List<FormDefinition> getFormDefinitionsForProcessDefinition(String processDefinitionId) { return commandExecutor.execute(new GetFormDefinitionsForProcessDefinitionCmd(processDefinitionId)); } }
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\RepositoryServiceImpl.java
1
请完成以下Java代码
public Builder accessToken(OAuth2Token accessToken) { this.accessToken = accessToken; return this; } /** * Builds a new {@link DPoPProofContext}. * @return a {@link DPoPProofContext} */ public DPoPProofContext build() { validate(); return new DPoPProofContext(this.dPoPProof, this.method, this.targetUri, this.accessToken); } private void validate() { Assert.hasText(this.method, "method cannot be empty"); Assert.hasText(this.targetUri, "targetUri cannot be empty"); if (!"GET".equals(this.method) && !"HEAD".equals(this.method) && !"POST".equals(this.method) && !"PUT".equals(this.method) && !"PATCH".equals(this.method) && !"DELETE".equals(this.method)
&& !"OPTIONS".equals(this.method) && !"TRACE".equals(this.method)) { throw new IllegalArgumentException("method is invalid"); } URI uri; try { uri = new URI(this.targetUri); uri.toURL(); } catch (Exception ex) { throw new IllegalArgumentException("targetUri must be a valid URL", ex); } if (uri.getQuery() != null || uri.getFragment() != null) { throw new IllegalArgumentException("targetUri cannot contain query or fragment parts"); } } } }
repos\spring-security-main\oauth2\oauth2-jose\src\main\java\org\springframework\security\oauth2\jwt\DPoPProofContext.java
1
请完成以下Java代码
public org.compiere.model.I_C_DocType getC_DocType() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_C_DocType_ID, org.compiere.model.I_C_DocType.class); } @Override public void setC_DocType(org.compiere.model.I_C_DocType C_DocType) { set_ValueFromPO(COLUMNNAME_C_DocType_ID, org.compiere.model.I_C_DocType.class, C_DocType); } /** Set Belegart. @param C_DocType_ID Document type or rules */ @Override public void setC_DocType_ID (int C_DocType_ID) {
if (C_DocType_ID < 0) set_ValueNoCheck (COLUMNNAME_C_DocType_ID, null); else set_ValueNoCheck (COLUMNNAME_C_DocType_ID, Integer.valueOf(C_DocType_ID)); } /** Get Belegart. @return Document type or rules */ @Override public int getC_DocType_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_C_DocType_ID); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Document_Action_Access.java
1
请完成以下Java代码
public org.compiere.model.I_C_UOM getC_UOM() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_C_UOM_ID, org.compiere.model.I_C_UOM.class); } @Override public void setC_UOM(org.compiere.model.I_C_UOM C_UOM) { set_ValueFromPO(COLUMNNAME_C_UOM_ID, org.compiere.model.I_C_UOM.class, C_UOM); } /** Set Maßeinheit. @param C_UOM_ID Unit of Measure */ @Override public void setC_UOM_ID (int C_UOM_ID) { if (C_UOM_ID < 1) set_ValueNoCheck (COLUMNNAME_C_UOM_ID, null); else set_ValueNoCheck (COLUMNNAME_C_UOM_ID, Integer.valueOf(C_UOM_ID)); } /** Get Maßeinheit. @return Unit of Measure */ @Override public int getC_UOM_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_C_UOM_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Rabatt %. @param Discount Discount in percent */ @Override public void setDiscount (java.math.BigDecimal Discount) { set_ValueNoCheck (COLUMNNAME_Discount, Discount); } /** Get Rabatt %. @return Discount in percent */ @Override public java.math.BigDecimal getDiscount () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Discount); if (bd == null) return BigDecimal.ZERO; return bd; } @Override public org.compiere.model.I_C_ValidCombination getPr() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_Price, org.compiere.model.I_C_ValidCombination.class); } @Override public void setPr(org.compiere.model.I_C_ValidCombination Pr) { set_ValueFromPO(COLUMNNAME_Price, org.compiere.model.I_C_ValidCombination.class, Pr); } /** Set Preis. @param Price Price */ @Override public void setPrice (int Price) { set_ValueNoCheck (COLUMNNAME_Price, Integer.valueOf(Price)); }
/** Get Preis. @return Price */ @Override public int getPrice () { Integer ii = (Integer)get_Value(COLUMNNAME_Price); if (ii == null) return 0; return ii.intValue(); } /** Set Menge. @param Qty Quantity */ @Override public void setQty (java.math.BigDecimal Qty) { set_ValueNoCheck (COLUMNNAME_Qty, Qty); } /** Get Menge. @return Quantity */ @Override public java.math.BigDecimal getQty () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty); if (bd == null) return BigDecimal.ZERO; return bd; } /** Set Symbol. @param UOMSymbol Symbol for a Unit of Measure */ @Override public void setUOMSymbol (java.lang.String UOMSymbol) { set_ValueNoCheck (COLUMNNAME_UOMSymbol, UOMSymbol); } /** Get Symbol. @return Symbol for a Unit of Measure */ @Override public java.lang.String getUOMSymbol () { return (java.lang.String)get_Value(COLUMNNAME_UOMSymbol); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.rfq\src\main\java-gen\de\metas\rfq\model\X_C_RfQResponseLineQty_v.java
1
请完成以下Java代码
public void setOperation (final java.lang.String Operation) { set_Value (COLUMNNAME_Operation, Operation); } @Override public java.lang.String getOperation() { return get_ValueAsString(COLUMNNAME_Operation); } @Override public void setProcessed (final boolean Processed) { set_Value (COLUMNNAME_Processed, Processed); } @Override public boolean isProcessed() { return get_ValueAsBoolean(COLUMNNAME_Processed); } @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); } @Override public void setValueDate (final @Nullable java.sql.Timestamp ValueDate) { set_Value (COLUMNNAME_ValueDate, ValueDate); } @Override public java.sql.Timestamp getValueDate() { return get_ValueAsTimestamp(COLUMNNAME_ValueDate); } @Override public void setValueDateInitial (final @Nullable java.sql.Timestamp ValueDateInitial) { set_Value (COLUMNNAME_ValueDateInitial, ValueDateInitial);
} @Override public java.sql.Timestamp getValueDateInitial() { return get_ValueAsTimestamp(COLUMNNAME_ValueDateInitial); } @Override public void setValueInitial (final @Nullable java.lang.String ValueInitial) { set_Value (COLUMNNAME_ValueInitial, ValueInitial); } @Override public java.lang.String getValueInitial() { return get_ValueAsString(COLUMNNAME_ValueInitial); } @Override public void setValueNumber (final @Nullable BigDecimal ValueNumber) { set_Value (COLUMNNAME_ValueNumber, ValueNumber); } @Override public BigDecimal getValueNumber() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_ValueNumber); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setValueNumberInitial (final @Nullable BigDecimal ValueNumberInitial) { set_Value (COLUMNNAME_ValueNumberInitial, ValueNumberInitial); } @Override public BigDecimal getValueNumberInitial() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_ValueNumberInitial); return bd != null ? bd : BigDecimal.ZERO; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java-gen\de\metas\handlingunits\model\X_M_HU_Trx_Attribute.java
1
请完成以下Java代码
public boolean isContinue() { return true; } } protected static final class SelectableRowAdapter { private final AnnotatedTableModel<?> tableModel; private final int rowModelIndex; private final int selectedColumnIndex; public SelectableRowAdapter(final AnnotatedTableModel<?> tableModel, final int rowModelIndex, final int selectedColumnIndex) { super(); this.tableModel = tableModel;
this.rowModelIndex = rowModelIndex; this.selectedColumnIndex = selectedColumnIndex; } public void setSelected(final boolean selected) { tableModel.setValueAt(selected, rowModelIndex, selectedColumnIndex); } public boolean isSelected() { final Object valueObj = tableModel.getValueAt(rowModelIndex, selectedColumnIndex); return DisplayType.toBoolean(valueObj); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\org\compiere\swing\table\AbstractManageSelectableRowsAction.java
1
请完成以下Java代码
public class SysComment implements Serializable { private static final long serialVersionUID = 1L; /**id*/ @TableId(type = IdType.ASSIGN_ID) @Schema(description = "id") private String id; /**表名*/ @Excel(name = "表名", width = 15) @Schema(description = "表名") private String tableName; /**数据id*/ @Excel(name = "数据id", width = 15) @Schema(description = "数据id") private String tableDataId; /**来源用户id*/ @Excel(name = "来源用户id", width = 15) @Schema(description = "来源用户id") @Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname") private String fromUserId; /**发送给用户id(允许为空)*/ @Excel(name = "发送给用户id(允许为空)", width = 15) @Schema(description = "发送给用户id(允许为空)") @Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname") private String toUserId; /**评论id(允许为空,不为空时,则为回复)*/ @Excel(name = "评论id(允许为空,不为空时,则为回复)", width = 15) @Schema(description = "评论id(允许为空,不为空时,则为回复)") @Dict(dictTable = "sys_comment", dicCode = "id", dicText = "comment_content") private String commentId; /**回复内容*/ @Excel(name = "回复内容", width = 15) @Schema(description = "回复内容") private String commentContent; /**创建人*/
@Schema(description = "创建人") private String createBy; /**创建日期*/ @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @Schema(description = "创建日期") private Date createTime; /**更新人*/ @Schema(description = "更新人") private String updateBy; /**更新日期*/ @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @Schema(description = "更新日期") private Date updateTime; /** * 不是数据库字段,用于评论跳转 */ @TableField(exist = false) private String tableId; }
repos\JeecgBoot-main\jeecg-boot\jeecg-module-system\jeecg-system-biz\src\main\java\org\jeecg\modules\system\entity\SysComment.java
1
请完成以下Java代码
public void setM_AttributeSetInstance_ID(final int M_AttributeSetInstance_ID) { throw new UnsupportedOperationException(); } @Override public void setQty(final BigDecimal qty) { infoWindow.setValueByColumnName(IHUPackingAware.COLUMNNAME_Qty_CU, rowIndexModel, qty); } @Override public BigDecimal getQty() { final BigDecimal qty = infoWindow.getValue(rowIndexModel, IHUPackingAware.COLUMNNAME_Qty_CU); return qty; } @Override public void setM_HU_PI_Item_Product_ID(final int huPiItemProductId) { throw new UnsupportedOperationException(); } @Override public int getM_HU_PI_Item_Product_ID() { final KeyNamePair huPiItemProductKNP = infoWindow.getValue(rowIndexModel, IHUPackingAware.COLUMNNAME_M_HU_PI_Item_Product_ID); if (huPiItemProductKNP == null) { return -1; } final int piItemProductId = huPiItemProductKNP.getKey(); if (piItemProductId <= 0) { return -1; } return piItemProductId; } @Override public BigDecimal getQtyTU() { final BigDecimal qty = infoWindow.getValue(rowIndexModel, IHUPackingAware.COLUMNNAME_QtyPacks); return qty; } @Override public void setQtyTU(final BigDecimal qtyPacks) { infoWindow.setValueByColumnName(IHUPackingAware.COLUMNNAME_QtyPacks, rowIndexModel, qtyPacks); } @Override public int getC_UOM_ID() { return Services.get(IProductBL.class).getStockUOMId(getM_Product_ID()).getRepoId(); }
@Override public void setC_UOM_ID(final int uomId) { throw new UnsupportedOperationException(); } @Override public void setC_BPartner_ID(final int partnerId) { throw new UnsupportedOperationException(); } @Override public int getC_BPartner_ID() { final KeyNamePair bpartnerKNP = infoWindow.getValue(rowIndexModel, IHUPackingAware.COLUMNNAME_C_BPartner_ID); return bpartnerKNP != null ? bpartnerKNP.getKey() : -1; } @Override public boolean isInDispute() { // there is no InDispute flag to be considered return false; } @Override public void setInDispute(final boolean inDispute) { throw new UnsupportedOperationException(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\adempiere\gui\search\impl\HUPackingAwareInfoWindowAdapter.java
1
请完成以下Java代码
public HttpStatusCode getStatusCode() { return statusCode; } public RateLimitConfig setStatusCode(HttpStatusCode statusCode) { this.statusCode = statusCode; return this; } public @Nullable Duration getTimeout() { return timeout; } public RateLimitConfig setTimeout(Duration timeout) { this.timeout = timeout; return this; } public int getTokens() { return tokens; } public RateLimitConfig setTokens(int tokens) { Assert.isTrue(tokens > 0, "tokens must be greater than zero"); this.tokens = tokens; return this;
} public String getHeaderName() { return headerName; } public RateLimitConfig setHeaderName(String headerName) { Objects.requireNonNull(headerName, "headerName may not be null"); this.headerName = headerName; return this; } } public static class FilterSupplier extends SimpleFilterSupplier { public FilterSupplier() { super(Bucket4jFilterFunctions.class); } } }
repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webmvc\src\main\java\org\springframework\cloud\gateway\server\mvc\filter\Bucket4jFilterFunctions.java
1
请完成以下Java代码
public int getTrxTimeoutSecs() { return 0; } @Override public boolean isTrxTimeoutLogOnly() { return false; } @Override public ITrxConstraints setMaxTrx(int max) { return this; } @Override public ITrxConstraints incMaxTrx(int num) { return this; } @Override public int getMaxTrx() { return 0; } @Override public int getMaxSavepoints() { return 0; } @Override public ITrxConstraints setMaxSavepoints(int maxSavePoints) { return this; } @Override public boolean isAllowTrxAfterThreadEnd() {
return false; } @Override public ITrxConstraints setAllowTrxAfterThreadEnd(boolean allow) { return this; } @Override public void reset() { } @Override public String toString() { return "TrxConstraints have been globally disabled. Add or change AD_SysConfig " + TrxConstraintsBL.SYSCONFIG_TRX_CONSTRAINTS_DISABLED + " to enable them"; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\util\trxConstraints\api\impl\TrxConstraintsDisabled.java
1
请完成以下Java代码
public static final class VirtualFilterChainDecorator implements FilterChainDecorator { /** * {@inheritDoc} */ @Override public FilterChain decorate(FilterChain original) { return original; } /** * {@inheritDoc} */ @Override public FilterChain decorate(FilterChain original, List<Filter> filters) { return new VirtualFilterChain(original, filters); } } private static final class FirewallFilter implements Filter {
private final HttpFirewall firewall; private FirewallFilter(HttpFirewall firewall) { this.firewall = firewall; } @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; filterChain.doFilter(this.firewall.getFirewalledRequest(request), this.firewall.getFirewalledResponse(response)); } } }
repos\spring-security-main\web\src\main\java\org\springframework\security\web\FilterChainProxy.java
1
请完成以下Java代码
public class ObjectType { @XmlMixed @XmlAnyElement(lax = true) protected List<Object> content; @XmlAttribute(name = "Id") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlID @XmlSchemaType(name = "ID") protected String id; @XmlAttribute(name = "MimeType") protected String mimeType; @XmlAttribute(name = "Encoding") @XmlSchemaType(name = "anyURI") protected String encoding; /** * Gets the value of the content 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 content property. * * <p> * For example, to add a new item, do as follows: * <pre> * getContent().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Element } * {@link Object } * {@link String } * * */ public List<Object> getContent() { if (content == null) { content = new ArrayList<Object>(); } return this.content; } /** * Gets the value of the id property. * * @return * possible object is * {@link String } * */ public String getId() { return id; } /** * Sets the value of the id property. * * @param value * allowed object is * {@link String } * */ public void setId(String value) { this.id = value; }
/** * Gets the value of the mimeType property. * * @return * possible object is * {@link String } * */ public String getMimeType() { return mimeType; } /** * Sets the value of the mimeType property. * * @param value * allowed object is * {@link String } * */ public void setMimeType(String value) { this.mimeType = value; } /** * Gets the value of the encoding property. * * @return * possible object is * {@link String } * */ public String getEncoding() { return encoding; } /** * Sets the value of the encoding property. * * @param value * allowed object is * {@link String } * */ public void setEncoding(String value) { this.encoding = 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\ObjectType.java
1
请完成以下Java代码
public class EmptyHUListener { private final transient Consumer<I_M_HU> consumer; private final String description; public static EmptyHUListener doBeforeDestroyed( @NonNull final Consumer<I_M_HU> consumer, @NonNull final String description) { return new EmptyHUListener(consumer, description); } public static EmptyHUListener doBeforeDestroyed(@NonNull final Consumer<I_M_HU> consumer) { final String description = null; return new EmptyHUListener(consumer, description); } public static EmptyHUListener collectDestroyedHUIdsTo(@NonNull final Collection<HuId> collector)
{ return doBeforeDestroyed(hu -> collector.add(HuId.ofRepoId(hu.getM_HU_ID()))); } private EmptyHUListener( @NonNull final Consumer<I_M_HU> consumer, @Nullable final String description) { this.consumer = consumer; this.description = description; } public void beforeDestroyEmptyHu(@NonNull final I_M_HU emptyHU) { consumer.accept(emptyHU); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\storage\EmptyHUListener.java
1
请完成以下Java代码
public class MuleTaskJsonConverter extends BaseBpmnJsonConverter { public static void fillTypes( Map<String, Class<? extends BaseBpmnJsonConverter>> convertersToBpmnMap, Map<Class<? extends BaseElement>, Class<? extends BaseBpmnJsonConverter>> convertersToJsonMap ) { fillJsonTypes(convertersToBpmnMap); fillBpmnTypes(convertersToJsonMap); } public static void fillJsonTypes(Map<String, Class<? extends BaseBpmnJsonConverter>> convertersToBpmnMap) { convertersToBpmnMap.put(STENCIL_TASK_MULE, MuleTaskJsonConverter.class); } public static void fillBpmnTypes( Map<Class<? extends BaseElement>, Class<? extends BaseBpmnJsonConverter>> convertersToJsonMap ) {} protected String getStencilId(BaseElement baseElement) { return STENCIL_TASK_MULE;
} protected void convertElementToJson(ObjectNode propertiesNode, BaseElement baseElement) { // done in service task } protected FlowElement convertJsonToElement( JsonNode elementNode, JsonNode modelNode, Map<String, JsonNode> shapeMap ) { ServiceTask task = new ServiceTask(); task.setType("mule"); addField("endpointUrl", PROPERTY_MULETASK_ENDPOINT_URL, elementNode, task); addField("language", PROPERTY_MULETASK_LANGUAGE, elementNode, task); addField("payloadExpression", PROPERTY_MULETASK_PAYLOAD_EXPRESSION, elementNode, task); addField("resultVariable", PROPERTY_MULETASK_RESULT_VARIABLE, elementNode, task); return task; } }
repos\Activiti-develop\activiti-core\activiti-json-converter\src\main\java\org\activiti\editor\language\json\converter\MuleTaskJsonConverter.java
1
请完成以下Java代码
protected AbstractJobEntity copyJobInfo(AbstractJobEntity copyToJob, AbstractJobEntity copyFromJob) { copyToJob.setDuedate(copyFromJob.getDuedate()); copyToJob.setEndDate(copyFromJob.getEndDate()); copyToJob.setExclusive(copyFromJob.isExclusive()); copyToJob.setExecutionId(copyFromJob.getExecutionId()); copyToJob.setId(copyFromJob.getId()); copyToJob.setJobHandlerConfiguration(copyFromJob.getJobHandlerConfiguration()); copyToJob.setJobHandlerType(copyFromJob.getJobHandlerType()); copyToJob.setJobType(copyFromJob.getJobType()); copyToJob.setExceptionMessage(copyFromJob.getExceptionMessage()); copyToJob.setExceptionStacktrace(copyFromJob.getExceptionStacktrace()); copyToJob.setMaxIterations(copyFromJob.getMaxIterations()); copyToJob.setProcessDefinitionId(copyFromJob.getProcessDefinitionId()); copyToJob.setProcessInstanceId(copyFromJob.getProcessInstanceId()); copyToJob.setRepeat(copyFromJob.getRepeat()); copyToJob.setRetries(copyFromJob.getRetries()); copyToJob.setRevision(copyFromJob.getRevision()); copyToJob.setTenantId(copyFromJob.getTenantId()); return copyToJob; } public ProcessEngineConfigurationImpl getProcessEngineConfiguration() { return processEngineConfiguration; } public void setProcessEngineConfiguration(ProcessEngineConfigurationImpl processEngineConfiguration) { this.processEngineConfiguration = processEngineConfiguration; }
protected boolean isAsyncExecutorActive() { return processEngineConfiguration.getAsyncExecutor().isActive(); } protected CommandContext getCommandContext() { return Context.getCommandContext(); } protected AsyncExecutor getAsyncExecutor() { return processEngineConfiguration.getAsyncExecutor(); } protected ExecutionEntityManager getExecutionEntityManager() { return processEngineConfiguration.getExecutionEntityManager(); } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\asyncexecutor\DefaultJobManager.java
1
请完成以下Java代码
public void addContent(DefaultMetadataElement element) { withWritableContent((content) -> content.add(element)); } public void setContent(List<DefaultMetadataElement> newContent) { withWritableContent((content) -> { content.clear(); content.addAll(newContent); }); } /** * Return the default element of this capability. */ @Override public DefaultMetadataElement getDefault() { return withReadableContent( (content) -> content.stream().filter(DefaultMetadataElement::isDefault).findFirst().orElse(null)); } /** * Return the element with the specified id or {@code null} if no such element exists. * @param id the ID of the element to find * @return the element or {@code null} */ public DefaultMetadataElement get(String id) { return withReadableContent( (content) -> content.stream().filter((it) -> id.equals(it.getId())).findFirst().orElse(null)); } @Override public void merge(List<DefaultMetadataElement> otherContent) {
withWritableContent((content) -> otherContent.forEach((it) -> { if (get(it.getId()) == null) { this.content.add(it); } })); } private <T> T withReadableContent(Function<List<DefaultMetadataElement>, T> consumer) { this.contentLock.readLock().lock(); try { return consumer.apply(this.content); } finally { this.contentLock.readLock().unlock(); } } private void withWritableContent(Consumer<List<DefaultMetadataElement>> consumer) { this.contentLock.writeLock().lock(); try { consumer.accept(this.content); } finally { this.contentLock.writeLock().unlock(); } } }
repos\initializr-main\initializr-metadata\src\main\java\io\spring\initializr\metadata\SingleSelectCapability.java
1
请完成以下Java代码
PickingJobLine withCurrentPickingTarget(@NonNull final CurrentPickingTarget currentPickingTarget) { return !CurrentPickingTarget.equals(this.currentPickingTarget, currentPickingTarget) ? toBuilder().currentPickingTarget(currentPickingTarget).build() : this; } PickingJobLine withCurrentPickingTarget(@NonNull final UnaryOperator<CurrentPickingTarget> currentPickingTargetMapper) { final CurrentPickingTarget changedCurrentPickingTarget = currentPickingTargetMapper.apply(this.currentPickingTarget); return !CurrentPickingTarget.equals(this.currentPickingTarget, changedCurrentPickingTarget) ? toBuilder().currentPickingTarget(changedCurrentPickingTarget).build() : this; }
public boolean isPickingSlotSet() {return currentPickingTarget.isPickingSlotSet();} public Optional<PickingSlotId> getPickingSlotId() {return currentPickingTarget.getPickingSlotId();} public PickingJobLine withPickingSlot(@Nullable final PickingSlotIdAndCaption pickingSlot) { return withCurrentPickingTarget(currentPickingTarget.withPickingSlot(pickingSlot)); } public boolean isFullyPicked() {return qtyRemainingToPick.signum() <= 0;} public boolean isFullyPickedExcludingRejectedQty() { return qtyToPick.subtract(qtyPicked).signum() <= 0; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\job\model\PickingJobLine.java
1
请完成以下Java代码
public void onComplete(final I_C_Invoice invoice) { invoiceDAO.retrieveLines(invoice).forEach(this::syncInvoiceLine); } @Override public void onReverse(final I_C_Invoice invoice) { invoiceDAO.retrieveLines(invoice).forEach(this::syncInvoiceLine); } @Override public void onReactivate(final I_C_Invoice invoice) { detailRepo.resetInvoicedQtyForInvoice(InvoiceId.ofRepoId(invoice.getC_Invoice_ID())); } private void syncInvoiceLine(@NonNull final I_C_InvoiceLine invoiceLine) { final FlatrateTermId flatrateTermId = FlatrateTermId.ofRepoIdOrNull(invoiceLine.getC_Flatrate_Term_ID()); if (flatrateTermId == null) { return; }
if (!callOrderContractService.isCallOrderContract(flatrateTermId)) { return; } callOrderContractService.validateCallOrderInvoiceLine(invoiceLine, flatrateTermId); final UpsertCallOrderDetailRequest request = UpsertCallOrderDetailRequest.builder() .callOrderContractId(flatrateTermId) .invoiceLine(invoiceLine) .build(); callOrderService.handleCallOrderDetailUpsert(request); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\callorder\detail\document\DocumentChangeHandler_Invoice.java
1
请完成以下Spring Boot application配置
spring.docker.compose.enabled=true spring.docker.compose.file=./connectiondetails/docker/docker-compose-cassandra.yml spring.docker.compose.skip.in-tests=false spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true spring.mustache.check-template-location=false spring.profiles.active=cassandra spring.cassandra.local-datacenter=dc1 #spring.cassandra.keyspace-name=spring_cassandra #spring.cassandra.schema-action=CREATE_IF_NOT_EXISTS spring.data.cassandra.request.timeout=20000 # Set your desired timeout in milliseconds spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration, org.springframework.boot.autoconfigure.data.mongo.MongoRepositoriesAutoConfiguration, org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration, org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration, org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration, org.springframework.boot.autoconfigure.data.r2dbc.R2dbcDataAutoConfiguration, org.springframework.boot.autoconfigure.data.r2dbc.R2dbcRepositoriesAutoConfiguration, org.springframework.boot.autoconfigure.r2dbc.R2dbcAutoConfiguration, org.springframework.boot.autoc
onfigure.data.neo4j.Neo4jDataAutoConfiguration, org.springframework.boot.autoconfigure.data.neo4j.Neo4jRepositoriesAutoConfiguration, org.springframework.boot.autoconfigure.neo4j.Neo4jAutoConfiguration, org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration, org.springframework.boot.autoconfigure.couchbase.CouchbaseAutoConfiguration, org.springframework.boot.autoconfigure.data.couchbase.CouchbaseDataAutoConfiguration, org.springframework.boot.autoconfigure.data.couchbase.CouchbaseRepositoriesAutoConfiguration
repos\tutorials-master\spring-boot-modules\spring-boot-3-2\src\main\resources\connectiondetails\application-cassandra.properties
2
请在Spring Boot框架中完成以下Java代码
public BigDecimal getBankRefundAmount() { return bankRefundAmount; } public void setBankRefundAmount(BigDecimal bankRefundAmount) { this.bankRefundAmount = bankRefundAmount; } public BigDecimal getBankFee() { return bankFee; } public void setBankFee(BigDecimal bankFee) { this.bankFee = bankFee; } public String getErrType() { return errType; } public void setErrType(String errType) { this.errType = errType == null ? null : errType.trim(); } public String getHandleStatus() { return handleStatus; } public void setHandleStatus(String handleStatus) { this.handleStatus = handleStatus == null ? null : handleStatus.trim(); } public String getHandleValue() { return handleValue; } public void setHandleValue(String handleValue) { this.handleValue = handleValue == null ? null : handleValue.trim(); }
public String getHandleRemark() { return handleRemark; } public void setHandleRemark(String handleRemark) { this.handleRemark = handleRemark == null ? null : handleRemark.trim(); } public String getOperatorName() { return operatorName; } public void setOperatorName(String operatorName) { this.operatorName = operatorName == null ? null : operatorName.trim(); } public String getOperatorAccountNo() { return operatorAccountNo; } public void setOperatorAccountNo(String operatorAccountNo) { this.operatorAccountNo = operatorAccountNo == null ? null : operatorAccountNo.trim(); } }
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\reconciliation\entity\RpAccountCheckMistake.java
2