instruction
string
input
string
output
string
source_file
string
priority
int64
请完成以下Java代码
private EventLogId getEventLogIdUsingCacheOutOfTrx(@NonNull final UUID uuid) { final Collection<EventLogId> eventLogIds = getEventLogIdsUsingCacheOutOfTrx(ImmutableSet.of(uuid)); if (eventLogIds.isEmpty()) { throw new AdempiereException("No EventLog found for " + uuid); } else { if (eventLogIds.size() > 1) // shall not happen { logger.warn("More than one EventLogId found for {}: {}. Returning first one.", uuid, eventLogIds); } return eventLogIds.iterator().next(); } } private Collection<EventLogId> getEventLogIdsUsingCacheOutOfTrx(@NonNull final Collection<UUID> uuids) { return uuid2eventLogId.getAllOrLoad(uuids, this::retrieveAllRecordIdOutOfTrx); } private ImmutableMap<UUID, EventLogId> retrieveAllRecordIdOutOfTrx(@NonNull final Collection<UUID> uuids) { if (uuids.isEmpty()) { return ImmutableMap.of(); } final ImmutableSet<String> uuidStrs = uuids.stream().map(UUID::toString).collect(ImmutableSet.toImmutableSet()); return Services.get(IQueryBL.class)
.createQueryBuilderOutOfTrx(I_AD_EventLog.class) .addOnlyActiveRecordsFilter() .addInArrayFilter(I_AD_EventLog.COLUMN_Event_UUID, uuidStrs) .orderBy(I_AD_EventLog.COLUMN_AD_EventLog_ID) // just to have a predictable order .create() .listColumns(I_AD_EventLog.COLUMNNAME_AD_EventLog_ID, I_AD_EventLog.COLUMNNAME_Event_UUID) .stream() .map(map -> { final int eventLogRepoId = NumberUtils.asInt(map.get(I_AD_EventLog.COLUMNNAME_AD_EventLog_ID), -1); final EventLogId eventLogId = EventLogId.ofRepoId(eventLogRepoId); final UUID uuid = UUID.fromString(map.get(I_AD_EventLog.COLUMNNAME_Event_UUID).toString()); return GuavaCollectors.entry(uuid, eventLogId); }) .collect(GuavaCollectors.toImmutableMap()); } private void updateUpdateEventLogErrorFlagFromEntries(@NonNull final Set<EventLogId> eventLogsWithError) { if (eventLogsWithError.isEmpty()) { return; } Services.get(IQueryBL.class) .createQueryBuilderOutOfTrx(I_AD_EventLog.class) .addInArrayFilter(I_AD_EventLog.COLUMNNAME_AD_EventLog_ID, eventLogsWithError) .create() .updateDirectly() .addSetColumnValue(I_AD_EventLog.COLUMNNAME_IsError, true) .execute(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\event\log\EventLogsRepository.java
1
请完成以下Java代码
public Integer getAttendCount() { return attendCount; } public void setAttendCount(Integer attendCount) { this.attendCount = attendCount; } public Integer getFansCount() { return fansCount; } public void setFansCount(Integer fansCount) { this.fansCount = fansCount; } public Integer getCollectProductCount() { return collectProductCount; } public void setCollectProductCount(Integer collectProductCount) { this.collectProductCount = collectProductCount; } public Integer getCollectSubjectCount() { return collectSubjectCount; } public void setCollectSubjectCount(Integer collectSubjectCount) { this.collectSubjectCount = collectSubjectCount; } public Integer getCollectTopicCount() { return collectTopicCount; } public void setCollectTopicCount(Integer collectTopicCount) { this.collectTopicCount = collectTopicCount; } public Integer getCollectCommentCount() { return collectCommentCount; } public void setCollectCommentCount(Integer collectCommentCount) { this.collectCommentCount = collectCommentCount; } public Integer getInviteFriendCount() { return inviteFriendCount; } public void setInviteFriendCount(Integer inviteFriendCount) { this.inviteFriendCount = inviteFriendCount; } public Date getRecentOrderTime() { return recentOrderTime; }
public void setRecentOrderTime(Date recentOrderTime) { this.recentOrderTime = recentOrderTime; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); sb.append(", memberId=").append(memberId); sb.append(", consumeAmount=").append(consumeAmount); sb.append(", orderCount=").append(orderCount); sb.append(", couponCount=").append(couponCount); sb.append(", commentCount=").append(commentCount); sb.append(", returnOrderCount=").append(returnOrderCount); sb.append(", loginCount=").append(loginCount); sb.append(", attendCount=").append(attendCount); sb.append(", fansCount=").append(fansCount); sb.append(", collectProductCount=").append(collectProductCount); sb.append(", collectSubjectCount=").append(collectSubjectCount); sb.append(", collectTopicCount=").append(collectTopicCount); sb.append(", collectCommentCount=").append(collectCommentCount); sb.append(", inviteFriendCount=").append(inviteFriendCount); sb.append(", recentOrderTime=").append(recentOrderTime); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); } }
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\UmsMemberStatisticsInfo.java
1
请完成以下Java代码
public void setM_InOutLine_ID (final int M_InOutLine_ID) { if (M_InOutLine_ID < 1) set_Value (COLUMNNAME_M_InOutLine_ID, null); else set_Value (COLUMNNAME_M_InOutLine_ID, M_InOutLine_ID); } @Override public int getM_InOutLine_ID() { return get_ValueAsInt(COLUMNNAME_M_InOutLine_ID); } @Override public void setQtyDeliveredInUOM (final @Nullable BigDecimal QtyDeliveredInUOM) { set_Value (COLUMNNAME_QtyDeliveredInUOM, QtyDeliveredInUOM); } @Override public BigDecimal getQtyDeliveredInUOM() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyDeliveredInUOM); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setQtyEntered (final @Nullable BigDecimal QtyEntered) { set_Value (COLUMNNAME_QtyEntered, QtyEntered); } @Override public BigDecimal getQtyEntered()
{ final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyEntered); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setQtyInvoicedInUOM (final @Nullable BigDecimal QtyInvoicedInUOM) { set_Value (COLUMNNAME_QtyInvoicedInUOM, QtyInvoicedInUOM); } @Override public BigDecimal getQtyInvoicedInUOM() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyInvoicedInUOM); return bd != null ? bd : BigDecimal.ZERO; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java-gen\de\metas\contracts\model\X_C_CallOrderDetail.java
1
请完成以下Java代码
void okB_actionPerformed(ActionEvent e) { this.dispose(); } void cancelB_actionPerformed(ActionEvent e) { CANCELLED = true; this.dispose(); } void tdBgcolorB_actionPerformed(ActionEvent e) { Color c = JColorChooser.showDialog(this, Local.getString("Table cell background color"), Util.decodeColor(tdBgcolorField.getText())); if (c == null) return; tdBgcolorField.setText(Util.encodeColor(c)); Util.setBgcolorField(tdBgcolorField); }
void trBgcolorB_actionPerformed(ActionEvent e) { Color c = JColorChooser.showDialog(this, Local.getString("Table row background color"), Util.decodeColor(trBgcolorField.getText())); if (c == null) return; trBgcolorField.setText(Util.encodeColor(c)); Util.setBgcolorField(trBgcolorField); } void bgColorB_actionPerformed(ActionEvent e) { Color c = JColorChooser.showDialog(this, Local.getString("Table background color"), Util.decodeColor(bgcolorField.getText())); if (c == null) return; bgcolorField.setText(Util.encodeColor(c)); Util.setBgcolorField(bgcolorField); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\net\sf\memoranda\ui\htmleditor\TdDialog.java
1
请完成以下Java代码
public Builder put(final String columnName, final ICalloutInstance callout) { if (callout == null) { logger.warn("Skip adding callout for ColumnName={} to map because it's null", columnName); return this; } final ArrayKey calloutKey = mkCalloutKey(columnName, callout); if (!seenCalloutKeys.add(calloutKey)) { logger.warn("Skip adding callout {} with key '{}' to map because was already added", callout, calloutKey); return this; } calloutsByColumn.put(columnName, callout); return this; } public Builder putAll(final ListMultimap<String, ICalloutInstance> calloutsByColumn) { if (calloutsByColumn == null || calloutsByColumn.isEmpty()) { return this; } for (final Entry<String, ICalloutInstance> entry : calloutsByColumn.entries()) { put(entry.getKey(), entry.getValue()); } return this; } public Builder putAll(final Map<String, List<ICalloutInstance>> calloutsByColumn) { if (calloutsByColumn == null || calloutsByColumn.isEmpty()) { return this; } for (final Entry<String, List<ICalloutInstance>> entry : calloutsByColumn.entrySet()) { final List<ICalloutInstance> callouts = entry.getValue(); if (callouts == null || callouts.isEmpty())
{ continue; } final String columnName = entry.getKey(); for (final ICalloutInstance callout : callouts) { put(columnName, callout); } } return this; } public Builder putAll(final TableCalloutsMap callouts) { if (callouts == null || callouts.isEmpty()) { return this; } putAll(callouts.calloutsByColumn); return this; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\callout\api\TableCalloutsMap.java
1
请完成以下Java代码
public EventModel getEventModelByKeyAndParentDeploymentId(String eventDefinitionKey, String parentDeploymentId) { return commandExecutor.execute(new GetEventModelCmd(eventDefinitionKey, null, parentDeploymentId)); } @Override public EventModel getEventModelByKeyAndParentDeploymentId(String eventDefinitionKey, String parentDeploymentId, String tenantId) { return commandExecutor.execute(new GetEventModelCmd(eventDefinitionKey, tenantId, parentDeploymentId)); } @Override public ChannelModel getChannelModelById(String channelDefinitionId) { return commandExecutor.execute(new GetChannelModelCmd(null, channelDefinitionId)); } @Override public ChannelModel getChannelModelByKey(String channelDefinitionKey) { return commandExecutor.execute(new GetChannelModelCmd(channelDefinitionKey, null)); } @Override public ChannelModel getChannelModelByKey(String channelDefinitionKey, String tenantId) { return commandExecutor.execute(new GetChannelModelCmd(channelDefinitionKey, tenantId, null)); } @Override public ChannelModel getChannelModelByKeyAndParentDeploymentId(String channelDefinitionKey, String parentDeploymentId) { return commandExecutor.execute(new GetChannelModelCmd(channelDefinitionKey, null, parentDeploymentId)); } @Override public ChannelModel getChannelModelByKeyAndParentDeploymentId(String channelDefinitionKey, String parentDeploymentId, String tenantId) { return commandExecutor.execute(new GetChannelModelCmd(channelDefinitionKey, tenantId, parentDeploymentId)); } @Override public EventModelBuilder createEventModelBuilder() {
return new EventModelBuilderImpl(this, eventRegistryEngineConfiguration.getEventJsonConverter()); } @Override public InboundChannelModelBuilder createInboundChannelModelBuilder() { return new InboundChannelDefinitionBuilderImpl(this, eventRegistryEngineConfiguration.getChannelJsonConverter()); } @Override public OutboundChannelModelBuilder createOutboundChannelModelBuilder() { return new OutboundChannelDefinitionBuilderImpl(this, eventRegistryEngineConfiguration.getChannelJsonConverter()); } public void registerEventModel(EventModel eventModel) { } }
repos\flowable-engine-main\modules\flowable-event-registry\src\main\java\org\flowable\eventregistry\impl\EventRepositoryServiceImpl.java
1
请完成以下Java代码
public void afterPropertiesSet() throws Exception { mergeSubscriptionWithProperties(); super.afterPropertiesSet(); } @Override protected Predicate<ApplicationEvent> isEventThatCanStartSubscription() { return event -> event instanceof ApplicationStartedEvent; } protected void mergeSubscriptionWithProperties() { SubscriptionConfiguration merge = getSubscriptionConfiguration(); String topicName = merge.getTopicName(); SubscriptionConfiguration subscriptionProperties = clientProperties.findSubscriptionPropsByTopicName(topicName); if (subscriptionProperties != null) { if (subscriptionProperties.getAutoOpen() != null) { merge.setAutoOpen(subscriptionProperties.getAutoOpen()); } if (subscriptionProperties.getLockDuration() != null) { merge.setLockDuration(subscriptionProperties.getLockDuration()); } if (subscriptionProperties.getVariableNames() != null) { merge.setVariableNames(subscriptionProperties.getVariableNames()); } if (subscriptionProperties.getBusinessKey() != null) { merge.setBusinessKey(subscriptionProperties.getBusinessKey()); } if (subscriptionProperties.getProcessDefinitionId() != null) { merge.setProcessDefinitionId(subscriptionProperties.getProcessDefinitionId()); } if (subscriptionProperties.getProcessDefinitionIdIn() != null) { merge.setProcessDefinitionIdIn(subscriptionProperties.getProcessDefinitionIdIn()); } if (subscriptionProperties.getProcessDefinitionKey() != null) { merge.setProcessDefinitionKey(subscriptionProperties.getProcessDefinitionKey()); } if (subscriptionProperties.getProcessDefinitionKeyIn() != null) { merge.setProcessDefinitionKeyIn(subscriptionProperties.getProcessDefinitionKeyIn()); }
if (subscriptionProperties.getProcessDefinitionVersionTag() != null) { merge.setProcessDefinitionVersionTag(subscriptionProperties.getProcessDefinitionVersionTag()); } if (subscriptionProperties.getProcessVariables() != null) { merge.setProcessVariables(subscriptionProperties.getProcessVariables()); } if (subscriptionProperties.getWithoutTenantId() != null) { merge.setWithoutTenantId(subscriptionProperties.getWithoutTenantId()); } if (subscriptionProperties.getTenantIdIn() != null) { merge.setTenantIdIn(subscriptionProperties.getTenantIdIn()); } if (subscriptionProperties.getIncludeExtensionProperties() != null) { merge.setIncludeExtensionProperties(subscriptionProperties.getIncludeExtensionProperties()); } setSubscriptionConfiguration(merge); } } }
repos\camunda-bpm-platform-master\spring-boot-starter\starter-client\spring-boot\src\main\java\org\camunda\bpm\client\spring\boot\starter\impl\PropertiesAwareSpringTopicSubscription.java
1
请完成以下Java代码
protected boolean beforeSave(boolean newRecord) { if (newRecord && getParent().isComplete()) { throw new AdempiereException("@ParentComplete@ @M_MovementLine_ID@"); } // Set Line No if (getLine() == 0) { final String sql = "SELECT COALESCE(MAX(Line),0)+10 AS DefaultValue FROM M_MovementLine WHERE M_Movement_ID=?"; final int nextLineNo = DB.getSQLValueEx(get_TrxName(), sql, getM_Movement_ID()); setLine(nextLineNo); } // either movement between locator or movement between lot if (getM_Locator_ID() == getM_LocatorTo_ID() && getM_AttributeSetInstance_ID() == getM_AttributeSetInstanceTo_ID()) { throw new AdempiereException("@M_Locator_ID@ == @M_LocatorTo_ID@ and @M_AttributeSetInstance_ID@ == @M_AttributeSetInstanceTo_ID@") .setParameter("M_Locator_ID", getM_Locator()) .setParameter("M_LocatorTo_ID", getM_LocatorTo()) .setParameter("M_AttributeSetInstance_ID", getM_AttributeSetInstance()) .setParameter("M_AttributeSetInstanceTo_ID", getM_AttributeSetInstanceTo()); } if (getMovementQty().signum() == 0) { if (MMovement.DOCACTION_Void.equals(getParent().getDocAction()) && (MMovement.DOCSTATUS_Drafted.equals(getParent().getDocStatus()) || MMovement.DOCSTATUS_Invalid.equals(getParent().getDocStatus()) || MMovement.DOCSTATUS_InProgress.equals(getParent().getDocStatus()) || MMovement.DOCSTATUS_Approved.equals(getParent().getDocStatus()) || MMovement.DOCSTATUS_NotApproved.equals(getParent().getDocStatus()))) { // [ 2092198 ] Error voiding an Inventory Move - globalqss // zero allowed in this case (action Void and status Draft) } else { throw new FillMandatoryException(I_M_MovementLine.COLUMNNAME_MovementQty); } } // Qty Precision if (newRecord || is_ValueChanged(COLUMNNAME_MovementQty)) { setMovementQty(getMovementQty()); } return true; } // beforeSave /** * Set M_Locator_ID * * @param M_Locator_ID id
*/ @Override public void setM_Locator_ID(int M_Locator_ID) { if (M_Locator_ID < 0) throw new IllegalArgumentException("M_Locator_ID is mandatory."); // set to 0 explicitly to reset set_Value(COLUMNNAME_M_Locator_ID, M_Locator_ID); } // setM_Locator_ID /** * Set M_LocatorTo_ID * * @param M_LocatorTo_ID id */ @Override public void setM_LocatorTo_ID(int M_LocatorTo_ID) { if (M_LocatorTo_ID < 0) throw new IllegalArgumentException("M_LocatorTo_ID is mandatory."); // set to 0 explicitly to reset set_Value(COLUMNNAME_M_LocatorTo_ID, M_LocatorTo_ID); } // M_LocatorTo_ID @Override public String toString() { return Table_Name + "[" + get_ID() + ", M_Product_ID=" + getM_Product_ID() + ", M_ASI_ID=" + getM_AttributeSetInstance_ID() + ", M_ASITo_ID=" + getM_AttributeSetInstanceTo_ID() + ", M_Locator_ID=" + getM_Locator_ID() + ", M_LocatorTo_ID=" + getM_LocatorTo_ID() + "]"; } } // MMovementLine
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\MMovementLine.java
1
请完成以下Java代码
public final class JSONAddressLayout implements Serializable { public static JSONAddressLayout of(final AddressLayout layout, final JSONDocumentLayoutOptions options) { return new JSONAddressLayout(layout, options); } @JsonProperty("elements") @JsonInclude(JsonInclude.Include.NON_EMPTY) private final List<JSONDocumentLayoutElement> elements; public JSONAddressLayout(final AddressLayout layout, final JSONDocumentLayoutOptions options) { super(); elements = JSONDocumentLayoutElement.ofList(layout.getElements(), options);
} @Override public String toString() { return MoreObjects.toStringHelper(this) .add("elements", elements) .toString(); } public List<JSONDocumentLayoutElement> getElements() { return elements; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\address\json\JSONAddressLayout.java
1
请完成以下Java代码
public Optional<ApiResponseAudit> getLatestByRequestId(@NonNull final ApiRequestAuditId apiRequestAuditId) { return queryBL.createQueryBuilder(I_API_Response_Audit.class) .addEqualsFilter(I_API_Response_Audit.COLUMNNAME_API_Request_Audit_ID, apiRequestAuditId.getRepoId()) .orderByDescending(I_API_Response_Audit.COLUMN_API_Response_Audit_ID) .create() .firstOptional() .map(this::recordToResponseAudit); } public void delete(@NonNull final ApiResponseAuditId apiResponseAuditId) { final I_API_Response_Audit record = InterfaceWrapperHelper.load(apiResponseAuditId, I_API_Response_Audit.class); InterfaceWrapperHelper.deleteRecord(record); }
@NonNull private ApiResponseAudit recordToResponseAudit(@NonNull final I_API_Response_Audit record) { return ApiResponseAudit.builder() .orgId(OrgId.ofRepoId(record.getAD_Org_ID())) .apiRequestAuditId(ApiRequestAuditId.ofRepoId(record.getAPI_Request_Audit_ID())) .apiResponseAuditId(ApiResponseAuditId.ofRepoId(record.getAPI_Response_Audit_ID())) .body(record.getBody()) .httpCode(record.getHttpCode()) .time(TimeUtil.asInstant(record.getTime())) .httpHeaders(record.getHttpHeaders()) .build(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\audit\apirequest\response\ApiResponseAuditRepository.java
1
请完成以下Java代码
public class PosterUtil { public static String ossDomain="http://qdliuhaihua.oss-cn-qingdao-internal.aliyuncs.com/"; public static void main(String[] args) throws Exception{ //String in1pathString = PosterUtil.class.getResource("/static/css/fonts/simkai.ttf").getFile(); //System.out.printf(in1pathString); test(); } public static byte[] test() throws IOException, IllegalAccessException, FontFormatException { // 测试注解, 这里读取图片如果不成功,请查看target 或者 out 目录下是否加载了资源。 如需使用,请引入spring core依赖 BufferedImage background = ImageIO.read(new URL("http://image.liuhaihua.cn/bg.jpg")); File file2= new File("/Users/liuhaihua/Downloads/2.jpg"); BufferedImage mainImage = ImageIO.read(file2); BufferedImage siteSlogon = ImageIO.read(new URL("http://image.liuhaihua.cn/site.jpg")); BufferedImage xx = ImageIO.read(new URL("http://image.liuhaihua.cn/xx.jpg")); File file5= new File("/Users/liuhaihua/IdeaProjects/springboot-demo/poster/src/main/resources/image/wx_300px.png"); BufferedImage qrcode = ImageIO.read(file5); SamplePoster poster = SamplePoster.builder() .backgroundImage(background) .postQrcode(qrcode) .xuxian(xx)
.siteSlogon(siteSlogon) .postTitle("Java generate poster in 5 miniutes") .postDate("2022年11月14日 pm1:23 Author:Harries") .posttitleDesc("Demand Background\u200B We often encounter such a demand in multi-terminal application development: when users browse products, they feel good and want to share them with friends. At this time, the terminal (Android, Apple, H5, etc.) generates a beautiful product poster and shares it with others through WeChat or other channels. You may also encounter the demand: make a personal business card and print it out or share it with others. The effect is probably like this: It may also be like this (the above pictures are all mine...") .mainImage(mainImage) .build(); PosterDefaultImpl<SamplePoster> impl = new PosterDefaultImpl<>(); BufferedImage test = impl.annotationDrawPoster(poster).draw(null); //ImageIO.write(test,"png",new FileOutputStream("/Users/liuhaihua/annTest.png")); ByteArrayOutputStream stream = new ByteArrayOutputStream(); ImageIO.write(test, "png", stream); return stream.toByteArray(); } }
repos\springboot-demo-master\poster\src\main\java\com\et\poster\service\PosterUtil.java
1
请完成以下Spring Boot application配置
server: port: 8095 servlet: session: timeout: 30 spring: application: name: roncoo-pay-app-notify logging: config: classpath:logback.
xml mybatis: mapper-locations: classpath*:mybatis/mapper/**/*.xml
repos\roncoo-pay-master\roncoo-pay-app-notify\src\main\resources\application.yml
2
请完成以下Java代码
public int getPay_OnlinePaymentHistory_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_Pay_OnlinePaymentHistory_ID); if (ii == null) { return 0; } return ii.intValue(); } /** Set Authorization Code. @param R_AuthCode Authorization Code returned */ @Override public void setR_AuthCode (String R_AuthCode) { set_Value (COLUMNNAME_R_AuthCode, R_AuthCode); } /** Get Authorization Code. @return Authorization Code returned */ @Override public String getR_AuthCode () { return (String)get_Value(COLUMNNAME_R_AuthCode); } // /** TenderType AD_Reference_ID=214 */ // public static final int TENDERTYPE_AD_Reference_ID=214; // /** Kreditkarte = C */ // public static final String TENDERTYPE_Kreditkarte = "C"; // /** Scheck = K */ // public static final String TENDERTYPE_Scheck = "K"; // /** ueberweisung = A */ // public static final String TENDERTYPE_ueberweisung = "A"; // /** Bankeinzug = D */ // public static final String TENDERTYPE_Bankeinzug = "D"; // /** Account = T */ // public static final String TENDERTYPE_Account = "T"; // /** Bar = X */ // public static final String TENDERTYPE_Bar = "X"; /** Set Tender type. @param TenderType Method of Payment */ @Override public void setTenderType (String TenderType) { set_Value (COLUMNNAME_TenderType, TenderType); } /** Get Tender type. @return Method of Payment
*/ @Override public String getTenderType () { return (String)get_Value(COLUMNNAME_TenderType); } // /** TrxType AD_Reference_ID=215 */ // public static final int TRXTYPE_AD_Reference_ID=215; // /** Verkauf = S */ // public static final String TRXTYPE_Verkauf = "S"; // /** Delayed Capture = D */ // public static final String TRXTYPE_DelayedCapture = "D"; // /** Kredit (Zahlung) = C */ // public static final String TRXTYPE_KreditZahlung = "C"; // /** Voice Authorization = F */ // public static final String TRXTYPE_VoiceAuthorization = "F"; // /** Autorisierung = A */ // public static final String TRXTYPE_Autorisierung = "A"; // /** Loeschen = V */ // public static final String TRXTYPE_Loeschen = "V"; // /** Rueckzahlung = R */ // public static final String TRXTYPE_Rueckzahlung = "R"; /** Set Transaction Type. @param TrxType Type of credit card transaction */ @Override public void setTrxType (String TrxType) { set_Value (COLUMNNAME_TrxType, TrxType); } /** Get Transaction Type. @return Type of credit card transaction */ @Override public String getTrxType () { return (String)get_Value(COLUMNNAME_TrxType); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.base\src\main\java\de\schaeffer\pay\model\X_Pay_OnlinePaymentHistory.java
1
请完成以下Java代码
public boolean isValueUpdatedBefore(final AttributeCode attributeCode) { return getLastPropagatorOrNull(attributeCode) != null; } @Override public IHUAttributePropagator getLastPropagatorOrNull(@NonNull final AttributeCode attributeCode) { // Iterate up chain of parents, starting with the parent context. for each parent context, we check if the attribute was updated in that context // NOTE: we are skipping current node because we want to check if that attribute was updated before for (IHUAttributePropagationContext currentParentContext = parent; currentParentContext != null; currentParentContext = currentParentContext.getParent()) { if (!currentParentContext.isValueUpdateInvocation()) { continue; } final IAttributeStorage currentAttributeStorage = currentParentContext.getAttributeStorage(); if (!currentAttributeStorage.equals(attributeStorage)) { continue; } final AttributeCode currentAttributeCode = currentParentContext.getAttributeCode(); if (!AttributeCode.equals(currentAttributeCode, attributeCode)) { continue; }
return currentParentContext.getPropagator(); } return null; } @Override public IAttributeValueContext copy() { return cloneForPropagation(getAttributeStorage(), getAttribute(), getPropagator()); } @Override public IHUAttributePropagationContext cloneForPropagation(final IAttributeStorage attributeStorage, final I_M_Attribute attribute, final IHUAttributePropagator propagatorToUse) { final HUAttributePropagationContext propagationContextClone = new HUAttributePropagationContext(this, attributeStorage, propagatorToUse, attribute, getParameters()); return propagationContextClone; } @Override public boolean isExternalInput() { // NOTE: we consider External Input if this is the first context created (i.e. has no parents => no previous calls) return Util.same(getParent(), IHUAttributePropagationContext.NULL); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\attribute\propagation\impl\HUAttributePropagationContext.java
1
请完成以下Java代码
public static boolean isBlacklisted(ExtensionAttribute attribute, List<ExtensionAttribute>... blackLists) { if (blackLists != null) { for (List<ExtensionAttribute> blackList : blackLists) { for (ExtensionAttribute blackAttribute : blackList) { if (blackAttribute.getName().equals(attribute.getName())) { if ( blackAttribute.getNamespace() != null && attribute.getNamespace() != null && blackAttribute.getNamespace().equals(attribute.getNamespace()) ) return true; if (blackAttribute.getNamespace() == null && attribute.getNamespace() == null) return true; } } } } return false; } public static void writeIncomingAndOutgoingFlowElement(FlowNode flowNode, XMLStreamWriter xtw) throws Exception { if (!flowNode.getIncomingFlows().isEmpty()) { for (SequenceFlow incomingSequence : flowNode.getIncomingFlows()) { writeIncomingElementChild(xtw, incomingSequence); } } if (!flowNode.getOutgoingFlows().isEmpty()) { for (SequenceFlow outgoingSequence : flowNode.getOutgoingFlows()) { writeOutgoingElementChild(xtw, outgoingSequence); } } } public static void writeIncomingElementChild(XMLStreamWriter xtw, SequenceFlow incomingSequence) throws Exception { xtw.writeStartElement(BPMN2_PREFIX, ELEMENT_GATEWAY_INCOMING, BPMN2_NAMESPACE); xtw.writeCharacters(incomingSequence.getId()); xtw.writeEndElement(); }
public static void writeOutgoingElementChild(XMLStreamWriter xtw, SequenceFlow outgoingSequence) throws Exception { xtw.writeStartElement(BPMN2_PREFIX, ELEMENT_GATEWAY_OUTGOING, BPMN2_NAMESPACE); xtw.writeCharacters(outgoingSequence.getId()); xtw.writeEndElement(); } /** * 'safe' is here reflecting: * http://activiti.org/userguide/index.html#advanced.safe.bpmn.xml */ public static XMLInputFactory createSafeXmlInputFactory() { XMLInputFactory xif = XMLInputFactory.newInstance(); if (xif.isPropertySupported(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES)) { xif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, false); } if (xif.isPropertySupported(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES)) { xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false); } if (xif.isPropertySupported(XMLInputFactory.SUPPORT_DTD)) { xif.setProperty(XMLInputFactory.SUPPORT_DTD, false); } return xif; } }
repos\Activiti-develop\activiti-core\activiti-bpmn-converter\src\main\java\org\activiti\bpmn\converter\util\BpmnXMLUtil.java
1
请完成以下Java代码
public int getRank() { return sales; } @Override public String toString() { return "Product [name=" + name + ", price=" + price + ", sales=" + sales + "]"; } // getters and setters public String getName() { return name; } public void setName(String name) { this.name = name; }
public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public int getSales() { return sales; } public void setSales(int sales) { this.sales = sales; } }
repos\tutorials-master\core-java-modules\core-java-lang-oop-generics-2\src\main\java\com\baeldung\generics\Product.java
1
请完成以下Java代码
public String getName() { return name; } public void setName(String name) { this.name = name; } public int getSalary() { return salary; } public void setSalary(int salary) { this.salary = salary; }
public String getDepartment() { return department; } public void setDepartment(String department) { this.department = department; } @Override public String toString() { return "Employee{" + "name='" + name + '\'' + ", salary=" + salary + ", department='" + department + '\'' + ", sex='" + sex + '\'' + '}'; } }
repos\tutorials-master\core-java-modules\core-java-9-streams\src\main\java\com\baledung\streams\entity\Employee.java
1
请完成以下Java代码
public int getBatchJobsPerSeed() { return batchJobsPerSeed; } public void setBatchJobsPerSeed(int batchJobsPerSeed) { this.batchJobsPerSeed = batchJobsPerSeed; } public int getInvocationsPerBatchJob() { return invocationsPerBatchJob; } public void setInvocationsPerBatchJob(int invocationsPerBatchJob) { this.invocationsPerBatchJob = invocationsPerBatchJob; } public String getSeedJobDefinitionId() { return seedJobDefinitionId; } public void setSeedJobDefinitionId(String seedJobDefinitionId) { this.seedJobDefinitionId = seedJobDefinitionId; } public String getMonitorJobDefinitionId() { return monitorJobDefinitionId; } public void setMonitorJobDefinitionId(String monitorJobDefinitionId) { this.monitorJobDefinitionId = monitorJobDefinitionId; } public String getBatchJobDefinitionId() { return batchJobDefinitionId; } public void setBatchJobDefinitionId(String batchJobDefinitionId) { this.batchJobDefinitionId = batchJobDefinitionId; } public String getTenantId() { return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } public String getCreateUserId() { return createUserId; } public void setCreateUserId(String createUserId) { this.createUserId = createUserId;
} public Date getStartTime() { return startTime; } public void setStartTime(Date startTime) { this.startTime = startTime; } public Date getEndTime() { return endTime; } public void setEndTime(Date endTime) { this.endTime = endTime; } @Override public Date getExecutionStartTime() { return executionStartTime; } public void setExecutionStartTime(final Date executionStartTime) { this.executionStartTime = executionStartTime; } @Override public Object getPersistentState() { Map<String, Object> persistentState = new HashMap<String, Object>(); persistentState.put("endTime", endTime); persistentState.put("executionStartTime", executionStartTime); return persistentState; } public void delete() { HistoricIncidentManager historicIncidentManager = Context.getCommandContext().getHistoricIncidentManager(); historicIncidentManager.deleteHistoricIncidentsByJobDefinitionId(seedJobDefinitionId); historicIncidentManager.deleteHistoricIncidentsByJobDefinitionId(monitorJobDefinitionId); historicIncidentManager.deleteHistoricIncidentsByJobDefinitionId(batchJobDefinitionId); HistoricJobLogManager historicJobLogManager = Context.getCommandContext().getHistoricJobLogManager(); historicJobLogManager.deleteHistoricJobLogsByJobDefinitionId(seedJobDefinitionId); historicJobLogManager.deleteHistoricJobLogsByJobDefinitionId(monitorJobDefinitionId); historicJobLogManager.deleteHistoricJobLogsByJobDefinitionId(batchJobDefinitionId); Context.getCommandContext().getHistoricBatchManager().delete(this); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\batch\history\HistoricBatchEntity.java
1
请完成以下Java代码
public class DeviceActor extends ContextAwareActor { private final DeviceActorMessageProcessor processor; DeviceActor(ActorSystemContext systemContext, TenantId tenantId, DeviceId deviceId) { super(systemContext); this.processor = new DeviceActorMessageProcessor(systemContext, tenantId, deviceId); } @Override public void init(TbActorCtx ctx) throws TbActorException { super.init(ctx); log.debug("[{}][{}] Starting device actor.", processor.tenantId, processor.deviceId); try { processor.init(ctx); log.debug("[{}][{}] Device actor started.", processor.tenantId, processor.deviceId); } catch (Exception e) { log.warn("[{}][{}] Unknown failure", processor.tenantId, processor.deviceId, e); throw new TbActorException("Failed to initialize device actor", e); } } @Override protected boolean doProcess(TbActorMsg msg) { switch (msg.getMsgType()) { case TRANSPORT_TO_DEVICE_ACTOR_MSG: processor.process((TransportToDeviceActorMsgWrapper) msg); break; case DEVICE_ATTRIBUTES_UPDATE_TO_DEVICE_ACTOR_MSG: processor.processAttributesUpdate((DeviceAttributesEventNotificationMsg) msg); break; case DEVICE_DELETE_TO_DEVICE_ACTOR_MSG: ctx.stop(ctx.getSelf()); break; case DEVICE_CREDENTIALS_UPDATE_TO_DEVICE_ACTOR_MSG: processor.processCredentialsUpdate(msg); break; case DEVICE_NAME_OR_TYPE_UPDATE_TO_DEVICE_ACTOR_MSG: processor.processNameOrTypeUpdate((DeviceNameOrTypeUpdateMsg) msg); break; case DEVICE_RPC_REQUEST_TO_DEVICE_ACTOR_MSG: processor.processRpcRequest(ctx, (ToDeviceRpcRequestActorMsg) msg); break; case DEVICE_RPC_RESPONSE_TO_DEVICE_ACTOR_MSG: processor.processRpcResponsesFromEdge((FromDeviceRpcResponseActorMsg) msg);
break; case DEVICE_ACTOR_SERVER_SIDE_RPC_TIMEOUT_MSG: processor.processServerSideRpcTimeout((DeviceActorServerSideRpcTimeoutMsg) msg); break; case SESSION_TIMEOUT_MSG: processor.checkSessionsTimeout(); break; case DEVICE_EDGE_UPDATE_TO_DEVICE_ACTOR_MSG: processor.processEdgeUpdate((DeviceEdgeUpdateMsg) msg); break; case REMOVE_RPC_TO_DEVICE_ACTOR_MSG: processor.processRemoveRpc((RemoveRpcActorMsg) msg); break; default: return false; } return true; } }
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\actors\device\DeviceActor.java
1
请完成以下Java代码
protected org.compiere.model.POInfo initPO(final Properties ctx) { return org.compiere.model.POInfo.getPOInfo(Table_Name); } @Override public org.compiere.model.I_C_BPartner_QuickInput getC_BPartner_QuickInput() { return get_ValueAsPO(COLUMNNAME_C_BPartner_QuickInput_ID, org.compiere.model.I_C_BPartner_QuickInput.class); } @Override public void setC_BPartner_QuickInput(final org.compiere.model.I_C_BPartner_QuickInput C_BPartner_QuickInput) { set_ValueFromPO(COLUMNNAME_C_BPartner_QuickInput_ID, org.compiere.model.I_C_BPartner_QuickInput.class, C_BPartner_QuickInput); } @Override public void setC_BPartner_QuickInput_ID (final int C_BPartner_QuickInput_ID) { if (C_BPartner_QuickInput_ID < 1) set_Value (COLUMNNAME_C_BPartner_QuickInput_ID, null); else set_Value (COLUMNNAME_C_BPartner_QuickInput_ID, C_BPartner_QuickInput_ID); } @Override public int getC_BPartner_QuickInput_ID() { return get_ValueAsInt(COLUMNNAME_C_BPartner_QuickInput_ID); } @Override public void setC_BPartner_QuickInput_RelatedRecord1_ID (final int C_BPartner_QuickInput_RelatedRecord1_ID) { if (C_BPartner_QuickInput_RelatedRecord1_ID < 1) set_ValueNoCheck (COLUMNNAME_C_BPartner_QuickInput_RelatedRecord1_ID, null); else set_ValueNoCheck (COLUMNNAME_C_BPartner_QuickInput_RelatedRecord1_ID, C_BPartner_QuickInput_RelatedRecord1_ID);
} @Override public int getC_BPartner_QuickInput_RelatedRecord1_ID() { return get_ValueAsInt(COLUMNNAME_C_BPartner_QuickInput_RelatedRecord1_ID); } @Override public void setRecord_ID (final int Record_ID) { if (Record_ID < 0) set_Value (COLUMNNAME_Record_ID, null); else set_Value (COLUMNNAME_Record_ID, Record_ID); } @Override public int getRecord_ID() { return get_ValueAsInt(COLUMNNAME_Record_ID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_BPartner_QuickInput_RelatedRecord1.java
1
请完成以下Java代码
class Frame { private static final byte[] NO_BYTES = new byte[0]; private final Type type; private final byte[] payload; /** * Create a new {@link Type#TEXT text} {@link Frame} instance with the specified * payload. * @param payload the text payload */ Frame(String payload) { Assert.notNull(payload, "'payload' must not be null"); this.type = Type.TEXT; this.payload = payload.getBytes(); } Frame(Type type) { Assert.notNull(type, "'type' must not be null"); this.type = type; this.payload = NO_BYTES; } Frame(Type type, byte[] payload) { this.type = type; this.payload = payload; } Type getType() { return this.type; } byte[] getPayload() { return this.payload; } @Override public String toString() { return new String(this.payload); } void write(OutputStream outputStream) throws IOException { outputStream.write(0x80 | this.type.code); if (this.payload.length < 126) { outputStream.write(this.payload.length & 0x7F); } else { outputStream.write(0x7E); outputStream.write(this.payload.length >> 8 & 0xFF); outputStream.write(this.payload.length & 0xFF); } outputStream.write(this.payload); outputStream.flush(); } static Frame read(ConnectionInputStream inputStream) throws IOException { int firstByte = inputStream.checkedRead(); Assert.state((firstByte & 0x80) != 0, "Fragmented frames are not supported"); int maskAndLength = inputStream.checkedRead(); boolean hasMask = (maskAndLength & 0x80) != 0; int length = (maskAndLength & 0x7F); Assert.state(length != 127, "Large frames are not supported"); if (length == 126) { length = ((inputStream.checkedRead()) << 8 | inputStream.checkedRead()); } byte[] mask = new byte[4]; if (hasMask) { inputStream.readFully(mask, 0, mask.length); } byte[] payload = new byte[length]; inputStream.readFully(payload, 0, length); if (hasMask) {
for (int i = 0; i < payload.length; i++) { payload[i] ^= mask[i % 4]; } } return new Frame(Type.forCode(firstByte & 0x0F), payload); } /** * Frame types. */ enum Type { /** * Continuation frame. */ CONTINUATION(0x00), /** * Text frame. */ TEXT(0x01), /** * Binary frame. */ BINARY(0x02), /** * Close frame. */ CLOSE(0x08), /** * Ping frame. */ PING(0x09), /** * Pong frame. */ PONG(0x0A); private final int code; Type(int code) { this.code = code; } static Type forCode(int code) { for (Type type : values()) { if (type.code == code) { return type; } } throw new IllegalStateException("Unknown code " + code); } } }
repos\spring-boot-4.0.1\module\spring-boot-devtools\src\main\java\org\springframework\boot\devtools\livereload\Frame.java
1
请完成以下Java代码
public void setC_MembershipMonth_ID (final int C_MembershipMonth_ID) { if (C_MembershipMonth_ID < 1) set_ValueNoCheck (COLUMNNAME_C_MembershipMonth_ID, null); else set_ValueNoCheck (COLUMNNAME_C_MembershipMonth_ID, C_MembershipMonth_ID); } @Override public int getC_MembershipMonth_ID() { return get_ValueAsInt(COLUMNNAME_C_MembershipMonth_ID); } @Override public org.compiere.model.I_C_Year getC_Year() { return get_ValueAsPO(COLUMNNAME_C_Year_ID, org.compiere.model.I_C_Year.class); } @Override public void setC_Year(final org.compiere.model.I_C_Year C_Year) { set_ValueFromPO(COLUMNNAME_C_Year_ID, org.compiere.model.I_C_Year.class, C_Year); } @Override public void setC_Year_ID (final int C_Year_ID) { if (C_Year_ID < 1) set_Value (COLUMNNAME_C_Year_ID, null);
else set_Value (COLUMNNAME_C_Year_ID, C_Year_ID); } @Override public int getC_Year_ID() { return get_ValueAsInt(COLUMNNAME_C_Year_ID); } @Override public void setValidTo (final @Nullable java.sql.Timestamp ValidTo) { set_ValueNoCheck (COLUMNNAME_ValidTo, ValidTo); } @Override public java.sql.Timestamp getValidTo() { return get_ValueAsTimestamp(COLUMNNAME_ValidTo); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_MembershipMonth.java
1
请完成以下Java代码
public boolean isEmpty() { final List<I_M_HU_Item_Storage> storages = dao.retrieveItemStorages(item); for (final I_M_HU_Item_Storage storage : storages) { if (!isEmpty(storage)) { return false; } } return true; } private boolean isEmpty(final I_M_HU_Item_Storage storage) { final BigDecimal qty = storage.getQty(); if (qty.signum() != 0) {
return false; } return true; } @Override public boolean isEmpty(final ProductId productId) { final I_M_HU_Item_Storage storage = dao.retrieveItemStorage(item, productId); if (storage == null) { return true; } return isEmpty(storage); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\storage\impl\HUItemStorage.java
1
请在Spring Boot框架中完成以下Java代码
public class JsonResponseBPGroup { public static final String METASFRESH_ID = "metasfreshId"; public static final String NAME = "name"; public static final String VALUE = "value"; public static final String ACTIVE = "active"; @ApiModelProperty( // required = true, // dataType = "java.lang.Integer", // value = "This translates to `C_BP_Group.C_BP_Group_ID`.") @JsonProperty(METASFRESH_ID) @JsonInclude(JsonInclude.Include.NON_NULL) JsonMetasfreshId metasfreshId; @ApiModelProperty(value = "This translates to `C_BP_Group.Name`.") @JsonProperty(NAME)
String name; @ApiModelProperty(value = "This translates to `C_BP_Group.Value`.") @JsonProperty(VALUE) String value; @JsonCreator @Builder(toBuilder = true) private JsonResponseBPGroup( @JsonProperty(METASFRESH_ID) @NonNull final JsonMetasfreshId metasfreshId, @JsonProperty(VALUE) @NonNull final String value, @JsonProperty(NAME) @NonNull final String name) { this.metasfreshId = metasfreshId; this.name = name; this.value = value; } }
repos\metasfresh-new_dawn_uat\misc\de-metas-common\de-metas-common-bpartner\src\main\java\de\metas\common\bpartner\v2\response\JsonResponseBPGroup.java
2
请完成以下Java代码
public Class<? extends ObservationConvention<? extends Context>> getDefaultConvention() { return DefaultRabbitTemplateObservationConvention.class; } @Override public KeyName[] getLowCardinalityKeyNames() { return TemplateLowCardinalityTags.values(); } }; /** * Low cardinality tags. */ public enum TemplateLowCardinalityTags implements KeyName { /** * Bean name of the template. */ BEAN_NAME { @Override public String asString() { return "spring.rabbit.template.name"; } }, /** * The destination exchange (empty if default exchange). * @since 3.2 */ EXCHANGE { @Override public String asString() { return "messaging.destination.name"; } }, /** * The destination routing key. * @since 3.2 */ ROUTING_KEY { @Override public String asString() { return "messaging.rabbitmq.destination.routing_key"; } }
} /** * Default {@link RabbitTemplateObservationConvention} for Rabbit template key values. */ public static class DefaultRabbitTemplateObservationConvention implements RabbitTemplateObservationConvention { /** * A singleton instance of the convention. */ public static final DefaultRabbitTemplateObservationConvention INSTANCE = new DefaultRabbitTemplateObservationConvention(); @Override public KeyValues getLowCardinalityKeyValues(RabbitMessageSenderContext context) { return KeyValues.of( TemplateLowCardinalityTags.BEAN_NAME.asString(), context.getBeanName(), TemplateLowCardinalityTags.EXCHANGE.asString(), context.getExchange(), TemplateLowCardinalityTags.ROUTING_KEY.asString(), context.getRoutingKey() ); } @Override public String getContextualName(RabbitMessageSenderContext context) { return context.getDestination() + " send"; } } }
repos\spring-amqp-main\spring-rabbit\src\main\java\org\springframework\amqp\rabbit\support\micrometer\RabbitTemplateObservation.java
1
请完成以下Java代码
public Date getCreateTime() { return getStartTime(); } public void setCreateTime(Date createTime) { setStartTime(createTime); } public Date getCloseTime() { return getEndTime(); } public void setCloseTime(Date closeTime) { setEndTime(closeTime); } public String getCreateUserId() { return createUserId; } public void setCreateUserId(String userId) { createUserId = userId; } public String getSuperCaseInstanceId() { return superCaseInstanceId; } public void setSuperCaseInstanceId(String superCaseInstanceId) { this.superCaseInstanceId = superCaseInstanceId; } public String getSuperProcessInstanceId() { return superProcessInstanceId; } public void setSuperProcessInstanceId(String superProcessInstanceId) { this.superProcessInstanceId = superProcessInstanceId; } public String getTenantId() { return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } public int getState() { return state; } public void setState(int state) { this.state = state; } public boolean isActive() { return state == ACTIVE.getStateCode(); } public boolean isCompleted() { return state == COMPLETED.getStateCode();
} public boolean isTerminated() { return state == TERMINATED.getStateCode(); } public boolean isFailed() { return state == FAILED.getStateCode(); } public boolean isSuspended() { return state == SUSPENDED.getStateCode(); } public boolean isClosed() { return state == CLOSED.getStateCode(); } @Override public String toString() { return this.getClass().getSimpleName() + "[businessKey=" + businessKey + ", startUserId=" + createUserId + ", superCaseInstanceId=" + superCaseInstanceId + ", superProcessInstanceId=" + superProcessInstanceId + ", durationInMillis=" + durationInMillis + ", createTime=" + startTime + ", closeTime=" + endTime + ", id=" + id + ", eventType=" + eventType + ", caseExecutionId=" + caseExecutionId + ", caseDefinitionId=" + caseDefinitionId + ", caseInstanceId=" + caseInstanceId + ", tenantId=" + tenantId + "]"; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\history\event\HistoricCaseInstanceEventEntity.java
1
请在Spring Boot框架中完成以下Java代码
public static void register(BeanDefinitionRegistry registry, Collection<String> packageNames) { Assert.notNull(registry, "'registry' must not be null"); Assert.notNull(packageNames, "'packageNames' must not be null"); if (registry.containsBeanDefinition(BEAN)) { EntityScanPackagesBeanDefinition beanDefinition = (EntityScanPackagesBeanDefinition) registry .getBeanDefinition(BEAN); beanDefinition.addPackageNames(packageNames); } else { registry.registerBeanDefinition(BEAN, new EntityScanPackagesBeanDefinition(packageNames)); } } /** * {@link ImportBeanDefinitionRegistrar} to store the base package from the importing * configuration. */ static class Registrar implements ImportBeanDefinitionRegistrar { private final Environment environment; Registrar(Environment environment) { this.environment = environment; } @Override public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) { register(registry, getPackagesToScan(metadata)); } private Set<String> getPackagesToScan(AnnotationMetadata metadata) { AnnotationAttributes attributes = AnnotationAttributes .fromMap(metadata.getAnnotationAttributes(EntityScan.class.getName())); Assert.state(attributes != null, "'attributes' must not be null"); Set<String> packagesToScan = new LinkedHashSet<>(); for (String basePackage : attributes.getStringArray("basePackages")) { String[] tokenized = StringUtils.tokenizeToStringArray( this.environment.resolvePlaceholders(basePackage), ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS); Collections.addAll(packagesToScan, tokenized); } for (Class<?> basePackageClass : attributes.getClassArray("basePackageClasses")) {
packagesToScan.add(this.environment.resolvePlaceholders(ClassUtils.getPackageName(basePackageClass))); } if (packagesToScan.isEmpty()) { String packageName = ClassUtils.getPackageName(metadata.getClassName()); Assert.state(StringUtils.hasLength(packageName), "@EntityScan cannot be used with the default package"); return Collections.singleton(packageName); } return packagesToScan; } } static class EntityScanPackagesBeanDefinition extends RootBeanDefinition { private final Set<String> packageNames = new LinkedHashSet<>(); EntityScanPackagesBeanDefinition(Collection<String> packageNames) { setBeanClass(EntityScanPackages.class); setRole(BeanDefinition.ROLE_INFRASTRUCTURE); addPackageNames(packageNames); } private void addPackageNames(Collection<String> additionalPackageNames) { this.packageNames.addAll(additionalPackageNames); getConstructorArgumentValues().addIndexedArgumentValue(0, StringUtils.toStringArray(this.packageNames)); } } }
repos\spring-boot-4.0.1\module\spring-boot-persistence\src\main\java\org\springframework\boot\persistence\autoconfigure\EntityScanPackages.java
2
请完成以下Java代码
public final class NullVendorGatewayInvoker implements VendorGatewayInvoker { public static final String NO_REMOTE_PURCHASE_ID = "NO_REMOTE_PURCHASE_ID"; public static final NullVendorGatewayInvoker INSTANCE = new NullVendorGatewayInvoker(); private NullVendorGatewayInvoker() { } /** * Does not actually place a remote purchase order, but just returns a "plain" purchase order item for each candidate. */ @Override public List<PurchaseItem> placeRemotePurchaseOrder( @NonNull final Collection<PurchaseCandidate> purchaseCandidates) { return purchaseCandidates.stream() .map(NullVendorGatewayInvoker::createPlainPurchaseOrderItem) .collect(ImmutableList.toImmutableList());
} private static PurchaseOrderItem createPlainPurchaseOrderItem( @NonNull final PurchaseCandidate purchaseCandidate) { return purchaseCandidate.createOrderItem() .remotePurchaseOrderId(NO_REMOTE_PURCHASE_ID) .datePromised(purchaseCandidate.getPurchaseDatePromised()) .dateOrdered(purchaseCandidate.getPurchaseDateOrdered()) .purchasedQty(purchaseCandidate.getQtyToPurchase()) .dimension(purchaseCandidate.getDimension()) .buildAndAddToParent(); } /** * Does nothing */ @Override public void updateRemoteLineReferences(Collection<PurchaseOrderItem> purchaseOrderItem) { } }
repos\metasfresh-new_dawn_uat\backend\de.metas.purchasecandidate.base\src\main\java\de\metas\purchasecandidate\purchaseordercreation\remoteorder\NullVendorGatewayInvoker.java
1
请完成以下Java代码
private String getFileName(String template, String className, String packageName, String moduleName) { // 包路径 String packagePath = GenConstants.SIGNATURE + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator; // 资源路径 String resourcePath = GenConstants.SIGNATURE + File.separator + "src" + File.separator + "main" + File.separator + "resources" + File.separator; // api路径 String apiPath = GenConstants.SIGNATURE + File.separator + "api" + File.separator; if (StrUtil.isNotBlank(packageName)) { packagePath += packageName.replace(".", File.separator) + File.separator + moduleName + File.separator; } if (template.contains(ENTITY_JAVA_VM)) { return packagePath + "entity" + File.separator + className + ".java"; } if (template.contains(MAPPER_JAVA_VM)) { return packagePath + "mapper" + File.separator + className + "Mapper.java"; } if (template.contains(SERVICE_JAVA_VM)) { return packagePath + "service" + File.separator + className + "Service.java";
} if (template.contains(SERVICE_IMPL_JAVA_VM)) { return packagePath + "service" + File.separator + "impl" + File.separator + className + "ServiceImpl.java"; } if (template.contains(CONTROLLER_JAVA_VM)) { return packagePath + "controller" + File.separator + className + "Controller.java"; } if (template.contains(MAPPER_XML_VM)) { return resourcePath + "mapper" + File.separator + className + "Mapper.xml"; } if (template.contains(API_JS_VM)) { return apiPath + className.toLowerCase() + ".js"; } return null; } }
repos\spring-boot-demo-master\demo-codegen\src\main\java\com\xkcoding\codegen\utils\CodeGenUtil.java
1
请完成以下Java代码
public abstract class AbstractEmptyBodyFilter implements Filter { protected static final Pattern CONTENT_TYPE_JSON_PATTERN = Pattern.compile("^application\\/json((;)(.*)?)?$", Pattern.CASE_INSENSITIVE); @Override public void doFilter(final ServletRequest req, final ServletResponse resp, FilterChain chain) throws IOException, ServletException { final boolean isContentTypeJson = CONTENT_TYPE_JSON_PATTERN.matcher(req.getContentType() == null ? "" : req.getContentType()).find(); if (isContentTypeJson) { final PushbackInputStream requestBody = new PushbackInputStream(req.getInputStream()); int firstByte = requestBody.read(); final boolean isBodyEmpty = firstByte == -1; requestBody.unread(firstByte); chain.doFilter(wrapRequest((HttpServletRequest) req, isBodyEmpty, requestBody), resp); } else { chain.doFilter(req, resp); } } public InputStream getRequestBody(boolean isBodyEmpty, PushbackInputStream requestBody) { return isBodyEmpty ? new ByteArrayInputStream("{}".getBytes(StandardCharsets.UTF_8)) : requestBody; } public abstract HttpServletRequestWrapper wrapRequest(HttpServletRequest req, boolean isBodyEmpty, PushbackInputStream requestBody);
@Override public void destroy() { } @Override public void init(FilterConfig filterConfig) throws ServletException { } public BufferedReader getReader(final ServletInputStream inputStream) { return new BufferedReader(new InputStreamReader(inputStream)); } }
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\filter\AbstractEmptyBodyFilter.java
1
请在Spring Boot框架中完成以下Java代码
public class Group { @Id @GeneratedValue private Long id; private String name; @ManyToMany(mappedBy = "groups") private List<User> users = new ArrayList<>(); public Group(String name) { this.name = name; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; }
public List<User> getUsers() { return users; } public void setUsers(List<User> users) { this.users = users; } @Override public String toString() { return "Group [name=" + name + "]"; } }
repos\tutorials-master\persistence-modules\hibernate-annotations-2\src\main\java\com\baeldung\hibernate\wherejointable\Group.java
2
请完成以下Java代码
public void destroy() { } protected void setAuthenticatedUser(ProcessEngine engine, String userId, List<String> groupIds, List<String> tenantIds) { if (groupIds == null) { groupIds = getGroupsOfUser(engine, userId); } if (tenantIds == null) { tenantIds = getTenantsOfUser(engine, userId); } engine.getIdentityService().setAuthentication(userId, groupIds, tenantIds); } protected List<String> getGroupsOfUser(ProcessEngine engine, String userId) { List<Group> groups = engine.getIdentityService().createGroupQuery() .groupMember(userId) .list(); List<String> groupIds = new ArrayList<String>(); for (Group group : groups) { groupIds.add(group.getId()); } return groupIds; } protected List<String> getTenantsOfUser(ProcessEngine engine, String userId) { List<Tenant> tenants = engine.getIdentityService().createTenantQuery() .userMember(userId) .includingGroupsOfUser(true) .list(); List<String> tenantIds = new ArrayList<String>(); for(Tenant tenant : tenants) { tenantIds.add(tenant.getId()); } return tenantIds; } protected void clearAuthentication(ProcessEngine engine) { engine.getIdentityService().clearAuthentication(); } protected boolean requiresEngineAuthentication(String requestUrl) {
for (Pattern whiteListedUrlPattern : WHITE_LISTED_URL_PATTERNS) { Matcher matcher = whiteListedUrlPattern.matcher(requestUrl); if (matcher.matches()) { return false; } } return true; } /** * May not return null */ protected String extractEngineName(String requestUrl) { Matcher matcher = ENGINE_REQUEST_URL_PATTERN.matcher(requestUrl); if (matcher.find()) { return matcher.group(1); } else { // any request that does not match a specific engine and is not an /engine request // is mapped to the default engine return DEFAULT_ENGINE_NAME; } } protected ProcessEngine getAddressedEngine(String engineName) { return EngineUtil.lookupProcessEngine(engineName); } }
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\security\auth\ProcessEngineAuthenticationFilter.java
1
请完成以下Java代码
private static Decoder<?> findJsonDecoder(CodecConfigurer configurer) { return configurer.getReaders().stream() .filter((reader) -> reader.canRead(MESSAGE_TYPE, MediaType.APPLICATION_JSON)) .map((reader) -> ((DecoderHttpMessageReader<?>) reader).getDecoder()) .findFirst() .orElseThrow(() -> new IllegalArgumentException("No JSON Decoder")); } private static Encoder<?> findJsonEncoder(CodecConfigurer configurer) { return configurer.getWriters().stream() .filter((writer) -> writer.canWrite(MESSAGE_TYPE, MediaType.APPLICATION_JSON)) .map((writer) -> ((EncoderHttpMessageWriter<?>) writer).getEncoder()) .findFirst() .orElseThrow(() -> new IllegalArgumentException("No JSON Encoder")); } @SuppressWarnings("unchecked") <T> WebSocketMessage encode(WebSocketSession session, GraphQlWebSocketMessage message) { DataBuffer buffer = ((Encoder<T>) this.encoder).encodeValue( (T) message, session.bufferFactory(), MESSAGE_TYPE, MimeTypeUtils.APPLICATION_JSON, null); this.messagesEncoded = true; return new WebSocketMessage(WebSocketMessage.Type.TEXT, buffer); }
@SuppressWarnings("ConstantConditions") @Nullable GraphQlWebSocketMessage decode(WebSocketMessage webSocketMessage) { DataBuffer buffer = DataBufferUtils.retain(webSocketMessage.getPayload()); return (GraphQlWebSocketMessage) this.decoder.decode(buffer, MESSAGE_TYPE, null, null); } WebSocketMessage encodeConnectionAck(WebSocketSession session, Object ackPayload) { return encode(session, GraphQlWebSocketMessage.connectionAck(ackPayload)); } WebSocketMessage encodeNext(WebSocketSession session, String id, Map<String, Object> responseMap) { return encode(session, GraphQlWebSocketMessage.next(id, responseMap)); } WebSocketMessage encodeError(WebSocketSession session, String id, List<GraphQLError> errors) { return encode(session, GraphQlWebSocketMessage.error(id, errors)); } WebSocketMessage encodeComplete(WebSocketSession session, String id) { return encode(session, GraphQlWebSocketMessage.complete(id)); } boolean checkMessagesEncodedAndClear() { boolean result = this.messagesEncoded; this.messagesEncoded = false; return result; } }
repos\spring-graphql-main\spring-graphql\src\main\java\org\springframework\graphql\server\webflux\WebSocketCodecDelegate.java
1
请在Spring Boot框架中完成以下Java代码
public class UserRepositoryImpl implements UserRepository { @Autowired private JdbcTemplate primaryJdbcTemplate; @Override public int save(User user,JdbcTemplate jdbcTemplate) { if(jdbcTemplate == null){ jdbcTemplate= primaryJdbcTemplate; } return jdbcTemplate.update("INSERT INTO users(name, password, age) values(?, ?, ?)", user.getName(), user.getPassword(), user.getAge()); } @Override public int update(User user,JdbcTemplate jdbcTemplate) { if(jdbcTemplate==null){ jdbcTemplate= primaryJdbcTemplate; } return jdbcTemplate.update("UPDATE users SET name = ? , password = ? , age = ? WHERE id=?", user.getName(), user.getPassword(), user.getAge(), user.getId()); } @Override public int delete(long id,JdbcTemplate jdbcTemplate) { if(jdbcTemplate==null){ jdbcTemplate= primaryJdbcTemplate; } return jdbcTemplate.update("DELETE FROM users where id = ? ",id); } @Override public User findById(long id,JdbcTemplate jdbcTemplate) { if(jdbcTemplate==null){ jdbcTemplate= primaryJdbcTemplate; } return jdbcTemplate.queryForObject("SELECT * FROM users WHERE id=?", new Object[] { id }, new BeanPropertyRowMapper<User>(User.class));
} @Override public List<User> findALL(JdbcTemplate jdbcTemplate) { if(jdbcTemplate==null){ jdbcTemplate= primaryJdbcTemplate; } return jdbcTemplate.query("SELECT * FROM users", new UserRowMapper()); // return jdbcTemplate.query("SELECT * FROM users", new BeanPropertyRowMapper(User.class)); } class UserRowMapper implements RowMapper<User> { @Override public User mapRow(ResultSet rs, int rowNum) throws SQLException { User user = new User(); user.setId(rs.getLong("id")); user.setName(rs.getString("name")); user.setPassword(rs.getString("password")); user.setAge(rs.getInt("age")); return user; } } }
repos\spring-boot-leaning-master\2.x_42_courses\第 3-1 课: Spring Boot 使用 JDBC 操作数据库\spring-boot-multi-jdbc\src\main\java\com\neo\repository\impl\UserRepositoryImpl.java
2
请完成以下Java代码
public PublicKeyCredentialBuilder type(PublicKeyCredentialType type) { this.type = type; return this; } /** * Sets the {@link #getRawId()} property. * @param rawId the raw id * @return the PublicKeyCredentialBuilder */ public PublicKeyCredentialBuilder rawId(Bytes rawId) { this.rawId = rawId; return this; } /** * Sets the {@link #getResponse()} property. * @param response the response * @return the PublicKeyCredentialBuilder */ public PublicKeyCredentialBuilder response(R response) { this.response = response; return this; } /** * Sets the {@link #getAuthenticatorAttachment()} property. * @param authenticatorAttachment the authenticator attachement * @return the PublicKeyCredentialBuilder */ public PublicKeyCredentialBuilder authenticatorAttachment(AuthenticatorAttachment authenticatorAttachment) { this.authenticatorAttachment = authenticatorAttachment; return this; } /** * Sets the {@link #getClientExtensionResults()} property.
* @param clientExtensionResults the client extension results * @return the PublicKeyCredentialBuilder */ public PublicKeyCredentialBuilder clientExtensionResults( AuthenticationExtensionsClientOutputs clientExtensionResults) { this.clientExtensionResults = clientExtensionResults; return this; } /** * Creates a new {@link PublicKeyCredential} * @return a new {@link PublicKeyCredential} */ public PublicKeyCredential<R> build() { Assert.notNull(this.id, "id cannot be null"); Assert.notNull(this.rawId, "rawId cannot be null"); Assert.notNull(this.response, "response cannot be null"); return new PublicKeyCredential(this.id, this.type, this.rawId, this.response, this.authenticatorAttachment, this.clientExtensionResults); } } }
repos\spring-security-main\webauthn\src\main\java\org\springframework\security\web\webauthn\api\PublicKeyCredential.java
1
请在Spring Boot框架中完成以下Java代码
public class JsonExternalReferenceItem { public static JsonExternalReferenceItem of( @NonNull final JsonExternalReferenceLookupItem lookupItem, @NonNull final JsonMetasfreshId metasfreshId) { return new JsonExternalReferenceItem(lookupItem, metasfreshId, null, null, null, null, null); } public static JsonExternalReferenceItem of( @NonNull final JsonExternalReferenceLookupItem lookupItem) { return new JsonExternalReferenceItem(lookupItem, null, null, null, null, null, null); } @NonNull JsonExternalReferenceLookupItem lookupItem; @Nullable @JsonInclude(JsonInclude.Include.NON_NULL) String externalReference; @Nullable @JsonInclude(JsonInclude.Include.NON_NULL) JsonMetasfreshId metasfreshId; @Nullable @JsonInclude(JsonInclude.Include.NON_NULL) String version; @Nullable @JsonInclude(JsonInclude.Include.NON_NULL) String externalReferenceUrl; @Nullable @JsonInclude(JsonInclude.Include.NON_NULL) JsonExternalSystemName systemName;
@Nullable @JsonInclude(JsonInclude.Include.NON_NULL) JsonMetasfreshId externalReferenceId; @JsonCreator @Builder private JsonExternalReferenceItem( @JsonProperty("lookupItem") @NonNull final JsonExternalReferenceLookupItem lookupItem, @JsonProperty("metasfreshId") @Nullable final JsonMetasfreshId metasfreshId, @JsonProperty("externalReference") @Nullable final String externalReference, @JsonProperty("version") @Nullable final String version, @JsonProperty("externalReferenceUrl") @Nullable final String externalReferenceUrl, @JsonProperty("systemName") @Nullable final JsonExternalSystemName systemName, @JsonProperty("externalReferenceId") @Nullable final JsonMetasfreshId externalReferenceId) { this.lookupItem = lookupItem; this.metasfreshId = metasfreshId; this.externalReference = externalReference; this.version = version; this.externalReferenceUrl = externalReferenceUrl; this.systemName = systemName; this.externalReferenceId = externalReferenceId; } }
repos\metasfresh-new_dawn_uat\misc\de-metas-common\de-metas-common-externalreference\src\main\java\de\metas\common\externalreference\v2\JsonExternalReferenceItem.java
2
请完成以下Java代码
public static PlainContextAware newCopy(final IContextAware contextProvider) { return new PlainContextAware(contextProvider.getCtx(), contextProvider.getTrxName(), contextProvider.isAllowThreadInherited()); } private final Properties ctx; private final String trxName; private final boolean allowThreadInherited; /** * Creates an instance with {@link ITrx#TRXNAME_None} as <code>trxName</code>. * <p> * <b>WARNING:</b> * <li>{@link InterfaceWrapperHelper#newInstance(Class, Object, boolean) * and maybe other code will still use a thread-inherited trx over the "null" trx if there is any. * <li>Use {@link #newOutOfTrx(Properties)} * * @deprecated please use {@link #newOutOfTrxAllowThreadInherited(Properties)} * to get a context aware that will use a local trx but can "fall back" to thread-inherited. */ @Deprecated public PlainContextAware(final Properties ctx) { this(ctx, ITrx.TRXNAME_None); } /** * @deprecated please use {@link #newWithTrxName(Properties, String)} instead. */ @Deprecated public PlainContextAware(final Properties ctx, @Nullable final String trxName) { this(ctx, trxName, true); // allowThreadInherited == true for backward compatibility; also see javadoc of isAllowThreadInherited. } private PlainContextAware(@NonNull final Properties ctx, @Nullable final String trxName, final boolean allowThreadInherited) { this.ctx = ctx; this.trxName = trxName; this.allowThreadInherited = allowThreadInherited; } @Override public String toString() { return "PlainContextAware[" // +", ctx="+ctx // don't print it... it's fucking too big + ", trxName=" + trxName + "]"; } @Override public int hashCode()
{ return new HashcodeBuilder() .append(ctx) .append(trxName) .toHashcode(); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } final PlainContextAware other = EqualsBuilder.getOther(this, obj); if (other == null) { return false; } return new EqualsBuilder() .appendByRef(ctx, other.ctx) .append(trxName, other.trxName) .isEqual(); } @Override public Properties getCtx() { return ctx; } @Override public String getTrxName() { return trxName; } @Override public boolean isAllowThreadInherited() { return allowThreadInherited; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\model\PlainContextAware.java
1
请完成以下Java代码
public class UserExcel implements Serializable { @Serial private static final long serialVersionUID = 1L; @ColumnWidth(15) @ExcelProperty("租户编号") private String tenantId; @ColumnWidth(15) @ExcelProperty("账户") private String account; @ColumnWidth(10) @ExcelProperty("昵称") private String name; @ColumnWidth(10) @ExcelProperty("姓名") private String realName; @ExcelProperty("邮箱") private String email; @ColumnWidth(15) @ExcelProperty("手机") private String phone; @ExcelIgnore @ExcelProperty("角色ID")
private String roleId; @ExcelIgnore @ExcelProperty("部门ID") private String deptId; @ExcelIgnore @ExcelProperty("岗位ID") private String postId; @ExcelProperty("角色名称") private String roleName; @ExcelProperty("部门名称") private String deptName; @ExcelProperty("岗位名称") private String postName; @ColumnWidth(20) @ExcelProperty("生日") private Date birthday; }
repos\SpringBlade-master\blade-service\blade-system\src\main\java\org\springblade\system\excel\UserExcel.java
1
请完成以下Spring Boot application配置
## tomcat\u914D\u7F6E server.port=8009 #server.tomcat.maxHttpHeaderSize=8192 server.tomcat.uri-encoding=UTF-8 spring.http.encoding.charset=UTF-8 spring.http.encoding.enabled=true spring.http.encoding.force=true spring.es.encoding=UTF-8 # tomcat\u6700\u5927\u7EBF\u7A0B\u6570\uFF0C\u9ED8\u8BA4\u4E3A200 server.tomcat.max-threads=800 # session\u6700\u5927\u8D85\u65F6\u65F6\u95F4(\u5206\u949F)\uFF0C\u9ED8\u8BA4\u4E3A30 server.session-timeout=60 ## spring \u914D\u7F6E spring.application.name=springboot-elasticsearch application.main=cn.abel.Application ## LOG logging.file=./logs/springboot-elasticsearch.log ## \u4E3B\u6570\u636E\u6E90\uFF0C\u9ED8\u8BA4\u7684 spring.datasource.url=jdbc:mysql://localhost:3306/oldMan?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&useSSL=false spring.datasource.username=root spring.datasource.password=admin spring.datasource.driverClassName=com.mysql.jdbc.Driver spring.datasource.type=com.zaxxer.hikari.HikariDataSource #\u6700\u5C0F\u7A7A\u95F2\u8FDE\u63A5 spring.datasource.min-idle=5 #\u6700\u5927\u8FDE\u63A5\u6570\u91CF spring.datasource.max-active=100 #\u68C0\u6D4B\u6570\u636E\u5E93\u7684\u67E5\u8BE2\u8BED\u53E5 spring.datasource.validation-query=select 1 from dual #\u7B49\u5F85\u8FDE\u63A5\u6C60\u5206\u914D\u8FDE\u63A5\u7684\u6700\u5927\u65F6\u957F\uFF08\u6BEB\u79D2\uFF09 spring.datasource.connection-timeout=60000 #\u4E00\u4E2A\u8FDE\u63A5\u7684\u751F\u547D\u65F6\u957F\uFF08\u6BEB\u79D2\uFF09 spring.datasource.max-left-time=60000 #\u751F\u6548\u8D85\u65F6 spring.datasource.validation-time-out=3000 #\u4E00\u4E2A\u8FDE\u63A5idle\u72B6\u6001\u7684\u6700\u5927\u65F6\u957F\uFF08\u6BEB\u79D2\uFF09 spring.datasource.idle-time-out=60000 #\u8BBE\u7F6E\u9ED8\u8BA4\u5B57\u7B26\u96C6
spring.datasource.connection-init-sql= set names utf8mb4 logging.level.cn.abel.dao=debug #Mapper.xml\u6240\u5728\u7684\u4F4D\u7F6E mybatis.mapper-locations=classpath*:mapper/*Mapper.xml smybatis.type-aliases-package=cn.abel.bean #Mapper.xml\u6240\u5728\u7684\u4F4D\u7F6E ## pagehelper pagehelper.helperDialect=mysql pagehelper.reasonable=true pagehelper.supportMethodsArguments=true pagehelper.params=count=countSql #es\u670D\u52A1\u5668\u5730\u5740\u914D\u7F6E elasticsearch.userName= elasticsearch.password= elasticsearch.rest.hostNames=127.0.0.1 elasticsearch.rest.port=9200 #es2\u670D\u52A1\u5668\u5730\u5740\u914D\u7F6E elasticsearch2.userName= elasticsearch2.password= elasticsearch2.rest.hostNames=127.0.0.1 elasticsearch2.rest.port=9200
repos\springBoot-master\springboot-elasticsearch\src\main\resources\local\application.properties
2
请完成以下Java代码
public PublicKeyCredentialRequestOptionsBuilder allowCredentials( List<PublicKeyCredentialDescriptor> allowCredentials) { Assert.notNull(allowCredentials, "allowCredentials cannot be null"); this.allowCredentials = allowCredentials; return this; } /** * Sets the {@link #getUserVerification()} property. * @param userVerification the user verification * @return the {@link PublicKeyCredentialRequestOptionsBuilder} */ public PublicKeyCredentialRequestOptionsBuilder userVerification(UserVerificationRequirement userVerification) { this.userVerification = userVerification; return this; } /** * Sets the {@link #getExtensions()} property * @param extensions the extensions * @return the {@link PublicKeyCredentialRequestOptionsBuilder} */ public PublicKeyCredentialRequestOptionsBuilder extensions(AuthenticationExtensionsClientInputs extensions) { this.extensions = extensions; return this; } /**
* Allows customizing the {@link PublicKeyCredentialRequestOptionsBuilder} * @param customizer the {@link Consumer} used to customize the builder * @return the {@link PublicKeyCredentialRequestOptionsBuilder} */ public PublicKeyCredentialRequestOptionsBuilder customize( Consumer<PublicKeyCredentialRequestOptionsBuilder> customizer) { customizer.accept(this); return this; } /** * Builds a new {@link PublicKeyCredentialRequestOptions} * @return a new {@link PublicKeyCredentialRequestOptions} */ public PublicKeyCredentialRequestOptions build() { if (this.challenge == null) { this.challenge = Bytes.random(); } return new PublicKeyCredentialRequestOptions(this.challenge, this.timeout, this.rpId, this.allowCredentials, this.userVerification, this.extensions); } } }
repos\spring-security-main\webauthn\src\main\java\org\springframework\security\web\webauthn\api\PublicKeyCredentialRequestOptions.java
1
请完成以下Java代码
public void deleteHistoricIdentityLinksLogByProcessDefinitionId(String processDefId) { if (isHistoryEventProduced()) { getDbEntityManager().delete(HistoricIdentityLinkLogEntity.class, "deleteHistoricIdentityLinksByProcessDefinitionId", processDefId); } } public void deleteHistoricIdentityLinksLogByTaskId(String taskId) { if (isHistoryEventProduced()) { getDbEntityManager().delete(HistoricIdentityLinkLogEntity.class, "deleteHistoricIdentityLinksByTaskId", taskId); } } public void deleteHistoricIdentityLinksLogByTaskProcessInstanceIds(List<String> processInstanceIds) { getDbEntityManager().deletePreserveOrder(HistoricIdentityLinkLogEntity.class, "deleteHistoricIdentityLinksByTaskProcessInstanceIds", processInstanceIds); } public void deleteHistoricIdentityLinksLogByTaskCaseInstanceIds(List<String> caseInstanceIds) { getDbEntityManager().deletePreserveOrder(HistoricIdentityLinkLogEntity.class, "deleteHistoricIdentityLinksByTaskCaseInstanceIds", caseInstanceIds); } public DbOperation deleteHistoricIdentityLinkLogByRemovalTime(Date removalTime, int minuteFrom, int minuteTo, int batchSize) { Map<String, Object> parameters = new HashMap<>(); parameters.put("removalTime", removalTime); if (minuteTo - minuteFrom + 1 < 60) {
parameters.put("minuteFrom", minuteFrom); parameters.put("minuteTo", minuteTo); } parameters.put("batchSize", batchSize); return getDbEntityManager() .deletePreserveOrder(HistoricIdentityLinkLogEntity.class, "deleteHistoricIdentityLinkLogByRemovalTime", new ListQueryParameterObject(parameters, 0, batchSize)); } protected void configureQuery(HistoricIdentityLinkLogQueryImpl query) { getAuthorizationManager().configureHistoricIdentityLinkQuery(query); getTenantManager().configureQuery(query); } protected boolean isHistoryEventProduced() { HistoryLevel historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel(); return historyLevel.isHistoryEventProduced(HistoryEventTypes.IDENTITY_LINK_ADD, null) || historyLevel.isHistoryEventProduced(HistoryEventTypes.IDENTITY_LINK_DELETE, null); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\HistoricIdentityLinkLogManager.java
1
请完成以下Java代码
public Collection<Dependency> getAll() { return Collections .unmodifiableCollection(this.indexedDependencies.values().stream().distinct().collect(Collectors.toList())); } public void validate() { index(); } public void updateCompatibilityRange(VersionParser versionParser) { this.indexedDependencies.values().forEach((it) -> it.updateCompatibilityRange(versionParser)); } @Override public void merge(List<DependencyGroup> otherContent) { otherContent.forEach((group) -> { if (this.content.stream() .noneMatch((it) -> group.getName() != null && group.getName().equals(it.getName()))) { this.content.add(group); } }); index(); } private void index() { this.indexedDependencies.clear(); this.content.forEach((group) -> group.content.forEach((dependency) -> { // Apply defaults if (dependency.getCompatibilityRange() == null && group.getCompatibilityRange() != null) { dependency.setCompatibilityRange(group.getCompatibilityRange()); }
if (dependency.getBom() == null && group.getBom() != null) { dependency.setBom(group.getBom()); } if (dependency.getRepository() == null && group.getRepository() != null) { dependency.setRepository(group.getRepository()); } dependency.resolve(); indexDependency(dependency.getId(), dependency); for (String alias : dependency.getAliases()) { indexDependency(alias, dependency); } })); } private void indexDependency(String id, Dependency dependency) { Dependency existing = this.indexedDependencies.get(id); if (existing != null) { throw new IllegalArgumentException("Could not register " + dependency + " another dependency " + "has also the '" + id + "' id " + existing); } this.indexedDependencies.put(id, dependency); } }
repos\initializr-main\initializr-metadata\src\main\java\io\spring\initializr\metadata\DependenciesCapability.java
1
请完成以下Java代码
public QueryService getQueryService(String processEngineName) { CommandExecutor commandExecutor = getCommandExecutor(processEngineName); return new QueryServiceImpl(commandExecutor); } @Override public CommandExecutor getCommandExecutor(String processEngineName) { CommandExecutor commandExecutor = commandExecutors.get(processEngineName); if (commandExecutor == null) { commandExecutor = createCommandExecutor(processEngineName); commandExecutors.put(processEngineName, commandExecutor); } return commandExecutor; } /** * Deprecated: use {@link #getAppPluginRegistry()} */ @Deprecated public PluginRegistry getPluginRegistry() { return new DefaultPluginRegistry(pluginRegistry); } /** * Returns the list of mapping files that should be used to create the * session factory for this runtime. * * @return */ protected List<String> getMappingFiles() { List<CockpitPlugin> cockpitPlugins = pluginRegistry.getPlugins(); List<String> mappingFiles = new ArrayList<String>(); for (CockpitPlugin plugin: cockpitPlugins) {
mappingFiles.addAll(plugin.getMappingFiles()); } return mappingFiles; } /** * Create command executor for the engine with the given name * * @param processEngineName * @return */ protected CommandExecutor createCommandExecutor(String processEngineName) { ProcessEngine processEngine = getProcessEngine(processEngineName); if (processEngine == null) { throw new ProcessEngineException("No process engine with name " + processEngineName + " found."); } ProcessEngineConfigurationImpl processEngineConfiguration = ((ProcessEngineImpl)processEngine).getProcessEngineConfiguration(); List<String> mappingFiles = getMappingFiles(); return new CommandExecutorImpl(processEngineConfiguration, mappingFiles); } }
repos\camunda-bpm-platform-master\webapps\assembly\src\main\java\org\camunda\bpm\cockpit\impl\DefaultCockpitRuntimeDelegate.java
1
请完成以下Java代码
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 setOffsetDays (final int OffsetDays) { set_Value (COLUMNNAME_OffsetDays, OffsetDays); } @Override public int getOffsetDays() { return get_ValueAsInt(COLUMNNAME_OffsetDays); } @Override public void setPercent (final int Percent) { set_Value (COLUMNNAME_Percent, Percent); } @Override public int getPercent() { return get_ValueAsInt(COLUMNNAME_Percent); } /** * ReferenceDateType AD_Reference_ID=541989 * Reference name: ReferenceDateType */ public static final int REFERENCEDATETYPE_AD_Reference_ID=541989; /** InvoiceDate = IV */ public static final String REFERENCEDATETYPE_InvoiceDate = "IV"; /** BLDate = BL */
public static final String REFERENCEDATETYPE_BLDate = "BL"; /** OrderDate = OD */ public static final String REFERENCEDATETYPE_OrderDate = "OD"; /** LCDate = LC */ public static final String REFERENCEDATETYPE_LCDate = "LC"; /** ETADate = ET */ public static final String REFERENCEDATETYPE_ETADate = "ET"; @Override public void setReferenceDateType (final java.lang.String ReferenceDateType) { set_Value (COLUMNNAME_ReferenceDateType, ReferenceDateType); } @Override public java.lang.String getReferenceDateType() { return get_ValueAsString(COLUMNNAME_ReferenceDateType); } @Override public void setSeqNo (final int SeqNo) { set_Value (COLUMNNAME_SeqNo, SeqNo); } @Override public int getSeqNo() { return get_ValueAsInt(COLUMNNAME_SeqNo); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_PaymentTerm_Break.java
1
请完成以下Java代码
public String getProcessDefinitionId() { return processDefinitionId; } /** Reference to the overall process instance */ public String getProcessInstanceId() { return processInstanceId; } /** * Return the id of the tenant this execution belongs to. Can be * <code>null</code> if the execution belongs to no single tenant. */ public String getTenantId() { return tenantId; } @Override
public String toString() { return this.getClass().getSimpleName() + "[id=" + id + ", eventName=" + eventName + ", businessKey=" + businessKey + ", activityInstanceId=" + activityInstanceId + ", currentActivityId=" + currentActivityId + ", currentActivityName=" + currentActivityName + ", currentTransitionId=" + currentTransitionId + ", parentActivityInstanceId=" + parentActivityInstanceId + ", parentId=" + parentId + ", processBusinessKey=" + processBusinessKey + ", processDefinitionId=" + processDefinitionId + ", processInstanceId=" + processInstanceId + ", tenantId=" + tenantId + "]"; } }
repos\camunda-bpm-platform-master\spring-boot-starter\starter\src\main\java\org\camunda\bpm\spring\boot\starter\event\ExecutionEvent.java
1
请完成以下Java代码
public BigDecimal getQtyBOM() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyBOM); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setScrap (final @Nullable BigDecimal Scrap) { set_Value (COLUMNNAME_Scrap, Scrap); } @Override public BigDecimal getScrap() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Scrap); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setSeqNo (final int SeqNo) { set_Value (COLUMNNAME_SeqNo, SeqNo); } @Override public int getSeqNo() { return get_ValueAsInt(COLUMNNAME_SeqNo); } @Override public void setTM_Product_ID (final int TM_Product_ID) { if (TM_Product_ID < 1)
set_Value (COLUMNNAME_TM_Product_ID, null); else set_Value (COLUMNNAME_TM_Product_ID, TM_Product_ID); } @Override public int getTM_Product_ID() { return get_ValueAsInt(COLUMNNAME_TM_Product_ID); } @Override public void setValidFrom (final @Nullable java.sql.Timestamp ValidFrom) { set_Value (COLUMNNAME_ValidFrom, ValidFrom); } @Override public java.sql.Timestamp getValidFrom() { return get_ValueAsTimestamp(COLUMNNAME_ValidFrom); } @Override public void setValidTo (final @Nullable java.sql.Timestamp ValidTo) { set_Value (COLUMNNAME_ValidTo, ValidTo); } @Override public java.sql.Timestamp getValidTo() { return get_ValueAsTimestamp(COLUMNNAME_ValidTo); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_RV_PP_Product_BOMLine.java
1
请完成以下Java代码
public I_C_ValidCombination getV_Liability_A() throws RuntimeException { return (I_C_ValidCombination)MTable.get(getCtx(), I_C_ValidCombination.Table_Name) .getPO(getV_Liability_Acct(), get_TrxName()); } /** Set Vendor Liability. @param V_Liability_Acct Account for Vendor Liability */ public void setV_Liability_Acct (int V_Liability_Acct) { set_Value (COLUMNNAME_V_Liability_Acct, Integer.valueOf(V_Liability_Acct)); } /** Get Vendor Liability. @return Account for Vendor Liability */ public int getV_Liability_Acct () { Integer ii = (Integer)get_Value(COLUMNNAME_V_Liability_Acct); if (ii == null) return 0; return ii.intValue(); } public I_C_ValidCombination getV_Liability_Services_A() throws RuntimeException { return (I_C_ValidCombination)MTable.get(getCtx(), I_C_ValidCombination.Table_Name) .getPO(getV_Liability_Services_Acct(), get_TrxName()); } /** Set Vendor Service Liability. @param V_Liability_Services_Acct Account for Vender Service Liability */ public void setV_Liability_Services_Acct (int V_Liability_Services_Acct) { set_Value (COLUMNNAME_V_Liability_Services_Acct, Integer.valueOf(V_Liability_Services_Acct)); } /** Get Vendor Service Liability. @return Account for Vender Service Liability */
public int getV_Liability_Services_Acct () { Integer ii = (Integer)get_Value(COLUMNNAME_V_Liability_Services_Acct); if (ii == null) return 0; return ii.intValue(); } public I_C_ValidCombination getV_Prepayment_A() throws RuntimeException { return (I_C_ValidCombination)MTable.get(getCtx(), I_C_ValidCombination.Table_Name) .getPO(getV_Prepayment_Acct(), get_TrxName()); } /** Set Vendor Prepayment. @param V_Prepayment_Acct Account for Vendor Prepayments */ public void setV_Prepayment_Acct (int V_Prepayment_Acct) { set_Value (COLUMNNAME_V_Prepayment_Acct, Integer.valueOf(V_Prepayment_Acct)); } /** Get Vendor Prepayment. @return Account for Vendor Prepayments */ public int getV_Prepayment_Acct () { Integer ii = (Integer)get_Value(COLUMNNAME_V_Prepayment_Acct); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_BP_Vendor_Acct.java
1
请完成以下Java代码
public void remove() { throw new RuntimeException("不支持的操作"); } @Override public boolean hasNext() { try { boolean next = in.available() > 0; if (!next) in.close(); return next; } catch (IOException e) { throw new RuntimeException(e); } } @Override public Document next()
{ try { return new Document(in); } catch (IOException e) { throw new RuntimeException(e); } } }; } catch (IOException e) { throw new RuntimeException(e); } } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\classification\corpus\FileDataSet.java
1
请完成以下Java代码
public Liefervorgabe getBestellLiefervorgabe() { return bestellLiefervorgabe; } /** * Sets the value of the bestellLiefervorgabe property. * * @param value * allowed object is * {@link Liefervorgabe } * */ public void setBestellLiefervorgabe(Liefervorgabe value) { this.bestellLiefervorgabe = value; } /** * Gets the value of the substitution property. * * @return * possible object is * {@link BestellungSubstitution } * */ public BestellungSubstitution getSubstitution() { return substitution; } /** * Sets the value of the substitution property. * * @param value * allowed object is * {@link BestellungSubstitution } * */ public void setSubstitution(BestellungSubstitution value) { this.substitution = value; } /** * Gets the value of the anteile 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 anteile property. *
* <p> * For example, to add a new item, do as follows: * <pre> * getAnteile().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link BestellungAnteil } * * */ public List<BestellungAnteil> getAnteile() { if (anteile == null) { anteile = new ArrayList<BestellungAnteil>(); } return this.anteile; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.msv3.schema.v1\src\main\java-xjc\de\metas\vertical\pharma\vendor\gateway\msv3\schema\v1\BestellungAntwortPosition.java
1
请完成以下Java代码
public Class<NoDeviceResponse> getResponseClass() { return NoDeviceResponse.class; } @NonNull public String getCmd() { final int scale = getTargetScale(); return "<K180K" + format(targetWeight, scale) + ";" + format(negativeTolerance, scale) + ";" + format(positiveTolerance, scale) + ">"; } private int getTargetScale()
{ return Optional.ofNullable(targetWeightScale).orElse(DEFAULT_SCALE); } /** * Formats decimal value to fit Soehenle scale specs. */ @NonNull private static String format(@NonNull final BigDecimal value, final int scale) { final BigDecimal absValue = value.abs(); final BigDecimal valueToUse = absValue.setScale(scale, RoundingMode.HALF_UP); return NumberUtils.toStringWithCustomDecimalSeparator(valueToUse, ','); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.device.scales\src\main\java\de\metas\device\scales\impl\soehenle\SoehenleSendTargetWeightRequest.java
1
请完成以下Java代码
public MWebProject getWebProject() { if (m_project == null) m_project = MWebProject.get(getCtx(), getCM_WebProject_ID()); return m_project; } // getWebProject /** * Get AD_Tree_ID * @return tree */ public int getAD_Tree_ID() { return getWebProject().getAD_TreeCMM_ID(); } // getAD_Tree_ID; /** * Before Save * @param newRecord new * @return true */ @Override protected boolean beforeSave (boolean newRecord) { if (isSummary()) { setMediaType(null); setAD_Image_ID(0); } return true; } // beforeSave /** * After Save. * Insert * - create tree * @param newRecord insert * @param success save success * @return true if saved */ @Override protected boolean afterSave (boolean newRecord, boolean success) { if (!success) return success; if (newRecord) { StringBuffer sb = new StringBuffer ("INSERT INTO AD_TreeNodeCMM " + "(AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, " + "AD_Tree_ID, Node_ID, Parent_ID, SeqNo) " + "VALUES (") .append(getAD_Client_ID()).append(",0, 'Y', now(), 0, now(), 0,") .append(getAD_Tree_ID()).append(",").append(get_ID()) .append(", 0, 999)"); int no = DB.executeUpdateAndSaveErrorOnFail(sb.toString(), get_TrxName()); if (no > 0) log.debug("#" + no + " - TreeType=CMM"); else log.warn("#" + no + " - TreeType=CMM"); return no > 0; } return success; } // afterSave /** * After Delete * @param success * @return deleted */ @Override protected boolean afterDelete (boolean success) { if (!success) return success; // StringBuffer sb = new StringBuffer ("DELETE FROM AD_TreeNodeCMM ") .append(" WHERE Node_ID=").append(get_IDOld()) .append(" AND AD_Tree_ID=").append(getAD_Tree_ID()); int no = DB.executeUpdateAndSaveErrorOnFail(sb.toString(), get_TrxName());
if (no > 0) log.debug("#" + no + " - TreeType=CMM"); else log.warn("#" + no + " - TreeType=CMM"); return no > 0; } // afterDelete /** * Get File Name * @return file name return ID */ public String getFileName() { return get_ID() + getExtension(); } // getFileName /** * Get Extension with . * @return extension */ public String getExtension() { String mt = getMediaType(); if (MEDIATYPE_ApplicationPdf.equals(mt)) return ".pdf"; if (MEDIATYPE_ImageGif.equals(mt)) return ".gif"; if (MEDIATYPE_ImageJpeg.equals(mt)) return ".jpg"; if (MEDIATYPE_ImagePng.equals(mt)) return ".png"; if (MEDIATYPE_TextCss.equals(mt)) return ".css"; // Unknown return ".dat"; } // getExtension /** * Get Image * @return image or null */ public MImage getImage() { if (getAD_Image_ID() != 0) return MImage.get(getCtx(), getAD_Image_ID()); return null; } // getImage } // MMedia
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MMedia.java
1
请在Spring Boot框架中完成以下Java代码
public void export(HttpServletResponse response) throws Exception { //mock datas Goods goods1 = new Goods(); List<GoodType> goodTypeList1 = new ArrayList<>(); GoodType goodType1 = new GoodType(); goodType1.setTypeId("apple-1"); goodType1.setTypeName("apple-red"); goodTypeList1.add(goodType1); GoodType goodType2 = new GoodType(); goodType2.setTypeId("apple-2"); goodType2.setTypeName("apple-white"); goodTypeList1.add(goodType2); goods1.setNo(110); goods1.setName("apple"); goods1.setShelfLife(new Date()); goods1.setGoodTypes(goodTypeList1); Goods goods2 = new Goods(); List<GoodType> goodTypeList2 = new ArrayList<>(); GoodType goodType21 = new GoodType(); goodType21.setTypeId("wine-1"); goodType21.setTypeName("wine-red"); goodTypeList2.add(goodType21); GoodType goodType22 = new GoodType(); goodType22.setTypeId("wine-2"); goodType22.setTypeName("wine-white"); goodTypeList2.add(goodType22); goods2.setNo(111); goods2.setName("wine"); goods2.setShelfLife(new Date()); goods2.setGoodTypes(goodTypeList2); List<Goods> goodsList = new ArrayList<Goods>(); goodsList.add(goods1); goodsList.add(goods2); for (Goods goods : goodsList) {
System.out.println(goods); } //export FileUtil.exportExcel(goodsList, Goods.class,"product.xls",response); } @RequestMapping("/importExcel") public void importExcel() throws Exception { //loal file String filePath = "C:\\Users\\Dell\\Downloads\\product.xls"; //anaysis excel List<Goods> goodsList = FileUtil.importExcel(filePath,0,1,Goods.class); //also use MultipartFile,invoke FileUtil.importExcel(MultipartFile file, Integer titleRows, Integer headerRows, Class<T> pojoClass) System.out.println("load data count【"+goodsList.size()+"】row"); //TODO save datas for (Goods goods:goodsList) { JSONObject.toJSONString(goods); } } }
repos\springboot-demo-master\eaypoi\src\main\java\com\et\easypoi\controller\HelloWorldController.java
2
请完成以下Java代码
public ProcessEngine getProcessEngine(String processEngineName) { try { return processEngineProvider.getProcessEngine(processEngineName); } catch (Exception e) { throw new ProcessEngineException("No process engine with name " + processEngineName + " found.", e); } } public Set<String> getProcessEngineNames() { return processEngineProvider.getProcessEngineNames(); } public ProcessEngine getDefaultProcessEngine() { return processEngineProvider.getDefaultProcessEngine(); } public AppPluginRegistry<T> getAppPluginRegistry() { return pluginRegistry; } /** * Load the {@link ProcessEngineProvider} spi implementation. * * @return */ protected ProcessEngineProvider loadProcessEngineProvider() { ServiceLoader<ProcessEngineProvider> loader = ServiceLoader.load(ProcessEngineProvider.class); try { return loader.iterator().next(); } catch (NoSuchElementException e) { String message = String.format("No implementation for the %s spi found on classpath", ProcessEngineProvider.class.getName());
throw new IllegalStateException(message, e); } } public List<PluginResourceOverride> getResourceOverrides() { if(resourceOverrides == null) { initResourceOverrides(); } return resourceOverrides; } protected synchronized void initResourceOverrides() { if(resourceOverrides == null) { // double-checked sync, do not remove resourceOverrides = new ArrayList<PluginResourceOverride>(); List<T> plugins = pluginRegistry.getPlugins(); for (T p : plugins) { resourceOverrides.addAll(p.getResourceOverrides()); } } } }
repos\camunda-bpm-platform-master\webapps\assembly\src\main\java\org\camunda\bpm\webapp\impl\AbstractAppRuntimeDelegate.java
1
请完成以下Java代码
public ColumnInfo setColumnName(final String columnName) { this.columnName = columnName; return this; } /** * * @return internal (not translated) column name */ public String getColumnName() { return columnName; } private int precision = -1; /** * Sets precision to be used in case it's a number. * * If not set, default displayType's precision will be used. * * @param precision * @return this */ public ColumnInfo setPrecision(final int precision) { this.precision = precision; return this; } /** * * @return precision to be used in case it's a number */ public int getPrecision() { return this.precision; } public ColumnInfo setSortNo(final int sortNo)
{ this.sortNo = sortNo; return this; } /** * Gets SortNo. * * @return * @see I_AD_Field#COLUMNNAME_SortNo. */ public int getSortNo() { return sortNo; } @Override public String toString() { return ObjectUtils.toString(this); } } // infoColumn
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\minigrid\ColumnInfo.java
1
请完成以下Java代码
public void setSeqNo (final int SeqNo) { set_Value (COLUMNNAME_SeqNo, SeqNo); } @Override public int getSeqNo() { return get_ValueAsInt(COLUMNNAME_SeqNo); } @Override public de.metas.ui.web.base.model.I_WEBUI_Board getWEBUI_Board() { return get_ValueAsPO(COLUMNNAME_WEBUI_Board_ID, de.metas.ui.web.base.model.I_WEBUI_Board.class); } @Override public void setWEBUI_Board(final de.metas.ui.web.base.model.I_WEBUI_Board WEBUI_Board) { set_ValueFromPO(COLUMNNAME_WEBUI_Board_ID, de.metas.ui.web.base.model.I_WEBUI_Board.class, WEBUI_Board); } @Override public void setWEBUI_Board_ID (final int WEBUI_Board_ID) { if (WEBUI_Board_ID < 1)
set_ValueNoCheck (COLUMNNAME_WEBUI_Board_ID, null); else set_ValueNoCheck (COLUMNNAME_WEBUI_Board_ID, WEBUI_Board_ID); } @Override public int getWEBUI_Board_ID() { return get_ValueAsInt(COLUMNNAME_WEBUI_Board_ID); } @Override public void setWEBUI_Board_Lane_ID (final int WEBUI_Board_Lane_ID) { if (WEBUI_Board_Lane_ID < 1) set_ValueNoCheck (COLUMNNAME_WEBUI_Board_Lane_ID, null); else set_ValueNoCheck (COLUMNNAME_WEBUI_Board_Lane_ID, WEBUI_Board_Lane_ID); } @Override public int getWEBUI_Board_Lane_ID() { return get_ValueAsInt(COLUMNNAME_WEBUI_Board_Lane_ID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java-gen\de\metas\ui\web\base\model\X_WEBUI_Board_Lane.java
1
请完成以下Java代码
public int getAD_User_SortPref_Hdr_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_SortPref_Hdr_ID); if (ii == null) return 0; return ii.intValue(); } @Override public org.compiere.model.I_AD_Window getAD_Window() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_AD_Window_ID, org.compiere.model.I_AD_Window.class); } @Override public void setAD_Window(org.compiere.model.I_AD_Window AD_Window) { set_ValueFromPO(COLUMNNAME_AD_Window_ID, org.compiere.model.I_AD_Window.class, AD_Window); } /** Set Fenster. @param AD_Window_ID Eingabe- oder Anzeige-Fenster */ @Override public void setAD_Window_ID (int AD_Window_ID) { if (AD_Window_ID < 1) set_Value (COLUMNNAME_AD_Window_ID, null); else set_Value (COLUMNNAME_AD_Window_ID, Integer.valueOf(AD_Window_ID)); } /** Get Fenster. @return Eingabe- oder Anzeige-Fenster */ @Override public int getAD_Window_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_AD_Window_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Beschreibung. @param Description Beschreibung */ @Override public void setDescription (java.lang.String Description) { set_Value (COLUMNNAME_Description, Description); }
/** Get Beschreibung. @return Beschreibung */ @Override public java.lang.String getDescription () { return (java.lang.String)get_Value(COLUMNNAME_Description); } /** Set Konferenz. @param IsConference Konferenz */ @Override public void setIsConference (boolean IsConference) { set_Value (COLUMNNAME_IsConference, Boolean.valueOf(IsConference)); } /** Get Konferenz. @return Konferenz */ @Override public boolean isConference () { Object oo = get_Value(COLUMNNAME_IsConference); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_User_SortPref_Hdr.java
1
请在Spring Boot框架中完成以下Java代码
private BPartner importBPartnerNoCascade(final SyncBPartner syncBpartner) { // // BPartner BPartner bpartner = bpartnersRepo.findByUuid(syncBpartner.getUuid()); // // Handle delete request if (syncBpartner.isDeleted()) { if (bpartner != null) { deleteBPartner(bpartner); } return bpartner; } if (bpartner == null) { bpartner = new BPartner(); bpartner.setUuid(syncBpartner.getUuid()); } bpartner.setDeleted(false);
bpartner.setName(syncBpartner.getName()); bpartnersRepo.save(bpartner); logger.debug("Imported: {} -> {}", syncBpartner, bpartner); return bpartner; } private void deleteBPartner(final BPartner bpartner) { if (bpartner.isDeleted()) { return; } bpartner.setDeleted(true); bpartnersRepo.save(bpartner); logger.debug("Deleted: {}", bpartner); } }
repos\metasfresh-new_dawn_uat\misc\services\procurement-webui\procurement-webui-backend\src\main\java\de\metas\procurement\webui\sync\SyncBPartnerImportService.java
2
请完成以下Java代码
private Optional<InvoiceId> retrieveInvoice(final IdentifierString invoiceIdentifier, final OrgId orgId, final DocBaseAndSubType docType) { final InvoiceQuery invoiceQuery = createInvoiceQuery(invoiceIdentifier).docType(docType).orgId(orgId).build(); return invoiceDAO.retrieveIdByInvoiceQuery(invoiceQuery); } private static InvoiceQuery.InvoiceQueryBuilder createInvoiceQuery(@NonNull final IdentifierString identifierString) { final IdentifierString.Type type = identifierString.getType(); if (IdentifierString.Type.METASFRESH_ID.equals(type)) { return InvoiceQuery.builder().invoiceId(MetasfreshId.toValue(identifierString.asMetasfreshId())); } else if (IdentifierString.Type.EXTERNAL_ID.equals(type)) { return InvoiceQuery.builder().externalId(identifierString.asExternalId()); } else if (IdentifierString.Type.DOC.equals(type)) { return InvoiceQuery.builder().documentNo(identifierString.asDoc()); } else { throw new AdempiereException("Invalid identifierString: " + identifierString); } } private Optional<I_C_Order> getOrderIdFromIdentifier(final IdentifierString orderIdentifier, final OrgId orgId) { return orderDAO.retrieveByOrderCriteria(createOrderQuery(orderIdentifier, orgId)); } private OrderQuery createOrderQuery(final IdentifierString identifierString, final OrgId orgId) { final IdentifierString.Type type = identifierString.getType(); final OrderQuery.OrderQueryBuilder builder = OrderQuery.builder().orgId(orgId); if (IdentifierString.Type.METASFRESH_ID.equals(type)) { return builder .orderId(MetasfreshId.toValue(identifierString.asMetasfreshId())) .build();
} else if (IdentifierString.Type.EXTERNAL_ID.equals(type)) { return builder .externalId(identifierString.asExternalId()) .build(); } else if (IdentifierString.Type.DOC.equals(type)) { return builder .documentNo(identifierString.asDoc()) .build(); } else { throw new AdempiereException("Invalid identifierString: " + identifierString); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business.rest-api-impl\src\main\java\de\metas\rest_api\v1\payment\JsonPaymentService.java
1
请完成以下Java代码
public static MProductPO[] getOfProduct (Properties ctx, int M_Product_ID, String trxName) { final String whereClause = "M_Product_ID=? AND IsActive=?"; List<MProductPO> list = new Query(ctx, Table_Name, whereClause, trxName) .setParameters(new Object[]{M_Product_ID, "Y"}) .setOrderBy("IsCurrentVendor DESC") .list(MProductPO.class); return list.toArray(new MProductPO[list.size()]); } // getOfProduct /** * Persistency Constructor * @param ctx context * @param ignored ignored * @param trxName transaction */ public MProductPO (Properties ctx, int ignored, String trxName) { super(ctx, 0, trxName); if (ignored != 0) throw new IllegalArgumentException("Multi-Key"); else { // setM_Product_ID (0); // @M_Product_ID@
// setC_BPartner_ID (0); // 0 // setVendorProductNo (null); // @Value@ setIsCurrentVendor (true); // Y } } // MProduct_PO /** * Load Constructor * @param ctx context * @param rs result set * @param trxName transaction */ public MProductPO(Properties ctx, ResultSet rs, String trxName) { super(ctx, rs, trxName); } // MProductPO } // MProductPO
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MProductPO.java
1
请在Spring Boot框架中完成以下Java代码
public class RpNotifyRecordLog extends BaseEntity { /** 通知记录ID **/ private String notifyId; /** 请求信息 **/ private String request; /** 返回信息 **/ private String response; /** 商户编号 **/ private String merchantNo; /** 商户订单号 **/ private String merchantOrderNo; /** HTTP状态 **/ private Integer httpStatus; private Date createTime; public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public RpNotifyRecordLog() { super(); } public RpNotifyRecordLog(Date createTime, String notifyId, String request, String response, String merchantNo, String merchantOrderNo, Integer httpStatus) { super(); this.createTime = createTime; this.notifyId = notifyId; this.request = request; this.response = response; this.merchantNo = merchantNo; this.merchantOrderNo = merchantOrderNo; this.httpStatus = httpStatus; } /** 通知记录ID **/ public String getNotifyId() { return notifyId; } /** 通知记录ID **/ public void setNotifyId(String notifyId) { this.notifyId = notifyId; } /** 请求信息 **/ public String getRequest() { return request; }
/** 请求信息 **/ public void setRequest(String request) { this.request = request == null ? null : request.trim(); } /** 返回信息 **/ public String getResponse() { return response; } /** 返回信息 **/ public void setResponse(String response) { this.response = response == null ? null : response.trim(); } /** 商户编号 **/ public String getMerchantNo() { return merchantNo; } /** 商户编号 **/ public void setMerchantNo(String merchantNo) { this.merchantNo = merchantNo == null ? null : merchantNo.trim(); } /** 商户订单号 **/ public String getMerchantOrderNo() { return merchantOrderNo; } /** 商户订单号 **/ public void setMerchantOrderNo(String merchantOrderNo) { this.merchantOrderNo = merchantOrderNo == null ? null : merchantOrderNo.trim(); } /** HTTP状态 **/ public Integer getHttpStatus() { return httpStatus; } /** HTTP状态 **/ public void setHttpStatus(Integer httpStatus) { this.httpStatus = httpStatus; } }
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\notify\entity\RpNotifyRecordLog.java
2
请完成以下Java代码
public String toString() { return getClass().getSimpleName() + "[" + delegate + "]"; } @Override public void setHUIterator(final IHUIterator iterator) { delegate.setHUIterator(iterator); } protected IHUIterator getHUIterator() { if (delegate instanceof HUIteratorListenerAdapter) { return ((HUIteratorListenerAdapter)delegate).getHUIterator(); } else { throw new AdempiereException("Cannot get HUIterator from delegate: " + delegate); } } @Override public Result beforeHU(final IMutable<I_M_HU> hu) { return delegate.beforeHU(hu); }
@Override public Result afterHU(final I_M_HU hu) { return delegate.afterHU(hu); } @Override public Result beforeHUItem(final IMutable<I_M_HU_Item> item) { return delegate.beforeHUItem(item); } @Override public Result afterHUItem(final I_M_HU_Item item) { return delegate.afterHUItem(item); } @Override public Result beforeHUItemStorage(final IMutable<IHUItemStorage> itemStorage) { return delegate.beforeHUItemStorage(itemStorage); } @Override public Result afterHUItemStorage(final IHUItemStorage itemStorage) { return delegate.afterHUItemStorage(itemStorage); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\HUIteratorListenerDelegateAdapter.java
1
请完成以下Java代码
public UOMConversionRate getRate(@NonNull final UomId fromUomId, @NonNull final UomId toUomId) { final UOMConversionRate rate = getRateOrNull(fromUomId, toUomId); if (rate == null) { throw new NoUOMConversionException(productId, fromUomId, toUomId); } return rate; } public Optional<UOMConversionRate> getRateIfExists(@NonNull final UomId fromUomId, @NonNull final UomId toUomId) { return Optional.ofNullable(getRateOrNull(fromUomId, toUomId)); } @Nullable private UOMConversionRate getRateOrNull(@NonNull final UomId fromUomId, @NonNull final UomId toUomId) { if (fromUomId.equals(toUomId)) { return UOMConversionRate.one(fromUomId); } final FromAndToUomIds key = FromAndToUomIds.builder() .fromUomId(fromUomId) .toUomId(toUomId) .build(); final UOMConversionRate directRate = rates.get(key); if (directRate != null) { return directRate; } final UOMConversionRate invertedRate = rates.get(key.invert()); if (invertedRate != null) { return invertedRate.invert(); } return null; } public boolean isEmpty() { return rates.isEmpty(); } public ImmutableSet<UomId> getCatchUomIds() { if (rates.isEmpty()) { return ImmutableSet.of(); }
return rates.values() .stream() .filter(UOMConversionRate::isCatchUOMForProduct) .map(UOMConversionRate::getToUomId) .collect(ImmutableSet.toImmutableSet()); } private static FromAndToUomIds toFromAndToUomIds(final UOMConversionRate conversion) { return FromAndToUomIds.builder() .fromUomId(conversion.getFromUomId()) .toUomId(conversion.getToUomId()) .build(); } @Value @Builder public static class FromAndToUomIds { @NonNull UomId fromUomId; @NonNull UomId toUomId; public FromAndToUomIds invert() { return builder().fromUomId(toUomId).toUomId(fromUomId).build(); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\uom\UOMConversionsMap.java
1
请在Spring Boot框架中完成以下Java代码
public class JwtAuthenticationController { private final JwtTokenService tokenService; private final AuthenticationManager authenticationManager; public JwtAuthenticationController(JwtTokenService tokenService, AuthenticationManager authenticationManager) { this.tokenService = tokenService; this.authenticationManager = authenticationManager; } @PostMapping("/authenticate") public ResponseEntity<JwtTokenResponse> generateToken( @RequestBody JwtTokenRequest jwtTokenRequest) {
var authenticationToken = new UsernamePasswordAuthenticationToken( jwtTokenRequest.username(), jwtTokenRequest.password()); var authentication = authenticationManager.authenticate(authenticationToken); var token = tokenService.generateToken(authentication); return ResponseEntity.ok(new JwtTokenResponse(token)); } }
repos\master-spring-and-spring-boot-main\13-full-stack\02-rest-api\src\main\java\com\in28minutes\rest\webservices\restfulwebservices\jwt\JwtAuthenticationController.java
2
请完成以下Java代码
public void setM_InOut_ID (final int M_InOut_ID) { if (M_InOut_ID < 1) set_Value (COLUMNNAME_M_InOut_ID, null); else set_Value (COLUMNNAME_M_InOut_ID, M_InOut_ID); } @Override public int getM_InOut_ID() { return get_ValueAsInt(COLUMNNAME_M_InOut_ID); } @Override public org.compiere.model.I_M_InOutLine getM_InOutLine() { return get_ValueAsPO(COLUMNNAME_M_InOutLine_ID, org.compiere.model.I_M_InOutLine.class); } @Override public void setM_InOutLine(final org.compiere.model.I_M_InOutLine M_InOutLine) { set_ValueFromPO(COLUMNNAME_M_InOutLine_ID, org.compiere.model.I_M_InOutLine.class, M_InOutLine); } @Override public void setM_InOutLine_ID (final int M_InOutLine_ID) { if (M_InOutLine_ID < 1) set_Value (COLUMNNAME_M_InOutLine_ID, null); else set_Value (COLUMNNAME_M_InOutLine_ID, M_InOutLine_ID); } @Override public int getM_InOutLine_ID() { return get_ValueAsInt(COLUMNNAME_M_InOutLine_ID); } @Override public void setQtyDeliveredInUOM (final @Nullable BigDecimal QtyDeliveredInUOM) { set_Value (COLUMNNAME_QtyDeliveredInUOM, QtyDeliveredInUOM); } @Override public BigDecimal getQtyDeliveredInUOM()
{ final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyDeliveredInUOM); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setQtyEntered (final @Nullable BigDecimal QtyEntered) { set_Value (COLUMNNAME_QtyEntered, QtyEntered); } @Override public BigDecimal getQtyEntered() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyEntered); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setQtyInvoicedInUOM (final @Nullable BigDecimal QtyInvoicedInUOM) { set_Value (COLUMNNAME_QtyInvoicedInUOM, QtyInvoicedInUOM); } @Override public BigDecimal getQtyInvoicedInUOM() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyInvoicedInUOM); return bd != null ? bd : BigDecimal.ZERO; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java-gen\de\metas\contracts\model\X_C_CallOrderDetail.java
1
请在Spring Boot框架中完成以下Java代码
public BeetlSqlScannerConfigurer getBeetlSqlScannerConfigurer() { BeetlSqlScannerConfigurer conf = new BeetlSqlScannerConfigurer(); conf.setBasePackage("com.forezp.dao"); conf.setDaoSuffix("Dao"); conf.setSqlManagerFactoryBeanName("sqlManagerFactoryBean"); return conf; } @Bean(name = "sqlManagerFactoryBean") @Primary public SqlManagerFactoryBean getSqlManagerFactoryBean(@Qualifier("datasource") DataSource datasource) { SqlManagerFactoryBean factory = new SqlManagerFactoryBean(); BeetlSqlDataSource source = new BeetlSqlDataSource(); source.setMasterSource(datasource); factory.setCs(source); factory.setDbStyle(new MySqlStyle()); factory.setInterceptors(new Interceptor[]{new DebugInterceptor()}); factory.setNc(new UnderlinedNameConversion());//开启驼峰
factory.setSqlLoader(new ClasspathLoader("/sql"));//sql文件路径 return factory; } //配置数据库 @Bean(name = "datasource") public DataSource getDataSource() { return DataSourceBuilder.create().url("jdbc:mysql://127.0.0.1:3306/test").username("root").password("123456").build(); } //开启事务 @Bean(name = "txManager") public DataSourceTransactionManager getDataSourceTransactionManager(@Qualifier("datasource") DataSource datasource) { DataSourceTransactionManager dsm = new DataSourceTransactionManager(); dsm.setDataSource(datasource); return dsm; } }
repos\SpringBootLearning-master\springboot-beatlsql\src\main\java\com\forezp\SpringbootBeatlsqlApplication.java
2
请完成以下Java代码
public PropertySource<?> toPropertySource() { return new PropertiesPropertySource(getClass().getSimpleName(), copy(this.entries)); } private Properties copy(Properties properties) { Properties copy = new Properties(); copy.putAll(properties); return copy; } private static final class PropertiesIterator implements Iterator<Entry> { private final Iterator<Map.Entry<Object, Object>> iterator; private PropertiesIterator(Properties properties) { this.iterator = properties.entrySet().iterator(); } @Override public boolean hasNext() { return this.iterator.hasNext(); } @Override public Entry next() { Map.Entry<Object, Object> entry = this.iterator.next(); return new Entry((String) entry.getKey(), (String) entry.getValue()); } @Override public void remove() { throw new UnsupportedOperationException("InfoProperties are immutable."); } }
/** * Property entry. */ public static final class Entry { private final String key; private final String value; private Entry(String key, String value) { this.key = key; this.value = value; } public String getKey() { return this.key; } public String getValue() { return this.value; } } }
repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\info\InfoProperties.java
1
请完成以下Java代码
private static String generateMainClass(String packageName) { return packageName + ";\n" + "\n" + "public class Main {\n" + " public static void main(String[] args){\n" + " System.out.println(\"Hello World!\");\n" + " }\n" + "}\n"; } private static Path generateFolders(Path sourceFolder, String packageName) throws IOException { return Files.createDirectories(sourceFolder.resolve(packageName)); } private Build configureJavaVersion() { Plugin plugin = new Plugin(); plugin.setGroupId("org.apache.maven.plugins"); plugin.setArtifactId("maven-compiler-plugin"); plugin.setVersion("3.8.1");
Xpp3Dom configuration = new Xpp3Dom("configuration"); Xpp3Dom source = new Xpp3Dom("source"); source.setValue(javaVersion.getVersion()); Xpp3Dom target = new Xpp3Dom("target"); target.setValue(javaVersion.getVersion()); configuration.addChild(source); configuration.addChild(target); plugin.setConfiguration(configuration); Build build = new Build(); build.addPlugin(plugin); return build; } }
repos\tutorials-master\maven-modules\maven-exec-plugin\src\main\java\com\baeldung\learningplatform\ProjectBuilder.java
1
请在Spring Boot框架中完成以下Java代码
public String getGoodsId() { return goodsId; } public void setGoodsId(String goodsId) { this.goodsId = goodsId; } public String getGoodsName() { return goodsName; } public void setGoodsName(String goodsName) { this.goodsName = goodsName; }
public Long getSinglePrice() { return singlePrice; } public void setSinglePrice(Long singlePrice) { this.singlePrice = singlePrice; } public Integer getNums() { return nums; } public void setNums(Integer nums) { this.nums = nums; } }
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\trade\entity\RoncooPayGoodsDetails.java
2
请完成以下Java代码
private void recordTaskUpdated(TaskComparatorImpl taskComparator) { // Only update history if history is enabled if (commandContext.getProcessEngineConfiguration().getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) { TaskInfo updatedTask = taskComparator.getUpdatedTask(); if (taskComparator.hasTaskNameChanged()) { commandContext.getHistoryManager().recordTaskNameChange(updatedTask.getId(), updatedTask.getName()); } if (taskComparator.hasTaskDescriptionChanged()) { commandContext .getHistoryManager() .recordTaskDescriptionChange(updatedTask.getId(), updatedTask.getDescription()); } if (taskComparator.hasTaskDueDateChanged()) { commandContext .getHistoryManager() .recordTaskDueDateChange(updatedTask.getId(), updatedTask.getDueDate()); } if (taskComparator.hasTaskPriorityChanged()) { commandContext .getHistoryManager() .recordTaskPriorityChange(updatedTask.getId(), updatedTask.getPriority()); } if (taskComparator.hasTaskCategoryChanged()) { commandContext .getHistoryManager() .recordTaskCategoryChange(updatedTask.getId(), updatedTask.getCategory());
} if (taskComparator.hasTaskFormKeyChanged()) { commandContext .getHistoryManager() .recordTaskFormKeyChange(updatedTask.getId(), updatedTask.getFormKey()); } if (taskComparator.hasTaskParentIdChanged()) { commandContext .getHistoryManager() .recordTaskParentTaskIdChange(updatedTask.getId(), updatedTask.getParentTaskId()); } if (taskComparator.hasTaskDefinitionKeyChanged()) { commandContext .getHistoryManager() .recordTaskDefinitionKeyChange(updatedTask.getId(), updatedTask.getTaskDefinitionKey()); } } } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\bpmn\helper\task\TaskUpdater.java
1
请完成以下Java代码
public void setIsAsync (final boolean IsAsync) { set_Value (COLUMNNAME_IsAsync, IsAsync); } @Override public boolean isAsync() { return get_ValueAsBoolean(COLUMNNAME_IsAsync); } @Override public void setIsFeatureActivated (final boolean IsFeatureActivated) { set_Value (COLUMNNAME_IsFeatureActivated, IsFeatureActivated); } @Override public boolean isFeatureActivated() { return get_ValueAsBoolean(COLUMNNAME_IsFeatureActivated); } @Override public void setIsQtyPerWarehouse (final boolean IsQtyPerWarehouse) { set_Value (COLUMNNAME_IsQtyPerWarehouse, IsQtyPerWarehouse); } @Override public boolean isQtyPerWarehouse() { return get_ValueAsBoolean(COLUMNNAME_IsQtyPerWarehouse); } @Override public void setMD_AvailableForSales_Config_ID (final int MD_AvailableForSales_Config_ID) { if (MD_AvailableForSales_Config_ID < 1) set_ValueNoCheck (COLUMNNAME_MD_AvailableForSales_Config_ID, null); else set_ValueNoCheck (COLUMNNAME_MD_AvailableForSales_Config_ID, MD_AvailableForSales_Config_ID);
} @Override public int getMD_AvailableForSales_Config_ID() { return get_ValueAsInt(COLUMNNAME_MD_AvailableForSales_Config_ID); } @Override public void setSalesOrderLookBehindHours (final int SalesOrderLookBehindHours) { set_Value (COLUMNNAME_SalesOrderLookBehindHours, SalesOrderLookBehindHours); } @Override public int getSalesOrderLookBehindHours() { return get_ValueAsInt(COLUMNNAME_SalesOrderLookBehindHours); } @Override public void setShipmentDateLookAheadHours (final int ShipmentDateLookAheadHours) { set_Value (COLUMNNAME_ShipmentDateLookAheadHours, ShipmentDateLookAheadHours); } @Override public int getShipmentDateLookAheadHours() { return get_ValueAsInt(COLUMNNAME_ShipmentDateLookAheadHours); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.material\cockpit\src\main\java-gen\de\metas\material\cockpit\model\X_MD_AvailableForSales_Config.java
1
请完成以下Java代码
public String getExpressionString() { return "@Value@"; } @Override public Set<CtxName> getParameters() { return PARAMETERS; } @Override public String evaluate(final Evaluatee ctx, final OnVariableNotFound onVariableNotFound) throws ExpressionEvaluationException { Integer adClientId = ctx.get_ValueAsInt(PARAMETER_AD_Client_ID, null); if (adClientId == null || adClientId < 0) { adClientId = Env.getAD_Client_ID(Env.getCtx()); } Integer adOrgId = ctx.get_ValueAsInt(PARAMETER_AD_Org_ID, null); if (adOrgId == null || adOrgId < 0)
{ adOrgId = Env.getAD_Org_ID(Env.getCtx()); } final IDocumentNoBuilderFactory documentNoFactory = Services.get(IDocumentNoBuilderFactory.class); final String value = documentNoFactory.forTableName(tableName, adClientId, adOrgId) .setFailOnError(onVariableNotFound == OnVariableNotFound.Fail) .setUsePreliminaryDocumentNo(true) .build(); if (value == null && onVariableNotFound == OnVariableNotFound.Fail) { throw new AdempiereException("No auto value sequence found for " + tableName + ", AD_Client_ID=" + adClientId + ", AD_Org_ID=" + adOrgId); } return value; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\descriptor\sql\AutoSequenceDefaultValueExpression.java
1
请完成以下Java代码
public final Mono<List<GraphQLError>> resolveException(Throwable ex, DataFetchingEnvironment env) { return Mono.defer(() -> Mono.justOrEmpty(resolveInternal(ex, env))); } private @Nullable List<GraphQLError> resolveInternal(Throwable exception, DataFetchingEnvironment env) { try { return (this.threadLocalContextAware) ? ContextPropagationHelper.captureFrom(env.getGraphQlContext()) .wrap(() -> resolveToMultipleErrors(exception, env)) .call() : resolveToMultipleErrors(exception, env); } catch (Exception ex2) { this.logger.warn("Failure while resolving " + exception.getMessage(), ex2); return null; } } /** * Override this method to resolve an Exception to multiple GraphQL errors. * @param ex the exception to resolve * @param env the environment for the invoked {@code DataFetcher} * @return the resolved errors or {@code null} if unresolved */ protected @Nullable List<GraphQLError> resolveToMultipleErrors(Throwable ex, DataFetchingEnvironment env) {
GraphQLError error = resolveToSingleError(ex, env); return (error != null) ? Collections.singletonList(error) : null; } /** * Override this method to resolve an Exception to a single GraphQL error. * @param ex the exception to resolve * @param env the environment for the invoked {@code DataFetcher} * @return the resolved error or {@code null} if unresolved */ protected @Nullable GraphQLError resolveToSingleError(Throwable ex, DataFetchingEnvironment env) { return null; } }
repos\spring-graphql-main\spring-graphql\src\main\java\org\springframework\graphql\execution\DataFetcherExceptionResolverAdapter.java
1
请在Spring Boot框架中完成以下Java代码
private String resolveBeanId(String mode) { if (isUnboundidEnabled(mode)) { return BeanIds.EMBEDDED_UNBOUNDID; } return null; } private boolean isUnboundidEnabled(String mode) { return "unboundid".equals(mode) || unboundIdPresent; } private String getPort(Element element) { String port = element.getAttribute(ATT_PORT); return (StringUtils.hasText(port) ? port : getDefaultPort()); } private String getDefaultPort() { try (ServerSocket serverSocket = new ServerSocket(DEFAULT_PORT)) { return String.valueOf(serverSocket.getLocalPort()); } catch (IOException ex) { return RANDOM_PORT; } } private static class EmbeddedLdapServerConfigBean implements ApplicationContextAware { private ApplicationContext applicationContext;
@Override public void setApplicationContext(ApplicationContext applicationContext) { this.applicationContext = applicationContext; } @SuppressWarnings("unused") private DefaultSpringSecurityContextSource createEmbeddedContextSource(String suffix) { int port = getPort(); String providerUrl = "ldap://127.0.0.1:" + port + "/" + suffix; return new DefaultSpringSecurityContextSource(providerUrl); } private int getPort() { if (unboundIdPresent) { UnboundIdContainer unboundIdContainer = this.applicationContext.getBean(UnboundIdContainer.class); return unboundIdContainer.getPort(); } throw new IllegalStateException("Embedded LDAP server is not provided"); } } }
repos\spring-security-main\config\src\main\java\org\springframework\security\config\ldap\LdapServerBeanDefinitionParser.java
2
请完成以下Java代码
public Path createSourceFile(String packageName, String fileName) throws IOException { Path sourceFile = resolveSourceFile(packageName, fileName); createFile(sourceFile); return sourceFile; } /** * Resolve a resource file defined in the specified package. * @param packageName the name of the package * @param file the name of the file (including its extension) * @return the {@link Path file} to use to store a resource with the specified package * @see #getResourcesDirectory() */ public Path resolveResourceFile(String packageName, String file) { return resolvePackage(this.resourcesDirectory, packageName).resolve(file); } /** * Create a resource file, creating its package structure if necessary. * @param packageName the name of the package * @param file the name of the file (including its extension)
* @return the {@link Path file} to use to store a resource with the specified package * @throws IOException if an error occurred while trying to create the directory * structure or the file itself * @see #getResourcesDirectory() */ public Path createResourceFile(String packageName, String file) throws IOException { Path resourceFile = resolveResourceFile(packageName, file); createFile(resourceFile); return resourceFile; } private void createFile(Path file) throws IOException { Files.createDirectories(file.getParent()); Files.createFile(file); } private static Path resolvePackage(Path directory, String packageName) { return directory.resolve(packageName.replace('.', '/')); } }
repos\initializr-main\initializr-generator\src\main\java\io\spring\initializr\generator\language\SourceStructure.java
1
请完成以下Java代码
public void staleTabs(final WindowId windowId, final DocumentId documentId, final Set<DetailId> tabIds) { forCollector(collector -> collector.staleTabs(windowId, documentId, tabIds)); } public void staleIncludedDocuments(final WindowId windowId, final DocumentId documentId, final DetailId tabId, final DocumentIdsSelection rowIds) { forCollector(collector -> collector.staleIncludedDocuments(windowId, documentId, tabId, rowIds)); } public void convertAndPublish(final List<JSONDocument> jsonDocumentEvents) { if (jsonDocumentEvents == null || jsonDocumentEvents.isEmpty()) { return; } final JSONDocumentChangedWebSocketEventCollector collectorToMerge = JSONDocumentChangedWebSocketEventCollector.newInstance(); for (final JSONDocument jsonDocumentEvent : jsonDocumentEvents) { collectFrom(collectorToMerge, jsonDocumentEvent); } if (collectorToMerge.isEmpty()) { return; } forCollector(collector -> collector.mergeFrom(collectorToMerge)); } private static void collectFrom(final JSONDocumentChangedWebSocketEventCollector collector, final JSONDocument event) { final WindowId windowId = event.getWindowId(); if (windowId == null) { return; } // Included document => nothing to publish about it if (event.getTabId() != null) { return; } final DocumentId documentId = event.getId(); collector.staleRootDocument(windowId, documentId); event.getIncludedTabsInfos().forEach(tabInfo -> collector.mergeFrom(windowId, documentId, tabInfo)); } public CloseableCollector temporaryCollectOnThisThread()
{ final CloseableCollector closeableCollector = new CloseableCollector(); closeableCollector.open(); return closeableCollector; } public class CloseableCollector implements IAutoCloseable { @NonNull private final JSONDocumentChangedWebSocketEventCollector collector = JSONDocumentChangedWebSocketEventCollector.newInstance(); @NonNull private final AtomicBoolean closed = new AtomicBoolean(false); @Override public String toString() { return "CloseableCollector[" + collector + "]"; } private void open() { if (THREAD_LOCAL_COLLECTOR.get() != null) { throw new AdempiereException("A thread level collector was already set"); } THREAD_LOCAL_COLLECTOR.set(collector); } @Override public void close() { if (closed.getAndSet(true)) { return; // already closed } THREAD_LOCAL_COLLECTOR.set(null); sendAllAndClose(collector, websocketSender); } @VisibleForTesting ImmutableList<JSONDocumentChangedWebSocketEvent> getEvents() {return collector.getEvents();} } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\events\DocumentWebsocketPublisher.java
1
请完成以下Java代码
private void configureEditor() { editor.setVisible(false); editor.setSaveListener(employee -> { var saved = employeeRepository.save(employee); updateEmployees(filter.getValue()); editor.setEmployee(null); grid.asSingleSelect().setValue(saved); }); editor.setDeleteListener(employee -> { employeeRepository.delete(employee); updateEmployees(filter.getValue()); editEmployee(null); }); editor.setCancelListener(() -> { editEmployee(null); }); } private void editEmployee(Employee employee) { editor.setEmployee(employee); if (employee != null) { editor.setVisible(true); } else {
// Deselect grid grid.asSingleSelect().setValue(null); editor.setVisible(false); } } private void updateEmployees(String filterText) { if (filterText.isEmpty()) { grid.setItems(employeeRepository.findAll()); } else { grid.setItems(employeeRepository.findByLastNameStartsWithIgnoreCase(filterText)); } } }
repos\tutorials-master\vaadin\src\main\java\com\baeldung\spring\EmployeesView.java
1
请在Spring Boot框架中完成以下Java代码
public BigDecimal getCreditWatchRatio(final BPartnerStats stats) { // bp group will be taken from the stats' bpartner final I_C_BPartner partner = Services.get(IBPartnerDAO.class).getById(stats.getBpartnerId()); final I_C_BP_Group bpGroup = partner.getC_BP_Group(); final BigDecimal creditWatchPercent = bpGroup.getCreditWatchPercent(); if (creditWatchPercent.signum() == 0) { return new BigDecimal(0.90); } return creditWatchPercent.divide(Env.ONEHUNDRED, 2, BigDecimal.ROUND_HALF_UP); } @Override public void resetCreditStatusFromBPGroup(@NonNull final I_C_BPartner bpartner) {
final BPartnerStats bpartnerStats = Services.get(IBPartnerStatsDAO.class).getCreateBPartnerStats(bpartner); final I_C_BP_Group bpGroup = bpartner.getC_BP_Group(); final String creditStatus = bpGroup.getSOCreditStatus(); if (Check.isEmpty(creditStatus, true)) { return; } final I_C_BPartner_Stats stats = load(bpartnerStats.getRepoId(), I_C_BPartner_Stats.class); stats.setSOCreditStatus(creditStatus); save(stats); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\bpartner\service\impl\BPartnerStatsBL.java
2
请完成以下Java代码
public class DistributionJobLineId { @NonNull private final DDOrderLineId ddOrderLineId; private DistributionJobLineId(@NonNull final DDOrderLineId ddOrderLineId) { this.ddOrderLineId = ddOrderLineId; } public static DistributionJobLineId ofDDOrderLineId(final @NonNull DDOrderLineId ddOrderLineId) { return new DistributionJobLineId(ddOrderLineId); } @JsonCreator public static DistributionJobLineId ofJson(final @NonNull Object json) { final DDOrderLineId ddOrderLineId = RepoIdAwares.ofObject(json, DDOrderLineId.class, DDOrderLineId::ofRepoId); return ofDDOrderLineId(ddOrderLineId);
} @JsonValue public String toString() { return toJson(); } @NonNull private String toJson() { return String.valueOf(ddOrderLineId.getRepoId()); } public DDOrderLineId toDDOrderLineId() {return ddOrderLineId;} public static boolean equals(@Nullable final DistributionJobLineId id1, @Nullable final DistributionJobLineId id2) {return Objects.equals(id1, id2);} }
repos\metasfresh-new_dawn_uat\backend\de.metas.distribution.rest-api\src\main\java\de\metas\distribution\mobileui\job\model\DistributionJobLineId.java
1
请完成以下Java代码
public class EvaluationConditionDto { private String businessKey; private Map<String, VariableValueDto> variables; private String tenantId; private boolean withoutTenantId; private String processDefinitionId; public String getBusinessKey() { return businessKey; } public void setBusinessKey(String businessKey) { this.businessKey = businessKey; } public Map<String, VariableValueDto> getVariables() { return variables; } public void setVariables(Map<String, VariableValueDto> variables) { this.variables = variables; } public String getTenantId() {
return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } public boolean isWithoutTenantId() { return withoutTenantId; } public void setWithoutTenantId(boolean withoutTenantId) { this.withoutTenantId = withoutTenantId; } public String getProcessDefinitionId() { return processDefinitionId; } public void setProcessDefinitionId(String processInstanceId) { this.processDefinitionId = processInstanceId; } }
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\condition\EvaluationConditionDto.java
1
请完成以下Java代码
public int getStartImpression () { Integer ii = (Integer)get_Value(COLUMNNAME_StartImpression); if (ii == null) return 0; return ii.intValue(); } /** Set Target Frame. @param Target_Frame Which target should be used if user clicks? */ public void setTarget_Frame (String Target_Frame) { set_Value (COLUMNNAME_Target_Frame, Target_Frame); } /** Get Target Frame. @return Which target should be used if user clicks? */ public String getTarget_Frame () { return (String)get_Value(COLUMNNAME_Target_Frame);
} /** Set Target URL. @param TargetURL URL for the Target */ public void setTargetURL (String TargetURL) { set_Value (COLUMNNAME_TargetURL, TargetURL); } /** Get Target URL. @return URL for the Target */ public String getTargetURL () { return (String)get_Value(COLUMNNAME_TargetURL); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_CM_Ad.java
1
请在Spring Boot框架中完成以下Java代码
public String getAgreementNumber() { return agreementNumber; } /** * Sets the value of the agreementNumber property. * * @param value * allowed object is * {@link String } * */ public void setAgreementNumber(String value) { this.agreementNumber = value; } /** * Gets the value of the timeForPayment property. * * @return * possible object is * {@link BigInteger } * */ public BigInteger getTimeForPayment() { return timeForPayment; } /** * Sets the value of the timeForPayment property. * * @param value * allowed object is * {@link BigInteger } * */ public void setTimeForPayment(BigInteger value) { this.timeForPayment = value; } /** * Additional free text.Gets the value of the freeText 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 freeText property. * * <p> * For example, to add a new item, do as follows: * <pre> * getFreeText().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link FreeTextType } * * */
public List<FreeTextType> getFreeText() { if (freeText == null) { freeText = new ArrayList<FreeTextType>(); } return this.freeText; } /** * Reference to the consignment. * * @return * possible object is * {@link String } * */ public String getConsignmentReference() { return consignmentReference; } /** * Sets the value of the consignmentReference property. * * @param value * allowed object is * {@link String } * */ public void setConsignmentReference(String value) { this.consignmentReference = value; } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\extensions\edifact\ORDERSExtensionType.java
2
请完成以下Java代码
public E poll() { if (isNotEmpty()) { E nextValue = data[readSequence % capacity]; readSequence++; return nextValue; } return null; } public int capacity() { return capacity; } public int size() { return (writeSequence - readSequence) + 1; } public boolean isEmpty() {
return writeSequence < readSequence; } public boolean isFull() { return size() >= capacity; } private boolean isNotEmpty() { return !isEmpty(); } private boolean isNotFull() { return !isFull(); } }
repos\tutorials-master\data-structures-2\src\main\java\com\baeldung\circularbuffer\CircularBuffer.java
1
请完成以下Java代码
public final class PIAttributes implements Iterable<I_M_HU_PI_Attribute> { public static PIAttributes of(@NonNull final Collection<I_M_HU_PI_Attribute> piAttributes) { if (piAttributes.isEmpty()) { return EMPTY; } return new PIAttributes(piAttributes); } public static final PIAttributes EMPTY = new PIAttributes(ImmutableList.of()); private final ImmutableList<I_M_HU_PI_Attribute> list; private final ImmutableMap<AttributeId, I_M_HU_PI_Attribute> attributesByAttributeId; private PIAttributes(@NonNull final Collection<I_M_HU_PI_Attribute> piAttributes) { list = ImmutableList.copyOf(piAttributes); attributesByAttributeId = Maps.uniqueIndex(piAttributes, piAttribute -> AttributeId.ofRepoId(piAttribute.getM_Attribute_ID())); } @Override public Iterator<I_M_HU_PI_Attribute> iterator() { return list.iterator(); } public boolean hasActiveAttribute(@NonNull final AttributeId attributeId) { final I_M_HU_PI_Attribute piAttribute = getByAttributeIdOrNull(attributeId); return piAttribute != null && piAttribute.isActive(); } public I_M_HU_PI_Attribute getByAttributeId(final AttributeId attributeId) { final I_M_HU_PI_Attribute piAttribute = getByAttributeIdOrNull(attributeId); if (piAttribute == null) { throw new AdempiereException("No " + attributeId + " found. Available attributeIds are: " + getAttributeIds()); } return piAttribute; } public Optional<I_M_HU_PI_Attribute> getByAttributeIdIfExists(final AttributeId attributeId) { final I_M_HU_PI_Attribute piAttribute = getByAttributeIdOrNull(attributeId); return Optional.ofNullable(piAttribute); } private I_M_HU_PI_Attribute getByAttributeIdOrNull(final AttributeId attributeId) { return attributesByAttributeId.get(attributeId); }
public PIAttributes addIfAbsent(@NonNull final PIAttributes from) { if (from.isEmpty()) { return this; } if (this.isEmpty()) { return from; } final LinkedHashMap<AttributeId, I_M_HU_PI_Attribute> piAttributesNew = new LinkedHashMap<>(attributesByAttributeId); from.attributesByAttributeId.forEach(piAttributesNew::putIfAbsent); return of(piAttributesNew.values()); } public int getSeqNoByAttributeId(final AttributeId attributeId, final int seqNoIfNotFound) { final I_M_HU_PI_Attribute piAttribute = getByAttributeIdOrNull(attributeId); if (piAttribute == null) { return seqNoIfNotFound; } return piAttribute.getSeqNo(); } public ImmutableSet<AttributeId> getAttributeIds() { return attributesByAttributeId.keySet(); } public boolean isEmpty() { return attributesByAttributeId.isEmpty(); } public boolean isUseInASI(@NonNull final AttributeId attributeId) { return getByAttributeId(attributeId).isUseInASI(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\attribute\PIAttributes.java
1
请完成以下Java代码
public void setM_Securpharm_Action_Result_ID (int M_Securpharm_Action_Result_ID) { if (M_Securpharm_Action_Result_ID < 1) set_ValueNoCheck (COLUMNNAME_M_Securpharm_Action_Result_ID, null); else set_ValueNoCheck (COLUMNNAME_M_Securpharm_Action_Result_ID, Integer.valueOf(M_Securpharm_Action_Result_ID)); } /** Get Securpharm Aktion Ergebnise. @return Securpharm Aktion Ergebnise */ @Override public int getM_Securpharm_Action_Result_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_Securpharm_Action_Result_ID); if (ii == null) return 0; return ii.intValue(); } @Override public de.metas.vertical.pharma.securpharm.model.I_M_Securpharm_Productdata_Result getM_Securpharm_Productdata_Result() { return get_ValueAsPO(COLUMNNAME_M_Securpharm_Productdata_Result_ID, de.metas.vertical.pharma.securpharm.model.I_M_Securpharm_Productdata_Result.class); } @Override public void setM_Securpharm_Productdata_Result(de.metas.vertical.pharma.securpharm.model.I_M_Securpharm_Productdata_Result M_Securpharm_Productdata_Result) { set_ValueFromPO(COLUMNNAME_M_Securpharm_Productdata_Result_ID, de.metas.vertical.pharma.securpharm.model.I_M_Securpharm_Productdata_Result.class, M_Securpharm_Productdata_Result); } /** Set Securpharm Produktdaten Ergebnise. @param M_Securpharm_Productdata_Result_ID Securpharm Produktdaten Ergebnise */ @Override public void setM_Securpharm_Productdata_Result_ID (int M_Securpharm_Productdata_Result_ID) { if (M_Securpharm_Productdata_Result_ID < 1) set_Value (COLUMNNAME_M_Securpharm_Productdata_Result_ID, null); else set_Value (COLUMNNAME_M_Securpharm_Productdata_Result_ID, Integer.valueOf(M_Securpharm_Productdata_Result_ID)); }
/** Get Securpharm Produktdaten Ergebnise. @return Securpharm Produktdaten Ergebnise */ @Override public int getM_Securpharm_Productdata_Result_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_Securpharm_Productdata_Result_ID); if (ii == null) return 0; return ii.intValue(); } /** Set TransaktionsID Server. @param TransactionIDServer TransaktionsID Server */ @Override public void setTransactionIDServer (java.lang.String TransactionIDServer) { set_Value (COLUMNNAME_TransactionIDServer, TransactionIDServer); } /** Get TransaktionsID Server. @return TransaktionsID Server */ @Override public java.lang.String getTransactionIDServer () { return (java.lang.String)get_Value(COLUMNNAME_TransactionIDServer); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.securpharm\src\main\java-gen\de\metas\vertical\pharma\securpharm\model\X_M_Securpharm_Action_Result.java
1
请完成以下Java代码
public Object getCachedValue() { return cachedValue; } public void setCachedValue(Object cachedValue) { this.cachedValue = cachedValue; } // misc methods /////////////////////////////////////////////////////////////// @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("VariableInstanceEntity["); sb.append("id=").append(id); sb.append(", name=").append(name); sb.append(", type=").append(type != null ? type.getTypeName() : "null"); if (longValue != null) { sb.append(", longValue=").append(longValue);
} if (doubleValue != null) { sb.append(", doubleValue=").append(doubleValue); } if (textValue != null) { sb.append(", textValue=").append(StringUtils.abbreviate(textValue, 40)); } if (textValue2 != null) { sb.append(", textValue2=").append(StringUtils.abbreviate(textValue2, 40)); } if (byteArrayRef != null && byteArrayRef.getId() != null) { sb.append(", byteArrayValueId=").append(byteArrayRef.getId()); } sb.append("]"); return sb.toString(); } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\persistence\entity\VariableInstanceEntityImpl.java
1
请在Spring Boot框架中完成以下Java代码
public class CommissionPointsService { public Optional<Money> getCommissionPointsValue(@NonNull final CommissionPoints commissionPoints, @NonNull final FlatrateTermId flatrateTermId, @NonNull final LocalDate priceDate) { final IPricingResult pricingResult = calculateCommissionPointPriceFor(flatrateTermId, priceDate); if (!pricingResult.isCalculated()) { return Optional.empty(); } final Money customerTradeMarginAmount = Money.of( pricingResult.getPriceStd().multiply(commissionPoints.getPoints()), pricingResult.getCurrencyId()); return Optional.of(customerTradeMarginAmount); } private IPricingResult calculateCommissionPointPriceFor( @NonNull final FlatrateTermId flatrateTermId, @NonNull final LocalDate requestedDate) { final IFlatrateDAO flatrateDAO = Services.get(IFlatrateDAO.class); final IBPartnerDAO bPartnerDAO = Services.get(IBPartnerDAO.class); final IPricingBL pricingBL = Services.get(IPricingBL.class); final IPriceListDAO priceListDAO = Services.get(IPriceListDAO.class); final I_C_Flatrate_Term flatrateTerm = flatrateDAO.retrieveTerm(flatrateTermId); final BPartnerLocationAndCaptureId commissionToLocationId = ContractLocationHelper.extractBillToLocationId(flatrateTerm); final BPartnerId bPartnerId = BPartnerId.ofRepoId(flatrateTerm.getBill_BPartner_ID()); final PricingSystemId pricingSystemId = bPartnerDAO.retrievePricingSystemIdOrNull(bPartnerId, SOTrx.PURCHASE);
final PriceListId priceListId = priceListDAO.retrievePriceListIdByPricingSyst(pricingSystemId, commissionToLocationId, SOTrx.PURCHASE); final ProductId commissionProductId = ProductId.ofRepoId(flatrateTerm.getM_Product_ID()); final IEditablePricingContext pricingContext = pricingBL .createInitialContext( OrgId.ofRepoId(flatrateTerm.getAD_Org_ID()), commissionProductId, bPartnerId, Quantitys.of(ONE, commissionProductId), SOTrx.PURCHASE) .setPriceListId(priceListId) .setPriceDate(requestedDate); return pricingBL.calculatePrice(pricingContext); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\commission\commissioninstance\services\CommissionPointsService.java
2
请完成以下Java代码
private static void addArrayIfNotNull(ObjectNode node, List<String> values) { if (!CollectionUtils.isEmpty(values)) { ArrayNode arrayNode = nodeFactory.arrayNode(); values.forEach(arrayNode::add); node.set("repositories", arrayNode); } } private static ObjectNode mapNode(Map<String, JsonNode> content) { ObjectNode node = nodeFactory.objectNode(); content.forEach(node::set); return node; } private ObjectNode mapDependencies(Map<String, Dependency> dependencies) { return mapNode(dependencies.entrySet() .stream() .collect(Collectors.toMap(Map.Entry::getKey, (entry) -> mapDependency(entry.getValue()))));
} private ObjectNode mapRepositories(Map<String, Repository> repositories) { return mapNode(repositories.entrySet() .stream() .collect(Collectors.toMap(Map.Entry::getKey, (entry) -> mapRepository(entry.getValue())))); } private ObjectNode mapBoms(Map<String, BillOfMaterials> boms) { return mapNode(boms.entrySet() .stream() .collect(Collectors.toMap(Map.Entry::getKey, (entry) -> mapBom(entry.getValue())))); } }
repos\initializr-main\initializr-web\src\main\java\io\spring\initializr\web\mapper\DependencyMetadataV21JsonMapper.java
1
请完成以下Java代码
public String getCustomPropertiesResolverImplementationType() { return customPropertiesResolverImplementationType; } public void setCustomPropertiesResolverImplementationType(String customPropertiesResolverImplementationType) { this.customPropertiesResolverImplementationType = customPropertiesResolverImplementationType; } public String getCustomPropertiesResolverImplementation() { return customPropertiesResolverImplementation; } public void setCustomPropertiesResolverImplementation(String customPropertiesResolverImplementation) { this.customPropertiesResolverImplementation = customPropertiesResolverImplementation; } public Object getInstance() { return instance; } public void setInstance(Object instance) { this.instance = instance; } /** * Return the script info, if present. * <p> * ScriptInfo must be populated, when {@code <executionListener type="script" ...>} e.g. when * implementationType is 'script'. * </p> */ @Override public ScriptInfo getScriptInfo() { return scriptInfo; } /** * Sets the script info * * @see #getScriptInfo()
*/ @Override public void setScriptInfo(ScriptInfo scriptInfo) { this.scriptInfo = scriptInfo; } @Override public FlowableListener clone() { FlowableListener clone = new FlowableListener(); clone.setValues(this); return clone; } public void setValues(FlowableListener otherListener) { super.setValues(otherListener); setEvent(otherListener.getEvent()); setImplementation(otherListener.getImplementation()); setImplementationType(otherListener.getImplementationType()); if (otherListener.getScriptInfo() != null) { setScriptInfo(otherListener.getScriptInfo().clone()); } fieldExtensions = new ArrayList<>(); if (otherListener.getFieldExtensions() != null && !otherListener.getFieldExtensions().isEmpty()) { for (FieldExtension extension : otherListener.getFieldExtensions()) { fieldExtensions.add(extension.clone()); } } setOnTransaction(otherListener.getOnTransaction()); setCustomPropertiesResolverImplementationType(otherListener.getCustomPropertiesResolverImplementationType()); setCustomPropertiesResolverImplementation(otherListener.getCustomPropertiesResolverImplementation()); } }
repos\flowable-engine-main\modules\flowable-bpmn-model\src\main\java\org\flowable\bpmn\model\FlowableListener.java
1
请完成以下Java代码
public void setAD_Window(org.compiere.model.I_AD_Window AD_Window) { set_ValueFromPO(COLUMNNAME_AD_Window_ID, org.compiere.model.I_AD_Window.class, AD_Window); } /** Set Fenster. @param AD_Window_ID Eingabe- oder Anzeige-Fenster */ @Override public void setAD_Window_ID (int AD_Window_ID) { if (AD_Window_ID < 1) set_Value (COLUMNNAME_AD_Window_ID, null); else
set_Value (COLUMNNAME_AD_Window_ID, Integer.valueOf(AD_Window_ID)); } /** Get Fenster. @return Eingabe- oder Anzeige-Fenster */ @Override public int getAD_Window_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_AD_Window_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_Element_Link.java
1
请完成以下Java代码
public OrderAndLineId getSalesOrderLineId() { final DemandDetail demandDetail = getDemandDetail(); if (demandDetail == null) { return null; } return OrderAndLineId.ofRepoIdsOrNull(demandDetail.getOrderId(), demandDetail.getOrderLineId()); } @NonNull public BusinessCaseDetail getBusinessCaseDetailNotNull() { return Check.assumeNotNull(getBusinessCaseDetail(), "businessCaseDetail is not null: {}", this); } public <T extends BusinessCaseDetail> Optional<T> getBusinessCaseDetail(@NonNull final Class<T> type) { return type.isInstance(businessCaseDetail) ? Optional.of(type.cast(businessCaseDetail)) : Optional.empty(); } public <T extends BusinessCaseDetail> T getBusinessCaseDetailNotNull(@NonNull final Class<T> type) { if (type.isInstance(businessCaseDetail)) { return type.cast(businessCaseDetail); } else { throw new AdempiereException("businessCaseDetail is not matching " + type.getSimpleName() + ": " + this); } } public <T extends BusinessCaseDetail> Candidate withBusinessCaseDetail(@NonNull final Class<T> type, @NonNull final UnaryOperator<T> mapper) { final T businessCaseDetail = getBusinessCaseDetailNotNull(type); final T businessCaseDetailChanged = mapper.apply(businessCaseDetail); if (Objects.equals(businessCaseDetail, businessCaseDetailChanged)) { return this; } return withBusinessCaseDetail(businessCaseDetailChanged); }
@Nullable public String getTraceId() { final DemandDetail demandDetail = getDemandDetail(); return demandDetail != null ? demandDetail.getTraceId() : null; } /** * This is enabled by the current usage of {@link #parentId} */ public boolean isStockCandidateOfThisCandidate(@NonNull final Candidate potentialStockCandidate) { if (potentialStockCandidate.type != CandidateType.STOCK) { return false; } switch (type) { case DEMAND: return potentialStockCandidate.getParentId().equals(id); case SUPPLY: return potentialStockCandidate.getId().equals(parentId); default: return false; } } /** * The qty is always stored as an absolute value on the candidate, but we're interested if the candidate is adding or subtracting qty to the stock. */ public BigDecimal getStockImpactPlannedQuantity() { switch (getType()) { case DEMAND: case UNEXPECTED_DECREASE: case INVENTORY_DOWN: return getQuantity().negate(); default: return getQuantity(); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.material\dispo-commons\src\main\java\de\metas\material\dispo\commons\candidate\Candidate.java
1
请在Spring Boot框架中完成以下Java代码
public Collection<Class<? extends AbstractStockEstimateEvent>> getHandledEventType() { return ImmutableList.of(StockEstimateDeletedEvent.class); } @Override public void handleEvent(final AbstractStockEstimateEvent event) { final Candidate candidateToDelete = stockEstimateEventService.retrieveExistingStockEstimateCandidateOrNull(event); if (candidateToDelete == null) { Loggables.withLogger(logger, Level.WARN).addLog("Nothing to do for event, record was already deleted", event); return; } final BusinessCaseDetail businessCaseDetail = candidateToDelete.getBusinessCaseDetail(); if (businessCaseDetail == null) { throw new AdempiereException("No business case detail found for candidate") .appendParametersToMessage() .setParameter("candidateId: ", candidateToDelete.getId()); } final StockChangeDetail existingStockChangeDetail = StockChangeDetail.cast(businessCaseDetail) .toBuilder()
.isReverted(true) .build(); final CandidatesQuery query = CandidatesQuery.fromCandidate(candidateToDelete, false); final I_MD_Candidate candidateRecord = RepositoryCommons .mkQueryBuilder(query) .create() .firstOnly(I_MD_Candidate.class); if (candidateRecord == null) { throw new AdempiereException("No MD_Candidate found for candidate") .appendParametersToMessage() .setParameter("candidateId: ", candidateToDelete.getId()); } stockChangeDetailRepo.saveOrUpdate(existingStockChangeDetail, candidateRecord); candidateChangeHandler.onCandidateDelete(candidateToDelete); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.material\dispo-service\src\main\java\de\metas\material\dispo\service\event\handler\stockchange\StockEstimateDeletedHandler.java
2
请完成以下Java代码
public void setCM_NewsItem_ID (int CM_NewsItem_ID) { if (CM_NewsItem_ID < 1) set_ValueNoCheck (COLUMNNAME_CM_NewsItem_ID, null); else set_ValueNoCheck (COLUMNNAME_CM_NewsItem_ID, Integer.valueOf(CM_NewsItem_ID)); } /** Get News Item / Article. @return News item or article defines base content */ public int getCM_NewsItem_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_CM_NewsItem_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Content HTML. @param ContentHTML Contains the content itself */ public void setContentHTML (String ContentHTML) { set_Value (COLUMNNAME_ContentHTML, ContentHTML); } /** Get Content HTML. @return Contains the content itself */ public String getContentHTML () { return (String)get_Value(COLUMNNAME_ContentHTML); } /** 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 LinkURL. @param LinkURL Contains URL to a target
*/ public void setLinkURL (String LinkURL) { set_Value (COLUMNNAME_LinkURL, LinkURL); } /** Get LinkURL. @return Contains URL to a target */ public String getLinkURL () { return (String)get_Value(COLUMNNAME_LinkURL); } /** Set Publication Date. @param PubDate Date on which this article will / should get published */ public void setPubDate (Timestamp PubDate) { set_Value (COLUMNNAME_PubDate, PubDate); } /** Get Publication Date. @return Date on which this article will / should get published */ public Timestamp getPubDate () { return (Timestamp)get_Value(COLUMNNAME_PubDate); } /** Set Title. @param Title Name this entity is referred to as */ public void setTitle (String Title) { set_Value (COLUMNNAME_Title, Title); } /** Get Title. @return Name this entity is referred to as */ public String getTitle () { return (String)get_Value(COLUMNNAME_Title); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_CM_NewsItem.java
1
请完成以下Java代码
public int getSingleSelectedRecordId() { return document.getDocumentIdAsInt(); } @Override public SelectionSize getSelectionSize() { return SelectionSize.ofSize(1); } @Override public <T> IQueryFilter<T> getQueryFilter(@NonNull final Class<T> recordClass) { final String keyColumnName = InterfaceWrapperHelper.getKeyColumnName(tableName);
return EqualsQueryFilter.of(keyColumnName, getSingleSelectedRecordId()); } @Override public OptionalBoolean isExistingDocument() { return OptionalBoolean.ofBoolean(!document.isNew()); } @Override public OptionalBoolean isProcessedDocument() { return OptionalBoolean.ofBoolean(document.isProcessed()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\process\DocumentPreconditionsAsContext.java
1
请在Spring Boot框架中完成以下Java代码
public void log(TbRuleEngineProcessingResult msg, boolean finalIterationForPack) { int success = msg.getSuccessMap().size(); int pending = msg.getPendingMap().size(); int failed = msg.getFailedMap().size(); totalMsgCounter.add(success + pending + failed); successMsgCounter.add(success); msg.getSuccessMap().values().forEach(m -> getTenantStats(m).logSuccess()); if (finalIterationForPack) { if (pending > 0 || failed > 0) { timeoutMsgCounter.add(pending); failedMsgCounter.add(failed); if (pending > 0) { msg.getPendingMap().values().forEach(m -> getTenantStats(m).logTimeout()); } if (failed > 0) { msg.getFailedMap().values().forEach(m -> getTenantStats(m).logFailed()); } failedIterationsCounter.increment(); } else { successIterationsCounter.increment(); } } else { failedIterationsCounter.increment(); tmpTimeoutMsgCounter.add(pending); tmpFailedMsgCounter.add(failed); if (pending > 0) { msg.getPendingMap().values().forEach(m -> getTenantStats(m).logTmpTimeout()); } if (failed > 0) { msg.getFailedMap().values().forEach(m -> getTenantStats(m).logTmpFailed()); } } msg.getExceptionsMap().forEach(tenantExceptions::putIfAbsent); } private TbTenantRuleEngineStats getTenantStats(TbProtoQueueMsg<ToRuleEngineMsg> m) { ToRuleEngineMsg reMsg = m.getValue(); return tenantStats.computeIfAbsent(new UUID(reMsg.getTenantIdMSB(), reMsg.getTenantIdLSB()), TbTenantRuleEngineStats::new); } public ConcurrentMap<UUID, TbTenantRuleEngineStats> getTenantStats() {
return tenantStats; } public String getQueueName() { return queueName; } public ConcurrentMap<TenantId, RuleEngineException> getTenantExceptions() { return tenantExceptions; } public void printStats() { int total = totalMsgCounter.get(); if (total > 0) { StringBuilder stats = new StringBuilder(); counters.forEach(counter -> { stats.append(counter.getName()).append(" = [").append(counter.get()).append("] "); }); if (tenantId.isSysTenantId()) { log.info("[{}] Stats: {}", queueName, stats); } else { log.info("[{}][{}] Stats: {}", queueName, tenantId, stats); } } } public void reset() { counters.forEach(StatsCounter::clear); tenantStats.clear(); tenantExceptions.clear(); } }
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\queue\TbRuleEngineConsumerStats.java
2
请完成以下Java代码
public void run() { try { runnable.run(); } catch (Exception e) { handleException(e); } } }; } protected final void handleException(final Exception e) { final OnFail onFail = getOnFail(); if (OnFail.ThrowException == onFail) { throw AdempiereException.wrapIfNeeded(e); } else if (OnFail.ShowErrorPopup == onFail) { clientUI.error(getParentWindowNo(), e); } else if (OnFail.SilentlyIgnore == onFail) { // Ignore it silently. Don't do logging. // logger.warn("Got error while running: " + runnable + ". Ignored.", e); return; } else if (OnFail.UseHandler == onFail) { final IExceptionHandler exceptionHandler = getExceptionHandler(); if (exceptionHandler == null) { logger.warn("No exception handler was configurated and OnFail=UseHandler. Throwing the exception"); // fallback throw AdempiereException.wrapIfNeeded(e); } else { exceptionHandler.handleException(e); } } // Fallback: throw the exception else { throw AdempiereException.wrapIfNeeded(e); } } @Override public final IClientUIInvoker setInvokeLater(final boolean invokeLater) { this.invokeLater = invokeLater; return this; } protected final boolean isInvokeLater() { return invokeLater; } @Override public final IClientUIInvoker setLongOperation(final boolean longOperation) { this.longOperation = longOperation; return this; } protected final boolean isLongOperation() { return longOperation; } @Override public IClientUIInvoker setShowGlassPane(final boolean showGlassPane) { this.showGlassPane = showGlassPane; return this; }
protected final boolean isShowGlassPane() { return showGlassPane; } @Override public final IClientUIInvoker setOnFail(OnFail onFail) { Check.assumeNotNull(onFail, "onFail not null"); this.onFail = onFail; return this; } private final OnFail getOnFail() { return onFail; } @Override public final IClientUIInvoker setExceptionHandler(IExceptionHandler exceptionHandler) { Check.assumeNotNull(exceptionHandler, "exceptionHandler not null"); this.exceptionHandler = exceptionHandler; return this; } private final IExceptionHandler getExceptionHandler() { return exceptionHandler; } @Override public abstract IClientUIInvoker setParentComponent(final Object parentComponent); @Override public abstract IClientUIInvoker setParentComponentByWindowNo(final int windowNo); protected final void setParentComponent(final int windowNo, final Object component) { this.parentWindowNo = windowNo; this.parentComponent = component; } protected final Object getParentComponent() { return parentComponent; } protected final int getParentWindowNo() { return parentWindowNo; } @Override public final IClientUIInvoker setRunnable(final Runnable runnable) { this.runnable = runnable; return this; } private final Runnable getRunnable() { return runnable; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\adempiere\form\AbstractClientUIInvoker.java
1
请完成以下Java代码
public void postConstruct() { final Thread thread = new Thread(this::runNow); thread.setDaemon(true); thread.setName("SumUp-pending-transaction-updater"); thread.start(); logger.info("Started {}", thread); } private void runNow() { while (true) { final Duration delay = getPollInterval(); for (int i = 1; i <= DEFAULT_NoPendingTransactionsDelayMultiplier; i++) { if (!sleep(delay)) { logger.info("Got interrupt request. Exiting."); return; } if (pendingTransactionsDetected.get()) { logger.debug("Pending transactions detected."); break; } } bulkUpdatePendingTransactionsNoFail(); } } @SuppressWarnings("BooleanMethodIsAlwaysInverted") private static boolean sleep(final Duration duration) { try { logger.debug("Sleeping {}", duration); Thread.sleep(duration.toMillis()); return true; } catch (InterruptedException e) {
return false; } } private void bulkUpdatePendingTransactionsNoFail() { try { final BulkUpdateByQueryResult result = sumUpService.bulkUpdatePendingTransactions(false); if (!result.isZero()) { logger.debug("Pending transactions updated: {}", result); } // Set the pending transactions flag as long as we get some updates pendingTransactionsDetected.set(!result.isZero()); } catch (final Exception ex) { logger.warn("Failed to process. Ignored.", ex); } } private Duration getPollInterval() { final int valueInt = sysConfigBL.getPositiveIntValue(SYSCONFIG_PollIntervalInSeconds, 0); return valueInt > 0 ? Duration.ofSeconds(valueInt) : DEFAULT_PollInterval; } @Override public void onStatusChanged(@NonNull final SumUpTransactionStatusChangedEvent event) { if (event.getStatusNew().isPending()) { pendingTransactionsDetected.set(true); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.sumup\src\main\java\de\metas\payment\sumup\server\SumUpPendingTransactionContinuousUpdater.java
1
请完成以下Java代码
protected void deleteTask(String taskId, CommandContext commandContext) { TaskManager taskManager = commandContext.getTaskManager(); TaskEntity task = taskManager.findTaskById(taskId); if (task != null) { if(task.getExecutionId() != null) { throw new ProcessEngineException("The task cannot be deleted because is part of a running process"); } else if (task.getCaseExecutionId() != null) { throw new ProcessEngineException("The task cannot be deleted because is part of a running case instance"); } checkDeleteTask(task, commandContext); task.logUserOperation(UserOperationLogEntry.OPERATION_TYPE_DELETE); String reason = (deleteReason == null || deleteReason.length() == 0) ? TaskEntity.DELETE_REASON_DELETED : deleteReason;
task.delete(reason, cascade); } else if (cascade) { Context .getCommandContext() .getHistoricTaskInstanceManager() .deleteHistoricTaskInstanceById(taskId); } } protected void checkDeleteTask(TaskEntity task, CommandContext commandContext) { for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { checker.checkDeleteTask(task); } } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmd\DeleteTaskCmd.java
1
请完成以下Java代码
public PaymentString parse(@NonNull final String paymentText) throws IndexOutOfBoundsException { final List<String> collectedErrors = new ArrayList<>(); // // First 3 digits: transaction type final String trxType = paymentText.substring(0, 3); final String postAccountNo = paymentText.substring(3, 12); final String amountStringWithPosibleSpaces = paymentText.substring(39, 49); final BigDecimal amount = extractAmountFromString(trxType, amountStringWithPosibleSpaces, collectedErrors); if (!trxType.endsWith(ESRConstants.ESRTRXTYPE_REVERSE_LAST_DIGIT)) { Check.assume(trxType.endsWith(ESRConstants.ESRTRXTYPE_CREDIT_MEMO_LAST_DIGIT) || trxType.endsWith(ESRConstants.ESRTRXTYPE_CORRECTION_LAST_DIGIT), "The file contains a line with unsupported transaction type '" + trxType + "'"); } final String paymentDateStr = paymentText.substring(59, 65); final Timestamp paymentDate = extractTimestampFromString(paymentDateStr, ERR_WRONG_PAYMENT_DATE, collectedErrors); final String accountDateStr = paymentText.substring(65, 71); final Timestamp accountDate = extractTimestampFromString(accountDateStr, ERR_WRONG_ACCOUNT_DATE, collectedErrors); final String esrReferenceNoComplete = paymentText.substring(12, 39); final InvoiceReferenceNo invoiceReferenceNo = InvoiceReferenceNos.parse(esrReferenceNoComplete); final PaymentString paymentString = PaymentString.builder()
.collectedErrors(collectedErrors) .rawPaymentString(paymentText) .postAccountNo(postAccountNo) .innerAccountNo(invoiceReferenceNo.getBankAccount()) .amount(amount) .referenceNoComplete(esrReferenceNoComplete) .paymentDate(paymentDate) .accountDate(accountDate) .orgValue(invoiceReferenceNo.getOrg()) .build(); final IPaymentStringDataProvider dataProvider = new ESRPaymentStringDataProvider(paymentString); paymentString.setDataProvider(dataProvider); return paymentString; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.esr\src\main\java\de\metas\payment\spi\impl\ESRRegularLineParser.java
1
请完成以下Java代码
protected void onCreate(FlowableEvent event) { // Default implementation is a NO-OP } /** * Called when an entity initialized event is received. */ protected void onInitialized(FlowableEvent event) { // Default implementation is a NO-OP } /** * Called when an entity delete event is received. */ protected void onDelete(FlowableEvent event) { // Default implementation is a NO-OP
} /** * Called when an entity update event is received. */ protected void onUpdate(FlowableEvent event) { // Default implementation is a NO-OP } /** * Called when an event is received, which is not a create, an update or delete. */ protected void onEntityEvent(FlowableEvent event) { // Default implementation is a NO-OP } }
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\delegate\event\BaseEntityEventListener.java
1
请在Spring Boot框架中完成以下Java代码
public String getParentCaseInstanceId() { return parentCaseInstanceId; } public void setParentCaseInstanceId(String parentCaseInstanceId) { this.parentCaseInstanceId = parentCaseInstanceId; } public Boolean getWithoutCallbackId() { return withoutCallbackId; } public void setWithoutCallbackId(Boolean withoutCallbackId) { this.withoutCallbackId = withoutCallbackId; } public String getTenantId() { return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } public String getTenantIdLike() { return tenantIdLike; } public void setTenantIdLike(String tenantIdLike) { this.tenantIdLike = tenantIdLike; } public String getTenantIdLikeIgnoreCase() { return tenantIdLikeIgnoreCase; } public void setTenantIdLikeIgnoreCase(String tenantIdLikeIgnoreCase) { this.tenantIdLikeIgnoreCase = tenantIdLikeIgnoreCase; } public Boolean getWithoutTenantId() { return withoutTenantId; } public void setWithoutTenantId(Boolean withoutTenantId) { this.withoutTenantId = withoutTenantId;
} public String getRootScopeId() { return rootScopeId; } public void setRootScopeId(String rootScopeId) { this.rootScopeId = rootScopeId; } public String getParentScopeId() { return parentScopeId; } public void setParentScopeId(String parentScopeId) { this.parentScopeId = parentScopeId; } public Set<String> getCallbackIds() { return callbackIds; } public void setCallbackIds(Set<String> callbackIds) { this.callbackIds = callbackIds; } }
repos\flowable-engine-main\modules\flowable-rest\src\main\java\org\flowable\rest\service\api\history\HistoricProcessInstanceQueryRequest.java
2