instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请完成以下Java代码
|
public class MyTokenizer {
public List<String> getTokens(String str) {
List<String> tokens = new ArrayList<>();
// StringTokenizer tokenizer = new StringTokenizer( str );
StringTokenizer tokenizer = new StringTokenizer(str, ",");
// StringTokenizer tokenizer = new StringTokenizer( str , "," , true );
while (tokenizer.hasMoreElements()) {
tokens.add(tokenizer.nextToken());
// tokens.add( tokenizer.nextToken("e") );
}
int tokenLength = tokens.size();
return tokens;
}
public List<String> getTokensWithCollection(String str) {
return Collections.list(new StringTokenizer(str, ",")).stream().map(token -> (String) token).collect(Collectors.toList());
}
public List<String> getTokensFromFile(String path, String delim) {
|
List<String> tokens = new ArrayList<>();
String currLine;
StringTokenizer tokenizer;
try (BufferedReader br = new BufferedReader(new InputStreamReader(MyTokenizer.class.getResourceAsStream("/" + path)))) {
while ((currLine = br.readLine()) != null) {
tokenizer = new StringTokenizer(currLine, delim);
while (tokenizer.hasMoreElements()) {
tokens.add(tokenizer.nextToken());
}
}
} catch (IOException e) {
e.printStackTrace();
}
return tokens;
}
}
|
repos\tutorials-master\core-java-modules\core-java-string-apis\src\main\java\com\baeldung\stringtokenizer\MyTokenizer.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private I_S_Issue buildRecord(@NonNull final IssueEntity issueEntity)
{
final I_S_Issue record =
InterfaceWrapperHelper.loadOrNew(issueEntity.getIssueId(), I_S_Issue.class);
record.setAD_Org_ID(issueEntity.getOrgId().getRepoId());
record.setAD_User_ID(NumberUtils.asInt(issueEntity.getAssigneeId(), -1));
record.setC_Project_ID(NumberUtils.asInt(issueEntity.getProjectId(), -1));
record.setS_ExternalProjectReference_ID(NumberUtils.asInt(issueEntity.getExternalProjectReferenceId(), -1));
record.setS_Parent_Issue_ID(NumberUtils.asInt(issueEntity.getParentIssueId(), -1));
record.setProcessed(issueEntity.isProcessed());
record.setName(issueEntity.getName());
record.setValue(issueEntity.getSearchKey());
record.setDescription(issueEntity.getDescription());
record.setIssueType(issueEntity.getType().getValue());
record.setIsEffortIssue(issueEntity.isEffortIssue());
record.setS_Milestone_ID(NumberUtils.asInt(issueEntity.getMilestoneId(), -1));
record.setRoughEstimation(issueEntity.getRoughEstimation());
record.setEstimatedEffort(issueEntity.getEstimatedEffort());
record.setBudgetedEffort(issueEntity.getBudgetedEffort());
record.setEffort_UOM_ID(issueEntity.getEffortUomId().getRepoId());
record.setIssueEffort(issueEntity.getIssueEffort().getHmm());
record.setAggregatedEffort(issueEntity.getAggregatedEffort().getHmm());
|
record.setInvoiceableChildEffort(Quantity.toBigDecimal(issueEntity.getInvoicableChildEffort()));
record.setLatestActivityOnSubIssues(TimeUtil.asTimestamp(issueEntity.getLatestActivityOnSubIssues()));
record.setLatestActivity(TimeUtil.asTimestamp(issueEntity.getLatestActivityOnIssue()));
if (issueEntity.getStatus() != null)
{
record.setStatus(issueEntity.getStatus().getCode());
}
record.setPlannedUATDate(TimeUtil.asTimestamp(issueEntity.getPlannedUATDate()));
record.setDeliveryPlatform(issueEntity.getDeliveryPlatform());
record.setDeliveredDate(TimeUtil.asTimestamp(issueEntity.getDeliveredDate()));
record.setExternalIssueNo(issueEntity.getExternalIssueNo());
record.setIssueURL(issueEntity.getExternalIssueURL());
return record;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.serviceprovider\src\main\java\de\metas\serviceprovider\issue\IssueRepository.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class ClientApplication {
public static void main(String[] args) {
ConfigurableApplicationContext ctx = new SpringApplicationBuilder(ClientApplication.class)
.web(WebApplicationType.NONE)
.run(args);
WebClient loadBalancedClient = ctx.getBean(WebClient.Builder.class).build();
for(int i = 1; i <= 10; i++) {
String response =
loadBalancedClient.get().uri("http://example-service/hello")
.retrieve().toEntity(String.class)
.block().getBody();
System.out.println(response);
}
}
}
@Configuration
class DemoServerInstanceConfiguration {
@Bean
ServiceInstanceListSupplier serviceInstanceListSupplier() {
return new DemoInstanceSupplier("example-service");
}
}
@Configuration
@LoadBalancerClient(name = "example-service", configuration = DemoServerInstanceConfiguration.class)
class WebClientConfig {
|
@LoadBalanced
@Bean
WebClient.Builder webClientBuilder() {
return WebClient.builder();
}
}
class DemoInstanceSupplier implements ServiceInstanceListSupplier {
private final String serviceId;
public DemoInstanceSupplier(String serviceId) {
this.serviceId = serviceId;
}
@Override
public String getServiceId() {
return serviceId;
}
@Override
public Flux<List<ServiceInstance>> get() {
return Flux.just(Arrays
.asList(new DefaultServiceInstance(serviceId + "1", serviceId, "localhost", 8080, false),
new DefaultServiceInstance(serviceId + "2", serviceId, "localhost", 8081, false)));
}
}
|
repos\tutorials-master\spring-cloud-modules\spring-cloud-loadbalancer\spring-cloud-loadbalancer-client\src\main\java\com\baeldung\spring\cloud\loadbalancer\client\ClientApplication.java
| 2
|
请完成以下Java代码
|
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
if (!super.equals(o)) {
return false;
}
ProcessInstanceImpl that = (ProcessInstanceImpl) o;
return (
Objects.equals(id, that.id) &&
Objects.equals(name, that.name) &&
Objects.equals(processDefinitionId, that.processDefinitionId) &&
Objects.equals(processDefinitionKey, that.processDefinitionKey) &&
Objects.equals(initiator, that.initiator) &&
Objects.equals(startDate, that.startDate) &&
Objects.equals(completedDate, that.completedDate) &&
Objects.equals(businessKey, that.businessKey) &&
status == that.status &&
Objects.equals(parentId, that.parentId) &&
Objects.equals(processDefinitionVersion, that.processDefinitionVersion) &&
Objects.equals(processDefinitionName, that.processDefinitionName)
);
}
@Override
public int hashCode() {
return Objects.hash(
super.hashCode(),
id,
name,
processDefinitionId,
processDefinitionKey,
initiator,
startDate,
completedDate,
businessKey,
status,
parentId,
processDefinitionVersion,
processDefinitionName
);
}
@Override
|
public String toString() {
return (
"ProcessInstance{" +
"id='" +
id +
'\'' +
", name='" +
name +
'\'' +
", processDefinitionId='" +
processDefinitionId +
'\'' +
", processDefinitionKey='" +
processDefinitionKey +
'\'' +
", parentId='" +
parentId +
'\'' +
", initiator='" +
initiator +
'\'' +
", startDate=" +
startDate +
", completedDate=" +
completedDate +
", businessKey='" +
businessKey +
'\'' +
", status=" +
status +
", processDefinitionVersion='" +
processDefinitionVersion +
'\'' +
", processDefinitionName='" +
processDefinitionName +
'\'' +
'}'
);
}
}
|
repos\Activiti-develop\activiti-core\activiti-api-impl\activiti-api-process-model-impl\src\main\java\org\activiti\api\runtime\model\impl\ProcessInstanceImpl.java
| 1
|
请完成以下Java代码
|
public class ConcurrentContainerStoppedEvent extends KafkaEvent {
@Serial
private static final long serialVersionUID = 1L;
private final ConsumerStoppedEvent.Reason reason;
/**
* Construct an instance with the provided source and container.
* @param source the container instance that generated the event.
* @param reason the reason.
*/
public ConcurrentContainerStoppedEvent(Object source, ConsumerStoppedEvent.Reason reason) {
super(source, source);
this.reason = reason;
|
}
/**
* Return the reason why the container was stopped.
* @return the reason.
*/
public ConsumerStoppedEvent.Reason getReason() {
return this.reason;
}
@Override
public String toString() {
return "ConcurrentContainerStoppedEvent [source=" + getSource() + ", reason=" + this.reason + "]";
}
}
|
repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\event\ConcurrentContainerStoppedEvent.java
| 1
|
请完成以下Java代码
|
public java.lang.String getDescription()
{
return get_ValueAsString(COLUMNNAME_Description);
}
/**
* Granularity AD_Reference_ID=540141
* Reference name: Granularity OLCandAggAndOrder
*/
public static final int GRANULARITY_AD_Reference_ID=540141;
/** Tag = D */
public static final String GRANULARITY_Tag = "D";
/** Woche = W */
public static final String GRANULARITY_Woche = "W";
/** Monat = M */
public static final String GRANULARITY_Monat = "M";
@Override
public void setGranularity (final @Nullable java.lang.String Granularity)
{
set_Value (COLUMNNAME_Granularity, Granularity);
}
@Override
public java.lang.String getGranularity()
{
return get_ValueAsString(COLUMNNAME_Granularity);
}
@Override
public void setGroupBy (final boolean GroupBy)
{
set_Value (COLUMNNAME_GroupBy, GroupBy);
}
@Override
public boolean isGroupBy()
{
|
return get_ValueAsBoolean(COLUMNNAME_GroupBy);
}
@Override
public void setOrderBySeqNo (final int OrderBySeqNo)
{
set_Value (COLUMNNAME_OrderBySeqNo, OrderBySeqNo);
}
@Override
public int getOrderBySeqNo()
{
return get_ValueAsInt(COLUMNNAME_OrderBySeqNo);
}
@Override
public void setSplitOrder (final boolean SplitOrder)
{
set_Value (COLUMNNAME_SplitOrder, SplitOrder);
}
@Override
public boolean isSplitOrder()
{
return get_ValueAsBoolean(COLUMNNAME_SplitOrder);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.salescandidate.base\src\main\java-gen\de\metas\ordercandidate\model\X_C_OLCandAggAndOrder.java
| 1
|
请完成以下Java代码
|
public void setRecipientType (final java.lang.String RecipientType)
{
set_Value (COLUMNNAME_RecipientType, RecipientType);
}
@Override
public java.lang.String getRecipientType()
{
return get_ValueAsString(COLUMNNAME_RecipientType);
}
@Override
public void setRecord_ID (final int Record_ID)
{
if (Record_ID < 0)
set_Value (COLUMNNAME_Record_ID, null);
else
set_Value (COLUMNNAME_Record_ID, Record_ID);
}
@Override
public int getRecord_ID()
{
return get_ValueAsInt(COLUMNNAME_Record_ID);
}
@Override
public void setRegionName (final @Nullable java.lang.String RegionName)
{
set_Value (COLUMNNAME_RegionName, RegionName);
}
|
@Override
public java.lang.String getRegionName()
{
return get_ValueAsString(COLUMNNAME_RegionName);
}
@Override
public void setRevolut_Payment_Export_ID (final int Revolut_Payment_Export_ID)
{
if (Revolut_Payment_Export_ID < 1)
set_ValueNoCheck (COLUMNNAME_Revolut_Payment_Export_ID, null);
else
set_ValueNoCheck (COLUMNNAME_Revolut_Payment_Export_ID, Revolut_Payment_Export_ID);
}
@Override
public int getRevolut_Payment_Export_ID()
{
return get_ValueAsInt(COLUMNNAME_Revolut_Payment_Export_ID);
}
@Override
public void setRoutingNo (final @Nullable java.lang.String RoutingNo)
{
set_Value (COLUMNNAME_RoutingNo, RoutingNo);
}
@Override
public java.lang.String getRoutingNo()
{
return get_ValueAsString(COLUMNNAME_RoutingNo);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.revolut\src\main\java-gen\de\metas\payment\revolut\model\X_Revolut_Payment_Export.java
| 1
|
请完成以下Java代码
|
default void onPartitionsRevokedBeforeCommit(Consumer<?, ?> consumer, Collection<TopicPartition> partitions) {
onPartitionsRevoked(partitions);
}
/**
* The same as {@link #onPartitionsRevoked(Collection)} with the additional consumer
* parameter. It is invoked by the container after any pending offsets are committed.
* @param consumer the consumer.
* @param partitions the partitions.
*/
default void onPartitionsRevokedAfterCommit(Consumer<?, ?> consumer, Collection<TopicPartition> partitions) {
}
/**
* The same as {@link #onPartitionsLost(Collection)} with an additional consumer parameter.
* @param consumer the consumer.
* @param partitions the partitions.
* @since 2.4
*/
default void onPartitionsLost(Consumer<?, ?> consumer, Collection<TopicPartition> partitions) {
onPartitionsLost(partitions);
}
/**
|
* The same as {@link #onPartitionsAssigned(Collection)} with the additional consumer
* parameter.
* @param consumer the consumer.
* @param partitions the partitions.
*/
default void onPartitionsAssigned(Consumer<?, ?> consumer, Collection<TopicPartition> partitions) {
onPartitionsAssigned(partitions);
}
@Override
default void onPartitionsRevoked(Collection<TopicPartition> partitions) {
}
@Override
default void onPartitionsAssigned(Collection<TopicPartition> partitions) {
}
@Override
default void onPartitionsLost(Collection<TopicPartition> partitions) {
}
}
|
repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\listener\ConsumerAwareRebalanceListener.java
| 1
|
请完成以下Java代码
|
public Date getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
public Date getGmtModified() {
return gmtModified;
}
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
public String getApp() {
return app;
}
public void setApp(String app) {
this.app = app;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getHostname() {
return hostname;
}
public void setHostname(String hostname) {
this.hostname = hostname;
}
public Date getTimestamp() {
return timestamp;
}
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
public Integer getPort() {
return port;
}
public void setPort(Integer port) {
this.port = port;
}
public MachineInfo toMachineInfo() {
MachineInfo machineInfo = new MachineInfo();
|
machineInfo.setApp(app);
machineInfo.setHostname(hostname);
machineInfo.setIp(ip);
machineInfo.setPort(port);
machineInfo.setLastHeartbeat(timestamp.getTime());
machineInfo.setHeartbeatVersion(timestamp.getTime());
return machineInfo;
}
@Override
public String toString() {
return "MachineEntity{" +
"id=" + id +
", gmtCreate=" + gmtCreate +
", gmtModified=" + gmtModified +
", app='" + app + '\'' +
", ip='" + ip + '\'' +
", hostname='" + hostname + '\'' +
", timestamp=" + timestamp +
", port=" + port +
'}';
}
}
|
repos\spring-boot-student-master\spring-boot-student-sentinel-dashboard\src\main\java\com\alibaba\csp\sentinel\dashboard\datasource\entity\MachineEntity.java
| 1
|
请完成以下Java代码
|
public String getEventName() {
return eventName;
}
/**
* Reference to the path of execution or null if it is not related to a
* process instance.
*/
public String getExecutionId() {
return executionId;
}
/** Follow-up date of the task. */
public Date getFollowUpDate() {
return followUpDate;
}
/** DB id of the task. */
public String getId() {
return id;
}
/**
* The date/time when this task was last updated.
* All operations that fire {@link TaskListener#EVENTNAME_UPDATE} count as an update to the task.
* Returns null if the task was never updated before (i.e. it was only created).
* */
public Date getLastUpdated() {
return lastUpdated;
}
/** Name or title of the task. */
public String getName() {
return name;
}
/**
* The {@link User.getId() userId} of the person responsible for this task.
*/
public String getOwner() {
return owner;
}
/**
* indication of how important/urgent this task is with a number between 0 and
* 100 where higher values mean a higher priority and lower values mean lower
* priority: [0..19] lowest, [20..39] low, [40..59] normal, [60..79] high
* [80..100] highest
*/
public int getPriority() {
return priority;
}
/**
* Reference to the process definition or null if it is not related to a
* process.
*/
public String getProcessDefinitionId() {
return processDefinitionId;
}
/**
* Reference to the process instance or null if it is not related to a process
* instance.
*/
public String getProcessInstanceId() {
return processInstanceId;
}
/**
* The id of the activity in the process defining this task or null if this is
* not related to a process
*/
public String getTaskDefinitionKey() {
return taskDefinitionKey;
}
|
/**
* Return the id of the tenant this task belongs to. Can be <code>null</code>
* if the task belongs to no single tenant.
*/
public String getTenantId() {
return tenantId;
}
@Override
public String toString() {
return this.getClass().getSimpleName()
+ "[id=" + id
+ ", eventName=" + eventName
+ ", name=" + name
+ ", createTime=" + createTime
+ ", lastUpdated=" + lastUpdated
+ ", executionId=" + executionId
+ ", processDefinitionId=" + processDefinitionId
+ ", processInstanceId=" + processInstanceId
+ ", taskDefinitionKey=" + taskDefinitionKey
+ ", assignee=" + assignee
+ ", owner=" + owner
+ ", description=" + description
+ ", dueDate=" + dueDate
+ ", followUpDate=" + followUpDate
+ ", priority=" + priority
+ ", deleteReason=" + deleteReason
+ ", caseDefinitionId=" + caseDefinitionId
+ ", caseExecutionId=" + caseExecutionId
+ ", caseInstanceId=" + caseInstanceId
+ ", tenantId=" + tenantId
+ "]";
}
}
|
repos\camunda-bpm-platform-master\spring-boot-starter\starter\src\main\java\org\camunda\bpm\spring\boot\starter\event\TaskEvent.java
| 1
|
请完成以下Java代码
|
public boolean isCopying() {return isDynAttributeTrue(DYNATTR_IsCopyWithDetailsInProgress);}
public void setCopying(final boolean copying) {setDynAttribute(DYNATTR_IsCopyWithDetailsInProgress, copying ? Boolean.TRUE : null);}
public boolean isCopiedFromOtherRecord() {return getDynAttribute(DYNATTR_CopiedFromRecordId) != null;}
public void setCopiedFromRecordId(final int fromRecordId) {setDynAttribute(DYNATTR_CopiedFromRecordId, fromRecordId);}
private class POReturningAfterInsertLoader implements ISqlUpdateReturnProcessor
{
private final List<String> columnNames;
private final StringBuilder sqlReturning;
public POReturningAfterInsertLoader()
{
this.columnNames = new ArrayList<>();
this.sqlReturning = new StringBuilder();
}
public void addColumnName(final String columnName)
{
// Make sure column was not already added
if (columnNames.contains(columnName))
{
return;
}
columnNames.add(columnName);
if (sqlReturning.length() > 0)
{
sqlReturning.append(", ");
}
sqlReturning.append(columnName);
|
}
public String getSqlReturning()
{
return sqlReturning.toString();
}
public boolean hasColumnNames()
{
return !columnNames.isEmpty();
}
@Override
public void process(final ResultSet rs) throws SQLException
{
for (final String columnName : columnNames)
{
final Object value = rs.getObject(columnName);
// NOTE: it is also setting the ID if applies
set_ValueNoCheck(columnName, value);
}
}
@Override
public String toString()
{
return "POReturningAfterInsertLoader [columnNames=" + columnNames + "]";
}
}
} // PO
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\PO.java
| 1
|
请完成以下Java代码
|
public class Doc_PPOrder extends Doc<DocLine<Doc_PPOrder>>
{
private static final Logger logger = LogManager.getLogger(Doc_PPOrder.class);
private final IPPOrderCostBL orderCostBL = Services.get(IPPOrderCostBL.class);
public Doc_PPOrder(final AcctDocContext ctx)
{
super(ctx);
final I_PP_Order ppOrder = getModel(I_PP_Order.class);
setDateAcct(ppOrder.getDateOrdered());
}
@Override
protected void loadDocumentDetails()
{
// nothing
}
private PPOrderId getPPOrderId()
{
return PPOrderId.ofRepoId(get_ID());
}
private I_PP_Order getPPOrder()
{
return getModel(I_PP_Order.class);
}
@Override
public BigDecimal getBalance()
{
return BigDecimal.ZERO;
}
|
@Override
public List<Fact> createFacts(final AcctSchema as)
{
final DocStatus docStatus = getDocStatus();
if (docStatus.isCompletedOrClosed())
{
createOrderCosts();
}
else if (DocStatus.Voided.equals(docStatus))
{
logger.debug("Skip creating costs for voided documents");
}
else
{
throw newPostingException()
.setPreserveDocumentPostedStatus()
.setDetailMessage("Invalid document status: " + docStatus);
}
return ImmutableList.of();
}
private void createOrderCosts()
{
if (!orderCostBL.hasPPOrderCosts(getPPOrderId()))
{
orderCostBL.createOrderCosts(getPPOrder());
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\de\metas\manufacturing\acct\Doc_PPOrder.java
| 1
|
请完成以下Java代码
|
protected IExternalSystemChildConfigId getExternalSystemChildConfigId()
{
return ExternalSystemRabbitMQConfigId.ofRepoId(externalSystemConfigRabbitMQId);
}
@Override
protected String getExternalSystemParam()
{
return PARAM_EXTERNAL_SYSTEM_CONFIG_RABBITMQ_HTTP_ID;
}
@Override
protected ExportToExternalSystemService getExportToBPartnerExternalSystem()
{
return exportBPartnerToRabbitMQService;
|
}
protected Optional<ProcessPreconditionsResolution> applyCustomPreconditionsIfAny(final @NonNull IProcessPreconditionsContext context)
{
if (!context.isSingleSelection())
{
return Optional.empty();
}
final BPartnerId bPartnerId = BPartnerId.ofRepoId(context.getSingleSelectedRecordId());
return dataExportAuditRepository.getByTableRecordReference(TableRecordReference.of(I_C_BPartner.Table_Name, bPartnerId))
.map(bPartnerAudit -> ProcessPreconditionsResolution.reject(msgBL.getTranslatableMsgText(MSG_RABBIT_MQ_SENT)));
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java\de\metas\externalsystem\rabbitmqhttp\export\bpartner\C_BPartner_SyncTo_RabbitMQ_HTTP.java
| 1
|
请完成以下Java代码
|
public TbQueueRequestTemplate<TbProtoQueueMsg<ToEdqsMsg>, TbProtoQueueMsg<FromEdqsMsg>> createEdqsRequestTemplate() {
throw new UnsupportedOperationException();
}
@PreDestroy
private void destroy() {
if (coreAdmin != null) {
coreAdmin.destroy();
}
if (ruleEngineAdmin != null) {
ruleEngineAdmin.destroy();
}
if (jsExecutorRequestAdmin != null) {
jsExecutorRequestAdmin.destroy();
}
|
if (jsExecutorResponseAdmin != null) {
jsExecutorResponseAdmin.destroy();
}
if (notificationAdmin != null) {
notificationAdmin.destroy();
}
if (fwUpdatesAdmin != null) {
fwUpdatesAdmin.destroy();
}
if (cfAdmin != null) {
cfAdmin.destroy();
}
}
}
|
repos\thingsboard-master\common\queue\src\main\java\org\thingsboard\server\queue\provider\KafkaTbRuleEngineQueueFactory.java
| 1
|
请完成以下Java代码
|
public class RadixSort {
public static void sort(int numbers[]) {
int maximumNumber = findMaximumNumberIn(numbers);
int numberOfDigits = calculateNumberOfDigitsIn(maximumNumber);
int placeValue = 1;
while (numberOfDigits-- > 0) {
applyCountingSortOn(numbers, placeValue);
placeValue *= 10;
}
}
private static void applyCountingSortOn(int[] numbers, int placeValue) {
int range = 10; // radix or the base
int length = numbers.length;
int[] frequency = new int[range];
int[] sortedValues = new int[length];
for (int i = 0; i < length; i++) {
int digit = (numbers[i] / placeValue) % range;
frequency[digit]++;
}
for (int i = 1; i < range; i++) {
frequency[i] += frequency[i - 1];
}
|
for (int i = length - 1; i >= 0; i--) {
int digit = (numbers[i] / placeValue) % range;
sortedValues[frequency[digit] - 1] = numbers[i];
frequency[digit]--;
}
System.arraycopy(sortedValues, 0, numbers, 0, length);
}
private static int calculateNumberOfDigitsIn(int number) {
return (int) Math.log10(number) + 1; // valid only if number > 0
}
private static int findMaximumNumberIn(int[] arr) {
return Arrays.stream(arr).max().getAsInt();
}
}
|
repos\tutorials-master\algorithms-modules\algorithms-sorting-2\src\main\java\com\baeldung\algorithms\radixsort\RadixSort.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class ExportExternalReferenceProcessor implements Processor
{
@Override
public void process(final Exchange exchange) throws Exception
{
final JsonExternalSystemRequest jsonExternalSystemRequest = exchange.getIn().getBody(JsonExternalSystemRequest.class);
final Map<String, String> parameters = jsonExternalSystemRequest.getParameters();
Check.assumeNotEmpty(parameters, "JsonExternalSystemRequest.parameters cannot be empty at this stage");
final String remoteUrl = parameters.get(ExternalSystemConstants.PARAM_RABBITMQ_HTTP_URL);
if (Check.isBlank(remoteUrl))
{
throw new RuntimeException("Missing mandatory param: " + ExternalSystemConstants.PARAM_RABBITMQ_HTTP_URL);
}
final String routingKey = parameters.get(ExternalSystemConstants.PARAM_RABBITMQ_HTTP_ROUTING_KEY);
if (Check.isBlank(routingKey))
{
throw new RuntimeException("Missing mandatory param: " + ExternalSystemConstants.PARAM_RABBITMQ_HTTP_ROUTING_KEY);
}
final String authToken = parameters.get(ExternalSystemConstants.PARAM_RABBIT_MQ_AUTH_TOKEN);
if (Check.isBlank(authToken))
{
throw new RuntimeException("Missing mandatory param: " + ExternalSystemConstants.PARAM_RABBIT_MQ_AUTH_TOKEN);
}
final ExportExternalReferenceRouteContext exportExternalReferenceRouteContext = ExportExternalReferenceRouteContext.builder()
.remoteUrl(remoteUrl)
.routingKey(routingKey)
.authToken(authToken)
.build();
|
exchange.setProperty(ROUTE_PROPERTY_EXPORT_EXTERNAL_REFERENCE_CONTEXT, exportExternalReferenceRouteContext);
final String externalReferenceLookupRequestIS = parameters.get(PARAM_JSON_EXTERNAL_REFERENCE_LOOKUP_REQUEST);
if (Check.isBlank(externalReferenceLookupRequestIS))
{
throw new RuntimeException("Missing mandatory param: " + PARAM_JSON_EXTERNAL_REFERENCE_LOOKUP_REQUEST);
}
final JsonExternalReferenceLookupRequest jsonExternalReferenceLookupRequest = JsonObjectMapperHolder.newJsonObjectMapper()
.readValue(externalReferenceLookupRequestIS, JsonExternalReferenceLookupRequest.class);
final JsonMetasfreshId externalSystemConfigId = jsonExternalSystemRequest.getExternalSystemConfigId();
final JsonMetasfreshId adPInstanceId = jsonExternalSystemRequest.getAdPInstanceId();
final ExternalReferenceLookupCamelRequest externalReferenceLookupCamelRequest = ExternalReferenceLookupCamelRequest.builder()
.externalSystemConfigId(externalSystemConfigId)
.adPInstanceId(adPInstanceId)
.jsonExternalReferenceLookupRequest(jsonExternalReferenceLookupRequest)
.orgCode(jsonExternalSystemRequest.getOrgCode())
.build();
exchange.getIn().setBody(externalReferenceLookupCamelRequest);
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\de-metas-camel-rabbitmq\src\main\java\de\metas\camel\externalsystems\rabbitmq\externalreference\processor\ExportExternalReferenceProcessor.java
| 2
|
请完成以下Java代码
|
public void onNext(Stock stock) {
count++;
price = +fetchStockPriceBid(stock);
sb.append(":")
.append(stock.getTickerSymbol());
}
@Override
public void onCompleted() {
responseObserver.onNext(StockQuote.newBuilder()
.setPrice(price / count)
.setDescription("Statistics-" + sb.toString())
.build());
responseObserver.onCompleted();
}
@Override
public void onError(Throwable t) {
logger.warn("error:{}", t.getMessage());
}
};
}
@Override
public StreamObserver<Stock> bidirectionalStreamingGetListsStockQuotes(final StreamObserver<StockQuote> responseObserver) {
return new StreamObserver<Stock>() {
@Override
public void onNext(Stock request) {
for (int i = 1; i <= 5; i++) {
StockQuote stockQuote = StockQuote.newBuilder()
.setPrice(fetchStockPriceBid(request))
.setOfferNumber(i)
.setDescription("Price for stock:" + request.getTickerSymbol())
.build();
responseObserver.onNext(stockQuote);
}
}
@Override
public void onCompleted() {
|
responseObserver.onCompleted();
}
@Override
public void onError(Throwable t) {
logger.warn("error:{}", t.getMessage());
}
};
}
}
private static double fetchStockPriceBid(Stock stock) {
return stock.getTickerSymbol()
.length()
+ ThreadLocalRandom.current()
.nextDouble(-0.1d, 0.1d);
}
}
|
repos\tutorials-master\grpc\src\main\java\com\baeldung\grpc\streaming\StockServer.java
| 1
|
请完成以下Java代码
|
public class SecureScriptScope implements Scriptable {
private static final String KEYWORD_EXECUTION = "execution";
private static final String KEYWORD_TASK = "task";
protected VariableContainer variableContainer;
protected Map<Object, Object> beans;
public SecureScriptScope(VariableContainer variableScope, Map<Object, Object> beans) {
this.variableContainer = variableScope;
this.beans = beans;
}
@Override
public String getClassName() {
return variableContainer.getClass().getName();
}
@Override
public Object get(String s, Scriptable scriptable) {
if (KEYWORD_EXECUTION.equals(s) && variableContainer instanceof DelegateExecution) {
return variableContainer;
} else if (KEYWORD_TASK.equals(s) && variableContainer instanceof DelegateTask) {
return variableContainer;
} else if (variableContainer.hasVariable(s)) {
return variableContainer.getVariable(s);
} else if (beans != null && beans.containsKey(s)) {
return beans.get(s);
}
return null;
}
@Override
public Object get(int i, Scriptable scriptable) {
return null;
}
@Override
public boolean has(String s, Scriptable scriptable) {
return variableContainer.hasVariable(s);
}
@Override
public boolean has(int i, Scriptable scriptable) {
return false;
}
@Override
public void put(String s, Scriptable scriptable, Object o) {
}
@Override
public void put(int i, Scriptable scriptable, Object o) {
}
@Override
public void delete(String s) {
}
@Override
public void delete(int i) {
}
|
@Override
public Scriptable getPrototype() {
return null;
}
@Override
public void setPrototype(Scriptable scriptable) {
}
@Override
public Scriptable getParentScope() {
return null;
}
@Override
public void setParentScope(Scriptable scriptable) {
}
@Override
public Object[] getIds() {
return null;
}
@Override
public Object getDefaultValue(Class<?> aClass) {
return null;
}
@Override
public boolean hasInstance(Scriptable scriptable) {
return false;
}
}
|
repos\flowable-engine-main\modules\flowable-secure-javascript\src\main\java\org\flowable\scripting\secure\impl\SecureScriptScope.java
| 1
|
请完成以下Java代码
|
public class DecisionQueryProperty implements QueryProperty {
private static final long serialVersionUID = 1L;
private static final Map<String, DecisionQueryProperty> properties = new HashMap<>();
public static final DecisionQueryProperty DECISION_KEY = new DecisionQueryProperty("RES.KEY_");
public static final DecisionQueryProperty DECISION_CATEGORY = new DecisionQueryProperty("RES.CATEGORY_");
public static final DecisionQueryProperty DECISION_ID = new DecisionQueryProperty("RES.ID_");
public static final DecisionQueryProperty DECISION_VERSION = new DecisionQueryProperty("RES.VERSION_");
public static final DecisionQueryProperty DECISION_NAME = new DecisionQueryProperty("RES.NAME_");
public static final DecisionQueryProperty DECISION_DEPLOYMENT_ID = new DecisionQueryProperty("RES.DEPLOYMENT_ID_");
public static final DecisionQueryProperty DECISION_TENANT_ID = new DecisionQueryProperty("RES.TENANT_ID_");
public static final DecisionQueryProperty DECISION_TYPE = new DecisionQueryProperty("RES.DECISION_TYPE_");
private String name;
|
public DecisionQueryProperty(String name) {
this.name = name;
properties.put(name, this);
}
@Override
public String getName() {
return name;
}
public static DecisionQueryProperty findByName(String propertyName) {
return properties.get(propertyName);
}
}
|
repos\flowable-engine-main\modules\flowable-dmn-engine\src\main\java\org\flowable\dmn\engine\impl\DecisionQueryProperty.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class CacheControlController {
@GetMapping(value = "/hello/{name}")
public ResponseEntity<String> hello(@PathVariable String name) {
CacheControl cacheControl = CacheControl.maxAge(60, TimeUnit.SECONDS)
.noTransform()
.mustRevalidate();
return ResponseEntity.ok()
.cacheControl(cacheControl)
.body("Hello " + name);
}
@GetMapping(value = "/home/{name}")
public String home(@PathVariable String name, final HttpServletResponse response) {
response.addHeader("Cache-Control", "max-age=60, must-revalidate, no-transform");
return "home";
}
@GetMapping(value = "/login/{name}")
public ResponseEntity<String> intercept(@PathVariable String name) {
return ResponseEntity.ok().body("Hello " + name);
}
|
@GetMapping(value = "/productInfo/{name}")
public ResponseEntity<String> validate(@PathVariable String name, WebRequest request) {
ZoneId zoneId = ZoneId.of("GMT");
long lastModifiedTimestamp = LocalDateTime.of(2020, 02, 4, 19, 57, 45)
.atZone(zoneId).toInstant().toEpochMilli();
if (request.checkNotModified(lastModifiedTimestamp)) {
return ResponseEntity.status(304).build();
}
return ResponseEntity.ok().body("Hello " + name);
}
}
|
repos\tutorials-master\spring-web-modules\spring-mvc-java-2\src\main\java\com\baeldung\cache\CacheControlController.java
| 2
|
请完成以下Java代码
|
public Builder setName(final String name)
{
this.name = name;
return this;
}
private String getName()
{
if (name != null)
{
return name;
}
if (record != null)
{
return Services.get(IMsgBL.class).translate(Env.getCtx(), record.getTableName()) + " #" + record.getRecord_ID();
}
return "";
}
public Builder setDate(final Date date)
{
this.date = date;
return this;
}
private Date getDate()
{
if (date == null)
{
return null;
|
}
return (Date)date.clone();
}
public Builder setRecord(final Object record)
{
this.record = TableRecordReference.of(record);
return this;
}
private ITableRecordReference getRecord()
{
return record;
}
public Builder setPaymentBatchProvider(IPaymentBatchProvider paymentBatchProvider)
{
this.paymentBatchProvider = paymentBatchProvider;
return this;
}
private IPaymentBatchProvider getPaymentBatchProvider()
{
return paymentBatchProvider;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.base\src\main\java\de\metas\banking\bankstatement\match\spi\PaymentBatch.java
| 1
|
请完成以下Java代码
|
public int getDataEntry_TargetWindow_ID()
{
return get_ValueAsInt(COLUMNNAME_DataEntry_TargetWindow_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 setName (final java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
|
}
@Override
public void setSeqNo (final int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, SeqNo);
}
@Override
public int getSeqNo()
{
return get_ValueAsInt(COLUMNNAME_SeqNo);
}
@Override
public void setTabName (final java.lang.String TabName)
{
set_Value (COLUMNNAME_TabName, TabName);
}
@Override
public java.lang.String getTabName()
{
return get_ValueAsString(COLUMNNAME_TabName);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\de\metas\dataentry\model\X_DataEntry_Tab.java
| 1
|
请完成以下Spring Boot application配置
|
logging.level.org.springframework.security=INFO
logging.level.org.springframework.boot.actuate.audit.listener.AuditListener=DEBUG
spring.security.user.name=user
spring.security.user.pa
|
ssword=password
spring.mvc.view.prefix=/templates/
spring.mvc.view.suffix=.html
|
repos\spring-boot-4.0.1\smoke-test\spring-boot-smoke-test-web-secure\src\main\resources\application.properties
| 2
|
请完成以下Java代码
|
public String toString()
{
final StringBuilder sb = new StringBuilder("LazyInitializer[");
if (initialized)
{
sb.append(value);
}
else
{
sb.append("not initialized");
}
sb.append("]");
return sb.toString();
}
@Override
public final T getValue()
{
if (!initialized)
{
value = initialize();
|
initialized = true;
}
return value;
}
/**
*
* @return true if the reference was already initialized (i.e. {@link #initialize()} was called)
*/
public final boolean isInitialized()
{
return initialized;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\org\adempiere\util\lang\LazyInitializer.java
| 1
|
请完成以下Java代码
|
private void clean(Node node) {
NodeList childNodes = node.getChildNodes();
for (int n = childNodes.getLength() - 1; n >= 0; n--) {
Node child = childNodes.item(n);
short nodeType = child.getNodeType();
if (nodeType == Node.ELEMENT_NODE)
clean(child);
else if (nodeType == Node.TEXT_NODE) {
String trimmedNodeVal = child.getNodeValue().trim();
if (trimmedNodeVal.length() == 0)
node.removeChild(child);
else
|
child.setNodeValue(trimmedNodeVal);
} else if (nodeType == Node.COMMENT_NODE)
node.removeChild(child);
}
}
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\DefaultParser.java
| 1
|
请完成以下Java代码
|
public void setCostDistributionMethod (final String CostDistributionMethod)
{
set_Value (COLUMNNAME_CostDistributionMethod, CostDistributionMethod);
}
@Override
public String getCostDistributionMethod()
{
return get_ValueAsString(COLUMNNAME_CostDistributionMethod);
}
@Override
public void setDescription (final @Nullable String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
@Override
public String getDescription()
{
return get_ValueAsString(COLUMNNAME_Description);
}
@Override
public void setIsAllowInvoicing (final boolean IsAllowInvoicing)
{
set_Value (COLUMNNAME_IsAllowInvoicing, IsAllowInvoicing);
}
@Override
public boolean isAllowInvoicing()
{
return get_ValueAsBoolean(COLUMNNAME_IsAllowInvoicing);
}
@Override
public void setIsAllowOnPurchase (final boolean IsAllowOnPurchase)
{
set_Value (COLUMNNAME_IsAllowOnPurchase, IsAllowOnPurchase);
}
@Override
public boolean isAllowOnPurchase()
{
return get_ValueAsBoolean(COLUMNNAME_IsAllowOnPurchase);
}
@Override
public void setIsAllowOnSales (final boolean IsAllowOnSales)
{
set_Value (COLUMNNAME_IsAllowOnSales, IsAllowOnSales);
}
@Override
public boolean isAllowOnSales()
{
return get_ValueAsBoolean(COLUMNNAME_IsAllowOnSales);
}
@Override
public I_M_CostElement getM_CostElement()
{
return get_ValueAsPO(COLUMNNAME_M_CostElement_ID, I_M_CostElement.class);
}
@Override
public void setM_CostElement(final I_M_CostElement M_CostElement)
{
set_ValueFromPO(COLUMNNAME_M_CostElement_ID, I_M_CostElement.class, M_CostElement);
}
@Override
public void setM_CostElement_ID (final int M_CostElement_ID)
{
if (M_CostElement_ID < 1)
|
set_Value (COLUMNNAME_M_CostElement_ID, null);
else
set_Value (COLUMNNAME_M_CostElement_ID, M_CostElement_ID);
}
@Override
public int getM_CostElement_ID()
{
return get_ValueAsInt(COLUMNNAME_M_CostElement_ID);
}
@Override
public void setM_Product_ID (final int M_Product_ID)
{
if (M_Product_ID < 1)
set_Value (COLUMNNAME_M_Product_ID, null);
else
set_Value (COLUMNNAME_M_Product_ID, M_Product_ID);
}
@Override
public int getM_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_ID);
}
@Override
public void setName (final String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
@Override
public void setValue (final String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
@Override
public String getValue()
{
return get_ValueAsString(COLUMNNAME_Value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Cost_Type.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class QtyDemandQtySupplyId implements RepoIdAware
{
@JsonCreator
public static QtyDemandQtySupplyId ofRepoId(final int repoId)
{
return new QtyDemandQtySupplyId(repoId);
}
@Nullable
public static QtyDemandQtySupplyId ofRepoIdOrNull(final int repoId)
{
return repoId > 0 ? new QtyDemandQtySupplyId(repoId) : null;
}
public static int toRepoId(@Nullable final QtyDemandQtySupplyId availableForSalesId)
{
|
return availableForSalesId != null ? availableForSalesId.getRepoId() : -1;
}
int repoId;
private QtyDemandQtySupplyId(final int repoId)
{
this.repoId = Check.assumeGreaterThanZero(repoId, "QtyDemand_QtySupply_ID");
}
@Override
@JsonValue
public int getRepoId()
{
return repoId;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.material\cockpit\src\main\java\de\metas\material\cockpit\QtyDemandQtySupplyId.java
| 2
|
请完成以下Java代码
|
public void setWeightNetNoPropagate(final BigDecimal weightNet)
{
this.weightNet = weightNet;
}
@Override
public void setWeightNet(final BigDecimal weightNet)
{
setWeightNetNoPropagate(weightNet);
}
@Override
public BigDecimal getWeightNetOrNull()
{
return getWeightNet();
}
@Override
public BigDecimal getWeightNet()
{
return weightNet;
}
@Override
public I_C_UOM getWeightNetUOM()
{
return uom;
}
@Override
public AttributeCode getWeightGrossAttribute()
{
return Weightables.ATTR_WeightGross;
}
@Override
public void setWeightGross(final BigDecimal weightGross)
{
this.weightGross = weightGross;
|
}
@Override
public BigDecimal getWeightGross()
{
return weightGross;
}
@Override
public Quantity getWeightGrossAsQuantity()
{
return Quantity.of(weightGross, uom);
}
@Override
public boolean isWeightTareAdjustAttribute(final AttributeCode attribute)
{
return AttributeCode.equals(attribute, Weightables.ATTR_WeightTareAdjust);
}
@Override
public boolean isWeightTareAttribute(final AttributeCode attribute)
{
return AttributeCode.equals(attribute, Weightables.ATTR_WeightTare);
}
@Override
public boolean isWeightNetAttribute(final AttributeCode attribute)
{
return AttributeCode.equals(attribute, Weightables.ATTR_WeightNet);
}
@Override
public boolean isWeightGrossAttribute(final AttributeCode attribute)
{
return AttributeCode.equals(attribute, Weightables.ATTR_WeightGross);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\attribute\weightable\PlainWeightable.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class PreSendForwardFilter extends ZuulFilter {
private Logger log = LoggerFactory.getLogger(this.getClass());
@Override
public String filterType() {
return "pre";
}
@Override
public int filterOrder() {
return 1;
}
@Override
|
public boolean shouldFilter() {
return true;
}
@Override
public Object run() {
RequestContext requestContext = RequestContext.getCurrentContext();
HttpServletRequest request = requestContext.getRequest();
String host = request.getRemoteHost();
String method = request.getMethod();
String uri = request.getRequestURI();
log.info("请求URI:{},HTTP Method:{},请求IP:{}", uri, method, host);
return null;
}
}
|
repos\SpringAll-master\39.Spring-Cloud-Zuul-Router\Zuul-Gateway\src\main\java\com\example\demo\filter\PreSendForwardFilter.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class Foo implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
private long id;
@Column(name = "name", nullable = false)
private String name;
@ManyToOne(targetEntity = Bar.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "BAR_ID")
private Bar bar = new Bar();
public Foo() {
super();
}
public Foo(final String name) {
super();
this.name = name;
}
//
public Bar getBar() {
return bar;
}
public void setBar(final Bar bar) {
this.bar = bar;
}
public long getId() {
return id;
}
public void setId(final long id) {
this.id = id;
}
public String getName() {
return name;
}
|
public void setName(final String name) {
this.name = name;
}
//
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final Foo other = (Foo) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
@Override
public String toString() {
final StringBuilder builder = new StringBuilder();
builder.append("Foo [name=").append(name).append("]");
return builder.toString();
}
}
|
repos\tutorials-master\persistence-modules\spring-data-jpa-enterprise\src\main\java\com\baeldung\boot\domain\Foo.java
| 2
|
请完成以下Java代码
|
public void setIsSplitWhenDifference (final boolean IsSplitWhenDifference)
{
set_Value (COLUMNNAME_IsSplitWhenDifference, IsSplitWhenDifference);
}
@Override
public boolean isSplitWhenDifference()
{
return get_ValueAsBoolean(COLUMNNAME_IsSplitWhenDifference);
}
@Override
public org.compiere.model.I_AD_Sequence getLotNo_Sequence()
{
return get_ValueAsPO(COLUMNNAME_LotNo_Sequence_ID, org.compiere.model.I_AD_Sequence.class);
}
@Override
public void setLotNo_Sequence(final org.compiere.model.I_AD_Sequence LotNo_Sequence)
{
set_ValueFromPO(COLUMNNAME_LotNo_Sequence_ID, org.compiere.model.I_AD_Sequence.class, LotNo_Sequence);
}
@Override
public void setLotNo_Sequence_ID (final int LotNo_Sequence_ID)
{
if (LotNo_Sequence_ID < 1)
set_Value (COLUMNNAME_LotNo_Sequence_ID, null);
else
set_Value (COLUMNNAME_LotNo_Sequence_ID, LotNo_Sequence_ID);
}
@Override
public int getLotNo_Sequence_ID()
{
return get_ValueAsInt(COLUMNNAME_LotNo_Sequence_ID);
}
@Override
public void setName (final java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
@Override
public void setPrintName (final java.lang.String PrintName)
{
set_Value (COLUMNNAME_PrintName, PrintName);
}
@Override
public java.lang.String getPrintName()
{
return get_ValueAsString(COLUMNNAME_PrintName);
}
|
@Override
public org.compiere.model.I_R_RequestType getR_RequestType()
{
return get_ValueAsPO(COLUMNNAME_R_RequestType_ID, org.compiere.model.I_R_RequestType.class);
}
@Override
public void setR_RequestType(final org.compiere.model.I_R_RequestType R_RequestType)
{
set_ValueFromPO(COLUMNNAME_R_RequestType_ID, org.compiere.model.I_R_RequestType.class, R_RequestType);
}
@Override
public void setR_RequestType_ID (final int R_RequestType_ID)
{
if (R_RequestType_ID < 1)
set_Value (COLUMNNAME_R_RequestType_ID, null);
else
set_Value (COLUMNNAME_R_RequestType_ID, R_RequestType_ID);
}
@Override
public int getR_RequestType_ID()
{
return get_ValueAsInt(COLUMNNAME_R_RequestType_ID);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_DocType.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void onSuccess(TbQueueMsgMetadata metadata) {
if (msgCount.decrementAndGet() <= 0) {
DefaultTransportService.this.transportCallbackExecutor.submit(() -> callback.onSuccess(null));
}
}
@Override
public void onFailure(Throwable t) {
DefaultTransportService.this.transportCallbackExecutor.submit(() -> callback.onError(t));
}
}
private class ApiStatsProxyCallback<T> implements TransportServiceCallback<T> {
private final TenantId tenantId;
private final CustomerId customerId;
private final int dataPoints;
private final TransportServiceCallback<T> callback;
public ApiStatsProxyCallback(TenantId tenantId, CustomerId customerId, int dataPoints, TransportServiceCallback<T> callback) {
this.tenantId = tenantId;
this.customerId = customerId;
this.dataPoints = dataPoints;
this.callback = callback;
}
@Override
public void onSuccess(T msg) {
try {
apiUsageClient.report(tenantId, customerId, ApiUsageRecordKey.TRANSPORT_MSG_COUNT, 1);
apiUsageClient.report(tenantId, customerId, ApiUsageRecordKey.TRANSPORT_DP_COUNT, dataPoints);
} finally {
callback.onSuccess(msg);
}
}
@Override
public void onError(Throwable e) {
callback.onError(e);
}
|
}
@Override
public ExecutorService getCallbackExecutor() {
return transportCallbackExecutor;
}
@Override
public boolean hasSession(TransportProtos.SessionInfoProto sessionInfo) {
return sessions.containsKey(toSessionId(sessionInfo));
}
@Override
public void createGaugeStats(String statsName, AtomicInteger number) {
statsFactory.createGauge(StatsType.TRANSPORT + "." + statsName, number);
statsMap.put(statsName, number);
}
@Scheduled(fixedDelayString = "${transport.stats.print-interval-ms:60000}")
public void printStats() {
if (statsEnabled && !statsMap.isEmpty()) {
String values = statsMap.entrySet().stream()
.map(kv -> kv.getKey() + " [" + kv.getValue() + "]").collect(Collectors.joining(", "));
log.info("Transport Stats: {}", values);
}
}
}
|
repos\thingsboard-master\common\transport\transport-api\src\main\java\org\thingsboard\server\common\transport\service\DefaultTransportService.java
| 2
|
请完成以下Java代码
|
public String getTokenValue() {
return this.tokenValue;
}
/**
* Returns the time at which the token was issued.
* @return the time the token was issued or {@code null}
*/
@Nullable
public Instant getIssuedAt() {
return this.issuedAt;
}
/**
* Returns the expiration time on or after which the token MUST NOT be accepted.
* @return the token expiration time or {@code null}
*/
@Nullable
public Instant getExpiresAt() {
return this.expiresAt;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || this.getClass() != obj.getClass()) {
return false;
|
}
AbstractOAuth2Token other = (AbstractOAuth2Token) obj;
if (!this.getTokenValue().equals(other.getTokenValue())) {
return false;
}
if ((this.getIssuedAt() != null) ? !this.getIssuedAt().equals(other.getIssuedAt())
: other.getIssuedAt() != null) {
return false;
}
return (this.getExpiresAt() != null) ? this.getExpiresAt().equals(other.getExpiresAt())
: other.getExpiresAt() == null;
}
@Override
public int hashCode() {
int result = this.getTokenValue().hashCode();
result = 31 * result + ((this.getIssuedAt() != null) ? this.getIssuedAt().hashCode() : 0);
result = 31 * result + ((this.getExpiresAt() != null) ? this.getExpiresAt().hashCode() : 0);
return result;
}
}
|
repos\spring-security-main\oauth2\oauth2-core\src\main\java\org\springframework\security\oauth2\core\AbstractOAuth2Token.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class Application {
@Autowired ItemRepository itemRepository;
@Autowired EmployeeRepository employeeRepository;
public static void main(String[] args) {
SpringApplication.run(Application.class);
}
/**
* Preload the system with employees and items.
*/
public @PostConstruct void init() {
employeeRepository.save(new Employee("Bilbo", "Baggins", "thief"));
employeeRepository.save(new Employee("Frodo", "Baggins", "ring bearer"));
employeeRepository.save(new Employee("Gandalf", "the Wizard", "servant of the Secret Fire"));
/*
* Due to method-level protections on {@link example.company.ItemRepository}, the security context must be loaded
* with an authentication token containing the necessary privileges.
*/
SecurityUtils.runAs("system", "system", "ROLE_ADMIN");
itemRepository.save(new Item("Sting"));
itemRepository.save(new Item("the one ring"));
SecurityContextHolder.clearContext();
}
/**
* This application is secured at both the URL level for some parts, and the method level for other parts. The URL
* security is shown inside this code, while method-level annotations are enabled at by {@link EnableMethodSecurity}.
*
* @author Greg Turnquist
* @author Oliver Gierke
*/
@Configuration
@EnableMethodSecurity(prePostEnabled = true)
@EnableWebSecurity
static class SecurityConfiguration {
/**
* This section defines the user accounts which can be used for authentication as well as the roles each user has.
*/
@Bean
InMemoryUserDetailsManager userDetailsManager() {
var builder = User.builder().passwordEncoder(PasswordEncoderFactories.createDelegatingPasswordEncoder()::encode);
var greg = builder.username("greg").password("turnquist").roles("USER").build();
var ollie = builder.username("ollie").password("gierke").roles("USER", "ADMIN").build();
|
return new InMemoryUserDetailsManager(greg, ollie);
}
/**
* This section defines the security policy for the app.
* <p>
* <ul>
* <li>BASIC authentication is supported (enough for this REST-based demo).</li>
* <li>/employees is secured using URL security shown below.</li>
* <li>CSRF headers are disabled since we are only testing the REST interface, not a web one.</li>
* </ul>
* NOTE: GET is not shown which defaults to permitted.
*
* @param http
* @throws Exception
*/
@Bean
protected SecurityFilterChain configure(HttpSecurity http) throws Exception {
return http.authorizeHttpRequests((authorize) -> {
authorize //
.requestMatchers(HttpMethod.POST, "/employees").hasRole("ADMIN") //
.requestMatchers(HttpMethod.PUT, "/employees/**").hasRole("ADMIN") //
.requestMatchers(HttpMethod.PATCH, "/employees/**").hasRole("ADMIN") //
.anyRequest().permitAll();
}).httpBasic(Customizer.withDefaults()).csrf(AbstractHttpConfigurer::disable).build();
}
}
}
|
repos\spring-data-examples-main\rest\security\src\main\java\example\springdata\rest\security\Application.java
| 2
|
请完成以下Java代码
|
public SqlDocumentOrderByBuilder joinOnTableNameOrAlias(final String joinOnTableNameOrAlias)
{
this.joinOnTableNameOrAlias = joinOnTableNameOrAlias;
return this;
}
public SqlDocumentOrderByBuilder useColumnNameAlias(final boolean useColumnNameAlias)
{
this.useColumnNameAlias = useColumnNameAlias;
return this;
}
public SqlDocumentOrderByBuilder beforeOrderBy(@Nullable final SqlAndParams beforeOrderBy)
{
if (beforeOrderBy != null && !beforeOrderBy.isEmpty())
{
if (this.beforeOrderBys == null)
{
this.beforeOrderBys = new ArrayList<>();
}
this.beforeOrderBys.add(beforeOrderBy);
}
return this;
}
public SqlDocumentOrderByBuilder beforeOrderBy(@Nullable final String beforeOrderBy)
{
if (beforeOrderBy != null)
{
beforeOrderBy(SqlAndParams.of(beforeOrderBy));
}
return this;
}
/**
* @return SQL order by (e.g. Column1 ASC, Column2 DESC)
*/
public Optional<SqlAndParamsExpression> buildSqlOrderBy(final DocumentQueryOrderByList orderBys)
{
if (orderBys.isEmpty())
{
return Optional.empty();
}
final SqlAndParamsExpression.Builder result = SqlAndParamsExpression.builder();
//
// First ORDER BYs
if (beforeOrderBys != null && !beforeOrderBys.isEmpty())
{
for (final SqlAndParams beforeOrderBy : beforeOrderBys)
{
if (!result.isEmpty())
{
result.append(", ");
}
result.append(beforeOrderBy);
}
}
//
// Actual ORDER BY columns
|
{
final IStringExpression orderBysExpression = orderBys
.stream()
.map(this::buildSqlOrderBy)
.filter(sql -> sql != null && !sql.isNullExpression())
.collect(IStringExpression.collectJoining(", "));
if (orderBysExpression != null && !orderBysExpression.isNullExpression())
{
if (!result.isEmpty())
{
result.append(", ");
}
result.append(orderBysExpression);
}
}
return !result.isEmpty()
? Optional.of(result.build())
: Optional.empty();
}
private IStringExpression buildSqlOrderBy(final DocumentQueryOrderBy orderBy)
{
final String fieldName = orderBy.getFieldName();
final SqlOrderByValue sqlExpression = bindings.getFieldOrderBy(fieldName);
return buildSqlOrderBy(sqlExpression, orderBy.isAscending(), orderBy.isNullsLast());
}
private IStringExpression buildSqlOrderBy(
final SqlOrderByValue orderBy,
final boolean ascending,
final boolean nullsLast)
{
if (orderBy.isNull())
{
return IStringExpression.NULL;
}
final CompositeStringExpression.Builder sql = IStringExpression.composer();
if (useColumnNameAlias)
{
sql.append(orderBy.withJoinOnTableNameOrAlias(joinOnTableNameOrAlias).toSqlUsingColumnNameAlias());
}
else
{
sql.append("(").append(orderBy.withJoinOnTableNameOrAlias(joinOnTableNameOrAlias).toSourceSqlExpression()).append(")");
}
return sql.append(ascending ? " ASC" : " DESC")
.append(nullsLast ? " NULLS LAST" : " NULLS FIRST")
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\model\sql\SqlDocumentOrderByBuilder.java
| 1
|
请完成以下Java代码
|
private I_M_AttributeSetInstance createASIFromRef(final I_M_InOutLine iol)
{
final IDimensionspecDAO dimSpecDAO = Services.get(IDimensionspecDAO.class);
final ISysConfigBL sysConfigBL = Services.get(ISysConfigBL.class);
final String internalName = sysConfigBL.getValue(MaterialTrackingConstants.SYSCONFIG_M_Material_Tracking_Report_Dimension);
final DimensionSpec dimensionSpec = dimSpecDAO.retrieveForInternalNameOrNull(internalName);
Check.errorIf(dimensionSpec == null, "Unable to load DIM_Dimension_Spec record with InternalName={}", internalName);
final I_M_AttributeSetInstance resultASI = dimensionSpec.createASIForDimensionSpec(iol.getM_AttributeSetInstance());
return resultASI;
}
@Override
public void createMaterialTrackingReportLineAllocation(final I_M_Material_Tracking_Report_Line reportLine,
final MaterialTrackingReportAgregationItem items)
{
final I_M_Material_Tracking_Report_Line_Alloc alloc = InterfaceWrapperHelper.newInstance(I_M_Material_Tracking_Report_Line_Alloc.class, reportLine);
|
alloc.setM_Material_Tracking_Report_Line(reportLine);
alloc.setPP_Order(items.getPPOrder());
alloc.setM_InOutLine(items.getInOutLine());
alloc.setM_Material_Tracking(items.getMaterialTracking());
if (items.getPPOrder() != null)
{
alloc.setQtyIssued(items.getQty());
}
else
{
alloc.setQtyReceived(items.getQty());
}
InterfaceWrapperHelper.save(alloc);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java\de\metas\materialtracking\impl\MaterialTrackingReportBL.java
| 1
|
请完成以下Java代码
|
public Player generatePlayer() {
Player player = new Player();
player.setName(names.get(rnd.nextInt(names.size())));
player.setCity(cities.get(rnd.nextInt(cities.size())));
player.setAge(18 + rnd.nextInt(50));
EntityManager em = emf.createEntityManager();
EntityTransaction tx = em.getTransaction();
try {
tx.begin();
em.persist(player);
tx.commit();
} catch (Exception e) { // or use explicit exception
|
if (tx != null && tx.isActive()) {
tx.rollback();
}
throw e;
} finally {
if (em != null && em.isOpen()) {
em.close();
}
}
return player;
}
}
|
repos\Hibernate-SpringBoot-master\Java EE\AMPCandRLTM1\src\main\java\com\sample\boundary\PlayerResource.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private CorsConfiguration getCorsConfiguration() {
CorsConfiguration corsConfiguration = new CorsConfiguration();
corsConfiguration.addAllowedOrigin(CorsConfiguration.ALL);
corsConfiguration.setAllowedMethods(Arrays.asList(HttpMethod.GET.name(), HttpMethod.POST.name()));
corsConfiguration
.setAllowedHeaders(Arrays.asList(HttpHeaders.AUTHORIZATION, "X-Cf-App-Instance", HttpHeaders.CONTENT_TYPE));
return corsConfiguration;
}
/**
* {@link WebSecurityConfigurer} to tell Spring Security to permit cloudfoundry
* specific paths. The Cloud foundry endpoints are protected by their own security
* interceptor.
*/
@ConditionalOnClass({ WebSecurityCustomizer.class, WebSecurity.class })
@Configuration(proxyBeanMethods = false)
static class IgnoredCloudFoundryPathsWebSecurityConfiguration {
private static final int FILTER_CHAIN_ORDER = -1;
@Bean
@Order(FILTER_CHAIN_ORDER)
SecurityFilterChain cloudFoundrySecurityFilterChain(HttpSecurity http,
CloudFoundryWebEndpointServletHandlerMapping handlerMapping) {
RequestMatcher cloudFoundryRequest = getRequestMatcher(handlerMapping);
http.csrf((csrf) -> csrf.ignoringRequestMatchers(cloudFoundryRequest));
http.securityMatchers((matches) -> matches.requestMatchers(cloudFoundryRequest))
.authorizeHttpRequests((authorize) -> authorize.anyRequest().permitAll());
return http.build();
|
}
private RequestMatcher getRequestMatcher(CloudFoundryWebEndpointServletHandlerMapping handlerMapping) {
PathMappedEndpoints endpoints = new PathMappedEndpoints(BASE_PATH, handlerMapping::getAllEndpoints);
List<RequestMatcher> matchers = new ArrayList<>();
endpoints.getAllPaths().forEach((path) -> matchers.add(pathMatcher(path + "/**")));
matchers.add(pathMatcher(BASE_PATH));
matchers.add(pathMatcher(BASE_PATH + "/"));
return new OrRequestMatcher(matchers);
}
private PathPatternRequestMatcher pathMatcher(String path) {
return PathPatternRequestMatcher.withDefaults().matcher(path);
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-cloudfoundry\src\main\java\org\springframework\boot\cloudfoundry\autoconfigure\actuate\endpoint\servlet\CloudFoundryActuatorAutoConfiguration.java
| 2
|
请完成以下Java代码
|
public String getF_FINANCIAL() {
return F_FINANCIAL;
}
public void setF_FINANCIAL(String f_FINANCIAL) {
F_FINANCIAL = f_FINANCIAL;
}
public String getF_CONTACTMAN() {
return F_CONTACTMAN;
}
public void setF_CONTACTMAN(String f_CONTACTMAN) {
F_CONTACTMAN = f_CONTACTMAN;
}
public String getF_TEL() {
return F_TEL;
}
public void setF_TEL(String f_TEL) {
F_TEL = f_TEL;
}
public String getF_EMAIL() {
return F_EMAIL;
}
public void setF_EMAIL(String f_EMAIL) {
F_EMAIL = f_EMAIL;
}
public String getF_CANTONLEV() {
return F_CANTONLEV;
}
public void setF_CANTONLEV(String f_CANTONLEV) {
F_CANTONLEV = f_CANTONLEV;
}
public String getF_TAXORGCODE() {
return F_TAXORGCODE;
}
public void setF_TAXORGCODE(String f_TAXORGCODE) {
F_TAXORGCODE = f_TAXORGCODE;
}
public String getF_MEMO() {
return F_MEMO;
}
public void setF_MEMO(String f_MEMO) {
F_MEMO = f_MEMO;
}
public String getF_USING() {
return F_USING;
}
public void setF_USING(String f_USING) {
F_USING = f_USING;
}
public String getF_USINGDATE() {
return F_USINGDATE;
}
public void setF_USINGDATE(String f_USINGDATE) {
F_USINGDATE = f_USINGDATE;
}
public Integer getF_LEVEL() {
return F_LEVEL;
}
|
public void setF_LEVEL(Integer f_LEVEL) {
F_LEVEL = f_LEVEL;
}
public String getF_END() {
return F_END;
}
public void setF_END(String f_END) {
F_END = f_END;
}
public String getF_QRCANTONID() {
return F_QRCANTONID;
}
public void setF_QRCANTONID(String f_QRCANTONID) {
F_QRCANTONID = f_QRCANTONID;
}
public String getF_DECLARE() {
return F_DECLARE;
}
public void setF_DECLARE(String f_DECLARE) {
F_DECLARE = f_DECLARE;
}
public String getF_DECLAREISEND() {
return F_DECLAREISEND;
}
public void setF_DECLAREISEND(String f_DECLAREISEND) {
F_DECLAREISEND = f_DECLAREISEND;
}
}
|
repos\SpringBootBucket-master\springboot-batch\src\main\java\com\xncoding\trans\modules\common\vo\BscCanton.java
| 1
|
请完成以下Java代码
|
public AsyncBuilder and(AsyncPredicate<ServerWebExchange> predicate) {
Objects.requireNonNull(this.predicate, "can not call and() on null predicate");
this.predicate = this.predicate.and(predicate);
return this;
}
public AsyncBuilder or(AsyncPredicate<ServerWebExchange> predicate) {
Objects.requireNonNull(this.predicate, "can not call or() on null predicate");
this.predicate = this.predicate.or(predicate);
return this;
}
public AsyncBuilder negate() {
Objects.requireNonNull(this.predicate, "can not call negate() on null predicate");
this.predicate = this.predicate.negate();
return this;
}
}
public static class Builder extends AbstractBuilder<Builder> {
protected @Nullable Predicate<ServerWebExchange> predicate;
@Override
protected Builder getThis() {
return this;
}
@Override
public AsyncPredicate<ServerWebExchange> getPredicate() {
return ServerWebExchangeUtils.toAsyncPredicate(this.predicate);
}
public Builder and(Predicate<ServerWebExchange> predicate) {
|
Objects.requireNonNull(this.predicate, "can not call and() on null predicate");
this.predicate = this.predicate.and(predicate);
return this;
}
public Builder or(Predicate<ServerWebExchange> predicate) {
Objects.requireNonNull(this.predicate, "can not call or() on null predicate");
this.predicate = this.predicate.or(predicate);
return this;
}
public Builder negate() {
Objects.requireNonNull(this.predicate, "can not call negate() on null predicate");
this.predicate = this.predicate.negate();
return this;
}
}
}
|
repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webflux\src\main\java\org\springframework\cloud\gateway\route\Route.java
| 1
|
请完成以下Java代码
|
public class HistoricFormPropertyEntityImpl extends HistoricDetailEntityImpl implements HistoricFormPropertyEntity {
private static final long serialVersionUID = 1L;
protected String propertyId;
protected String propertyValue;
public HistoricFormPropertyEntityImpl() {
this.detailType = "FormProperty";
}
@Override
public String getPropertyId() {
return propertyId;
}
|
@Override
public void setPropertyId(String propertyId) {
this.propertyId = propertyId;
}
@Override
public String getPropertyValue() {
return propertyValue;
}
@Override
public void setPropertyValue(String propertyValue) {
this.propertyValue = propertyValue;
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\persistence\entity\HistoricFormPropertyEntityImpl.java
| 1
|
请完成以下Java代码
|
public TelecomAddressType getTelecom() {
return telecom;
}
/**
* Sets the value of the telecom property.
*
* @param value
* allowed object is
* {@link TelecomAddressType }
*
*/
public void setTelecom(TelecomAddressType value) {
this.telecom = value;
}
/**
* Gets the value of the online property.
*
* @return
* possible object is
* {@link OnlineAddressType }
*
*/
public OnlineAddressType getOnline() {
return online;
}
/**
* Sets the value of the online property.
*
* @param value
* allowed object is
* {@link OnlineAddressType }
*
*/
public void setOnline(OnlineAddressType value) {
this.online = value;
}
/**
* Gets the value of the salutation property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSalutation() {
return salutation;
}
/**
|
* Sets the value of the salutation property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSalutation(String value) {
this.salutation = value;
}
/**
* Gets the value of the title property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTitle() {
return title;
}
/**
* Sets the value of the title property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTitle(String value) {
this.title = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_440_request\src\main\java-xjc\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_440\request\PersonType.java
| 1
|
请完成以下Java代码
|
public void setIsSummary (boolean IsSummary)
{
set_Value (COLUMNNAME_IsSummary, Boolean.valueOf(IsSummary));
}
/** Get Summary Level.
@return This is a summary entity
*/
public boolean isSummary ()
{
Object oo = get_Value(COLUMNNAME_IsSummary);
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());
}
/** Set Start Date.
@param StartDate
First effective day (inclusive)
*/
public void setStartDate (Timestamp StartDate)
|
{
set_Value (COLUMNNAME_StartDate, StartDate);
}
/** Get Start Date.
@return First effective day (inclusive)
*/
public Timestamp getStartDate ()
{
return (Timestamp)get_Value(COLUMNNAME_StartDate);
}
/** Set Search Key.
@param Value
Search key for the record in the format required - must be unique
*/
public void setValue (String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
/** Get Search Key.
@return Search key for the record in the format required - must be unique
*/
public String getValue ()
{
return (String)get_Value(COLUMNNAME_Value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Campaign.java
| 1
|
请完成以下Java代码
|
public void assignToResponsible(@NonNull final I_DD_Order ddOrder, @NonNull final UserId responsibleId)
{
final UserId currentResponsibleId = extractCurrentResponsibleId(ddOrder);
if (currentResponsibleId == null)
{
ddOrder.setAD_User_Responsible_ID(responsibleId.getRepoId());
save(ddOrder);
}
else if (!UserId.equals(currentResponsibleId, responsibleId))
{
throw new AdempiereException("DD Order already assigned to a different responsible");
}
else
{
// already assigned to that responsible,
// shall not happen but we can safely ignore the case
logger.warn("Order {} already assigned to {}", ddOrder.getDD_Order_ID(), responsibleId);
}
}
@Nullable
private static UserId extractCurrentResponsibleId(final I_DD_Order ddOrder)
{
return UserId.ofRepoIdOrNullIfSystem(ddOrder.getAD_User_Responsible_ID());
}
public void unassignFromResponsible(final DDOrderId ddOrderId)
{
final I_DD_Order ddOrder = getById(ddOrderId);
unassignFromResponsibleAndSave(ddOrder);
|
}
public void removeAllNotStartedSchedules(final DDOrderId ddOrderId)
{
ddOrderMoveScheduleService.removeNotStarted(ddOrderId);
}
private void unassignFromResponsibleAndSave(final I_DD_Order ddOrder)
{
ddOrder.setAD_User_Responsible_ID(-1);
save(ddOrder);
}
public Set<ProductId> getProductIdsByDDOrderIds(final Collection<DDOrderId> ddOrderIds)
{
return ddOrderLowLevelDAO.getProductIdsByDDOrderIds(ddOrderIds);
}
public Stream<I_DD_OrderLine> streamLinesByDDOrderIds(@NonNull final Collection<DDOrderId> ddOrderIds)
{
return ddOrderLowLevelDAO.streamLinesByDDOrderIds(ddOrderIds);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\distribution\ddorder\DDOrderService.java
| 1
|
请完成以下Java代码
|
public int getM_Product_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Faktor.
@param MultiplyRate
Rate to multiple the source by to calculate the target.
*/
@Override
public void setMultiplyRate (java.math.BigDecimal MultiplyRate)
{
|
set_Value (COLUMNNAME_MultiplyRate, MultiplyRate);
}
/** Get Faktor.
@return Rate to multiple the source by to calculate the target.
*/
@Override
public java.math.BigDecimal getMultiplyRate ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_MultiplyRate);
if (bd == null)
return BigDecimal.ZERO;
return bd;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_UOM_Conversion.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class PPCostCollectorQuantities
{
@NonNull
Quantity movementQty;
@NonNull
Quantity scrappedQty;
@NonNull
Quantity rejectedQty;
@NonNull
UomId uomId;
@Builder(toBuilder = true)
private PPCostCollectorQuantities(
@NonNull final Quantity movementQty,
@Nullable final Quantity scrappedQty,
@Nullable final Quantity rejectedQty)
{
this.movementQty = movementQty;
this.scrappedQty = CoalesceUtil.coalesce(scrappedQty, movementQty::toZero);
this.rejectedQty = CoalesceUtil.coalesce(rejectedQty, movementQty::toZero);
this.uomId = Quantity.getCommonUomIdOfAll(
this.movementQty,
this.scrappedQty,
this.rejectedQty
);
}
|
public static PPCostCollectorQuantities ofMovementQty(@NonNull final Quantity movementQty)
{
return builder().movementQty(movementQty).build();
}
public PPCostCollectorQuantities negate()
{
return toBuilder()
.movementQty(getMovementQty().negate())
.scrappedQty(getScrappedQty().negate())
.rejectedQty(getRejectedQty().negate())
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\api\PPCostCollectorQuantities.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class Book implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private Long id;
private String title;
private String isbn;
private String author;
@OneToMany(cascade = CascadeType.ALL,
mappedBy = "book", orphanRemoval = true)
private List<BookReview> reviews = new ArrayList<>();
public void addReview(BookReview review) {
this.reviews.add(review);
review.setBook(this);
}
public void removeReview(BookReview review) {
review.setBook(null);
this.reviews.remove(review);
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getIsbn() {
return isbn;
}
|
public void setIsbn(String isbn) {
this.isbn = isbn;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public List<BookReview> getReviews() {
return reviews;
}
public void setReviews(List<BookReview> reviews) {
this.reviews = reviews;
}
}
|
repos\Hibernate-SpringBoot-master\HibernateSpringBootDomainEvents\src\main\java\com\bookstore\entity\Book.java
| 2
|
请完成以下Java代码
|
public SetMultimap<TableRecordReference, ExistingLockInfo> getLockInfosByRecordIds(@NonNull final TableRecordReferenceSet recordRefs)
{
if (recordRefs.isEmpty())
{
return ImmutableSetMultimap.of();
}
final ImmutableSetMultimap<AdTableId, Integer> recordIdsByTableId = recordRefs.stream()
.collect(ImmutableSetMultimap.toImmutableSetMultimap(TableRecordReference::getAdTableId, TableRecordReference::getRecord_ID));
final StringBuilder sqlWhereClause = new StringBuilder();
final ArrayList<Object> sqlWhereClauseParams = new ArrayList<>();
for (final AdTableId adTableId : recordIdsByTableId.keySet())
{
final ImmutableSet<Integer> recordIds = recordIdsByTableId.get(adTableId);
if (sqlWhereClause.length() > 0)
{
sqlWhereClause.append(" OR ");
}
sqlWhereClause.append("(");
sqlWhereClause.append(I_T_Lock.COLUMNNAME_AD_Table_ID + "=?");
sqlWhereClauseParams.add(adTableId);
sqlWhereClause.append(" AND ").append(DB.buildSqlList(I_T_Lock.COLUMNNAME_Record_ID, recordIds, sqlWhereClauseParams));
sqlWhereClause.append(")");
}
return retrieveLockInfos(sqlWhereClause, sqlWhereClauseParams.toArray())
.stream()
|
.collect(ImmutableSetMultimap.toImmutableSetMultimap(
ExistingLockInfo::getLockedRecord,
lockInfo -> lockInfo
));
}
private ImmutableList<ExistingLockInfo> retrieveLockInfos(@NonNull final CharSequence sqlWhereClause, final Object... sqlWhereClauseParams)
{
final String sql =
"SELECT " + I_T_Lock.COLUMNNAME_AD_Table_ID + ", "
+ I_T_Lock.COLUMNNAME_T_Lock_ID + ", "
+ I_T_Lock.COLUMNNAME_Record_ID + ", "
+ I_T_Lock.COLUMNNAME_Owner + ", "
+ I_T_Lock.COLUMNNAME_IsAutoCleanup + ", "
+ I_T_Lock.COLUMNNAME_IsAllowMultipleOwners + ", "
+ I_T_Lock.COLUMNNAME_Created
+ " FROM " + I_T_Lock.Table_Name
+ " WHERE " + sqlWhereClause;
return trxManager.callInNewTrx(() -> DB.retrieveRows(sql, sqlWhereClauseParams, SqlLockDatabase::extractExistingLockInfo));
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.async\src\main\java\de\metas\lock\spi\impl\SqlLockDatabase.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public static String encode(String password) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
byte[] byteArray = md5.digest(password.getBytes("utf-8"));
String passwordMD5 = byteArrayToHexString(byteArray);
return passwordMD5;
} catch (Exception e) {
LOG.error(e.toString());
}
return password;
}
private static String byteArrayToHexString(byte[] byteArray) {
StringBuffer sb = new StringBuffer();
for (byte b : byteArray) {
|
sb.append(byteToHexChar(b));
}
return sb.toString();
}
private static Object byteToHexChar(byte b) {
int n = b;
if (n < 0) {
n = 256 + n;
}
int d1 = n / 16;
int d2 = n % 16;
return hex[d1] + hex[d2];
}
}
|
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\trade\utils\MD5Util.java
| 2
|
请完成以下Java代码
|
public File createPDF()
{
final DocumentReportService documentReportService = SpringContextHolder.instance.getBean(DocumentReportService.class);
final ReportResultData report = documentReportService.createStandardDocumentReportData(getCtx(), StandardDocumentReportType.MANUFACTURING_ORDER, getPP_Order_ID());
return report.writeToTemporaryFile(get_TableName() + get_ID());
}
@Override
public String getDocumentInfo()
{
final IDocTypeBL docTypeBL = Services.get(IDocTypeBL.class);
final DocTypeId docTypeId = DocTypeId.ofRepoId(getC_DocType_ID());
final ITranslatableString docTypeName = docTypeBL.getNameById(docTypeId);
return docTypeName.translate(Env.getADLanguageOrBaseLanguage()) + " " + getDocumentNo();
}
private PPOrderRouting getOrderRouting()
{
final PPOrderId orderId = PPOrderId.ofRepoId(getPP_Order_ID());
return Services.get(IPPOrderRoutingRepository.class).getByOrderId(orderId);
}
@Override
public String toString()
{
return "MPPOrder[ID=" + get_ID()
+ "-DocumentNo=" + getDocumentNo()
+ ",IsSOTrx=" + isSOTrx()
+ ",C_DocType_ID=" + getC_DocType_ID()
+ "]";
}
/**
* Auto report the first Activity and Sub contracting if are Milestone Activity
*/
private void autoReportActivities()
{
final IPPCostCollectorBL ppCostCollectorBL = Services.get(IPPCostCollectorBL.class);
final PPOrderRouting orderRouting = getOrderRouting();
for (final PPOrderRoutingActivity activity : orderRouting.getActivities())
{
if (activity.isMilestone()
&& (activity.isSubcontracting() || orderRouting.isFirstActivity(activity)))
{
ppCostCollectorBL.createActivityControl(ActivityControlCreateRequest.builder()
.order(this)
.orderActivity(activity)
.qtyMoved(activity.getQtyToDeliver())
|
.durationSetup(Duration.ZERO)
.duration(Duration.ZERO)
.build());
}
}
}
private void createVariances()
{
final IPPCostCollectorBL ppCostCollectorBL = Services.get(IPPCostCollectorBL.class);
//
for (final I_PP_Order_BOMLine bomLine : getLines())
{
ppCostCollectorBL.createMaterialUsageVariance(this, bomLine);
}
//
final PPOrderRouting orderRouting = getOrderRouting();
for (final PPOrderRoutingActivity activity : orderRouting.getActivities())
{
ppCostCollectorBL.createResourceUsageVariance(this, activity);
}
}
} // MPPOrder
|
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\model\MPPOrder.java
| 1
|
请完成以下Java代码
|
public void addGridTabRowBuilder(final int recordId, final IGridTabRowBuilder builder)
{
CompositeGridTabRowBuilder recordBuilders = builders.get(recordId);
if (recordBuilders == null)
{
recordBuilders = new CompositeGridTabRowBuilder();
builders.put(recordId, recordBuilders);
}
recordBuilders.addGridTabRowBuilder(builder);
}
@Override
public Set<Integer> getRecordIds()
{
final Set<Integer> recordIds = new HashSet<Integer>();
for (final Map.Entry<Integer, CompositeGridTabRowBuilder> e : builders.entrySet())
{
final CompositeGridTabRowBuilder builder = e.getValue();
if (!builder.isValid())
{
continue;
}
if (!builder.isCreateNewRecord())
{
continue;
}
final Integer recordId = e.getKey();
recordIds.add(recordId);
}
return recordIds;
}
@Override
public IGridTabRowBuilder getGridTabRowBuilder(final int recordId)
{
final CompositeGridTabRowBuilder recordBuilders = builders.get(recordId);
if (recordBuilders == null)
{
return NullGridTabRowBuilder.instance;
}
|
return recordBuilders;
}
private static final String createContextName(final int windowNo)
{
final String ctxName = windowNo + "|" + InfoWindowGridRowBuilders.class.getName();
return ctxName;
}
public void saveToContext(final Properties ctx, final int windowNo)
{
final String ctxName = createContextName(windowNo);
Env.put(ctx, ctxName, this);
}
/**
* Gets the builders from context and then it clears the context
*
* @param ctx
* @param windowNo
* @return builders or null
*/
public static IInfoWindowGridRowBuilders getFromContextOrNull(final Properties ctx, final int windowNo)
{
final String ctxName = createContextName(windowNo);
final IInfoWindowGridRowBuilders builders = Env.getAndRemove(ctx, ctxName);
return builders;
}
@Override
public String toString()
{
return String.format("InfoWindowGridRowBuilders [builders=%s]", builders);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\compiere\apps\search\impl\InfoWindowGridRowBuilders.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@ApiModelProperty(example = "http://localhost:8182/event-registry-repository/event-definitions/oneEvent%3A1%3A4")
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
@ApiModelProperty(example = "oneEvent")
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
@ApiModelProperty(example = "1")
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
}
@ApiModelProperty(example = "The One Event")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@ApiModelProperty(example = "null")
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
@ApiModelProperty(example = "2")
public String getDeploymentId() {
return deploymentId;
}
public void setDeploymentId(String deploymentId) {
this.deploymentId = deploymentId;
}
@ApiModelProperty(example = "http://localhost:8182/event-registry-repository/deployments/2")
public String getDeploymentUrl() {
return deploymentUrl;
}
public void setDeploymentUrl(String deploymentUrl) {
|
this.deploymentUrl = deploymentUrl;
}
@ApiModelProperty(example = "Examples")
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
@ApiModelProperty(example = "oneEvent.event")
public String getResourceName() {
return resourceName;
}
public void setResourceName(String resourceName) {
this.resourceName = resourceName;
}
public void setResource(String resource) {
this.resource = resource;
}
@ApiModelProperty(example = "http://localhost:8182/event-registry-repository/deployments/2/resources/oneEvent.event", value = "Contains the actual deployed event definition JSON.")
public String getResource() {
return resource;
}
@ApiModelProperty(example = "This is an event definition for testing purposes")
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
|
repos\flowable-engine-main\modules\flowable-event-registry-rest\src\main\java\org\flowable\eventregistry\rest\service\api\repository\EventDefinitionResponse.java
| 2
|
请完成以下Java代码
|
public Object getCredentials() {
return "";
}
/**
* Returns the ID Token previously issued by the Provider to the Client and used as a
* hint about the End-User's current authenticated session with the Client.
* @return the ID Token previously issued by the Provider to the Client
*/
public String getIdTokenHint() {
return this.idTokenHint;
}
/**
* Returns the ID Token previously issued by the Provider to the Client.
* @return the ID Token previously issued by the Provider to the Client
*/
@Nullable
public OidcIdToken getIdToken() {
return this.idToken;
}
/**
* Returns the End-User's current authenticated session identifier with the Provider.
* @return the End-User's current authenticated session identifier with the Provider
*/
@Nullable
public String getSessionId() {
return this.sessionId;
}
/**
* Returns the client identifier the ID Token was issued to.
* @return the client identifier
*/
@Nullable
|
public String getClientId() {
return this.clientId;
}
/**
* Returns the URI which the Client is requesting that the End-User's User Agent be
* redirected to after a logout has been performed.
* @return the URI which the Client is requesting that the End-User's User Agent be
* redirected to after a logout has been performed
*/
@Nullable
public String getPostLogoutRedirectUri() {
return this.postLogoutRedirectUri;
}
/**
* Returns the opaque value used by the Client to maintain state between the logout
* request and the callback to the {@link #getPostLogoutRedirectUri()}.
* @return the opaque value used by the Client to maintain state between the logout
* request and the callback to the {@link #getPostLogoutRedirectUri()}
*/
@Nullable
public String getState() {
return this.state;
}
}
|
repos\spring-security-main\oauth2\oauth2-authorization-server\src\main\java\org\springframework\security\oauth2\server\authorization\oidc\authentication\OidcLogoutAuthenticationToken.java
| 1
|
请完成以下Java代码
|
public byte[] getY() {
return y;
}
/**
* Sets the value of the y property.
*
* @param value
* allowed object is
* byte[]
*/
public void setY(byte[] value) {
this.y = value;
}
/**
* Gets the value of the j property.
*
* @return
* possible object is
* byte[]
*/
public byte[] getJ() {
return j;
}
/**
* Sets the value of the j property.
*
* @param value
* allowed object is
* byte[]
*/
public void setJ(byte[] value) {
this.j = value;
}
/**
* Gets the value of the seed property.
*
* @return
* possible object is
* byte[]
*/
public byte[] getSeed() {
return seed;
}
/**
* Sets the value of the seed property.
*
* @param value
* allowed object is
* byte[]
*/
|
public void setSeed(byte[] value) {
this.seed = value;
}
/**
* Gets the value of the pgenCounter property.
*
* @return
* possible object is
* byte[]
*/
public byte[] getPgenCounter() {
return pgenCounter;
}
/**
* Sets the value of the pgenCounter property.
*
* @param value
* allowed object is
* byte[]
*/
public void setPgenCounter(byte[] value) {
this.pgenCounter = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_440_request\src\main\java-xjc\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_440\request\DSAKeyValueType.java
| 1
|
请完成以下Java代码
|
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Other SQL Clause.
@param OtherClause
Other SQL Clause
*/
public void setOtherClause (String OtherClause)
{
set_Value (COLUMNNAME_OtherClause, OtherClause);
}
/** Get Other SQL Clause.
@return Other SQL Clause
*/
public String getOtherClause ()
{
return (String)get_Value(COLUMNNAME_OtherClause);
}
/** Set Record ID.
@param Record_ID
Direct internal record ID
*/
public void setRecord_ID (int Record_ID)
{
if (Record_ID < 0)
set_ValueNoCheck (COLUMNNAME_Record_ID, null);
else
set_ValueNoCheck (COLUMNNAME_Record_ID, Integer.valueOf(Record_ID));
}
/** Get Record ID.
@return Direct internal record ID
|
*/
public int getRecord_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Record_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Sql WHERE.
@param WhereClause
Fully qualified SQL WHERE clause
*/
public void setWhereClause (String WhereClause)
{
set_Value (COLUMNNAME_WhereClause, WhereClause);
}
/** Get Sql WHERE.
@return Fully qualified SQL WHERE clause
*/
public String getWhereClause ()
{
return (String)get_Value(COLUMNNAME_WhereClause);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_CM_ContainerTTable.java
| 1
|
请完成以下Java代码
|
public String toString()
{
StringBuffer sb = new StringBuffer ("X_R_GroupUpdates[")
.append(get_ID()).append("]");
return sb.toString();
}
public I_AD_User getAD_User() throws RuntimeException
{
return (I_AD_User)MTable.get(getCtx(), I_AD_User.Table_Name)
.getPO(getAD_User_ID(), get_TrxName()); }
/** Set User/Contact.
@param AD_User_ID
User within the system - Internal or Business Partner Contact
*/
public void setAD_User_ID (int AD_User_ID)
{
if (AD_User_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_User_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_User_ID, Integer.valueOf(AD_User_ID));
}
/** Get User/Contact.
@return User within the system - Internal or Business Partner Contact
*/
public int getAD_User_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Self-Service.
@param IsSelfService
This is a Self-Service entry or this entry can be changed via Self-Service
*/
public void setIsSelfService (boolean IsSelfService)
{
set_Value (COLUMNNAME_IsSelfService, Boolean.valueOf(IsSelfService));
}
|
/** Get Self-Service.
@return This is a Self-Service entry or this entry can be changed via Self-Service
*/
public boolean isSelfService ()
{
Object oo = get_Value(COLUMNNAME_IsSelfService);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
public I_R_Group getR_Group() throws RuntimeException
{
return (I_R_Group)MTable.get(getCtx(), I_R_Group.Table_Name)
.getPO(getR_Group_ID(), get_TrxName()); }
/** Set Group.
@param R_Group_ID
Request Group
*/
public void setR_Group_ID (int R_Group_ID)
{
if (R_Group_ID < 1)
set_ValueNoCheck (COLUMNNAME_R_Group_ID, null);
else
set_ValueNoCheck (COLUMNNAME_R_Group_ID, Integer.valueOf(R_Group_ID));
}
/** Get Group.
@return Request Group
*/
public int getR_Group_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_R_Group_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_R_GroupUpdates.java
| 1
|
请完成以下Java代码
|
public org.compiere.model.I_AD_UI_Column getAD_UI_Column() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_AD_UI_Column_ID, org.compiere.model.I_AD_UI_Column.class);
}
@Override
public void setAD_UI_Column(org.compiere.model.I_AD_UI_Column AD_UI_Column)
{
set_ValueFromPO(COLUMNNAME_AD_UI_Column_ID, org.compiere.model.I_AD_UI_Column.class, AD_UI_Column);
}
/** Set UI Column.
@param AD_UI_Column_ID UI Column */
@Override
public void setAD_UI_Column_ID (int AD_UI_Column_ID)
{
if (AD_UI_Column_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_UI_Column_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_UI_Column_ID, Integer.valueOf(AD_UI_Column_ID));
}
/** Get UI Column.
@return UI Column */
@Override
public int getAD_UI_Column_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_UI_Column_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set UI Element Group.
@param AD_UI_ElementGroup_ID UI Element Group */
@Override
public void setAD_UI_ElementGroup_ID (int AD_UI_ElementGroup_ID)
{
if (AD_UI_ElementGroup_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_UI_ElementGroup_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_UI_ElementGroup_ID, Integer.valueOf(AD_UI_ElementGroup_ID));
}
/** Get UI Element Group.
@return UI Element Group */
@Override
public int getAD_UI_ElementGroup_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_UI_ElementGroup_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
|
*/
@Override
public void setName (java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
@Override
public java.lang.String getName ()
{
return (java.lang.String)get_Value(COLUMNNAME_Name);
}
/** Set Reihenfolge.
@param SeqNo
Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst
*/
@Override
public void setSeqNo (int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo));
}
/** Get Reihenfolge.
@return Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst
*/
@Override
public int getSeqNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set UI Style.
@param UIStyle UI Style */
@Override
public void setUIStyle (java.lang.String UIStyle)
{
set_Value (COLUMNNAME_UIStyle, UIStyle);
}
/** Get UI Style.
@return UI Style */
@Override
public java.lang.String getUIStyle ()
{
return (java.lang.String)get_Value(COLUMNNAME_UIStyle);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_UI_ElementGroup.java
| 1
|
请完成以下Java代码
|
public void setMediaType (String MediaType)
{
set_Value (COLUMNNAME_MediaType, MediaType);
}
/** Get Media Type.
@return Defines the media type for the browser
*/
public String getMediaType ()
{
return (String)get_Value(COLUMNNAME_MediaType);
}
/** 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_CM_Media.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void setLINENUMBER(String value) {
this.linenumber = value;
}
/**
* Gets the value of the taxqual property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTAXQUAL() {
return taxqual;
}
/**
* Sets the value of the taxqual property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTAXQUAL(String value) {
this.taxqual = value;
}
/**
* Gets the value of the taxcode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTAXCODE() {
return taxcode;
}
/**
* Sets the value of the taxcode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTAXCODE(String value) {
this.taxcode = value;
}
/**
* Gets the value of the taxrate property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTAXRATE() {
return taxrate;
}
/**
* Sets the value of the taxrate property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTAXRATE(String value) {
this.taxrate = value;
}
/**
* Gets the value of the taxcategory property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTAXCATEGORY() {
return taxcategory;
}
|
/**
* Sets the value of the taxcategory property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTAXCATEGORY(String value) {
this.taxcategory = value;
}
/**
* Gets the value of the taxamount property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTAXAMOUNT() {
return taxamount;
}
/**
* Sets the value of the taxamount property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTAXAMOUNT(String value) {
this.taxamount = value;
}
/**
* Gets the value of the taxableamount property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTAXABLEAMOUNT() {
return taxableamount;
}
/**
* Sets the value of the taxableamount property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTAXABLEAMOUNT(String value) {
this.taxableamount = value;
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_stepcom_desadv\de\metas\edi\esb\jaxb\stepcom\desadv\DTAXI1.java
| 2
|
请完成以下Java代码
|
public Object remove(Object key) {
throw new UnsupportedOperationException("decision output is immutable");
}
@Override
public void putAll(Map<? extends String, ?> m) {
throw new UnsupportedOperationException("decision output is immutable");
}
@Override
public void clear() {
throw new UnsupportedOperationException("decision output is immutable");
}
@Override
public Set<Entry<String, Object>> entrySet() {
Set<Entry<String, Object>> entrySet = new HashSet<Entry<String, Object>>();
for (Entry<String, TypedValue> typedEntry : outputValues.entrySet()) {
DmnDecisionRuleOutputEntry entry = new DmnDecisionRuleOutputEntry(typedEntry.getKey(), typedEntry.getValue());
entrySet.add(entry);
}
return entrySet;
}
protected class DmnDecisionRuleOutputEntry implements Entry<String, Object> {
protected final String key;
protected final TypedValue typedValue;
public DmnDecisionRuleOutputEntry(String key, TypedValue typedValue) {
this.key = key;
this.typedValue = typedValue;
}
@Override
public String getKey() {
return key;
|
}
@Override
public Object getValue() {
if (typedValue != null) {
return typedValue.getValue();
} else {
return null;
}
}
@Override
public Object setValue(Object value) {
throw new UnsupportedOperationException("decision output entry is immutable");
}
}
}
|
repos\camunda-bpm-platform-master\engine-dmn\engine\src\main\java\org\camunda\bpm\dmn\engine\impl\DmnDecisionResultEntriesImpl.java
| 1
|
请完成以下Java代码
|
public void setValues(final PreparedStatement ps, final int i) throws SQLException {
ps.setInt(1, employees.get(i).getId());
ps.setString(2, employees.get(i).getFirstName());
ps.setString(3, employees.get(i).getLastName());
ps.setString(4, employees.get(i).getAddress());
}
@Override
public int getBatchSize() {
return 3;
}
});
}
public int[] batchUpdateUsingNamedParameterJDBCTemplate(final List<Employee> employees) {
|
final SqlParameterSource[] batch = SqlParameterSourceUtils.createBatch(employees.toArray());
final int[] updateCounts = namedParameterJdbcTemplate.batchUpdate("INSERT INTO EMPLOYEE VALUES (:id, :firstName, :lastName, :address)", batch);
return updateCounts;
}
public Employee getEmployeeUsingSimpleJdbcCall(int id) {
SqlParameterSource in = new MapSqlParameterSource().addValue("in_id", id);
Map<String, Object> out = simpleJdbcCall.execute(in);
Employee emp = new Employee();
emp.setFirstName((String) out.get("FIRST_NAME"));
emp.setLastName((String) out.get("LAST_NAME"));
return emp;
}
}
|
repos\tutorials-master\persistence-modules\spring-persistence-simple\src\main\java\com\baeldung\spring\jdbc\template\guide\EmployeeDAO.java
| 1
|
请完成以下Java代码
|
private IQueryBuilder<I_C_Invoice> createCommonQueryBuilder(@NonNull final OrgId orgId)
{
return Services.get(IQueryBL.class)
.createQueryBuilder(I_C_Invoice.class)
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_C_Invoice.COLUMNNAME_AD_Org_ID, orgId)
.addEqualsFilter(I_C_Invoice.COLUMN_IsSOTrx, true)
.addEqualsFilter(I_C_Invoice.COLUMN_DocStatus, IDocument.STATUS_Completed)
.orderBy(I_C_Invoice.COLUMN_DateInvoiced)
.orderBy(I_C_Invoice.COLUMN_C_Invoice_ID)
.setOption(IQuery.OPTION_ReturnReadOnlyRecords, true);
}
@Value
public static class PaymentStatusQuery
{
String orgValue;
String invoiceDocumentNoPrefix;
LocalDate dateInvoicedFrom;
LocalDate dateInvoicedTo;
|
@Builder
private PaymentStatusQuery(
@NonNull final String orgValue,
@Nullable final String invoiceDocumentNoPrefix,
@Nullable final LocalDate dateInvoicedFrom,
@Nullable final LocalDate dateInvoicedTo)
{
this.orgValue = assumeNotEmpty(orgValue, "Parameter 'orgValue' may not be empty");
this.invoiceDocumentNoPrefix = invoiceDocumentNoPrefix;
this.dateInvoicedFrom = dateInvoicedFrom;
this.dateInvoicedTo = dateInvoicedTo;
if (isBlank(invoiceDocumentNoPrefix))
{
Check.assumeNotNull(dateInvoicedFrom, "If parameter 'invoiceDocumentNoPrefix' is empty, then both dateInvoicedFrom and dateInvoicedTo need to be set, but dateInvoicedFrom is null");
Check.assumeNotNull(dateInvoicedTo, "If parameter 'invoiceDocumentNoPrefix' is empty, then both dateInvoicedFrom and dateInvoicedTo need to be set, but dateInvoicedTo is null");
}
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business.rest-api-impl\src\main\java\de\metas\rest_api\v1\invoice\impl\SalesInvoicePaymentStatusRepository.java
| 1
|
请完成以下Java代码
|
public List<I_C_Print_Job_Detail> getCreatePrintJobDetails(final I_C_Print_Job_Line printJobLine)
{
//
// Retrieve details if any
List<I_C_Print_Job_Detail> printJobDetails = printingDAO.retrievePrintJobDetailsIfAny(printJobLine);
if (printJobDetails != null && !printJobDetails.isEmpty())
{
return printJobDetails;
}
//
// Try to create them now
logger.info("Print Job Line has no details: {}. Creating them now...", printJobLine);
final I_C_Printing_Queue item = printJobLine.getC_Printing_Queue();
printJobDetails = createPrintJobDetails(printJobLine, item);
return printJobDetails;
}
private List<I_C_Print_Job_Detail> createPrintJobDetails(final I_C_Print_Job_Line printJobLine, final I_C_Printing_Queue item)
{
final List<I_AD_PrinterRouting> printerRoutings = findPrinterRoutings(item);
Check.errorIf(printerRoutings.isEmpty(), "Found no AD_PrinterRouting record(s) for C_Printing_Queue {}", item);
if (printerRoutings.isEmpty())
{
return Collections.emptyList(); // just for the case that we configured Check not to throw an exception
}
final List<I_C_Print_Job_Detail> printJobDetails = new ArrayList<>(printerRoutings.size());
for (final I_AD_PrinterRouting printerRouting : printerRoutings)
{
Check.assumeNotNull(printerRouting, "AD_PrinterRouting {} found for C_Printing_Queue {}", printerRouting, item);
final I_C_Print_Job_Detail printJobDetail = createPrintJobDetail(printJobLine, printerRouting);
if (printJobDetail != null)
{
printJobDetails.add(printJobDetail);
}
}
return printJobDetails;
}
private I_C_Print_Job_Detail createPrintJobDetail(
final I_C_Print_Job_Line printJobLine,
final I_AD_PrinterRouting routing)
{
final I_C_Print_Job_Detail printJobDetail = InterfaceWrapperHelper.newInstance(I_C_Print_Job_Detail.class, printJobLine);
printJobDetail.setAD_Org_ID(printJobLine.getAD_Org_ID());
printJobDetail.setIsActive(true);
printJobDetail.setAD_PrinterRouting_ID(routing.getAD_PrinterRouting_ID());
printJobDetail.setC_Print_Job_Line(printJobLine);
|
InterfaceWrapperHelper.save(printJobDetail);
return printJobDetail;
}
private List<I_AD_PrinterRouting> findPrinterRoutings(final I_C_Printing_Queue item)
{
final PrinterRoutingsQuery query = printingQueueBL.createPrinterRoutingsQueryForItem(item);
final List<de.metas.adempiere.model.I_AD_PrinterRouting> rs = printerRoutingDAO.fetchPrinterRoutings(query);
return InterfaceWrapperHelper.createList(rs, I_AD_PrinterRouting.class);
}
@Override
public String getSummary(final I_C_Print_Job printJob)
{
final Properties ctx = InterfaceWrapperHelper.getCtx(printJob);
return Services.get(IMsgBL.class).translate(ctx, I_C_Print_Job.COLUMNNAME_C_Print_Job_ID)
+ " "
+ printJob.getC_Print_Job_ID();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.printing\de.metas.printing.base\src\main\java\de\metas\printing\api\impl\PrintJobBL.java
| 1
|
请完成以下Java代码
|
public void checkDeleteLicenseKey() {
}
@Override
public void checkSetLicenseKey() {
}
@Override
public void checkReadLicenseKey() {
}
@Override
public void checkRegisterProcessApplication() {
}
@Override
public void checkUnregisterProcessApplication() {
}
@Override
public void checkReadRegisteredDeployments() {
}
@Override
public void checkReadProcessApplicationForDeployment() {
}
@Override
public void checkRegisterDeployment() {
}
@Override
public void checkUnregisterDeployment() {
}
@Override
public void checkDeleteMetrics() {
}
@Override
public void checkDeleteTaskMetrics() {
}
@Override
public void checkReadSchemaLog() {
|
}
// helper //////////////////////////////////////////////////
protected TenantManager getTenantManager() {
return Context.getCommandContext().getTenantManager();
}
protected ProcessDefinitionEntity findLatestProcessDefinitionById(String processDefinitionId) {
return Context.getCommandContext().getProcessDefinitionManager().findLatestProcessDefinitionById(processDefinitionId);
}
protected DecisionDefinitionEntity findLatestDecisionDefinitionById(String decisionDefinitionId) {
return Context.getCommandContext().getDecisionDefinitionManager().findDecisionDefinitionById(decisionDefinitionId);
}
protected ExecutionEntity findExecutionById(String processInstanceId) {
return Context.getCommandContext().getExecutionManager().findExecutionById(processInstanceId);
}
protected DeploymentEntity findDeploymentById(String deploymentId) {
return Context.getCommandContext().getDeploymentManager().findDeploymentById(deploymentId);
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cfg\multitenancy\TenantCommandChecker.java
| 1
|
请完成以下Java代码
|
public class M_Inventory_Mark_As_Counted extends JavaProcess implements IProcessPrecondition
{
final IInventoryBL inventoryBL = Services.get(IInventoryBL.class);
@Override
public ProcessPreconditionsResolution checkPreconditionsApplicable(final @NonNull IProcessPreconditionsContext context)
{
if (context.isMoreThanOneSelected())
{
return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection();
}
if (context.isNoSelection())
{
return ProcessPreconditionsResolution.rejectBecauseNoSelection().toInternal();
|
}
return ProcessPreconditionsResolution.accept();
}
@Override
protected String doIt() throws Exception
{
final InventoryId inventoryId = InventoryId.ofRepoId(getRecord_ID());
inventoryBL.markInventoryLinesAsCounted(inventoryId);
return MSG_OK;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\inventory\process\M_Inventory_Mark_As_Counted.java
| 1
|
请完成以下Java代码
|
default void starting(ConfigurableBootstrapContext bootstrapContext) {
}
/**
* Called once the environment has been prepared, but before the
* {@link ApplicationContext} has been created.
* @param bootstrapContext the bootstrap context
* @param environment the environment
*/
default void environmentPrepared(ConfigurableBootstrapContext bootstrapContext,
ConfigurableEnvironment environment) {
}
/**
* Called once the {@link ApplicationContext} has been created and prepared, but
* before sources have been loaded.
* @param context the application context
*/
default void contextPrepared(ConfigurableApplicationContext context) {
}
/**
* Called once the application context has been loaded but before it has been
* refreshed.
* @param context the application context
*/
default void contextLoaded(ConfigurableApplicationContext context) {
}
/**
* The context has been refreshed and the application has started but
* {@link CommandLineRunner CommandLineRunners} and {@link ApplicationRunner
* ApplicationRunners} have not been called.
* @param context the application context.
* @param timeTaken the time taken to start the application or {@code null} if unknown
* @since 2.6.0
*/
default void started(ConfigurableApplicationContext context, @Nullable Duration timeTaken) {
}
|
/**
* Called immediately before the run method finishes, when the application context has
* been refreshed and all {@link CommandLineRunner CommandLineRunners} and
* {@link ApplicationRunner ApplicationRunners} have been called.
* @param context the application context.
* @param timeTaken the time taken for the application to be ready or {@code null} if
* unknown
* @since 2.6.0
*/
default void ready(ConfigurableApplicationContext context, @Nullable Duration timeTaken) {
}
/**
* Called when a failure occurs when running the application.
* @param context the application context or {@code null} if a failure occurred before
* the context was created
* @param exception the failure
* @since 2.0.0
*/
default void failed(@Nullable ConfigurableApplicationContext context, Throwable exception) {
}
}
|
repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\SpringApplicationRunListener.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
protected void initUserDetailsService() {
if (!this.initScripts.isEmpty()) {
getDataSourceInit().afterPropertiesSet();
}
super.initUserDetailsService();
}
@Override
public JdbcUserDetailsManager getUserDetailsService() {
return (JdbcUserDetailsManager) super.getUserDetailsService();
}
/**
* Populates the default schema that allows users and authorities to be stored.
* @return The {@link JdbcUserDetailsManagerConfigurer} used for additional
* customizations
*/
public JdbcUserDetailsManagerConfigurer<B> withDefaultSchema() {
this.initScripts.add(new ClassPathResource("org/springframework/security/core/userdetails/jdbc/users.ddl"));
|
return this;
}
protected DatabasePopulator getDatabasePopulator() {
ResourceDatabasePopulator dbp = new ResourceDatabasePopulator();
dbp.setScripts(this.initScripts.toArray(new Resource[0]));
return dbp;
}
private DataSourceInitializer getDataSourceInit() {
DataSourceInitializer dsi = new DataSourceInitializer();
dsi.setDatabasePopulator(getDatabasePopulator());
dsi.setDataSource(this.dataSource);
return dsi;
}
}
|
repos\spring-security-main\config\src\main\java\org\springframework\security\config\annotation\authentication\configurers\provisioning\JdbcUserDetailsManagerConfigurer.java
| 2
|
请完成以下Java代码
|
public int getAD_ReportView_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_ReportView_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_AD_Table getAD_Table() throws RuntimeException
{
return (I_AD_Table)MTable.get(getCtx(), I_AD_Table.Table_Name)
.getPO(getAD_Table_ID(), get_TrxName()); }
/** Set Table.
@param AD_Table_ID
Database Table information
*/
public void setAD_Table_ID (int AD_Table_ID)
{
if (AD_Table_ID < 1)
set_Value (COLUMNNAME_AD_Table_ID, null);
else
set_Value (COLUMNNAME_AD_Table_ID, Integer.valueOf(AD_Table_ID));
}
/** Get Table.
@return Database Table information
*/
public int getAD_Table_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Table_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** EntityType AD_Reference_ID=389 */
public static final int ENTITYTYPE_AD_Reference_ID=389;
/** Set Entity Type.
@param EntityType
Dictionary Entity Type; Determines ownership and synchronization
*/
public void setEntityType (String EntityType)
{
set_Value (COLUMNNAME_EntityType, EntityType);
}
/** Get Entity Type.
@return Dictionary Entity Type; Determines ownership and synchronization
*/
public String getEntityType ()
{
return (String)get_Value(COLUMNNAME_EntityType);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
|
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Sql ORDER BY.
@param OrderByClause
Fully qualified ORDER BY clause
*/
public void setOrderByClause (String OrderByClause)
{
set_Value (COLUMNNAME_OrderByClause, OrderByClause);
}
/** Get Sql ORDER BY.
@return Fully qualified ORDER BY clause
*/
public String getOrderByClause ()
{
return (String)get_Value(COLUMNNAME_OrderByClause);
}
/** Set Sql WHERE.
@param WhereClause
Fully qualified SQL WHERE clause
*/
public void setWhereClause (String WhereClause)
{
set_Value (COLUMNNAME_WhereClause, WhereClause);
}
/** Get Sql WHERE.
@return Fully qualified SQL WHERE clause
*/
public String getWhereClause ()
{
return (String)get_Value(COLUMNNAME_WhereClause);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_ReportView.java
| 1
|
请完成以下Java代码
|
public void checkSetLicenseKey() {
}
@Override
public void checkReadLicenseKey() {
}
@Override
public void checkRegisterProcessApplication() {
}
@Override
public void checkUnregisterProcessApplication() {
}
@Override
public void checkReadRegisteredDeployments() {
}
@Override
public void checkReadProcessApplicationForDeployment() {
}
@Override
public void checkRegisterDeployment() {
}
@Override
public void checkUnregisterDeployment() {
}
@Override
public void checkDeleteMetrics() {
}
@Override
public void checkDeleteTaskMetrics() {
|
}
@Override
public void checkReadSchemaLog() {
}
// helper //////////////////////////////////////////////////
protected TenantManager getTenantManager() {
return Context.getCommandContext().getTenantManager();
}
protected ProcessDefinitionEntity findLatestProcessDefinitionById(String processDefinitionId) {
return Context.getCommandContext().getProcessDefinitionManager().findLatestProcessDefinitionById(processDefinitionId);
}
protected DecisionDefinitionEntity findLatestDecisionDefinitionById(String decisionDefinitionId) {
return Context.getCommandContext().getDecisionDefinitionManager().findDecisionDefinitionById(decisionDefinitionId);
}
protected ExecutionEntity findExecutionById(String processInstanceId) {
return Context.getCommandContext().getExecutionManager().findExecutionById(processInstanceId);
}
protected DeploymentEntity findDeploymentById(String deploymentId) {
return Context.getCommandContext().getDeploymentManager().findDeploymentById(deploymentId);
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cfg\multitenancy\TenantCommandChecker.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public CmmnEngineConfigurator cmmnEngineConfigurator(SpringCmmnEngineConfiguration cmmnEngineConfiguration) {
SpringCmmnEngineConfigurator cmmnEngineConfigurator = new SpringCmmnEngineConfigurator();
cmmnEngineConfigurator.setCmmnEngineConfiguration(cmmnEngineConfiguration);
cmmnEngineConfiguration.setDisableIdmEngine(true);
cmmnEngineConfiguration.setDisableEventRegistry(true);
invokeConfigurers(cmmnEngineConfiguration);
return cmmnEngineConfigurator;
}
}
@Configuration(proxyBeanMethods = false)
@ConditionalOnBean(type = {
"org.flowable.app.spring.SpringAppEngineConfiguration"
})
public static class CmmnEngineAppConfiguration extends BaseEngineConfigurationWithConfigurers<SpringCmmnEngineConfiguration> {
@Bean
@ConditionalOnMissingBean(name = "cmmnAppEngineConfigurationConfigurer")
public EngineConfigurationConfigurer<SpringAppEngineConfiguration> cmmnAppEngineConfigurationConfigurer(CmmnEngineConfigurator cmmnEngineConfigurator) {
return appEngineConfiguration -> appEngineConfiguration.addConfigurator(cmmnEngineConfigurator);
}
|
@Bean
@ConditionalOnMissingBean
public CmmnEngineConfigurator cmmnEngineConfigurator(SpringCmmnEngineConfiguration cmmnEngineConfiguration) {
SpringCmmnEngineConfigurator cmmnEngineConfigurator = new SpringCmmnEngineConfigurator();
cmmnEngineConfigurator.setCmmnEngineConfiguration(cmmnEngineConfiguration);
cmmnEngineConfiguration.setDisableIdmEngine(true);
cmmnEngineConfiguration.setDisableEventRegistry(true);
invokeConfigurers(cmmnEngineConfiguration);
return cmmnEngineConfigurator;
}
}
}
|
repos\flowable-engine-main\modules\flowable-spring-boot\flowable-spring-boot-starters\flowable-spring-boot-autoconfigure\src\main\java\org\flowable\spring\boot\cmmn\CmmnEngineAutoConfiguration.java
| 2
|
请完成以下Java代码
|
public String getProductUnit() {
return productUnit;
}
public void setProductUnit(String productUnit) {
this.productUnit = productUnit;
}
public Integer getNavStatus() {
return navStatus;
}
public void setNavStatus(Integer navStatus) {
this.navStatus = navStatus;
}
public Integer getShowStatus() {
return showStatus;
}
public void setShowStatus(Integer showStatus) {
this.showStatus = showStatus;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getKeywords() {
return keywords;
}
public void setKeywords(String keywords) {
this.keywords = keywords;
}
|
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", parentId=").append(parentId);
sb.append(", name=").append(name);
sb.append(", level=").append(level);
sb.append(", productCount=").append(productCount);
sb.append(", productUnit=").append(productUnit);
sb.append(", navStatus=").append(navStatus);
sb.append(", showStatus=").append(showStatus);
sb.append(", sort=").append(sort);
sb.append(", icon=").append(icon);
sb.append(", keywords=").append(keywords);
sb.append(", description=").append(description);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
|
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\PmsProductCategory.java
| 1
|
请完成以下Java代码
|
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_C_Withholding_Acct[")
.append(get_ID()).append("]");
return sb.toString();
}
public I_C_AcctSchema getC_AcctSchema() throws RuntimeException
{
return (I_C_AcctSchema)MTable.get(getCtx(), I_C_AcctSchema.Table_Name)
.getPO(getC_AcctSchema_ID(), get_TrxName()); }
/** Set Accounting Schema.
@param C_AcctSchema_ID
Rules for accounting
*/
public void setC_AcctSchema_ID (int C_AcctSchema_ID)
{
if (C_AcctSchema_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_AcctSchema_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_AcctSchema_ID, Integer.valueOf(C_AcctSchema_ID));
}
/** Get Accounting Schema.
@return Rules for accounting
*/
public int getC_AcctSchema_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_AcctSchema_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_C_Withholding getC_Withholding() throws RuntimeException
{
return (I_C_Withholding)MTable.get(getCtx(), I_C_Withholding.Table_Name)
.getPO(getC_Withholding_ID(), get_TrxName()); }
/** Set Withholding.
@param C_Withholding_ID
Withholding type defined
*/
public void setC_Withholding_ID (int C_Withholding_ID)
{
if (C_Withholding_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Withholding_ID, null);
else
|
set_ValueNoCheck (COLUMNNAME_C_Withholding_ID, Integer.valueOf(C_Withholding_ID));
}
/** Get Withholding.
@return Withholding type defined
*/
public int getC_Withholding_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Withholding_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_C_ValidCombination getWithholding_A() throws RuntimeException
{
return (I_C_ValidCombination)MTable.get(getCtx(), I_C_ValidCombination.Table_Name)
.getPO(getWithholding_Acct(), get_TrxName()); }
/** Set Withholding.
@param Withholding_Acct
Account for Withholdings
*/
public void setWithholding_Acct (int Withholding_Acct)
{
set_Value (COLUMNNAME_Withholding_Acct, Integer.valueOf(Withholding_Acct));
}
/** Get Withholding.
@return Account for Withholdings
*/
public int getWithholding_Acct ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Withholding_Acct);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Withholding_Acct.java
| 1
|
请完成以下Java代码
|
public BigDecimal getQtyTU()
{
return forecastLine.getQtyEnteredTU();
}
@Override
public void setQtyTU(final BigDecimal qtyPacks)
{
forecastLine.setQtyEnteredTU(qtyPacks);
}
@Override
public void setC_BPartner_ID(final int partnerId)
{
values.setC_BPartner_ID(partnerId);
}
|
@Override
public int getC_BPartner_ID()
{
return values.getC_BPartner_ID();
}
@Override
public boolean isInDispute()
{
return values.isInDispute();
}
@Override
public void setInDispute(final boolean inDispute)
{
values.setInDispute(inDispute);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\adempiere\gui\search\impl\ForecastLineHUPackingAware.java
| 1
|
请完成以下Java代码
|
public FilterSql acceptAll() {return FilterSql.ALLOW_ALL;}
@Override
public FilterSql acceptAllBut(@NonNull final Set<HuId> alwaysIncludeHUIds, @NonNull final Set<HuId> excludeHUIds)
{
final SqlAndParams whereClause = !excludeHUIds.isEmpty()
? toSql(newHUQuery().addHUIdsToExclude(excludeHUIds))
: null;
return FilterSql.builder()
.whereClause(whereClause)
.alwaysIncludeSql(toAlwaysIncludeSql(alwaysIncludeHUIds))
.build();
}
@Override
public FilterSql acceptNone() {return FilterSql.ALLOW_NONE;}
@Override
public FilterSql acceptOnly(@NonNull final HuIdsFilterList fixedHUIds, @NonNull final Set<HuId> alwaysIncludeHUIds)
{
final SqlAndParams whereClause = fixedHUIds.isNone()
? FilterSql.ALLOW_NONE.getWhereClause()
: toSql(newHUQuery().addOnlyHUIds(fixedHUIds.toSet()));
return FilterSql.builder()
|
.whereClause(whereClause)
.alwaysIncludeSql(toAlwaysIncludeSql(alwaysIncludeHUIds))
.build();
}
@Override
public FilterSql huQuery(final @NonNull IHUQueryBuilder initialHUQueryCopy, final @NonNull Set<HuId> alwaysIncludeHUIds, final @NonNull Set<HuId> excludeHUIds)
{
initialHUQueryCopy.setContext(PlainContextAware.newOutOfTrx());
initialHUQueryCopy.addHUIdsToAlwaysInclude(alwaysIncludeHUIds);
initialHUQueryCopy.addHUIdsToExclude(excludeHUIds);
return FilterSql.builder()
.whereClause(toSql(initialHUQueryCopy))
.alwaysIncludeSql(toAlwaysIncludeSql(alwaysIncludeHUIds))
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\filter\HUIdsFilterDataToSqlCaseConverter.java
| 1
|
请完成以下Java代码
|
private WebClient.RequestHeadersSpec<?> getRequestHeaderSpec(OAuth2UserRequest userRequest, String userInfoUri,
AuthenticationMethod authenticationMethod) {
if (AuthenticationMethod.FORM.equals(authenticationMethod)) {
// @formatter:off
return this.webClient.post()
.uri(userInfoUri)
.header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE)
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE)
.bodyValue("access_token=" + userRequest.getAccessToken().getTokenValue());
// @formatter:on
}
// @formatter:off
return this.webClient.get()
.uri(userInfoUri)
.header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE)
.headers((headers) -> headers
.setBearerAuth(userRequest.getAccessToken().getTokenValue())
);
// @formatter:on
}
/**
* Use this strategy to adapt user attributes into a format understood by Spring
* Security; by default, the original attributes are preserved.
*
* <p>
* This can be helpful, for example, if the user attribute is nested. Since Spring
* Security needs the username attribute to be at the top level, you can use this
* method to do:
*
* <pre>
* DefaultReactiveOAuth2UserService userService = new DefaultReactiveOAuth2UserService();
* userService.setAttributesConverter((userRequest) -> (attributes) ->
* Map<String, Object> userObject = (Map<String, Object>) attributes.get("user");
* attributes.put("user-name", userObject.get("user-name"));
* return attributes;
* });
|
* </pre>
* @param attributesConverter the attribute adaptation strategy to use
* @since 6.3
*/
public void setAttributesConverter(
Converter<OAuth2UserRequest, Converter<Map<String, Object>, Map<String, Object>>> attributesConverter) {
Assert.notNull(attributesConverter, "attributesConverter cannot be null");
this.attributesConverter = attributesConverter;
}
/**
* Sets the {@link WebClient} used for retrieving the user endpoint
* @param webClient the client to use
*/
public void setWebClient(WebClient webClient) {
Assert.notNull(webClient, "webClient cannot be null");
this.webClient = webClient;
}
private static Mono<UserInfoErrorResponse> parse(ClientResponse httpResponse) {
String wwwAuth = httpResponse.headers().asHttpHeaders().getFirst(HttpHeaders.WWW_AUTHENTICATE);
if (StringUtils.hasLength(wwwAuth)) {
// Bearer token error?
return Mono.fromCallable(() -> UserInfoErrorResponse.parse(wwwAuth));
}
// Other error?
return httpResponse.bodyToMono(STRING_STRING_MAP)
.map((body) -> new UserInfoErrorResponse(ErrorObject.parse(new JSONObject(body))));
}
}
|
repos\spring-security-main\oauth2\oauth2-client\src\main\java\org\springframework\security\oauth2\client\userinfo\DefaultReactiveOAuth2UserService.java
| 1
|
请完成以下Java代码
|
public class Person {
private Integer id;
private String name;
public Person() {
}
public Person(Integer id, String name) {
this.id = id;
this.name = name;
}
public Integer getId() {
return id;
|
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
|
repos\tutorials-master\spring-web-modules\spring-resttemplate-1\src\main\java\com\baeldung\resttemplate\web\dto\Person.java
| 1
|
请完成以下Java代码
|
public class DynamicEmbeddedSubProcessBuilder {
protected String id;
protected String processDefinitionId;
protected String dynamicSubProcessId;
protected int counter = 1;
public DynamicEmbeddedSubProcessBuilder() {
}
public DynamicEmbeddedSubProcessBuilder(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public DynamicEmbeddedSubProcessBuilder id(String id) {
this.id = id;
return this;
}
public String getProcessDefinitionId() {
return processDefinitionId;
}
public void setProcessDefinitionId(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
}
public DynamicEmbeddedSubProcessBuilder processDefinitionId(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
return this;
}
public String getDynamicSubProcessId() {
return dynamicSubProcessId;
}
public void setDynamicSubProcessId(String dynamicSubProcessId) {
this.dynamicSubProcessId = dynamicSubProcessId;
}
public String nextSubProcessId(Map<String, FlowElement> flowElementMap) {
|
return nextId("dynamicSubProcess", flowElementMap);
}
public String nextTaskId(Map<String, FlowElement> flowElementMap) {
return nextId("dynamicTask", flowElementMap);
}
public String nextFlowId(Map<String, FlowElement> flowElementMap) {
return nextId("dynamicFlow", flowElementMap);
}
public String nextForkGatewayId(Map<String, FlowElement> flowElementMap) {
return nextId("dynamicForkGateway", flowElementMap);
}
public String nextJoinGatewayId(Map<String, FlowElement> flowElementMap) {
return nextId("dynamicJoinGateway", flowElementMap);
}
public String nextStartEventId(Map<String, FlowElement> flowElementMap) {
return nextId("startEvent", flowElementMap);
}
public String nextEndEventId(Map<String, FlowElement> flowElementMap) {
return nextId("endEvent", flowElementMap);
}
protected String nextId(String prefix, Map<String, FlowElement> flowElementMap) {
String nextId = null;
boolean nextIdNotFound = true;
while (nextIdNotFound) {
if (!flowElementMap.containsKey(prefix + counter)) {
nextId = prefix + counter;
nextIdNotFound = false;
}
counter++;
}
return nextId;
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\dynamic\DynamicEmbeddedSubProcessBuilder.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
|
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public Integer getPages() {
return pages;
}
public void setPages(Integer pages) {
this.pages = pages;
}
}
|
repos\tutorials-master\microservices-modules\helidon\helidon-mp\src\main\java\com\baeldung\microprofile\model\Book.java
| 2
|
请完成以下Java代码
|
protected final String doIt()
{
HUMoveToDirectWarehouseService.newInstance()
.setDocumentsCollection(documentsCollection)
.setHUView(getView())
.setMovementDate(p_MovementDate)
.setDescription(p_Description)
.setFailOnFirstError(false)
.setLoggable(this)
.move(retrieveHUs());
return MSG_OK;
}
/**
* @return HUs that will be moved
*/
protected Iterator<I_M_HU> retrieveHUs()
{
final IHUQueryBuilder huQueryBuilder = handlingUnitsDAO.createHUQueryBuilder()
.setContext(getCtx(), ITrx.TRXNAME_None);
// Only top level HUs
huQueryBuilder.setOnlyTopLevelHUs();
// Only Active HUs
huQueryBuilder.addHUStatusToInclude(X_M_HU.HUSTATUS_Active);
// Only for preselected warehouse
if (p_M_Warehouse_ID > 0)
|
{
huQueryBuilder.addOnlyInWarehouseId(WarehouseId.ofRepoId(p_M_Warehouse_ID));
}
// Only for given SQL where clause
if (!Check.isEmpty(p_huWhereClause, true))
{
huQueryBuilder.addFilter(TypedSqlQueryFilter.of(p_huWhereClause));
}
// Fetch the HUs iterator
return huQueryBuilder
.createQuery()
.setOption(IQuery.OPTION_GuaranteedIteratorRequired, true) // because we might change the hu's locator
.setOption(IQuery.OPTION_IteratorBufferSize, 1000)
.iterate(I_M_HU.class);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\process\WEBUI_M_HU_MoveToDirectWarehouse_Mass.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public static MultiQueryRequest buildUpdatedAfterFilterQueryRequest(@NonNull final String updatedAfter)
{
return MultiQueryRequest.builder()
.filter(buildUpdatedAfterJsonQueries(updatedAfter))
.build();
}
@NonNull
public static MultiQueryRequest buildShopware6GetCustomersQueryRequest(@NonNull final String updatedAfter, final PageAndLimit pageAndLimitValues)
{
return MultiQueryRequest.builder()
.filter(buildUpdatedAfterJsonQueries(updatedAfter))
.page(pageAndLimitValues.getPageIndex())
.limit(pageAndLimitValues.getLimit())
.build();
}
@NonNull
public static MultiQueryRequest buildQueryParentProductRequest(@NonNull final String parentId)
{
return MultiQueryRequest.builder()
.filter(JsonQuery.builder()
.field(FIELD_PRODUCT_ID)
.queryType(QueryType.EQUALS)
.value(parentId)
.build())
.build();
}
|
@NonNull
@VisibleForTesting
public static JsonQuery buildUpdatedAfterJsonQueries(@NonNull final String updatedAfter)
{
final HashMap<String, String> parameters = new HashMap<>();
parameters.put(PARAMETERS_GTE, updatedAfter);
return JsonQuery.builder()
.queryType(QueryType.MULTI)
.operatorType(OperatorType.OR)
.jsonQuery(JsonQuery.builder()
.field(FIELD_UPDATED_AT)
.queryType(QueryType.RANGE)
.parameters(parameters)
.build())
.jsonQuery(JsonQuery.builder()
.field(FIELD_CREATED_AT)
.queryType(QueryType.RANGE)
.parameters(parameters)
.build())
.build();
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\de-metas-camel-shopware6\src\main\java\de\metas\camel\externalsystems\shopware6\api\model\QueryHelper.java
| 2
|
请完成以下Java代码
|
protected org.compiere.model.POInfo initPO(final Properties ctx)
{
return org.compiere.model.POInfo.getPOInfo(Table_Name);
}
@Override
public void setC_Title_ID (final int C_Title_ID)
{
if (C_Title_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Title_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Title_ID, C_Title_ID);
}
@Override
public int getC_Title_ID()
{
|
return get_ValueAsInt(COLUMNNAME_C_Title_ID);
}
@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_C_Title.java
| 1
|
请完成以下Java代码
|
protected List<Term> segSentence(char[] sentence)
{
if (trie == null)
{
logger.warning("还未加载任何词典");
return Collections.emptyList();
}
final int[] wordNet = new int[sentence.length];
Arrays.fill(wordNet, 1);
final Nature[] natureArray = config.speechTagging ? new Nature[sentence.length] : null;
trie.parseText(sentence, new AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute>()
{
@Override
public void hit(int begin, int end, CoreDictionary.Attribute value)
{
int length = end - begin;
if (length > wordNet[begin])
{
wordNet[begin] = length;
if (config.speechTagging)
{
natureArray[begin] = value.nature[0];
}
}
}
});
LinkedList<Term> termList = new LinkedList<Term>();
posTag(sentence, wordNet, natureArray);
for (int i = 0; i < wordNet.length; )
{
Term term = new Term(new String(sentence, i, wordNet[i]), config.speechTagging ? (natureArray[i] == null ? Nature.nz : natureArray[i]) : null);
term.offset = i;
termList.add(term);
i += wordNet[i];
}
return termList;
}
@Override
public Segment enableCustomDictionary(boolean enable)
{
throw new UnsupportedOperationException("AhoCorasickDoubleArrayTrieSegment暂时不支持用户词典。");
}
public AhoCorasickDoubleArrayTrie<CoreDictionary.Attribute> getTrie()
{
return trie;
}
|
public void setTrie(AhoCorasickDoubleArrayTrie<CoreDictionary.Attribute> trie)
{
this.trie = trie;
}
public AhoCorasickDoubleArrayTrieSegment loadDictionary(String... pathArray)
{
trie = new AhoCorasickDoubleArrayTrie<CoreDictionary.Attribute>();
TreeMap<String, CoreDictionary.Attribute> map = null;
try
{
map = IOUtil.loadDictionary(pathArray);
}
catch (IOException e)
{
logger.warning("加载词典失败\n" + TextUtility.exceptionToString(e));
return this;
}
if (map != null && !map.isEmpty())
{
trie.build(map);
}
return this;
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\seg\Other\AhoCorasickDoubleArrayTrieSegment.java
| 1
|
请完成以下Java代码
|
public class CustomRecursiveTask extends RecursiveTask<Integer> {
private int[] arr;
private static final int THRESHOLD = 20;
public CustomRecursiveTask(int[] arr) {
this.arr = arr;
}
@Override
protected Integer compute() {
if (arr.length > THRESHOLD) {
return ForkJoinTask.invokeAll(createSubtasks()).stream().mapToInt(ForkJoinTask::join).sum();
} else {
|
return processing(arr);
}
}
private Collection<CustomRecursiveTask> createSubtasks() {
List<CustomRecursiveTask> dividedTasks = new ArrayList<>();
dividedTasks.add(new CustomRecursiveTask(Arrays.copyOfRange(arr, 0, arr.length / 2)));
dividedTasks.add(new CustomRecursiveTask(Arrays.copyOfRange(arr, arr.length / 2, arr.length)));
return dividedTasks;
}
private Integer processing(int[] arr) {
return Arrays.stream(arr).filter(a -> a > 10 && a < 27).map(a -> a * 10).sum();
}
}
|
repos\tutorials-master\core-java-modules\core-java-concurrency-advanced\src\main\java\com\baeldung\forkjoin\CustomRecursiveTask.java
| 1
|
请完成以下Java代码
|
static AccessPredicate toServerAddress(final Predicate<? super SocketAddress> localAddressCheck) {
requireNonNull(localAddressCheck, "localAddressCheck");
return (a, c) -> localAddressCheck.test(c.getAttributes().get(Grpc.TRANSPORT_ATTR_LOCAL_ADDR));
}
/**
* Some helper methods used to create {@link Predicate}s for {@link SocketAddress}es.
*/
interface SocketPredicate extends Predicate<SocketAddress> {
/**
* Checks the type of the socket address.
*
* @param type The expected class of the socket address.
* @return The newly created socket predicate.
*/
static SocketPredicate type(final Class<? extends SocketAddress> type) {
requireNonNull(type, "type");
return type::isInstance;
}
/**
* Checks the type of the socket address and the given condition.
*
* @param <T> The expected type of the socket address.
* @param type The expected class of the socket address.
* @param condition The additional condition the socket has to pass.
* @return The newly created socket predicate.
*/
@SuppressWarnings("unchecked")
static <T> SocketPredicate typeAnd(final Class<T> type, final Predicate<T> condition) {
requireNonNull(type, "type");
requireNonNull(condition, "condition");
return s -> type.isInstance(s) && condition.test((T) s);
}
/**
* Checks that the given socket address is an {@link InProcessSocketAddress}.
*
* @return The newly created socket predicate.
*/
static SocketPredicate inProcess() {
return type(InProcessSocketAddress.class);
}
|
/**
* Checks that the given socket address is an {@link InProcessSocketAddress} with the given name.
*
* @param name The name of in process connection.
* @return The newly created socket predicate.
*/
static SocketPredicate inProcess(final String name) {
requireNonNull(name, "name");
return typeAnd(InProcessSocketAddress.class, s -> name.equals(s.getName()));
}
/**
* Checks that the given socket address is a {@link InetSocketAddress}.
*
* @return The newly created socket predicate.
*/
static SocketPredicate inet() {
return type(InetSocketAddress.class);
}
}
}
|
repos\grpc-spring-master\grpc-server-spring-boot-starter\src\main\java\net\devh\boot\grpc\server\security\check\AccessPredicate.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public static List<Throwable> validateMetaData(RuleChainMetaData ruleChainMetaData) {
validateMetaDataFieldsAndConnections(ruleChainMetaData);
return ruleChainMetaData.getNodes().stream()
.map(RuleChainDataValidator::validateRuleNode)
.filter(Objects::nonNull)
.collect(Collectors.toList());
}
public static void validateMetaDataFieldsAndConnections(RuleChainMetaData ruleChainMetaData) {
ConstraintValidator.validateFields(ruleChainMetaData);
if (CollectionUtils.isNotEmpty(ruleChainMetaData.getConnections())) {
validateCircles(ruleChainMetaData.getConnections());
}
}
public static Throwable validateRuleNode(RuleNode ruleNode) {
String errorPrefix = "'" + ruleNode.getName() + "' node configuration is invalid: ";
ConstraintValidator.validateFields(ruleNode, errorPrefix);
Object nodeConfig;
try {
Class<Object> nodeConfigType = ReflectionUtils.getAnnotationProperty(ruleNode.getType(),
"org.thingsboard.rule.engine.api.RuleNode", "configClazz");
nodeConfig = JacksonUtil.treeToValue(ruleNode.getConfiguration(), nodeConfigType);
} catch (Throwable t) {
log.warn("Failed to validate node configuration: {}", ExceptionUtils.getRootCauseMessage(t));
return t;
}
ConstraintValidator.validateFields(nodeConfig, errorPrefix);
|
return null;
}
private static void validateCircles(List<NodeConnectionInfo> connectionInfos) {
Map<Integer, Set<Integer>> connectionsMap = new HashMap<>();
for (NodeConnectionInfo nodeConnection : connectionInfos) {
if (nodeConnection.getFromIndex() == nodeConnection.getToIndex()) {
throw new DataValidationException("Can't create the relation to yourself.");
}
connectionsMap
.computeIfAbsent(nodeConnection.getFromIndex(), from -> new HashSet<>())
.add(nodeConnection.getToIndex());
}
connectionsMap.keySet().forEach(key -> validateCircles(key, connectionsMap.get(key), connectionsMap));
}
private static void validateCircles(int from, Set<Integer> toList, Map<Integer, Set<Integer>> connectionsMap) {
if (toList == null) {
return;
}
for (Integer to : toList) {
if (from == to) {
throw new DataValidationException("Can't create circling relations in rule chain.");
}
validateCircles(from, connectionsMap.get(to), connectionsMap);
}
}
}
|
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\service\validator\RuleChainDataValidator.java
| 2
|
请完成以下Java代码
|
public void setPA_ReportColumnSet_ID (int PA_ReportColumnSet_ID)
{
if (PA_ReportColumnSet_ID < 1)
set_ValueNoCheck (COLUMNNAME_PA_ReportColumnSet_ID, null);
else
set_ValueNoCheck (COLUMNNAME_PA_ReportColumnSet_ID, Integer.valueOf(PA_ReportColumnSet_ID));
}
/** Get Report Column Set.
@return Collection of Columns for Report
*/
public int getPA_ReportColumnSet_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_PA_ReportColumnSet_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** 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;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_PA_ReportColumnSet.java
| 1
|
请完成以下Java代码
|
public class IbatisVariableTypeHandler implements TypeHandler<VariableType> {
protected VariableTypes variableTypes;
public VariableType getResult(ResultSet rs, String columnName) throws SQLException {
String typeName = rs.getString(columnName);
VariableType type = getVariableTypes().getVariableType(typeName);
if (type == null && typeName != null) {
throw new ActivitiException("unknown variable type name " + typeName);
}
return type;
}
public VariableType getResult(CallableStatement cs, int columnIndex) throws SQLException {
String typeName = cs.getString(columnIndex);
VariableType type = getVariableTypes().getVariableType(typeName);
if (type == null) {
throw new ActivitiException("unknown variable type name " + typeName);
}
return type;
}
public void setParameter(PreparedStatement ps, int i, VariableType parameter, JdbcType jdbcType)
throws SQLException {
String typeName = parameter.getTypeName();
ps.setString(i, typeName);
|
}
protected VariableTypes getVariableTypes() {
if (variableTypes == null) {
variableTypes = Context.getProcessEngineConfiguration().getVariableTypes();
}
return variableTypes;
}
public VariableType getResult(ResultSet resultSet, int columnIndex) throws SQLException {
String typeName = resultSet.getString(columnIndex);
VariableType type = getVariableTypes().getVariableType(typeName);
if (type == null) {
throw new ActivitiException("unknown variable type name " + typeName);
}
return type;
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\db\IbatisVariableTypeHandler.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class DataEntry_Tab
{
public DataEntry_Tab()
{
Services.get(IProgramaticCalloutProvider.class).registerAnnotatedCallout(this);
}
@ModelChange(timings = ModelValidator.TYPE_BEFORE_DELETE)
public void deleteChildRecords(@NonNull final I_DataEntry_Tab dataEntryTabRecord)
{
Services.get(IQueryBL.class)
.createQueryBuilder(I_DataEntry_SubTab.class)
.addEqualsFilter(I_DataEntry_SubTab.COLUMN_DataEntry_Tab_ID, dataEntryTabRecord.getDataEntry_Tab_ID())
.create()
.delete();
}
@CalloutMethod(columnNames = I_DataEntry_Tab.COLUMNNAME_DataEntry_TargetWindow_ID)
public void setSeqNo(@NonNull final I_DataEntry_Tab dataEntryTabRecord)
{
if (dataEntryTabRecord.getDataEntry_TargetWindow_ID() <= 0)
|
{
return;
}
dataEntryTabRecord.setSeqNo(maxSeqNo(dataEntryTabRecord) + 10);
}
private int maxSeqNo(@NonNull final I_DataEntry_Tab dataEntryTabRecord)
{
return Services
.get(IQueryBL.class)
.createQueryBuilder(I_DataEntry_Tab.class)
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_DataEntry_Tab.COLUMN_DataEntry_TargetWindow_ID, dataEntryTabRecord.getDataEntry_TargetWindow_ID())
.create()
.maxInt(I_DataEntry_Tab.COLUMNNAME_SeqNo);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\dataentry\layout\interceptor\DataEntry_Tab.java
| 2
|
请完成以下Java代码
|
public String getId() {
return id;
}
@Override
public void setId(String id) {
this.id = id;
}
@Override
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
@Override
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public void setResources(Map<String, ResourceEntity> resources) {
this.resources = resources;
|
}
@Override
public Date getDeploymentTime() {
return deploymentTime;
}
public void setDeploymentTime(Date deploymentTime) {
this.deploymentTime = deploymentTime;
}
public boolean isNew() {
return isNew;
}
public void setNew(boolean isNew) {
this.isNew = isNew;
}
// common methods //////////////////////////////////////////////////////////
@Override
public String toString() {
return "DeploymentEntity[id=" + id + ", name=" + name + "]";
}
}
|
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\persistence\entity\DeploymentEntity.java
| 1
|
请完成以下Java代码
|
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 String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
return "User [userName=" + userName + ", password=" + password + "]";
}
public User() {
}
|
public User(String userName, String password) {
super();
this.userName = userName;
this.password = password;
}
private void writeObject(ObjectOutputStream oos) throws IOException {
this.password = "xyz" + password;
oos.defaultWriteObject();
}
private void readObject(ObjectInputStream aInputStream)
throws ClassNotFoundException, IOException {
aInputStream.defaultReadObject();
this.password = password.substring(3);
}
private Object readResolve() {
return this;
}
}
|
repos\tutorials-master\core-java-modules\core-java-serialization\src\main\java\com\baeldung\readresolvevsreadobject\User.java
| 1
|
请完成以下Java代码
|
public boolean getExcludeTaskRelated() {
return excludeTaskRelated;
}
public String getVariableName() {
return variableName;
}
public String getVariableNameLike() {
return variableNameLike;
}
public String getId() {
return id;
}
public Set<String> getTaskIds() {
return taskIds;
}
public String getExecutionId() {
return executionId;
}
public Set<String> getExecutionIds() {
|
return executionIds;
}
public boolean isExcludeTaskRelated() {
return excludeTaskRelated;
}
public boolean isExcludeVariableInitialization() {
return excludeVariableInitialization;
}
public QueryVariableValue getQueryVariableValue() {
return queryVariableValue;
}
}
|
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\HistoricVariableInstanceQueryImpl.java
| 1
|
请完成以下Java代码
|
private synchronized void updateRegisteredInterceptors()
{
final IModelValidationEngine engine = getEngine();
final BusinessRulesCollection rules = getRules();
final HashSet<String> registeredTableNamesNoLongerNeeded = new HashSet<>(registeredTableNames);
for (final AdTableId triggerTableId : rules.getTriggerTableIds())
{
final String triggerTableName = TableIdsCache.instance.getTableName(triggerTableId);
registeredTableNamesNoLongerNeeded.remove(triggerTableName);
if (registeredTableNames.contains(triggerTableName))
{
// already registered
continue;
}
engine.addModelChange(triggerTableName, this);
registeredTableNames.add(triggerTableName);
logger.info("Registered trigger for {}", triggerTableName);
}
//
// Remove no longer needed interceptors
for (final String triggerTableName : registeredTableNamesNoLongerNeeded)
{
engine.removeModelChange(triggerTableName, this);
registeredTableNames.remove(triggerTableName);
|
logger.info("Unregistered trigger for {}", triggerTableName);
}
}
@Override
public void onModelChange(@NonNull final Object model, @NonNull final ModelChangeType modelChangeType) throws Exception
{
final TriggerTiming timing = TriggerTiming.ofModelChangeType(modelChangeType).orElse(null);
if (timing == null)
{
return;
}
ruleService.fireTriggersForSourceModel(model, timing);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\business_rule\trigger\interceptor\BusinessRuleTriggerInterceptor.java
| 1
|
请完成以下Java代码
|
public List<String> getUserTaskFormTypes() {
return userTaskFormTypes;
}
public void setUserTaskFormTypes(List<String> userTaskFormTypes) {
this.userTaskFormTypes = userTaskFormTypes;
}
public List<String> getStartEventFormTypes() {
return startEventFormTypes;
}
public void setStartEventFormTypes(List<String> startEventFormTypes) {
this.startEventFormTypes = startEventFormTypes;
}
@JsonIgnore
public Object getEventSupport() {
return eventSupport;
|
}
public void setEventSupport(Object eventSupport) {
this.eventSupport = eventSupport;
}
public String getStartFormKey(String processId) {
FlowElement initialFlowElement = getProcessById(processId).getInitialFlowElement();
if (initialFlowElement instanceof StartEvent) {
StartEvent startEvent = (StartEvent) initialFlowElement;
return startEvent.getFormKey();
}
return null;
}
}
|
repos\Activiti-develop\activiti-core\activiti-bpmn-model\src\main\java\org\activiti\bpmn\model\BpmnModel.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public VariableType getVariableType(String typeName) {
return typesMap.get(typeName);
}
@Override
public VariableType findVariableType(Object value) {
for (VariableType type : typesList) {
if (type.isAbleToStore(value)) {
return type;
}
}
throw new FlowableException("couldn't find a variable type that is able to serialize " + value);
}
@Override
public int getTypeIndex(VariableType type) {
return typesList.indexOf(type);
}
@Override
public int getTypeIndex(String typeName) {
VariableType type = typesMap.get(typeName);
if (type != null) {
return getTypeIndex(type);
|
} else {
return -1;
}
}
@Override
public VariableTypes removeType(VariableType type) {
typesList.remove(type);
typesMap.remove(type.getTypeName());
return this;
}
public int size() {
return typesList.size();
}
}
|
repos\flowable-engine-main\modules\flowable-variable-service\src\main\java\org\flowable\variable\service\impl\types\DefaultVariableTypes.java
| 2
|
请完成以下Java代码
|
public void setPP_Order_Weighting_RunCheck_ID (final int PP_Order_Weighting_RunCheck_ID)
{
if (PP_Order_Weighting_RunCheck_ID < 1)
set_ValueNoCheck (COLUMNNAME_PP_Order_Weighting_RunCheck_ID, null);
else
set_ValueNoCheck (COLUMNNAME_PP_Order_Weighting_RunCheck_ID, PP_Order_Weighting_RunCheck_ID);
}
@Override
public int getPP_Order_Weighting_RunCheck_ID()
{
return get_ValueAsInt(COLUMNNAME_PP_Order_Weighting_RunCheck_ID);
}
@Override
public org.eevolution.model.I_PP_Order_Weighting_Run getPP_Order_Weighting_Run()
{
return get_ValueAsPO(COLUMNNAME_PP_Order_Weighting_Run_ID, org.eevolution.model.I_PP_Order_Weighting_Run.class);
}
@Override
public void setPP_Order_Weighting_Run(final org.eevolution.model.I_PP_Order_Weighting_Run PP_Order_Weighting_Run)
{
set_ValueFromPO(COLUMNNAME_PP_Order_Weighting_Run_ID, org.eevolution.model.I_PP_Order_Weighting_Run.class, PP_Order_Weighting_Run);
}
@Override
public void setPP_Order_Weighting_Run_ID (final int PP_Order_Weighting_Run_ID)
{
if (PP_Order_Weighting_Run_ID < 1)
|
set_ValueNoCheck (COLUMNNAME_PP_Order_Weighting_Run_ID, null);
else
set_ValueNoCheck (COLUMNNAME_PP_Order_Weighting_Run_ID, PP_Order_Weighting_Run_ID);
}
@Override
public int getPP_Order_Weighting_Run_ID()
{
return get_ValueAsInt(COLUMNNAME_PP_Order_Weighting_Run_ID);
}
@Override
public void setWeight (final BigDecimal Weight)
{
set_Value (COLUMNNAME_Weight, Weight);
}
@Override
public BigDecimal getWeight()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Weight);
return bd != null ? bd : BigDecimal.ZERO;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_PP_Order_Weighting_RunCheck.java
| 1
|
请完成以下Java代码
|
public Color getForegroundColor(ITable table, int rowIndexModel)
{
final int cCode = getRelativeForegroundColor(table, rowIndexModel);
if (cCode == 0)
{
return COLOR_NONE; // Black
}
else if (cCode < 0)
{
return AdempierePLAF.getTextColor_Issue(); // Red
}
else
{
return AdempierePLAF.getTextColor_OK(); // Blue
}
}
/**
* Get ColorCode for Row.
*
* <pre>
* If numerical value in compare column is
* negative = -1,
* positive = 1,
* otherwise = 0
* If Timestamp
* </pre>
*
* @param table
* @param rowIndexModel
* @return color code
*/
private int getRelativeForegroundColor(final ITable table, final int rowIndexModel)
{
if (colorColumnIndex < 0)
{
return 0;
}
Object data = table.getModelValueAt(rowIndexModel, colorColumnIndex);
int cmp = 0;
// We need to have a Number
if (data == null)
{
return 0;
}
try
{
if (data instanceof Timestamp)
|
{
if (colorDataCompare == null || !(colorDataCompare instanceof Timestamp))
colorDataCompare = new Timestamp(System.currentTimeMillis());
cmp = ((Timestamp)colorDataCompare).compareTo((Timestamp)data);
}
else
{
if (colorDataCompare == null || !(colorDataCompare instanceof BigDecimal))
colorDataCompare = Env.ZERO;
if (!(data instanceof BigDecimal))
data = new BigDecimal(data.toString());
cmp = ((BigDecimal)colorDataCompare).compareTo((BigDecimal)data);
}
}
catch (Exception e)
{
return 0;
}
if (cmp > 0)
{
return -1;
}
if (cmp < 0)
{
return 1;
}
return 0;
}
public int getColorColumnIndex()
{
return colorColumnIndex;
}
public void setColorColumnIndex(int colorColumnIndexModel)
{
this.colorColumnIndex = colorColumnIndexModel;
}
public Object getColorDataCompare()
{
return colorDataCompare;
}
public void setColorDataCompare(Object colorDataCompare)
{
this.colorDataCompare = colorDataCompare;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\ui\DefaultTableColorProvider.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public ProductId getSingleProductId(@NonNull final HUQRCode huQRCode)
{
final HuId huId = huQRCodesService.getHuIdByQRCode(huQRCode);
return getSingleHUProductStorage(huId).getProductId();
}
public IHUProductStorage getSingleHUProductStorage(@NonNull final HuId huId)
{
return handlingUnitsBL.getSingleHUProductStorage(huId);
}
public Quantity getProductQuantity(@NonNull final HuId huId, @NonNull ProductId productId)
{
return getHUProductStorage(huId, productId)
.map(IHUProductStorage::getQty)
.filter(Quantity::isPositive)
.orElseThrow(() -> new AdempiereException(PRODUCT_DOES_NOT_MATCH));
}
|
private Optional<IHUProductStorage> getHUProductStorage(final @NotNull HuId huId, final @NotNull ProductId productId)
{
final I_M_HU hu = handlingUnitsBL.getById(huId);
final IHUStorageFactory storageFactory = handlingUnitsBL.getStorageFactory();
return Optional.ofNullable(storageFactory.getStorage(hu).getProductStorageOrNull(productId));
}
public void assetHUContainsProduct(@NonNull final HUQRCode huQRCode, @NonNull final ProductId productId)
{
final HuId huId = huQRCodesService.getHuIdByQRCode(huQRCode);
getProductQuantity(huId, productId); // shall throw exception if no qty found
}
public void deleteReservationsByDocumentRefs(final ImmutableSet<HUReservationDocRef> huReservationDocRefs)
{
huReservationService.deleteReservationsByDocumentRefs(huReservationDocRefs);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.distribution.rest-api\src\main\java\de\metas\distribution\mobileui\external_services\hu\DistributionHUService.java
| 2
|
请完成以下Java代码
|
public String toString()
{
return MoreObjects.toStringHelper(this)
.add("id", id)
.add("caption", caption)
.add("adUserId", adUserId)
.add("restrictions", restrictions)
.toString();
}
@Override
public int getId()
{
return id;
}
@Override
|
public ITranslatableString getCaption()
{
return caption;
}
@Override
public int getAD_User_ID()
{
return adUserId;
}
@Override
public List<IUserQueryRestriction> getRestrictions()
{
return restrictions;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\compiere\apps\search\UserQuery.java
| 1
|
请完成以下Java代码
|
public StructuredLoggingJsonMembersCustomizer<E> build() {
return (members) -> {
List<StructuredLoggingJsonMembersCustomizer<?>> customizers = new ArrayList<>();
if (this.properties != null) {
customizers.add(new StructuredLoggingJsonPropertiesJsonMembersCustomizer(
StructuredLogFormatterFactory.this.instantiator, this.properties, this.nested));
}
customizers.addAll(loadStructuredLoggingJsonMembersCustomizers());
invokeCustomizers(members, customizers);
};
}
@SuppressWarnings({ "unchecked", "rawtypes" })
private List<StructuredLoggingJsonMembersCustomizer<?>> loadStructuredLoggingJsonMembersCustomizers() {
return (List) StructuredLogFormatterFactory.this.factoriesLoader.load(
|
StructuredLoggingJsonMembersCustomizer.class,
ArgumentResolver.from(StructuredLogFormatterFactory.this.instantiator::getArg));
}
@SuppressWarnings("unchecked")
private void invokeCustomizers(Members<E> members,
List<StructuredLoggingJsonMembersCustomizer<?>> customizers) {
LambdaSafe.callbacks(StructuredLoggingJsonMembersCustomizer.class, customizers, members)
.withFilter(LambdaSafe.Filter.allowAll())
.invoke((customizer) -> customizer.customize(members));
}
}
}
|
repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\logging\structured\StructuredLogFormatterFactory.java
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.