instruction
string
input
string
output
string
source_file
string
priority
int64
请完成以下Java代码
protected boolean isValidSortByValue(String value) { return VALID_SORT_BY_VALUES.contains(value); } protected AuthorizationQuery createNewQuery(ProcessEngine engine) { return engine.getAuthorizationService().createAuthorizationQuery(); } protected void applyFilters(AuthorizationQuery query) { if (id != null) { query.authorizationId(id); } if (type != null) { query.authorizationType(type); } if (userIdIn != null) { query.userIdIn(userIdIn); } if (groupIdIn != null) { query.groupIdIn(groupIdIn); } if (resourceType != null) { query.resourceType(resourceType);
} if (resourceId != null) { query.resourceId(resourceId); } } @Override protected void applySortBy(AuthorizationQuery query, String sortBy, Map<String, Object> parameters, ProcessEngine engine) { if (sortBy.equals(SORT_BY_RESOURCE_ID)) { query.orderByResourceId(); } else if (sortBy.equals(SORT_BY_RESOURCE_TYPE)) { query.orderByResourceType(); } } }
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\authorization\AuthorizationQueryDto.java
1
请完成以下Java代码
/* package */ void mergeFrom(final DocumentFieldChange fromEvent) { if (fromEvent.valueSet) { valueSet = true; value = fromEvent.value; valueReason = fromEvent.valueReason; } // if (fromEvent.readonly != null) { readonly = fromEvent.readonly; readonlyReason = fromEvent.readonlyReason; } // if (fromEvent.mandatory != null) { mandatory = fromEvent.mandatory; mandatoryReason = fromEvent.mandatoryReason; } // if (fromEvent.displayed != null) { displayed = fromEvent.displayed; displayedReason = fromEvent.displayedReason; } // if (fromEvent.lookupValuesStale != null) { lookupValuesStale = fromEvent.lookupValuesStale; lookupValuesStaleReason = fromEvent.lookupValuesStaleReason; } if (fromEvent.validStatus != null) { validStatus = fromEvent.validStatus; } if(fromEvent.fieldWarning != null) { fieldWarning = fromEvent.fieldWarning; } putDebugProperties(fromEvent.debugProperties); } /* package */ void mergeFrom(final IDocumentFieldChangedEvent fromEvent) { if (fromEvent.isValueSet()) { valueSet = true; value = fromEvent.getValue(); valueReason = null; // N/A } } public void putDebugProperty(final String name, final Object value) {
if (debugProperties == null) { debugProperties = new LinkedHashMap<>(); } debugProperties.put(name, value); } public void putDebugProperties(final Map<String, Object> debugProperties) { if (debugProperties == null || debugProperties.isEmpty()) { return; } if (this.debugProperties == null) { this.debugProperties = new LinkedHashMap<>(); } this.debugProperties.putAll(debugProperties); } public Map<String, Object> getDebugProperties() { return debugProperties == null ? ImmutableMap.of() : debugProperties; } public void setFieldWarning(@NonNull final DocumentFieldWarning fieldWarning) { this.fieldWarning = fieldWarning; } public DocumentFieldWarning getFieldWarning() { return fieldWarning; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\model\DocumentFieldChange.java
1
请完成以下Java代码
public class JSONDocumentLayoutElementLine { static List<JSONDocumentLayoutElementLine> ofList( @NonNull final List<DocumentLayoutElementLineDescriptor> elementsLines, @NonNull final JSONDocumentLayoutOptions options) { return elementsLines.stream() .map(elementsLine -> ofDocumentLayoutElementLineDescriptor(elementsLine, options)) .collect(GuavaCollectors.toImmutableList()); } private static JSONDocumentLayoutElementLine ofDocumentLayoutElementLineDescriptor( @NonNull final DocumentLayoutElementLineDescriptor elementLine, @NonNull final JSONDocumentLayoutOptions options) { return new JSONDocumentLayoutElementLine(elementLine, options); } @JsonProperty("elements") @JsonInclude(JsonInclude.Include.NON_EMPTY) @Getter private final List<JSONDocumentLayoutElement> elements; private JSONDocumentLayoutElementLine( @NonNull final DocumentLayoutElementLineDescriptor elementLine, @NonNull final JSONDocumentLayoutOptions options) { final List<JSONDocumentLayoutElement> elements = JSONDocumentLayoutElement.ofList(elementLine.getElements(), options); this.elements = ImmutableList.copyOf(elements); } @JsonCreator private JSONDocumentLayoutElementLine(
@JsonProperty("elements") @Nullable final List<JSONDocumentLayoutElement> elements) { this.elements = elements == null ? ImmutableList.of() : ImmutableList.copyOf(elements); } @JsonIgnore public boolean isEmpty() { return getElements().isEmpty(); } Stream<JSONDocumentLayoutElement> streamInlineTabElements() { return getElements() .stream() .filter(element -> element.getInlineTabId() != null); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\datatypes\json\JSONDocumentLayoutElementLine.java
1
请完成以下Java代码
public void setCreatedTime(long createdTime) { if (createdTime > 0) { this.createdTime = createdTime; } } protected static UUID getUuid(UUIDBased uuidBased) { if (uuidBased != null) { return uuidBased.getId(); } else { return null; } } protected static UUID getTenantUuid(TenantId tenantId) { if (tenantId != null) { return tenantId.getId(); } else { return EntityId.NULL_UUID; } } protected static <I> I getEntityId(UUID uuid, Function<UUID, I> creator) { return DaoUtil.toEntityId(uuid, creator); } protected static TenantId getTenantId(UUID uuid) { if (uuid != null && !uuid.equals(EntityId.NULL_UUID)) { return TenantId.fromUUID(uuid); } else { return TenantId.SYS_TENANT_ID; } }
protected JsonNode toJson(Object value) { if (value != null) { return JacksonUtil.valueToTree(value); } else { return null; } } protected <T> T fromJson(JsonNode json, Class<T> type) { return JacksonUtil.convertValue(json, type); } protected String listToString(List<?> list) { if (list != null) { return StringUtils.join(list, ','); } else { return ""; } } protected <E> List<E> listFromString(String string, Function<String, E> mappingFunction) { if (string != null) { return Arrays.stream(StringUtils.split(string, ',')) .filter(StringUtils::isNotBlank) .map(mappingFunction).collect(Collectors.toList()); } else { return Collections.emptyList(); } } }
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\model\BaseSqlEntity.java
1
请完成以下Java代码
public boolean isRelativeToCurrent() { return this.relativeToCurrent; } /** * Set whether the offset is relative to the current position. * @param relativeToCurrent true for relative to current. * @since 2.5.5 */ public void setRelativeToCurrent(boolean relativeToCurrent) { this.relativeToCurrent = relativeToCurrent; } public @Nullable SeekPosition getPosition() { return this.position; } public @Nullable Function<Long, Long> getOffsetComputeFunction() { return this.offsetComputeFunction; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) {
return false; } TopicPartitionOffset that = (TopicPartitionOffset) o; return Objects.equals(this.topicPartition, that.topicPartition) && Objects.equals(this.position, that.position); } @Override public int hashCode() { return Objects.hash(this.topicPartition, this.position); } @Override public String toString() { return "TopicPartitionOffset{" + "topicPartition=" + this.topicPartition + ", offset=" + this.offset + ", relativeToCurrent=" + this.relativeToCurrent + (this.position == null ? "" : (", position=" + this.position.name())) + '}'; } }
repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\support\TopicPartitionOffset.java
1
请完成以下Java代码
public boolean isHtmlView() { return isHtmlView; } public void setCacheName(String cacheName) { this.cacheName = cacheName; } public void setCacheListName(String cacheListName) { this.cacheListName = cacheListName; } public void setOutFilePath(String outFilePath) { this.outFilePath = outFilePath; } public void setOriginFilePath(String originFilePath) { this.originFilePath = originFilePath; } public void setHtmlView(boolean isHtmlView) { this.isHtmlView = isHtmlView; } public void setName(String name) { this.name = name; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public Boolean getSkipDownLoad() { return skipDownLoad; } public void setSkipDownLoad(Boolean skipDownLoad) { this.skipDownLoad = skipDownLoad; }
public String getTifPreviewType() { return tifPreviewType; } public void setTifPreviewType(String previewType) { this.tifPreviewType = previewType; } public Boolean forceUpdatedCache() { return forceUpdatedCache; } public void setForceUpdatedCache(Boolean forceUpdatedCache) { this.forceUpdatedCache = forceUpdatedCache; } public String getKkProxyAuthorization() { return kkProxyAuthorization; } public void setKkProxyAuthorization(String kkProxyAuthorization) { this.kkProxyAuthorization = kkProxyAuthorization; } }
repos\kkFileView-master\server\src\main\java\cn\keking\model\FileAttribute.java
1
请完成以下Java代码
public void setTE (final @Nullable java.lang.String TE) { set_Value (COLUMNNAME_TE, TE); } @Override public java.lang.String getTE() { return get_ValueAsString(COLUMNNAME_TE); } @Override 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 setWarehouseLocatorIdentifier (final @Nullable java.lang.String WarehouseLocatorIdentifier) { set_Value (COLUMNNAME_WarehouseLocatorIdentifier, WarehouseLocatorIdentifier); } @Override public java.lang.String getWarehouseLocatorIdentifier() { return get_ValueAsString(COLUMNNAME_WarehouseLocatorIdentifier); } @Override public void setWarehouseValue (final @Nullable java.lang.String WarehouseValue) { set_Value (COLUMNNAME_WarehouseValue, WarehouseValue); } @Override public java.lang.String getWarehouseValue() { return get_ValueAsString(COLUMNNAME_WarehouseValue); } @Override public void setX (final @Nullable java.lang.String X) { set_Value (COLUMNNAME_X, X); } @Override public java.lang.String getX() { return get_ValueAsString(COLUMNNAME_X); } @Override public void setX1 (final @Nullable java.lang.String X1)
{ set_Value (COLUMNNAME_X1, X1); } @Override public java.lang.String getX1() { return get_ValueAsString(COLUMNNAME_X1); } @Override public void setY (final @Nullable java.lang.String Y) { set_Value (COLUMNNAME_Y, Y); } @Override public java.lang.String getY() { return get_ValueAsString(COLUMNNAME_Y); } @Override public void setZ (final @Nullable java.lang.String Z) { set_Value (COLUMNNAME_Z, Z); } @Override public java.lang.String getZ() { return get_ValueAsString(COLUMNNAME_Z); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_I_Inventory.java
1
请完成以下Java代码
public List<String> getExtensions() { return this.extensions; } @Override public Mono<String> getDocument(String name) { return Flux.fromIterable(this.locations) .flatMapIterable((location) -> getCandidateResources(name, location)) .filter(Resource::exists) .next() .map(this::resourceToString) .switchIfEmpty(Mono.fromRunnable(() -> { throw new IllegalStateException( "Failed to find document, name='" + name + "', under location(s)=" + this.locations.stream().map(Resource::toString).toList()); })) .subscribeOn(Schedulers.boundedElastic()); } private List<Resource> getCandidateResources(String name, Resource location) { return this.extensions.stream() .map((ext) -> { try { return location.createRelative(name + ext); }
catch (IOException ex) { throw new IllegalStateException(ex); } }) .collect(Collectors.toList()); } private String resourceToString(Resource resource) { try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); FileCopyUtils.copy(resource.getInputStream(), outputStream); return outputStream.toString(StandardCharsets.UTF_8); } catch (IOException ex) { throw new IllegalArgumentException( "Found resource: " + resource.getDescription() + " but failed to read it", ex); } } }
repos\spring-graphql-main\spring-graphql\src\main\java\org\springframework\graphql\support\ResourceDocumentSource.java
1
请在Spring Boot框架中完成以下Java代码
public static class Verification { /** * Credentials used for verification of incoming SAML messages. */ private List<Credential> credentials = new ArrayList<>(); public List<Credential> getCredentials() { return this.credentials; } public void setCredentials(List<Credential> credentials) { this.credentials = credentials; } public static class Credential { /** * Locations of the X.509 certificate used for verification of incoming * SAML messages. */ private @Nullable Resource certificate; public @Nullable Resource getCertificateLocation() { return this.certificate; } public void setCertificateLocation(@Nullable Resource certificate) { this.certificate = certificate; } } } } /** * Single logout details. */ public static class Singlelogout { /** * Location where SAML2 LogoutRequest gets sent to. */ private @Nullable String url; /** * Location where SAML2 LogoutResponse gets sent to. */ private @Nullable String responseUrl; /** * Whether to redirect or post logout requests.
*/ private @Nullable Saml2MessageBinding binding; public @Nullable String getUrl() { return this.url; } public void setUrl(@Nullable String url) { this.url = url; } public @Nullable String getResponseUrl() { return this.responseUrl; } public void setResponseUrl(@Nullable String responseUrl) { this.responseUrl = responseUrl; } public @Nullable Saml2MessageBinding getBinding() { return this.binding; } public void setBinding(@Nullable Saml2MessageBinding binding) { this.binding = binding; } } }
repos\spring-boot-4.0.1\module\spring-boot-security-saml2\src\main\java\org\springframework\boot\security\saml2\autoconfigure\Saml2RelyingPartyProperties.java
2
请在Spring Boot框架中完成以下Java代码
private boolean isInfoOrDebug(LogLevel logLevel) { return LogLevel.INFO.equals(logLevel) || LogLevel.DEBUG.equals(logLevel); } void logReport(boolean isCrashReport) { ConditionEvaluationReport report = this.reportSupplier.get(); if (report == null) { this.logger.info("Unable to provide the condition evaluation report"); return; } if (!report.getConditionAndOutcomesBySource().isEmpty()) { if (this.logLevel.equals(LogLevel.INFO)) { if (this.logger.isInfoEnabled()) { this.logger.info(new ConditionEvaluationReportMessage(report)); } else if (isCrashReport) { logMessage("info"); } } else { if (this.logger.isDebugEnabled()) {
this.logger.debug(new ConditionEvaluationReportMessage(report)); } else if (isCrashReport) { logMessage("debug"); } } } } private void logMessage(String logLevel) { this.logger.info(String.format("%n%nError starting ApplicationContext. To display the " + "condition evaluation report re-run your application with '%s' enabled.", logLevel)); } }
repos\spring-boot-4.0.1\core\spring-boot-autoconfigure\src\main\java\org\springframework\boot\autoconfigure\logging\ConditionEvaluationReportLogger.java
2
请在Spring Boot框架中完成以下Java代码
public Role getRole(Long id) { return null; } @Override public String getRoleIds(String tenantId, String roleNames) { return null; } @Override public String getRoleName(Long id) { return null; } @Override public List<String> getRoleNames(String roleIds) { return null; }
@Override public String getRoleAlias(Long id) { return null; } @Override public R<Tenant> getTenant(Long id) { return null; } @Override public R<Tenant> getTenant(String tenantId) { return null; } }
repos\SpringBlade-master\blade-service-api\blade-system-api\src\main\java\org\springblade\system\feign\ISysClientFallback.java
2
请完成以下Java代码
protected String getPlanItemDefinitionXmlElementValue(CaseTask caseTask) { return ELEMENT_CASE_TASK; } @Override protected void writePlanItemDefinitionSpecificAttributes(CaseTask caseTask, XMLStreamWriter xtw) throws Exception { super.writePlanItemDefinitionSpecificAttributes(caseTask, xtw); TaskExport.writeCommonTaskAttributes(caseTask, xtw); if (caseTask.getFallbackToDefaultTenant() != null) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_FALLBACK_TO_DEFAULT_TENANT, caseTask.getFallbackToDefaultTenant().toString()); } if (caseTask.isSameDeployment()) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_SAME_DEPLOYMENT, "true"); } if (StringUtils.isNotEmpty(caseTask.getCaseInstanceIdVariableName())) { xtw.writeAttribute(FLOWABLE_EXTENSIONS_PREFIX, FLOWABLE_EXTENSIONS_NAMESPACE, ATTRIBUTE_ID_VARIABLE_NAME, caseTask.getCaseInstanceIdVariableName()); } } @Override
protected void writePlanItemDefinitionBody(CmmnModel model, CaseTask caseTask, XMLStreamWriter xtw, CmmnXmlConverterOptions options) throws Exception { super.writePlanItemDefinitionBody(model, caseTask, xtw, options); // Always export the case reference as an expression, even if the caseRef is set if (StringUtils.isNotEmpty(caseTask.getCaseRef()) || StringUtils.isNotEmpty(caseTask.getCaseRefExpression())) { xtw.writeStartElement(ELEMENT_CASE_REF_EXPRESSION); xtw.writeCData( StringUtils.isNotEmpty(caseTask.getCaseRef()) ? caseTask.getCaseRef() : caseTask.getCaseRefExpression() ); xtw.writeEndElement(); } } }
repos\flowable-engine-main\modules\flowable-cmmn-converter\src\main\java\org\flowable\cmmn\converter\export\CaseTaskExport.java
1
请完成以下Java代码
public static String getExt(String fileName) { return fileName.substring(fileName.lastIndexOf(".") + 1); } /** * 获取去掉横线的长度为32的UUID串. * * @author WuShuicheng. * @return uuid. */ public static String get32UUID() { return UUID.randomUUID().toString().replace("-", ""); } /** * 获取带横线的长度为36的UUID串. * * @author WuShuicheng. * @return uuid. */ public static String get36UUID() { return UUID.randomUUID().toString(); } /** * 验证一个字符串是否完全由纯数字组成的字符串,当字符串为空时也返回false. * * @author WuShuicheng . * @param str * 要判断的字符串 . * @return true or false . */ public static boolean isNumeric(String str) { if (StringUtils.isBlank(str)) { return false; } else { return str.matches("\\d*"); } } /** * 计算采用utf-8编码方式时字符串所占字节数 * * @param content * @return */ public static int getByteSize(String content) { int size = 0; if (null != content) { try { // 汉字采用utf-8编码时占3个字节 size = content.getBytes("utf-8").length;
} catch (UnsupportedEncodingException e) { LOG.error(e); } } return size; } /** * 函数功能说明 : 截取字符串拼接in查询参数. 修改者名字: 修改日期: 修改内容: * * @参数: @param ids * @参数: @return * @return String * @throws */ public static List<String> getInParam(String param) { boolean flag = param.contains(","); List<String> list = new ArrayList<String>(); if (flag) { list = Arrays.asList(param.split(",")); } else { list.add(param); } return list; } /** * 判断对象是否为空 * * @param obj * @return */ public static boolean isNotNull(Object obj) { if (obj != null && obj.toString() != null && !"".equals(obj.toString().trim())) { return true; } else { return false; } } }
repos\roncoo-pay-master\roncoo-pay-common-core\src\main\java\com\roncoo\pay\common\core\utils\StringUtil.java
1
请完成以下Java代码
private AttachmentTags extractAttachmentTags(@Nullable final List<JsonTag> tags) { if (tags == null || Check.isEmpty(tags)) { return AttachmentTags.EMPTY; } final ImmutableMap<String, String> tagName2Value = tags.stream() .collect(ImmutableMap.toImmutableMap(JsonTag::getName, JsonTag::getValue)); return AttachmentTags.ofMap(tagName2Value); } @NonNull private List<TableRecordReference> extractTableRecordReferences(@NonNull final JsonAttachmentRequest request) { final ImmutableList.Builder<TableRecordReference> tableRecordReferenceBuilder = ImmutableList.builder(); request.getTargets() .stream() .map(target -> extractTableRecordReference(request.getOrgCode(), target)) .forEach(tableRecordReferenceBuilder::add); request.getReferences() .stream() .map(AttachmentRestService::extractTableRecordReference) .forEach(tableRecordReferenceBuilder::add); return tableRecordReferenceBuilder.build(); } @NonNull private static TableRecordReference extractTableRecordReference(@NonNull final JsonTableRecordReference reference) { return TableRecordReference.of(reference.getTableName(), reference.getRecordId().getValue()); }
private static void validateLocalFileURL(@NonNull final URL url) { if (!url.getProtocol().equals("file")) { throw new AdempiereException("Protocol " + url.getProtocol() + " not supported!"); } final Path filePath = FileUtil.getFilePath(url); if (!filePath.toFile().isFile()) { throw new AdempiereException("Provided local file with URL: " + url + " is not accessible!") .appendParametersToMessage() .setParameter("ParsedPath", filePath.toString()); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business.rest-api-impl\src\main\java\de\metas\rest_api\v2\attachment\AttachmentRestService.java
1
请完成以下Java代码
public String getAmtInWords (String amount) throws Exception { if (amount == null) return amount; // StringBuffer sb = new StringBuffer (); amount = amount.replaceAll (",", ""); Double iznos = Double.parseDouble(amount); sb.append (slovimaUValuti (new BigDecimal(Double.valueOf(iznos)))); return sb.toString (); } // getAmtInWords /** * Test Print * @param amt amount */ private void print (String amt) { try { System.out.println(amt + " = " + getAmtInWords(amt)); } catch (Exception e) {
e.printStackTrace(); } } // print /** * Test * @param args ignored */ public static void main (String[] args) { AmtInWords_HR aiw = new AmtInWords_HR(); // aiw.print (".23"); Error aiw.print("263.52"); aiw.print ("0.23"); aiw.print ("1.23"); aiw.print ("12.345"); aiw.print ("123.45"); aiw.print ("1234.56"); aiw.print ("12345.78"); aiw.print ("123457.89"); aiw.print ("1,234,578.90"); } // main } // AmtInWords_HR
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\util\AmtInWords_HR.java
1
请在Spring Boot框架中完成以下Java代码
public ResponseEntity<Customer> createCustomer(@RequestBody Customer customer) { Customer customerCreated = customerService.createCustomer(customer); URI location = ServletUriComponentsBuilder.fromCurrentRequest() .path("/{id}") .buildAndExpand(customerCreated.getId()) .toUri(); return ResponseEntity.created(location) .build(); } @PatchMapping(path = "/{id}", consumes = "application/json-patch+json") public ResponseEntity<Customer> updateCustomer(@PathVariable String id, @RequestBody JsonPatch patch) { try { Customer customer = customerService.findCustomer(id) .orElseThrow(CustomerNotFoundException::new); Customer customerPatched = applyPatchToCustomer(patch, customer);
customerService.updateCustomer(customerPatched); return ResponseEntity.ok(customerPatched); } catch (CustomerNotFoundException e) { return ResponseEntity.status(HttpStatus.NOT_FOUND) .build(); } catch (JsonPatchException | JsonProcessingException e) { return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .build(); } } private Customer applyPatchToCustomer(JsonPatch patch, Customer targetCustomer) throws JsonPatchException, JsonProcessingException { JsonNode patched = patch.apply(objectMapper.convertValue(targetCustomer, JsonNode.class)); return objectMapper.treeToValue(patched, Customer.class); } }
repos\tutorials-master\spring-web-modules\spring-rest-http\src\main\java\com\baeldung\web\controller\customer\CustomerRestController.java
2
请完成以下Java代码
public void setM_Warehouse_ID (int M_Warehouse_ID) { if (M_Warehouse_ID < 1) set_Value (COLUMNNAME_M_Warehouse_ID, null); else set_Value (COLUMNNAME_M_Warehouse_ID, Integer.valueOf(M_Warehouse_ID)); } /** Get Lager. @return Lager oder Ort für Dienstleistung */ @Override public int getM_Warehouse_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_Warehouse_ID); if (ii == null) return 0; return ii.intValue(); } @Override public org.compiere.model.I_S_Resource getPP_Plant() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_PP_Plant_ID, org.compiere.model.I_S_Resource.class); } @Override public void setPP_Plant(org.compiere.model.I_S_Resource PP_Plant) { set_ValueFromPO(COLUMNNAME_PP_Plant_ID, org.compiere.model.I_S_Resource.class, PP_Plant); } /** Set Produktionsstätte. @param PP_Plant_ID Produktionsstätte */ @Override public void setPP_Plant_ID (int PP_Plant_ID) { if (PP_Plant_ID < 1) set_Value (COLUMNNAME_PP_Plant_ID, null); else set_Value (COLUMNNAME_PP_Plant_ID, Integer.valueOf(PP_Plant_ID));
} /** Get Produktionsstätte. @return Produktionsstätte */ @Override public int getPP_Plant_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_PP_Plant_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; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.fresh\de.metas.fresh.base\src\main\java-gen\de\metas\fresh\model\X_C_Order_MFGWarehouse_Report.java
1
请完成以下Java代码
public boolean isEditable() { return editable; } public void setEditable(final boolean editable) { if (this.editable == editable) { return; } final boolean editableOld = this.editable; this.editable = editable; pcs.firePropertyChange(PROPERTY_Editable, editableOld, editable); } public boolean isVisible() { return visible; } public void setVisible(boolean visible) { if (this.visible == visible) { return; } final boolean visibleOld = this.visible; this.visible = visible; pcs.firePropertyChange(PROPERTY_Visible, visibleOld, visible); } @Override public Method getReadMethod() { return readMethod; } @Override public Method getWriteMethod() { return writeMethod; } void setWriteMethod(final Method writeMethod) { this.writeMethod = writeMethod; } void setSeqNo(final int seqNo) { this.seqNo = seqNo; } @Override public int getSeqNo() { return seqNo; } @Override public String getLookupTableName() { return lookupTableName; } void setLookupTableName(final String lookupTableName) {
this.lookupTableName = lookupTableName; } @Override public String getLookupColumnName() { return lookupColumnName; } void setLookupColumnName(final String lookupColumnName) { this.lookupColumnName = lookupColumnName; } @Override public String getPrototypeValue() { return prototypeValue; } void setPrototypeValue(final String prototypeValue) { this.prototypeValue = prototypeValue; } public int getDisplayType(final int defaultDisplayType) { return displayType > 0 ? displayType : defaultDisplayType; } public int getDisplayType() { return displayType; } void setDisplayType(int displayType) { this.displayType = displayType; } public boolean isSelectionColumn() { return selectionColumn; } public void setSelectionColumn(boolean selectionColumn) { this.selectionColumn = selectionColumn; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\compiere\swing\table\TableColumnInfo.java
1
请在Spring Boot框架中完成以下Java代码
public Object findByOperator() { // 设置查询条件参数 int min = 25; int max = 35; // 创建条件对象 Criteria criteria = Criteria.where("age").gt(min).lte(max); // 创建查询对象,然后将条件对象添加到其中 Query query = new Query(criteria); // 查询并返回结果 List<User> documentList = mongoTemplate.find(query, User.class, COLLECTION_NAME); // 输出结果 for (User user : documentList) { log.info("用户信息:{}", user); } return documentList; } /** * 根据【正则表达式】查询集合中的文档数据 * * @return 符合条件的文档列表 */ public Object findByRegex() { // 设置查询条件参数 String regex = "^zh*"; // 创建条件对象 Criteria criteria = Criteria.where("name").regex(regex); // 创建查询对象,然后将条件对象添加到其中 Query query = new Query(criteria); // 查询并返回结果 List<User> documentList = mongoTemplate.find(query, User.class, COLLECTION_NAME); // 输出结果 for (User user : documentList) { log.info("用户信息:{}", user);
} return documentList; } /** * 统计集合中符合【查询条件】的文档【数量】 * * @return 符合条件的文档列表 */ public Object countNumber() { // 设置查询条件参数 int age = 22; // 创建条件对象 Criteria criteria = Criteria.where("age").is(age); // 创建查询对象,然后将条件对象添加到其中 Query query = new Query(criteria); // 查询并返回结果 long count = mongoTemplate.count(query, User.class, COLLECTION_NAME); // 输出结果 log.info("符合条件的文档数量:{}", count); return count; } }
repos\springboot-demo-master\mongodb\src\main\java\demo\et\mongodb\service\QueryService.java
2
请完成以下Java代码
public class JaxenDemo { private File file; public JaxenDemo(File file) { this.file = file; } public List getAllTutorial() { try { FileInputStream fileIS = new FileInputStream(this.getFile()); DocumentBuilderFactory builderFactory = newSecureDocumentBuilderFactory(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); Document xmlDocument = builder.parse(fileIS); String expression = "/tutorials/tutorial"; XPath path = new DOMXPath(expression);
List result = path.selectNodes(xmlDocument); return result; } catch (SAXException | IOException | ParserConfigurationException | JaxenException e) { e.printStackTrace(); return null; } } public File getFile() { return file; } public void setFile(File file) { this.file = file; } }
repos\tutorials-master\xml-modules\xml\src\main\java\com\baeldung\xml\JaxenDemo.java
1
请完成以下Java代码
public void init() { this.s3Client = S3Client.builder() .region(Region.US_EAST_1) .credentialsProvider(ProfileCredentialsProvider.create("default")) .build(); } public void renameFile(String bucketName, String keyName, String destinationKeyName) { CopyObjectRequest copyObjRequest = CopyObjectRequest.builder() .sourceBucket(bucketName) .sourceKey(keyName) .destinationBucket(destinationKeyName) .destinationKey(bucketName) .build(); s3Client.copyObject(copyObjRequest); DeleteObjectRequest deleteRequest = DeleteObjectRequest.builder() .bucket(bucketName) .key(keyName) .build(); s3Client.deleteObject(deleteRequest); } public void renameFolder(String bucketName, String sourceFolderKey, String destinationFolderKey) { ListObjectsV2Request listRequest = ListObjectsV2Request.builder() .bucket(bucketName) .prefix(sourceFolderKey) .build(); ListObjectsV2Response listResponse = s3Client.listObjectsV2(listRequest); List<S3Object> objects = listResponse.contents(); for (S3Object s3Object : objects) { String newKey = destinationFolderKey + s3Object.key() .substring(sourceFolderKey.length());
// Copy object to destination folder CopyObjectRequest copyRequest = CopyObjectRequest.builder() .sourceBucket(bucketName) .sourceKey(s3Object.key()) .destinationBucket(bucketName) .destinationKey(newKey) .build(); s3Client.copyObject(copyRequest); // Delete object from source folder DeleteObjectRequest deleteRequest = DeleteObjectRequest.builder() .bucket(bucketName) .key(s3Object.key()) .build(); s3Client.deleteObject(deleteRequest); } } }
repos\tutorials-master\aws-modules\aws-s3\src\main\java\com\baeldung\s3\RenameObjectService.java
1
请在Spring Boot框架中完成以下Java代码
public class Address { @Id private Long id; @OneToOne private Person person; private String state; private String city; private String street; private String zipCode; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getCity() { return city; } public void setCity(String city) { this.city = city; }
public String getStreet() { return street; } public void setStreet(String street) { this.street = street; } public String getZipCode() { return zipCode; } public void setZipCode(String zipCode) { this.zipCode = zipCode; } }
repos\tutorials-master\persistence-modules\spring-data-jpa-simple\src\main\java\com\baeldung\jpa\projection\model\Address.java
2
请在Spring Boot框架中完成以下Java代码
public class DruidDataConfig { @Value("${jdbc.driver}") private String driverClassName; @Value("${jdbc.url}") private String url; @Value("${jdbc.username}") private String username; @Value("${jdbc.password}") private String password; @Value("${jdbc.initialSize}") private Integer initialSize; @Value("${jdbc.minIdle}") private Integer minIdle; @Value("${jdbc.maxActive}") private Integer maxActive; @Value("${jdbc.maxWait}") private Integer maxWait; @Primary @Bean(name = "dataSource", initMethod = "init", destroyMethod = "clone") public DruidDataSource druidDataSource() { DruidDataSource dataSource = new DruidDataSource(); //基本属性driverClassName、 url、user、password dataSource.setDriverClassName(driverClassName); dataSource.setUrl(url); dataSource.setUsername(username);
dataSource.setPassword(password); //初始化时建立物理连接的个数,缺省值为0 dataSource.setInitialSize(initialSize); //最小连接池数量 dataSource.setMinIdle(minIdle); //最大连接池数量,缺省值为8 dataSource.setMaxActive(maxActive); //获取连接时最大等待时间,单位毫秒。配置了maxWait之后,缺省启用公平锁,并发效率会有所下降,如果需要可以通过配置useUnfairLock属性为true使用非公平锁 dataSource.setMaxWait(maxWait); return dataSource; } }
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\config\DruidDataConfig.java
2
请在Spring Boot框架中完成以下Java代码
public class TbRuleNodeProfilerInfo { @Getter private final UUID ruleNodeId; @Getter private final String label; private AtomicInteger executionCount = new AtomicInteger(0); private AtomicLong executionTime = new AtomicLong(0); private AtomicLong maxExecutionTime = new AtomicLong(0); public TbRuleNodeProfilerInfo(RuleNodeInfo ruleNodeInfo) { this.ruleNodeId = ruleNodeInfo.getRuleNodeId().getId(); this.label = ruleNodeInfo.toString(); } public TbRuleNodeProfilerInfo(UUID ruleNodeId) { this.ruleNodeId = ruleNodeId; this.label = ""; } public void record(long processingTime) { executionCount.incrementAndGet(); executionTime.addAndGet(processingTime); while (true) { long value = maxExecutionTime.get(); if (value >= processingTime) {
break; } if (maxExecutionTime.compareAndSet(value, processingTime)) { break; } } } int getExecutionCount() { return executionCount.get(); } long getMaxExecutionTime() { return maxExecutionTime.get(); } double getAvgExecutionTime() { double executionCnt = (double) executionCount.get(); if (executionCnt > 0) { return executionTime.get() / executionCnt; } else { return 0.0; } } }
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\queue\TbRuleNodeProfilerInfo.java
2
请在Spring Boot框架中完成以下Java代码
public class Invoice440RequestConversionService implements CrossVersionRequestConverter { public static final String INVOICE_440_REQUEST_XSD = "http://www.forum-datenaustausch.ch/invoice generalInvoiceRequest_440.xsd"; private boolean usePrettyPrint = false; @Override public void fromCrossVersionRequest(@NonNull final XmlRequest xRequest, @NonNull final OutputStream outputStream) { final JAXBElement<RequestType> jaxbType = Invoice440FromCrossVersionModelTool.INSTANCE.fromCrossVersionModel(xRequest); JaxbUtil.marshal( jaxbType, RequestType.class, INVOICE_440_REQUEST_XSD, outputStream, usePrettyPrint); } @Override public XmlRequest toCrossVersionRequest(@NonNull final InputStream xmlInput) { final JAXBElement<RequestType> jaxbRequest = JaxbUtil.unmarshalToJaxbElement(xmlInput, RequestType.class); return Invoice440ToCrossVersionModelTool.INSTANCE.toCrossVersionModel(jaxbRequest.getValue());
} @Override public String getXsdName() { return INVOICE_440_REQUEST_XSD; } @Override public XmlVersion getVersion() { return XmlVersion.v440; } @VisibleForTesting public void setUsePrettyPrint(final boolean usePrettyPrint) { this.usePrettyPrint = usePrettyPrint; } }
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_440_request\src\main\java\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_440\Invoice440RequestConversionService.java
2
请在Spring Boot框架中完成以下Java代码
public class AttributeSetId implements RepoIdAware { public static final AttributeSetId NONE = new AttributeSetId(0); int repoId; @JsonCreator public static AttributeSetId ofRepoId(final int repoId) { final AttributeSetId id = ofRepoIdOrNull(repoId); if (id == null) { throw new AdempiereException("Invalid repoId: " + repoId); } return id; } public static AttributeSetId ofRepoIdOrNone(final int repoId) { final AttributeSetId id = ofRepoIdOrNull(repoId); return id != null ? id : NONE; } @Nullable public static AttributeSetId ofRepoIdOrNull(final int repoId) { if (repoId == NONE.repoId) { return NONE; } else if (repoId > 0) {
return new AttributeSetId(repoId); } else { return null; } } public static int toRepoId(@Nullable final AttributeSetId attributeSetId) { return attributeSetId != null ? attributeSetId.getRepoId() : -1; } private AttributeSetId(final int repoId) { this.repoId = Check.assumeGreaterOrEqualToZero(repoId, "M_AttributeSet_ID"); } @Override @JsonValue public int getRepoId() { return repoId; } public boolean isNone() { return repoId == NONE.repoId; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\mm\attributes\AttributeSetId.java
2
请在Spring Boot框架中完成以下Java代码
public void onFailure(Throwable t) { callback.onFailure(t); } }; } private <T> FutureCallback<ValidationResult> getAttributesFetchCallback(final TenantId tenantId, final EntityId entityId, final String scope, final FutureCallback<List<AttributeKvEntry>> callback) { return new FutureCallback<ValidationResult>() { @Override public void onSuccess(@Nullable ValidationResult result) { Futures.addCallback(attributesService.findAll(tenantId, entityId, AttributeScope.valueOf(scope)), callback, MoreExecutors.directExecutor()); } @Override public void onFailure(Throwable t) { callback.onFailure(t); } }; } private FutureCallback<ValidationResult> on(Consumer<Void> success, Consumer<Throwable> failure) { return new FutureCallback<ValidationResult>() { @Override public void onSuccess(@Nullable ValidationResult result) { ValidationResultCode resultCode = result.getResultCode(); if (resultCode == ValidationResultCode.OK) { success.accept(null); } else { onFailure(ValidationCallback.getException(result)); } } @Override public void onFailure(Throwable t) { failure.accept(t); } }; } public static Aggregation getAggregation(String agg) { return StringUtils.isEmpty(agg) ? DEFAULT_AGGREGATION : Aggregation.valueOf(agg); } private int getLimit(int limit) { return limit == 0 ? DEFAULT_LIMIT : limit; }
private DefaultTenantProfileConfiguration getTenantProfileConfiguration(WebSocketSessionRef sessionRef) { return Optional.ofNullable(tenantProfileCache.get(sessionRef.getSecurityCtx().getTenantId())) .map(TenantProfile::getDefaultProfileConfiguration).orElse(null); } public static <C extends WsCmd> WsCmdHandler<C> newCmdHandler(BiConsumer<WebSocketSessionRef, C> handler) { return new WsCmdHandler<>(handler); } @RequiredArgsConstructor @Getter @SuppressWarnings("unchecked") public static class WsCmdHandler<C extends WsCmd> { protected final BiConsumer<WebSocketSessionRef, C> handler; public void handle(WebSocketSessionRef sessionRef, WsCmd cmd) { handler.accept(sessionRef, (C) cmd); } } }
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\ws\DefaultWebSocketService.java
2
请完成以下Java代码
public int getMaxIterations() { return maxIterations; } public void setMaxIterations(int maxIterations) { this.maxIterations = maxIterations; } public String getJobHandlerType() { return jobHandlerType; } public void setJobHandlerType(String jobHandlerType) { this.jobHandlerType = jobHandlerType; } public String getJobHandlerConfiguration() { return jobHandlerConfiguration; } public void setJobHandlerConfiguration(String jobHandlerConfiguration) { this.jobHandlerConfiguration = jobHandlerConfiguration; } public String getJobType() { return jobType; } public void setJobType(String jobType) { this.jobType = jobType; } public String getTenantId() { return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } public String getExceptionStacktrace() { if (exceptionByteArrayRef == null) { return null; } byte[] bytes = exceptionByteArrayRef.getBytes(); if (bytes == null) { return null; } try {
return new String(bytes, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new ActivitiException("UTF-8 is not a supported encoding"); } } public void setExceptionStacktrace(String exception) { if (exceptionByteArrayRef == null) { exceptionByteArrayRef = new ByteArrayRef(); } exceptionByteArrayRef.setValue("stacktrace", getUtf8Bytes(exception)); } public String getExceptionMessage() { return exceptionMessage; } public void setExceptionMessage(String exceptionMessage) { this.exceptionMessage = StringUtils.abbreviate(exceptionMessage, MAX_EXCEPTION_MESSAGE_LENGTH); } public ByteArrayRef getExceptionByteArrayRef() { return exceptionByteArrayRef; } protected byte[] getUtf8Bytes(String str) { if (str == null) { return null; } try { return str.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { throw new ActivitiException("UTF-8 is not a supported encoding"); } } @Override public String toString() { return getClass().getName() + " [id=" + id + "]"; } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\persistence\entity\AbstractJobEntityImpl.java
1
请完成以下Java代码
public @Nullable Instant getInstant(String key) { String s = get(key); if (s != null) { try { return Instant.ofEpochMilli(Long.parseLong(s)); } catch (NumberFormatException ex) { // Not valid epoch time } } return null; } @Override public Iterator<Entry> iterator() { return new PropertiesIterator(this.entries); } /** * Return a {@link PropertySource} of this instance. * @return a {@link PropertySource} */ public PropertySource<?> toPropertySource() { return new PropertiesPropertySource(getClass().getSimpleName(), copy(this.entries)); } private Properties copy(Properties properties) { Properties copy = new Properties(); copy.putAll(properties); return copy; } private static final class PropertiesIterator implements Iterator<Entry> { private final Iterator<Map.Entry<Object, Object>> iterator; private PropertiesIterator(Properties properties) { this.iterator = properties.entrySet().iterator(); } @Override
public boolean hasNext() { return this.iterator.hasNext(); } @Override public Entry next() { Map.Entry<Object, Object> entry = this.iterator.next(); return new Entry((String) entry.getKey(), (String) entry.getValue()); } @Override public void remove() { throw new UnsupportedOperationException("InfoProperties are immutable."); } } /** * Property entry. */ public static final class Entry { private final String key; private final String value; private Entry(String key, String value) { this.key = key; this.value = value; } public String getKey() { return this.key; } public String getValue() { return this.value; } } }
repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\info\InfoProperties.java
1
请完成以下Java代码
public java.lang.String getName() { return get_ValueAsString(COLUMNNAME_Name); } @Override public void setProcessing (final boolean Processing) { set_Value (COLUMNNAME_Processing, Processing); } @Override public boolean isProcessing() { return get_ValueAsBoolean(COLUMNNAME_Processing); } @Override public void setRevision (final @Nullable java.lang.String Revision) { set_Value (COLUMNNAME_Revision, Revision); } @Override public java.lang.String getRevision() { return get_ValueAsString(COLUMNNAME_Revision); } @Override public void setValidFrom (final @Nullable java.sql.Timestamp ValidFrom) { set_Value (COLUMNNAME_ValidFrom, ValidFrom); } @Override public java.sql.Timestamp getValidFrom() { return get_ValueAsTimestamp(COLUMNNAME_ValidFrom);
} @Override public void setValidTo (final @Nullable java.sql.Timestamp ValidTo) { set_Value (COLUMNNAME_ValidTo, ValidTo); } @Override public java.sql.Timestamp getValidTo() { return get_ValueAsTimestamp(COLUMNNAME_ValidTo); } @Override public void setValue (final java.lang.String Value) { set_Value (COLUMNNAME_Value, Value); } @Override public java.lang.String getValue() { return get_ValueAsString(COLUMNNAME_Value); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_DD_NetworkDistribution.java
1
请完成以下Java代码
public class PaySelectionModeByPaySelectionTrxTypeValRule extends AbstractJavaValidationRule { private static final String PARAM_PaySelectionTrxType = I_C_PaySelection.COLUMNNAME_PaySelectionTrxType; private static final ImmutableSet<String> PARAMETERS = ImmutableSet.of(PARAM_PaySelectionTrxType); @Override public Set<String> getParameters(@Nullable final String contextTableName) { return PARAMETERS; } @Override public boolean accept(@Nullable final IValidationContext evalCtx, @Nullable final NamePair item) { final PaySelectionTrxType trxType = extractPaySelectionTrxType(evalCtx); if (trxType == null) { return true; } final PaySelectionMatchingMode paySelectionMatchingMode = extractPaySelectionMatchingMode(item); if (paySelectionMatchingMode == null) { return false; } return paySelectionMatchingMode.isCompatibleWith(trxType); } @Contract("null -> false") private static boolean isContextAvailable(@Nullable final IValidationContext evalCtx) { return evalCtx != IValidationContext.NULL && evalCtx != IValidationContext.DISABLED;
} @Nullable private static PaySelectionTrxType extractPaySelectionTrxType(@Nullable final IValidationContext evalCtx) { if (!isContextAvailable(evalCtx)) { return null; } final String code = evalCtx.get_ValueAsString(PARAM_PaySelectionTrxType); if (Check.isBlank(code)) { return null; } return PaySelectionTrxType.ofCode(code); } @Nullable private static PaySelectionMatchingMode extractPaySelectionMatchingMode(@Nullable final NamePair item) { return item != null ? PaySelectionMatchingMode.ofNullableCode(item.getID()) : null; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.base\src\main\java\de\metas\banking\payment\PaySelectionModeByPaySelectionTrxTypeValRule.java
1
请完成以下Java代码
public IFacetCategory getFacetCategory() { return facetCategory; } public static class Builder<ModelType> { private String id = null; private String displayName; private IQueryFilter<ModelType> filter; private IFacetCategory facetCategory; private Builder() { super(); } public Facet<ModelType> build() { return new Facet<>(this); } public Builder<ModelType> setId(final String id) { this.id = id; return this; } public Builder<ModelType> setDisplayName(final String displayName) {
this.displayName = displayName; return this; } public Builder<ModelType> setFilter(final IQueryFilter<ModelType> filter) { this.filter = filter; return this; } public Builder<ModelType> setFacetCategory(final IFacetCategory facetCategory) { this.facetCategory = facetCategory; return this; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\facet\impl\Facet.java
1
请在Spring Boot框架中完成以下Java代码
public String getUrl() { return url; } public void setContentUrl(String contentUrl) { this.contentUrl = contentUrl; } @ApiModelProperty(example = "http://localhost:8081/flowable-rest/service/cmmn-repository/deployments/10/resourcedata/diagrams%2Fmy-process.bpmn20.xml") public String getContentUrl() { return contentUrl; } public void setMediaType(String mimeType) { this.mediaType = mimeType; }
@ApiModelProperty(example = "text/xml", value = "Contains the media-type the resource has. This is resolved using a (pluggable) MediaTypeResolver and contains, by default, a limited number of mime-type mappings.") public String getMediaType() { return mediaType; } public void setType(String type) { this.type = type; } @ApiModelProperty(example = "processDefinition", value = "Type of resource", allowableValues = "resource,processDefinition,processImage") public String getType() { return type; } }
repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\repository\DeploymentResourceResponse.java
2
请完成以下Java代码
public static boolean isWeek(final I_C_UOM uom) { final X12DE355 x12de355 = X12DE355.ofNullableCode(uom.getX12DE355()); return X12DE355.WEEK.equals(x12de355); } public static boolean isMonth(final I_C_UOM uom) { final X12DE355 x12de355 = X12DE355.ofNullableCode(uom.getX12DE355()); return X12DE355.MONTH.equals(x12de355); } public static boolean isWorkMonth(final I_C_UOM uom) { final X12DE355 x12de355 = X12DE355.ofNullableCode(uom.getX12DE355()); return X12DE355.MONTH_WORK.equals(x12de355); } public static boolean isYear(final I_C_UOM uom) { final X12DE355 x12de355 = X12DE355.ofNullableCode(uom.getX12DE355()); return X12DE355.YEAR.equals(x12de355); }
/** * @return true if is time UOM */ public static boolean isTime(final I_C_UOM uom) { final X12DE355 x12de355 = X12DE355.ofCode(uom.getX12DE355()); return x12de355.isTemporalUnit(); } @NonNull public static TemporalUnit toTemporalUnit(final I_C_UOM uom) { final X12DE355 x12de355 = X12DE355.ofCode(uom.getX12DE355()); return x12de355.getTemporalUnit(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\uom\UOMUtil.java
1
请完成以下Java代码
public void setDescription (String Description) { set_Value (COLUMNNAME_Description, Description); } /** Get Description. @return Optional short description of the record */ public String getDescription () { return (String)get_Value(COLUMNNAME_Description); } /** Set Comment/Help. @param Help Comment or Hint */ public void setHelp (String Help) { set_Value (COLUMNNAME_Help, Help); } /** Get Comment/Help. @return Comment or Hint */ public String getHelp () { return (String)get_Value(COLUMNNAME_Help); } /** Set Employee. @param IsEmployee Indicates if this Business Partner is an employee */ public void setIsEmployee (boolean IsEmployee) { set_Value (COLUMNNAME_IsEmployee, Boolean.valueOf(IsEmployee)); } /** Get Employee. @return Indicates if this Business Partner is an employee */
public boolean isEmployee () { Object oo = get_Value(COLUMNNAME_IsEmployee); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Name. @param Name Alphanumeric identifier of the entity */ public void setName (String Name) { set_Value (COLUMNNAME_Name, Name); } /** Get Name. @return Alphanumeric identifier of the entity */ public String getName () { return (String)get_Value(COLUMNNAME_Name); } /** Get Record ID/ColumnName @return ID/ColumnName pair */ public KeyNamePair getKeyNamePair() { return new KeyNamePair(get_ID(), getName()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Job.java
1
请完成以下Java代码
public int hashCode() { int result = this.permission.hashCode(); result = 31 * result + ((this.id != null) ? this.id.hashCode() : 0); result = 31 * result + (this.sid.hashCode()); result = 31 * result + (this.auditFailure ? 1 : 0); result = 31 * result + (this.auditSuccess ? 1 : 0); result = 31 * result + (this.granting ? 1 : 0); return result; } @Override public Acl getAcl() { return this.acl; } @Override public Serializable getId() { return this.id; } @Override public Permission getPermission() { return this.permission; } @Override public Sid getSid() { return this.sid; } @Override public boolean isAuditFailure() { return this.auditFailure; } @Override public boolean isAuditSuccess() { return this.auditSuccess; } @Override public boolean isGranting() { return this.granting; } void setAuditFailure(boolean auditFailure) { this.auditFailure = auditFailure;
} void setAuditSuccess(boolean auditSuccess) { this.auditSuccess = auditSuccess; } void setPermission(Permission permission) { Assert.notNull(permission, "Permission required"); this.permission = permission; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("AccessControlEntryImpl["); sb.append("id: ").append(this.id).append("; "); sb.append("granting: ").append(this.granting).append("; "); sb.append("sid: ").append(this.sid).append("; "); sb.append("permission: ").append(this.permission).append("; "); sb.append("auditSuccess: ").append(this.auditSuccess).append("; "); sb.append("auditFailure: ").append(this.auditFailure); sb.append("]"); return sb.toString(); } }
repos\spring-security-main\acl\src\main\java\org\springframework\security\acls\domain\AccessControlEntryImpl.java
1
请完成以下Java代码
public class CmmnDiBoundsXmlConverter extends BaseCmmnXmlConverter { @Override public String getXMLElementName() { return CmmnXmlConstants.ELEMENT_DI_BOUNDS; } @Override public boolean hasChildElements() { return false; } @Override protected BaseElement convert(XMLStreamReader xtr, ConversionHelper conversionHelper) { // If this Bounds element is in a Label element, there will be a currentLabelGraphicInfo available GraphicInfo graphicInfo = null; if (conversionHelper.getCurrentLabelGraphicInfo() != null) { graphicInfo = conversionHelper.getCurrentLabelGraphicInfo();
if (conversionHelper.getCurrentDiEdge() != null) { conversionHelper.getCurrentDiEdge().setLabelGraphicInfo(graphicInfo); } else if (conversionHelper.getCurrentDiShape() != null) { conversionHelper.getCurrentDiShape().setLabelGraphicInfo(graphicInfo); } } else { graphicInfo = new GraphicInfo(); conversionHelper.getCurrentDiShape().setGraphicInfo(graphicInfo); } graphicInfo.setX(Double.valueOf(xtr.getAttributeValue(null, CmmnXmlConstants.ATTRIBUTE_DI_X))); graphicInfo.setY(Double.valueOf(xtr.getAttributeValue(null, CmmnXmlConstants.ATTRIBUTE_DI_Y))); graphicInfo.setWidth(Double.valueOf(xtr.getAttributeValue(null, CmmnXmlConstants.ATTRIBUTE_DI_WIDTH))); graphicInfo.setHeight(Double.valueOf(xtr.getAttributeValue(null, CmmnXmlConstants.ATTRIBUTE_DI_HEIGHT))); return graphicInfo; } }
repos\flowable-engine-main\modules\flowable-cmmn-converter\src\main\java\org\flowable\cmmn\converter\CmmnDiBoundsXmlConverter.java
1
请完成以下Java代码
public class WebSpherePreAuthenticatedProcessingFilter extends AbstractPreAuthenticatedProcessingFilter { private final WASUsernameAndGroupsExtractor wasHelper; /** * Public constructor which overrides the default AuthenticationDetails class to be * used. */ public WebSpherePreAuthenticatedProcessingFilter() { this(new DefaultWASUsernameAndGroupsExtractor()); } WebSpherePreAuthenticatedProcessingFilter(WASUsernameAndGroupsExtractor wasHelper) { this.wasHelper = wasHelper; setAuthenticationDetailsSource(new WebSpherePreAuthenticatedWebAuthenticationDetailsSource()); } /** * Return the WebSphere user name.
*/ @Override protected @Nullable Object getPreAuthenticatedPrincipal(HttpServletRequest httpRequest) { Object principal = this.wasHelper.getCurrentUserName(); this.logger.debug(LogMessage.format("PreAuthenticated WebSphere principal: %s", principal)); return principal; } /** * For J2EE container-based authentication there is no generic way to retrieve the * credentials, as such this method returns a fixed dummy value. */ @Override protected Object getPreAuthenticatedCredentials(HttpServletRequest httpRequest) { return "N/A"; } }
repos\spring-security-main\web\src\main\java\org\springframework\security\web\authentication\preauth\websphere\WebSpherePreAuthenticatedProcessingFilter.java
1
请完成以下Java代码
default void trxLineProcessed(final IHUContext huContext, final I_M_HU_Trx_Line trxLine) { // nothing } /** * Method called after the whole transaction was processed. This default implementation does nothing. * * @param trxHdrRef * @param trxLines */ default void afterTrxProcessed(IReference<I_M_HU_Trx_Hdr> trxHdrRef, List<I_M_HU_Trx_Line> trxLines) { // nothing } /** * Method called when a whole HU Load is completed. This default implementation does nothing. * * NOTE: this is the last method which is called, right before the final result is returned. * * @param huContext * @param loadResults */ default void afterLoad(IHUContext huContext, List<IAllocationResult> loadResults) { // nothing } /** * This default implementation does nothing. * * @param hu handling unit (never null) * @param parentHUItemOld (might be null) */ // TODO: we shall have a proper transaction for this case default void huParentChanged(final I_M_HU hu, final I_M_HU_Item parentHUItemOld) { // nothing }
/** * Called by {@link HULoader} each time a single unload/load transaction was performed. This default implementation does nothing. * * @param huContext * @param unloadTrx * @param loadTrx */ default void onUnloadLoadTransaction(IHUContext huContext, IHUTransactionCandidate unloadTrx, IHUTransactionCandidate loadTrx) { // nothing } /** * Called when a split is performed. This default implementation does nothing. * * @param huContext * @param unloadTrx transaction on source HU * @param loadTrx transaction on destination HU */ default void onSplitTransaction(IHUContext huContext, IHUTransactionCandidate unloadTrx, IHUTransactionCandidate loadTrx) { // nothing } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\hutransaction\IHUTrxListener.java
1
请完成以下Java代码
public class CompensateThrowIconType extends CompensateIconType { @Override public Integer getWidth() { return 15; } @Override public Integer getHeight() { return 16; } @Override public String getFillValue() { return "#585858"; } @Override public void drawIcon(int imageX, int imageY, int iconPadding, ProcessDiagramSVGGraphics2D svgGenerator) { Element gTag = svgGenerator.getDOMFactory().createElementNS(null, SVGGraphics2D.SVG_G_TAG); gTag.setAttributeNS(null, "transform", "translate(" + (imageX - 8) + "," + (imageY - 6) + ")"); Element polygonTag1 = svgGenerator.getDOMFactory().createElementNS(null, SVGGraphics2D.SVG_POLYGON_TAG); polygonTag1.setAttributeNS(null, "points", "14 8 14 22 7 15 "); polygonTag1.setAttributeNS(null, "fill", this.getFillValue());
polygonTag1.setAttributeNS(null, "stroke", this.getStrokeValue()); polygonTag1.setAttributeNS(null, "stroke-width", this.getStrokeWidth()); polygonTag1.setAttributeNS(null, "stroke-linecap", "butt"); polygonTag1.setAttributeNS(null, "stroke-linejoin", "miter"); polygonTag1.setAttributeNS(null, "stroke-miterlimit", "10"); gTag.appendChild(polygonTag1); Element polygonTag2 = svgGenerator.getDOMFactory().createElementNS(null, SVGGraphics2D.SVG_POLYGON_TAG); polygonTag2.setAttributeNS(null, "points", "21 8 21 22 14 15 "); polygonTag2.setAttributeNS(null, "fill", this.getFillValue()); polygonTag2.setAttributeNS(null, "stroke", this.getStrokeValue()); polygonTag2.setAttributeNS(null, "stroke-width", this.getStrokeWidth()); polygonTag2.setAttributeNS(null, "stroke-linecap", "butt"); polygonTag2.setAttributeNS(null, "stroke-linejoin", "miter"); polygonTag2.setAttributeNS(null, "stroke-miterlimit", "10"); gTag.appendChild(polygonTag2); svgGenerator.getExtendDOMGroupManager().addElement(gTag); } }
repos\Activiti-develop\activiti-core\activiti-image-generator\src\main\java\org\activiti\image\impl\icon\CompensateThrowIconType.java
1
请完成以下Java代码
public void setExitCriterion(ExitCriterion exitCriterion) { exitCriterionRefAttribute.setReferenceTargetElement(this, exitCriterion); } public PlanItem getSource() { return sourceRefAttribute.getReferenceTargetElement(this); } public void setSource(PlanItem source) { sourceRefAttribute.setReferenceTargetElement(this, source); } public PlanItemTransition getStandardEvent() { PlanItemTransitionStandardEvent child = standardEventChild.getChild(this); return child.getValue(); } public void setStandardEvent(PlanItemTransition standardEvent) { PlanItemTransitionStandardEvent child = standardEventChild.getChild(this); child.setValue(standardEvent); } public static void registerType(ModelBuilder modelBuilder) { ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(PlanItemOnPart.class, CMMN_ELEMENT_PLAN_ITEM_ON_PART) .extendsType(OnPart.class) .namespaceUri(CMMN11_NS) .instanceProvider(new ModelTypeInstanceProvider<PlanItemOnPart>() { public PlanItemOnPart newInstance(ModelTypeInstanceContext instanceContext) { return new PlanItemOnPartImpl(instanceContext); } });
sourceRefAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_SOURCE_REF) .idAttributeReference(PlanItem.class) .build(); exitCriterionRefAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_EXIT_CRITERION_REF) .idAttributeReference(ExitCriterion.class) .build(); sentryRefAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_SENTRY_REF) .namespace(CMMN10_NS) .idAttributeReference(Sentry.class) .build(); SequenceBuilder sequenceBuilder = typeBuilder.sequence(); standardEventChild = sequenceBuilder.element(PlanItemTransitionStandardEvent.class) .build(); typeBuilder.build(); } }
repos\camunda-bpm-platform-master\model-api\cmmn-model\src\main\java\org\camunda\bpm\model\cmmn\impl\instance\PlanItemOnPartImpl.java
1
请完成以下Java代码
public String getEventName() { return eventName; } /** * Unique id of this path of execution that can be used as a handle to provide * external signals back into the engine after wait states. */ public String getId() { return id; } /** * return the Id of the parent activity instance currently executed by this * execution */ public String getParentActivityInstanceId() { return parentActivityInstanceId; } /** * Gets the id of the parent of this execution. If null, the execution * represents a process-instance. */ public String getParentId() { return parentId; } /** * The business key for the process instance this execution is associated * with. */ public String getProcessBusinessKey() { return processBusinessKey; } /** * The process definition key for the process instance this execution is * associated with. */ public String getProcessDefinitionId() { return processDefinitionId; } /** Reference to the overall process instance */ public String getProcessInstanceId() { return processInstanceId; }
/** * Return the id of the tenant this execution belongs to. Can be * <code>null</code> if the execution belongs to no single tenant. */ public String getTenantId() { return tenantId; } @Override public String toString() { return this.getClass().getSimpleName() + "[id=" + id + ", eventName=" + eventName + ", businessKey=" + businessKey + ", activityInstanceId=" + activityInstanceId + ", currentActivityId=" + currentActivityId + ", currentActivityName=" + currentActivityName + ", currentTransitionId=" + currentTransitionId + ", parentActivityInstanceId=" + parentActivityInstanceId + ", parentId=" + parentId + ", processBusinessKey=" + processBusinessKey + ", processDefinitionId=" + processDefinitionId + ", processInstanceId=" + processInstanceId + ", tenantId=" + tenantId + "]"; } }
repos\camunda-bpm-platform-master\spring-boot-starter\starter\src\main\java\org\camunda\bpm\spring\boot\starter\event\ExecutionEvent.java
1
请完成以下Java代码
public void cacheInvalidate() { labelsValuesLookupDataSource.cacheInvalidate(); } @Override public boolean isHighVolume() { return false; } @Override public LookupSource getLookupSourceType() { return LookupSource.lookup; } @Override public boolean hasParameters() { return true; } @Override public Set<String> getDependsOnFieldNames() { return CtxNames.toNames(parameters); } @Override public boolean isNumericKey() { return false; } @Override public LookupDataSourceFetcher getLookupDataSourceFetcher() { return this; } @Override public LookupDataSourceContext.Builder newContextForFetchingById(final Object id) { return LookupDataSourceContext.builder(tableName) .putFilterById(IdsToFilter.ofSingleValue(id)); } @Override public LookupValue retrieveLookupValueById(final @NonNull LookupDataSourceContext evalCtx) { final Object id = evalCtx.getSingleIdToFilterAsObject(); if (id == null) { throw new IllegalStateException("No ID provided in " + evalCtx); } return labelsValuesLookupDataSource.findById(id); } @Override public LookupDataSourceContext.Builder newContextForFetchingList() { return LookupDataSourceContext.builder(tableName) .setRequiredParameters(parameters) .requiresAD_Language() .requiresUserRolePermissionsKey(); } @Override
public LookupValuesPage retrieveEntities(final LookupDataSourceContext evalCtx) { final String filter = evalCtx.getFilter(); return labelsValuesLookupDataSource.findEntities(evalCtx, filter); } public Set<Object> normalizeStringIds(final Set<String> stringIds) { if (stringIds.isEmpty()) { return ImmutableSet.of(); } if (isLabelsValuesUseNumericKey()) { return stringIds.stream() .map(LabelsLookup::convertToInt) .collect(ImmutableSet.toImmutableSet()); } else { return ImmutableSet.copyOf(stringIds); } } private static int convertToInt(final String stringId) { try { return Integer.parseInt(stringId); } catch (final Exception ex) { throw new AdempiereException("Failed converting `" + stringId + "` to int.", ex); } } public ColumnSql getSqlForFetchingValueIdsByLinkId(@NonNull final String tableNameOrAlias) { final String sql = "SELECT array_agg(" + labelsValueColumnName + ")" + " FROM " + labelsTableName + " WHERE " + labelsLinkColumnName + "=" + tableNameOrAlias + "." + linkColumnName + " AND IsActive='Y'"; return ColumnSql.ofSql(sql, tableNameOrAlias); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\model\lookup\LabelsLookup.java
1
请在Spring Boot框架中完成以下Java代码
public ApiResponse<CustomerMapping> updatePatientWithHttpInfo(Patient body, String albertaApiKey, String id) throws ApiException { com.squareup.okhttp.Call call = updatePatientValidateBeforeCall(body, albertaApiKey, id, null, null); Type localVarReturnType = new TypeToken<CustomerMapping>(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Patient ändern (asynchronously) * Szenario - ein Patient wurde im WaWi geändert und diese Änderungen sollen in Alberta übertragen werden ----- Aufruf &#x3D;&gt; patient/[patientenId] * @param body Der Patient (required) * @param albertaApiKey (required) * @param id die Id des zu ändernden Patienten (required) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call updatePatientAsync(Patient body, String albertaApiKey, String id, final ApiCallback<CustomerMapping> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override
public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = updatePatientValidateBeforeCall(body, albertaApiKey, id, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<CustomerMapping>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\alberta\alberta-patient-api\src\main\java\io\swagger\client\api\PatientApi.java
2
请完成以下Java代码
public static SqlParamsCollector wrapNullable(@Nullable final List<Object> list) { if (list == null) { return NOT_COLLECTING; } return new SqlParamsCollector(list); } /** An {@link SqlParamsCollector} which is actually not collecting the parameters but it's automatically translating it to SQL code. */ public static SqlParamsCollector notCollecting() { return NOT_COLLECTING; } private static final SqlParamsCollector NOT_COLLECTING = new SqlParamsCollector(null); private final List<Object> params; private final List<Object> paramsRO; private SqlParamsCollector(final List<Object> params) { this.params = params; paramsRO = params != null ? Collections.unmodifiableList(params) : null; } @Override public String toString() { return MoreObjects.toStringHelper(this) .addValue(paramsRO) .toString(); } public boolean isCollecting() { return params != null; } /** * Directly append all sqlParams from the given {@code sqlQueryFilter}. * * @param sqlQueryFilter * */ public void collectAll(@NonNull final ISqlQueryFilter sqlQueryFilter) { final List<Object> sqlParams = sqlQueryFilter.getSqlParams(Env.getCtx()); collectAll(sqlParams); } /** * Directly append the given {@code sqlParams}. Please prefer using {@link #placeholder(Object)} instead.<br> * "Package" scope because currently this method is needed only by {@link SqlDefaultDocumentFilterConverter}. * * Please avoid using it. It's used mainly to adapt with old code * * @param sqlParams */ public void collectAll(@Nullable final Collection<? extends Object> sqlParams) { if (sqlParams == null || sqlParams.isEmpty()) { return; } if (params == null) { throw new IllegalStateException("Cannot append " + sqlParams + " to not collecting params"); } params.addAll(sqlParams); } public void collect(@NonNull final SqlParamsCollector from)
{ collectAll(from.params); } /** * Collects given SQL value and returns an SQL placeholder, i.e. "?" * * In case this is in non-collecting mode, the given SQL value will be converted to SQL code and it will be returned. * The internal list won't be affected, because it does not exist. */ public String placeholder(@Nullable final Object sqlValue) { if (params == null) { return DB.TO_SQL(sqlValue); } else { params.add(sqlValue); return "?"; } } /** @return readonly live list */ public List<Object> toList() { return paramsRO; } /** @return read/write live list */ public List<Object> toLiveList() { return params; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\document\filter\sql\SqlParamsCollector.java
1
请完成以下Java代码
public void setM_PriceList_ID (int M_PriceList_ID) { if (M_PriceList_ID < 1) set_Value (COLUMNNAME_M_PriceList_ID, null); else set_Value (COLUMNNAME_M_PriceList_ID, Integer.valueOf(M_PriceList_ID)); } /** Get Price List. @return Unique identifier of a Price List */ public int getM_PriceList_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_PriceList_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Session ID. @param Session_ID Session ID */ public void setSession_ID (int Session_ID) { if (Session_ID < 1) set_Value (COLUMNNAME_Session_ID, null); else set_Value (COLUMNNAME_Session_ID, Integer.valueOf(Session_ID)); } /** Get Session ID. @return Session ID */ public int getSession_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_Session_ID); if (ii == null) return 0; return ii.intValue(); } /** Get Record ID/ColumnName @return ID/ColumnName pair */ public KeyNamePair getKeyNamePair() { return new KeyNamePair(get_ID(), String.valueOf(getSession_ID())); }
/** Set W_Basket_ID. @param W_Basket_ID Web Basket */ public void setW_Basket_ID (int W_Basket_ID) { if (W_Basket_ID < 1) set_ValueNoCheck (COLUMNNAME_W_Basket_ID, null); else set_ValueNoCheck (COLUMNNAME_W_Basket_ID, Integer.valueOf(W_Basket_ID)); } /** Get W_Basket_ID. @return Web Basket */ public int getW_Basket_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_W_Basket_ID); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_W_Basket.java
1
请完成以下Java代码
public void setPayPal_OrderJSON (final @Nullable java.lang.String PayPal_OrderJSON) { set_Value (COLUMNNAME_PayPal_OrderJSON, PayPal_OrderJSON); } @Override public java.lang.String getPayPal_OrderJSON() { return get_ValueAsString(COLUMNNAME_PayPal_OrderJSON); } @Override public void setPayPal_PayerApproveUrl (final @Nullable java.lang.String PayPal_PayerApproveUrl) { set_Value (COLUMNNAME_PayPal_PayerApproveUrl, PayPal_PayerApproveUrl); } @Override public java.lang.String getPayPal_PayerApproveUrl() {
return get_ValueAsString(COLUMNNAME_PayPal_PayerApproveUrl); } @Override public void setStatus (final java.lang.String Status) { set_Value (COLUMNNAME_Status, Status); } @Override public java.lang.String getStatus() { return get_ValueAsString(COLUMNNAME_Status); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.paypal\src\main\java-gen\de\metas\payment\paypal\model\X_PayPal_Order.java
1
请完成以下Java代码
private static void assertNotAlreadyShipped(final I_M_ShipmentSchedule_QtyPicked qtyPickedRecord, @NonNull final HuId huIdInScope) { if (qtyPickedRecord.getM_InOutLine_ID() > 0) { throw new AdempiereException( MSG_WEBUI_PICKING_ALREADY_SHIPPED_2P, huIdInScope.getRepoId(), qtyPickedRecord.getM_InOutLine().getM_InOut().getDocumentNo()); } } @Override public WarehouseId getWarehouseId(@NonNull final de.metas.inoutcandidate.model.I_M_ShipmentSchedule schedule) { return shipmentScheduleEffectiveBL.getWarehouseId(schedule); } @Override public BPartnerId getBPartnerId(@NonNull final de.metas.inoutcandidate.model.I_M_ShipmentSchedule schedule) { return shipmentScheduleEffectiveBL.getBPartnerId(schedule); } @Override public Quantity getQtyToDeliver(final de.metas.inoutcandidate.model.I_M_ShipmentSchedule schedule) { return shipmentScheduleBL.getQtyToDeliver(schedule); } @Override public Quantity getQtyScheduledForPicking(@NonNull final de.metas.inoutcandidate.model.I_M_ShipmentSchedule shipmentScheduleRecord) { return shipmentScheduleBL.getQtyScheduledForPicking(shipmentScheduleRecord); } @Override public Quantity getQtyRemainingToScheduleForPicking(@NonNull final de.metas.inoutcandidate.model.I_M_ShipmentSchedule shipmentScheduleRecord) { return shipmentScheduleBL.getQtyRemainingToScheduleForPicking(shipmentScheduleRecord); } @Override
public void flagForRecompute(@NonNull final Set<ShipmentScheduleId> shipmentScheduleIds) { if (shipmentScheduleIds.isEmpty()) {return;} final IShipmentScheduleInvalidateBL invalidSchedulesService = Services.get(IShipmentScheduleInvalidateBL.class); invalidSchedulesService.flagForRecompute(shipmentScheduleIds); } @Override public ShipmentScheduleLoadingCache<I_M_ShipmentSchedule> newLoadingCache() { return shipmentScheduleBL.newLoadingCache(I_M_ShipmentSchedule.class); } @Nullable @Override public ProjectId extractSingleProjectIdOrNull(@NonNull final List<ShipmentScheduleWithHU> candidates) { final Set<ProjectId> projectIdsFromShipmentSchedules = candidates.stream() .map(ShipmentScheduleWithHU::getProjectId) .filter(Objects::nonNull) .collect(Collectors.toSet()); if (projectIdsFromShipmentSchedules.size() == 1) { return projectIdsFromShipmentSchedules.iterator().next(); } return null; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\shipmentschedule\api\impl\HUShipmentScheduleBL.java
1
请完成以下Java代码
public String submit(@Valid @ModelAttribute("person") final Person person, final BindingResult result, final ModelMap modelMap, final Model model) { validator.validate(person, result); if (result.hasErrors()) { initData(model); return "personForm"; } modelMap.addAttribute("person", person); return "personView"; } private void initData(final Model model) { final List<String> favouriteLanguageItem = new ArrayList<String>(); favouriteLanguageItem.add("Java"); favouriteLanguageItem.add("C++"); favouriteLanguageItem.add("Perl"); model.addAttribute("favouriteLanguageItem", favouriteLanguageItem); final List<String> jobItem = new ArrayList<String>(); jobItem.add("Full time"); jobItem.add("Part time"); model.addAttribute("jobItem", jobItem); final Map<String, String> countryItems = new LinkedHashMap<String, String>(); countryItems.put("US", "United Stated"); countryItems.put("IT", "Italy");
countryItems.put("UK", "United Kingdom"); countryItems.put("FR", "Grance"); model.addAttribute("countryItems", countryItems); final List<String> fruit = new ArrayList<String>(); fruit.add("Banana"); fruit.add("Mango"); fruit.add("Apple"); model.addAttribute("fruit", fruit); final List<String> books = new ArrayList<String>(); books.add("The Great Gatsby"); books.add("Nineteen Eighty-Four"); books.add("The Lord of the Rings"); model.addAttribute("books", books); } }
repos\tutorials-master\spring-web-modules\spring-mvc-xml-2\src\main\java\com\baeldung\spring\taglibrary\PersonController.java
1
请在Spring Boot框架中完成以下Java代码
public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> implements IRegionService { public static final int PROVINCE_LEVEL = 1; public static final int CITY_LEVEL = 2; public static final int DISTRICT_LEVEL = 3; public static final int TOWN_LEVEL = 4; public static final int VILLAGE_LEVEL = 5; @Override public boolean submit(Region region) { Long cnt = baseMapper.selectCount(Wrappers.<Region>query().lambda().eq(Region::getCode, region.getCode())); if (cnt > 0) { return this.updateById(region); } // 设置祖区划编号 Region parent = baseMapper.selectById(region.getParentCode()); if (Func.isNotEmpty(parent) || Func.isNotEmpty(parent.getCode())) { String ancestors = parent.getAncestors() + StringPool.COMMA + parent.getCode(); region.setAncestors(ancestors); } // 设置省、市、区、镇、村 Integer level = region.getLevel(); String code = region.getCode(); String name = region.getName(); if (level == PROVINCE_LEVEL) { region.setProvinceCode(code); region.setProvinceName(name); } else if (level == CITY_LEVEL) { region.setCityCode(code); region.setCityName(name); } else if (level == DISTRICT_LEVEL) { region.setDistrictCode(code); region.setDistrictName(name); } else if (level == TOWN_LEVEL) { region.setTownCode(code); region.setTownName(name); } else if (level == VILLAGE_LEVEL) { region.setVillageCode(code); region.setVillageName(name);
} return this.save(region); } @Override public boolean removeRegion(String id) { Long cnt = baseMapper.selectCount(Wrappers.<Region>query().lambda().eq(Region::getParentCode, id)); if (cnt > 0) { throw new ServiceException("请先删除子节点!"); } return removeById(id); } @Override public List<RegionVO> lazyList(String parentCode, Map<String, Object> param) { return baseMapper.lazyList(parentCode, param); } @Override public List<RegionVO> lazyTree(String parentCode, Map<String, Object> param) { return baseMapper.lazyTree(parentCode, param); } }
repos\SpringBlade-master\blade-service\blade-system\src\main\java\org\springblade\system\service\impl\RegionServiceImpl.java
2
请完成以下Java代码
public boolean isPeanuts() { return peanuts; } public void setPeanuts(boolean peanuts) { this.peanuts = peanuts; } public boolean isCelery() { return celery; } public void setCelery(boolean celery) { this.celery = celery; }
public boolean isSesameSeeds() { return sesameSeeds; } public void setSesameSeeds(boolean sesameSeeds) { this.sesameSeeds = sesameSeeds; } @Override public String toString() { return "AllergensAsEmbeddable [peanuts=" + peanuts + ", celery=" + celery + ", sesameSeeds=" + sesameSeeds + "]"; } }
repos\tutorials-master\persistence-modules\java-jpa-2\src\main\java\com\baeldung\jpa\multipletables\secondarytable\embeddable\AllergensAsEmbeddable.java
1
请在Spring Boot框架中完成以下Java代码
public class SyncRfQQtyChangeEvent implements IConfirmableDTO { String uuid; boolean deleted; long syncConfirmationId; String rfq_uuid; LocalDate day; String product_uuid; BigDecimal qty; @Builder(toBuilder = true) @JsonCreator private SyncRfQQtyChangeEvent( @JsonProperty("uuid") final String uuid, @JsonProperty("deleted") final boolean deleted, @JsonProperty("syncConfirmationId") final long syncConfirmationId, @JsonProperty("rfq_uuid") final String rfq_uuid, @JsonProperty("day") final LocalDate day, @JsonProperty("product_uuid") final String product_uuid, @JsonProperty("qty") final BigDecimal qty) { this.uuid = uuid;
this.deleted = deleted; this.syncConfirmationId = syncConfirmationId; this.rfq_uuid = rfq_uuid; this.day = day; this.product_uuid = product_uuid; this.qty = qty; } @Override public IConfirmableDTO withNotDeleted() { return toBuilder().deleted(false).build(); } }
repos\metasfresh-new_dawn_uat\misc\de-metas-common\de-metas-common-procurement\src\main\java\de\metas\common\procurement\sync\protocol\dto\SyncRfQQtyChangeEvent.java
2
请完成以下Java代码
public void setTargetRef(String targetRef) { this.targetRef = targetRef; } public String getSkipExpression() { return skipExpression; } public void setSkipExpression(String skipExpression) { this.skipExpression = skipExpression; } public FlowElement getSourceFlowElement() { return sourceFlowElement; } public void setSourceFlowElement(FlowElement sourceFlowElement) { this.sourceFlowElement = sourceFlowElement; } public FlowElement getTargetFlowElement() { return targetFlowElement; } public void setTargetFlowElement(FlowElement targetFlowElement) { this.targetFlowElement = targetFlowElement; } public List<Integer> getWaypoints() {
return waypoints; } public void setWaypoints(List<Integer> waypoints) { this.waypoints = waypoints; } public String toString() { return sourceRef + " --> " + targetRef; } public SequenceFlow clone() { SequenceFlow clone = new SequenceFlow(); clone.setValues(this); return clone; } public void setValues(SequenceFlow otherFlow) { super.setValues(otherFlow); setConditionExpression(otherFlow.getConditionExpression()); setSourceRef(otherFlow.getSourceRef()); setTargetRef(otherFlow.getTargetRef()); setSkipExpression(otherFlow.getSkipExpression()); } }
repos\Activiti-develop\activiti-core\activiti-bpmn-model\src\main\java\org\activiti\bpmn\model\SequenceFlow.java
1
请在Spring Boot框架中完成以下Java代码
public List<TrackingInfo> getReturnShipmentTracking() { return returnShipmentTracking; } public void setReturnShipmentTracking(List<TrackingInfo> returnShipmentTracking) { this.returnShipmentTracking = returnShipmentTracking; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } InfoFromBuyer infoFromBuyer = (InfoFromBuyer)o; return Objects.equals(this.note, infoFromBuyer.note) && Objects.equals(this.returnShipmentTracking, infoFromBuyer.returnShipmentTracking); } @Override public int hashCode() { return Objects.hash(note, returnShipmentTracking); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class InfoFromBuyer {\n"); sb.append(" note: ").append(toIndentedString(note)).append("\n"); sb.append(" returnShipmentTracking: ").append(toIndentedString(returnShipmentTracking)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\de-metas-camel-ebay\ebay-api-client\src\main\java\de\metas\camel\externalsystems\ebay\api\model\InfoFromBuyer.java
2
请在Spring Boot框架中完成以下Java代码
protected PmsOperator getPmsOperator() { PmsOperator operator = (PmsOperator) this.getSession().getAttribute("PmsOperator"); return operator; } /** * 响应DWZ的ajax失败请求,跳转到ajaxDone视图. * * @param message * 提示消息. * @param model * model. * @return ajaxDone . */ protected String operateError(String message, Model model) { DwzAjax dwz = new DwzAjax(); dwz.setStatusCode(DWZ.ERROR); dwz.setMessage(message); model.addAttribute("dwz", dwz); return "common/ajaxDone"; } /** * 响应DWZ的ajax失败成功,跳转到ajaxDone视图.
* * @param model * model. * @param dwz * 页面传过来的dwz参数 * @return ajaxDone . */ protected String operateSuccess(Model model, DwzAjax dwz) { dwz.setStatusCode(DWZ.SUCCESS); dwz.setMessage("操作成功"); model.addAttribute("dwz", dwz); return "common/ajaxDone"; } }
repos\roncoo-pay-master\roncoo-pay-web-boss\src\main\java\com\roncoo\pay\controller\common\BaseController.java
2
请完成以下Java代码
protected void flattenTree() { flattenedList = new LinkedList<ExecutionTreeNode>(); LinkedList<ExecutionTreeNode> nodesToHandle = new LinkedList<ExecutionTreeNode>(); nodesToHandle.add(rootNode); while (!nodesToHandle.isEmpty()) { ExecutionTreeNode currentNode = nodesToHandle.pop(); if (reverseOrder) { flattenedList.addFirst(currentNode); } else { flattenedList.add(currentNode); } if (currentNode.getChildren() != null && currentNode.getChildren().size() > 0) { for (ExecutionTreeNode childNode : currentNode.getChildren()) { nodesToHandle.add(childNode); } } } flattenedListIterator = flattenedList.iterator(); } @Override public boolean hasNext() { if (flattenedList == null) { flattenTree(); }
return flattenedListIterator.hasNext(); } @Override public ExecutionTreeNode next() { if (flattenedList == null) { flattenTree(); } return flattenedListIterator.next(); } @Override public void remove() { if (flattenedList == null) { flattenTree(); } flattenedListIterator.remove(); } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\debug\ExecutionTreeBfsIterator.java
1
请完成以下Java代码
public class Employee { private long id; private String name; private String contactNumber; private String workingArea; public Employee() { super(); } public Employee(final long id, final String name, final String contactNumber, final String workingArea) { this.id = id; this.name = name; this.contactNumber = contactNumber; this.workingArea = workingArea; } public String getName() { return name; } public void setName(final String name) { this.name = name; } public long getId() { return id; } public void setId(final long id) { this.id = id; }
public String getContactNumber() { return contactNumber; } public void setContactNumber(final String contactNumber) { this.contactNumber = contactNumber; } public String getWorkingArea() { return workingArea; } public void setWorkingArea(final String workingArea) { this.workingArea = workingArea; } @Override public String toString() { return "Employee [id=" + id + ", name=" + name + ", contactNumber=" + contactNumber + ", workingArea=" + workingArea + "]"; } }
repos\tutorials-master\spring-web-modules\spring-mvc-basics\src\main\java\com\baeldung\modelattribute\Employee.java
1
请完成以下Java代码
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((maker == null) ? 0 : maker.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((sku == null) ? 0 : sku.hashCode()); result = prime * result + ((year == null) ? 0 : year.hashCode()); return result; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; CarModel other = (CarModel) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (maker == null) { if (other.maker != null) return false;
} else if (!maker.equals(other.maker)) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; if (sku == null) { if (other.sku != null) return false; } else if (!sku.equals(other.sku)) return false; if (year == null) { if (other.year != null) return false; } else if (!year.equals(other.year)) return false; return true; } }
repos\tutorials-master\apache-olingo\src\main\java\com\baeldung\examples\olingo2\domain\CarModel.java
1
请在Spring Boot框架中完成以下Java代码
public static final TransactionalPackingItemSupport getCreate() { final ITrxManager trxManager = Services.get(ITrxManager.class); final ITrx trx = trxManager.getThreadInheritedTrx(OnTrxMissingPolicy.ReturnTrxNone); if (trxManager.isNull(trx)) { // running out of transaction return null; } // // Gets/Creates a new transaction support return trx.getProperty(TRXPROPERTYNAME, new Supplier<TransactionalPackingItemSupport>() { @Override public TransactionalPackingItemSupport get() { return new TransactionalPackingItemSupport(trx); } }); } private final Map<Long, ItemState> items = new LinkedHashMap<>(); private TransactionalPackingItemSupport(final ITrx trx) { // // Register the commit/rollback transaction listeners trx.getTrxListenerManager() .newEventListener(TrxEventTiming.AFTER_COMMIT) .invokeMethodJustOnce(false) // invoke the handling method on *every* commit, because that's how it was and I can't check now if it's really needed .registerHandlingMethod(innerTrx -> commit()); trx.getTrxListenerManager() .newEventListener(TrxEventTiming.AFTER_ROLLBACK) .invokeMethodJustOnce(false) // invoke the handling method on *every* commit, because that's how it was and I can't check now if it's really needed .registerHandlingMethod(innerTrx -> rollback()); } private synchronized void commit() { final List<ItemState> itemsToCommit = new ArrayList<>(items.values()); for (final ItemState item : itemsToCommit) { item.commit(); } items.clear(); } private synchronized void rollback() { items.clear(); } /** * Gets the current state for given transactional item. * * @param item * @return current stateș never returns null. */ public synchronized PackingItem getState(final TransactionalPackingItem item) { final long id = item.getId();
ItemState itemState = items.get(id); if (itemState == null) { itemState = new ItemState(item); items.put(id, itemState); } return itemState.getState(); } /** * Transactional item state holder. * * @author metas-dev <dev@metasfresh.com> * */ private static final class ItemState { private final Reference<TransactionalPackingItem> transactionalItemRef; private final PackingItem state; public ItemState(final TransactionalPackingItem transactionalItem) { super(); // NOTE: we keep a weak reference to our transactional item // because in case nobody is referencing it, there is no point to update on commit. this.transactionalItemRef = new WeakReference<>(transactionalItem); state = transactionalItem.createNewState(); } public PackingItem getState() { return state; } public void commit() { final TransactionalPackingItem transactionalItem = transactionalItemRef.get(); if (transactionalItem == null) { // reference already expired return; } transactionalItem.commit(state); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\picking\service\TransactionalPackingItemSupport.java
2
请在Spring Boot框架中完成以下Java代码
public Boolean getEnableDefaultPwdCheck() { return enableDefaultPwdCheck; } public void setEnableDefaultPwdCheck(Boolean enableDefaultPwdCheck) { this.enableDefaultPwdCheck = enableDefaultPwdCheck; } public Boolean getDataSourceSafe() { return dataSourceSafe; } public void setDataSourceSafe(Boolean dataSourceSafe) { this.dataSourceSafe = dataSourceSafe; } public String getLowCodeMode() { return lowCodeMode; } public void setLowCodeMode(String lowCodeMode) { this.lowCodeMode = lowCodeMode; } public Boolean getDisableSelectAll() {
return disableSelectAll; } public void setDisableSelectAll(Boolean disableSelectAll) { this.disableSelectAll = disableSelectAll; } public Boolean getIsConcurrent() { return isConcurrent; } public void setIsConcurrent(Boolean isConcurrent) { this.isConcurrent = isConcurrent; } }
repos\JeecgBoot-main\jeecg-boot\jeecg-boot-base-core\src\main\java\org\jeecg\config\vo\Firewall.java
2
请完成以下Java代码
public class ESRDataLoaderFactory { public IESRDataImporter createImporter( @NonNull final I_ESR_ImportFile header, @NonNull final InputStream input) { if (X_ESR_ImportFile.DATATYPE_Camt54.equalsIgnoreCase(header.getDataType())) { return new ESRDataImporterCamt54(header, input); } else if (X_ESR_ImportFile.DATATYPE_V11.equalsIgnoreCase(header.getDataType())) { return new ESRDataImporterV11(input); } Check.errorIf(true, "The given ESR_Import has unexpected DataType={}; header={}", header.getDataType(), header); return null; } /** * Tries to guess the {@link I_ESR_Import#COLUMN_DataType} from the given {@code fileName}. May return {@code null}. * * @param fileName * @return
*/ public String guessTypeFromFileName(@NonNull final String fileName) { final boolean isV11FileNameEnding = fileName.matches("(?i).*\\.v11"); if (isV11FileNameEnding) { return X_ESR_Import.DATATYPE_V11; } final boolean isCamtFileNameEnding = fileName.matches("(?i).*\\.(xml|camt|camt\\.?54)"); if (isCamtFileNameEnding) { return X_ESR_Import.DATATYPE_Camt54; } return null; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.esr\src\main\java\de\metas\payment\esr\dataimporter\ESRDataLoaderFactory.java
1
请完成以下Java代码
public ADRefTable retrieveAccountTableRefInfo() { return ADRefTable.builder() .identifier("Account - C_ValidCombination_ID") .tableName(I_C_ValidCombination.Table_Name) .keyColumn(I_C_ValidCombination.COLUMNNAME_C_ValidCombination_ID) .autoComplete(true) .tooltipType(adTableDAO.getTooltipTypeByTableName(I_C_ValidCombination.Table_Name)) .build(); } public boolean existListValue(final int adReferenceId, final String value) { final ADRefListItem item = retrieveListItemOrNull(adReferenceId, value); return item != null; } @Nullable public ColorId getColorId(@NonNull final Object model, @NonNull final String columnName, @Nullable final String refListValue) {
if (Check.isBlank(refListValue)) { return null; } final ReferenceId referenceId = InterfaceWrapperHelper.getPO(model).getPOInfo().getColumnReferenceValueId(columnName); if (referenceId == null) { return null; } final ADRefListItem refListItem = retrieveListItemOrNull(referenceId, refListValue); return refListItem != null ? refListItem.getColorId() : null; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\ad_reference\ADReferenceService.java
1
请完成以下Java代码
protected void attachTo(ExecutionEntity execution) { jobEntity.setExecution(execution); } public void migrateState() { // update activity reference String activityId = targetScope.getId(); jobEntity.setActivityId(activityId); migrateJobHandlerConfiguration(); if (targetJobDefinitionEntity != null) { jobEntity.setJobDefinition(targetJobDefinitionEntity); } // update process definition reference ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) targetScope.getProcessDefinition(); jobEntity.setProcessDefinitionId(processDefinition.getId()); jobEntity.setProcessDefinitionKey(processDefinition.getKey()); // update deployment reference jobEntity.setDeploymentId(processDefinition.getDeploymentId()); } public void migrateDependentEntities() { for (MigratingInstance migratingDependentInstance : migratingDependentInstances) { migratingDependentInstance.migrateState(); } } public void remove() {
jobEntity.delete(); } public boolean migrates() { return targetScope != null; } public ScopeImpl getTargetScope() { return targetScope; } public JobDefinitionEntity getTargetJobDefinitionEntity() { return targetJobDefinitionEntity; } protected abstract void migrateJobHandlerConfiguration(); }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\migration\instance\MigratingJobInstance.java
1
请完成以下Java代码
public class ValidationErrorDecorator { public static final String PARAM_PREFIX = "{{"; public static final String PARAM_SUFFIX = "}}"; private Map<String, ErrorMessageDefinition> errorMessages; public ValidationErrorDecorator() { this.init(); } public void init() { try { ObjectMapper objectMapper = new ObjectMapper(); TypeReference<Map<String, ErrorMessageDefinition>> typeReference = new TypeReference<>() {}; InputStream inputStream = getClass().getResourceAsStream("/process-validation-messages.json"); this.errorMessages = objectMapper.readValue(inputStream, typeReference);
} catch (IOException e) { throw new RuntimeException("Failed to load error messages", e); } } public void decorate(ValidationError error) { error.setProblem(resolveMessage(errorMessages.get(error.getKey()).getProblem(), error.getParams())); error.setDefaultDescription( resolveMessage(errorMessages.get(error.getKey()).getDescription(), error.getParams()) ); } public String resolveMessage(String message, Map<String, String> params) { StringSubstitutor sub = new StringSubstitutor(params, PARAM_PREFIX, PARAM_SUFFIX); return sub.replace(message); } }
repos\Activiti-develop\activiti-core\activiti-process-validation\src\main\java\org\activiti\validation\validator\ValidationErrorDecorator.java
1
请在Spring Boot框架中完成以下Java代码
public String getSign() { return sign; } public void setSign(String sign) { this.sign = sign; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public String getPayType() { return payType; } public void setPayType(String payType) { this.payType = payType; } public Integer getNumberOfStages() { return numberOfStages;
} public void setNumberOfStages(Integer numberOfStages) { this.numberOfStages = numberOfStages; } @Override public String toString() { return "ScanPayRequestBo{" + "payKey='" + payKey + '\'' + ", productName='" + productName + '\'' + ", orderNo='" + orderNo + '\'' + ", orderPrice=" + orderPrice + ", orderIp='" + orderIp + '\'' + ", orderDate='" + orderDate + '\'' + ", orderTime='" + orderTime + '\'' + ", orderPeriod=" + orderPeriod + ", returnUrl='" + returnUrl + '\'' + ", notifyUrl='" + notifyUrl + '\'' + ", sign='" + sign + '\'' + ", remark='" + remark + '\'' + ", payType='" + payType + '\'' + ", numberOfStages=" + numberOfStages + '}'; } }
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\trade\bo\ScanPayRequestBo.java
2
请在Spring Boot框架中完成以下Java代码
private String getMessage(Map<String, ?> model) { Object path = model.get("path"); String message = "Cannot render error page for request [" + path + "]"; if (model.get("message") != null) { message += " and exception [" + model.get("message") + "]"; } message += " as the response has already been committed."; message += " As a result, the response may have the wrong status code."; return message; } @Override public String getContentType() { return "text/html"; } } /** * {@link ErrorPageRegistrar} that configures the server's error pages. */ static class ErrorPageCustomizer implements ErrorPageRegistrar, Ordered { private final WebProperties properties; private final DispatcherServletPath dispatcherServletPath; protected ErrorPageCustomizer(WebProperties properties, DispatcherServletPath dispatcherServletPath) { this.properties = properties; this.dispatcherServletPath = dispatcherServletPath; } @Override public void registerErrorPages(ErrorPageRegistry errorPageRegistry) { ErrorPage errorPage = new ErrorPage( this.dispatcherServletPath.getRelativePath(this.properties.getError().getPath())); errorPageRegistry.addErrorPages(errorPage); }
@Override public int getOrder() { return 0; } } /** * {@link BeanFactoryPostProcessor} to ensure that the target class of ErrorController * MVC beans are preserved when using AOP. */ static class PreserveErrorControllerTargetClassPostProcessor implements BeanFactoryPostProcessor { @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { String[] errorControllerBeans = beanFactory.getBeanNamesForType(ErrorController.class, false, false); for (String errorControllerBean : errorControllerBeans) { try { beanFactory.getBeanDefinition(errorControllerBean) .setAttribute(AutoProxyUtils.PRESERVE_TARGET_CLASS_ATTRIBUTE, Boolean.TRUE); } catch (Throwable ex) { // Ignore } } } } }
repos\spring-boot-4.0.1\module\spring-boot-webmvc\src\main\java\org\springframework\boot\webmvc\autoconfigure\error\ErrorMvcAutoConfiguration.java
2
请在Spring Boot框架中完成以下Java代码
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
请完成以下Java代码
public static final String extractEngineNameFromRuleValue(final String ruleValue) { if (ruleValue == null) { return null; } final int colonPosition = ruleValue.indexOf(":"); if (colonPosition < 0) { return null; } return ruleValue.substring(0, colonPosition); } public static final Optional<String> extractRuleValueFromClassname(final String classname) { if (classname == null || classname.isEmpty()) { return Optional.empty(); } if (!classname.toLowerCase().startsWith(SCRIPT_PREFIX)) { return Optional.empty(); } final String ruleValue = classname.substring(SCRIPT_PREFIX.length()).trim(); return Optional.of(ruleValue); } private final ScriptEngine createScriptEngine_JSR223(final String engineName) { Check.assumeNotEmpty(engineName, "engineName is not empty");
final ScriptEngineManager factory = getScriptEngineManager(); final ScriptEngine engine = factory.getEngineByName(engineName); if (engine == null) { throw new AdempiereException("Script engine was not found for engine name: '" + engineName + "'"); } return engine; } private final ScriptEngineManager getScriptEngineManager() { return scriptEngineManager.get(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\script\ScriptEngineFactory.java
1
请完成以下Java代码
public class X_AD_Process_Trl extends org.compiere.model.PO implements I_AD_Process_Trl, org.compiere.model.I_Persistent { private static final long serialVersionUID = 367610936L; /** Standard Constructor */ public X_AD_Process_Trl (final Properties ctx, final int AD_Process_Trl_ID, @Nullable final String trxName) { super (ctx, AD_Process_Trl_ID, trxName); } /** Load Constructor */ public X_AD_Process_Trl (final Properties ctx, final ResultSet rs, @Nullable final String trxName) { super (ctx, rs, trxName); } /** Load Meta Data */ @Override protected org.compiere.model.POInfo initPO(final Properties ctx) { return org.compiere.model.POInfo.getPOInfo(Table_Name); } /** * AD_Language AD_Reference_ID=106 * Reference name: AD_Language */ public static final int AD_LANGUAGE_AD_Reference_ID=106; @Override public void setAD_Language (final java.lang.String AD_Language) { set_ValueNoCheck (COLUMNNAME_AD_Language, AD_Language); } @Override public java.lang.String getAD_Language() { return get_ValueAsString(COLUMNNAME_AD_Language); } @Override public org.compiere.model.I_AD_Process getAD_Process() { return get_ValueAsPO(COLUMNNAME_AD_Process_ID, org.compiere.model.I_AD_Process.class); } @Override public void setAD_Process(final org.compiere.model.I_AD_Process AD_Process) { set_ValueFromPO(COLUMNNAME_AD_Process_ID, org.compiere.model.I_AD_Process.class, AD_Process); } @Override public void setAD_Process_ID (final int AD_Process_ID) { if (AD_Process_ID < 1) set_ValueNoCheck (COLUMNNAME_AD_Process_ID, null); else set_ValueNoCheck (COLUMNNAME_AD_Process_ID, AD_Process_ID); } @Override public int getAD_Process_ID() { return get_ValueAsInt(COLUMNNAME_AD_Process_ID); } @Override public void setDescription (final java.lang.String Description)
{ set_Value (COLUMNNAME_Description, Description); } @Override public java.lang.String getDescription() { return get_ValueAsString(COLUMNNAME_Description); } @Override public void setHelp (final java.lang.String Help) { set_Value (COLUMNNAME_Help, Help); } @Override public java.lang.String getHelp() { return get_ValueAsString(COLUMNNAME_Help); } @Override public void setIsTranslated (final boolean IsTranslated) { set_Value (COLUMNNAME_IsTranslated, IsTranslated); } @Override public boolean isTranslated() { return get_ValueAsBoolean(COLUMNNAME_IsTranslated); } @Override public void setName (final java.lang.String Name) { set_Value (COLUMNNAME_Name, Name); } @Override public java.lang.String getName() { return get_ValueAsString(COLUMNNAME_Name); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Process_Trl.java
1
请完成以下Java代码
public CommentDto createComment(UriInfo uriInfo, CommentDto commentDto) { ensureHistoryEnabled(Status.FORBIDDEN); ensureTaskExists(Status.BAD_REQUEST); Comment comment; String processInstanceId = commentDto.getProcessInstanceId(); try { comment = engine.getTaskService().createComment(taskId, processInstanceId, commentDto.getMessage()); } catch (ProcessEngineException e) { throw new InvalidRequestException(Status.BAD_REQUEST, e, "Not enough parameters submitted"); } URI uri = uriInfo.getBaseUriBuilder() .path(rootResourcePath) .path(TaskRestService.PATH) .path(taskId + "/comment/" + comment.getId()) .build(); CommentDto resultDto = CommentDto.fromComment(comment); // GET / resultDto.addReflexiveLink(uri, HttpMethod.GET, "self"); return resultDto; } private boolean isHistoryEnabled() { IdentityService identityService = engine.getIdentityService(); Authentication currentAuthentication = identityService.getCurrentAuthentication(); try { identityService.clearAuthentication(); int historyLevel = engine.getManagementService().getHistoryLevel(); return historyLevel > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE;
} finally { identityService.setAuthentication(currentAuthentication); } } private void ensureHistoryEnabled(Status status) { if (!isHistoryEnabled()) { throw new InvalidRequestException(status, "History is not enabled"); } } private void ensureTaskExists(Status status) { HistoricTaskInstance historicTaskInstance = engine.getHistoryService().createHistoricTaskInstanceQuery().taskId(taskId).singleResult(); if (historicTaskInstance == null) { throw new InvalidRequestException(status, "No task found for task id " + taskId); } } }
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\sub\task\impl\TaskCommentResourceImpl.java
1
请完成以下Java代码
public List<Map<String, AttributeValue>> getOrdersBetweenDates(String userId, String fromDate, String toDate) { QueryRequest request = QueryRequest.builder() .tableName(TABLE_NAME) .keyConditionExpression("userId = :uid AND orderDate BETWEEN :from AND :to") .expressionAttributeValues(Map.of( ":uid", AttributeValue.fromS(userId), ":from", AttributeValue.fromS(fromDate), ":to", AttributeValue.fromS(toDate) )) .build(); return dynamoDb.query(request).items(); } public List<Map<String, AttributeValue>> getOrdersByMonth(String userId, String monthPrefix) { QueryRequest request = QueryRequest.builder() .tableName(TABLE_NAME) .keyConditionExpression("userId = :uid AND begins_with(orderDate, :prefix)") .expressionAttributeValues(Map.of( ":uid", AttributeValue.fromS(userId), ":prefix", AttributeValue.fromS(monthPrefix) )) .build(); return dynamoDb.query(request).items(); } public List<Map<String, AttributeValue>> getAllOrdersPaginated(String userId) { List<Map<String, AttributeValue>> allItems = new ArrayList<>(); Map<String, AttributeValue> lastKey = null;
do { QueryRequest.Builder requestBuilder = QueryRequest.builder() .tableName("UserOrders") .keyConditionExpression("userId = :uid") .expressionAttributeValues(Map.of( ":uid", AttributeValue.fromS(userId) )); if (lastKey != null) { requestBuilder.exclusiveStartKey(lastKey); } QueryResponse response = dynamoDb.query(requestBuilder.build()); allItems.addAll(response.items()); lastKey = response.lastEvaluatedKey(); } while (lastKey != null && !lastKey.isEmpty()); return allItems; } }
repos\tutorials-master\aws-modules\aws-dynamodb-v2\src\main\java\com\baeldung\dynamodb\query\UserOrdersRepository.java
1
请完成以下Java代码
public ArrayList<Object> getSqlValuesList() { final ArrayList<Object> allValuesIncludingNulls = new ArrayList<>(keyColumnNames.size()); for (final String keyColumnName : keyColumnNames) { final Object value = getValue(keyColumnName); allValuesIncludingNulls.add(value); } return allValuesIncludingNulls; } public void forEach(@NonNull final BiConsumer<String, Object> keyAndValueConsumer) { for (final String keyColumnName : keyColumnNames) { final Object value = getValue(keyColumnName); keyAndValueConsumer.accept(keyColumnName, value); } } public SqlAndParams getSqlValuesCommaSeparated() { final SqlAndParams.Builder sqlBuilder = SqlAndParams.builder(); for (final String keyColumnName : keyColumnNames) { final Object value = getValue(keyColumnName); if (!sqlBuilder.isEmpty()) { sqlBuilder.append(", "); } sqlBuilder.append("?", value); }
return sqlBuilder.build(); } public String getSqlWhereClauseById(@NonNull final String tableAlias) { final StringBuilder sql = new StringBuilder(); for (final String keyFieldName : keyColumnNames) { final Object idPart = getValue(keyFieldName); if (sql.length() > 0) { sql.append(" AND "); } sql.append(tableAlias).append(".").append(keyFieldName); if (!JSONNullValue.isNull(idPart)) { sql.append("=").append(DB.TO_SQL(idPart)); } else { sql.append(" IS NULL"); } } return sql.toString(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\model\sql\SqlComposedKey.java
1
请完成以下Java代码
private static DataEntryRecordQuery toDataEntryRecordQuery(final Collection<CacheKey> keys) { final int mainRecordId = CollectionUtils.extractSingleElement(keys, CacheKey::getMainRecordId); final ImmutableSet<DataEntrySubTabId> subTabIds = extractSubTabIds(keys); return DataEntryRecordQuery.builder() .dataEntrySubTabIds(subTabIds) .recordId(mainRecordId) .build(); } private static ImmutableSet<DataEntrySubTabId> extractSubTabIds(final Collection<CacheKey> keys) { final ImmutableSet<DataEntrySubTabId> subTabIds = keys.stream() .map(CacheKey::getSubTabId) .collect(ImmutableSet.toImmutableSet()); return subTabIds; } @VisibleForTesting int getDataEntryRecordIdIndexSize() { return cacheIndex.size(); } @Value(staticConstructor = "of") private static final class CacheKey { int mainRecordId; DataEntrySubTabId subTabId; } @ToString @VisibleForTesting
static final class DataEntryRecordIdIndex implements CacheIndexDataAdapter<DataEntryRecordId, CacheKey, DataEntryRecord> { @Override public DataEntryRecordId extractDataItemId(final DataEntryRecord dataItem) { return dataItem.getId().get(); } @Override public ImmutableSet<TableRecordReference> extractRecordRefs(final DataEntryRecord dataItem) { final DataEntryRecordId id = dataItem.getId().orElse(null); return id != null ? ImmutableSet.of(TableRecordReference.of(I_DataEntry_Record.Table_Name, id)) : ImmutableSet.of(); } @Override public List<CacheKey> extractCacheKeys(final DataEntryRecord dataItem) { final CacheKey singleCacheKey = CacheKey.of(dataItem.getMainRecord().getRecord_ID(), dataItem.getDataEntrySubTabId()); return ImmutableList.of(singleCacheKey); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business.rest-api-impl\src\main\java\de\metas\rest_api\dataentry\impl\DataEntryRecordCache.java
1
请完成以下Java代码
public CmmnHistoryCleaningManager getCmmnHistoryCleaningManager() { return cmmnHistoryCleaningManager; } public CmmnEngineConfiguration setCmmnHistoryCleaningManager(CmmnHistoryCleaningManager cmmnHistoryCleaningManager) { this.cmmnHistoryCleaningManager = cmmnHistoryCleaningManager; return this; } public boolean isHandleCmmnEngineExecutorsAfterEngineCreate() { return handleCmmnEngineExecutorsAfterEngineCreate; } public CmmnEngineConfiguration setHandleCmmnEngineExecutorsAfterEngineCreate(boolean handleCmmnEngineExecutorsAfterEngineCreate) { this.handleCmmnEngineExecutorsAfterEngineCreate = handleCmmnEngineExecutorsAfterEngineCreate; return this; } public boolean isAlwaysUseArraysForDmnMultiHitPolicies() { return alwaysUseArraysForDmnMultiHitPolicies; } public CmmnEngineConfiguration setAlwaysUseArraysForDmnMultiHitPolicies(boolean alwaysUseArraysForDmnMultiHitPolicies) { this.alwaysUseArraysForDmnMultiHitPolicies = alwaysUseArraysForDmnMultiHitPolicies; return this; } public CaseDefinitionLocalizationManager getCaseDefinitionLocalizationManager() { return caseDefinitionLocalizationManager; } public CmmnEngineConfiguration setCaseDefinitionLocalizationManager(CaseDefinitionLocalizationManager caseDefinitionLocalizationManager) { this.caseDefinitionLocalizationManager = caseDefinitionLocalizationManager;
return this; } public CaseLocalizationManager getCaseLocalizationManager() { return caseLocalizationManager; } public CmmnEngineConfiguration setCaseLocalizationManager(CaseLocalizationManager caseLocalizationManager) { this.caseLocalizationManager = caseLocalizationManager; return this; } public PlanItemLocalizationManager getPlanItemLocalizationManager() { return planItemLocalizationManager; } public CmmnEngineConfiguration setPlanItemLocalizationManager(PlanItemLocalizationManager planItemLocalizationManager) { this.planItemLocalizationManager = planItemLocalizationManager; return this; } }
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\CmmnEngineConfiguration.java
1
请完成以下Java代码
public String getName () { return (String)get_Value(COLUMNNAME_Name); } /** Get Record ID/ColumnName @return ID/ColumnName pair */ public KeyNamePair getKeyNamePair() { return new KeyNamePair(get_ID(), getName()); } /** Set Process Now. @param Processing Process Now */ public void setProcessing (boolean Processing) { set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing)); } /** Get Process Now. @return Process Now */ public boolean isProcessing () { Object oo = get_Value(COLUMNNAME_Processing); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** RecurringType AD_Reference_ID=282 */ public static final int RECURRINGTYPE_AD_Reference_ID=282; /** Invoice = I */ public static final String RECURRINGTYPE_Invoice = "I"; /** Order = O */ public static final String RECURRINGTYPE_Order = "O"; /** GL Journal = G */ public static final String RECURRINGTYPE_GLJournal = "G"; /** Project = J */ public static final String RECURRINGTYPE_Project = "J"; /** Set Recurring Type. @param RecurringType Type of Recurring Document */ public void setRecurringType (String RecurringType) { set_Value (COLUMNNAME_RecurringType, RecurringType); } /** Get Recurring Type. @return Type of Recurring Document */ public String getRecurringType () { return (String)get_Value(COLUMNNAME_RecurringType); }
/** Set Maximum Runs. @param RunsMax Number of recurring runs */ public void setRunsMax (int RunsMax) { set_Value (COLUMNNAME_RunsMax, Integer.valueOf(RunsMax)); } /** Get Maximum Runs. @return Number of recurring runs */ public int getRunsMax () { Integer ii = (Integer)get_Value(COLUMNNAME_RunsMax); if (ii == null) return 0; return ii.intValue(); } /** Set Remaining Runs. @param RunsRemaining Number of recurring runs remaining */ public void setRunsRemaining (int RunsRemaining) { set_ValueNoCheck (COLUMNNAME_RunsRemaining, Integer.valueOf(RunsRemaining)); } /** Get Remaining Runs. @return Number of recurring runs remaining */ public int getRunsRemaining () { Integer ii = (Integer)get_Value(COLUMNNAME_RunsRemaining); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Recurring.java
1
请在Spring Boot框架中完成以下Java代码
public HCURR1 getHCURR1() { return hcurr1; } /** * Sets the value of the hcurr1 property. * * @param value * allowed object is * {@link HCURR1 } * */ public void setHCURR1(HCURR1 value) { this.hcurr1 = value; } /** * Gets the value of the hpayt1 property. * * @return * possible object is * {@link HPAYT1 } * */ public HPAYT1 getHPAYT1() { return hpayt1; } /** * Sets the value of the hpayt1 property. * * @param value * allowed object is * {@link HPAYT1 } * */ public void setHPAYT1(HPAYT1 value) { this.hpayt1 = value; } /** * Gets the value of the htrsd1 property. * * @return * possible object is * {@link HTRSD1 } * */ public HTRSD1 getHTRSD1() { return htrsd1; } /** * Sets the value of the htrsd1 property. * * @param value * allowed object is * {@link HTRSD1 } * */ public void setHTRSD1(HTRSD1 value) { this.htrsd1 = value; } /** * Gets the value of the htrsc1 property. * * @return
* possible object is * {@link HTRSC1 } * */ public HTRSC1 getHTRSC1() { return htrsc1; } /** * Sets the value of the htrsc1 property. * * @param value * allowed object is * {@link HTRSC1 } * */ public void setHTRSC1(HTRSC1 value) { this.htrsc1 = value; } /** * Gets the value of the detail property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the detail property. * * <p> * For example, to add a new item, do as follows: * <pre> * getDETAIL().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link DETAILXbest } * * */ public List<DETAILXbest> getDETAIL() { if (detail == null) { detail = new ArrayList<DETAILXbest>(); } return this.detail; } }
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\HEADERXbest.java
2
请完成以下Java代码
public void setClassname (java.lang.String Classname) { set_ValueNoCheck (COLUMNNAME_Classname, Classname); } /** Get Java-Klasse. @return Java-Klasse */ @Override public java.lang.String getClassname () { return (java.lang.String)get_Value(COLUMNNAME_Classname); } /** Set Fehler. @param IsError Ein Fehler ist bei der Durchführung aufgetreten */ @Override public void setIsError (boolean IsError) { set_Value (COLUMNNAME_IsError, Boolean.valueOf(IsError)); } /** Get Fehler. @return Ein Fehler ist bei der Durchführung aufgetreten */ @Override public boolean isError () { Object oo = get_Value(COLUMNNAME_IsError); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Message Text. @param MsgText Textual Informational, Menu or Error Message */ @Override public void setMsgText (java.lang.String MsgText) {
set_ValueNoCheck (COLUMNNAME_MsgText, MsgText); } /** Get Message Text. @return Textual Informational, Menu or Error Message */ @Override public java.lang.String getMsgText () { return (java.lang.String)get_Value(COLUMNNAME_MsgText); } /** 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; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\de\metas\event\model\X_AD_EventLog_Entry.java
1
请完成以下Java代码
public class Flowable5DeploymentWrapper implements Deployment { protected org.activiti.engine.repository.Deployment activiti5Deployment; public Flowable5DeploymentWrapper(org.activiti.engine.repository.Deployment activiti5Deployment) { this.activiti5Deployment = activiti5Deployment; } @Override public String getId() { return activiti5Deployment.getId(); } @Override public String getName() { return activiti5Deployment.getName(); } @Override public Date getDeploymentTime() { return activiti5Deployment.getDeploymentTime(); } @Override public String getCategory() { return activiti5Deployment.getCategory(); } @Override public String getKey() { return null; } @Override public String getTenantId() { return activiti5Deployment.getTenantId(); } @Override public boolean isNew() { return ((DeploymentEntity) activiti5Deployment).isNew(); } @Override public Map<String, EngineResource> getResources() { return null; }
@Override public String getDerivedFrom() { return null; } @Override public String getDerivedFromRoot() { return null; } @Override public String getParentDeploymentId() { return null; } @Override public String getEngineVersion() { return Flowable5Util.V5_ENGINE_TAG; } public org.activiti.engine.repository.Deployment getRawObject() { return activiti5Deployment; } }
repos\flowable-engine-main\modules\flowable5-compatibility\src\main\java\org\flowable\compatibility\wrapper\Flowable5DeploymentWrapper.java
1
请完成以下Java代码
public void loadAllFromSysConfigTo(final UIDefaults uiDefaults) { if (!DB.isConnected()) { return; } final String prefix = createSysConfigPrefix() + "."; final boolean removePrefix = true; final Properties ctx = Env.getCtx(); final ClientAndOrgId clientAndOrgId = ClientAndOrgId.ofClientAndOrg(Env.getAD_Client_ID(ctx), Env.getAD_Org_ID(ctx)); final Map<String, String> map = sysConfigBL.getValuesForPrefix(prefix, removePrefix, clientAndOrgId); for (final Map.Entry<String, String> mapEntry : map.entrySet()) {
final String key = mapEntry.getKey(); final String valueStr = mapEntry.getValue(); try { final Object value = serializer.fromString(valueStr); uiDefaults.put(key, value); } catch (Exception ex) { logger.warn("Failed loading " + key + ": " + valueStr + ". Skipped.", ex); } } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\plaf\SysConfigUIDefaultsRepository.java
1
请在Spring Boot框架中完成以下Java代码
public String getName() { return name; } public void setName(String name) { this.name = name; } public EbayTaxReference value(String value) { this.value = value; return this; } /** * The value returned in this field is the VAT identifier number (VATIN), which will vary by country/region. This field will be returned if VAT tax is applicable for the order. The name field indicates the VAT tax type, which will vary by country/region: ABN: eBay AU tax ID IOSS: eBay EU IOSS number / eBay UK IOSS number IRD: eBay NZ tax ID OSS: eBay DE VAT ID VOEC: eBay NO number * * @return value **/ @javax.annotation.Nullable @ApiModelProperty(value = "The value returned in this field is the VAT identifier number (VATIN), which will vary by country/region. This field will be returned if VAT tax is applicable for the order. The name field indicates the VAT tax type, which will vary by country/region: ABN: eBay AU tax ID IOSS: eBay EU IOSS number / eBay UK IOSS number IRD: eBay NZ tax ID OSS: eBay DE VAT ID VOEC: eBay NO number") public String getValue() { return value; } public void setValue(String value) { this.value = value; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } EbayTaxReference ebayTaxReference = (EbayTaxReference)o; return Objects.equals(this.name, ebayTaxReference.name) && Objects.equals(this.value, ebayTaxReference.value); } @Override public int hashCode() { return Objects.hash(name, value); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class EbayTaxReference {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" value: ").append(toIndentedString(value)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\de-metas-camel-ebay\ebay-api-client\src\main\java\de\metas\camel\externalsystems\ebay\api\model\EbayTaxReference.java
2
请完成以下Java代码
public boolean learn(String segmentedTaggedSentence) { return learn(POSInstance.create(segmentedTaggedSentence, model.featureMap)); } /** * 在线学习 * * @param wordTags [单词]/[词性]数组 * @return 是否学习成功(失败的原因是参数错误) */ public boolean learn(String... wordTags) { String[] words = new String[wordTags.length]; String[] tags = new String[wordTags.length]; for (int i = 0; i < wordTags.length; i++) { String[] wordTag = wordTags[i].split("//");
words[i] = wordTag[0]; tags[i] = wordTag[1]; } return learn(new POSInstance(words, tags, model.featureMap)); } @Override protected Instance createInstance(Sentence sentence, FeatureMap featureMap) { for (Word word : sentence.toSimpleWordList()) { if (!model.featureMap.tagSet.contains(word.getLabel())) throw new IllegalArgumentException("在线学习不可能学习新的标签: " + word + " ;请标注语料库后重新全量训练。"); } return POSInstance.create(sentence, featureMap); } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\model\perceptron\PerceptronPOSTagger.java
1
请在Spring Boot框架中完成以下Java代码
public String viewHomePage(Model model){ return findPaginated(1, "firstName", "asc", model); } @GetMapping("/showNewEmployeeForm") public String showNewEmployeeForm(Model model) { // create model attribute to bind from data Employee employee = new Employee(); model.addAttribute("employee", employee); return "new_employee"; } @PostMapping("/saveEmployee") public String saveEmployee(@ModelAttribute ("employee") Employee employee){ // save employee to database employeeService.saveEmployee(employee); return "redirect:/"; } @GetMapping("/showFormForUpdate/{id}") public String showFormForUpdate(@PathVariable(value = "id") long id, Model model){ // get employee from the service Employee employee = employeeService.getEmployeeById(id); //set employee a model attribute to pre-population the form model.addAttribute("employee", employee); return "update_employee"; } @GetMapping("/deleteEmployee/{id}") public String deleteEmployee(@PathVariable (value = "id") long id) { // call delete employee method
this.employeeService.deleteEmployeeById(id); return "redirect:/"; } @GetMapping("/page/{pageNo}") public String findPaginated(@PathVariable (value = "pageNo") int pageNo, @RequestParam("sortField") String sortField, @RequestParam("sortDir") String sortDir, Model model) { int pageSize = 5; Page<Employee> page = employeeService.findPaginated(pageNo, pageSize, sortField, sortDir); List<Employee> listEmployees = page.getContent(); model.addAttribute("currentPage", pageNo); model.addAttribute("totalPages", page.getTotalPages()); model.addAttribute("totalItems", page.getTotalElements()); model.addAttribute("sortField", sortField); model.addAttribute("sortDir", sortDir); model.addAttribute("reverseSortDir", sortDir.equals("asc") ? "desc" : "asc"); model.addAttribute("listEmployees", listEmployees); return "index"; } }
repos\Spring-Boot-Advanced-Projects-main\Registration-FullStack-Springboot\src\main\java\pagination\sort\controller\EmployeeController.java
2
请在Spring Boot框架中完成以下Java代码
private void customDecoder(OAuth2ResourceServerSpec server, ReactiveJwtDecoder decoder) { server.jwt((jwt) -> jwt.jwtDecoder(decoder)); } } private static class JwtConverterPropertiesCondition extends AnyNestedCondition { JwtConverterPropertiesCondition() { super(ConfigurationPhase.REGISTER_BEAN); } @ConditionalOnProperty("spring.security.oauth2.resourceserver.jwt.authority-prefix") static class OnAuthorityPrefix {
} @ConditionalOnProperty("spring.security.oauth2.resourceserver.jwt.principal-claim-name") static class OnPrincipalClaimName { } @ConditionalOnProperty("spring.security.oauth2.resourceserver.jwt.authorities-claim-name") static class OnAuthoritiesClaimName { } } }
repos\spring-boot-4.0.1\module\spring-boot-security-oauth2-resource-server\src\main\java\org\springframework\boot\security\oauth2\server\resource\autoconfigure\reactive\ReactiveOAuth2ResourceServerJwkConfiguration.java
2
请完成以下Java代码
public void handleRemaining(Exception thrownException, List<ConsumerRecord<?, ?>> records, Consumer<?, ?> consumer, MessageListenerContainer container) { this.recordErrorHandler.handleRemaining(thrownException, records, consumer, container); } @Override public void handleBatch(Exception thrownException, ConsumerRecords<?, ?> data, Consumer<?, ?> consumer, MessageListenerContainer container, Runnable invokeListener) { this.batchErrorHandler.handleBatch(thrownException, data, consumer, container, invokeListener); } @Override public int deliveryAttempt(TopicPartitionOffset topicPartitionOffset) { return this.recordErrorHandler.deliveryAttempt(topicPartitionOffset); } @Override public void clearThreadState() {
this.batchErrorHandler.clearThreadState(); this.recordErrorHandler.clearThreadState(); } @Override public boolean isAckAfterHandle() { return this.recordErrorHandler.isAckAfterHandle(); } @Override public void setAckAfterHandle(boolean ack) { this.batchErrorHandler.setAckAfterHandle(ack); this.recordErrorHandler.setAckAfterHandle(ack); } }
repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\listener\CommonMixedErrorHandler.java
1
请完成以下Java代码
public void setTrackingInfo (final @Nullable java.lang.String TrackingInfo) { set_Value (COLUMNNAME_TrackingInfo, TrackingInfo); } @Override public java.lang.String getTrackingInfo() { return get_ValueAsString(COLUMNNAME_TrackingInfo); } @Override public void setTrackingURL (final @Nullable java.lang.String TrackingURL) { set_Value (COLUMNNAME_TrackingURL, TrackingURL); } @Override public java.lang.String getTrackingURL()
{ return get_ValueAsString(COLUMNNAME_TrackingURL); } @Override public void setWidthInCm (final int WidthInCm) { set_Value (COLUMNNAME_WidthInCm, WidthInCm); } @Override public int getWidthInCm() { return get_ValueAsInt(COLUMNNAME_WidthInCm); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Package.java
1
请完成以下Java代码
public int getC_MediatedCommissionSettingsLine_ID() { return get_ValueAsInt(COLUMNNAME_C_MediatedCommissionSettingsLine_ID); } @Override public void setCommission_Product_ID (final int Commission_Product_ID) { if (Commission_Product_ID < 1) set_Value (COLUMNNAME_Commission_Product_ID, null); else set_Value (COLUMNNAME_Commission_Product_ID, Commission_Product_ID); } @Override public int getCommission_Product_ID() { return get_ValueAsInt(COLUMNNAME_Commission_Product_ID); } @Override public void setIsSimulation (final boolean IsSimulation) { set_Value (COLUMNNAME_IsSimulation, IsSimulation); } @Override public boolean isSimulation() { return get_ValueAsBoolean(COLUMNNAME_IsSimulation); } @Override public void setIsSOTrx (final boolean IsSOTrx) { set_Value (COLUMNNAME_IsSOTrx, IsSOTrx); } @Override public boolean isSOTrx() { return get_ValueAsBoolean(COLUMNNAME_IsSOTrx); } @Override public void setLevelHierarchy (final int LevelHierarchy) { set_ValueNoCheck (COLUMNNAME_LevelHierarchy, LevelHierarchy); } @Override public int getLevelHierarchy() { return get_ValueAsInt(COLUMNNAME_LevelHierarchy); } @Override public void setPointsSum_Forecasted (final BigDecimal PointsSum_Forecasted) { set_Value (COLUMNNAME_PointsSum_Forecasted, PointsSum_Forecasted); } @Override public BigDecimal getPointsSum_Forecasted() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PointsSum_Forecasted); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setPointsSum_Invoiceable (final BigDecimal PointsSum_Invoiceable) { set_ValueNoCheck (COLUMNNAME_PointsSum_Invoiceable, PointsSum_Invoiceable); } @Override public BigDecimal getPointsSum_Invoiceable() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PointsSum_Invoiceable); return bd != null ? bd : BigDecimal.ZERO; }
@Override public void setPointsSum_Invoiced (final BigDecimal PointsSum_Invoiced) { set_Value (COLUMNNAME_PointsSum_Invoiced, PointsSum_Invoiced); } @Override public BigDecimal getPointsSum_Invoiced() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PointsSum_Invoiced); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setPointsSum_Settled (final BigDecimal PointsSum_Settled) { set_Value (COLUMNNAME_PointsSum_Settled, PointsSum_Settled); } @Override public BigDecimal getPointsSum_Settled() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PointsSum_Settled); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setPointsSum_ToSettle (final BigDecimal PointsSum_ToSettle) { set_Value (COLUMNNAME_PointsSum_ToSettle, PointsSum_ToSettle); } @Override public BigDecimal getPointsSum_ToSettle() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PointsSum_ToSettle); return bd != null ? bd : BigDecimal.ZERO; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java-gen\de\metas\contracts\commission\model\X_C_Commission_Share.java
1
请完成以下Java代码
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 class DocumentPrintRestController { public static final String ENDPOINT = WindowRestController.ENDPOINT; private final UserSession userSession; private final WebuiDocumentPrintService documentPrintService; public DocumentPrintRestController( @NonNull final UserSession userSession, @NonNull final WebuiDocumentPrintService documentPrintService) { this.userSession = userSession; this.documentPrintService = documentPrintService; } @GetMapping("/{windowId}/{documentId}/print/{filename:.*}") public ResponseEntity<Resource> createDocumentPrint( @PathVariable("windowId") final String windowIdStr, @PathVariable("documentId") final String documentIdStr, @PathVariable("filename") final String filename, @RequestParam final Map<String, String> requestParams) { userSession.assertLoggedIn(); return documentPrintService.createDocumentPrint(WebuiDocumentPrintRequest.builder() .flavor(DocumentReportFlavor.EMAIL) .documentPath(DocumentPath.rootDocumentPath(WindowId.fromJson(windowIdStr), documentIdStr)) .userId(userSession.getLoggedUserId()) .roleId(userSession.getLoggedRoleId()) .printOptions(DocumentPrintOptions.ofMap(requestParams, "user HTTP request")) .build())
.filter(report -> !report.isEmpty()) .map(documentPrint -> toResponseEntity(documentPrint, filename)) .orElseGet(() -> ResponseEntity.ok().build()); } @NonNull private static ResponseEntity<Resource> toResponseEntity(@NonNull final ReportResultData documentPrint, @NonNull final String filename) { final Resource reportData = documentPrint.getReportData(); final String reportContentType = documentPrint.getReportContentType(); final HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.parseMediaType(reportContentType)); headers.set(HttpHeaders.CONTENT_DISPOSITION, "inline; filename=\"" + filename + "\""); headers.setCacheControl("must-revalidate, post-check=0, pre-check=0"); return new ResponseEntity<>(reportData, headers, HttpStatus.OK); } @GetMapping("/{windowId}/{documentId}/printingOptions") public JSONDocumentPrintingOptions getPrintingOptions( @PathVariable("windowId") final String windowIdStr, @PathVariable("documentId") final String documentIdStr) { userSession.assertLoggedIn(); final WindowId windowId = WindowId.fromJson(windowIdStr); final DocumentPath documentPath = DocumentPath.rootDocumentPath(windowId, documentIdStr); return documentPrintService.getPrintingOptions(documentPath, userSession.getAD_Language()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\print\DocumentPrintRestController.java
2
请完成以下Java代码
public class ProcessApplicationContextInterceptor extends CommandInterceptor { private final static CommandLogger LOG = ProcessEngineLogger.CMD_LOGGER; protected ProcessEngineConfigurationImpl processEngineConfiguration; public ProcessApplicationContextInterceptor(ProcessEngineConfigurationImpl processEngineConfiguration) { this.processEngineConfiguration = processEngineConfiguration; } @Override public <T> T execute(final Command<T> command) { ProcessApplicationIdentifier processApplicationIdentifier = ProcessApplicationContextImpl.get(); if (processApplicationIdentifier != null) { // clear the identifier so this interceptor does not apply to nested commands ProcessApplicationContextImpl.clear(); try { ProcessApplicationReference reference = getPaReference(processApplicationIdentifier); return Context.executeWithinProcessApplication(new Callable<T>() { @Override public T call() throws Exception { return next.execute(command); } }, reference); } finally { // restore the identifier for subsequent commands ProcessApplicationContextImpl.set(processApplicationIdentifier); } } else { return next.execute(command); } }
protected ProcessApplicationReference getPaReference(ProcessApplicationIdentifier processApplicationIdentifier) { if (processApplicationIdentifier.getReference() != null) { return processApplicationIdentifier.getReference(); } else if (processApplicationIdentifier.getProcessApplication() != null) { return processApplicationIdentifier.getProcessApplication().getReference(); } else if (processApplicationIdentifier.getName() != null) { RuntimeContainerDelegate runtimeContainerDelegate = RuntimeContainerDelegate.INSTANCE.get(); ProcessApplicationReference reference = runtimeContainerDelegate.getDeployedProcessApplication(processApplicationIdentifier.getName()); if (reference == null) { throw LOG.paWithNameNotRegistered(processApplicationIdentifier.getName()); } else { return reference; } } else { throw LOG.cannotReolvePa(processApplicationIdentifier); } } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\interceptor\ProcessApplicationContextInterceptor.java
1
请在Spring Boot框架中完成以下Java代码
public static class InvoiceDetail { @NonNull InvoiceId invoiceId; @NonNull InvoiceAndLineId invoiceAndLineId; @NonNull Quantity qtyInvoiced; } @Value @Builder public static class ShipmentDetail { @NonNull InOutId shipmentId; @NonNull InOutLineId shipmentLineId; @NonNull
Quantity qtyDelivered; } @Value @Builder public static class OrderDetail { @NonNull OrderId orderId; @NonNull OrderLineId orderLineId; @NonNull Quantity qtyEntered; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\callorder\detail\model\CallOrderDetailData.java
2
请完成以下Java代码
public TbQueueProducer<TbProtoQueueMsg<ToUsageStatsServiceMsg>> createToUsageStatsServiceMsgProducer() { TbKafkaProducerTemplate.TbKafkaProducerTemplateBuilder<TbProtoQueueMsg<ToUsageStatsServiceMsg>> requestBuilder = TbKafkaProducerTemplate.builder(); requestBuilder.settings(kafkaSettings); requestBuilder.clientId("tb-vc-us-producer-" + serviceInfoProvider.getServiceId()); requestBuilder.defaultTopic(topicService.buildTopicName(coreSettings.getUsageStatsTopic())); requestBuilder.admin(coreAdmin); return requestBuilder.build(); } @Override public TbQueueProducer<TbProtoQueueMsg<ToHousekeeperServiceMsg>> createHousekeeperMsgProducer() { return TbKafkaProducerTemplate.<TbProtoQueueMsg<ToHousekeeperServiceMsg>>builder() .settings(kafkaSettings) .clientId("tb-vc-housekeeper-producer-" + serviceInfoProvider.getServiceId()) .defaultTopic(topicService.buildTopicName(coreSettings.getHousekeeperTopic())) .admin(housekeeperAdmin) .build();
} @PreDestroy private void destroy() { if (coreAdmin != null) { coreAdmin.destroy(); } if (vcAdmin != null) { vcAdmin.destroy(); } if (notificationAdmin != null) { notificationAdmin.destroy(); } } }
repos\thingsboard-master\common\queue\src\main\java\org\thingsboard\server\queue\provider\KafkaTbVersionControlQueueFactory.java
1
请完成以下Java代码
public int getMaxIterations() { return maxIterations; } public void setMaxIterations(int maxIterations) { this.maxIterations = maxIterations; } public String getRepeat() { return repeat; } public void setRepeat(String repeat) { this.repeat = repeat; } public String getExceptionMessage() { return exceptionMessage; } public void setExceptionMessage(String exceptionMessage) { this.exceptionMessage = exceptionMessage; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((dueDate == null) ? 0 : dueDate.hashCode()); result = prime * result + ((endDate == null) ? 0 : endDate.hashCode()); result = prime * result + ((exceptionMessage == null) ? 0 : exceptionMessage.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + maxIterations; result = prime * result + ((repeat == null) ? 0 : repeat.hashCode()); result = prime * result + retries; return result; } @Override public boolean equals(Object obj) {
if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; TimerPayload other = (TimerPayload) obj; if (dueDate == null) { if (other.dueDate != null) return false; } else if (!dueDate.equals(other.dueDate)) return false; if (endDate == null) { if (other.endDate != null) return false; } else if (!endDate.equals(other.endDate)) return false; if (exceptionMessage == null) { if (other.exceptionMessage != null) return false; } else if (!exceptionMessage.equals(other.exceptionMessage)) return false; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (maxIterations != other.maxIterations) return false; if (repeat == null) { if (other.repeat != null) return false; } else if (!repeat.equals(other.repeat)) return false; if (retries != other.retries) return false; return true; } }
repos\Activiti-develop\activiti-api\activiti-api-process-model\src\main\java\org\activiti\api\process\model\payloads\TimerPayload.java
1
请完成以下Java代码
public void setAD_User_SaveCustomInfo_ID (int AD_User_SaveCustomInfo_ID) { if (AD_User_SaveCustomInfo_ID < 1) set_ValueNoCheck (COLUMNNAME_AD_User_SaveCustomInfo_ID, null); else set_ValueNoCheck (COLUMNNAME_AD_User_SaveCustomInfo_ID, Integer.valueOf(AD_User_SaveCustomInfo_ID)); } /** Get User Save Custom Info. @return User Save Custom Info */ @Override public int getAD_User_SaveCustomInfo_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_SaveCustomInfo_ID); if (ii == null) return 0; return ii.intValue(); } @Override public org.compiere.model.I_C_Country getC_Country() throws RuntimeException { return get_ValueAsPO(COLUMNNAME_C_Country_ID, org.compiere.model.I_C_Country.class); } @Override public void setC_Country(org.compiere.model.I_C_Country C_Country) { set_ValueFromPO(COLUMNNAME_C_Country_ID, org.compiere.model.I_C_Country.class, C_Country); } /** Set Land. @param C_Country_ID Land */ @Override public void setC_Country_ID (int C_Country_ID) { if (C_Country_ID < 1) set_ValueNoCheck (COLUMNNAME_C_Country_ID, null); else set_ValueNoCheck (COLUMNNAME_C_Country_ID, Integer.valueOf(C_Country_ID)); }
/** Get Land. @return Land */ @Override public int getC_Country_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_C_Country_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Capture Sequence. @param CaptureSequence Capture Sequence */ @Override public void setCaptureSequence (java.lang.String CaptureSequence) { set_Value (COLUMNNAME_CaptureSequence, CaptureSequence); } /** Get Capture Sequence. @return Capture Sequence */ @Override public java.lang.String getCaptureSequence () { return (java.lang.String)get_Value(COLUMNNAME_CaptureSequence); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_User_SaveCustomInfo.java
1
请完成以下Java代码
public void setApplicationName(String applicationName) { this.applicationName = applicationName; } public String getLanguage() { return this.language; } public void setLanguage(String language) { this.language = language; } public String getConfigurationFileFormat() { return this.configurationFileFormat; } public void setConfigurationFileFormat(String configurationFileFormat) { this.configurationFileFormat = configurationFileFormat; } public String getPackageName() { if (StringUtils.hasText(this.packageName)) { return this.packageName; } if (StringUtils.hasText(this.groupId) && StringUtils.hasText(this.artifactId)) { return getGroupId() + "." + getArtifactId(); } return null; } public void setPackageName(String packageName) { this.packageName = packageName; } public String getJavaVersion() {
return this.javaVersion; } public void setJavaVersion(String javaVersion) { this.javaVersion = javaVersion; } public String getBaseDir() { return this.baseDir; } public void setBaseDir(String baseDir) { this.baseDir = baseDir; } }
repos\initializr-main\initializr-web\src\main\java\io\spring\initializr\web\project\ProjectRequest.java
1
请完成以下Java代码
public DeadLetterJobQueryImpl jobWithoutTenantId() { this.withoutTenantId = true; return this; } // sorting ////////////////////////////////////////// public DeadLetterJobQuery orderByJobDuedate() { return orderBy(JobQueryProperty.DUEDATE); } public DeadLetterJobQuery orderByExecutionId() { return orderBy(JobQueryProperty.EXECUTION_ID); } public DeadLetterJobQuery orderByJobId() { return orderBy(JobQueryProperty.JOB_ID); } public DeadLetterJobQuery orderByProcessInstanceId() { return orderBy(JobQueryProperty.PROCESS_INSTANCE_ID); } public DeadLetterJobQuery orderByJobRetries() { return orderBy(JobQueryProperty.RETRIES); } public DeadLetterJobQuery orderByTenantId() { return orderBy(JobQueryProperty.TENANT_ID); } // results ////////////////////////////////////////// public long executeCount(CommandContext commandContext) { checkQueryOk(); return commandContext.getDeadLetterJobEntityManager().findJobCountByQueryCriteria(this); } public List<Job> executeList(CommandContext commandContext, Page page) { checkQueryOk(); return commandContext.getDeadLetterJobEntityManager().findJobsByQueryCriteria(this, page); } // getters ////////////////////////////////////////// public String getProcessInstanceId() { return processInstanceId; } public String getExecutionId() { return executionId; } public boolean getExecutable() { return executable; } public Date getNow() { return Context.getProcessEngineConfiguration().getClock().getCurrentTime(); } public boolean isWithException() { return withException; } public String getExceptionMessage() { return exceptionMessage; } public String getTenantId() { return tenantId; }
public String getTenantIdLike() { return tenantIdLike; } public boolean isWithoutTenantId() { return withoutTenantId; } public static long getSerialversionuid() { return serialVersionUID; } public String getId() { return id; } public String getProcessDefinitionId() { return processDefinitionId; } public boolean isOnlyTimers() { return onlyTimers; } public boolean isOnlyMessages() { return onlyMessages; } public Date getDuedateHigherThan() { return duedateHigherThan; } public Date getDuedateLowerThan() { return duedateLowerThan; } public Date getDuedateHigherThanOrEqual() { return duedateHigherThanOrEqual; } public Date getDuedateLowerThanOrEqual() { return duedateLowerThanOrEqual; } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\DeadLetterJobQueryImpl.java
1
请完成以下Java代码
protected boolean executeLogin(ServletRequest request, ServletResponse response) { HttpServletRequest httpServletRequest = (HttpServletRequest) request; String authorization = httpServletRequest.getHeader("Authorization"); JWTToken token = new JWTToken(authorization); // 提交给realm进行登入,如果错误他会抛出异常并被捕获 getSubject(request, response).login(token); // 如果没有抛出异常则代表登入成功,返回true return true; } /** * 这里我们详细说明下为什么最终返回的都是true,即允许访问 * 例如我们提供一个地址 GET /article * 登入用户和游客看到的内容是不同的 * 如果在这里返回了false,请求会被直接拦截,用户看不到任何东西 * 所以我们在这里返回true,Controller中可以通过 subject.isAuthenticated() 来判断用户是否登入 * 如果有些资源只有登入用户才能访问,我们只需要在方法上面加上 @RequiresAuthentication 注解即可 * 但是这样做有一个缺点,就是不能够对GET,POST等请求进行分别过滤鉴权(因为我们重写了官方的方法),但实际上对应用影响不大 */ @Override protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) { if (isLoginAttempt(request, response)) { return executeLogin(request, response); } return true; } /** * 对跨域提供支持 */ @Override protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
HttpServletRequest httpServletRequest = (HttpServletRequest) request; HttpServletResponse httpServletResponse = (HttpServletResponse) response; httpServletResponse.setHeader("Access-control-Allow-Origin", httpServletRequest.getHeader("Origin")); httpServletResponse.setHeader("Access-Control-Allow-Methods", "GET,POST,OPTIONS,PUT,DELETE"); httpServletResponse.setHeader("Access-Control-Allow-Headers", httpServletRequest.getHeader("Access-Control-Request-Headers")); // 跨域时会首先发送一个option请求,这里我们给option请求直接返回正常状态 if (httpServletRequest.getMethod().equals(RequestMethod.OPTIONS.name())) { httpServletResponse.setStatus(HttpStatus.OK.value()); return false; } return super.preHandle(request, response); } /** * 将非法请求 /401 */ private void response401(ServletRequest req, ServletResponse resp) { try { HttpServletResponse httpServletResponse = (HttpServletResponse) resp; httpServletResponse.sendRedirect("/401"); } catch (IOException e) { LOGGER.error(e.getMessage()); } } }
repos\SpringBootBucket-master\springboot-jwt\src\main\java\com\xncoding\jwt\shiro\JWTFilter.java
1
请在Spring Boot框架中完成以下Java代码
public boolean isEnabled() { return this.enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public boolean isPersistent() { return this.persistent; } public void setPersistent(boolean persistent) { this.persistent = persistent; } public @Nullable String getDataDirectory() { return this.dataDirectory; } public void setDataDirectory(@Nullable String dataDirectory) { this.dataDirectory = dataDirectory; } public String[] getQueues() { return this.queues; } public void setQueues(String[] queues) { this.queues = queues; } public String[] getTopics() { return this.topics; } public void setTopics(String[] topics) { this.topics = topics; } public String getClusterPassword() { return this.clusterPassword; }
public void setClusterPassword(String clusterPassword) { this.clusterPassword = clusterPassword; this.defaultClusterPassword = false; } public boolean isDefaultClusterPassword() { return this.defaultClusterPassword; } /** * Creates the minimal transport parameters for an embedded transport * configuration. * @return the transport parameters * @see TransportConstants#SERVER_ID_PROP_NAME */ public Map<String, Object> generateTransportParameters() { Map<String, Object> parameters = new HashMap<>(); parameters.put(TransportConstants.SERVER_ID_PROP_NAME, getServerId()); return parameters; } } }
repos\spring-boot-4.0.1\module\spring-boot-artemis\src\main\java\org\springframework\boot\artemis\autoconfigure\ArtemisProperties.java
2
请完成以下Java代码
public String toString() { return MoreObjects.toStringHelper(this) .addValue(_documentRef.get()) .toString(); } private Document getDocument() { final Document document = _documentRef.get(); if (document == null) { throw new IllegalStateException("Document reference already expired"); } return document; } @Override public String getTableName() { final Document document = getDocument(); return document.getEntityDescriptor().getTableName(); } @Override public int getAD_Tab_ID() { final Document document = getDocument(); return document.getEntityDescriptor().getAdTabId().getRepoId(); } @Override public <T> T getModel(final Class<T> modelClass) { final Document document = getDocument(); return DocumentInterfaceWrapper.wrap(document, modelClass); } @Override public <T> T getModelBeforeChanges(final Class<T> modelClass) { final Document document = getDocument(); return DocumentInterfaceWrapper.wrapUsingOldValues(document, modelClass); } @Override public Object getValue(final String columnName) { final Document document = getDocument(); return InterfaceWrapperHelper.getValueOrNull(document, columnName); } @Override public String setValue(final String columnName, final Object value) { final Document document = getDocument();
document.setValue(columnName, value, REASON_Value_DirectSetOnCalloutRecord); return ""; } @Override public void dataRefresh() { final Document document = getDocument(); document.refreshFromRepository(); } @Override public void dataRefreshAll() { // NOTE: there is no "All" concept here, so we are just refreshing this document final Document document = getDocument(); document.refreshFromRepository(); } @Override public void dataRefreshRecursively() { // TODO dataRefreshRecursively: refresh document and it's children throw new UnsupportedOperationException(); } @Override public boolean dataSave(final boolean manualCmd) { // TODO dataSave: save document but also update the DocumentsCollection! throw new UnsupportedOperationException(); } @Override public boolean isLookupValuesContainingId(@NonNull final String columnName, @NonNull final RepoIdAware id) { //Querying all values because getLookupValueById doesn't take validation rul into consideration. // TODO: Implement possibility to fetch sqllookupbyid with validation rule considered. return getDocument().getFieldLookupValues(columnName).containsId(id); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\model\DocumentAsCalloutRecord.java
1
请完成以下Java代码
public String getSymbol() { return symbol; } /** * @param symbol the symbol to set */ public void setSymbol(String symbol) { this.symbol = symbol; } /** * @return the value */ public double getValue() { return value; } /** * @param value the value to set */ public void setValue(double value) { this.value = value; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((symbol == null) ? 0 : symbol.hashCode()); result = prime * result + ((ts == null) ? 0 : ts.hashCode()); long temp; temp = Double.doubleToLongBits(value); result = prime * result + (int) (temp ^ (temp >>> 32)); return result;
} @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Quote other = (Quote) obj; if (symbol == null) { if (other.symbol != null) return false; } else if (!symbol.equals(other.symbol)) return false; if (ts == null) { if (other.ts != null) return false; } else if (!ts.equals(other.ts)) return false; if (Double.doubleToLongBits(value) != Double.doubleToLongBits(other.value)) return false; return true; } @Override public String toString() { return "Quote [ts=" + ts + ", symbol=" + symbol + ", value=" + value + "]"; } }
repos\tutorials-master\web-modules\ratpack\src\main\java\com\baeldung\model\Quote.java
1
请完成以下Java代码
public class StudentClassic { private String name; private int rollNo; private int marks; public StudentClassic(String name, int rollNo, int marks) { this.name = name; this.rollNo = rollNo; this.marks = marks; } public String getName() { return name; } public int getRollNo() { return rollNo; } public int getMarks() { return marks; } public void setName(String name) { this.name = name; } public void setRollNo(int rollNo) { this.rollNo = rollNo; } public void setMarks(int marks) { this.marks = marks; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false;
StudentClassic that = (StudentClassic) o; return rollNo == that.rollNo && marks == that.marks && Objects.equals(name, that.name); } @Override public int hashCode() { return Objects.hash(name, rollNo, marks); } @Override public String toString() { return "StudentClassic{" + "name='" + name + '\'' + ", rollNo=" + rollNo + ", marks=" + marks + '}'; } }
repos\tutorials-master\core-java-modules\core-java-14\src\main\java\com\baeldung\java14\recordscustomconstructors\StudentClassic.java
1