instruction
string
input
string
output
string
source_file
string
priority
int64
请完成以下Java代码
public java.lang.String getX1 () { return (java.lang.String)get_Value(COLUMNNAME_X1); } /** Set Fach. @param Y Y-Dimension, z.B. Fach */ @Override public void setY (java.lang.String Y) { set_Value (COLUMNNAME_Y, Y); } /** Get Fach. @return Y-Dimension, z.B. Fach */ @Override public java.lang.String getY () { return (java.lang.String)get_Value(COLUMNNAME_Y); }
/** Set Ebene. @param Z Z-Dimension, z.B. Ebene */ @Override public void setZ (java.lang.String Z) { set_Value (COLUMNNAME_Z, Z); } /** Get Ebene. @return Z-Dimension, z.B. Ebene */ @Override public java.lang.String getZ () { return (java.lang.String)get_Value(COLUMNNAME_Z); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Locator.java
1
请完成以下Java代码
private static class TableInfoMap { private final ImmutableMap<TableNameKey, TableInfo> tableInfoByTableName; private final ImmutableMap<AdTableId, TableInfo> tableInfoByTableId; TableInfoMap(@NonNull final List<TableInfo> list) { tableInfoByTableName = Maps.uniqueIndex(list, tableInfo -> TableNameKey.of(tableInfo.getTableName())); tableInfoByTableId = Maps.uniqueIndex(list, TableInfo::getAdTableId); } @Override public String toString() { return MoreObjects.toStringHelper(this) .add("size", tableInfoByTableName.size()) .toString(); } @Nullable public TableInfo getTableInfoOrNull(final String tableName) { final TableNameKey tableNameKey = TableNameKey.of(tableName); return tableInfoByTableName.get(tableNameKey); } @Nullable public TableInfo getTableInfoOrNull(final AdTableId adTableId) { return tableInfoByTableId.get(adTableId); } } private static class JUnitGeneratedTableInfoMap { private final AtomicInteger nextTableId2 = new AtomicInteger(1); private final HashMap<TableNameKey, TableInfo> tableInfoByTableName = new HashMap<>(); private final HashMap<AdTableId, TableInfo> tableInfoByTableId = new HashMap<>(); public AdTableId getOrCreateTableId(@NonNull final String tableName) { final TableNameKey tableNameKey = TableNameKey.of(tableName); TableInfo tableInfo = tableInfoByTableName.get(tableNameKey); if (tableInfo == null) { tableInfo = TableInfo.builder() .adTableId(AdTableId.ofRepoId(nextTableId2.getAndIncrement())) .tableName(tableName) .entityType("D") .tooltipType(TooltipType.DEFAULT) .build();
tableInfoByTableName.put(tableNameKey, tableInfo); tableInfoByTableId.put(tableInfo.getAdTableId(), tableInfo); } return tableInfo.getAdTableId(); } public String getTableName(@NonNull final AdTableId adTableId) { final TableInfo tableInfo = tableInfoByTableId.get(adTableId); if (tableInfo != null) { return tableInfo.getTableName(); } //noinspection ConstantConditions final I_AD_Table adTable = POJOLookupMap.get().lookup("AD_Table", adTableId.getRepoId()); if (adTable != null) { final String tableName = adTable.getTableName(); if (Check.isBlank(tableName)) { throw new AdempiereException("No TableName set for " + adTable); } return tableName; } // throw new AdempiereException("No TableName found for AD_Table_ID=" + adTableId); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\table\api\impl\TableIdsCache.java
1
请在Spring Boot框架中完成以下Java代码
public class AlbertaRoleRepository { final IQueryBL queryBL = Services.get(IQueryBL.class); public AlbertaRole save(final @NonNull AlbertaRole role) { final I_C_BPartner_AlbertaRole record = InterfaceWrapperHelper.loadOrNew(role.getBPartnerAlbertaRoleId(), I_C_BPartner_AlbertaRole.class); record.setC_BPartner_ID(role.getBPartnerId().getRepoId()); record.setAlbertaRole(role.getRole().getCode()); InterfaceWrapperHelper.save(record); return toAlbertaRole(record); } @NonNull public List<AlbertaRole> getByPartnerId(final @NonNull BPartnerId bPartnerId) { return queryBL.createQueryBuilder(I_C_BPartner_AlbertaRole.class) .addOnlyActiveRecordsFilter()
.addEqualsFilter(I_C_BPartner_AlbertaRole.COLUMNNAME_C_BPartner_ID, bPartnerId) .create() .list(I_C_BPartner_AlbertaRole.class) .stream() .map(this::toAlbertaRole) .collect(ImmutableList.toImmutableList()); } @NonNull public AlbertaRole toAlbertaRole(final @NonNull I_C_BPartner_AlbertaRole record) { final BPartnerAlbertaRoleId bPartnerAlbertaRoleId = BPartnerAlbertaRoleId.ofRepoId(record.getC_BPartner_AlbertaRole_ID()); final BPartnerId bPartnerId = BPartnerId.ofRepoId(record.getC_BPartner_ID()); return AlbertaRole.builder() .bPartnerAlbertaRoleId(bPartnerAlbertaRoleId) .bPartnerId(bPartnerId) .role(AlbertaRoleType.ofCode(record.getAlbertaRole())) .build(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.healthcare.alberta\src\main\java\de\metas\vertical\healthcare\alberta\bpartner\role\AlbertaRoleRepository.java
2
请完成以下Java代码
public boolean getAckFilter() { return ackFilter.orElseThrow(() -> new RuntimeException("Ack filter is not set! Use `hasAckFilter` to check.")); } public static AlarmStatusFilter from(Collection<AlarmSearchStatus> statuses) { if (statuses == null || statuses.isEmpty() || statuses.contains(AlarmSearchStatus.ANY)) { return EMPTY; } boolean clearFilter = statuses.contains(AlarmSearchStatus.CLEARED); boolean activeFilter = statuses.contains(AlarmSearchStatus.ACTIVE); Optional<Boolean> clear = Optional.empty(); if (clearFilter && !activeFilter || !clearFilter && activeFilter) { clear = Optional.of(clearFilter); }
boolean ackFilter = statuses.contains(AlarmSearchStatus.ACK); boolean unackFilter = statuses.contains(AlarmSearchStatus.UNACK); Optional<Boolean> ack = Optional.empty(); if (ackFilter && !unackFilter || !ackFilter && unackFilter) { ack = Optional.of(ackFilter); } return new AlarmStatusFilter(clear, ack); } public boolean matches(Alarm alarm) { return ackFilter.map(ackFilter -> ackFilter.equals(alarm.isAcknowledged())).orElse(true) && clearFilter.map(clearedFilter -> clearedFilter.equals(alarm.isCleared())).orElse(true); } }
repos\thingsboard-master\common\data\src\main\java\org\thingsboard\server\common\data\alarm\AlarmStatusFilter.java
1
请在Spring Boot框架中完成以下Java代码
public class ShipmentDAO extends BaseDAO { public ShipmentDAO(String url) { super(url); } public boolean insertShipment(Shipment shipment) { Date date = new Date(); Timestamp nowAsTS = new Timestamp(date.getTime()); String sql = "INSERT INTO shipments(orderId,driverId,address,instructions,createdAt,status) VALUES(?,?,?,?,?,?)"; try (Connection conn = this.connect(); PreparedStatement pstmt = conn.prepareStatement(sql)) { pstmt.setString(1, shipment.getOrderId()); pstmt.setInt(2, shipment.getDriverId()); pstmt.setString(3, shipment.getDeliveryAddress()); pstmt.setString(4, shipment.getDeliveryInstructions()); pstmt.setTimestamp(5, nowAsTS); pstmt.setString(6, Shipment.Status.SCHEDULED.name()); pstmt.executeUpdate(); } catch (SQLException e) { System.out.println(e.getMessage()); return false; } return true; } public void cancelShipment(String orderId) { String sql = "UPDATE shipments SET status=? WHERE orderId=?;"; try (Connection conn = this.connect(); PreparedStatement pstmt = conn.prepareStatement(sql)) { pstmt.setString(1, Shipment.Status.CANCELED.name()); pstmt.setString(2, orderId); pstmt.executeUpdate(); } catch (SQLException e) { System.out.println(e.getMessage()); } } public void confirmShipment(String orderId) { String sql = "UPDATE shipments SET status=? WHERE orderId=?;"; try (Connection conn = this.connect(); PreparedStatement pstmt = conn.prepareStatement(sql)) { pstmt.setString(1, Shipment.Status.CONFIRMED.name()); pstmt.setString(2, orderId); pstmt.executeUpdate(); } catch (SQLException e) {
System.out.println(e.getMessage()); } } public void readDriver(int driverId, Driver driver) { String sql = "SELECT name, contact FROM drivers WHERE id = ?"; try (Connection conn = this.connect(); PreparedStatement pstmt = conn.prepareStatement(sql)) { pstmt.setInt(1, driverId); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { driver.setId(driverId); driver.setName(rs.getString("name")); driver.setContact(rs.getString("contact")); } } catch (SQLException e) { System.out.println(e.getMessage()); } } }
repos\tutorials-master\microservices-modules\saga-pattern\src\main\java\io\orkes\example\saga\dao\ShipmentDAO.java
2
请完成以下Java代码
public void handleInOutLineDelete(final I_M_InOutLine iol) { matchInvoiceService.deleteByInOutLineId(InOutLineId.ofRepoId(iol.getM_InOutLine_ID())); } /** * If the <code>C_Order_ID</code> of the given line is at odds with the <code>C_Order_ID</code> of the line's <code>M_InOut</code>, then <code>M_InOut.C_Order</code> is set to <code>null</code>. * * @implSpec task 08451 */ @ModelChange(timings = { ModelValidator.TYPE_AFTER_NEW, ModelValidator.TYPE_AFTER_CHANGE }, ifColumnsChanged = { I_M_InOutLine.COLUMNNAME_M_InOut_ID, I_M_InOutLine.COLUMNNAME_C_OrderLine_ID }) public void unsetM_InOut_C_Order_ID(final I_M_InOutLine inOutLine) { if (inOutLine.getC_OrderLine_ID() <= 0) { return; // nothing to do }
final I_M_InOut inOut = inOutLine.getM_InOut(); final int headerOrderId = inOut.getC_Order_ID(); if (headerOrderId <= 0) { return; // nothing to do } final int lineOrderId = inOutLine.getC_OrderLine().getC_Order_ID(); if (lineOrderId == headerOrderId) { return; // nothing to do } inOut.setC_Order_ID(0); // they are at odds. unset the reference } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\inout\model\validator\M_InOutLine.java
1
请完成以下Java代码
public boolean isEmpty() { return map.isEmpty(); } @Override public boolean contains(Object o) { return map.containsKey(o); } @Override public boolean add(E o) { return map.put(o, PRESENT) == null; } @Override public boolean remove(Object o) { return map.remove(o) == PRESENT; } @Override public void clear() { map.clear(); } @SuppressWarnings("unchecked") @Override public Object clone() { try { final IdentityHashSet<E> newSet = (IdentityHashSet<E>)super.clone(); newSet.map = (IdentityHashMap<E, Object>)map.clone(); return newSet; } catch (CloneNotSupportedException e) { throw new InternalError(); } }
// -- Serializable --// private synchronized void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException { // Write out any hidden serialization magic s.defaultWriteObject(); // Write out size s.writeInt(map.size()); // Write out all elements in the proper order. for (Iterator<E> i = map.keySet().iterator(); i.hasNext();) s.writeObject(i.next()); } private synchronized void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { // Read in any hidden serialization magic s.defaultReadObject(); // Read in size (number of Mappings) int size = s.readInt(); // Read in IdentityHashMap capacity and load factor and create backing IdentityHashMap map = new IdentityHashMap<E, Object>((size * 4) / 3); // Allow for 33% growth (i.e., capacity is >= 2* size()). // Read in all elements in the proper order. for (int i = 0; i < size; i++) { @SuppressWarnings("unchecked") final E e = (E)s.readObject(); map.put(e, PRESENT); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\de\metas\util\collections\IdentityHashSet.java
1
请在Spring Boot框架中完成以下Java代码
public class LayoutFactoryProvider { @NonNull private final LayoutFactorySupportingServices supportingServices; public LayoutFactory ofMainTab(final GridWindowVO gridWindowVO) { final GridTabVO mainTabVO = gridWindowVO.getTab(GridTabVO.MAIN_TabNo); final DAOWindowUIElementsProvider windowUIElementsProvider = new DAOWindowUIElementsProvider(); windowUIElementsProvider.warmUp(extractTemplateTabIds(gridWindowVO)); return LayoutFactory.builder() .services(supportingServices) .windowUIElementsProvider(windowUIElementsProvider) //
.gridWindowVO(gridWindowVO) .gridTabVO(mainTabVO) .parentTab(null) // .build(); } private static ImmutableSet<AdTabId> extractTemplateTabIds(final GridWindowVO gridWindowVO) { return gridWindowVO.getTabs() .stream() .map(LayoutFactory::extractTemplateTabId) .collect(ImmutableSet.toImmutableSet()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\descriptor\factory\standard\LayoutFactoryProvider.java
2
请在Spring Boot框架中完成以下Java代码
public OrderStatus _id(String _id) { this._id = _id; return this; } /** * Alberta-Id der Bestellung * @return _id **/ @Schema(example = "a4adecb6-126a-4fa6-8fac-e80165ac4264", required = true, description = "Alberta-Id der Bestellung") public String getId() { return _id; } public void setId(String _id) { this._id = _id; } public OrderStatus salesId(String salesId) { this.salesId = salesId; return this; } /** * Id des Auftrags aus WaWi * @return salesId **/ @Schema(example = "A123445", required = true, description = "Id des Auftrags aus WaWi") public String getSalesId() { return salesId; } public void setSalesId(String salesId) { this.salesId = salesId; } public OrderStatus status(BigDecimal status) { this.status = status; return this; } /** * -3 &#x3D; Ausstehend, 0 &#x3D; Angelegt, 1 &#x3D; Übermittelt, 2 &#x3D; Übermittlung fehlgeschlagen, 3 &#x3D; Verarbeitet, 4 &#x3D; Versandt, 5 &#x3D; Ausgeliefert, 6 &#x3D; Gelöscht, 7 &#x3D; Storniert, 8 &#x3D; Gestoppte Serienbestellung * @return status **/ @Schema(example = "3", required = true, description = "-3 = Ausstehend, 0 = Angelegt, 1 = Übermittelt, 2 = Übermittlung fehlgeschlagen, 3 = Verarbeitet, 4 = Versandt, 5 = Ausgeliefert, 6 = Gelöscht, 7 = Storniert, 8 = Gestoppte Serienbestellung") public BigDecimal getStatus() { return status; } public void setStatus(BigDecimal status) { this.status = status;
} @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } OrderStatus orderStatus = (OrderStatus) o; return Objects.equals(this._id, orderStatus._id) && Objects.equals(this.salesId, orderStatus.salesId) && Objects.equals(this.status, orderStatus.status); } @Override public int hashCode() { return Objects.hash(_id, salesId, status); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class OrderStatus {\n"); sb.append(" _id: ").append(toIndentedString(_id)).append("\n"); sb.append(" salesId: ").append(toIndentedString(salesId)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\alberta\alberta-orders-api\src\main\java\io\swagger\client\model\OrderStatus.java
2
请完成以下Java代码
public String getBusinessKey() { return businessKey; } public String getBusinessKeyLike() { return businessKeyLike; } public String getProcessDefinitionId() { return processDefinitionId; } public String getProcessDefinitionKey() { return processDefinitionKey; } public String[] getProcessDefinitionKeys() { return processDefinitionKeys; } public String[] getProcessDefinitionKeyNotIn() { return processDefinitionKeyNotIn; } public String getDeploymentId() { return deploymentId; } public String getSuperProcessInstanceId() { return superProcessInstanceId; } public String getSubProcessInstanceId() { return subProcessInstanceId; } public SuspensionState getSuspensionState() { return suspensionState; } public void setSuspensionState(SuspensionState suspensionState) { this.suspensionState = suspensionState; } public boolean isWithIncident() { return withIncident; } public String getIncidentId() { return incidentId; } public String getIncidentType() { return incidentType; } public String getIncidentMessage() { return incidentMessage; } public String getIncidentMessageLike() { return incidentMessageLike; } public String getCaseInstanceId() { return caseInstanceId; } public String getSuperCaseInstanceId() { return superCaseInstanceId; } public String getSubCaseInstanceId() { return subCaseInstanceId; }
public boolean isTenantIdSet() { return isTenantIdSet; } public boolean isRootProcessInstances() { return isRootProcessInstances; } public boolean isProcessDefinitionWithoutTenantId() { return isProcessDefinitionWithoutTenantId; } public boolean isLeafProcessInstances() { return isLeafProcessInstances; } public String[] getTenantIds() { return tenantIds; } @Override public ProcessInstanceQuery or() { if (this != queries.get(0)) { throw new ProcessEngineException("Invalid query usage: cannot set or() within 'or' query"); } ProcessInstanceQueryImpl orQuery = new ProcessInstanceQueryImpl(); orQuery.isOrQueryActive = true; orQuery.queries = queries; queries.add(orQuery); return orQuery; } @Override public ProcessInstanceQuery endOr() { if (!queries.isEmpty() && this != queries.get(queries.size()-1)) { throw new ProcessEngineException("Invalid query usage: cannot set endOr() before or()"); } return queries.get(0); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\ProcessInstanceQueryImpl.java
1
请完成以下Java代码
public ConditionEvaluationBuilder processDefinitionId(String processDefinitionId) { ensureNotNull("processDefinitionId", processDefinitionId); this.processDefinitionId = processDefinitionId; return this; } @Override public ConditionEvaluationBuilder setVariable(String variableName, Object variableValue) { ensureNotNull("variableName", variableName); this.variables.put(variableName, variableValue); return this; } @Override public ConditionEvaluationBuilder setVariables(Map<String, Object> variables) { ensureNotNull("variables", variables); if (variables != null) { this.variables.putAll(variables); } return this; } @Override public ConditionEvaluationBuilder tenantId(String tenantId) {
ensureNotNull( "The tenant-id cannot be null. Use 'withoutTenantId()' if you want to evaluate conditional start event with a process definition which has no tenant-id.", "tenantId", tenantId); isTenantIdSet = true; this.tenantId = tenantId; return this; } @Override public ConditionEvaluationBuilder withoutTenantId() { isTenantIdSet = true; tenantId = null; return this; } @Override public List<ProcessInstance> evaluateStartConditions() { return execute(new EvaluateStartConditionCmd(this)); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\ConditionEvaluationBuilderImpl.java
1
请在Spring Boot框架中完成以下Java代码
public class DataExportAuditService { private final DataExportAuditRepository dataExportAuditRepository; private final DataExportAuditLogRepository dataExportAuditLogRepository; public DataExportAuditService( @NonNull final DataExportAuditRepository dataExportAuditRepository, @NonNull final DataExportAuditLogRepository dataExportAuditLogRepository) { this.dataExportAuditRepository = dataExportAuditRepository; this.dataExportAuditLogRepository = dataExportAuditLogRepository; } @NonNull public DataExportAuditId createExportAudit(@NonNull final DataExportAuditRequest dataExportAuditRequest) { final CreateDataExportAuditRequest.CreateDataExportAuditRequestBuilder createDataExportAuditRequestBuilder = CreateDataExportAuditRequest.builder() .tableRecordReference(dataExportAuditRequest.getTableRecordReference()) .parentId(dataExportAuditRequest.getParentExportAuditId()); dataExportAuditRepository.getByTableRecordReference(dataExportAuditRequest.getTableRecordReference())
.ifPresent(dataExportAudit -> createDataExportAuditRequestBuilder.dataExportAuditId(dataExportAudit.getId())); final DataExportAudit savedDataExportAudit = dataExportAuditRepository.save(createDataExportAuditRequestBuilder.build()); final CreateDataExportAuditLogRequest newAuditLog = CreateDataExportAuditLogRequest.builder() .dataExportAuditId(savedDataExportAudit.getId()) .action(dataExportAuditRequest.getAction()) .externalSystemConfigId(dataExportAuditRequest.getExternalSystemConfigId()) .adPInstanceId(dataExportAuditRequest.getAdPInstanceId()) .build(); dataExportAuditLogRepository.createNew(newAuditLog); return savedDataExportAudit.getId(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\audit\data\service\DataExportAuditService.java
2
请完成以下Java代码
private static List<String> convertScope(Object scope) { if (scope == null) { return Collections.emptyList(); } return Arrays.asList(StringUtils.delimitedListToStringArray(scope.toString(), " ")); } } private static final class OAuth2ClientRegistrationMapConverter implements Converter<OAuth2ClientRegistration, Map<String, Object>> { @Override public Map<String, Object> convert(OAuth2ClientRegistration source) { Map<String, Object> responseClaims = new LinkedHashMap<>(source.getClaims()); if (source.getClientIdIssuedAt() != null) { responseClaims.put(OAuth2ClientMetadataClaimNames.CLIENT_ID_ISSUED_AT, source.getClientIdIssuedAt().getEpochSecond());
} if (source.getClientSecret() != null) { long clientSecretExpiresAt = 0; if (source.getClientSecretExpiresAt() != null) { clientSecretExpiresAt = source.getClientSecretExpiresAt().getEpochSecond(); } responseClaims.put(OAuth2ClientMetadataClaimNames.CLIENT_SECRET_EXPIRES_AT, clientSecretExpiresAt); } if (!CollectionUtils.isEmpty(source.getScopes())) { responseClaims.put(OAuth2ClientMetadataClaimNames.SCOPE, StringUtils.collectionToDelimitedString(source.getScopes(), " ")); } return responseClaims; } } }
repos\spring-security-main\oauth2\oauth2-authorization-server\src\main\java\org\springframework\security\oauth2\server\authorization\http\converter\OAuth2ClientRegistrationHttpMessageConverter.java
1
请完成以下Java代码
public void setUPC (final @Nullable java.lang.String UPC) { set_Value (COLUMNNAME_UPC, UPC); } @Override public java.lang.String getUPC() { return get_ValueAsString(COLUMNNAME_UPC); } @Override public void setValue (final @Nullable java.lang.String Value) { set_Value (COLUMNNAME_Value, Value); } @Override public java.lang.String getValue() { return get_ValueAsString(COLUMNNAME_Value); } @Override public void setVendorCategory (final @Nullable java.lang.String VendorCategory) { set_Value (COLUMNNAME_VendorCategory, VendorCategory); } @Override public java.lang.String getVendorCategory() { return get_ValueAsString(COLUMNNAME_VendorCategory); } @Override public void setVendorProductNo (final @Nullable java.lang.String VendorProductNo) { set_Value (COLUMNNAME_VendorProductNo, VendorProductNo); } @Override public java.lang.String getVendorProductNo() { return get_ValueAsString(COLUMNNAME_VendorProductNo); } @Override public void setVolume (final @Nullable BigDecimal Volume) { set_Value (COLUMNNAME_Volume, Volume); } @Override public BigDecimal getVolume() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Volume); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setWeight (final @Nullable BigDecimal Weight) { set_Value (COLUMNNAME_Weight, Weight); } @Override public BigDecimal getWeight() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Weight); return bd != null ? bd : BigDecimal.ZERO; } @Override
public void setWeightUOM (final @Nullable java.lang.String WeightUOM) { set_Value (COLUMNNAME_WeightUOM, WeightUOM); } @Override public java.lang.String getWeightUOM() { return get_ValueAsString(COLUMNNAME_WeightUOM); } @Override public void setWeight_UOM_ID (final int Weight_UOM_ID) { if (Weight_UOM_ID < 1) set_Value (COLUMNNAME_Weight_UOM_ID, null); else set_Value (COLUMNNAME_Weight_UOM_ID, Weight_UOM_ID); } @Override public int getWeight_UOM_ID() { return get_ValueAsInt(COLUMNNAME_Weight_UOM_ID); } @Override public void setWidthInCm (final int WidthInCm) { set_Value (COLUMNNAME_WidthInCm, WidthInCm); } @Override public int getWidthInCm() { return get_ValueAsInt(COLUMNNAME_WidthInCm); } @Override public void setX12DE355 (final @Nullable java.lang.String X12DE355) { set_Value (COLUMNNAME_X12DE355, X12DE355); } @Override public java.lang.String getX12DE355() { return get_ValueAsString(COLUMNNAME_X12DE355); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_I_Product.java
1
请完成以下Java代码
public String getClientSoftwareKennung() { return clientSoftwareKennung; } /** * Sets the value of the clientSoftwareKennung property. * * @param value * allowed object is * {@link String } * */ public void setClientSoftwareKennung(String value) { this.clientSoftwareKennung = value; } /** * Gets the value of the bestellung property. * * @return * possible object is * {@link Bestellung } * */ public Bestellung getBestellung() { return bestellung;
} /** * Sets the value of the bestellung property. * * @param value * allowed object is * {@link Bestellung } * */ public void setBestellung(Bestellung value) { this.bestellung = value; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.msv3.schema.v1\src\main\java-xjc\de\metas\vertical\pharma\vendor\gateway\msv3\schema\v1\Bestellen.java
1
请完成以下Java代码
public void run() { // m_onlyCurrentRows = false; // search history too // cmd_save(false); m_query.setUserQuery(true); gc.getMTab().setQuery(m_query); final boolean onlyCurrentRows = false; final int onlyCurrentDays = 0; gc.query(onlyCurrentRows, onlyCurrentDays, maxRows); // autoSize } }). invoke(); ; } } public void setActionListener(final FindPanelActionListener actionListener) { Check.assumeNotNull(actionListener, "actionListener not null"); this.actionListener = actionListener; } private void setDefaultButton() { setDefaultButton(confirmPanel.getOKButton()); } private void setDefaultButton(final JButton button) { final Window frame = AEnv.getWindow(this); if (frame instanceof RootPaneContainer) { final RootPaneContainer c = (RootPaneContainer)frame; c.getRootPane().setDefaultButton(button); } } /** * Get Icon with name action * * @param name name * @param small small * @return Icon */ private final ImageIcon getIcon(String name) { final String fullName = name + (drawSmallButtons ? "16" : "24"); return Images.getImageIcon2(fullName); } /** * @return true if the panel is visible and it has at least one field in simple search mode */ @Override public boolean isFocusable() { if (!isVisible())
{ return false; } if (isSimpleSearchPanelActive()) { return m_editorFirst != null; } return false; } @Override public void setFocusable(final boolean focusable) { // ignore it } @Override public void requestFocus() { if (isSimpleSearchPanelActive()) { if (m_editorFirst != null) { m_editorFirst.requestFocus(); } } } @Override public boolean requestFocusInWindow() { if (isSimpleSearchPanelActive()) { if (m_editorFirst != null) { return m_editorFirst.requestFocusInWindow(); } } return false; } private boolean disposed = false; boolean isDisposed() { return disposed; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\apps\search\FindPanel.java
1
请完成以下Java代码
private void markExpiredInOwnTrx(@NonNull final HuId huId) { huTrxBL.process((Consumer<IHUContext>)huContext -> markExpiredUsingHUContext(huId, huContext)); } private void markExpiredUsingHUContext( @NonNull final HuId huId, @NonNull final IHUContext huContext) { try { countChecked++; final IAttributeStorage huAttributes = getHUAttributes(huId, huContext); final String expiredOld = huAttributes.getValueAsString(HUAttributeConstants.ATTR_Expired); if (HUAttributeConstants.ATTR_Expired_Value_Expired.equals(expiredOld)) { Loggables.addLog("Already marked as Expired: M_HU_ID={}", huId); return; } huAttributes.setSaveOnChange(true); huAttributes.setValue(HUAttributeConstants.ATTR_Expired, HUAttributeConstants.ATTR_Expired_Value_Expired);
countUpdated++; Loggables.addLog("Successfully processed M_HU_ID={}", huId); } catch (final AdempiereException ex) { Loggables.addLog("!!! Failed processing M_HU_ID={}: {} !!!", huId, ex.getLocalizedMessage()); logger.warn("Failed processing M_HU_ID={}. Skipped", huId, ex); } } private IAttributeStorage getHUAttributes(@NonNull final HuId huId, @NonNull final IHUContext huContext) { final I_M_HU hu = handlingUnitsBL.getById(huId); return huContext .getHUAttributeStorageFactory() .getAttributeStorage(hu); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\expiry\MarkExpiredWhereWarnDateExceededCommand.java
1
请完成以下Java代码
final class ParentChildModelCacheInvalidateRequestFactory implements ModelCacheInvalidateRequestFactory { private final String rootTableName; private final String childTableName; private final String childKeyColumnNameOrNull; private final String childLinkColumnName; @Builder private ParentChildModelCacheInvalidateRequestFactory( @NonNull final String rootTableName, @NonNull final String childTableName, @Nullable final String childKeyColumnName, @NonNull final String childLinkColumnName) { this.rootTableName = rootTableName; this.childTableName = childTableName; this.childKeyColumnNameOrNull = StringUtils.trimBlankToNull(childKeyColumnName); this.childLinkColumnName = childLinkColumnName; } @Override public List<CacheInvalidateRequest> createRequestsFromModel( final ICacheSourceModel model, final ModelCacheInvalidationTiming timing_NOTUSED)
{ final int rootRecordId = model.getValueAsInt(childLinkColumnName, -1); if (rootRecordId < 0) { return ImmutableList.of(); } final int childRecordId = childKeyColumnNameOrNull != null ? model.getValueAsInt(childKeyColumnNameOrNull, -1) : -1; if (childRecordId >= 0) { return ImmutableList.of(CacheInvalidateRequest.builder() .rootRecord(rootTableName, rootRecordId) .childRecord(childTableName, childRecordId) .build()); } else { return ImmutableList.of(CacheInvalidateRequest.rootRecord(rootTableName, rootRecordId)); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\cache\model\ParentChildModelCacheInvalidateRequestFactory.java
1
请完成以下Java代码
static class TrustedIssuerJwtAuthenticationManagerResolver implements AuthenticationManagerResolver<String> { private final Log logger = LogFactory.getLog(getClass()); private final Map<String, AuthenticationManager> authenticationManagers = new ConcurrentHashMap<>(); private final Predicate<String> trustedIssuer; TrustedIssuerJwtAuthenticationManagerResolver(Predicate<String> trustedIssuer) { this.trustedIssuer = trustedIssuer; } @Override public AuthenticationManager resolve(String issuer) { if (this.trustedIssuer.test(issuer)) { AuthenticationManager authenticationManager = this.authenticationManagers.computeIfAbsent(issuer, (k) -> { this.logger.debug("Constructing AuthenticationManager");
JwtDecoder jwtDecoder = JwtDecoders.fromIssuerLocation(issuer); return new JwtAuthenticationProvider(jwtDecoder)::authenticate; }); this.logger.debug(LogMessage.format("Resolved AuthenticationManager for issuer '%s'", issuer)); return authenticationManager; } else { this.logger.debug("Did not resolve AuthenticationManager since issuer is not trusted"); } return null; } } }
repos\spring-security-main\oauth2\oauth2-resource-server\src\main\java\org\springframework\security\oauth2\server\resource\authentication\JwtIssuerAuthenticationManagerResolver.java
1
请完成以下Java代码
public Batch correlateAllAsync() { return commandExecutor.execute(new CorrelateAllMessageBatchCmd(this)); } // getters ////////////////////////////////// public CommandExecutor getCommandExecutor() { return commandExecutor; } public String getMessageName() { return messageName; } public List<String> getProcessInstanceIds() {
return processInstanceIds; } public ProcessInstanceQuery getProcessInstanceQuery() { return processInstanceQuery; } public HistoricProcessInstanceQuery getHistoricProcessInstanceQuery() { return historicProcessInstanceQuery; } public Map<String, Object> getPayloadProcessInstanceVariables() { return payloadProcessInstanceVariables; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\MessageCorrelationAsyncBuilderImpl.java
1
请完成以下Java代码
public class TemplateUtils { private static final Pattern TEMPLATE_PARAM_PATTERN = Pattern.compile("\\$\\{(.+?)(:[a-zA-Z]+)?}"); private static final Map<String, UnaryOperator<String>> FUNCTIONS = Map.of( "upperCase", String::toUpperCase, "lowerCase", String::toLowerCase, "capitalize", StringUtils::capitalize ); private TemplateUtils() {} public static String processTemplate(String template, Map<String, String> context) { return TEMPLATE_PARAM_PATTERN.matcher(template).replaceAll(matchResult -> { String key = matchResult.group(1);
if (!context.containsKey(key)) { return "\\" + matchResult.group(); } String value = nullToEmpty(context.get(key)); String function = removeStart(matchResult.group(2), ":"); if (function != null) { if (FUNCTIONS.containsKey(function)) { value = FUNCTIONS.get(function).apply(value); } } return Matcher.quoteReplacement(value); }); } }
repos\thingsboard-master\common\data\src\main\java\org\thingsboard\server\common\data\util\TemplateUtils.java
1
请完成以下Java代码
public void setMultiplyRate (java.math.BigDecimal MultiplyRate) { set_Value (COLUMNNAME_MultiplyRate, MultiplyRate); } /** Get Faktor. @return Rate to multiple the source by to calculate the target. */ @Override public java.math.BigDecimal getMultiplyRate () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_MultiplyRate); if (bd == null) return Env.ZERO; return bd; } /** Set Gültig ab. @param ValidFrom Valid from including this date (first day) */ @Override public void setValidFrom (java.sql.Timestamp ValidFrom) { set_Value (COLUMNNAME_ValidFrom, ValidFrom); } /** Get Gültig ab. @return Valid from including this date (first day) */
@Override public java.sql.Timestamp getValidFrom () { return (java.sql.Timestamp)get_Value(COLUMNNAME_ValidFrom); } /** Set Gültig bis. @param ValidTo Valid to including this date (last day) */ @Override public void setValidTo (java.sql.Timestamp ValidTo) { set_Value (COLUMNNAME_ValidTo, ValidTo); } /** Get Gültig bis. @return Valid to including this date (last day) */ @Override public java.sql.Timestamp getValidTo () { return (java.sql.Timestamp)get_Value(COLUMNNAME_ValidTo); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Conversion_Rate.java
1
请在Spring Boot框架中完成以下Java代码
public ConversationalRetrievalChain chain() { EmbeddingModel embeddingModel = new AllMiniLmL6V2EmbeddingModel(); EmbeddingStore<TextSegment> embeddingStore = new InMemoryEmbeddingStore<>(); EmbeddingStoreIngestor ingestor = EmbeddingStoreIngestor.builder() .documentSplitter(DocumentSplitters.recursive(500, 0)) .embeddingModel(embeddingModel) .embeddingStore(embeddingStore) .build(); log.info("Ingesting Spring Boot Resources ..."); ingestor.ingest(documents); log.info("Ingested {} documents", documents.size()); EmbeddingStoreRetriever retriever = EmbeddingStoreRetriever.from(embeddingStore, embeddingModel); EmbeddingStoreLoggingRetriever loggingRetriever = new EmbeddingStoreLoggingRetriever(retriever); /*MessageWindowChatMemory chatMemory = MessageWindowChatMemory.builder() .maxMessages(10)
.build();*/ log.info("Building ConversationalRetrievalChain ..."); ConversationalRetrievalChain chain = ConversationalRetrievalChain.builder() .chatLanguageModel(OpenAiChatModel.builder() .apiKey(apiKey) .timeout(Duration.ofSeconds(timeout)) .build() ) .promptTemplate(PromptTemplate.from(PROMPT_TEMPLATE_2)) //.chatMemory(chatMemory) .retriever(loggingRetriever) .build(); log.info("Spring Boot knowledge base is ready!"); return chain; } }
repos\springboot-demo-master\rag\src\main\java\com\et\rag\configuration\LangChainConfiguration.java
2
请完成以下Java代码
public List<CellValue> getHeaderNames() { final ArrayList<CellValue> result = new ArrayList<>(); for (int i = 0; i < getColumnCount(); i++) { result.add(CellValues.toCellValue(getHeaderName(i))); } return result; } private String getHeaderName(final int col) { return m_printFormat.getItem(col).getPrintName(getLanguage()); } @Override public int getRowCount() { return m_printData.getRowCount(); } @Override public boolean isColumnPrinted(final int col) { MPrintFormatItem item = m_printFormat.getItem(col); return item.isPrinted(); } @Override public boolean isPageBreak(final int row, final int col) { PrintDataElement pde = getPDE(row, col); return pde != null ? pde.isPageBreak() : false; } @Override public boolean isFunctionRow(final int row) { return m_printData.isFunctionRow(row); } @Override protected void formatPage(final Sheet sheet) { super.formatPage(sheet); MPrintPaper paper = MPrintPaper.get(this.m_printFormat.getAD_PrintPaper_ID()); // // Set paper size: short paperSize = -1; MediaSizeName mediaSizeName = paper.getMediaSize().getMediaSizeName(); if (MediaSizeName.NA_LETTER.equals(mediaSizeName)) { paperSize = PrintSetup.LETTER_PAPERSIZE; } else if (MediaSizeName.NA_LEGAL.equals(mediaSizeName)) { paperSize = PrintSetup.LEGAL_PAPERSIZE; } else if (MediaSizeName.EXECUTIVE.equals(mediaSizeName)) { paperSize = PrintSetup.EXECUTIVE_PAPERSIZE; } else if (MediaSizeName.ISO_A4.equals(mediaSizeName)) { paperSize = PrintSetup.A4_PAPERSIZE;
} else if (MediaSizeName.ISO_A5.equals(mediaSizeName)) { paperSize = PrintSetup.A5_PAPERSIZE; } else if (MediaSizeName.NA_NUMBER_10_ENVELOPE.equals(mediaSizeName)) { paperSize = PrintSetup.ENVELOPE_10_PAPERSIZE; } // else if (MediaSizeName..equals(mediaSizeName)) { // paperSize = PrintSetup.ENVELOPE_DL_PAPERSIZE; // } // else if (MediaSizeName..equals(mediaSizeName)) { // paperSize = PrintSetup.ENVELOPE_CS_PAPERSIZE; // } else if (MediaSizeName.MONARCH_ENVELOPE.equals(mediaSizeName)) { paperSize = PrintSetup.ENVELOPE_MONARCH_PAPERSIZE; } if (paperSize != -1) { sheet.getPrintSetup().setPaperSize(paperSize); } // // Set Landscape/Portrait: sheet.getPrintSetup().setLandscape(paper.isLandscape()); // // Set Paper Margin: sheet.setMargin(Sheet.TopMargin, ((double)paper.getMarginTop()) / 72); sheet.setMargin(Sheet.RightMargin, ((double)paper.getMarginRight()) / 72); sheet.setMargin(Sheet.LeftMargin, ((double)paper.getMarginLeft()) / 72); sheet.setMargin(Sheet.BottomMargin, ((double)paper.getMarginBottom()) / 72); // } @Override protected List<CellValue> getNextRow() { final ArrayList<CellValue> result = new ArrayList<>(); for (int i = 0; i < getColumnCount(); i++) { result.add(getValueAt(rowNumber, i)); } rowNumber++; return result; } @Override protected boolean hasNextRow() { return rowNumber < getRowCount(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\adempiere\print\export\PrintDataExcelExporter.java
1
请完成以下Java代码
public AcceptedType getAccepted() { return accepted; } /** * Sets the value of the accepted property. * * @param value * allowed object is * {@link AcceptedType } * */ public void setAccepted(AcceptedType value) { this.accepted = value; } /** * Gets the value of the rejected property. * * @return * possible object is * {@link RejectedType } *
*/ public RejectedType getRejected() { return rejected; } /** * Sets the value of the rejected property. * * @param value * allowed object is * {@link RejectedType } * */ public void setRejected(RejectedType value) { this.rejected = value; } }
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_440_response\src\main\java-xjc\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_440\response\BodyType.java
1
请完成以下Java代码
protected void deleteCaseInstance() { updateChildPlanItemInstancesState(); String newState = getNewState(); CallbackData callBackData = new CallbackData(caseInstanceEntity.getCallbackId(), caseInstanceEntity.getCallbackType(), caseInstanceEntity.getId(), caseInstanceEntity.getState(), newState); addAdditionalCallbackData(callBackData); CommandContextUtil.getCaseInstanceHelper(commandContext).callCaseInstanceStateChangeCallbacks(callBackData); CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext); CommandContextUtil.getCmmnHistoryManager(commandContext) .recordCaseInstanceEnd(caseInstanceEntity, newState, cmmnEngineConfiguration.getClock().getCurrentTime()); if (cmmnEngineConfiguration.isLoggingSessionEnabled()) { String loggingType = null; if (CaseInstanceState.TERMINATED.equals(getNewState())) { loggingType = CmmnLoggingSessionConstants.TYPE_CASE_TERMINATED; } else { loggingType = CmmnLoggingSessionConstants.TYPE_CASE_COMPLETED; } CmmnLoggingSessionUtil.addLoggingData(loggingType, "Completed case instance with id " + caseInstanceEntity.getId(), caseInstanceEntity, cmmnEngineConfiguration.getObjectMapper()); } CommandContextUtil.getCaseInstanceEntityManager(commandContext).delete(caseInstanceEntity.getId(), false, getDeleteReason()); } protected void updateChildPlanItemInstancesState() {
List<PlanItemInstanceEntity> childPlanItemInstances = caseInstanceEntity.getChildPlanItemInstances(); if (childPlanItemInstances != null) { for (PlanItemInstanceEntity childPlanItemInstance : childPlanItemInstances) { // if the child plan item is not yet in a terminal state, terminate it if (!PlanItemInstanceState.isInTerminalState(childPlanItemInstance)) { changeStateForChildPlanItemInstance(childPlanItemInstance); } } } } public abstract String getDeleteReason(); public void addAdditionalCallbackData(CallbackData callbackData) { // meant to be overridden } }
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\agenda\operation\AbstractDeleteCaseInstanceOperation.java
1
请完成以下Java代码
public void setA_Period_3 (BigDecimal A_Period_3) { set_Value (COLUMNNAME_A_Period_3, A_Period_3); } /** Get A_Period_3. @return A_Period_3 */ public BigDecimal getA_Period_3 () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_A_Period_3); if (bd == null) return Env.ZERO; return bd; } /** Set A_Period_4. @param A_Period_4 A_Period_4 */ public void setA_Period_4 (BigDecimal A_Period_4) { set_Value (COLUMNNAME_A_Period_4, A_Period_4); } /** Get A_Period_4. @return A_Period_4 */ public BigDecimal getA_Period_4 () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_A_Period_4); if (bd == null) return Env.ZERO; return bd; } /** Set A_Period_5. @param A_Period_5 A_Period_5 */ public void setA_Period_5 (BigDecimal A_Period_5) { set_Value (COLUMNNAME_A_Period_5, A_Period_5); } /** Get A_Period_5. @return A_Period_5 */ public BigDecimal getA_Period_5 () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_A_Period_5); if (bd == null) return Env.ZERO; return bd; } /** Set A_Period_6. @param A_Period_6 A_Period_6 */ public void setA_Period_6 (BigDecimal A_Period_6) { set_Value (COLUMNNAME_A_Period_6, A_Period_6); } /** Get A_Period_6. @return A_Period_6 */ public BigDecimal getA_Period_6 () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_A_Period_6); if (bd == null) return Env.ZERO; return bd; } /** Set A_Period_7. @param A_Period_7 A_Period_7 */ public void setA_Period_7 (BigDecimal A_Period_7) { set_Value (COLUMNNAME_A_Period_7, A_Period_7); } /** Get A_Period_7. @return A_Period_7 */
public BigDecimal getA_Period_7 () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_A_Period_7); if (bd == null) return Env.ZERO; return bd; } /** Set A_Period_8. @param A_Period_8 A_Period_8 */ public void setA_Period_8 (BigDecimal A_Period_8) { set_Value (COLUMNNAME_A_Period_8, A_Period_8); } /** Get A_Period_8. @return A_Period_8 */ public BigDecimal getA_Period_8 () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_A_Period_8); if (bd == null) return Env.ZERO; return bd; } /** Set A_Period_9. @param A_Period_9 A_Period_9 */ public void setA_Period_9 (BigDecimal A_Period_9) { set_Value (COLUMNNAME_A_Period_9, A_Period_9); } /** Get A_Period_9. @return A_Period_9 */ public BigDecimal getA_Period_9 () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_A_Period_9); if (bd == null) return Env.ZERO; return bd; } /** 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); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_A_Asset_Spread.java
1
请完成以下Java代码
public abstract class PlanItemDefinitionMapping { protected String planItemDefinitionId; protected String condition; public PlanItemDefinitionMapping(String planItemDefinitionId) { this.planItemDefinitionId = planItemDefinitionId; } public PlanItemDefinitionMapping(String planItemDefinitionId, String condition) { this.planItemDefinitionId = planItemDefinitionId; this.condition = condition; } public String getPlanItemDefinitionId() {
return planItemDefinitionId; } public void setPlanItemDefinitionId(String planItemDefinitionId) { this.planItemDefinitionId = planItemDefinitionId; } public String getCondition() { return condition; } public void setCondition(String condition) { this.condition = condition; } }
repos\flowable-engine-main\modules\flowable-cmmn-api\src\main\java\org\flowable\cmmn\api\migration\PlanItemDefinitionMapping.java
1
请完成以下Java代码
public class ModelInfo { protected String id; protected String name; protected String key; public ModelInfo(String id, String name, String key) { this.id = id; this.name = name; this.key = key; } public String getId() { return id; } public void setId(String id) { this.id = id; }
public String getName() { return name; } public void setName(String name) { this.name = name; } public String getKey() { return key; } public void setKey(String key) { this.key = key; } }
repos\Activiti-develop\activiti-core\activiti-json-converter\src\main\java\org\activiti\editor\language\json\model\ModelInfo.java
1
请完成以下Java代码
public Point newInstance(ModelTypeInstanceContext instanceContext) { return new PointImpl(instanceContext); } }); xAttribute = typeBuilder.doubleAttribute(DC_ATTRIBUTE_X) .required() .build(); yAttribute = typeBuilder.doubleAttribute(DC_ATTRIBUTE_Y) .required() .build(); typeBuilder.build(); } public PointImpl(ModelTypeInstanceContext instanceContext) { super(instanceContext); } public Double getX() {
return xAttribute.getValue(this); } public void setX(double x) { xAttribute.setValue(this, x); } public Double getY() { return yAttribute.getValue(this); } public void setY(double y) { yAttribute.setValue(this, y); } }
repos\camunda-bpm-platform-master\model-api\bpmn-model\src\main\java\org\camunda\bpm\model\bpmn\impl\instance\dc\PointImpl.java
1
请在Spring Boot框架中完成以下Java代码
public DeploymentBuilder name(String name) { deployment.setName(name); return this; } @Override public DeploymentBuilder category(String category) { deployment.setCategory(category); return this; } @Override public DeploymentBuilder key(String key) { deployment.setKey(key); return this; } @Override public DeploymentBuilder parentDeploymentId(String parentDeploymentId) { deployment.setParentDeploymentId(parentDeploymentId); return this; } @Override public DeploymentBuilder disableBpmnValidation() { this.isProcessValidationEnabled = false; return this; } @Override public DeploymentBuilder disableSchemaValidation() { this.isBpmn20XsdValidationEnabled = false; return this; } @Override public DeploymentBuilder tenantId(String tenantId) { deployment.setTenantId(tenantId); return this; } @Override public DeploymentBuilder enableDuplicateFiltering() { this.isDuplicateFilterEnabled = true; return this; } @Override public DeploymentBuilder activateProcessDefinitionsOn(Date date) { this.processDefinitionsActivationDate = date; return this; } @Override public DeploymentBuilder deploymentProperty(String propertyKey, Object propertyValue) { deploymentProperties.put(propertyKey, propertyValue); return this; } @Override public Deployment deploy() { return repositoryService.deploy(this); }
// getters and setters // ////////////////////////////////////////////////////// public DeploymentEntity getDeployment() { return deployment; } public boolean isProcessValidationEnabled() { return isProcessValidationEnabled; } public boolean isBpmn20XsdValidationEnabled() { return isBpmn20XsdValidationEnabled; } public boolean isDuplicateFilterEnabled() { return isDuplicateFilterEnabled; } public Date getProcessDefinitionsActivationDate() { return processDefinitionsActivationDate; } public Map<String, Object> getDeploymentProperties() { return deploymentProperties; } }
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\repository\DeploymentBuilderImpl.java
2
请在Spring Boot框架中完成以下Java代码
public class PriceSpecification { public static PriceSpecification none() { return NONE; } public static PriceSpecification basePricingSystem(@NonNull final PricingSystemId pricingSystemId) { final Money pricingSystemSurcharge = null; return basePricingSystem(pricingSystemId, pricingSystemSurcharge); } public static PriceSpecification basePricingSystem( @NonNull final PricingSystemId pricingSystemId, @Nullable final Money pricingSystemSurcharge) { return new PriceSpecification( PriceSpecificationType.BASE_PRICING_SYSTEM, pricingSystemId/* pricingSystemId */, pricingSystemSurcharge /* pricingSystemSurcharge */, null/* fixedPriceAmt */ ); } public static PriceSpecification fixedPrice(@NonNull final Money fixedPrice) { return new PriceSpecification( PriceSpecificationType.FIXED_PRICE, null/* pricingSystemId */, null/* basePriceAddAmt */, fixedPrice/* fixedPriceAmt */ ); } private static final PriceSpecification NONE = new PriceSpecification( PriceSpecificationType.NONE,
null/* basePricingSystemId */, null/* pricingSystemSurchargeAmt */, null/* fixedPriceAmt */); PriceSpecificationType type; // // Base pricing system related fields PricingSystemId basePricingSystemId; Money pricingSystemSurcharge; // // Fixed price related fields Money fixedPrice; private PriceSpecification( @NonNull final PriceSpecificationType type, @Nullable final PricingSystemId basePricingSystemId, @Nullable final Money pricingSystemSurcharge, @Nullable final Money fixedPrice) { this.type = type; this.basePricingSystemId = basePricingSystemId; this.pricingSystemSurcharge = pricingSystemSurcharge; this.fixedPrice = fixedPrice; } public boolean isNoPrice() { return type == PriceSpecificationType.NONE; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\pricing\conditions\PriceSpecification.java
2
请完成以下Java代码
private boolean shouldExportDirectly(@NonNull final I_M_HU_Trace huTrace) { final HUTraceType huTraceType = HUTraceType.ofCode(huTrace.getHUTraceType()); final boolean purchasedOrProduced = huTraceType.equals(MATERIAL_RECEIPT) || huTraceType.equals(PRODUCTION_RECEIPT); final boolean docCompleted = DocStatus.ofCodeOptional(huTrace.getDocStatus()) .map(DocStatus::isCompleted) .orElse(false); return purchasedOrProduced && docCompleted; } private boolean shouldExportIfAlreadyExportedOnce(@NonNull final HUTraceType huTraceType) { return huTraceType.equals(TRANSFORM_LOAD) || huTraceType.equals(TRANSFORM_PARENT);
} private boolean shouldExportToExternalSystem(@NonNull final ExternalSystemGRSSignumConfig grsSignumConfig, @NonNull final HUTraceType huTraceType) { switch (huTraceType) { case MATERIAL_RECEIPT: return grsSignumConfig.isSyncHUsOnMaterialReceipt(); case PRODUCTION_RECEIPT: return grsSignumConfig.isSyncHUsOnProductionReceipt(); default: return false; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java\de\metas\externalsystem\grssignum\ExportHUToGRSService.java
1
请完成以下Java代码
public String getIntroduction() { return introduction; } public void setIntroduction(String introduction) { this.introduction = introduction; } public String getLastLoginIp() { return lastLoginIp; } public void setLastLoginIp(String lastLoginIp) { this.lastLoginIp = lastLoginIp; }
@Override public String toString() { return "UserDetail{" + "id=" + id + ", userId=" + userId + ", age=" + age + ", realName='" + realName + '\'' + ", status='" + status + '\'' + ", hobby='" + hobby + '\'' + ", introduction='" + introduction + '\'' + ", lastLoginIp='" + lastLoginIp + '\'' + '}'; } }
repos\spring-boot-leaning-master\2.x_42_courses\第 3-4 课: Spring Data JPA 的基本使用\spring-boot-jpa\src\main\java\com\neo\model\UserDetail.java
1
请完成以下Java代码
public long getBurstCapacity() { return burstCapacity; } public Config setBurstCapacity(long burstCapacity) { Assert.isTrue(burstCapacity >= this.replenishRate, "BurstCapacity(" + burstCapacity + ") must be greater than or equal than replenishRate(" + this.replenishRate + ")"); Assert.isTrue(burstCapacity <= REDIS_LUA_MAX_SAFE_INTEGER, "BurstCapacity(" + burstCapacity + ") must not exceed the maximum allowed value of " + REDIS_LUA_MAX_SAFE_INTEGER); this.burstCapacity = burstCapacity; return this; } public int getRequestedTokens() { return requestedTokens; } public Config setRequestedTokens(int requestedTokens) {
this.requestedTokens = requestedTokens; return this; } @Override public String toString() { return new ToStringCreator(this).append("replenishRate", replenishRate) .append("burstCapacity", burstCapacity) .append("requestedTokens", requestedTokens) .toString(); } } }
repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webflux\src\main\java\org\springframework\cloud\gateway\filter\ratelimit\RedisRateLimiter.java
1
请完成以下Java代码
private void recalculateADR(final Properties ctx, final IAttributeSet attributeSet, final boolean subProducerJustInitialized) { final I_M_Attribute attr_MarkeADR = adrAttributeDAO.retrieveADRAttribute(ctx); if (attr_MarkeADR == null) { return; } final IAttributeStorage attributeStorage = (IAttributeStorage)attributeSet; if (!attributeStorage.hasAttribute(attr_MarkeADR)) { return; // skip if the attribute storage does not have the ADR attribute } if (subProducerJustInitialized && attributeStorage.getValue(attr_MarkeADR) != null) { return; // task 08782: the sub-producer was set only now, so we keep the pre-existing ADR value. } // This variable will keep the partner for who we want to compute the ADR Region attribute // It can be either the sub-producer,if it exists, or the partner if it doesn't I_C_BPartner partner = getSubProducerBPartnerOrNull(attributeStorage); if (partner == null) { final I_M_HU hu = huAttributesBL.getM_HU_OrNull(attributeSet); // attributeset might also belong to e.g. an inventory line and have no HU if (hu != null) { partner = InterfaceWrapperHelper.create(IHandlingUnitsBL.extractBPartnerOrNull(hu), I_C_BPartner.class); } // If there is no BPartner we have to set the ADR attribute to null if (partner == null) { Check.assume(!subProducerJustInitialized, "partner=null for attributeSet={}, therefore subProducerJustInitialized is false", attributeSet); attributeStorage.setValueToNull(attr_MarkeADR); return; }
} // isSoTrx = false because we only need it in Wareneingang POS // TODO: Check if this will be needed somewhere else and fix accordingly final boolean isSOTrx = false; final AttributeListValue markeADR = adrAttributeBL.getCreateAttributeValue(ctx, partner, isSOTrx, ITrx.TRXNAME_None); final String markeADRValue = markeADR == null ? null : markeADR.getValue(); attributeStorage.setValue(attr_MarkeADR, markeADRValue); } @Nullable private I_C_BPartner getSubProducerBPartnerOrNull(final IAttributeSet attributeStorage) { final AttributeId subProducerAttributeId = attributeDAO.retrieveActiveAttributeIdByValueOrNull(HUAttributeConstants.ATTR_SubProducerBPartner_Value); if (subProducerAttributeId == null) { return null; } final I_M_Attribute subProducerAttribute = attributeDAO.getAttributeRecordById(subProducerAttributeId); final BigDecimal subProducerIdBD = attributeStorage.getValueAsBigDecimal(subProducerAttribute); final int subProducerID = subProducerIdBD.intValueExact(); if (subProducerID <= 0) { return null; } return bpartnerDAO.getById(subProducerID, I_C_BPartner.class); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.fresh\de.metas.fresh.base\src\main\java\org\adempiere\mm\attributes\api\impl\SubProducerAttributeBL.java
1
请完成以下Java代码
public Object generateSeedValue(final IAttributeSet attributeSet, final I_M_Attribute attribute, final Object valueInitialDefault) { return SecurPharmAttributesStatus.UNKNOW.getCode(); } @Override public boolean isReadonlyUI(final IAttributeValueContext ctx, final IAttributeSet attributeSet, final I_M_Attribute attribute) { return true; } @Override public boolean isAlwaysEditableUI(final IAttributeValueContext ctx, final IAttributeSet attributeSet, final I_M_Attribute attribute) { return false;
} @Override public boolean isDisplayedUI(final IAttributeSet attributeSet, final I_M_Attribute attribute) { return Adempiere.getBean(SecurPharmService.class).hasConfig(); } @Override public String getAttributeValueType() { return X_M_Attribute.ATTRIBUTEVALUETYPE_List; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.securpharm\src\main\java\de\metas\vertical\pharma\securpharm\attribute\HUScannedAttributeHandler.java
1
请完成以下Java代码
public abstract class AbstractStockEstimateEvent implements MaterialEvent { private final EventDescriptor eventDescriptor; private final MaterialDescriptor materialDescriptor; private final Instant date; private final int plantId; private final int freshQtyOnHandId; private final int freshQtyOnHandLineId; private final Integer qtyStockEstimateSeqNo; private final Instant eventDate; public AbstractStockEstimateEvent( @NonNull final EventDescriptor eventDescriptor, @NonNull final MaterialDescriptor materialDescriptor, @NonNull final Instant date, final int plantId, final int freshQtyOnHandId, final int freshQtyOnHandLineId, @Nullable final Integer qtyStockEstimateSeqNo, @NonNull final Instant eventDate ) {
this.eventDescriptor = eventDescriptor; this.materialDescriptor = materialDescriptor; this.date = date; this.plantId = plantId; this.freshQtyOnHandId = freshQtyOnHandId; this.freshQtyOnHandLineId = freshQtyOnHandLineId; this.qtyStockEstimateSeqNo = qtyStockEstimateSeqNo; this.eventDate = eventDate; } public abstract BigDecimal getQuantityDelta(); @Nullable @Override public TableRecordReference getSourceTableReference() { return TableRecordReference.ofNullable(FRESH_QTYONHAND_TABLE_NAME, freshQtyOnHandId); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.material\event\src\main\java\de\metas\material\event\stockestimate\AbstractStockEstimateEvent.java
1
请完成以下Java代码
public static String normalizeRoutePredicateName(Class<? extends RoutePredicateFactory> clazz) { return removeGarbage(clazz.getSimpleName().replace(RoutePredicateFactory.class.getSimpleName(), "")); } public static String normalizeRoutePredicateNameAsProperty(Class<? extends RoutePredicateFactory> clazz) { return normalizeToCanonicalPropertyFormat(normalizeRoutePredicateName(clazz)); } public static String normalizeFilterFactoryName(Class<? extends GatewayFilterFactory> clazz) { return removeGarbage(clazz.getSimpleName().replace(GatewayFilterFactory.class.getSimpleName(), "")); } public static String normalizeGlobalFilterName(Class<? extends GlobalFilter> clazz) { return removeGarbage(clazz.getSimpleName().replace(GlobalFilter.class.getSimpleName(), "")).replace("Filter", ""); } public static String normalizeFilterFactoryNameAsProperty(Class<? extends GatewayFilterFactory> clazz) { return normalizeToCanonicalPropertyFormat(normalizeFilterFactoryName(clazz)); } public static String normalizeGlobalFilterNameAsProperty(Class<? extends GlobalFilter> filterClass) { return normalizeToCanonicalPropertyFormat(normalizeGlobalFilterName(filterClass)); } public static String normalizeToCanonicalPropertyFormat(String name) { Matcher matcher = NAME_PATTERN.matcher(name); StringBuffer stringBuffer = new StringBuffer();
while (matcher.find()) { if (stringBuffer.length() != 0) { matcher.appendReplacement(stringBuffer, "-" + matcher.group(1)); } else { matcher.appendReplacement(stringBuffer, matcher.group(1)); } } return stringBuffer.toString().toLowerCase(Locale.ROOT); } private static String removeGarbage(String s) { int garbageIdx = s.indexOf("$Mockito"); if (garbageIdx > 0) { return s.substring(0, garbageIdx); } return s; } }
repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webflux\src\main\java\org\springframework\cloud\gateway\support\NameUtils.java
1
请完成以下Java代码
protected Properties initialValue() { final Properties ctx = new Properties(); listener.onContextCreated(ctx); return ctx; } /** @return a new properties instance, using the given <code>parentValue</code> for defaults */ @Override protected Properties childValue(final Properties ctx) { final Properties childCtx = new Properties(ctx); listener.onChildContextCreated(ctx, childCtx); return childCtx; } @Override public Properties get() { final Properties ctx = super.get(); listener.onContextCheckOut(ctx); return ctx; }; @Override public void set(final Properties ctx) { final Properties ctxOld = super.get(); super.set(ctx); listener.onContextCheckIn(ctx, ctxOld); }; }; @Override protected Properties getDelegate() { return threadLocalContext.get(); } public ThreadLocalServerContext() { super(); } /** * Temporarily switches the context in the current thread. */ public IAutoCloseable switchContext(final Properties ctx) { Check.assumeNotNull(ctx, "ctx not null"); // Avoid StackOverflowException caused by setting the same context if (ctx == this) { return NullAutoCloseable.instance; } final long threadIdOnSet = Thread.currentThread().getId(); final Properties ctxOld = threadLocalContext.get(); threadLocalContext.set(ctx);
return new IAutoCloseable() { private boolean closed = false; @Override public void close() { // Do nothing if already closed if (closed) { return; } // Assert we are restoring the ctx in same thread. // Because else, we would set the context "back" in another thread which would lead to huge inconsistencies. if (Thread.currentThread().getId() != threadIdOnSet) { throw new IllegalStateException("Error: setting back the context shall be done in the same thread as it was set initially"); } threadLocalContext.set(ctxOld); closed = true; } }; } /** * Dispose the context from current thread */ public void dispose() { final Properties ctx = threadLocalContext.get(); ctx.clear(); threadLocalContext.remove(); } public void setListener(@NonNull final IContextProviderListener listener) { this.listener = listener; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\context\ThreadLocalServerContext.java
1
请完成以下Java代码
public String getName() { return this.name; } public void setName(String name) { this.name = name; } public URL getUrl() { return this.url; } public void setUrl(URL url) { this.url = url; } public boolean isReleasesEnabled() { return this.releasesEnabled; } public void setReleasesEnabled(boolean releasesEnabled) { this.releasesEnabled = releasesEnabled; } public boolean isSnapshotsEnabled() { return this.snapshotsEnabled; } public void setSnapshotsEnabled(boolean snapshotsEnabled) { this.snapshotsEnabled = snapshotsEnabled; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Repository other = (Repository) obj; if (this.name == null) { if (other.name != null) { return false; } } else if (!this.name.equals(other.name)) { return false; }
if (this.releasesEnabled != other.releasesEnabled) { return false; } if (this.snapshotsEnabled != other.snapshotsEnabled) { return false; } if (this.url == null) { if (other.url != null) { return false; } } else if (!this.url.equals(other.url)) { return false; } return true; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((this.name == null) ? 0 : this.name.hashCode()); result = prime * result + (this.releasesEnabled ? 1231 : 1237); result = prime * result + (this.snapshotsEnabled ? 1231 : 1237); result = prime * result + ((this.url == null) ? 0 : this.url.hashCode()); return result; } @Override public String toString() { return new StringJoiner(", ", Repository.class.getSimpleName() + "[", "]").add("name='" + this.name + "'") .add("url=" + this.url) .add("releasesEnabled=" + this.releasesEnabled) .add("snapshotsEnabled=" + this.snapshotsEnabled) .toString(); } }
repos\initializr-main\initializr-metadata\src\main\java\io\spring\initializr\metadata\Repository.java
1
请完成以下Java代码
public AggregatedCostAmount add(@NonNull final AggregatedCostAmount other) { if (!Objects.equals(costSegment, other.costSegment)) { throw new AdempiereException("Cannot add cost results when the cost segment is not matching: " + this + ", " + other); } final Map<CostElement, CostAmountDetailed> amountsNew = new HashMap<>(amountsPerElement); other.amountsPerElement.forEach((costElement, amtToAdd) -> { amountsNew.compute(costElement, (ce, amtOld) -> amtOld != null ? amtOld.add(amtToAdd) : amtToAdd); }); return new AggregatedCostAmount(costSegment, amountsNew); } @VisibleForTesting public AggregatedCostAmount retainOnlyAccountable(@NonNull final AcctSchema as) { final AcctSchemaCosting costing = as.getCosting(); final LinkedHashMap<CostElement, CostAmountDetailed> amountsPerElementNew = new LinkedHashMap<>(); amountsPerElement.forEach((costElement, costAmount) -> { if (costElement.isAccountable(costing)) { amountsPerElementNew.put(costElement, costAmount); } });
if (amountsPerElementNew.size() == amountsPerElement.size()) { return this; } return new AggregatedCostAmount(costSegment, amountsPerElementNew); } public CostAmountDetailed getTotalAmountToPost(@NonNull final AcctSchema as) { return getTotalAmount(as.getCosting()).orElseGet(() -> CostAmountDetailed.zero(as.getCurrencyId())); } @VisibleForTesting Optional<CostAmountDetailed> getTotalAmount(@NonNull final AcctSchemaCosting asCosting) { return getCostElements() .stream() .filter(costElement -> costElement.isAccountable(asCosting)) .map(this::getCostAmountForCostElement) .reduce(CostAmountDetailed::add); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\costing\AggregatedCostAmount.java
1
请在Spring Boot框架中完成以下Java代码
public class CRLFLogConverter extends CompositeConverter<ILoggingEvent> { public static final Marker CRLF_SAFE_MARKER = MarkerFactory.getMarker("CRLF_SAFE"); private static final String[] SAFE_LOGGERS = { "org.hibernate", "org.springframework.boot.autoconfigure", "org.springframework.boot.diagnostics", }; private static final Map<String, AnsiElement> ELEMENTS; static { Map<String, AnsiElement> ansiElements = new HashMap<>(); ansiElements.put("faint", AnsiStyle.FAINT); ansiElements.put("red", AnsiColor.RED); ansiElements.put("green", AnsiColor.GREEN); ansiElements.put("yellow", AnsiColor.YELLOW); ansiElements.put("blue", AnsiColor.BLUE); ansiElements.put("magenta", AnsiColor.MAGENTA); ansiElements.put("cyan", AnsiColor.CYAN); ELEMENTS = Collections.unmodifiableMap(ansiElements); } @Override protected String transform(ILoggingEvent event, String in) { AnsiElement element = ELEMENTS.get(getFirstOption()); List<Marker> markers = event.getMarkerList(); if ((markers != null && !markers.isEmpty() && markers.get(0).contains(CRLF_SAFE_MARKER)) || isLoggerSafe(event)) { return in; } String replacement = element == null ? "_" : toAnsiString("_", element); return in.replaceAll("[\n\r\t]", replacement);
} protected boolean isLoggerSafe(ILoggingEvent event) { for (String safeLogger : SAFE_LOGGERS) { if (event.getLoggerName().startsWith(safeLogger)) { return true; } } return false; } protected String toAnsiString(String in, AnsiElement element) { return AnsiOutput.toString(element, in); } }
repos\tutorials-master\jhipster-8-modules\jhipster-8-microservice\car-app\src\main\java\com\cars\app\config\CRLFLogConverter.java
2
请完成以下Java代码
public class ResourceNameUtil { public static final String[] CMMN_RESOURCE_SUFFIXES = new String[] { "cmmn.xml", "cmmn" }; public static final String[] DIAGRAM_SUFFIXES = new String[] { "png", "jpg", "gif", "svg" }; public static String stripCmmnFileSuffix(String cmmnFileResource) { for (String suffix : CMMN_RESOURCE_SUFFIXES) { if (cmmnFileResource.endsWith(suffix)) { return cmmnFileResource.substring(0, cmmnFileResource.length() - suffix.length()); } } return cmmnFileResource; } public static String getCaseDiagramResourceName(String cmmnFileResource, String caseKey, String diagramSuffix) { String cmmnFileResourceBase = stripCmmnFileSuffix(cmmnFileResource); return cmmnFileResourceBase + caseKey + "." + diagramSuffix; } /** * Finds the name of a resource for the diagram for a case definition. Assumes that the case definition's key and (CMMN) resource name are already set. * * <p> * It will first look for an image resource which matches the case specifically, before resorting to an image resource which matches the CMMN 1.1 xml file resource. * * <p> * Example: if the deployment contains a CMMN 1.1 xml resource called 'abc.cmmn.xml' containing only one case with key 'myCase', then this method will look for an image resources * called 'abc.myCase.png' (or .jpg, or .gif, etc.) or 'abc.png' if the previous one wasn't found. * * <p> * Example 2: if the deployment contains a CMMN 1.1 xml resource called 'abc.cmmn.xml' containing three cases (with keys a, b and c), then this method will first look for an image resource * called 'abc.a.png' before looking for 'abc.png' (likewise for b and c). Note that if abc.a.png, abc.b.png and abc.c.png don't exist, all cases will have the same image: abc.png. * * @return name of an existing resource, or null if no matching image resource is found in the resources. */ public static String getCaseDiagramResourceNameFromDeployment( CaseDefinitionEntity caseDefinition, Map<String, EngineResource> resources) { if (StringUtils.isEmpty(caseDefinition.getResourceName())) {
throw new IllegalStateException("Provided case definition must have its resource name set."); } String cmmnResourceBase = stripCmmnFileSuffix(caseDefinition.getResourceName()); String key = caseDefinition.getKey(); for (String diagramSuffix : DIAGRAM_SUFFIXES) { String possibleName = cmmnResourceBase + key + "." + diagramSuffix; if (resources.containsKey(possibleName)) { return possibleName; } possibleName = cmmnResourceBase + diagramSuffix; if (resources.containsKey(possibleName)) { return possibleName; } } return null; } }
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\deployer\ResourceNameUtil.java
1
请完成以下Java代码
public static DeviceProfileCacheKey forName(TenantId tenantId, String name) { return new DeviceProfileCacheKey(tenantId, name, null, false, null); } public static DeviceProfileCacheKey forId(DeviceProfileId id) { return new DeviceProfileCacheKey(null, null, id, false, null); } public static DeviceProfileCacheKey forDefaultProfile(TenantId tenantId) { return new DeviceProfileCacheKey(tenantId, null, null, true, null); } public static DeviceProfileCacheKey forProvisionKey(String provisionDeviceKey) { return new DeviceProfileCacheKey(null, null, null, false, provisionDeviceKey); } /** * IMPORTANT: Method toString() has to return unique value, if you add additional field to this class, please also refactor toString(). */ @Override
public String toString() { if (deviceProfileId != null) { return deviceProfileId.toString(); } else if (defaultProfile) { return tenantId.toString(); } else if (StringUtils.isNotEmpty(provisionDeviceKey)) { return provisionDeviceKey; } return tenantId + "_" + name; } @Override public boolean isVersioned() { return deviceProfileId != null; } }
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\device\DeviceProfileCacheKey.java
1
请完成以下Java代码
public final Set<Integer> getSelectedInvoiceCandidateIds() { final Set<Integer> invoiceCandidateIds = new HashSet<>(); for (final IInvoiceCandidateRow row : getRowsSelected()) { final int invoiceCandidateId = row.getC_Invoice_Candidate_ID(); if (invoiceCandidateId <= 0) { continue; } invoiceCandidateIds.add(invoiceCandidateId); } return invoiceCandidateIds; } public final void selectRowsByInvoiceCandidateIds(final Collection<Integer> invoiceCandidateIds) { if (invoiceCandidateIds == null || invoiceCandidateIds.isEmpty()) { return; } final List<IInvoiceCandidateRow> rowsChanged = new ArrayList<>(); for (final IInvoiceCandidateRow row : getRowsInnerList()) { // Skip if already selected if (row.isSelected()) { continue; } if (invoiceCandidateIds.contains(row.getC_Invoice_Candidate_ID())) { row.setSelected(true); rowsChanged.add(row); } } fireTableRowsUpdated(rowsChanged); } /** @return latest {@link IInvoiceCandidateRow#getDocumentDate()} of selected rows */ public final Date getLatestDocumentDateOfSelectedRows() { Date latestDocumentDate = null; for (final IInvoiceCandidateRow row : getRowsSelected()) { final Date documentDate = row.getDocumentDate(); latestDocumentDate = TimeUtil.max(latestDocumentDate, documentDate); }
return latestDocumentDate; } /** * @return latest {@link IInvoiceCandidateRow#getDateAcct()} of selected rows */ public final Date getLatestDateAcctOfSelectedRows() { Date latestDateAcct = null; for (final IInvoiceCandidateRow row : getRowsSelected()) { final Date dateAcct = row.getDateAcct(); latestDateAcct = TimeUtil.max(latestDateAcct, dateAcct); } return latestDateAcct; } public final BigDecimal getTotalNetAmtToInvoiceOfSelectedRows() { BigDecimal totalNetAmtToInvoiced = BigDecimal.ZERO; for (final IInvoiceCandidateRow row : getRowsSelected()) { final BigDecimal netAmtToInvoice = row.getNetAmtToInvoice(); totalNetAmtToInvoiced = totalNetAmtToInvoiced.add(netAmtToInvoice); } return totalNetAmtToInvoiced; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.swingui\src\main\java\de\metas\banking\payment\paymentallocation\model\InvoiceCandidatesTableModel.java
1
请完成以下Java代码
public int getId() { return id; } public void setId(final int id) { this.id = id; } public String getName() { return name; } public void setName(final String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(final String email) { this.email = email; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public int getAge() { return age; } public void setAge(final int age) { this.age = age; } public LocalDate getCreationDate() { return creationDate; } public LocalDate getLastLoginDate() { return lastLoginDate; } public void setLastLoginDate(LocalDate lastLoginDate) { this.lastLoginDate = lastLoginDate; } public boolean isActive() {
return active; } public void setActive(boolean active) { this.active = active; } @Override public String toString() { return "User [name=" + name + ", id=" + id + "]"; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; User user = (User) o; return id == user.id && age == user.age && Objects.equals(name, user.name) && Objects.equals(creationDate, user.creationDate) && Objects.equals(email, user.email) && Objects.equals(status, user.status); } @Override public int hashCode() { return Objects.hash(id, name, creationDate, age, email, status); } }
repos\tutorials-master\persistence-modules\spring-data-jpa-simple\src\main\java\com\baeldung\jpa\query\model\User.java
1
请在Spring Boot框架中完成以下Java代码
public class WxCityNo { /** * @author: * @date:2018/8/30 * @description:从txt文件读取List<String> */ public static List getList() { List strList = new ArrayList(); InputStreamReader read = null; BufferedReader reader = null; try { read = new InputStreamReader(new ClassPathResource("WxCityNo.txt").getInputStream(), "utf-8"); reader = new BufferedReader(read); String line; while ((line = reader.readLine()) != null) { Map<String, String> strMap = new HashMap<>(); strMap.put("name", line.substring(0, line.indexOf("="))); strMap.put("desc", line.substring(line.indexOf("=") + 1)); strList.add(strMap); } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (read != null) { try { read.close(); } catch (IOException e) { e.printStackTrace(); } } if (reader != null) {
try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } } return strList; } public static String getCityNameByNo(String cityNo) { List list = getList(); String cityName = null; for (int i = 0; i < list.size(); i++) { Map map = (HashMap) list.get(i); if (cityNo.equals(map.get("name"))) { cityName = (String) map.get("desc"); } } return cityName; } }
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\banklink\utils\weixin\WxCityNo.java
2
请在Spring Boot框架中完成以下Java代码
public String getId() { return this.id; } @Override public String getName() { return this.name; } @Override public MessageInstance sendFor(MessageInstance message, Operation operation, ConcurrentMap<QName, URL> overridenEndpointAddresses) throws Exception { Object[] inArguments = this.getInArguments(message); Object[] outArguments = this.getOutArguments(operation); // For each out parameters, a value 'null' must be set in arguments passed to the Apache CXF API to invoke // web-service operation Object[] arguments = new Object[inArguments.length + outArguments.length]; System.arraycopy(inArguments, 0, arguments, 0, inArguments.length); Object[] results = this.safeSend(arguments, overridenEndpointAddresses); return this.createResponseMessage(results, operation); } private Object[] getInArguments(MessageInstance message) { return message.getStructureInstance().toArray(); } private Object[] getOutArguments(Operation operation) { MessageDefinition outMessage = operation.getOutMessage(); if (outMessage != null) { return outMessage.createInstance().getStructureInstance().toArray(); } else { return new Object[] {}; }
} private Object[] safeSend(Object[] arguments, ConcurrentMap<QName, URL> overridenEndpointAddresses) throws Exception { Object[] results = null; results = this.service.getClient().send(this.name, arguments, overridenEndpointAddresses); if (results == null) { results = new Object[] {}; } return results; } private MessageInstance createResponseMessage(Object[] results, Operation operation) { MessageInstance message = null; MessageDefinition outMessage = operation.getOutMessage(); if (outMessage != null) { message = outMessage.createInstance(); message.getStructureInstance().loadFrom(results); } return message; } public WSService getService() { return this.service; } }
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\webservice\WSOperation.java
2
请完成以下Java代码
protected void onApplicationEnvironmentPreparedEvent( @NonNull ApplicationEnvironmentPreparedEvent environmentPreparedEvent) { Assert.notNull(environmentPreparedEvent, "ApplicationEnvironmentPreparedEvent must not be null"); Environment environment = environmentPreparedEvent.getEnvironment(); if (isSystemPropertyNotSet(SPRING_BOOT_DATA_GEMFIRE_LOG_LEVEL_PROPERTY)) { String logLevel = environment.getProperty(SPRING_BOOT_DATA_GEMFIRE_LOG_LEVEL_PROPERTY, environment.getProperty(SPRING_DATA_GEMFIRE_LOGGING_LOG_LEVEL, environment.getProperty(SPRING_DATA_GEMFIRE_CACHE_LOG_LEVEL))); setSystemProperty(SPRING_BOOT_DATA_GEMFIRE_LOG_LEVEL_PROPERTY, logLevel); } } protected boolean isSystemPropertySet(@Nullable String propertyName) { return StringUtils.hasText(propertyName) && StringUtils.hasText(System.getProperty(propertyName)); } protected boolean isSystemPropertyNotSet(@Nullable String propertyName) { return !isSystemPropertySet(propertyName); } protected void setSystemProperty(@NonNull String propertyName, @Nullable String propertyValue) { Assert.hasText(propertyName, () -> String.format("PropertyName [%s] is required", propertyName));
if (StringUtils.hasText(propertyValue)) { System.setProperty(propertyName, propertyValue); } } @Override public boolean supportsEventType(@NonNull ResolvableType eventType) { Class<?> rawType = eventType.getRawClass(); return rawType != null && Arrays.stream(EVENT_TYPES).anyMatch(it -> it.isAssignableFrom(rawType)); } @Override public boolean supportsSourceType(@Nullable Class<?> sourceType) { return sourceType != null && Arrays.stream(SOURCE_TYPES).anyMatch(it -> it.isAssignableFrom(sourceType)); } }
repos\spring-boot-data-geode-main\spring-geode-project\spring-geode\src\main\java\org\springframework\geode\context\logging\GeodeLoggingApplicationListener.java
1
请完成以下Java代码
public OidcUserInfo apply(OidcUserInfoAuthenticationContext authenticationContext) { OAuth2Authorization authorization = authenticationContext.getAuthorization(); OidcIdToken idToken = authorization.getToken(OidcIdToken.class).getToken(); OAuth2AccessToken accessToken = authenticationContext.getAccessToken(); Map<String, Object> scopeRequestedClaims = getClaimsRequestedByScope(idToken.getClaims(), accessToken.getScopes()); return new OidcUserInfo(scopeRequestedClaims); } private static Map<String, Object> getClaimsRequestedByScope(Map<String, Object> claims, Set<String> requestedScopes) { Set<String> scopeRequestedClaimNames = new HashSet<>(32); scopeRequestedClaimNames.add(StandardClaimNames.SUB); if (requestedScopes.contains(OidcScopes.ADDRESS)) { scopeRequestedClaimNames.add(StandardClaimNames.ADDRESS); } if (requestedScopes.contains(OidcScopes.EMAIL)) {
scopeRequestedClaimNames.addAll(EMAIL_CLAIMS); } if (requestedScopes.contains(OidcScopes.PHONE)) { scopeRequestedClaimNames.addAll(PHONE_CLAIMS); } if (requestedScopes.contains(OidcScopes.PROFILE)) { scopeRequestedClaimNames.addAll(PROFILE_CLAIMS); } Map<String, Object> requestedClaims = new HashMap<>(claims); requestedClaims.keySet().removeIf((claimName) -> !scopeRequestedClaimNames.contains(claimName)); return requestedClaims; } } }
repos\spring-security-main\oauth2\oauth2-authorization-server\src\main\java\org\springframework\security\oauth2\server\authorization\oidc\authentication\OidcUserInfoAuthenticationProvider.java
1
请完成以下Java代码
public XMLGregorianCalendar getCaseDate() { return caseDate; } /** * Sets the value of the caseDate property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setCaseDate(XMLGregorianCalendar value) { this.caseDate = value; } /** * Gets the value of the contractNumber property. * * @return * possible object is * {@link String } * */ public String getContractNumber() { return contractNumber; } /** * Sets the value of the contractNumber property. * * @param value * allowed object is * {@link String } * */ public void setContractNumber(String value) { this.contractNumber = value; } /** * Gets the value of the ssn property. * * @return * possible object is * {@link String } *
*/ public String getSsn() { return ssn; } /** * Sets the value of the ssn property. * * @param value * allowed object is * {@link String } * */ public void setSsn(String value) { this.ssn = value; } /** * Gets the value of the nif property. * * @return * possible object is * {@link String } * */ public String getNif() { return nif; } /** * Sets the value of the nif property. * * @param value * allowed object is * {@link String } * */ public void setNif(String value) { this.nif = value; } }
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_440_request\src\main\java-xjc\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_440\request\IvgLawType.java
1
请完成以下Java代码
public void onImport(IImportProcess<?> process, Object importModel, Object targetModel, int timing) { if (timing != IImportInterceptor.TIMING_AFTER_IMPORT) { return; } final I_I_Product iproduct = InterfaceWrapperHelper.create(importModel, I_I_Product.class); if (isPharmaProductImport(iproduct)) { final I_M_Product product = InterfaceWrapperHelper.create(targetModel, I_M_Product.class); onPharmaProductImported(iproduct, product); } } private boolean isPharmaProductImport(final I_I_Product iproduct) { return !Check.isEmpty(iproduct.getPharmaProductCategory_Name(), true); } private void onPharmaProductImported(@NonNull final I_I_Product iproduct, @NonNull final I_M_Product product ) { product.setIsPrescription(iproduct.isPrescription()); product.setIsNarcotic(iproduct.isNarcotic()); product.setIsColdChain(iproduct.isColdChain()); product.setIsTFG(iproduct.isTFG()); if (!Check.isEmpty(iproduct.getFAM_ZUB(), true)) { product.setFAM_ZUB(iproduct.getFAM_ZUB()); } if (iproduct.getM_DosageForm_ID() > 0) { product.setM_DosageForm_ID(iproduct.getM_DosageForm_ID()); } if (iproduct.getM_Indication_ID() > 0) { product.setM_Indication_ID(iproduct.getM_Indication_ID()); } if (iproduct.getM_PharmaProductCategory_ID() > 0) { product.setM_PharmaProductCategory_ID(iproduct.getM_PharmaProductCategory_ID()); } save(product); importPrices(iproduct); } private void importPrices(@NonNull final I_I_Product importRecord) { createAPU(importRecord); createAEP(importRecord); } private void createAPU(@NonNull final I_I_Product importRecord) { final TaxCategoryQuery query = TaxCategoryQuery.builder() .type(VATType.RegularVAT)
.countryId(Services.get(ICountryDAO.class).getDefaultCountryId()) .build(); final ProductPriceCreateRequest request = ProductPriceCreateRequest.builder() .price(importRecord.getA01APU()) .priceListId(importRecord.getAPU_Price_List_ID()) .productId(importRecord.getM_Product_ID()) .validDate(firstDayYear) .taxCategoryId(taxDAO.findTaxCategoryId(query)) .build(); final ProductPriceImporter command = new ProductPriceImporter(request); command.createProductPrice_And_PriceListVersionIfNeeded(); } private void createAEP(@NonNull final I_I_Product importRecord) { final TaxCategoryQuery query = TaxCategoryQuery.builder() .type(VATType.RegularVAT) .countryId(Services.get(ICountryDAO.class).getDefaultCountryId()) .build(); final ProductPriceCreateRequest request = ProductPriceCreateRequest.builder() .price(importRecord.getA01AEP()) .priceListId(importRecord.getAEP_Price_List_ID()) .productId(importRecord.getM_Product_ID()) .validDate(firstDayYear) .taxCategoryId(taxDAO.findTaxCategoryId(query)) .build(); final ProductPriceImporter command = new ProductPriceImporter(request); command.createProductPrice_And_PriceListVersionIfNeeded(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma\src\main\java\de\metas\impexp\product\PharmaImportProductInterceptor.java
1
请完成以下Java代码
public class AD_Role_GrantPermission extends JavaProcess { private int p_AD_Role_PermRequest_ID = -1; private Boolean p_IsReadWrite = null; @Override protected void prepare() { for (ProcessInfoParameter para : getParametersAsArray()) { String name = para.getParameterName(); if (para.getParameter() == null) ; else if (name.equals("IsReadWrite")) p_IsReadWrite = para.getParameter() == null ? null : "Y".equals(para.getParameter()); } if (getTable_ID() == MRolePermRequest.Table_ID) { p_AD_Role_PermRequest_ID = getRecord_ID(); } } @Override protected String doIt() throws Exception { if (p_AD_Role_PermRequest_ID <= 0)
throw new FillMandatoryException(MRolePermRequest.COLUMNNAME_AD_Role_PermRequest_ID); // final MRolePermRequest req = new MRolePermRequest(getCtx(), p_AD_Role_PermRequest_ID, get_TrxName()); if (p_IsReadWrite != null) { req.setIsReadWrite(p_IsReadWrite); } RolePermGrandAccess.grantAccess(req); req.saveEx(); return "Ok"; } @Override protected void postProcess(boolean success) { if (success) { Services.get(IUserRolePermissionsDAO.class).resetCacheAfterTrxCommit(); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\org\adempiere\process\AD_Role_GrantPermission.java
1
请完成以下Java代码
public int getC_UOM_ID() { return Services.get(IProductBL.class).getStockUOMId(getM_Product_ID()).getRepoId(); } @Override public void setC_UOM_ID(final int uomId) { throw new UnsupportedOperationException(); } @Override public void setC_BPartner_ID(final int partnerId) { throw new UnsupportedOperationException(); } @Override
public int getC_BPartner_ID() { final KeyNamePair bpartnerKNP = infoWindow.getValue(rowIndexModel, IHUPackingAware.COLUMNNAME_C_BPartner_ID); return bpartnerKNP != null ? bpartnerKNP.getKey() : -1; } @Override public boolean isInDispute() { // there is no InDispute flag to be considered return false; } @Override public void setInDispute(final boolean inDispute) { throw new UnsupportedOperationException(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\adempiere\gui\search\impl\HUPackingAwareInfoWindowAdapter.java
1
请在Spring Boot框架中完成以下Java代码
public class CustomSecurityConfig { @Autowired @Qualifier("customAuthenticationEntryPoint") AuthenticationEntryPoint authEntryPoint; @Bean public UserDetailsService userDetailsService() { UserDetails admin = User.withUsername("admin") .password("password") .roles("ADMIN") .build(); InMemoryUserDetailsManager userDetailsManager = new InMemoryUserDetailsManager(); userDetailsManager.createUser(admin); return userDetailsManager;
} @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { http.authorizeHttpRequests(auth -> auth .requestMatchers("/login") .authenticated() .anyRequest() .hasRole("ADMIN")) .httpBasic(basic -> basic.authenticationEntryPoint(authEntryPoint)) .exceptionHandling(Customizer.withDefaults()); return http.build(); } }
repos\tutorials-master\spring-security-modules\spring-security-core-2\src\main\java\com\baeldung\global\exceptionhandler\security\CustomSecurityConfig.java
2
请完成以下Java代码
class SpringBootExceptionHandler implements UncaughtExceptionHandler { private static final Set<String> LOG_CONFIGURATION_MESSAGES; static { Set<String> messages = new HashSet<>(); messages.add("Logback configuration error detected"); LOG_CONFIGURATION_MESSAGES = Collections.unmodifiableSet(messages); } private static final LoggedExceptionHandlerThreadLocal handler = new LoggedExceptionHandlerThreadLocal(); private final @Nullable UncaughtExceptionHandler parent; private final List<Throwable> loggedExceptions = new ArrayList<>(); private int exitCode; SpringBootExceptionHandler(@Nullable UncaughtExceptionHandler parent) { this.parent = parent; } void registerLoggedException(Throwable exception) { this.loggedExceptions.add(exception); } void registerExitCode(int exitCode) { this.exitCode = exitCode; } @Override public void uncaughtException(Thread thread, Throwable ex) { try { if (isPassedToParent(ex) && this.parent != null) { this.parent.uncaughtException(thread, ex); } } finally { this.loggedExceptions.clear(); if (this.exitCode != 0) { System.exit(this.exitCode); } } } private boolean isPassedToParent(Throwable ex) { return isLogConfigurationMessage(ex) || !isRegistered(ex); } /** * Check if the exception is a log configuration message, i.e. the log call might not * have actually output anything. * @param ex the source exception * @return {@code true} if the exception contains a log configuration message */ private boolean isLogConfigurationMessage(@Nullable Throwable ex) {
if (ex == null) { return false; } if (ex instanceof InvocationTargetException) { return isLogConfigurationMessage(ex.getCause()); } String message = ex.getMessage(); if (message != null) { for (String candidate : LOG_CONFIGURATION_MESSAGES) { if (message.contains(candidate)) { return true; } } } return false; } private boolean isRegistered(@Nullable Throwable ex) { if (ex == null) { return false; } if (this.loggedExceptions.contains(ex)) { return true; } if (ex instanceof InvocationTargetException) { return isRegistered(ex.getCause()); } return false; } static SpringBootExceptionHandler forCurrentThread() { return handler.get(); } /** * Thread local used to attach and track handlers. */ private static final class LoggedExceptionHandlerThreadLocal extends ThreadLocal<SpringBootExceptionHandler> { @Override protected SpringBootExceptionHandler initialValue() { SpringBootExceptionHandler handler = new SpringBootExceptionHandler( Thread.currentThread().getUncaughtExceptionHandler()); Thread.currentThread().setUncaughtExceptionHandler(handler); return handler; } } }
repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\SpringBootExceptionHandler.java
1
请完成以下Java代码
public boolean isIgnoreInvoiceSchedule() { return params.getParameterAsBool(PARA_IgnoreInvoiceSchedule); } @Override public boolean isUpdateLocationAndContactForInvoice() { return params.getParameterAsBool(PARA_IsUpdateLocationAndContactForInvoice); } @Override public LocalDate getDateInvoiced() { return params.getParameterAsLocalDate(PARA_DateInvoiced); } @Override public LocalDate getDateAcct() { return params.getParameterAsLocalDate(PARA_DateAcct); } @Override public String getPOReference() { return params.getParameterAsString(PARA_POReference); } @Override public BigDecimal getCheck_NetAmtToInvoice() { return params.getParameterAsBigDecimal(PARA_Check_NetAmtToInvoice); } /** * Always returns {@code false}.
*/ @Override public boolean isAssumeOneInvoice() { return false; } @Override public boolean isCompleteInvoices() { return params.getParameterAsBoolean(PARA_IsCompleteInvoices, true /*true for backwards-compatibility*/); } /** * Always returns {@code false}. */ @Override public boolean isStoreInvoicesInResult() { return false; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\api\impl\InvoicingParams.java
1
请完成以下Java代码
public void submitTaskFormData(String taskId, Map<String, String> properties) { submitTaskForm(taskId, (Map) properties); } public void submitTaskForm(String taskId, Map<String, Object> properties) { commandExecutor.execute(new SubmitTaskFormCmd(taskId, properties, false, false)); } public VariableMap submitTaskFormWithVariablesInReturn(String taskId, Map<String, Object> properties, boolean deserializeValues) { return commandExecutor.execute(new SubmitTaskFormCmd(taskId, properties, true, deserializeValues)); } public String getStartFormKey(String processDefinitionId) { return commandExecutor.execute(new GetFormKeyCmd(processDefinitionId)); } public String getTaskFormKey(String processDefinitionId, String taskDefinitionKey) { return commandExecutor.execute(new GetFormKeyCmd(processDefinitionId, taskDefinitionKey)); } public VariableMap getStartFormVariables(String processDefinitionId) { return getStartFormVariables(processDefinitionId, null, true); } public VariableMap getStartFormVariables(String processDefinitionId, Collection<String> formVariables, boolean deserializeObjectValues) { return commandExecutor.execute(new GetStartFormVariablesCmd(processDefinitionId, formVariables, deserializeObjectValues)); } public VariableMap getTaskFormVariables(String taskId) { return getTaskFormVariables(taskId, null, true);
} public VariableMap getTaskFormVariables(String taskId, Collection<String> formVariables, boolean deserializeObjectValues) { return commandExecutor.execute(new GetTaskFormVariablesCmd(taskId, formVariables, deserializeObjectValues)); } public InputStream getDeployedStartForm(String processDefinitionId) { return commandExecutor.execute(new GetDeployedStartFormCmd(processDefinitionId)); } public InputStream getDeployedTaskForm(String taskId) { return commandExecutor.execute(new GetDeployedTaskFormCmd(taskId)); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\FormServiceImpl.java
1
请在Spring Boot框架中完成以下Java代码
public WFProcess setUserConfirmation( @NonNull final UserId invokerId, @NonNull final WFProcessId wfProcessId, @NonNull final WFActivityId wfActivityId) { return processWFActivity( invokerId, wfProcessId, wfActivityId, this::setUserConfirmation0); } private WFProcess setUserConfirmation0( @NonNull final WFProcess wfProcess, @NonNull final WFActivity wfActivity) { return wfActivityHandlersRegistry .getFeature(wfActivity.getWfActivityType(), UserConfirmationSupport.class) .userConfirmed(UserConfirmationRequest.builder() .wfProcess(wfProcess) .wfActivity(wfActivity) .build()); } private WFProcess processWFActivity( @NonNull final UserId invokerId, @NonNull final WFProcessId wfProcessId, @NonNull final WFActivityId wfActivityId, @NonNull final BiFunction<WFProcess, WFActivity, WFProcess> processor) { return changeWFProcessById( wfProcessId, wfProcess -> { wfProcess.assertHasAccess(invokerId); final WFActivity wfActivity = wfProcess.getActivityById(wfActivityId);
WFProcess wfProcessChanged = processor.apply(wfProcess, wfActivity); if (!Objects.equals(wfProcess, wfProcessChanged)) { wfProcessChanged = withUpdatedActivityStatuses(wfProcessChanged); } return wfProcessChanged; }); } private WFProcess withUpdatedActivityStatuses(@NonNull final WFProcess wfProcess) { WFProcess wfProcessChanged = wfProcess; for (final WFActivity wfActivity : wfProcess.getActivities()) { final WFActivityStatus newActivityStatus = wfActivityHandlersRegistry .getHandler(wfActivity.getWfActivityType()) .computeActivityState(wfProcessChanged, wfActivity); wfProcessChanged = wfProcessChanged.withChangedActivityStatus(wfActivity.getId(), newActivityStatus); } return wfProcessChanged; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.workflow.rest-api\src\main\java\de\metas\workflow\rest_api\service\WorkflowRestAPIService.java
2
请在Spring Boot框架中完成以下Java代码
public class SpringTransactionProvider implements TransactionProvider { // Based on the jOOQ-spring-example from https://github.com/jOOQ/jOOQ private final PlatformTransactionManager transactionManager; public SpringTransactionProvider(PlatformTransactionManager transactionManager) { this.transactionManager = transactionManager; } @Override public void begin(TransactionContext context) { TransactionDefinition definition = new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_NESTED); TransactionStatus status = this.transactionManager.getTransaction(definition); context.transaction(new SpringTransaction(status)); }
@Override public void commit(TransactionContext ctx) { this.transactionManager.commit(getTransactionStatus(ctx)); } @Override public void rollback(TransactionContext ctx) { this.transactionManager.rollback(getTransactionStatus(ctx)); } private TransactionStatus getTransactionStatus(TransactionContext ctx) { SpringTransaction transaction = (SpringTransaction) ctx.transaction(); Assert.state(transaction != null, "'transaction' must not be null"); return transaction.getTxStatus(); } }
repos\spring-boot-4.0.1\module\spring-boot-jooq\src\main\java\org\springframework\boot\jooq\autoconfigure\SpringTransactionProvider.java
2
请在Spring Boot框架中完成以下Java代码
public JsonDailyReport getDailyReport(@PathVariable("date") @NonNull final String dateStr) { final LocalDate date = LocalDate.parse(dateStr); return getDailyReport(date); } private JsonDailyReport getDailyReport(@NonNull final LocalDate date) { return JsonDailyReportProducer.builder() .productSuppliesService(productSuppliesService) .user(loginService.getLoggedInUser()) .locale(loginService.getLocale()) .date(date) .build() .execute(); } @PostMapping public JsonDailyReport postDailyReport(@RequestBody @NonNull final JsonDailyReportRequest request) { final JsonDailyReportItemRequest requestItem = extractRequestItem(request); final User user = loginService.getLoggedInUser(); final BPartner bpartner = user.getBpartner(); final Contracts contracts = contractsService.getContracts(bpartner); final LocalDate date = requestItem.getDate(); final long productId = Long.parseLong(requestItem.getProductId()); final Product product = productSuppliesService.getProductById(productId); final ContractLine contractLine = contracts.getContractLineOrNull(product, date); final BigDecimal qty = requestItem.getQty(); productSuppliesService.reportSupply(IProductSuppliesService.ReportDailySupplyRequest.builder() .bpartner(bpartner) .contractLine(contractLine) .productId(productId) .date(date) .qty(qty)
.build()); return getDailyReport(date) .withCountUnconfirmed(userConfirmationService.getCountUnconfirmed(user)); } private static JsonDailyReportItemRequest extractRequestItem(final JsonDailyReportRequest request) { final List<JsonDailyReportItemRequest> requestItems = request.getItems(); if (requestItems.isEmpty()) { throw new BadRequestException("No request items mentioned"); } else if (requestItems.size() != 1) { throw new BadRequestException("Only one item is allowed"); } else { return requestItems.get(0); } } }
repos\metasfresh-new_dawn_uat\misc\services\procurement-webui\procurement-webui-backend\src\main\java\de\metas\procurement\webui\rest\dailyReport\DailyReportRestController.java
2
请完成以下Java代码
public static class Index { /** * 分片数量 */ private Integer numberOfShards = 3; /** * 副本数量 */ private Integer numberOfReplicas = 2; } /** * 认证账户 */
@Data public static class Account { /** * 认证用户 */ private String username; /** * 认证密码 */ private String password; } }
repos\spring-boot-demo-master\demo-elasticsearch-rest-high-level-client\src\main\java\com\xkcoding\elasticsearch\config\ElasticsearchProperties.java
1
请在Spring Boot框架中完成以下Java代码
public String getPACKAGINGUNIT() { return packagingunit; } /** * Sets the value of the packagingunit property. * * @param value * allowed object is * {@link String } * */ public void setPACKAGINGUNIT(String value) { this.packagingunit = value; } /** * Gets the value of the packagingunitcode property. * * @return * possible object is * {@link String } * */ public String getPACKAGINGUNITCODE() { return packagingunitcode; } /** * Sets the value of the packagingunitcode property. * * @param value * allowed object is * {@link String } * */ public void setPACKAGINGUNITCODE(String value) { this.packagingunitcode = value; } /** * Gets the value of the pmesu1 property. * * @return * possible object is * {@link PMESU1 } * */ public PMESU1 getPMESU1() { return pmesu1; } /** * Sets the value of the pmesu1 property. * * @param value * allowed object is * {@link PMESU1 } * */ public void setPMESU1(PMESU1 value) { this.pmesu1 = value; } /** * Gets the value of the phand1 property. * * @return * possible object is * {@link PHAND1 }
* */ public PHAND1 getPHAND1() { return phand1; } /** * Sets the value of the phand1 property. * * @param value * allowed object is * {@link PHAND1 } * */ public void setPHAND1(PHAND1 value) { this.phand1 = value; } /** * Gets the value of the detail property. * * @return * possible object is * {@link DETAILXbest } * */ public DETAILXbest getDETAIL() { return detail; } /** * Sets the value of the detail property. * * @param value * allowed object is * {@link DETAILXbest } * */ public void setDETAIL(DETAILXbest value) { this.detail = value; } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_stepcom_orders\de\metas\edi\esb\jaxb\stepcom\orders\PPACK1.java
2
请完成以下Java代码
public final class Constraints { public static Builder builder() { return new Builder(); } private final ImmutableMap<Class<? extends Constraint>, Constraint> constraints; private Constraints(final Builder builder) { constraints = builder.getConstraints(); } @Override public String toString() { // NOTE: we are making it translatable friendly because it's displayed in Prefereces->Info->Rollen final String constraintsName = getClass().getSimpleName(); final Collection<Constraint> constraintsList = constraints.values(); final StringBuilder sb = new StringBuilder(); sb.append(constraintsName).append(": "); if (constraintsList.isEmpty()) { sb.append("@None@"); } else { sb.append(Env.NL); } Joiner.on(Env.NL) .skipNulls() .appendTo(sb, constraintsList); return sb.toString(); } public <T extends Constraint> Optional<T> getConstraint(final Class<T> constraintType) { @SuppressWarnings("unchecked") final T constraint = (T)constraints.get(constraintType); return Optional.ofNullable(constraint); } public static final class Builder { private final LinkedHashMap<Class<? extends Constraint>, Constraint> constraints = new LinkedHashMap<>();
private Builder() { super(); } public Constraints build() { return new Constraints(this); } private ImmutableMap<Class<? extends Constraint>, Constraint> getConstraints() { return ImmutableMap.copyOf(constraints); } public Builder addConstraint(final Constraint constraint) { Check.assumeNotNull(constraint, "constraint not null"); constraints.put(constraint.getClass(), constraint); return this; } public Builder addConstraintIfNotEquals(final Constraint constraint, final Constraint constraintToExclude) { Check.assumeNotNull(constraint, "constraint not null"); Check.assumeNotNull(constraintToExclude, "constraintToExclude not null"); if (constraint.equals(constraintToExclude)) { return this; } constraints.put(constraint.getClass(), constraint); return this; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\security\permissions\Constraints.java
1
请完成以下Java代码
public void addPart(FormPart formPart) { formParts.put(formPart.getFieldName(), formPart); } public FormPart getNamedPart(String name) { return formParts.get(name); } public Set<String> getPartNames() { return formParts.keySet(); } /** * Dto representing a part in a multipart form. * */ public static class FormPart { protected String fieldName; protected String contentType; protected String textContent; protected String fileName; protected byte[] binaryContent; public FormPart(FileItemStream stream) { fieldName = stream.getFieldName(); contentType = stream.getContentType(); binaryContent = readBinaryContent(stream); fileName = stream.getName(); if(contentType == null || contentType.contains(MediaType.TEXT_PLAIN)) { textContent = new String(binaryContent, StandardCharsets.UTF_8); } } public FormPart() { }
protected byte[] readBinaryContent(FileItemStream stream) { InputStream inputStream = getInputStream(stream); return IoUtil.readInputStream(inputStream, stream.getFieldName()); } protected InputStream getInputStream(FileItemStream stream) { try { return stream.openStream(); } catch (IOException e) { throw new RestException(Status.INTERNAL_SERVER_ERROR, e); } } public String getFieldName() { return fieldName; } public String getContentType() { return contentType; } public String getTextContent() { return textContent; } public byte[] getBinaryContent() { return binaryContent; } public String getFileName() { return fileName; } } }
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\mapper\MultipartFormData.java
1
请完成以下Java代码
public void setC_PurchaseCandidate(final de.metas.purchasecandidate.model.I_C_PurchaseCandidate C_PurchaseCandidate) { set_ValueFromPO(COLUMNNAME_C_PurchaseCandidate_ID, de.metas.purchasecandidate.model.I_C_PurchaseCandidate.class, C_PurchaseCandidate); } @Override public void setC_PurchaseCandidate_ID (final int C_PurchaseCandidate_ID) { if (C_PurchaseCandidate_ID < 1) set_ValueNoCheck (COLUMNNAME_C_PurchaseCandidate_ID, null); else set_ValueNoCheck (COLUMNNAME_C_PurchaseCandidate_ID, C_PurchaseCandidate_ID); } @Override public int getC_PurchaseCandidate_ID() { return get_ValueAsInt(COLUMNNAME_C_PurchaseCandidate_ID); } @Override public void setDateOrdered (final @Nullable java.sql.Timestamp DateOrdered) { set_Value (COLUMNNAME_DateOrdered, DateOrdered); } @Override public java.sql.Timestamp getDateOrdered() { return get_ValueAsTimestamp(COLUMNNAME_DateOrdered); } @Override public void setDatePromised (final @Nullable java.sql.Timestamp DatePromised) {
set_Value (COLUMNNAME_DatePromised, DatePromised); } @Override public java.sql.Timestamp getDatePromised() { return get_ValueAsTimestamp(COLUMNNAME_DatePromised); } @Override public void setRecord_ID (final int Record_ID) { if (Record_ID < 0) set_Value (COLUMNNAME_Record_ID, null); else set_Value (COLUMNNAME_Record_ID, Record_ID); } @Override public int getRecord_ID() { return get_ValueAsInt(COLUMNNAME_Record_ID); } @Override public void setRemotePurchaseOrderId (final @Nullable java.lang.String RemotePurchaseOrderId) { set_Value (COLUMNNAME_RemotePurchaseOrderId, RemotePurchaseOrderId); } @Override public java.lang.String getRemotePurchaseOrderId() { return get_ValueAsString(COLUMNNAME_RemotePurchaseOrderId); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.purchasecandidate.base\src\main\java-gen\de\metas\purchasecandidate\model\X_C_PurchaseCandidate_Alloc.java
1
请完成以下Java代码
public String getFormatedExpressionString() { return stringExpression.getFormatedExpressionString(); } @Override public Set<String> getParameterNames() { return stringExpression.getParameterNames(); } @Override public Set<CtxName> getParameters() { return stringExpression.getParameters(); } @Override public V evaluate(final Evaluatee ctx, final OnVariableNotFound onVariableNotFound) throws ExpressionEvaluationException { final String resultStr = stringExpression.evaluate(ctx, onVariableNotFound);
if (stringExpression.isNoResult(resultStr)) { if (onVariableNotFound == OnVariableNotFound.ReturnNoResult) // i.e. !ignoreUnparsable { return noResultValue; } // else if (onVariableNotFound == OnVariableNotFound.Fail) // no need to handle this case because we expect an exception to be already thrown else { throw new IllegalArgumentException("Unknown " + OnVariableNotFound.class + " value: " + onVariableNotFound); } } return valueConverter.convertFrom(resultStr, options); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\expression\api\impl\StringExpressionSupportTemplate.java
1
请在Spring Boot框架中完成以下Java代码
public int getVersion() { return version; } public void setDeleted(final boolean deleted) { this.deleted = deleted; } public boolean isDeleted() { return deleted; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Objects.hashCode(id); return result; } @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass())
{ return false; } final AbstractEntity other = (AbstractEntity)obj; return Objects.equals(id, other.id); } protected Date getDateCreated() { return dateCreated; } protected Date getDateUpdated() { return dateUpdated; } }
repos\metasfresh-new_dawn_uat\misc\services\procurement-webui\procurement-webui-backend\src\main\java\de\metas\procurement\webui\model\AbstractEntity.java
2
请完成以下Java代码
protected final String doIt() throws Exception { countExported = 0; countErrors = 0; retrieveValidSelectedDocuments().forEach(this::performNestedProcessInvocation); if (countExported > 0 && countErrors == 0) { return MSG_OK; } return MSG_Error + Services.get(IMsgBL.class).getMsg(getCtx(), errorMsg, new Object[] { countExported, countErrors }); } private void performNestedProcessInvocation(@NonNull final InOutId inOutId) { final StringBuilder logMessage = new StringBuilder("Export M_InOut_ID={} ==>").append(inOutId.getRepoId()); try { final ProcessExecutor processExecutor = ProcessInfo .builder() .setProcessCalledFrom(getProcessInfo().getProcessCalledFrom()) .setAD_ProcessByClassname(M_InOut_EDI_Export_JSON.class.getName()) .addParameter(PARAM_M_InOut_ID, inOutId.getRepoId()) .setRecord(I_M_InOut.Table_Name, inOutId.getRepoId()) // will be stored in the AD_Pinstance .buildAndPrepareExecution() .executeSync(); final ProcessExecutionResult result = processExecutor.getResult(); final String summary = result.getSummary(); if (MSG_OK.equals(summary)) countExported++; else countErrors++; logMessage.append("AD_PInstance_ID=").append(PInstanceId.toRepoId(processExecutor.getProcessInfo().getPinstanceId())) .append("; Summary=").append(summary); } catch (final Exception e) { final AdIssueId issueId = errorManager.createIssue(e); logMessage .append("Failed with AD_Issue_ID=").append(issueId.getRepoId()) .append("; Exception: ").append(e.getMessage());
countErrors++; } finally { addLog(logMessage.toString()); } } @NonNull private Stream<InOutId> retrieveValidSelectedDocuments() { return createSelectedInvoicesQueryBuilder() .addOnlyActiveRecordsFilter() .addEqualsFilter(org.compiere.model.I_M_InOut.COLUMNNAME_IsSOTrx, true) .addEqualsFilter(org.compiere.model.I_M_InOut.COLUMNNAME_DocStatus, I_M_InOut.DOCSTATUS_Completed) .addEqualsFilter(I_M_InOut.COLUMNNAME_IsEdiEnabled, true) .addEqualsFilter(I_M_InOut.COLUMNNAME_EDI_ExportStatus, I_EDI_Document.EDI_EXPORTSTATUS_Pending) .create() .iterateAndStreamIds(InOutId::ofRepoId); } private IQueryBuilder<I_M_InOut> createSelectedInvoicesQueryBuilder() { return queryBL .createQueryBuilder(I_M_InOut.class) .filter(getProcessInfo().getQueryFilterOrElseFalse()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.edi\src\main\java\de\metas\edi\process\export\json\M_InOut_Selection_Export_JSON.java
1
请完成以下Java代码
public class ExecutionQueryProperty implements QueryProperty { private static final long serialVersionUID = 1L; private static final Map<String, ExecutionQueryProperty> properties = new HashMap<String, ExecutionQueryProperty>(); public static final ExecutionQueryProperty PROCESS_INSTANCE_ID = new ExecutionQueryProperty("RES.ID_"); public static final ExecutionQueryProperty PROCESS_DEFINITION_KEY = new ExecutionQueryProperty( "ProcessDefinitionKey" ); public static final ExecutionQueryProperty PROCESS_DEFINITION_ID = new ExecutionQueryProperty( "ProcessDefinitionId" ); public static final ExecutionQueryProperty TENANT_ID = new ExecutionQueryProperty("RES.TENANT_ID_");
private String name; public ExecutionQueryProperty(String name) { this.name = name; properties.put(name, this); } public String getName() { return name; } public static ExecutionQueryProperty findByName(String propertyName) { return properties.get(propertyName); } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\ExecutionQueryProperty.java
1
请完成以下Java代码
public class CommandContextUtil { public static EventRegistryEngineConfiguration getEventRegistryConfiguration() { return getEventRegistryConfiguration(getCommandContext()); } public static EventRegistryEngineConfiguration getEventRegistryConfiguration(CommandContext commandContext) { if (commandContext != null) { return (EventRegistryEngineConfiguration) commandContext.getEngineConfigurations().get(EngineConfigurationConstants.KEY_EVENT_REGISTRY_CONFIG); } return null; } public static EventRepositoryService getEventRepositoryService() { return getEventRegistryConfiguration().getEventRepositoryService(); } public static DbSqlSession getDbSqlSession() { return getDbSqlSession(getCommandContext()); } public static DbSqlSession getDbSqlSession(CommandContext commandContext) { return commandContext.getSession(DbSqlSession.class); } public static EventResourceEntityManager getResourceEntityManager() { return getResourceEntityManager(getCommandContext()); } public static EventResourceEntityManager getResourceEntityManager(CommandContext commandContext) { return getEventRegistryConfiguration(commandContext).getResourceEntityManager(); } public static EventDeploymentEntityManager getDeploymentEntityManager() { return getDeploymentEntityManager(getCommandContext()); } public static EventDeploymentEntityManager getDeploymentEntityManager(CommandContext commandContext) { return getEventRegistryConfiguration(commandContext).getDeploymentEntityManager(); } public static EventDefinitionEntityManager getEventDefinitionEntityManager() { return getEventDefinitionEntityManager(getCommandContext()); }
public static EventDefinitionEntityManager getEventDefinitionEntityManager(CommandContext commandContext) { return getEventRegistryConfiguration(commandContext).getEventDefinitionEntityManager(); } public static ChannelDefinitionEntityManager getChannelDefinitionEntityManager() { return getChannelDefinitionEntityManager(getCommandContext()); } public static ChannelDefinitionEntityManager getChannelDefinitionEntityManager(CommandContext commandContext) { return getEventRegistryConfiguration(commandContext).getChannelDefinitionEntityManager(); } public static TableDataManager getTableDataManager() { return getTableDataManager(getCommandContext()); } public static TableDataManager getTableDataManager(CommandContext commandContext) { return getEventRegistryConfiguration(commandContext).getTableDataManager(); } public static CommandContext getCommandContext() { return Context.getCommandContext(); } }
repos\flowable-engine-main\modules\flowable-event-registry\src\main\java\org\flowable\eventregistry\impl\util\CommandContextUtil.java
1
请完成以下Java代码
public void setM_FreightCostDetail_ID (final int M_FreightCostDetail_ID) { if (M_FreightCostDetail_ID < 1) set_ValueNoCheck (COLUMNNAME_M_FreightCostDetail_ID, null); else set_ValueNoCheck (COLUMNNAME_M_FreightCostDetail_ID, M_FreightCostDetail_ID); } @Override public int getM_FreightCostDetail_ID() { return get_ValueAsInt(COLUMNNAME_M_FreightCostDetail_ID); } @Override public org.adempiere.model.I_M_FreightCostShipper getM_FreightCostShipper() { return get_ValueAsPO(COLUMNNAME_M_FreightCostShipper_ID, org.adempiere.model.I_M_FreightCostShipper.class); } @Override public void setM_FreightCostShipper(final org.adempiere.model.I_M_FreightCostShipper M_FreightCostShipper) { set_ValueFromPO(COLUMNNAME_M_FreightCostShipper_ID, org.adempiere.model.I_M_FreightCostShipper.class, M_FreightCostShipper); } @Override public void setM_FreightCostShipper_ID (final int M_FreightCostShipper_ID) { if (M_FreightCostShipper_ID < 1) set_ValueNoCheck (COLUMNNAME_M_FreightCostShipper_ID, null); else set_ValueNoCheck (COLUMNNAME_M_FreightCostShipper_ID, M_FreightCostShipper_ID); } @Override public int getM_FreightCostShipper_ID() {
return get_ValueAsInt(COLUMNNAME_M_FreightCostShipper_ID); } @Override public void setSeqNo (final int SeqNo) { set_Value (COLUMNNAME_SeqNo, SeqNo); } @Override public int getSeqNo() { return get_ValueAsInt(COLUMNNAME_SeqNo); } @Override public void setShipmentValueAmt (final BigDecimal ShipmentValueAmt) { set_Value (COLUMNNAME_ShipmentValueAmt, ShipmentValueAmt); } @Override public BigDecimal getShipmentValueAmt() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_ShipmentValueAmt); return bd != null ? bd : BigDecimal.ZERO; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\adempiere\model\X_M_FreightCostDetail.java
1
请在Spring Boot框架中完成以下Java代码
public Person save(Person person) { Person p = personRepository.save(person); logger.info("为id、key为:" + p.getId() + "数据做了缓存"); return p; } @Override public void remove(Long id) { logger.info("删除了id、key为" + id + "的数据缓存"); //这里不做实际删除操作 } @Override public void removeAll() { logger.info("删除了所有缓存的数据缓存"); //这里不做实际删除操作 }
@Override public Person findOne(Person person) throws Exception { Thread.sleep((long) (Math.random() * 500), 1000); Person p = personRepository.findOne(Example.of(person)); logger.info("为id、key为: {} 数据做了缓存", p.getId()); return p; } @Override public Person findOne1(Person person) throws Exception { Thread.sleep((long) (Math.random() * 500), 1000); Person p = personRepository.findOne(Example.of(person)); logger.info("为id、key为:" + p.getId() + "数据做了缓存"); return p; } }
repos\spring-boot-student-master\spring-boot-student-websocket\src\main\java\com\xiaolyuh\service\impl\PersonServiceImpl.java
2
请完成以下Java代码
public void setM_Product_ID (int M_Product_ID) { if (M_Product_ID < 1) set_ValueNoCheck (COLUMNNAME_M_Product_ID, null); else set_ValueNoCheck (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID)); } /** Get Produkt. @return Produkt, Leistung, Artikel */ @Override public int getM_Product_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID); if (ii == null) return 0; return ii.intValue(); } /** * PMM_Trend AD_Reference_ID=540648 * Reference name: PMM_Trend */ public static final int PMM_TREND_AD_Reference_ID=540648; /** Up = U */ public static final String PMM_TREND_Up = "U"; /** Down = D */ public static final String PMM_TREND_Down = "D"; /** Same = E */ public static final String PMM_TREND_Same = "E"; /** Zero = Z */ public static final String PMM_TREND_Zero = "Z"; /** Set Trend. @param PMM_Trend Trend */ @Override public void setPMM_Trend (java.lang.String PMM_Trend) { set_Value (COLUMNNAME_PMM_Trend, PMM_Trend); } /** Get Trend. @return Trend */ @Override public java.lang.String getPMM_Trend () { return (java.lang.String)get_Value(COLUMNNAME_PMM_Trend); } /** Set Procurement Week. @param PMM_Week_ID Procurement Week */ @Override public void setPMM_Week_ID (int PMM_Week_ID) { if (PMM_Week_ID < 1) set_ValueNoCheck (COLUMNNAME_PMM_Week_ID, null); else set_ValueNoCheck (COLUMNNAME_PMM_Week_ID, Integer.valueOf(PMM_Week_ID)); } /** Get Procurement Week. @return Procurement Week */ @Override public int getPMM_Week_ID ()
{ Integer ii = (Integer)get_Value(COLUMNNAME_PMM_Week_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Verarbeitet. @param Processed Checkbox sagt aus, ob der Beleg verarbeitet wurde. */ @Override public void setProcessed (boolean Processed) { set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed)); } /** Get Verarbeitet. @return Checkbox sagt aus, ob der Beleg verarbeitet wurde. */ @Override public boolean isProcessed () { Object oo = get_Value(COLUMNNAME_Processed); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Wochenerster. @param WeekDate Wochenerster */ @Override public void setWeekDate (java.sql.Timestamp WeekDate) { set_ValueNoCheck (COLUMNNAME_WeekDate, WeekDate); } /** Get Wochenerster. @return Wochenerster */ @Override public java.sql.Timestamp getWeekDate () { return (java.sql.Timestamp)get_Value(COLUMNNAME_WeekDate); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.procurement.base\src\main\java-gen\de\metas\procurement\base\model\X_PMM_Week.java
1
请在Spring Boot框架中完成以下Java代码
public class CalledProcessDefinitionDto extends ProcessDefinitionDto { protected List<String> calledFromActivityIds; protected String callingProcessDefinitionId; public List<String> getCalledFromActivityIds() { return calledFromActivityIds; } public String getCallingProcessDefinitionId() { return callingProcessDefinitionId; } public static CalledProcessDefinitionDto from(CalledProcessDefinition definition){ CalledProcessDefinitionDto dto = new CalledProcessDefinitionDto(); dto.callingProcessDefinitionId = definition.getCallingProcessDefinitionId(); dto.calledFromActivityIds = definition.getCalledFromActivityIds(); dto.id = definition.getId(); dto.key = definition.getKey();
dto.category = definition.getCategory(); dto.description = definition.getDescription(); dto.name = definition.getName(); dto.version = definition.getVersion(); dto.resource = definition.getResourceName(); dto.deploymentId = definition.getDeploymentId(); dto.diagram = definition.getDiagramResourceName(); dto.suspended = definition.isSuspended(); dto.tenantId = definition.getTenantId(); dto.versionTag = definition.getVersionTag(); dto.historyTimeToLive = definition.getHistoryTimeToLive(); dto.isStartableInTasklist = definition.isStartableInTasklist(); return dto; } }
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\repository\CalledProcessDefinitionDto.java
2
请在Spring Boot框架中完成以下Java代码
public List<QueryVariable> getVariables() { return variables; } public void setVariables(List<QueryVariable> variables) { this.variables = variables; } 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 Boolean getWithoutCaseInstanceParentId() { return withoutCaseInstanceParentId; } public void setWithoutCaseInstanceParentId(Boolean withoutCaseInstanceParentId) { this.withoutCaseInstanceParentId = withoutCaseInstanceParentId; } public Boolean getWithoutCaseInstanceCallbackId() { return withoutCaseInstanceCallbackId; } public void setWithoutCaseInstanceCallbackId(Boolean withoutCaseInstanceCallbackId) { this.withoutCaseInstanceCallbackId = withoutCaseInstanceCallbackId; } public Set<String> getCaseInstanceCallbackIds() { return caseInstanceCallbackIds; } public void setCaseInstanceCallbackIds(Set<String> caseInstanceCallbackIds) { this.caseInstanceCallbackIds = caseInstanceCallbackIds; } }
repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\history\caze\HistoricCaseInstanceQueryRequest.java
2
请完成以下Java代码
public boolean checkFirstDownlink() { boolean result = firstEdrxDownlink; firstEdrxDownlink = false; return result; } public LwM2mPath getLwM2mPathFromString(String path) { return new LwM2mPath(fromVersionedIdToObjectId(path)); } public LwM2m.Version getDefaultObjectIDVer() { return this.defaultObjectIDVer == null ? new Version(LWM2M_OBJECT_VERSION_DEFAULT) : this.defaultObjectIDVer; } public LwM2m.Version getSupportedObjectVersion(Integer objectid) { return this.supportedClientObjects != null ? this.supportedClientObjects.get(objectid) : null; } private void setSupportedClientObjects(){ if (this.registration.getSupportedObject() != null && this.registration.getSupportedObject().size() > 0) { this.supportedClientObjects = this.registration.getSupportedObject(); } else { this.supportedClientObjects = new ConcurrentHashMap<>(); for (Link link : this.registration.getSortedObjectLinks()) { if (link instanceof MixedLwM2mLink) { LwM2mPath path = ((MixedLwM2mLink) link).getPath(); // add supported objects if (path.isObject() || path.isObjectInstance()) {
int objectId = path.getObjectId(); LwM2mAttribute<Version> versionParamValue = link.getAttributes().get(LwM2mAttributes.OBJECT_VERSION); if (versionParamValue != null) { // if there is a version attribute then use it as version for this object this.supportedClientObjects.put(objectId, versionParamValue.getValue()); } else { // there is no version attribute attached. // In this case we use the DEFAULT_VERSION only if this object stored as supported object. Version currentVersion = this.supportedClientObjects.get(objectId); if (currentVersion == null) { this.supportedClientObjects.put(objectId, getDefaultObjectIDVer()); } } } } } } } }
repos\thingsboard-master\common\transport\lwm2m\src\main\java\org\thingsboard\server\transport\lwm2m\server\client\LwM2mClient.java
1
请完成以下Java代码
public de.metas.shipper.gateway.dhl.model.I_DHL_ShipmentOrderRequest getDHL_ShipmentOrderRequest() { return get_ValueAsPO(COLUMNNAME_DHL_ShipmentOrderRequest_ID, de.metas.shipper.gateway.dhl.model.I_DHL_ShipmentOrderRequest.class); } @Override public void setDHL_ShipmentOrderRequest(final de.metas.shipper.gateway.dhl.model.I_DHL_ShipmentOrderRequest DHL_ShipmentOrderRequest) { set_ValueFromPO(COLUMNNAME_DHL_ShipmentOrderRequest_ID, de.metas.shipper.gateway.dhl.model.I_DHL_ShipmentOrderRequest.class, DHL_ShipmentOrderRequest); } @Override public void setDHL_ShipmentOrderRequest_ID (final int DHL_ShipmentOrderRequest_ID) { if (DHL_ShipmentOrderRequest_ID < 1) set_Value (COLUMNNAME_DHL_ShipmentOrderRequest_ID, null); else set_Value (COLUMNNAME_DHL_ShipmentOrderRequest_ID, DHL_ShipmentOrderRequest_ID); } @Override public int getDHL_ShipmentOrderRequest_ID() { return get_ValueAsInt(COLUMNNAME_DHL_ShipmentOrderRequest_ID); } @Override public void setDurationMillis (final int DurationMillis) { set_Value (COLUMNNAME_DurationMillis, DurationMillis); } @Override public int getDurationMillis() { return get_ValueAsInt(COLUMNNAME_DurationMillis); } @Override public void setIsError (final boolean IsError) { set_Value (COLUMNNAME_IsError, IsError); }
@Override public boolean isError() { return get_ValueAsBoolean(COLUMNNAME_IsError); } @Override public void setRequestMessage (final @Nullable java.lang.String RequestMessage) { set_Value (COLUMNNAME_RequestMessage, RequestMessage); } @Override public java.lang.String getRequestMessage() { return get_ValueAsString(COLUMNNAME_RequestMessage); } @Override public void setResponseMessage (final @Nullable java.lang.String ResponseMessage) { set_Value (COLUMNNAME_ResponseMessage, ResponseMessage); } @Override public java.lang.String getResponseMessage() { return get_ValueAsString(COLUMNNAME_ResponseMessage); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.dhl\src\main\java-gen\de\metas\shipper\gateway\dhl\model\X_Dhl_ShipmentOrder_Log.java
1
请在Spring Boot框架中完成以下Java代码
static class PathQueryRequestMatcher implements RequestMatcher { private final RequestMatcher matcher; PathQueryRequestMatcher(RequestMatcher pathMatcher, String... params) { List<RequestMatcher> matchers = new ArrayList<>(); matchers.add(pathMatcher); for (String param : params) { String[] parts = param.split("="); if (parts.length == 1) { matchers.add(new ParameterRequestMatcher(parts[0])); } else { matchers.add(new ParameterRequestMatcher(parts[0], parts[1])); } }
this.matcher = new AndRequestMatcher(matchers); } @Override public boolean matches(HttpServletRequest request) { return matcher(request).isMatch(); } @Override public MatchResult matcher(HttpServletRequest request) { return this.matcher.matcher(request); } } }
repos\spring-security-main\config\src\main\java\org\springframework\security\config\annotation\web\configurers\saml2\Saml2LoginConfigurer.java
2
请完成以下Java代码
public void setDueDate (final @Nullable java.sql.Timestamp DueDate) { set_ValueNoCheck (COLUMNNAME_DueDate, DueDate); } @Override public java.sql.Timestamp getDueDate() { return get_ValueAsTimestamp(COLUMNNAME_DueDate); } @Override public void setIsSOTrx (final @Nullable java.lang.String IsSOTrx) { set_ValueNoCheck (COLUMNNAME_IsSOTrx, IsSOTrx); } @Override public java.lang.String getIsSOTrx() { return get_ValueAsString(COLUMNNAME_IsSOTrx); } @Override public void setPOReference (final @Nullable java.lang.String POReference) { set_ValueNoCheck (COLUMNNAME_POReference, POReference); } @Override public java.lang.String getPOReference() { return get_ValueAsString(COLUMNNAME_POReference); } @Override public void setPostingType (final @Nullable java.lang.String PostingType) { set_ValueNoCheck (COLUMNNAME_PostingType, PostingType); } @Override
public java.lang.String getPostingType() { return get_ValueAsString(COLUMNNAME_PostingType); } @Override public void setTaxAmtSource (final @Nullable BigDecimal TaxAmtSource) { set_ValueNoCheck (COLUMNNAME_TaxAmtSource, TaxAmtSource); } @Override public BigDecimal getTaxAmtSource() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_TaxAmtSource); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setVATCode (final @Nullable java.lang.String VATCode) { set_ValueNoCheck (COLUMNNAME_VATCode, VATCode); } @Override public java.lang.String getVATCode() { return get_ValueAsString(COLUMNNAME_VATCode); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.datev\src\main\java-gen\de\metas\datev\model\X_DATEV_ExportLine.java
1
请完成以下Java代码
private static String formatInNibbles(String binary) { StringBuilder formattedBin = new StringBuilder(); for (int i = 1; i <= binary.length(); i++) { if (i % 4 == 0 && i != binary.length()) { formattedBin.append(binary.charAt(i - 1)).append(" "); } else { formattedBin.append(binary.charAt(i - 1)); } } return formattedBin.toString(); } private static boolean canRepresentInNBits(BigInteger number, int numBits) { BigInteger minValue = BigInteger.ONE.shiftLeft(numBits - 1).negate(); // -2^(numBits-1) BigInteger maxValue = BigInteger.ONE.shiftLeft(numBits - 1).subtract(BigInteger.ONE); // 2^(numBits-1) - 1 return number.compareTo(minValue) >= 0 && number.compareTo(maxValue) <= 0; } public static String decimalToTwosComplementBinaryUsingShortCut(BigInteger num, int numBits) { if (!canRepresentInNBits(num, numBits)) { throw new IllegalArgumentException(numBits + " bits is not enough to represent the number " + num); } var isNegative = num.signum() == -1; var absNum = num.abs(); // Convert the abs value of the number to its binary representation String binary = absNum.toString(2); // Pad the binary representation with zeros to make it numBits long while (binary.length() < numBits) { binary = "0" + binary; }
// If the input number is negative, calculate two's complement if (isNegative) { binary = performTwosComplementUsingShortCut(binary); } return formatInNibbles(binary); } private static String performTwosComplementUsingShortCut(String binary) { int firstOneIndexFromRight = binary.lastIndexOf('1'); if (firstOneIndexFromRight == -1) { return binary; } String rightPart = binary.substring(firstOneIndexFromRight); String leftPart = binary.substring(0, firstOneIndexFromRight); String leftWithOnes = leftPart.chars().mapToObj(c -> c == '0' ? '1' : '0') .map(String::valueOf).collect(Collectors.joining("")); return leftWithOnes + rightPart; } }
repos\tutorials-master\core-java-modules\core-java-numbers-7\src\main\java\com\baeldung\twoscomplement\TwosComplement.java
1
请完成以下Java代码
public List<EventDefinition> getEventDefinitions() { return eventDefinitions; } public void setEventDefinitions(List<EventDefinition> eventDefinitions) { this.eventDefinitions = eventDefinitions; } public void addEventDefinition(EventDefinition eventDefinition) { eventDefinitions.add(eventDefinition); } @Override public List<IOParameter> getInParameters() { return inParameters; } @Override public void addInParameter(IOParameter inParameter) { inParameters.add(inParameter); } @Override public void setInParameters(List<IOParameter> inParameters) { this.inParameters = inParameters; } @Override public List<IOParameter> getOutParameters() { return outParameters; } @Override public void addOutParameter(IOParameter outParameter) { this.outParameters.add(outParameter); } @Override public void setOutParameters(List<IOParameter> outParameters) { this.outParameters = outParameters; } public void setValues(Event otherEvent) { super.setValues(otherEvent);
eventDefinitions = new ArrayList<>(); if (otherEvent.getEventDefinitions() != null && !otherEvent.getEventDefinitions().isEmpty()) { for (EventDefinition eventDef : otherEvent.getEventDefinitions()) { eventDefinitions.add(eventDef.clone()); } } inParameters = new ArrayList<>(); if (otherEvent.getInParameters() != null && !otherEvent.getInParameters().isEmpty()) { for (IOParameter parameter : otherEvent.getInParameters()) { inParameters.add(parameter.clone()); } } outParameters = new ArrayList<>(); if (otherEvent.getOutParameters() != null && !otherEvent.getOutParameters().isEmpty()) { for (IOParameter parameter : otherEvent.getOutParameters()) { outParameters.add(parameter.clone()); } } } }
repos\flowable-engine-main\modules\flowable-bpmn-model\src\main\java\org\flowable\bpmn\model\Event.java
1
请完成以下Java代码
private static PerformanceMonitoringData getPerformanceMonitoringData() { if (perfMonDataTL.get() == null) { perfMonDataTL.set(new PerformanceMonitoringData()); } return perfMonDataTL.get(); } @NonNull private static ArrayList<Tag> createTags(final @NonNull Metadata metadata, final PerformanceMonitoringData perfMonData) { final ArrayList<Tag> tags = new ArrayList<>(); addTagIfNotNull("name", metadata.getClassName(), tags); addTagIfNotNull("action", metadata.getFunctionName(), tags); if (!perfMonData.isInitiator()) { addTagIfNotNull("depth", String.valueOf(perfMonData.getDepth()), tags); addTagIfNotNull("initiator", perfMonData.getInitiatorFunctionNameFQ(), tags); addTagIfNotNull("window", perfMonData.getInitiatorWindow(), tags); addTagIfNotNull("callerName", metadata.getFunctionNameFQ(), tags); addTagIfNotNull("calledBy", perfMonData.getLastCalledFunctionNameFQ(), tags); } else { for (final Entry<String, String> entry : metadata.getLabels().entrySet()) { if (PerformanceMonitoringService.VOLATILE_LABELS.contains(entry.getKey())) { // Avoid OOME: if we included e.g. the recordId, then every recordId would cause a new meter to be created. continue; } addTagIfNotNull(entry.getKey(), entry.getValue(), tags); } } return tags; }
private static void addTagIfNotNull(@Nullable final String name, @Nullable final String value, @NonNull final ArrayList<Tag> tags) { final String nameNorm = StringUtils.trimBlankToNull(name); if (nameNorm == null) { return; } final String valueNorm = StringUtils.trimBlankToNull(value); if (valueNorm == null) { return; } tags.add(Tag.of(nameNorm, valueNorm)); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.monitoring\src\main\java\de\metas\monitoring\adapter\MicrometerPerformanceMonitoringService.java
1
请完成以下Java代码
public boolean supportsParameter(MethodParameter parameter) { Class<?> parameterType = parameter.getParameterType(); return (OAuth2AuthorizedClient.class.isAssignableFrom(parameterType) && (AnnotatedElementUtils .findMergedAnnotation(parameter.getParameter(), RegisteredOAuth2AuthorizedClient.class) != null)); } @NonNull @Override public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer, NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) { String clientRegistrationId = this.resolveClientRegistrationId(parameter); if (!StringUtils.hasLength(clientRegistrationId)) { throw new IllegalArgumentException("Unable to resolve the Client Registration Identifier. " + "It must be provided via @RegisteredOAuth2AuthorizedClient(\"client1\") or " + "@RegisteredOAuth2AuthorizedClient(registrationId = \"client1\")."); } Authentication principal = this.securityContextHolderStrategy.getContext().getAuthentication(); if (principal == null) { principal = ANONYMOUS_AUTHENTICATION; } HttpServletRequest servletRequest = webRequest.getNativeRequest(HttpServletRequest.class); HttpServletResponse servletResponse = webRequest.getNativeResponse(HttpServletResponse.class); // @formatter:off OAuth2AuthorizeRequest authorizeRequest = OAuth2AuthorizeRequest .withClientRegistrationId(clientRegistrationId) .principal(principal) .attribute(HttpServletRequest.class.getName(), servletRequest) .attribute(HttpServletResponse.class.getName(), servletResponse) .build(); // @formatter:on return this.authorizedClientManager.authorize(authorizeRequest); } private String resolveClientRegistrationId(MethodParameter parameter) { RegisteredOAuth2AuthorizedClient authorizedClientAnnotation = AnnotatedElementUtils .findMergedAnnotation(parameter.getParameter(), RegisteredOAuth2AuthorizedClient.class); Authentication principal = this.securityContextHolderStrategy.getContext().getAuthentication(); if (StringUtils.hasLength(authorizedClientAnnotation.registrationId())) { return authorizedClientAnnotation.registrationId(); }
if (StringUtils.hasLength(authorizedClientAnnotation.value())) { return authorizedClientAnnotation.value(); } if (principal != null && OAuth2AuthenticationToken.class.isAssignableFrom(principal.getClass())) { return ((OAuth2AuthenticationToken) principal).getAuthorizedClientRegistrationId(); } return null; } /** * Sets the {@link SecurityContextHolderStrategy} to use. The default action is to use * the {@link SecurityContextHolderStrategy} stored in {@link SecurityContextHolder}. * * @since 5.8 */ public void setSecurityContextHolderStrategy(SecurityContextHolderStrategy securityContextHolderStrategy) { Assert.notNull(securityContextHolderStrategy, "securityContextHolderStrategy cannot be null"); this.securityContextHolderStrategy = securityContextHolderStrategy; } }
repos\spring-security-main\oauth2\oauth2-client\src\main\java\org\springframework\security\oauth2\client\web\method\annotation\OAuth2AuthorizedClientArgumentResolver.java
1
请完成以下Java代码
public EventInfo findLatestDebugRuleNodeInEvent(TenantId tenantId, EntityId entityId) { return convert(entityId.getEntityType(), eventDao.findLatestDebugRuleNodeInEvent(tenantId.getId(), entityId.getId())); } @Override public PageData<EventInfo> findEventsByFilter(TenantId tenantId, EntityId entityId, EventFilter eventFilter, TimePageLink pageLink) { return convert(entityId.getEntityType(), eventDao.findEventByFilter(tenantId.getId(), entityId.getId(), eventFilter, pageLink)); } @Override public void removeEvents(TenantId tenantId, EntityId entityId) { removeEvents(tenantId, entityId, null, null, null); } @Override public void removeEvents(TenantId tenantId, EntityId entityId, EventFilter eventFilter, Long startTime, Long endTime) { if (eventFilter == null) { eventDao.removeEvents(tenantId.getId(), entityId.getId(), startTime, endTime); } else { eventDao.removeEvents(tenantId.getId(), entityId.getId(), eventFilter, startTime, endTime); } } @Override public void cleanupEvents(long regularEventExpTs, long debugEventExpTs, boolean cleanupDb) {
eventDao.cleanupEvents(regularEventExpTs, debugEventExpTs, cleanupDb); } private PageData<EventInfo> convert(EntityType entityType, PageData<? extends Event> pd) { return new PageData<>(pd.getData() == null ? null : pd.getData().stream().map(e -> e.toInfo(entityType)).collect(Collectors.toList()) , pd.getTotalPages(), pd.getTotalElements(), pd.hasNext()); } private List<EventInfo> convert(EntityType entityType, List<? extends Event> list) { return list == null ? null : list.stream().map(e -> e.toInfo(entityType)).collect(Collectors.toList()); } private EventInfo convert(EntityType entityType, Event event) { return Optional.ofNullable(event).map(e -> e.toInfo(entityType)).orElse(null); } }
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\event\BaseEventService.java
1
请完成以下Java代码
public List<PlanItem> getEntryDependencies() { return entryDependencies; } public void setEntryDependencies(List<PlanItem> entryDependencies) { this.entryDependencies = entryDependencies; } public List<PlanItem> getExitDependencies() { return exitDependencies; } public void setExitDependencies(List<PlanItem> exitDependencies) { this.exitDependencies = exitDependencies; } public List<PlanItem> getEntryDependentPlanItems() { return entryDependentPlanItems; } public void setEntryDependentPlanItems(List<PlanItem> entryDependentPlanItems) { this.entryDependentPlanItems = entryDependentPlanItems; } public void addEntryDependentPlanItem(PlanItem planItem) { Optional<PlanItem> planItemWithSameId = entryDependentPlanItems.stream().filter(p -> p.getId().equals(planItem.getId())).findFirst(); if (!planItemWithSameId.isPresent()) { entryDependentPlanItems.add(planItem); } } public List<PlanItem> getExitDependentPlanItems() { return exitDependentPlanItems; } public void setExitDependentPlanItems(List<PlanItem> exitDependentPlanItems) { this.exitDependentPlanItems = exitDependentPlanItems; }
public void addExitDependentPlanItem(PlanItem planItem) { Optional<PlanItem> planItemWithSameId = exitDependentPlanItems.stream().filter(p -> p.getId().equals(planItem.getId())).findFirst(); if (!planItemWithSameId.isPresent()) { exitDependentPlanItems.add(planItem); } } public List<PlanItem> getAllDependentPlanItems() { List<PlanItem> allDependentPlanItems = new ArrayList<>(entryDependentPlanItems.size() + exitDependentPlanItems.size()); allDependentPlanItems.addAll(entryDependentPlanItems); allDependentPlanItems.addAll(exitDependentPlanItems); return allDependentPlanItems; } @Override public String toString() { StringBuilder stringBuilder = new StringBuilder("PlanItem"); if (getName() != null) { stringBuilder.append(" '").append(getName()).append("'"); } stringBuilder.append(" (id: "); stringBuilder.append(getId()); if (getPlanItemDefinition() != null) { stringBuilder.append(", definitionId: ").append(getPlanItemDefinition().getId()); } stringBuilder.append(")"); return stringBuilder.toString(); } }
repos\flowable-engine-main\modules\flowable-cmmn-model\src\main\java\org\flowable\cmmn\model\PlanItem.java
1
请在Spring Boot框架中完成以下Java代码
public String createUser(String name, String email) { String id = UUID.randomUUID().toString(); AddressEntity address = createAddress(); UserEntity userEntity = new UserEntity(); userEntity.setId(id); userEntity.setAddress(address); userEntity.setName(name); userEntity.setEmail(email); userEntity.setEnabled(true); addressRepository.save(address); userRepository.save(userEntity); return id; } @Override public Collection<UserEntity> getAll() { return userRepository.findAll(); }
@Transactional @Override public void deleteUser(String id) { UserEntity userEntity = new UserEntity(); userEntity.setId(id); userRepository.delete(userEntity); } private AddressEntity createAddress() { String id = UUID.randomUUID().toString(); AddressEntity addressEntity = new AddressEntity(); addressEntity.setId(id); addressEntity.setStreet("street"); addressEntity.setCity("city"); return addressEntity; } }
repos\spring-examples-java-17\spring-data\src\main\java\itx\examples\springdata\service\UserServiceImpl.java
2
请在Spring Boot框架中完成以下Java代码
public class YellowPagesService extends AbstractCacheableService { @Cacheable("YellowPages") public Person find(String name) { this.cacheMiss.set(true); Person person = Person.newPerson(name) .withEmail(EmailGenerator.generate(name, null)) .withPhoneNumber(PhoneNumberGenerator.generate(null)); simulateLatency(); return person; } @CachePut(cacheNames = "YellowPages", key = "#person.name") public Person save(Person person, String email, String phoneNumber) { if (StringUtils.hasText(email)) { person.withEmail(email);
} if (StringUtils.hasText(phoneNumber)) { person.withPhoneNumber(phoneNumber); } return person; } @CacheEvict(cacheNames = "YellowPages") public boolean evict(String name) { return true; } } // end::class[]
repos\spring-boot-data-geode-main\spring-geode-samples\caching\near\src\main\java\example\app\caching\near\client\service\YellowPagesService.java
2
请完成以下Java代码
public void writeEntityRef(String name) throws XMLStreamException { writer.writeEntityRef(name); } @Override public void writeStartDocument() throws XMLStreamException { writer.writeStartDocument(); } @Override public void writeStartDocument(String version) throws XMLStreamException { writer.writeStartDocument(version); } @Override public void writeStartDocument(String encoding, String version) throws XMLStreamException { writer.writeStartDocument(encoding, version); } @Override public void writeCharacters(String text) throws XMLStreamException { writer.writeCharacters(text); } @Override public void writeCharacters(char[] text, int start, int len) throws XMLStreamException { writer.writeCharacters(text, start, len); } @Override public String getPrefix(String uri) throws XMLStreamException { return writer.getPrefix(uri); } @Override public void setPrefix(String prefix, String uri) throws XMLStreamException { writer.setPrefix(prefix, uri); } @Override public void setDefaultNamespace(String uri) throws XMLStreamException {
writer.setDefaultNamespace(uri); } @Override public void setNamespaceContext(NamespaceContext context) throws XMLStreamException { writer.setNamespaceContext(context); } @Override public NamespaceContext getNamespaceContext() { return writer.getNamespaceContext(); } @Override public Object getProperty(String name) throws IllegalArgumentException { return writer.getProperty(name); } }
repos\flowable-engine-main\modules\flowable-bpmn-converter\src\main\java\org\flowable\bpmn\converter\DelegatingXMLStreamWriter.java
1
请完成以下Java代码
public String toString() { return MoreObjects.toStringHelper(this) .add("size", byAdMessage.size()) .toString(); } public boolean isMessageExists(AdMessageKey adMessage) { return getByAdMessage(adMessage) != null; } public Optional<AdMessageId> getIdByAdMessage(final AdMessageKey adMessage) { return Optional.ofNullable(getByAdMessage(adMessage)).map(Message::getAdMessageId); } @Nullable public Message getByAdMessage(@NonNull final String adMessage) { return getByAdMessage(AdMessageKey.of(adMessage)); } @Nullable public Message getByAdMessage(@NonNull final AdMessageKey adMessage) { return byAdMessage.get(adMessage); } public Stream<Message> stream() {return byAdMessage.values().stream();} public Map<String, String> toStringMap(final String adLanguage, final String prefix, boolean removePrefix)
{ final Function<Message, String> keyFunction; if (removePrefix) { final int beginIndex = prefix.length(); keyFunction = message -> message.getAdMessage().toAD_Message().substring(beginIndex); } else { keyFunction = message -> message.getAdMessage().toAD_Message(); } return stream() .filter(message -> message.getAdMessage().startsWith(prefix)) .collect(ImmutableMap.toImmutableMap(keyFunction, message -> message.getMsgText(adLanguage))); } public Optional<Message> getById(@NonNull final AdMessageId adMessageId) { return Optional.ofNullable(byId.get(adMessageId)); } public Optional<AdMessageKey> getAdMessageKeyById(final AdMessageId adMessageId) { return getById(adMessageId).map(Message::getAdMessage); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\i18n\MessagesMap.java
1
请完成以下Java代码
public void setAD_Role_NotificationGroup_ID (int AD_Role_NotificationGroup_ID) { if (AD_Role_NotificationGroup_ID < 1) set_ValueNoCheck (COLUMNNAME_AD_Role_NotificationGroup_ID, null); else set_ValueNoCheck (COLUMNNAME_AD_Role_NotificationGroup_ID, Integer.valueOf(AD_Role_NotificationGroup_ID)); } /** Get Role Notification Group. @return Role Notification Group */ @Override public int getAD_Role_NotificationGroup_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_AD_Role_NotificationGroup_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); } /** * NotificationType AD_Reference_ID=344 * Reference name: AD_User NotificationType */ public static final int NOTIFICATIONTYPE_AD_Reference_ID=344; /** EMail = E */ public static final String NOTIFICATIONTYPE_EMail = "E"; /** Notice = N */ public static final String NOTIFICATIONTYPE_Notice = "N"; /** None = X */ public static final String NOTIFICATIONTYPE_None = "X"; /** EMailPlusNotice = B */ public static final String NOTIFICATIONTYPE_EMailPlusNotice = "B";
/** NotifyUserInCharge = O */ public static final String NOTIFICATIONTYPE_NotifyUserInCharge = "O"; /** Set Benachrichtigungs-Art. @param NotificationType Art der Benachrichtigung */ @Override public void setNotificationType (java.lang.String NotificationType) { set_Value (COLUMNNAME_NotificationType, NotificationType); } /** Get Benachrichtigungs-Art. @return Art der Benachrichtigung */ @Override public java.lang.String getNotificationType () { return (java.lang.String)get_Value(COLUMNNAME_NotificationType); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Role_NotificationGroup.java
1
请完成以下Java代码
public meta setContent (String content) { addAttribute ("content", content); return this; } /** * Sets the name="" attribute. * * @param content * the value that should go into the name attribute */ public meta setName (String name) { addAttribute ("name", name); return this; } /** * Sets the name="" attribute. * * @param content * the value that should go into the name attribute */ public meta setName (String name, String content) { addAttribute ("name", name); addAttribute ("content", content); return this; } /** * Sets the scheme="" attribute. * * @param content * the value that should go into the scheme attribute */ public meta setScheme (String scheme) { addAttribute ("scheme", scheme); return this; } /** * Sets the http-equiv="" attribute. * * @param content * the value that should go into the http-equiv attribute */ public meta setHttpEquiv (String http_equiv) { addAttribute ("http-equiv", http_equiv); return this; } /** * Sets the http-equiv="" attribute. * * @param content * the value that should go into the http-equiv attribute */ public meta setHttpEquiv (String http_equiv, String content) { addAttribute ("content", content); addAttribute ("http-equiv", http_equiv); return this; } /** * Sets the lang="" and xml:lang="" attributes * * @param lang * the lang="" and xml:lang="" attributes */ public Element setLang (String lang) { addAttribute ("lang", lang); addAttribute ("xml:lang", lang); return this; } /**
* Adds an Element to the element. * * @param hashcode * name of element for hash table * @param element * Adds an Element to the element. */ public meta addElement (String hashcode, Element element) { addElementToRegistry (hashcode, element); return (this); } /** * Adds an Element to the element. * * @param hashcode * name of element for hash table * @param element * Adds an Element to the element. */ public meta addElement (String hashcode, String element) { addElementToRegistry (hashcode, element); return (this); } /** * Adds an Element to the element. * * @param element * Adds an Element to the element. */ public meta addElement (Element element) { addElementToRegistry (element); return (this); } /** * Adds an Element to the element. * * @param element * Adds an Element to the element. */ public meta addElement (String element) { addElementToRegistry (element); return (this); } /** * Removes an Element from the element. * * @param hashcode * the name of the element to be removed. */ public meta removeElement (String hashcode) { removeElementFromRegistry (hashcode); return (this); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\tools\src\main\java-legacy\org\apache\ecs\xhtml\meta.java
1
请完成以下Java代码
public List<UiExtension> getJsExtensions() { return this.uiExtensions.getJsExtensions(); } @ModelAttribute(value = "user", binding = false) public Map<String, Object> getUser(@Nullable Principal principal) { if (principal != null) { return singletonMap("name", principal.getName()); } return emptyMap(); } @GetMapping(path = "/", produces = MediaType.TEXT_HTML_VALUE) @RegisterReflectionForBinding(String.class) public String index() { return "index"; } @GetMapping(path = "/sba-settings.js", produces = "application/javascript") public String sbaSettings() { return "sba-settings.js"; } @GetMapping(path = "/variables.css", produces = "text/css") public String variablesCss() { return "variables.css"; } @GetMapping(path = "/login", produces = MediaType.TEXT_HTML_VALUE) public String login() { return "login"; } @lombok.Data @lombok.Builder public static class Settings { private final String title; private final String brand; private final String loginIcon; private final String favicon; private final String faviconDanger; private final PollTimer pollTimer; private final UiTheme theme; private final boolean notificationFilterEnabled; private final boolean rememberMeEnabled; private final List<String> availableLanguages; private final List<String> routes; private final List<ExternalView> externalViews; private final List<ViewSettings> viewSettings; private final Boolean enableToasts; private final Boolean hideInstanceUrl; private final Boolean disableInstanceUrl; } @lombok.Data @JsonInclude(Include.NON_EMPTY) public static class ExternalView { /** * Label to be shown in the navbar. */ private final String label;
/** * Url for the external view to be linked */ private final String url; /** * Order in the navbar. */ private final Integer order; /** * Should the page shown as an iframe or open in a new window. */ private final boolean iframe; /** * A list of child views. */ private final List<ExternalView> children; public ExternalView(String label, String url, Integer order, boolean iframe, List<ExternalView> children) { Assert.hasText(label, "'label' must not be empty"); if (isEmpty(children)) { Assert.hasText(url, "'url' must not be empty"); } this.label = label; this.url = url; this.order = order; this.iframe = iframe; this.children = children; } } @lombok.Data @JsonInclude(Include.NON_EMPTY) public static class ViewSettings { /** * Name of the view to address. */ private final String name; /** * Set view enabled. */ private boolean enabled; public ViewSettings(String name, boolean enabled) { Assert.hasText(name, "'name' must not be empty"); this.name = name; this.enabled = enabled; } } }
repos\spring-boot-admin-master\spring-boot-admin-server-ui\src\main\java\de\codecentric\boot\admin\server\ui\web\UiController.java
1
请在Spring Boot框架中完成以下Java代码
public class FileUploadServiceImpl implements FileUploadService { @Value("${upload.path:/data/upload/}") private String filePath; private static final List<FileInfo> FILE_STORAGE = new CopyOnWriteArrayList<>(); @Override public void upload(MultipartFile[] files) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); for (MultipartFile file : files) { String fileName = file.getOriginalFilename(); boolean match = FILE_STORAGE.stream().anyMatch(fileInfo -> fileInfo.getFileName().equals(fileName)); if (match) { throw new RuntimeException("File [ " + fileName + " ] already exist"); } String currentTime = simpleDateFormat.format(new Date()); try (InputStream in = file.getInputStream(); OutputStream out = Files.newOutputStream(Paths.get(filePath + fileName))) { FileCopyUtils.copy(in, out); } catch (IOException e) { log.error("File [{}] upload failed", fileName, e); throw new RuntimeException(e); }
FileInfo fileInfo = new FileInfo().setFileName(fileName).setUploadTime(currentTime); FILE_STORAGE.add(fileInfo); } } @Override public List<FileInfo> list() { return FILE_STORAGE; } @Override public Resource getFile(String fileName) { FILE_STORAGE.stream() .filter(info -> info.getFileName().equals(fileName)) .findFirst() .orElseThrow(() -> new RuntimeException("File [ " + fileName + " ] not exist")); File file = new File(filePath + fileName); return new FileSystemResource(file); } }
repos\springboot-demo-master\file\src\main\java\com\et\service\impl\FileUploadServiceImpl.java
2
请完成以下Java代码
public class Account { private String name; // render this field before any others (the highest ranked) @ToString.Include(rank = 1) private String id; @ToString.Exclude private String accountNumber; // automatically excluded private String $ignored; @ToString.Include String description() { return "Account description"; } public String getAccountNumber() { return accountNumber; } public void setAccountNumber(String accountNumber) { this.accountNumber = accountNumber; } public String getName() { return name;
} public void setName(String name) { this.name = name; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String get$ignored() { return $ignored; } public void set$ignored(String value) { this.$ignored = value; } }
repos\tutorials-master\lombok-modules\lombok-2\src\main\java\com\baeldung\lombok\tostring\Account.java
1
请完成以下Java代码
public void setTrxItemProcessorCtx(final ITrxItemProcessorContext processorCtx) { processor.setTrxItemProcessorCtx(processorCtx); } @Override public void process(final IT item) throws Exception { processor.process(item); } @Override public RT getResult() { return processor.getResult(); } /** * @return always return <code>false</code>. Each item is a separated chunk */ @Override public boolean isSameChunk(final IT item)
{ return false; } @Override public void newChunk(final IT item) { // nothing } @Override public void completeChunk() { // nothing } @Override public void cancelChunk() { // nothing } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\trx\processor\api\impl\TrxItemProcessor2TrxItemChunkProcessorWrapper.java
1
请完成以下Java代码
public ExternalTaskQuery orderByCreateTime() { return orderBy(ExternalTaskQueryProperty.CREATE_TIME); } @Override public long executeCount(CommandContext commandContext) { ensureVariablesInitialized(); checkQueryOk(); return commandContext .getExternalTaskManager() .findExternalTaskCountByQueryCriteria(this); } @Override public List<ExternalTask> executeList(CommandContext commandContext, Page page) { ensureVariablesInitialized(); checkQueryOk(); return commandContext .getExternalTaskManager() .findExternalTasksByQueryCriteria(this); } public List<String> executeIdsList(CommandContext commandContext) { ensureVariablesInitialized(); checkQueryOk(); return commandContext .getExternalTaskManager() .findExternalTaskIdsByQueryCriteria(this); } @Override public List<ImmutablePair<String, String>> executeDeploymentIdMappingsList(CommandContext commandContext) { checkQueryOk(); return commandContext .getExternalTaskManager() .findDeploymentIdMappingsByQueryCriteria(this); } public String getExternalTaskId() { return externalTaskId; } public String getWorkerId() { return workerId; } public Date getLockExpirationBefore() { return lockExpirationBefore; } public Date getLockExpirationAfter() { return lockExpirationAfter; } public String getTopicName() { return topicName; } public Boolean getLocked() { return locked; } public Boolean getNotLocked() { return notLocked; } public String getExecutionId() { return executionId; }
public String getProcessInstanceId() { return processInstanceId; } public String getProcessDefinitionKey() { return processDefinitionKey; } public String[] getProcessDefinitionKeys() { return processDefinitionKeys; } public String getProcessDefinitionId() { return processDefinitionId; } public String getProcessDefinitionName() { return processDefinitionName; } public String getProcessDefinitionNameLike() { return processDefinitionNameLike; } public String getActivityId() { return activityId; } public SuspensionState getSuspensionState() { return suspensionState; } public Boolean getRetriesLeft() { return retriesLeft; } public Date getNow() { return ClockUtil.getCurrentTime(); } protected void ensureVariablesInitialized() { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); VariableSerializers variableSerializers = processEngineConfiguration.getVariableSerializers(); String dbType = processEngineConfiguration.getDatabaseType(); for(QueryVariableValue var : variables) { var.initialize(variableSerializers, dbType); } } public List<QueryVariableValue> getVariables() { return variables; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\ExternalTaskQueryImpl.java
1
请完成以下Java代码
public String getId() { return id; } public String getDeploymentId() { return deploymentId; } public String getProcessDefinitionId() { return processDefinitionId; } public String getProcessDefinitionKey() { return processDefinitionKey; } public String getProcessInstanceId() { return processInstanceId; } public String getExecutionId() { return executionId; } public String getCaseDefinitionId() { return caseDefinitionId; } public String getCaseInstanceId() { return caseInstanceId; } public String getCaseExecutionId() { return caseExecutionId; } public String getTaskId() { return taskId; } public String getJobId() { return jobId; } public String getJobDefinitionId() { return jobDefinitionId; } public String getBatchId() { return batchId; } public String getUserId() { return userId;
} public Date getTimestamp() { return timestamp; } public String getOperationId() { return operationId; } public String getExternalTaskId() { return externalTaskId; } public String getOperationType() { return operationType; } public String getEntityType() { return entityType; } public String getProperty() { return property; } public String getOrgValue() { return orgValue; } public String getNewValue() { return newValue; } public Date getRemovalTime() { return removalTime; } public String getRootProcessInstanceId() { return rootProcessInstanceId; } public String getCategory() { return category; } public String getAnnotation() { return annotation; } }
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\history\UserOperationLogEntryDto.java
1
请完成以下Java代码
public class DDOrderLineHUPackingAware implements IHUPackingAware { private final I_DD_OrderLine ddOrderLine; /** * Plain delegate for fields which are not available in order line */ private final PlainHUPackingAware values = new PlainHUPackingAware(); public DDOrderLineHUPackingAware(@NonNull final I_DD_OrderLine ddOrderLine) { Check.assumeNotNull(ddOrderLine, "orderLine not null"); this.ddOrderLine = ddOrderLine; } @Override public int getM_Product_ID() { return ddOrderLine.getM_Product_ID(); } @Override public void setM_Product_ID(final int productId) { ddOrderLine.setM_Product_ID(productId); values.setM_Product_ID(productId); } @Override public void setQty(final BigDecimal qty) { ddOrderLine.setQtyEntered(qty); final ProductId productId = ProductId.ofRepoIdOrNull(getM_Product_ID()); final I_C_UOM uom = Services.get(IUOMDAO.class).getById(getC_UOM_ID()); final BigDecimal qtyOrdered = Services.get(IUOMConversionBL.class).convertToProductUOM(productId, uom, qty); ddOrderLine.setQtyOrdered(qtyOrdered); values.setQty(qty); } @Override public BigDecimal getQty() { return ddOrderLine.getQtyEntered(); } @Override public int getM_HU_PI_Item_Product_ID() { return ddOrderLine.getM_HU_PI_Item_Product_ID(); } @Override public void setM_HU_PI_Item_Product_ID(final int huPiItemProductId) { ddOrderLine.setM_HU_PI_Item_Product_ID(huPiItemProductId); values.setM_HU_PI_Item_Product_ID(huPiItemProductId); } @Override public int getM_AttributeSetInstance_ID() { return ddOrderLine.getM_AttributeSetInstance_ID(); } @Override public void setM_AttributeSetInstance_ID(final int M_AttributeSetInstance_ID) { ddOrderLine.setM_AttributeSetInstance_ID(M_AttributeSetInstance_ID); values.setM_AttributeSetInstance_ID(M_AttributeSetInstance_ID); } @Override public int getC_UOM_ID() { return ddOrderLine.getC_UOM_ID(); } @Override public void setC_UOM_ID(final int uomId) { values.setC_UOM_ID(uomId); // NOTE: uom is mandatory // we assume orderLine's UOM is correct if (uomId > 0) { ddOrderLine.setC_UOM_ID(uomId); }
} @Override public BigDecimal getQtyTU() { return ddOrderLine.getQtyEnteredTU(); } @Override public void setQtyTU(final BigDecimal qtyPacks) { ddOrderLine.setQtyEnteredTU(qtyPacks); values.setQtyTU(qtyPacks); } @Override public boolean isInDispute() { // order line has no IsInDispute flag return values.isInDispute(); } @Override public void setInDispute(final boolean inDispute) { values.setInDispute(inDispute); } @Override public void setC_BPartner_ID(final int partnerId) { // nothing } @Override public int getC_BPartner_ID() { return ddOrderLine.getDD_Order().getC_BPartner_ID(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\distribution\ddorder\lowlevel\model\DDOrderLineHUPackingAware.java
1