instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请完成以下Java代码
|
public class HelloWorldScheduler implements Scheduler {
private int launchedTasks = 0;
private final ExecutorInfo helloWorldExecutor;
public HelloWorldScheduler(ExecutorInfo helloWorldExecutor) {
this.helloWorldExecutor = helloWorldExecutor;
}
@Override
public void registered(SchedulerDriver schedulerDriver, Protos.FrameworkID frameworkID, Protos.MasterInfo masterInfo) {
}
@Override
public void reregistered(SchedulerDriver schedulerDriver, Protos.MasterInfo masterInfo) {
}
@Override
public void resourceOffers(SchedulerDriver schedulerDriver, List<Offer> list) {
for (Offer offer : list) {
List<TaskInfo> tasks = new ArrayList<TaskInfo>();
Protos.TaskID taskId = Protos.TaskID.newBuilder().setValue(Integer.toString(launchedTasks++)).build();
System.out.println("Launching printHelloWorld " + taskId.getValue() + " Hello World Java");
TaskInfo printHelloWorld = TaskInfo
.newBuilder()
.setName("printHelloWorld " + taskId.getValue())
.setTaskId(taskId)
.setSlaveId(offer.getSlaveId())
.addResources(
Protos.Resource.newBuilder().setName("cpus").setType(Protos.Value.Type.SCALAR)
.setScalar(Protos.Value.Scalar.newBuilder().setValue(1)))
.addResources(
Protos.Resource.newBuilder().setName("mem").setType(Protos.Value.Type.SCALAR)
.setScalar(Protos.Value.Scalar.newBuilder().setValue(128)))
.setExecutor(ExecutorInfo.newBuilder(helloWorldExecutor)).build();
List<OfferID> offerIDS = new ArrayList<>();
offerIDS.add(offer.getId());
tasks.add(printHelloWorld);
schedulerDriver.declineOffer(offer.getId());
schedulerDriver.launchTasks(offerIDS, tasks);
}
}
@Override
public void offerRescinded(SchedulerDriver schedulerDriver, OfferID offerID) {
}
@Override
|
public void statusUpdate(SchedulerDriver schedulerDriver, Protos.TaskStatus taskStatus) {
}
@Override
public void frameworkMessage(SchedulerDriver schedulerDriver, Protos.ExecutorID executorID, Protos.SlaveID slaveID, byte[] bytes) {
}
@Override
public void disconnected(SchedulerDriver schedulerDriver) {
}
@Override
public void slaveLost(SchedulerDriver schedulerDriver, Protos.SlaveID slaveID) {
}
@Override
public void executorLost(SchedulerDriver schedulerDriver, Protos.ExecutorID executorID, Protos.SlaveID slaveID, int i) {
}
@Override
public void error(SchedulerDriver schedulerDriver, String s) {
}
}
|
repos\tutorials-master\apache-libraries\src\main\java\com\baeldung\mesos\schedulers\HelloWorldScheduler.java
| 1
|
请完成以下Java代码
|
public ProcessDefinitionEntity getSourceDefinition() {
return sourceDefinition;
}
public ProcessDefinitionEntity getTargetDefinition() {
return targetDefinition;
}
public String getProcessInstanceId() {
return processInstanceId;
}
public MigratingActivityInstance addActivityInstance(
MigrationInstruction migrationInstruction,
ActivityInstance activityInstance,
ScopeImpl sourceScope,
ScopeImpl targetScope,
ExecutionEntity scopeExecution) {
MigratingActivityInstance migratingActivityInstance = new MigratingActivityInstance(
activityInstance,
migrationInstruction,
sourceScope,
targetScope,
scopeExecution);
migratingActivityInstances.add(migratingActivityInstance);
if (processInstanceId.equals(activityInstance.getId())) {
rootInstance = migratingActivityInstance;
}
return migratingActivityInstance;
}
public MigratingTransitionInstance addTransitionInstance(
MigrationInstruction migrationInstruction,
TransitionInstance transitionInstance,
ScopeImpl sourceScope,
ScopeImpl targetScope,
ExecutionEntity asyncExecution) {
MigratingTransitionInstance migratingTransitionInstance = new MigratingTransitionInstance(
transitionInstance,
migrationInstruction,
sourceScope,
targetScope,
asyncExecution);
|
migratingTransitionInstances.add(migratingTransitionInstance);
return migratingTransitionInstance;
}
public MigratingEventScopeInstance addEventScopeInstance(
MigrationInstruction migrationInstruction,
ExecutionEntity eventScopeExecution,
ScopeImpl sourceScope,
ScopeImpl targetScope,
MigrationInstruction eventSubscriptionInstruction,
EventSubscriptionEntity eventSubscription,
ScopeImpl eventSubscriptionSourceScope,
ScopeImpl eventSubscriptionTargetScope) {
MigratingEventScopeInstance compensationInstance = new MigratingEventScopeInstance(
migrationInstruction,
eventScopeExecution,
sourceScope,
targetScope,
eventSubscriptionInstruction,
eventSubscription,
eventSubscriptionSourceScope,
eventSubscriptionTargetScope);
migratingEventScopeInstances.add(compensationInstance);
return compensationInstance;
}
public MigratingCompensationEventSubscriptionInstance addCompensationSubscriptionInstance(
MigrationInstruction eventSubscriptionInstruction,
EventSubscriptionEntity eventSubscription,
ScopeImpl sourceScope,
ScopeImpl targetScope) {
MigratingCompensationEventSubscriptionInstance compensationInstance = new MigratingCompensationEventSubscriptionInstance(
eventSubscriptionInstruction,
sourceScope,
targetScope,
eventSubscription);
migratingCompensationSubscriptionInstances.add(compensationInstance);
return compensationInstance;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\migration\instance\MigratingProcessInstance.java
| 1
|
请完成以下Java代码
|
protected void setSafeInValueLists(ExecutionQueryImpl executionQuery) {
if (executionQuery.getInvolvedGroups() != null) {
executionQuery.setSafeInvolvedGroups(createSafeInValuesList(executionQuery.getInvolvedGroups()));
}
if (executionQuery.getProcessInstanceIds() != null) {
executionQuery.setSafeProcessInstanceIds(createSafeInValuesList(executionQuery.getProcessInstanceIds()));
}
if (executionQuery.getOrQueryObjects() != null && !executionQuery.getOrQueryObjects().isEmpty()) {
for (ExecutionQueryImpl orExecutionQuery : executionQuery.getOrQueryObjects()) {
setSafeInValueLists(orExecutionQuery);
}
}
}
protected void setSafeInValueLists(ProcessInstanceQueryImpl processInstanceQuery) {
|
if (processInstanceQuery.getProcessInstanceIds() != null) {
processInstanceQuery.setSafeProcessInstanceIds(createSafeInValuesList(processInstanceQuery.getProcessInstanceIds()));
}
if (processInstanceQuery.getInvolvedGroups() != null) {
processInstanceQuery.setSafeInvolvedGroups(createSafeInValuesList(processInstanceQuery.getInvolvedGroups()));
}
if (processInstanceQuery.getOrQueryObjects() != null && !processInstanceQuery.getOrQueryObjects().isEmpty()) {
for (ProcessInstanceQueryImpl orProcessInstanceQuery : processInstanceQuery.getOrQueryObjects()) {
setSafeInValueLists(orProcessInstanceQuery);
}
}
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\persistence\entity\data\impl\MybatisExecutionDataManager.java
| 1
|
请完成以下Java代码
|
public void deleteFilter(String filterId) {
checkAuthorization(DELETE, FILTER, filterId);
FilterEntity filter = findFilterByIdInternal(filterId);
ensureNotNull("No filter found for filter id '" + filterId + "'", "filter", filter);
// delete all authorizations for this filter id
deleteAuthorizations(FILTER, filterId);
// delete the filter itself
getDbEntityManager().delete(filter);
}
public FilterEntity findFilterById(String filterId) {
ensureNotNull("Invalid filter id", "filterId", filterId);
checkAuthorization(READ, FILTER, filterId);
return findFilterByIdInternal(filterId);
}
protected FilterEntity findFilterByIdInternal(String filterId) {
return getDbEntityManager().selectById(FilterEntity.class, filterId);
}
@SuppressWarnings("unchecked")
|
public List<Filter> findFiltersByQueryCriteria(FilterQueryImpl filterQuery) {
configureQuery(filterQuery, FILTER);
return getDbEntityManager().selectList("selectFilterByQueryCriteria", filterQuery);
}
public long findFilterCountByQueryCriteria(FilterQueryImpl filterQuery) {
configureQuery(filterQuery, FILTER);
return (Long) getDbEntityManager().selectOne("selectFilterCountByQueryCriteria", filterQuery);
}
// authorization utils /////////////////////////////////
protected void createDefaultAuthorizations(Filter filter) {
if(isAuthorizationEnabled()) {
saveDefaultAuthorizations(getResourceAuthorizationProvider().newFilter(filter));
}
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\FilterManager.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public ProcessExtensionService processExtensionService(ProcessExtensionRepository processExtensionsRepository) {
return new ProcessExtensionService(processExtensionsRepository);
}
@Bean
InitializingBean initRepositoryServiceForDeploymentResourceLoader(
RepositoryService repositoryService,
DeploymentResourceLoader deploymentResourceLoader
) {
return () -> deploymentResourceLoader.setRepositoryService(repositoryService);
}
@Bean
@ConditionalOnMissingBean(name = "variableTypeMap")
public Map<String, VariableType> variableTypeMap(
ObjectMapper objectMapper,
DateFormatterProvider dateFormatterProvider
) {
Map<String, VariableType> variableTypeMap = new HashMap<>();
variableTypeMap.put("boolean", new JavaObjectVariableType(Boolean.class));
variableTypeMap.put("string", new JavaObjectVariableType(String.class));
variableTypeMap.put("integer", new JavaObjectVariableType(Integer.class));
variableTypeMap.put("bigdecimal", new BigDecimalVariableType());
variableTypeMap.put("json", new JsonObjectVariableType(objectMapper));
variableTypeMap.put("file", new JsonObjectVariableType(objectMapper));
variableTypeMap.put("folder", new JsonObjectVariableType(objectMapper));
variableTypeMap.put("content", new JsonObjectVariableType(objectMapper));
variableTypeMap.put("date", new DateVariableType(Date.class, dateFormatterProvider));
variableTypeMap.put("datetime", new DateVariableType(Date.class, dateFormatterProvider));
variableTypeMap.put("array", new JsonObjectVariableType(objectMapper));
return variableTypeMap;
}
|
@Bean
public VariableValidationService variableValidationService(Map<String, VariableType> variableTypeMap) {
return new VariableValidationService(variableTypeMap);
}
@Bean
public VariableParsingService variableParsingService(Map<String, VariableType> variableTypeMap) {
return new VariableParsingService(variableTypeMap);
}
@Bean
@ConditionalOnMissingBean
public CachingProcessExtensionService cachingProcessExtensionService(
ProcessExtensionService processExtensionService
) {
return new CachingProcessExtensionService(processExtensionService);
}
}
|
repos\Activiti-develop\activiti-core\activiti-spring-process-extensions\src\main\java\org\activiti\spring\process\conf\ProcessExtensionsAutoConfiguration.java
| 2
|
请完成以下Java代码
|
public final boolean hasNext()
{
clearCurrentIfNotValid();
if (current != null)
{
return true;
}
return iterator.hasNext();
}
private final void clearCurrentIfNotValid()
{
if (current == null)
{
return;
}
final boolean valid = isValidPredicate.test(current);
if (!valid)
{
current = null;
}
}
@Override
public final T next()
{
if (!hasNext())
{
throw new NoSuchElementException();
}
|
// NOTE: we assume "current" was also checked if it's still valid (in hasNext() method)
if (current != null)
{
return current;
}
return iterator.next();
}
@Override
public void remove()
{
throw new UnsupportedOperationException();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\de\metas\util\collections\ReturnWhileValidIterator.java
| 1
|
请完成以下Java代码
|
public HttpStatusCode resolve() {
if (httpStatus != null) {
return httpStatus;
}
return HttpStatusCode.valueOf(status);
}
public HttpStatusCode getHttpStatus() {
return httpStatus;
}
public Integer getStatus() {
return status;
}
/**
* Whether this status code is in the HTTP series
* {@link HttpStatus.Series#INFORMATIONAL}.
* @return <code>true</code> if status code is in the INFORMATIONAL http series
*/
public boolean is1xxInformational() {
return HttpStatus.Series.INFORMATIONAL.equals(getSeries());
}
/**
* Whether this status code is in the HTTP series
* {@link HttpStatus.Series#SUCCESSFUL}.
* @return <code>true</code> if status code is in the SUCCESSFUL http series
*/
public boolean is2xxSuccessful() {
return HttpStatus.Series.SUCCESSFUL.equals(getSeries());
}
/**
* Whether this status code is in the HTTP series
* {@link HttpStatus.Series#REDIRECTION}.
* @return <code>true</code> if status code is in the REDIRECTION http series
*/
public boolean is3xxRedirection() {
return HttpStatus.Series.REDIRECTION.equals(getSeries());
}
/**
* Whether this status code is in the HTTP series
* {@link HttpStatus.Series#CLIENT_ERROR}.
* @return <code>true</code> if status code is in the CLIENT_ERROR http series
*/
public boolean is4xxClientError() {
return HttpStatus.Series.CLIENT_ERROR.equals(getSeries());
}
/**
* Whether this status code is in the HTTP series
* {@link HttpStatus.Series#SERVER_ERROR}.
* @return <code>true</code> if status code is in the SERVER_ERROR http series
|
*/
public boolean is5xxServerError() {
return HttpStatus.Series.SERVER_ERROR.equals(getSeries());
}
public HttpStatus.Series getSeries() {
if (httpStatus != null) {
return HttpStatus.Series.valueOf(httpStatus.value());
}
if (status != null) {
return HttpStatus.Series.valueOf(status);
}
return null;
}
/**
* Whether this status code is in the HTTP series
* {@link HttpStatus.Series#CLIENT_ERROR} or {@link HttpStatus.Series#SERVER_ERROR}.
* @return <code>true</code> if is either CLIENT_ERROR or SERVER_ERROR
*/
public boolean isError() {
return is4xxClientError() || is5xxServerError();
}
@Override
public String toString() {
return new ToStringCreator(this).append("httpStatus", httpStatus).append("status", status).toString();
}
}
|
repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webmvc\src\main\java\org\springframework\cloud\gateway\server\mvc\common\HttpStatusHolder.java
| 1
|
请完成以下Java代码
|
public int getM_PickingSlot_ID()
{
return get_ValueAsInt(COLUMNNAME_M_PickingSlot_ID);
}
@Override
public void setM_Product_ID (final int M_Product_ID)
{
if (M_Product_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Product_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Product_ID, M_Product_ID);
}
@Override
public int getM_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_ID);
}
@Override
public void setM_ShipmentSchedule_ID (final int M_ShipmentSchedule_ID)
{
if (M_ShipmentSchedule_ID < 1)
set_Value (COLUMNNAME_M_ShipmentSchedule_ID, null);
else
set_Value (COLUMNNAME_M_ShipmentSchedule_ID, M_ShipmentSchedule_ID);
}
@Override
public int getM_ShipmentSchedule_ID()
{
return get_ValueAsInt(COLUMNNAME_M_ShipmentSchedule_ID);
}
@Override
public void setPP_Order_ID (final int PP_Order_ID)
{
if (PP_Order_ID < 1)
set_Value (COLUMNNAME_PP_Order_ID, null);
else
set_Value (COLUMNNAME_PP_Order_ID, PP_Order_ID);
}
@Override
public int getPP_Order_ID()
{
return get_ValueAsInt(COLUMNNAME_PP_Order_ID);
}
|
@Override
public void setProcessed (final boolean Processed)
{
set_Value (COLUMNNAME_Processed, Processed);
}
@Override
public boolean isProcessed()
{
return get_ValueAsBoolean(COLUMNNAME_Processed);
}
@Override
public void setQtyToPick (final BigDecimal QtyToPick)
{
set_Value (COLUMNNAME_QtyToPick, QtyToPick);
}
@Override
public BigDecimal getQtyToPick()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyToPick);
return bd != null ? bd : BigDecimal.ZERO;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java-gen\de\metas\handlingunits\model\X_M_Picking_Job_Line.java
| 1
|
请完成以下Java代码
|
public void setDescription (java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Beschreibung.
@return Beschreibung */
@Override
public java.lang.String getDescription ()
{
return (java.lang.String)get_Value(COLUMNNAME_Description);
}
/** Set 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 Number Grouping Separator.
|
@param NumberGroupingSeparator Number Grouping Separator */
@Override
public void setNumberGroupingSeparator (java.lang.String NumberGroupingSeparator)
{
set_Value (COLUMNNAME_NumberGroupingSeparator, NumberGroupingSeparator);
}
/** Get Number Grouping Separator.
@return Number Grouping Separator */
@Override
public java.lang.String getNumberGroupingSeparator ()
{
return (java.lang.String)get_Value(COLUMNNAME_NumberGroupingSeparator);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.datev\src\main\java-gen\de\metas\datev\model\X_DATEV_ExportFormat.java
| 1
|
请完成以下Java代码
|
public String asString() {
return "messaging.destination.name";
}
}
}
/**
* High cardinality tags.
*
* @since 3.2.1
*/
public enum ListenerHighCardinalityTags implements KeyName {
/**
* The delivery tag.
*/
DELIVERY_TAG {
@Override
public String asString() {
return "messaging.rabbitmq.message.delivery_tag";
}
}
}
/**
* Default {@link RabbitListenerObservationConvention} for Rabbit listener key values.
*/
public static class DefaultRabbitListenerObservationConvention implements RabbitListenerObservationConvention {
/**
* A singleton instance of the convention.
*/
public static final DefaultRabbitListenerObservationConvention INSTANCE =
new DefaultRabbitListenerObservationConvention();
@Override
public KeyValues getLowCardinalityKeyValues(RabbitMessageReceiverContext context) {
MessageProperties messageProperties = context.getCarrier().getMessageProperties();
|
String consumerQueue = Objects.requireNonNullElse(messageProperties.getConsumerQueue(), "");
return KeyValues.of(
RabbitListenerObservation.ListenerLowCardinalityTags.LISTENER_ID.asString(),
context.getListenerId(),
RabbitListenerObservation.ListenerLowCardinalityTags.DESTINATION_NAME.asString(),
consumerQueue);
}
@Override
public KeyValues getHighCardinalityKeyValues(RabbitMessageReceiverContext context) {
return KeyValues.of(RabbitListenerObservation.ListenerHighCardinalityTags.DELIVERY_TAG.asString(),
String.valueOf(context.getCarrier().getMessageProperties().getDeliveryTag()));
}
@Override
public String getContextualName(RabbitMessageReceiverContext context) {
return context.getSource() + " receive";
}
}
}
|
repos\spring-amqp-main\spring-rabbit\src\main\java\org\springframework\amqp\rabbit\support\micrometer\RabbitListenerObservation.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class RequestMappingShortcutsController {
@GetMapping("/get")
public @ResponseBody ResponseEntity<String> get() {
return new ResponseEntity<>("GET Response", HttpStatus.OK);
}
@GetMapping("/get/{id}")
public @ResponseBody ResponseEntity<String> getById(@PathVariable String id) {
return new ResponseEntity<>("GET Response : " + id, HttpStatus.OK);
}
@PostMapping("/post")
public @ResponseBody ResponseEntity<String> post() {
return new ResponseEntity<>("POST Response", HttpStatus.OK);
}
|
@PutMapping("/put")
public @ResponseBody ResponseEntity<String> put() {
return new ResponseEntity<>("PUT Response", HttpStatus.OK);
}
@DeleteMapping("/delete")
public @ResponseBody ResponseEntity<String> delete() {
return new ResponseEntity<>("DELETE Response", HttpStatus.OK);
}
@PatchMapping("/patch")
public @ResponseBody ResponseEntity<String> patch() {
return new ResponseEntity<>("PATCH Response", HttpStatus.OK);
}
}
|
repos\tutorials-master\spring-web-modules\spring-mvc-basics-3\src\main\java\com\baeldung\boot\controller\RequestMappingShortcutsController.java
| 2
|
请完成以下Java代码
|
public java.lang.String getI_ErrorMsg ()
{
return (java.lang.String)get_Value(COLUMNNAME_I_ErrorMsg);
}
/** Set Importiert.
@param I_IsImported
Ist dieser Import verarbeitet worden?
*/
@Override
public void setI_IsImported (boolean I_IsImported)
{
set_Value (COLUMNNAME_I_IsImported, Boolean.valueOf(I_IsImported));
}
/** Get Importiert.
@return Ist dieser Import verarbeitet worden?
*/
@Override
public boolean isI_IsImported ()
{
Object oo = get_Value(COLUMNNAME_I_IsImported);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Verarbeitet.
@param Processed
Checkbox sagt aus, ob der Beleg verarbeitet wurde.
*/
@Override
public void setProcessed (boolean Processed)
{
set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
}
/** Get Verarbeitet.
@return Checkbox sagt aus, ob der Beleg verarbeitet wurde.
*/
@Override
public boolean isProcessed ()
{
Object oo = get_Value(COLUMNNAME_Processed);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
|
return "Y".equals(oo);
}
return false;
}
/** Set Process Now.
@param Processing Process Now */
@Override
public void setProcessing (boolean Processing)
{
set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
}
/** Get Process Now.
@return Process Now */
@Override
public boolean isProcessing ()
{
Object oo = get_Value(COLUMNNAME_Processing);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set URL3.
@param URL3
Vollständige Web-Addresse, z.B. https://metasfresh.com/
*/
@Override
public void setURL3 (java.lang.String URL3)
{
set_Value (COLUMNNAME_URL3, URL3);
}
/** Get URL3.
@return Vollständige Web-Addresse, z.B. https://metasfresh.com/
*/
@Override
public java.lang.String getURL3 ()
{
return (java.lang.String)get_Value(COLUMNNAME_URL3);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_I_BPartner_GlobalID.java
| 1
|
请完成以下Java代码
|
public void setSecurityContextHolderStrategy(SecurityContextHolderStrategy strategy) {
this.securityContextHolderStrategy = strategy;
this.empty = this.securityContextHolderStrategy.createEmptyContext();
}
private void setup(Message<?> message) {
SecurityContext currentContext = this.securityContextHolderStrategy.getContext();
Stack<SecurityContext> contextStack = originalContext.get();
if (contextStack == null) {
contextStack = new Stack<>();
originalContext.set(contextStack);
}
contextStack.push(currentContext);
Object user = message.getHeaders().get(this.authenticationHeaderName);
Authentication authentication = getAuthentication(user);
SecurityContext context = this.securityContextHolderStrategy.createEmptyContext();
context.setAuthentication(authentication);
this.securityContextHolderStrategy.setContext(context);
}
private Authentication getAuthentication(@Nullable Object user) {
if ((user instanceof Authentication)) {
return (Authentication) user;
}
return this.anonymous;
}
private void cleanup() {
Stack<SecurityContext> contextStack = originalContext.get();
if (contextStack == null || contextStack.isEmpty()) {
this.securityContextHolderStrategy.clearContext();
originalContext.remove();
return;
}
SecurityContext context = contextStack.pop();
|
try {
if (SecurityContextChannelInterceptor.this.empty.equals(context)) {
this.securityContextHolderStrategy.clearContext();
originalContext.remove();
}
else {
this.securityContextHolderStrategy.setContext(context);
}
}
catch (Throwable ex) {
this.securityContextHolderStrategy.clearContext();
}
}
}
|
repos\spring-security-main\messaging\src\main\java\org\springframework\security\messaging\context\SecurityContextChannelInterceptor.java
| 1
|
请完成以下Java代码
|
public B x509SHA256Thumbprint(String x509SHA256Thumbprint) {
return header(JoseHeaderNames.X5T_S256, x509SHA256Thumbprint);
}
/**
* Sets the type header that declares the media type of the JWS/JWE.
* @param type the type header
* @return the {@link AbstractBuilder}
*/
public B type(String type) {
return header(JoseHeaderNames.TYP, type);
}
/**
* Sets the content type header that declares the media type of the secured
* content (the payload).
* @param contentType the content type header
* @return the {@link AbstractBuilder}
*/
public B contentType(String contentType) {
return header(JoseHeaderNames.CTY, contentType);
}
/**
* Sets the critical header that indicates which extensions to the JWS/JWE/JWA
* specifications are being used that MUST be understood and processed.
* @param name the critical header name
* @param value the critical header value
* @return the {@link AbstractBuilder}
*/
@SuppressWarnings("unchecked")
public B criticalHeader(String name, Object value) {
header(name, value);
getHeaders().computeIfAbsent(JoseHeaderNames.CRIT, (k) -> new HashSet<String>());
((Set<String>) getHeaders().get(JoseHeaderNames.CRIT)).add(name);
return getThis();
}
/**
* Sets the header.
* @param name the header name
* @param value the header value
* @return the {@link AbstractBuilder}
*/
public B header(String name, Object value) {
Assert.hasText(name, "name cannot be empty");
Assert.notNull(value, "value cannot be null");
this.headers.put(name, value);
return getThis();
|
}
/**
* A {@code Consumer} to be provided access to the headers allowing the ability to
* add, replace, or remove.
* @param headersConsumer a {@code Consumer} of the headers
* @return the {@link AbstractBuilder}
*/
public B headers(Consumer<Map<String, Object>> headersConsumer) {
headersConsumer.accept(this.headers);
return getThis();
}
/**
* Builds a new {@link JoseHeader}.
* @return a {@link JoseHeader}
*/
public abstract T build();
private static URL convertAsURL(String header, String value) {
URL convertedValue = ClaimConversionService.getSharedInstance().convert(value, URL.class);
Assert.notNull(convertedValue,
() -> "Unable to convert header '" + header + "' of type '" + value.getClass() + "' to URL.");
return convertedValue;
}
}
}
|
repos\spring-security-main\oauth2\oauth2-jose\src\main\java\org\springframework\security\oauth2\jwt\JoseHeader.java
| 1
|
请完成以下Java代码
|
public class StartManagedThreadPoolStep extends DeploymentOperationStep {
private static final int DEFAULT_CORE_POOL_SIZE = 3;
private static final int DEFAULT_MAX_POOL_SIZE = 10;
private static final long DEFAULT_KEEP_ALIVE_TIME_MS = 0L;
private static final int DEFAULT_QUEUE_SIZE = 3;
public String getName() {
return "Deploy Job Executor Thread Pool";
}
public void performOperationStep(DeploymentOperation operationContext) {
final PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
JobExecutorXml jobExecutorXml = getJobExecutorXml(operationContext);
int queueSize = getQueueSize(jobExecutorXml);
int corePoolSize = getCorePoolSize(jobExecutorXml);
int maxPoolSize = getMaxPoolSize(jobExecutorXml);
long keepAliveTime = getKeepAliveTime(jobExecutorXml);
// initialize Queue & Executor services
BlockingQueue<Runnable> threadPoolQueue = new ArrayBlockingQueue<Runnable>(queueSize);
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(corePoolSize, maxPoolSize, keepAliveTime, TimeUnit.MILLISECONDS, threadPoolQueue);
threadPoolExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy());
// construct the service for the thread pool
JmxManagedThreadPool managedThreadPool = new JmxManagedThreadPool(threadPoolQueue, threadPoolExecutor);
// install the service into the container
serviceContainer.startService(ServiceTypes.BPM_PLATFORM, RuntimeContainerDelegateImpl.SERVICE_NAME_EXECUTOR, managedThreadPool);
}
private JobExecutorXml getJobExecutorXml(DeploymentOperation operationContext) {
BpmPlatformXml bpmPlatformXml = operationContext.getAttachment(Attachments.BPM_PLATFORM_XML);
JobExecutorXml jobExecutorXml = bpmPlatformXml.getJobExecutor();
return jobExecutorXml;
}
private int getQueueSize(JobExecutorXml jobExecutorXml) {
String queueSize = jobExecutorXml.getProperties().get(JobExecutorXml.QUEUE_SIZE);
if (queueSize == null) {
return DEFAULT_QUEUE_SIZE;
}
|
return Integer.parseInt(queueSize);
}
private long getKeepAliveTime(JobExecutorXml jobExecutorXml) {
String keepAliveTime = jobExecutorXml.getProperties().get(JobExecutorXml.KEEP_ALIVE_TIME);
if (keepAliveTime == null) {
return DEFAULT_KEEP_ALIVE_TIME_MS;
}
return Long.parseLong(keepAliveTime);
}
private int getMaxPoolSize(JobExecutorXml jobExecutorXml) {
String maxPoolSize = jobExecutorXml.getProperties().get(JobExecutorXml.MAX_POOL_SIZE);
if (maxPoolSize == null) {
return DEFAULT_MAX_POOL_SIZE;
}
return Integer.parseInt(maxPoolSize);
}
private int getCorePoolSize(JobExecutorXml jobExecutorXml) {
String corePoolSize = jobExecutorXml.getProperties().get(JobExecutorXml.CORE_POOL_SIZE);
if (corePoolSize == null) {
return DEFAULT_CORE_POOL_SIZE;
}
return Integer.parseInt(corePoolSize);
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\container\impl\deployment\jobexecutor\StartManagedThreadPoolStep.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class MusicStoreController {
@Autowired
private MusicStoreService service;
@PostMapping("/album")
public MusicAlbum post(@RequestBody MusicAlbum item) {
return service.add(item);
}
@GetMapping("/album")
public List<MusicAlbum> getAlbumList() {
return service.getAlbumList();
}
@PostMapping("/compilation")
public Compilation post(@RequestBody Compilation item) {
return service.add(item);
}
@GetMapping("/compilation")
public List<Compilation> getCompilationList() {
return service.getCompilationList();
}
@PostMapping("/store")
public Store post(@RequestBody Store item) {
|
return service.add(item);
}
@GetMapping("/store")
public List<Store> getStoreList() {
return service.getStoreList();
}
@PostMapping("/track")
public MusicTrack post(@RequestBody MusicTrack item) {
return service.add(item);
}
@GetMapping("/track")
public List<MusicTrack> getTrackList() {
return service.getTrackList();
}
}
|
repos\tutorials-master\persistence-modules\spring-boot-persistence-mongodb-2\src\main\java\com\baeldung\boot\collection\name\web\MusicStoreController.java
| 2
|
请完成以下Java代码
|
private static final ITableRecordReference extractTableRecordReferenceOrNull(final Object obj)
{
if(obj == null)
{
return null;
}
if (obj instanceof ITableRecordReference)
{
return (ITableRecordReference)obj;
}
// Extract the TableRecordReference from Map.
// Usually that's the case when the parameters were deserialized and the the TableRecordRefererence was deserialized as Map.
if(obj instanceof Map)
{
final Map<?, ?> map = (Map<?, ?>)obj;
return TableRecordReference.ofMapOrNull(map);
}
|
return null;
}
protected abstract String formatTableRecordReference(final ITableRecordReference recordRef);
@Override
protected String formatText(final String text)
{
if (text == null || text.isEmpty())
{
return "";
}
return StringUtils.maskHTML(text);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\event\EventMessageFormatTemplate.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
protected String resolveDescription(MetadataGenerationEnvironment environment) {
return environment.getTypeUtils().getJavaDoc(this.field);
}
@Override
protected Object resolveDefaultValue(MetadataGenerationEnvironment environment) {
return environment.getFieldDefaultValue(getDeclaringElement(), this.field);
}
@Override
protected ItemDeprecation resolveItemDeprecation(MetadataGenerationEnvironment environment) {
return resolveItemDeprecation(environment, getGetter(), this.setter, this.field, this.factoryMethod);
}
@Override
public boolean isProperty(MetadataGenerationEnvironment env) {
if (!hasLombokPublicAccessor(env, true)) {
return false;
}
boolean isCollection = env.getTypeUtils().isCollectionOrMap(getType());
return !env.isExcluded(getType()) && (hasSetter(env) || isCollection);
}
@Override
public boolean isNested(MetadataGenerationEnvironment environment) {
return hasLombokPublicAccessor(environment, true) && super.isNested(environment);
}
private boolean hasSetter(MetadataGenerationEnvironment env) {
boolean nonFinalPublicField = !getField().getModifiers().contains(Modifier.FINAL)
&& hasLombokPublicAccessor(env, false);
return this.setter != null || nonFinalPublicField;
}
/**
* Determine if the current {@link #getField() field} defines a public accessor using
|
* lombok annotations.
* @param env the {@link MetadataGenerationEnvironment}
* @param getter {@code true} to look for the read accessor, {@code false} for the
* write accessor
* @return {@code true} if this field has a public accessor of the specified type
*/
private boolean hasLombokPublicAccessor(MetadataGenerationEnvironment env, boolean getter) {
String annotation = (getter ? LOMBOK_GETTER_ANNOTATION : LOMBOK_SETTER_ANNOTATION);
AnnotationMirror lombokMethodAnnotationOnField = env.getAnnotation(getField(), annotation);
if (lombokMethodAnnotationOnField != null) {
return isAccessLevelPublic(env, lombokMethodAnnotationOnField);
}
AnnotationMirror lombokMethodAnnotationOnElement = env.getAnnotation(getDeclaringElement(), annotation);
if (lombokMethodAnnotationOnElement != null) {
return isAccessLevelPublic(env, lombokMethodAnnotationOnElement);
}
return (env.hasAnnotation(getDeclaringElement(), LOMBOK_DATA_ANNOTATION)
|| env.hasAnnotation(getDeclaringElement(), LOMBOK_VALUE_ANNOTATION));
}
private boolean isAccessLevelPublic(MetadataGenerationEnvironment env, AnnotationMirror lombokAnnotation) {
Map<String, Object> values = env.getAnnotationElementValues(lombokAnnotation);
Object value = values.get("value");
return (value == null || value.toString().equals(LOMBOK_ACCESS_LEVEL_PUBLIC));
}
}
|
repos\spring-boot-4.0.1\configuration-metadata\spring-boot-configuration-processor\src\main\java\org\springframework\boot\configurationprocessor\LombokPropertyDescriptor.java
| 2
|
请完成以下Java代码
|
public byte[] encrypt(byte[] byteArray) {
return encrypt(byteArray, this.publicKey, this.algorithm);
}
@Override
public byte[] decrypt(byte[] encryptedByteArray) {
return decrypt(encryptedByteArray, this.privateKey, this.algorithm);
}
private static byte[] encrypt(byte[] text, PublicKey key, RsaAlgorithm alg) {
ByteArrayOutputStream output = new ByteArrayOutputStream(text.length);
try {
final Cipher cipher = Cipher.getInstance(alg.getJceName());
int limit = Math.min(text.length, alg.getMaxLength());
int pos = 0;
while (pos < text.length) {
cipher.init(Cipher.ENCRYPT_MODE, key);
cipher.update(text, pos, limit);
pos += limit;
limit = Math.min(text.length - pos, alg.getMaxLength());
byte[] buffer = cipher.doFinal();
output.write(buffer, 0, buffer.length);
}
return output.toByteArray();
}
catch (RuntimeException ex) {
throw ex;
}
catch (Exception ex) {
throw new IllegalStateException("Cannot encrypt", ex);
}
}
private static byte[] decrypt(byte[] text, @Nullable RSAPrivateKey key, RsaAlgorithm alg) {
ByteArrayOutputStream output = new ByteArrayOutputStream(text.length);
try {
final Cipher cipher = Cipher.getInstance(alg.getJceName());
int maxLength = getByteLength(key);
int pos = 0;
while (pos < text.length) {
int limit = Math.min(text.length - pos, maxLength);
cipher.init(Cipher.DECRYPT_MODE, key);
cipher.update(text, pos, limit);
pos += limit;
byte[] buffer = cipher.doFinal();
output.write(buffer, 0, buffer.length);
|
}
return output.toByteArray();
}
catch (RuntimeException ex) {
throw ex;
}
catch (Exception ex) {
throw new IllegalStateException("Cannot decrypt", ex);
}
}
// copied from sun.security.rsa.RSACore.getByteLength(java.math.BigInteger)
public static int getByteLength(@Nullable RSAKey key) {
if (key == null) {
throw new IllegalArgumentException("key cannot be null");
}
int n = key.getModulus().bitLength();
return (n + 7) >> 3;
}
}
|
repos\spring-security-main\crypto\src\main\java\org\springframework\security\crypto\encrypt\RsaRawEncryptor.java
| 1
|
请完成以下Java代码
|
public I_M_Tour getM_Tour()
{
return tour;
}
@Override
public void setM_Tour(I_M_Tour tour)
{
this.tour = tour;
}
@Override
public Date getDeliveryDate()
{
return deliveryDate;
}
@Override
public void setDeliveryDate(final Date deliveryDate)
{
this.deliveryDate = deliveryDate;
}
@Override
public Boolean getProcessed()
{
return processed;
}
@Override
public void setProcessed(Boolean processed)
{
this.processed = processed;
}
@Override
public Boolean getGenericTourInstance()
{
return genericTourInstance;
}
|
@Override
public void setGenericTourInstance(Boolean genericTourInstance)
{
this.genericTourInstance = genericTourInstance;
}
@Override
public int getM_ShipperTransportation_ID()
{
return shipperTransportationId;
}
@Override
public void setM_ShipperTransportation_ID(final int shipperTransportationId)
{
this.shipperTransportationId = shipperTransportationId;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\tourplanning\api\impl\PlainTourInstanceQueryParams.java
| 1
|
请完成以下Java代码
|
public DocTypeId getDocTypeGLJournal(@NonNull final ClientId clientId,
@NonNull final OrgId orgId)
{
final DocTypeQuery docTypeQuery = DocTypeQuery.builder()
.adClientId(clientId.getRepoId())
.adOrgId(orgId.getRepoId())
.docBaseType(DocBaseType.GLJournal)
.build();
return docTypeDAO
.getDocTypeId(docTypeQuery);
}
@Override
public void assertSamePeriod(
@NonNull final I_GL_Journal journal,
@NonNull final I_GL_JournalLine line)
{
assertSamePeriod(journal, ImmutableList.of(line));
}
@Override
public void assertSamePeriod(
@NonNull final I_GL_Journal journal,
@NonNull final List<I_GL_JournalLine> lines)
|
{
final Properties ctx = InterfaceWrapperHelper.getCtx(journal);
final int headerPeriodId = MPeriod.getOrFail(ctx, journal.getDateAcct(), journal.getAD_Org_ID()).getC_Period_ID();
for (final I_GL_JournalLine line : lines)
{
final int linePeriodId = MPeriod.getOrFail(ctx, line.getDateAcct(), line.getAD_Org_ID()).getC_Period_ID();
if (headerPeriodId != linePeriodId)
{
throw new AdempiereException(MSG_HeaderAndLinePeriodMismatchError, line.getLine());
}
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\gljournal\impl\GLJournalBL.java
| 1
|
请完成以下Java代码
|
public boolean isDefault() {
return isDefault;
}
public void setDefault(boolean isDefault) {
this.isDefault = isDefault;
}
public String getConfigurationClass() {
return configurationClass;
}
public void setConfigurationClass(String configurationClass) {
this.configurationClass = configurationClass;
}
public Map<String, String> getProperties() {
return properties;
}
public void setProperties(Map<String, String> properties) {
this.properties = properties;
}
|
public String getDatasource() {
return datasource;
}
public void setDatasource(String datasource) {
this.datasource = datasource;
}
public String getJobAcquisitionName() {
return jobAcquisitionName;
}
public void setJobAcquisitionName(String jobAcquisitionName) {
this.jobAcquisitionName = jobAcquisitionName;
}
public List<ProcessEnginePluginXml> getPlugins() {
return plugins;
}
public void setPlugins(List<ProcessEnginePluginXml> plugins) {
this.plugins = plugins;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\container\impl\metadata\ProcessEngineXmlImpl.java
| 1
|
请在Spring Boot框架中完成以下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;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail;
}
public String getLicencePic() {
|
return licencePic;
}
public void setLicencePic(String licencePic) {
this.licencePic = licencePic;
}
public Integer getUserType() {
return userType;
}
public void setUserType(Integer userType) {
this.userType = userType;
}
@Override
public String toString() {
return "RegisterReq{" +
"username='" + username + '\'' +
", password='" + password + '\'' +
", phone='" + phone + '\'' +
", mail='" + mail + '\'' +
", licencePic='" + licencePic + '\'' +
", userType=" + userType +
'}';
}
}
|
repos\SpringBoot-Dubbo-Docker-Jenkins-master\Gaoxi-Common-Service-Facade\src\main\java\com\gaoxi\req\user\RegisterReq.java
| 2
|
请完成以下Java代码
|
public void calloutOnElementIdChanged(final I_AD_Window window)
{
updateWindowFromElement(window);
}
@ModelChange(timings = { ModelValidator.TYPE_BEFORE_NEW, ModelValidator.TYPE_BEFORE_CHANGE }, ifColumnsChanged = I_AD_Tab.COLUMNNAME_AD_Element_ID)
public void onBeforeWindowSave_WhenElementIdChanged(final I_AD_Window window)
{
updateWindowFromElement(window);
}
@ModelChange(timings = { ModelValidator.TYPE_AFTER_NEW, ModelValidator.TYPE_AFTER_CHANGE }, ifColumnsChanged = I_AD_Window.COLUMNNAME_AD_Element_ID)
public void onAfterWindowSave_WhenElementIdChanged(final I_AD_Window window)
{
updateTranslationsForElement(window);
recreateElementLinkForWindow(window);
}
@ModelChange(timings = { ModelValidator.TYPE_AFTER_NEW, ModelValidator.TYPE_AFTER_CHANGE })
public void onAfterWindowSave_AssertNoCyclesInWindowCustomizationsChain(@NonNull final I_AD_Window window)
{
customizedWindowInfoMapRepository.assertNoCycles(AdWindowId.ofRepoId(window.getAD_Window_ID()));
}
private void updateWindowFromElement(final I_AD_Window window)
{
// do not copy translations from element to window
if (!IElementTranslationBL.DYNATTR_AD_Window_UpdateTranslations.getValue(window, true))
{
return;
}
final I_AD_Element windowElement = adElementDAO.getById(window.getAD_Element_ID());
if (windowElement == null)
{
// nothing to do. It was not yet set
return;
|
}
window.setName(windowElement.getName());
window.setDescription(windowElement.getDescription());
window.setHelp(windowElement.getHelp());
}
private void updateTranslationsForElement(final I_AD_Window window)
{
final AdElementId windowElementId = AdElementId.ofRepoIdOrNull(window.getAD_Element_ID());
if (windowElementId == null)
{
// nothing to do. It was not yet set
return;
}
elementTranslationBL.updateWindowTranslationsFromElement(windowElementId);
}
private void recreateElementLinkForWindow(final I_AD_Window window)
{
final AdWindowId adWindowId = AdWindowId.ofRepoIdOrNull(window.getAD_Window_ID());
if (adWindowId != null)
{
final IElementLinkBL elementLinksService = Services.get(IElementLinkBL.class);
elementLinksService.recreateADElementLinkForWindowId(adWindowId);
}
}
@ModelChange(timings = { ModelValidator.TYPE_BEFORE_DELETE })
public void onBeforeWindowDelete(final I_AD_Window window)
{
final AdWindowId adWindowId = AdWindowId.ofRepoId(window.getAD_Window_ID());
final IElementLinkBL elementLinksService = Services.get(IElementLinkBL.class);
elementLinksService.deleteExistingADElementLinkForWindowId(adWindowId);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\window\model\interceptor\AD_Window.java
| 1
|
请完成以下Java代码
|
protected ReactiveWebServerFactory getWebServerFactory(String factoryBeanName) {
return getBeanFactory().getBean(factoryBeanName, ReactiveWebServerFactory.class);
}
/**
* Return the {@link HttpHandler} that should be used to process the reactive web
* server. By default this method searches for a suitable bean in the context itself.
* @return a {@link HttpHandler} (never {@code null}
*/
protected HttpHandler getHttpHandler() {
// Use bean names so that we don't consider the hierarchy
String[] beanNames = getBeanFactory().getBeanNamesForType(HttpHandler.class);
if (beanNames.length == 0) {
throw new ApplicationContextException(
"Unable to start ReactiveWebApplicationContext due to missing HttpHandler bean.");
}
if (beanNames.length > 1) {
throw new ApplicationContextException(
"Unable to start ReactiveWebApplicationContext due to multiple HttpHandler beans : "
+ StringUtils.arrayToCommaDelimitedString(beanNames));
}
return getBeanFactory().getBean(beanNames[0], HttpHandler.class);
}
@Override
protected void doClose() {
if (isActive()) {
AvailabilityChangeEvent.publish(this, ReadinessState.REFUSING_TRAFFIC);
}
super.doClose();
WebServer webServer = getWebServer();
if (webServer != null) {
webServer.destroy();
}
}
|
/**
* Returns the {@link WebServer} that was created by the context or {@code null} if
* the server has not yet been created.
* @return the web server
*/
@Override
public @Nullable WebServer getWebServer() {
WebServerManager serverManager = this.serverManager;
return (serverManager != null) ? serverManager.getWebServer() : null;
}
@Override
public @Nullable String getServerNamespace() {
return this.serverNamespace;
}
@Override
public void setServerNamespace(@Nullable String serverNamespace) {
this.serverNamespace = serverNamespace;
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-web-server\src\main\java\org\springframework\boot\web\server\reactive\context\ReactiveWebServerApplicationContext.java
| 1
|
请完成以下Java代码
|
public void setXPosition (int XPosition)
{
set_Value (COLUMNNAME_XPosition, Integer.valueOf(XPosition));
}
/** Get X Position.
@return Absolute X (horizontal) position in 1/72 of an inch
*/
public int getXPosition ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_XPosition);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Y Position.
@param YPosition
Absolute Y (vertical) position in 1/72 of an inch
*/
|
public void setYPosition (int YPosition)
{
set_Value (COLUMNNAME_YPosition, Integer.valueOf(YPosition));
}
/** Get Y Position.
@return Absolute Y (vertical) position in 1/72 of an inch
*/
public int getYPosition ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_YPosition);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_PrintLabelLine.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Map<String, List<DragDictModel>> getManyDictItems(List<String> codeList, List<JSONObject> tableDictList) {
Map<String, List<DragDictModel>> manyDragDictItems = new HashMap<>();
if(!CollectionUtils.isEmpty(codeList)){
Map<String, List<DictModel>> dictItemsMap = sysBaseApi.getManyDictItems(codeList);
dictItemsMap.forEach((k,v)->{
List<DragDictModel> dictItems = new ArrayList<>();
v.forEach(dictItem->{
DragDictModel dictModel = new DragDictModel();
BeanUtils.copyProperties(dictItem,dictModel);
dictItems.add(dictModel);
});
manyDragDictItems.put(k,dictItems);
});
}
if(!CollectionUtils.isEmpty(tableDictList)){
tableDictList.forEach(item->{
List<DragDictModel> dictItems = new ArrayList<>();
JSONObject object = JSONObject.parseObject(item.toString());
String dictField = object.getString("dictField");
String dictTable = object.getString("dictTable");
String dictText = object.getString("dictText");
String fieldName = object.getString("fieldName");
List<DictModel> dictItemsList = sysBaseApi.queryTableDictItemsByCode(dictTable,dictText,dictField);
dictItemsList.forEach(dictItem->{
DragDictModel dictModel = new DragDictModel();
BeanUtils.copyProperties(dictItem,dictModel);
dictItems.add(dictModel);
});
manyDragDictItems.put(fieldName,dictItems);
});
}
return manyDragDictItems;
}
/**
*
* @param dictCode
* @return
*/
@Override
public List<DragDictModel> getDictItems(String dictCode) {
List<DragDictModel> dictItems = new ArrayList<>();
if(oConvertUtils.isNotEmpty(dictCode)){
List<DictModel> dictItemsList = sysBaseApi.getDictItems(dictCode);
dictItemsList.forEach(dictItem->{
DragDictModel dictModel = new DragDictModel();
BeanUtils.copyProperties(dictItem,dictModel);
dictItems.add(dictModel);
});
}
return dictItems;
}
|
/**
* 添加日志
* @param dragLogDTO
*/
@Override
public void addLog(DragLogDTO dragLogDTO) {
if(oConvertUtils.isNotEmpty(dragLogDTO)){
LogDTO dto = new LogDTO();
BeanUtils.copyProperties(dragLogDTO,dto);
baseCommonService.addLog(dto);
}
}
/**
* 保存日志
* @param logMsg
* @param logType
* @param operateType
*/
@Override
public void addLog(String logMsg, int logType, int operateType) {
baseCommonService.addLog(logMsg,logType,operateType);
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-module-system\jeecg-system-biz\src\main\java\org\jeecg\config\jimureport\JimuDragExternalServiceImpl.java
| 2
|
请完成以下Java代码
|
public void run()
{
initNow();
}
@Override
public String toString()
{
// nice toString representation to be displayed part of the thread name
return QueueProcessorExecutorService.class.getName() + "-delayedInit";
}
});
public QueueProcessorExecutorService()
{
if (Ini.isSwingClient())
{
// NOTE: later, here we can implement and add a ProxyQueueProcessorExecutorService which will contact the server
executor = NullQueueProcessorsExecutor.instance;
}
else
{
// default
executor = new QueueProcessorsExecutor();
}
}
@Override
public void init(final long delayMillis)
{
// If it's NULL then there is no point to schedule a timer
if (executor instanceof NullQueueProcessorsExecutor)
{
return;
}
// Do nothing if already initialized
if (delayedInit.isDone())
{
return;
}
delayedInit.run(delayMillis);
}
/**
* Initialize executors now.
*
* NOTE: never ever call this method directly. It's supposed to be called from {@link #delayedInit}.
*/
private void initNow()
{
// NOTE: don't check if it's already initialized because at the time when this method is called the "initialized" flag was already set,
// to prevent future executions.
|
// If it's NULL then there is no point to load all processors
if (executor instanceof NullQueueProcessorsExecutor)
{
return;
}
// Remove all queue processors. It shall be none, but just to make sure
executor.shutdown();
for (final I_C_Queue_Processor processorDef : queueDAO.retrieveAllProcessors())
{
executor.addQueueProcessor(processorDef);
}
}
@Override
public void removeAllQueueProcessors()
{
delayedInit.cancelAndReset();
executor.shutdown();
}
@Override
public IQueueProcessorsExecutor getExecutor()
{
// Make sure executor was initialized.
// Else it makes no sense to return it because could lead to data corruption.
if (!isInitialized())
{
throw new IllegalStateException("Service not initialized");
}
return executor;
}
@Override
public boolean isInitialized()
{
return delayedInit.isDone();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.async\src\main\java\de\metas\async\processor\impl\QueueProcessorExecutorService.java
| 1
|
请完成以下Java代码
|
private static String convertToString(final Object value)
{
if (value == null)
{
return null;
}
else if (value instanceof Boolean)
{
return DisplayType.toBooleanString((Boolean)value);
}
else if (value instanceof String)
{
return value.toString();
}
else if (value instanceof LookupValue)
{
return ((LookupValue)value).getIdAsString();
}
else if (value instanceof java.util.Date)
{
final java.util.Date valueDate = (java.util.Date)value;
return Env.toString(valueDate);
}
else
{
return value.toString();
}
}
private static Integer convertToInteger(final Object valueObj)
{
if (valueObj == null)
{
return null;
}
else if (valueObj instanceof Integer)
{
return (Integer)valueObj;
}
else if (valueObj instanceof Number)
{
return ((Number)valueObj).intValue();
}
else if (valueObj instanceof IntegerLookupValue)
{
return ((IntegerLookupValue)valueObj).getIdAsInt();
}
else
{
final String valueStr = valueObj.toString().trim();
if (valueStr.isEmpty())
{
return null;
}
|
return Integer.parseInt(valueStr);
}
}
private static BigDecimal convertToBigDecimal(final Object valueObj)
{
if (valueObj == null)
{
return null;
}
else if (valueObj instanceof BigDecimal)
{
return (BigDecimal)valueObj;
}
else
{
final String valueStr = valueObj.toString().trim();
if (valueStr.isEmpty())
{
return null;
}
return new BigDecimal(valueStr);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\model\DocumentEvaluatee.java
| 1
|
请完成以下Java代码
|
static boolean isRotation(int startingAt, String rotation, String origin) {
for (int i = 0; i < origin.length(); i++) {
if (rotation.charAt((startingAt + i) % origin.length()) != origin.charAt(i)) {
return false;
}
}
return true;
}
public static boolean isRotationUsingQueue(String origin, String rotation) {
if (origin.length() == rotation.length()) {
return checkWithQueue(origin, rotation);
}
return false;
}
static boolean checkWithQueue(String origin, String rotation) {
if (origin.length() == rotation.length()) {
Queue<Character> originQueue = getCharactersQueue(origin);
Queue<Character> rotationQueue = getCharactersQueue(rotation);
int k = rotation.length();
while (k > 0 && null != rotationQueue.peek()) {
k--;
char ch = rotationQueue.peek();
rotationQueue.remove();
rotationQueue.add(ch);
if (rotationQueue.equals(originQueue)) {
return true;
}
}
}
return false;
}
static Queue<Character> getCharactersQueue(String origin) {
return origin.chars()
.mapToObj(c -> (char) c)
|
.collect(Collectors.toCollection(LinkedList::new));
}
public static boolean isRotationUsingSuffixAndPrefix(String origin, String rotation) {
if (origin.length() == rotation.length()) {
return checkPrefixAndSuffix(origin, rotation);
}
return false;
}
static boolean checkPrefixAndSuffix(String origin, String rotation) {
if (origin.length() == rotation.length()) {
for (int i = 0; i < origin.length(); i++) {
if (origin.charAt(i) == rotation.charAt(0)) {
if (checkRotationPrefixWithOriginSuffix(origin, rotation, i)) {
if (checkOriginPrefixWithRotationSuffix(origin, rotation, i))
return true;
}
}
}
}
return false;
}
private static boolean checkRotationPrefixWithOriginSuffix(String origin, String rotation, int i) {
return origin.substring(i)
.equals(rotation.substring(0, origin.length() - i));
}
private static boolean checkOriginPrefixWithRotationSuffix(String origin, String rotation, int i) {
return origin.substring(0, i)
.equals(rotation.substring(origin.length() - i));
}
}
|
repos\tutorials-master\algorithms-modules\algorithms-miscellaneous-7\src\main\java\com\baeldung\algorithms\stringrotation\StringRotation.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class Dog {
private String name;
private Integer age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getAge() {
return age;
}
|
public void setAge(Integer age) {
this.age = age;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder( "{\"Dog\":{" );
sb.append( "\"name\":\"" )
.append( name ).append( '\"' );
sb.append( ",\"age\":" )
.append( age );
sb.append( "}}" );
return sb.toString();
}
}
|
repos\SpringBootLearning-master (1)\springboot-config\src\main\java\com\gf\entity\Dog.java
| 2
|
请完成以下Java代码
|
protected void compileScript(ScriptEngine engine) {
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
if (processEngineConfiguration.isEnableScriptEngineCaching() && processEngineConfiguration.isEnableScriptCompilation()) {
if (getCompiledScript() == null && shouldBeCompiled) {
synchronized (this) {
if (getCompiledScript() == null && shouldBeCompiled) {
// try to compile script
compiledScript = compile(engine, language, scriptSource);
// either the script was successfully compiled or it can't be
// compiled but we won't try it again
shouldBeCompiled = false;
}
}
}
}
else {
// if script compilation is disabled abort
shouldBeCompiled = false;
}
}
public CompiledScript compile(ScriptEngine scriptEngine, String language, String src) {
if(scriptEngine instanceof Compilable && !scriptEngine.getFactory().getLanguageName().equalsIgnoreCase("ecmascript")) {
Compilable compilingEngine = (Compilable) scriptEngine;
try {
CompiledScript compiledScript = compilingEngine.compile(src);
LOG.debugCompiledScriptUsing(language);
return compiledScript;
} catch (ScriptException e) {
throw new ScriptCompilationException("Unable to compile script: " + e.getMessage(), e);
}
} else {
// engine does not support compilation
return null;
}
}
protected Object evaluateScript(ScriptEngine engine, Bindings bindings) throws ScriptException {
LOG.debugEvaluatingNonCompiledScript(scriptSource);
return engine.eval(scriptSource, bindings);
}
|
public String getScriptSource() {
return scriptSource;
}
/**
* Sets the script source code. And invalidates any cached compilation result.
*
* @param scriptSource
* the new script source code
*/
public void setScriptSource(String scriptSource) {
this.compiledScript = null;
shouldBeCompiled = true;
this.scriptSource = scriptSource;
}
public boolean isShouldBeCompiled() {
return shouldBeCompiled;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\scripting\SourceExecutableScript.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class ProductService {
private final ProductRepository productRepository;
private final Random random;
private final Clock clock;
public ProductService(ProductRepository productRepository, Random random, Clock clock) {
this.productRepository = productRepository;
this.random = random;
this.clock = clock;
}
@Transactional
public long createProducts(int count) {
List<Product> products = generate(count);
long startTime = clock.millis();
productRepository.saveAll(products);
return clock.millis() - startTime;
}
private List<Product> generate(int count) {
|
final String[] titles = { "car", "plane", "house", "yacht" };
final BigDecimal[] prices = {
new BigDecimal("12483.12"),
new BigDecimal("8539.99"),
new BigDecimal("88894"),
new BigDecimal("458694")
};
final List<Product> products = new ArrayList<>(count);
for (int i = 0; i < count; i++) {
Product product = new Product();
product.setCreatedTs(LocalDateTime.now(clock));
product.setPrice(prices[random.nextInt(4)]);
product.setTitle(titles[random.nextInt(4)]);
products.add(product);
}
return products;
}
}
|
repos\tutorials-master\persistence-modules\spring-jdbc\src\main\java\com\baeldung\spring\jdbc\batch\service\ProductService.java
| 2
|
请完成以下Java代码
|
public boolean isEmpty()
{
return transactions == null ? true : transactions.isEmpty();
}
/**
* Removes all collected transactions (if any).
*/
public void clearTransactions()
{
transactions = null;
}
/**
* Iterates given list (from end to begining) and deletes all duplicate transactions, keeping only the last one.
*
* Two transactions are considered duplicate if their keys (see {@link #mkKey(IHUTransactionAttribute)}) are equal.
*
* @param transactions
*/
private void removeDuplicateTransactions(final List<IHUTransactionAttribute> transactions)
{
if (transactions.isEmpty())
{
return;
}
//
// Check our transactions history and if we find a transaction which is shadowed by our newly created transaction
// then just remove it from list and keep only ours
final int size = transactions.size();
final Set<ArrayKey> seenTrxs = new HashSet<>(size);
final ListIterator<IHUTransactionAttribute> it = transactions.listIterator(size);
while (it.hasPrevious())
{
final IHUTransactionAttribute trx = it.previous();
final ArrayKey trxKey = mkKey(trx);
final boolean uniqueTransaction = seenTrxs.add(trxKey);
if (!uniqueTransaction)
{
// Already seen transaction => remove it
it.remove();
continue;
}
}
}
/**
* Used by {@link #mkKey(IHUTransactionAttribute)} in case we want to make sure a given key is unique.
*
|
* In this case it will use and increment this value.
*/
private int uniqueKeyIndex = 1;
/**
* Creates transaction's unique key.
*
* @param trx
* @return
*/
private ArrayKey mkKey(final IHUTransactionAttribute trx)
{
final AttributeId attributeId = trx.getAttributeId();
final HUTransactionAttributeOperation operation = trx.getOperation();
final Object referencedObject = trx.getReferencedObject();
final String referencedObjectTableName;
final int referencedObjectId;
final int uniqueDiscriminant;
if (referencedObject == null)
{
referencedObjectTableName = null;
referencedObjectId = -1;
uniqueDiscriminant = uniqueKeyIndex++; // we want to have a unique discriminant
}
else
{
referencedObjectTableName = InterfaceWrapperHelper.getModelTableName(referencedObject);
referencedObjectId = InterfaceWrapperHelper.getId(referencedObject);
uniqueDiscriminant = 0; // nop, we don't want to have a unique discriminant
}
return Util.mkKey(uniqueDiscriminant, attributeId, operation, referencedObjectTableName, referencedObjectId);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\attribute\impl\HUTrxAttributesCollector.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
static MethodInterceptor preFilterAuthorizationMethodInterceptor(
ObjectProvider<ReactiveAuthorizationManagerMethodSecurityConfiguration> _reactiveMethodSecurityConfiguration) {
return new DeferringMethodInterceptor<>(preFilterPointcut,
() -> _reactiveMethodSecurityConfiguration.getObject().preFilterMethodInterceptor);
}
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
static MethodInterceptor preAuthorizeAuthorizationMethodInterceptor(
ObjectProvider<ReactiveAuthorizationManagerMethodSecurityConfiguration> _reactiveMethodSecurityConfiguration) {
return new DeferringMethodInterceptor<>(preAuthorizePointcut,
() -> _reactiveMethodSecurityConfiguration.getObject().preAuthorizeMethodInterceptor);
}
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
static MethodInterceptor postFilterAuthorizationMethodInterceptor(
ObjectProvider<ReactiveAuthorizationManagerMethodSecurityConfiguration> _reactiveMethodSecurityConfiguration) {
return new DeferringMethodInterceptor<>(postFilterPointcut,
() -> _reactiveMethodSecurityConfiguration.getObject().postFilterMethodInterceptor);
}
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
static MethodInterceptor postAuthorizeAuthorizationMethodInterceptor(
ObjectProvider<ReactiveAuthorizationManagerMethodSecurityConfiguration> _reactiveMethodSecurityConfiguration) {
return new DeferringMethodInterceptor<>(postAuthorizePointcut,
() -> _reactiveMethodSecurityConfiguration.getObject().postAuthorizeMethodInterceptor);
|
}
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Fallback
static DefaultMethodSecurityExpressionHandler methodSecurityExpressionHandler(
@Autowired(required = false) GrantedAuthorityDefaults grantedAuthorityDefaults) {
DefaultMethodSecurityExpressionHandler handler = new DefaultMethodSecurityExpressionHandler();
if (grantedAuthorityDefaults != null) {
handler.setDefaultRolePrefix(grantedAuthorityDefaults.getRolePrefix());
}
return handler;
}
}
|
repos\spring-security-main\config\src\main\java\org\springframework\security\config\annotation\method\configuration\ReactiveAuthorizationManagerMethodSecurityConfiguration.java
| 2
|
请完成以下Java代码
|
public void setIsAllowAccountDR (final boolean IsAllowAccountDR)
{
set_Value (COLUMNNAME_IsAllowAccountDR, IsAllowAccountDR);
}
@Override
public boolean isAllowAccountDR()
{
return get_ValueAsBoolean(COLUMNNAME_IsAllowAccountDR);
}
@Override
public void setIsGenerated (final boolean IsGenerated)
{
set_ValueNoCheck (COLUMNNAME_IsGenerated, IsGenerated);
}
@Override
public boolean isGenerated()
{
return get_ValueAsBoolean(COLUMNNAME_IsGenerated);
}
@Override
public void setIsSplitAcctTrx (final boolean IsSplitAcctTrx)
{
set_Value (COLUMNNAME_IsSplitAcctTrx, IsSplitAcctTrx);
}
@Override
public boolean isSplitAcctTrx()
{
return get_ValueAsBoolean(COLUMNNAME_IsSplitAcctTrx);
}
@Override
public void setLine (final int Line)
{
set_Value (COLUMNNAME_Line, Line);
}
@Override
public int getLine()
{
return get_ValueAsInt(COLUMNNAME_Line);
}
@Override
public void setProcessed (final boolean Processed)
{
set_Value (COLUMNNAME_Processed, Processed);
}
@Override
public boolean isProcessed()
{
return get_ValueAsBoolean(COLUMNNAME_Processed);
}
@Override
public void setQty (final @Nullable BigDecimal Qty)
|
{
set_Value (COLUMNNAME_Qty, Qty);
}
@Override
public BigDecimal getQty()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty);
return bd != null ? bd : BigDecimal.ZERO;
}
/**
* Type AD_Reference_ID=540534
* Reference name: GL_JournalLine_Type
*/
public static final int TYPE_AD_Reference_ID=540534;
/** Normal = N */
public static final String TYPE_Normal = "N";
/** Tax = T */
public static final String TYPE_Tax = "T";
@Override
public void setType (final java.lang.String Type)
{
set_Value (COLUMNNAME_Type, Type);
}
@Override
public java.lang.String getType()
{
return get_ValueAsString(COLUMNNAME_Type);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_GL_JournalLine.java
| 1
|
请完成以下Java代码
|
default boolean isImmutable()
{
return getPrefilterWhereClause().getParameterNames().isEmpty()
&& getPostQueryFilter().getParameters(null).isEmpty();
}
/**
* Returns a set of parameters on which this validation rule depends.
* <p>
* Actually it's a concatenation of:
* <ul>
* <li>{@link #getPrefilterWhereClause()}'s parameters
* <li>{@link #getPostQueryFilter()}'s parameters
* </ul>
* <p>
* It is assumed that the parameters set is static and not change over time.
*
* @return set of parameter names
*/
Set<String> getAllParameters();
/**
* @return SQL to be used for pre-filtering data
*/
IStringExpression getPrefilterWhereClause();
/**
* @return filter to be applied after query; or {@link NamePairPredicates#ACCEPT_ALL}
*/
default INamePairPredicate getPostQueryFilter()
{
return NamePairPredicates.ACCEPT_ALL;
}
/**
* Specify for which table and column pair this validation rule shall not apply
*
* @param description may be null
|
*/
default void registerException(@NonNull final String tableName, @NonNull final String columnName, final String description)
{
throw new UnsupportedOperationException("Class " + getClass().getName() + " does not support registering exceptions");
}
/**
* @return a list containing all the table+column pairs for which this validation rule shall not be applied
*/
default List<ValueNamePair> getExceptionTableAndColumns()
{
return ImmutableList.of();
}
default Set<String> getDependsOnTableNames()
{
return ImmutableSet.of();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\validationRule\IValidationRule.java
| 1
|
请完成以下Java代码
|
public class Doc_Requisition extends Doc<DocLine_Requisition>
{
public Doc_Requisition(final AcctDocContext ctx)
{
super(ctx, DocBaseType.PurchaseRequisition);
} // Doc_Requisition
@Override
protected void loadDocumentDetails()
{
setNoCurrency();
final I_M_Requisition req = getModel(I_M_Requisition.class);
setDateDoc(req.getDateDoc());
setDateAcct(req.getDateDoc());
// Amounts
setAmount(AMTTYPE_Gross, req.getTotalLines());
setAmount(AMTTYPE_Net, req.getTotalLines());
setDocLines(loadLines(req));
}
private List<DocLine_Requisition> loadLines(I_M_Requisition req)
{
final List<DocLine_Requisition> list = new ArrayList<>();
|
final MRequisition reqPO = LegacyAdapters.convertToPO(req);
for (final I_M_RequisitionLine line : reqPO.getLines())
{
DocLine_Requisition docLine = new DocLine_Requisition(line, this);
list.add(docLine);
}
return list;
}
@Override
public BigDecimal getBalance()
{
return BigDecimal.ZERO;
} // getBalance
@Override
public List<Fact> createFacts(AcctSchema as)
{
return ImmutableList.of();
}
} // Doc_Requisition
|
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java-legacy\org\compiere\acct\Doc_Requisition.java
| 1
|
请完成以下Java代码
|
public void setC_Phase_ID (final int C_Phase_ID)
{
if (C_Phase_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Phase_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Phase_ID, C_Phase_ID);
}
@Override
public int getC_Phase_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Phase_ID);
}
@Override
public void setC_Task_ID (final int C_Task_ID)
{
if (C_Task_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Task_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Task_ID, C_Task_ID);
}
@Override
public int getC_Task_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Task_ID);
}
@Override
public void setDescription (final java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
@Override
public java.lang.String getDescription()
{
return get_ValueAsString(COLUMNNAME_Description);
}
@Override
public void setHelp (final java.lang.String Help)
{
set_Value (COLUMNNAME_Help, Help);
}
@Override
public java.lang.String getHelp()
{
return get_ValueAsString(COLUMNNAME_Help);
}
@Override
public void 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 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 setStandardQty (final BigDecimal StandardQty)
{
set_Value (COLUMNNAME_StandardQty, StandardQty);
}
@Override
public BigDecimal getStandardQty()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_StandardQty);
return bd != null ? bd : BigDecimal.ZERO;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Task.java
| 1
|
请完成以下Java代码
|
public void setButtonLink(String buttonLink) {
getButtonConfig().ifPresent(buttonConfig -> {
buttonConfig.set("link", new TextNode(buttonLink));
});
}
private String getButtonConfigProperty(String property) {
return getButtonConfig()
.map(buttonConfig -> buttonConfig.get(property))
.filter(JsonNode::isTextual)
.map(JsonNode::asText).orElse(null);
}
private Optional<ObjectNode> getButtonConfig() {
return Optional.ofNullable(additionalConfig)
|
.map(config -> config.get("actionButtonConfig")).filter(JsonNode::isObject)
.map(config -> (ObjectNode) config);
}
@Override
public NotificationDeliveryMethod getMethod() {
return NotificationDeliveryMethod.WEB;
}
@Override
public WebDeliveryMethodNotificationTemplate copy() {
return new WebDeliveryMethodNotificationTemplate(this);
}
}
|
repos\thingsboard-master\common\data\src\main\java\org\thingsboard\server\common\data\notification\template\WebDeliveryMethodNotificationTemplate.java
| 1
|
请完成以下Java代码
|
protected List<String> getLineDescriptionList()
{
final List<String> lineDesc = new ArrayList<>();
final String addtlNtryInfStr = entry.getAddtlNtryInf();
if (addtlNtryInfStr != null)
{
lineDesc.addAll( Arrays.stream(addtlNtryInfStr.split(" "))
.filter(Check::isNotBlank)
.collect(Collectors.toList()));
}
final List<String> trxDetails = getEntryTransaction()
.stream()
.map(EntryTransaction2::getAddtlTxInf)
.filter(Objects::nonNull)
.map(str -> Arrays.asList(str.split(" ")))
.flatMap(List::stream)
.filter(Check::isNotBlank)
.collect(Collectors.toList());
lineDesc.addAll(trxDetails);
return lineDesc;
}
@Override
@Nullable
protected String getCcy()
{
return entry.getAmt().getCcy();
|
}
@Override
@Nullable
protected BigDecimal getAmtValue()
{
return entry.getAmt().getValue();
}
public boolean isBatchTransaction() {return getEntryTransaction().size() > 1;}
@Override
public List<ITransactionDtlsWrapper> getTransactionDtlsWrapper()
{
return getEntryTransaction()
.stream()
.map(tr -> TransactionDtls2Wrapper.builder().entryDtls(tr).build())
.collect(ImmutableList.toImmutableList());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java\de\metas\banking\camt53\wrapper\v02\BatchReportEntry2Wrapper.java
| 1
|
请完成以下Java代码
|
public void setIsSOTrx (boolean IsSOTrx)
{
set_ValueNoCheck (COLUMNNAME_IsSOTrx, Boolean.valueOf(IsSOTrx));
}
/** Get Sales Transaction.
@return This is a Sales Transaction
*/
@Override
public boolean isSOTrx ()
{
Object oo = get_Value(COLUMNNAME_IsSOTrx);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
@Override
public org.compiere.model.I_M_Product getM_Product() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_M_Product_ID, org.compiere.model.I_M_Product.class);
}
@Override
public void setM_Product(org.compiere.model.I_M_Product M_Product)
{
set_ValueFromPO(COLUMNNAME_M_Product_ID, org.compiere.model.I_M_Product.class, M_Product);
}
/** Set Produkt.
@param M_Product_ID
Produkt, Leistung, Artikel
*/
@Override
public void setM_Product_ID (int M_Product_ID)
{
if (M_Product_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Product_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID));
}
|
/** Get Produkt.
@return Produkt, Leistung, Artikel
*/
@Override
public int getM_Product_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Einzelpreis.
@param PriceActual
Effektiver Preis
*/
@Override
public void setPriceActual (java.math.BigDecimal PriceActual)
{
set_ValueNoCheck (COLUMNNAME_PriceActual, PriceActual);
}
/** Get Einzelpreis.
@return Effektiver Preis
*/
@Override
public java.math.BigDecimal getPriceActual ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PriceActual);
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_BPartner_Product_Stats_Invoice_Online_V.java
| 1
|
请完成以下Java代码
|
public int getM_PriceList_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_PriceList_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Session ID.
@param Session_ID Session ID */
public void setSession_ID (int Session_ID)
{
if (Session_ID < 1)
set_Value (COLUMNNAME_Session_ID, null);
else
set_Value (COLUMNNAME_Session_ID, Integer.valueOf(Session_ID));
}
/** Get Session ID.
@return Session ID */
public int getSession_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Session_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), String.valueOf(getSession_ID()));
|
}
/** Set W_Basket_ID.
@param W_Basket_ID
Web Basket
*/
public void setW_Basket_ID (int W_Basket_ID)
{
if (W_Basket_ID < 1)
set_ValueNoCheck (COLUMNNAME_W_Basket_ID, null);
else
set_ValueNoCheck (COLUMNNAME_W_Basket_ID, Integer.valueOf(W_Basket_ID));
}
/** Get W_Basket_ID.
@return Web Basket
*/
public int getW_Basket_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_W_Basket_ID);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_W_Basket.java
| 1
|
请完成以下Java代码
|
protected void doCommit(DefaultTransactionStatus status) {
RabbitTransactionObject txObject = (RabbitTransactionObject) status.getTransaction();
RabbitResourceHolder resourceHolder = txObject.getResourceHolder();
if (resourceHolder != null) {
resourceHolder.commitAll();
}
}
@Override
protected void doRollback(DefaultTransactionStatus status) {
RabbitTransactionObject txObject = (RabbitTransactionObject) status.getTransaction();
RabbitResourceHolder resourceHolder = txObject.getResourceHolder();
if (resourceHolder != null) {
resourceHolder.rollbackAll();
}
}
@Override
protected void doSetRollbackOnly(DefaultTransactionStatus status) {
RabbitTransactionObject txObject = (RabbitTransactionObject) status.getTransaction();
RabbitResourceHolder resourceHolder = txObject.getResourceHolder();
if (resourceHolder != null) {
resourceHolder.setRollbackOnly();
}
}
@Override
protected void doCleanupAfterCompletion(Object transaction) {
RabbitTransactionObject txObject = (RabbitTransactionObject) transaction;
TransactionSynchronizationManager.unbindResource(getResourceFactory());
RabbitResourceHolder resourceHolder = txObject.getResourceHolder();
if (resourceHolder != null) {
resourceHolder.closeAll();
resourceHolder.clear();
}
}
/**
* Rabbit transaction object, representing a RabbitResourceHolder. Used as transaction object by
* RabbitTransactionManager.
* @see RabbitResourceHolder
*/
private static class RabbitTransactionObject implements SmartTransactionObject {
private @Nullable RabbitResourceHolder resourceHolder;
RabbitTransactionObject() {
}
|
public void setResourceHolder(@Nullable RabbitResourceHolder resourceHolder) {
this.resourceHolder = resourceHolder;
}
public @Nullable RabbitResourceHolder getResourceHolder() {
return this.resourceHolder;
}
@Override
public boolean isRollbackOnly() {
return this.resourceHolder != null && this.resourceHolder.isRollbackOnly();
}
@Override
public void flush() {
// no-op
}
}
}
|
repos\spring-amqp-main\spring-rabbit\src\main\java\org\springframework\amqp\rabbit\transaction\RabbitTransactionManager.java
| 1
|
请完成以下Java代码
|
static class InitWoerk implements Runnable {
@Override
public void run() {
System.out.println(Thread.currentThread().getName() + "初始化工作开始第一步》》》》》");
try {
sleep(5);
} finally {
countDownLatch.countDown();
}
System.out.println(Thread.currentThread().getName() + "初始化工作开始第二步》》》》》");
try {
sleep(5);
} finally {
countDownLatch.countDown();
}
System.out.println(Thread.currentThread().getName() + "初始化工作处理业务逻辑》》》》》");
}
}
/**
* 业务线程
*/
|
static class BusinessWoerk implements Runnable {
@Override
public void run() {
try {
System.out.println(Thread.currentThread().getName() + "初始化线程还未完成,业务线程阻塞----------");
countDownLatch.await(1, TimeUnit.MINUTES);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName() + "初始化工作完成业务线程开始工作----------");
System.out.println(Thread.currentThread().getName() + "初始化工作完成业务线程开始工作----------");
System.out.println(Thread.currentThread().getName() + "初始化工作完成业务线程开始工作----------");
System.out.println(Thread.currentThread().getName() + "初始化工作完成业务线程开始工作----------");
}
}
private static void sleep(long millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
|
repos\spring-boot-student-master\spring-boot-student-concurrent\src\main\java\com\xiaolyuh\CountDownLatchTest.java
| 1
|
请完成以下Java代码
|
public ChannelDefinitionEntity findChannelDefinitionByDeploymentAndKey(String deploymentId, String channelDefinitionKey) {
return dataManager.findChannelDefinitionByDeploymentAndKey(deploymentId, channelDefinitionKey);
}
@Override
public ChannelDefinitionEntity findChannelDefinitionByDeploymentAndKeyAndTenantId(String deploymentId, String channelDefinitionKey, String tenantId) {
return dataManager.findChannelDefinitionByDeploymentAndKeyAndTenantId(deploymentId, channelDefinitionKey, tenantId);
}
@Override
public ChannelDefinitionEntity findLatestChannelDefinitionByKeyAndTenantId(String channelDefinitionKey, String tenantId) {
if (tenantId == null || EventRegistryEngineConfiguration.NO_TENANT_ID.equals(tenantId)) {
return dataManager.findLatestChannelDefinitionByKey(channelDefinitionKey);
} else {
return dataManager.findLatestChannelDefinitionByKeyAndTenantId(channelDefinitionKey, tenantId);
}
}
@Override
public ChannelDefinitionEntity findChannelDefinitionByKeyAndVersionAndTenantId(String channelDefinitionKey, Integer eventVersion, String tenantId) {
if (tenantId == null || EventRegistryEngineConfiguration.NO_TENANT_ID.equals(tenantId)) {
return dataManager.findChannelDefinitionByKeyAndVersion(channelDefinitionKey, eventVersion);
} else {
|
return dataManager.findChannelDefinitionByKeyAndVersionAndTenantId(channelDefinitionKey, eventVersion, tenantId);
}
}
@Override
public List<ChannelDefinition> findChannelDefinitionsByNativeQuery(Map<String, Object> parameterMap) {
return dataManager.findChannelDefinitionsByNativeQuery(parameterMap);
}
@Override
public long findChannelDefinitionCountByNativeQuery(Map<String, Object> parameterMap) {
return dataManager.findChannelDefinitionCountByNativeQuery(parameterMap);
}
@Override
public void updateChannelDefinitionTenantIdForDeployment(String deploymentId, String newTenantId) {
dataManager.updateChannelDefinitionTenantIdForDeployment(deploymentId, newTenantId);
}
}
|
repos\flowable-engine-main\modules\flowable-event-registry\src\main\java\org\flowable\eventregistry\impl\persistence\entity\ChannelDefinitionEntityManagerImpl.java
| 1
|
请完成以下Java代码
|
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTarget() {
return target;
}
public void setTarget(String target) {
this.target = target;
}
public List<String> getSources() {
return sources;
}
|
public void setSources(List<String> sources) {
this.sources = sources;
}
public void addSource(String source) {
if (sources == null) {
sources = new ArrayList<>();
}
sources.add(source);
}
public void setValues(LinkEventDefinition otherDefinition) {
super.setValues(otherDefinition);
setName(otherDefinition.getName());
setTarget(otherDefinition.getTarget());
setSources(otherDefinition.getSources());
}
}
|
repos\Activiti-develop\activiti-core\activiti-bpmn-model\src\main\java\org\activiti\bpmn\model\LinkEventDefinition.java
| 1
|
请完成以下Java代码
|
public static void registerType(ModelBuilder bpmnModelBuilder) {
ModelElementTypeBuilder typeBuilder = bpmnModelBuilder.defineType(BaseElement.class, BPMN_ELEMENT_BASE_ELEMENT)
.namespaceUri(BPMN20_NS)
.abstractType();
idAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_ID)
.idAttribute()
.build();
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
documentationCollection = sequenceBuilder.elementCollection(Documentation.class)
.build();
extensionElementsChild = sequenceBuilder.element(ExtensionElements.class)
.build();
typeBuilder.build();
}
public BaseElementImpl(ModelTypeInstanceContext instanceContext) {
super(instanceContext);
}
public String getId() {
return idAttribute.getValue(this);
}
public void setId(String id) {
idAttribute.setValue(this, id);
}
public Collection<Documentation> getDocumentations() {
return documentationCollection.get(this);
}
public ExtensionElements getExtensionElements() {
return extensionElementsChild.getChild(this);
}
public void setExtensionElements(ExtensionElements extensionElements) {
extensionElementsChild.setChild(this, extensionElements);
}
@SuppressWarnings("rawtypes")
public DiagramElement getDiagramElement() {
Collection<Reference> incomingReferences = getIncomingReferencesByType(DiagramElement.class);
|
for (Reference<?> reference : incomingReferences) {
for (ModelElementInstance sourceElement : reference.findReferenceSourceElements(this)) {
String referenceIdentifier = reference.getReferenceIdentifier(sourceElement);
if (referenceIdentifier != null && referenceIdentifier.equals(getId())) {
return (DiagramElement) sourceElement;
}
}
}
return null;
}
@SuppressWarnings("rawtypes")
public Collection<Reference> getIncomingReferencesByType(Class<? extends ModelElementInstance> referenceSourceTypeClass) {
Collection<Reference> references = new ArrayList<Reference>();
// we traverse all incoming references in reverse direction
for (Reference<?> reference : idAttribute.getIncomingReferences()) {
ModelElementType sourceElementType = reference.getReferenceSourceElementType();
Class<? extends ModelElementInstance> sourceInstanceType = sourceElementType.getInstanceType();
// if the referencing element (source element) is a BPMNDI element, dig deeper
if (referenceSourceTypeClass.isAssignableFrom(sourceInstanceType)) {
references.add(reference);
}
}
return references;
}
}
|
repos\camunda-bpm-platform-master\model-api\bpmn-model\src\main\java\org\camunda\bpm\model\bpmn\impl\instance\BaseElementImpl.java
| 1
|
请完成以下Java代码
|
public class ChangeTenantIdBuilderImpl implements ChangeTenantIdBuilder {
protected final String sourceTenantId;
protected final String targetTenantId;
protected final ChangeTenantIdManager changeTenantIdManager;
protected String definitionTenantId;
public ChangeTenantIdBuilderImpl(String sourceTenantId, String targetTenantId, ChangeTenantIdManager changeTenantIdManager) {
if (sourceTenantId == null) {
throw new FlowableIllegalArgumentException("The source tenant id must not be null.");
}
if (targetTenantId == null) {
throw new FlowableIllegalArgumentException("The target tenant id must not be null.");
}
this.sourceTenantId = sourceTenantId;
this.targetTenantId = targetTenantId;
if (sourceTenantId.equals(targetTenantId)) {
throw new FlowableIllegalArgumentException("The source and the target tenant ids must be different.");
}
this.changeTenantIdManager = changeTenantIdManager;
}
@Override
public ChangeTenantIdBuilder definitionTenantId(String definitionTenantId) {
if (definitionTenantId == null) {
throw new FlowableIllegalArgumentException("definitionTenantId must not be null");
}
this.definitionTenantId = definitionTenantId;
return this;
|
}
@Override
public ChangeTenantIdResult simulate() {
return changeTenantIdManager.simulate(this);
}
@Override
public ChangeTenantIdResult complete() {
return changeTenantIdManager.complete(this);
}
public String getSourceTenantId() {
return sourceTenantId;
}
public String getTargetTenantId() {
return targetTenantId;
}
public String getDefinitionTenantId() {
return definitionTenantId;
}
}
|
repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\tenant\ChangeTenantIdBuilderImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class AlbertaCompositeProductInfo
{
@NonNull
ProductId productId;
@Nullable
String albertaArticleId;
@Nullable
String productGroupId;
@NonNull
Instant lastUpdated;
@Nullable
String additionalDescription;
@Nullable
String size;
@Nullable
String medicalAidPositionNumber;
@Nullable
String inventoryType;
@Nullable
|
String status;
@Nullable
BigDecimal stars;
@Nullable
String assortmentType;
@Nullable
String purchaseRating;
@Nullable
BigDecimal pharmacyPrice;
@Nullable
BigDecimal fixedPrice;
@Nullable
List<String> therapyIds;
@Nullable
List<String> billableTherapyIds;
@Nullable
List<AlbertaPackagingUnit> albertaPackagingUnitList;
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.healthcare.alberta\src\main\java\de\metas\vertical\healthcare\alberta\service\AlbertaCompositeProductInfo.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public Map<String, String> getPathMapping() {
return this.pathMapping;
}
public Discovery getDiscovery() {
return this.discovery;
}
public static class Exposure {
/**
* Endpoint IDs that should be included or '*' for all.
*/
private Set<String> include = new LinkedHashSet<>();
/**
* Endpoint IDs that should be excluded or '*' for all.
*/
private Set<String> exclude = new LinkedHashSet<>();
public Set<String> getInclude() {
return this.include;
}
public void setInclude(Set<String> include) {
this.include = include;
}
public Set<String> getExclude() {
return this.exclude;
|
}
public void setExclude(Set<String> exclude) {
this.exclude = exclude;
}
}
public static class Discovery {
/**
* Whether the discovery page is enabled.
*/
private boolean enabled = true;
public boolean isEnabled() {
return this.enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-actuator-autoconfigure\src\main\java\org\springframework\boot\actuate\autoconfigure\endpoint\web\WebEndpointProperties.java
| 2
|
请完成以下Java代码
|
public boolean doCatch(final Throwable e) throws Throwable
{
throw e;
}
@Override
public void doFinally()
{
// nothing
}
};
}
public static TrxCallableWithTrxName<Void> wrapIfNeeded(final TrxRunnable2 trxRunnable)
{
if (trxRunnable == null)
{
return null;
}
return new TrxCallableWithTrxName<Void>()
{
@Override
public String toString()
{
return "TrxCallableWithTrxName-wrapper[" + trxRunnable + "]";
}
@Override
public Void call(final String localTrxName) throws Exception
{
trxRunnable.run(localTrxName);
return null;
}
@Override
public Void call() throws Exception
{
throw new IllegalStateException("This method shall not be called");
}
@Override
public boolean doCatch(final Throwable e) throws Throwable
{
return trxRunnable.doCatch(e);
}
@Override
public void doFinally()
{
trxRunnable.doFinally();
}
};
}
public static <T> TrxCallable<T> wrapIfNeeded(final Callable<T> callable)
{
if (callable == null)
{
return null;
}
if (callable instanceof TrxCallable)
{
final TrxCallable<T> trxCallable = (TrxCallable<T>)callable;
return trxCallable;
}
return new TrxCallableAdapter<T>()
{
@Override
public String toString()
{
return "TrxCallableWrappers[" + callable + "]";
}
@Override
public T call() throws Exception
{
return callable.call();
}
};
}
public static <T> TrxCallableWithTrxName<T> wrapAsTrxCallableWithTrxNameIfNeeded(final TrxCallable<T> callable)
{
|
if (callable == null)
{
return null;
}
if (callable instanceof TrxCallableWithTrxName)
{
final TrxCallableWithTrxName<T> callableWithTrxName = (TrxCallableWithTrxName<T>)callable;
return callableWithTrxName;
}
return new TrxCallableWithTrxName<T>()
{
@Override
public String toString()
{
return "TrxCallableWithTrxName-wrapper[" + callable + "]";
}
@Override
public T call(final String localTrxName) throws Exception
{
return callable.call();
}
@Override
public T call() throws Exception
{
throw new IllegalStateException("This method shall not be called");
}
@Override
public boolean doCatch(final Throwable e) throws Throwable
{
return callable.doCatch(e);
}
@Override
public void doFinally()
{
callable.doFinally();
}
};
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\trx\api\impl\TrxCallableWrappers.java
| 1
|
请完成以下Java代码
|
public class C_Invoice_Candidate_GenerateInvoice_From_Queue extends JavaProcess
{
@Override
protected void prepare()
{
// nothing to do
}
@Override
protected String doIt() throws Exception
{
final IInvoiceCandBL service = Services.get(IInvoiceCandBL.class);
final Properties ctx = getCtx();
final IInvoiceGenerateResult result = service.generateInvoicesFromQueue(ctx);
final ADHyperlinkBuilder linkHelper = new ADHyperlinkBuilder();
final StringBuilder summary = new StringBuilder("@Generated@")
.append(" @C_Invoice_ID@ #").append(result.getInvoiceCount());
if (result.getNotificationCount() > 0)
|
{
final String notificationsLink = linkHelper.createShowWindowHTML(
"@AD_Note_ID@ #" + result.getNotificationCount(),
I_AD_Note.Table_Name,
-1, // suggested windowID -> use the default one
result.getNotificationsWhereClause());
summary.append(", ").append(notificationsLink);
}
// Output the actual invoices that were created.
// Note that the list will be empty if storing the actual invoices has been switched off to avoid mass-data-memory problems.
final IInvoiceBL invoiceBL = Services.get(IInvoiceBL.class);
for (final I_C_Invoice invoice : result.getC_Invoices())
{
addLog(invoice.getC_Invoice_ID(), null, null, invoiceBL.getSummary(invoice));
}
return summary.toString();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\process\C_Invoice_Candidate_GenerateInvoice_From_Queue.java
| 1
|
请完成以下Java代码
|
public void setPP_MRP_Supply(org.eevolution.model.I_PP_MRP PP_MRP_Supply)
{
set_ValueFromPO(COLUMNNAME_PP_MRP_Supply_ID, org.eevolution.model.I_PP_MRP.class, PP_MRP_Supply);
}
/** Set MRP Supply.
@param PP_MRP_Supply_ID MRP Supply */
@Override
public void setPP_MRP_Supply_ID (int PP_MRP_Supply_ID)
{
if (PP_MRP_Supply_ID < 1)
set_ValueNoCheck (COLUMNNAME_PP_MRP_Supply_ID, null);
else
set_ValueNoCheck (COLUMNNAME_PP_MRP_Supply_ID, Integer.valueOf(PP_MRP_Supply_ID));
}
/** Get MRP Supply.
@return MRP Supply */
@Override
public int getPP_MRP_Supply_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_PP_MRP_Supply_ID);
if (ii == null)
return 0;
|
return ii.intValue();
}
/** Set Zugewiesene Menge.
@param QtyAllocated Zugewiesene Menge */
@Override
public void setQtyAllocated (java.math.BigDecimal QtyAllocated)
{
set_Value (COLUMNNAME_QtyAllocated, QtyAllocated);
}
/** Get Zugewiesene Menge.
@return Zugewiesene Menge */
@Override
public java.math.BigDecimal getQtyAllocated ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyAllocated);
if (bd == null)
return Env.ZERO;
return bd;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_PP_MRP_Alloc.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void setMetadata(Map<String, Object> metadata) {
this.metadata = metadata;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
RouteProperties that = (RouteProperties) o;
return this.order == that.order && Objects.equals(this.id, that.id)
&& Objects.equals(this.predicates, that.predicates) && Objects.equals(this.filters, that.filters)
|
&& Objects.equals(this.uri, that.uri) && Objects.equals(this.metadata, that.metadata);
}
@Override
public int hashCode() {
return Objects.hash(this.id, this.predicates, this.filters, this.uri, this.metadata, this.order);
}
@Override
public String toString() {
return "RouteDefinition{" + "id='" + id + '\'' + ", predicates=" + predicates + ", filters=" + filters
+ ", uri=" + uri + ", order=" + order + ", metadata=" + metadata + '}';
}
}
|
repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webmvc\src\main\java\org\springframework\cloud\gateway\server\mvc\config\RouteProperties.java
| 2
|
请完成以下Java代码
|
public int getWindowNo()
{
if (m_APanel != null)
{
return m_APanel.getWindowNo();
}
return 0;
} // getWindowNo
/**
* String Representation
* @return Name
*/
@Override
public String toString()
|
{
return getName() + "_" + getWindowNo();
} // toString
// metas: begin
public GridWindow getGridWindow()
{
if (m_APanel == null)
{
return null;
}
return m_APanel.getGridWorkbench().getMWindowById(getAdWindowId());
}
// metas: end
} // AWindow
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\apps\AWindow.java
| 1
|
请完成以下Java代码
|
public boolean isTenantIdSet() {
return isTenantIdSet;
}
public String getJobId() {
return jobId;
}
public String getJobExceptionMessage() {
return jobExceptionMessage;
}
public String getJobDefinitionId() {
return jobDefinitionId;
}
public String getJobDefinitionType() {
return jobDefinitionType;
}
public String getJobDefinitionConfiguration() {
return jobDefinitionConfiguration;
}
public String[] getActivityIds() {
return activityIds;
}
public String[] getFailedActivityIds() {
return failedActivityIds;
}
public String[] getExecutionIds() {
return executionIds;
}
|
public String getProcessInstanceId() {
return processInstanceId;
}
public String getProcessDefinitionId() {
return processDefinitionId;
}
public String getProcessDefinitionKey() {
return processDefinitionKey;
}
public String getDeploymentId() {
return deploymentId;
}
public JobState getState() {
return state;
}
public String[] getTenantIds() {
return tenantIds;
}
public String getHostname() {
return hostname;
}
// setter //////////////////////////////////
protected void setState(JobState state) {
this.state = state;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\HistoricJobLogQueryImpl.java
| 1
|
请完成以下Java代码
|
public int getM_Picking_Job_Schedule_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Picking_Job_Schedule_ID);
}
@Override
public void setM_PickingSlot_ID (final int M_PickingSlot_ID)
{
if (M_PickingSlot_ID < 1)
set_Value (COLUMNNAME_M_PickingSlot_ID, null);
else
set_Value (COLUMNNAME_M_PickingSlot_ID, M_PickingSlot_ID);
}
@Override
public int getM_PickingSlot_ID()
{
return get_ValueAsInt(COLUMNNAME_M_PickingSlot_ID);
}
@Override
public void setM_Product_ID (final int M_Product_ID)
{
if (M_Product_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Product_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Product_ID, M_Product_ID);
}
@Override
public int getM_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_ID);
}
@Override
public void setM_ShipmentSchedule_ID (final int M_ShipmentSchedule_ID)
{
if (M_ShipmentSchedule_ID < 1)
set_Value (COLUMNNAME_M_ShipmentSchedule_ID, null);
else
set_Value (COLUMNNAME_M_ShipmentSchedule_ID, M_ShipmentSchedule_ID);
}
@Override
public int getM_ShipmentSchedule_ID()
{
return get_ValueAsInt(COLUMNNAME_M_ShipmentSchedule_ID);
}
@Override
public void setPP_Order_ID (final int PP_Order_ID)
{
if (PP_Order_ID < 1)
set_Value (COLUMNNAME_PP_Order_ID, null);
|
else
set_Value (COLUMNNAME_PP_Order_ID, PP_Order_ID);
}
@Override
public int getPP_Order_ID()
{
return get_ValueAsInt(COLUMNNAME_PP_Order_ID);
}
@Override
public void setProcessed (final boolean Processed)
{
set_Value (COLUMNNAME_Processed, Processed);
}
@Override
public boolean isProcessed()
{
return get_ValueAsBoolean(COLUMNNAME_Processed);
}
@Override
public void setQtyToPick (final BigDecimal QtyToPick)
{
set_Value (COLUMNNAME_QtyToPick, QtyToPick);
}
@Override
public BigDecimal getQtyToPick()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyToPick);
return bd != null ? bd : BigDecimal.ZERO;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java-gen\de\metas\handlingunits\model\X_M_Picking_Job_Line.java
| 1
|
请完成以下Java代码
|
protected boolean isBlank(String s) {
return s == null || s.trim().isEmpty();
}
public enum SameSiteOption {
LAX("Lax"),
STRICT("Strict");
protected final String value;
SameSiteOption(String value) {
this.value = value;
}
|
public String getValue() {
return value;
}
public String getName() {
return this.name();
}
public boolean compareTo(String value) {
return this.value.equalsIgnoreCase(value);
}
}
}
|
repos\camunda-bpm-platform-master\webapps\assembly\src\main\java\org\camunda\bpm\webapp\impl\security\filter\CookieConfigurator.java
| 1
|
请完成以下Java代码
|
public BigDecimal getQtyCount()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyCount);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyCsv (final BigDecimal QtyCsv)
{
set_Value (COLUMNNAME_QtyCsv, QtyCsv);
}
@Override
public BigDecimal getQtyCsv()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyCsv);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyInternalUse (final @Nullable BigDecimal QtyInternalUse)
{
set_Value (COLUMNNAME_QtyInternalUse, QtyInternalUse);
}
@Override
public BigDecimal getQtyInternalUse()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyInternalUse);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setRenderedQRCode (final @Nullable java.lang.String RenderedQRCode)
{
set_Value (COLUMNNAME_RenderedQRCode, RenderedQRCode);
}
@Override
public java.lang.String getRenderedQRCode()
{
return get_ValueAsString(COLUMNNAME_RenderedQRCode);
}
@Override
public org.compiere.model.I_M_InventoryLine getReversalLine()
{
return get_ValueAsPO(COLUMNNAME_ReversalLine_ID, org.compiere.model.I_M_InventoryLine.class);
}
|
@Override
public void setReversalLine(final org.compiere.model.I_M_InventoryLine ReversalLine)
{
set_ValueFromPO(COLUMNNAME_ReversalLine_ID, org.compiere.model.I_M_InventoryLine.class, ReversalLine);
}
@Override
public void setReversalLine_ID (final int ReversalLine_ID)
{
if (ReversalLine_ID < 1)
set_Value (COLUMNNAME_ReversalLine_ID, null);
else
set_Value (COLUMNNAME_ReversalLine_ID, ReversalLine_ID);
}
@Override
public int getReversalLine_ID()
{
return get_ValueAsInt(COLUMNNAME_ReversalLine_ID);
}
@Override
public void setUPC (final @Nullable java.lang.String UPC)
{
throw new IllegalArgumentException ("UPC is virtual column"); }
@Override
public java.lang.String getUPC()
{
return get_ValueAsString(COLUMNNAME_UPC);
}
@Override
public void setValue (final @Nullable java.lang.String Value)
{
throw new IllegalArgumentException ("Value is virtual column"); }
@Override
public java.lang.String getValue()
{
return get_ValueAsString(COLUMNNAME_Value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_InventoryLine.java
| 1
|
请完成以下Java代码
|
private void createAndAddFacts(
@NonNull final CommissionShare commissionShare,
@NonNull final Instant timestamp,
@NonNull final CommissionPoints forecastedBase,
@NonNull final CommissionPoints toInvoiceBase,
@NonNull final CommissionPoints invoicedBase)
{
try (final MDC.MDCCloseable shareMDC = TableRecordMDC.putTableRecordReference(I_C_Commission_Share.Table_Name, commissionShare.getId()))
{
Check.assume(MediatedCommissionConfig.isInstance(commissionShare.getConfig()), "The commission share is always carrying a mediated commission config at this stage!");
final MediatedCommissionConfig mediatedCommissionConfig = MediatedCommissionConfig.cast(commissionShare.getConfig());
try (final MDC.MDCCloseable ignore = TableRecordMDC.putTableRecordReference(I_C_MediatedCommissionSettings.Table_Name, mediatedCommissionConfig.getId()))
{
logger.debug("Create commission shares and facts");
final Function<CommissionPoints, CommissionPoints> computeSalesRepCommissionPoints = (basePoints) ->
basePoints.computePercentageOf(mediatedCommissionConfig.getCommissionPercent(), mediatedCommissionConfig.getPointsPrecision());
|
final CommissionPoints forecastCP = computeSalesRepCommissionPoints.apply(forecastedBase);
final CommissionPoints toInvoiceCP = computeSalesRepCommissionPoints.apply(toInvoiceBase);
final CommissionPoints invoicedCP = computeSalesRepCommissionPoints.apply(invoicedBase);
final Optional<CommissionFact> forecastedFact = CommissionFact.createFact(timestamp, CommissionState.FORECASTED, forecastCP, commissionShare.getForecastedPointsSum());
final Optional<CommissionFact> toInvoiceFact = CommissionFact.createFact(timestamp, CommissionState.INVOICEABLE, toInvoiceCP, commissionShare.getInvoiceablePointsSum());
final Optional<CommissionFact> invoicedFact = CommissionFact.createFact(timestamp, CommissionState.INVOICED, invoicedCP, commissionShare.getInvoicedPointsSum());
forecastedFact.ifPresent(commissionShare::addFact);
toInvoiceFact.ifPresent(commissionShare::addFact);
invoicedFact.ifPresent(commissionShare::addFact);
}
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\commission\mediated\algorithm\MediatedCommissionAlgorithm.java
| 1
|
请完成以下Java代码
|
public void setOrg_Location_ID (int Org_Location_ID)
{
if (Org_Location_ID < 1)
set_ValueNoCheck (COLUMNNAME_Org_Location_ID, null);
else
set_ValueNoCheck (COLUMNNAME_Org_Location_ID, Integer.valueOf(Org_Location_ID));
}
/** Get Org Address.
@return Organization Location/Address
*/
@Override
public int getOrg_Location_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Org_Location_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Telefon.
@param Phone
Beschreibt eine Telefon Nummer
*/
@Override
public void setPhone (java.lang.String Phone)
{
set_ValueNoCheck (COLUMNNAME_Phone, Phone);
}
/** Get Telefon.
@return Beschreibt eine Telefon Nummer
*/
@Override
public java.lang.String getPhone ()
{
return (java.lang.String)get_Value(COLUMNNAME_Phone);
}
/** Set Steuer-ID.
@param TaxID
Tax Identification
*/
|
@Override
public void setTaxID (java.lang.String TaxID)
{
set_ValueNoCheck (COLUMNNAME_TaxID, TaxID);
}
/** Get Steuer-ID.
@return Tax Identification
*/
@Override
public java.lang.String getTaxID ()
{
return (java.lang.String)get_Value(COLUMNNAME_TaxID);
}
/** Set Titel.
@param Title
Name this entity is referred to as
*/
@Override
public void setTitle (java.lang.String Title)
{
set_ValueNoCheck (COLUMNNAME_Title, Title);
}
/** Get Titel.
@return Name this entity is referred to as
*/
@Override
public java.lang.String getTitle ()
{
return (java.lang.String)get_Value(COLUMNNAME_Title);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.rfq\src\main\java-gen\de\metas\rfq\model\X_C_RfQResponse_v.java
| 1
|
请完成以下Java代码
|
public Builder setEmptyFieldText(final ITranslatableString emptyFieldText)
{
this.emptyFieldText = emptyFieldText;
return this;
}
public Builder trackField(final DocumentFieldDescriptor.Builder field)
{
documentFieldBuilder = field;
return this;
}
public boolean isSpecialFieldToExcludeFromLayout()
{
return documentFieldBuilder != null && documentFieldBuilder.isSpecialFieldToExcludeFromLayout();
}
public Builder setDevices(@NonNull final DeviceDescriptorsList devices)
{
this._devices = devices;
return this;
}
private DeviceDescriptorsList getDevices()
{
return _devices;
}
public Builder setSupportZoomInto(final boolean supportZoomInto)
{
this.supportZoomInto = supportZoomInto;
return this;
}
|
private boolean isSupportZoomInto()
{
return supportZoomInto;
}
public Builder setForbidNewRecordCreation(final boolean forbidNewRecordCreation)
{
this.forbidNewRecordCreation = forbidNewRecordCreation;
return this;
}
private boolean isForbidNewRecordCreation()
{
return forbidNewRecordCreation;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\descriptor\DocumentLayoutElementFieldDescriptor.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Object getPersistentState() {
// Entity link is immutable
return EntityLinkEntityImpl.class;
}
@Override
public String getLinkType() {
return linkType;
}
@Override
public void setLinkType(String linkType) {
this.linkType = linkType;
}
@Override
public String getScopeId() {
return this.scopeId;
}
@Override
public void setScopeId(String scopeId) {
this.scopeId = scopeId;
}
@Override
public String getSubScopeId() {
return subScopeId;
}
@Override
public void setSubScopeId(String subScopeId) {
this.subScopeId = subScopeId;
}
@Override
public String getScopeType() {
return this.scopeType;
}
@Override
public void setScopeType(String scopeType) {
this.scopeType = scopeType;
}
@Override
public String getScopeDefinitionId() {
return this.scopeDefinitionId;
}
@Override
public void setScopeDefinitionId(String scopeDefinitionId) {
this.scopeDefinitionId = scopeDefinitionId;
}
@Override
public String getParentElementId() {
return parentElementId;
}
@Override
public void setParentElementId(String parentElementId) {
this.parentElementId = parentElementId;
}
@Override
public String getReferenceScopeId() {
return referenceScopeId;
}
@Override
public void setReferenceScopeId(String referenceScopeId) {
this.referenceScopeId = referenceScopeId;
|
}
@Override
public String getReferenceScopeType() {
return referenceScopeType;
}
@Override
public void setReferenceScopeType(String referenceScopeType) {
this.referenceScopeType = referenceScopeType;
}
@Override
public String getReferenceScopeDefinitionId() {
return referenceScopeDefinitionId;
}
@Override
public void setReferenceScopeDefinitionId(String referenceScopeDefinitionId) {
this.referenceScopeDefinitionId = referenceScopeDefinitionId;
}
@Override
public String getRootScopeId() {
return rootScopeId;
}
@Override
public void setRootScopeId(String rootScopeId) {
this.rootScopeId = rootScopeId;
}
@Override
public String getRootScopeType() {
return rootScopeType;
}
@Override
public void setRootScopeType(String rootScopeType) {
this.rootScopeType = rootScopeType;
}
@Override
public Date getCreateTime() {
return createTime;
}
@Override
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public String getHierarchyType() {
return hierarchyType;
}
@Override
public void setHierarchyType(String hierarchyType) {
this.hierarchyType = hierarchyType;
}
}
|
repos\flowable-engine-main\modules\flowable-entitylink-service\src\main\java\org\flowable\entitylink\service\impl\persistence\entity\EntityLinkEntityImpl.java
| 2
|
请完成以下Java代码
|
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.newPassword = password;
}
public String getSalt() {
return this.salt;
}
public void setSalt(String salt) {
this.salt = salt;
}
/**
* Special setter for MyBatis.
*/
public void setDbPassword(String password) {
this.password = password;
}
public int getRevision() {
return revision;
}
public void setRevision(int revision) {
this.revision = revision;
}
public Date getLockExpirationTime() {
return lockExpirationTime;
}
public void setLockExpirationTime(Date lockExpirationTime) {
this.lockExpirationTime = lockExpirationTime;
}
public int getAttempts() {
return attempts;
}
public void setAttempts(int attempts) {
this.attempts = attempts;
}
public void encryptPassword() {
if (newPassword != null) {
salt = generateSalt();
setDbPassword(encryptPassword(newPassword, salt));
|
}
}
protected String encryptPassword(String password, String salt) {
if (password == null) {
return null;
} else {
String saltedPassword = saltPassword(password, salt);
return Context.getProcessEngineConfiguration()
.getPasswordManager()
.encrypt(saltedPassword);
}
}
protected String generateSalt() {
return Context.getProcessEngineConfiguration()
.getSaltGenerator()
.generateSalt();
}
public boolean checkPasswordAgainstPolicy() {
PasswordPolicyResult result = Context.getProcessEngineConfiguration()
.getIdentityService()
.checkPasswordAgainstPolicy(newPassword, this);
return result.isValid();
}
public boolean hasNewPassword() {
return newPassword != null;
}
public String toString() {
return this.getClass().getSimpleName()
+ "[id=" + id
+ ", revision=" + revision
+ ", firstName=" + firstName
+ ", lastName=" + lastName
+ ", email=" + email
+ ", password=******" // sensitive for logging
+ ", salt=******" // sensitive for logging
+ ", lockExpirationTime=" + lockExpirationTime
+ ", attempts=" + attempts
+ "]";
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\UserEntity.java
| 1
|
请完成以下Java代码
|
public void setEmail(String email) {
this.email = email;
}
public ReviewStatus getStatus() {
return status;
}
public void setStatus(ReviewStatus status) {
this.status = status;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
|
if (this == obj) {
return true;
}
if (!(obj instanceof BookReview)) {
return false;
}
return id != null && id.equals(((BookReview) obj).id);
}
@Override
public int hashCode() {
return 2021;
}
}
|
repos\Hibernate-SpringBoot-master\HibernateSpringBootDomainEvents\src\main\java\com\bookstore\entity\BookReview.java
| 1
|
请完成以下Java代码
|
public int getUserElement1_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_UserElement1_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Nutzer-Element 2.
@param UserElement2_ID
User defined accounting Element
*/
@Override
public void setUserElement2_ID (int UserElement2_ID)
{
if (UserElement2_ID < 1)
set_Value (COLUMNNAME_UserElement2_ID, null);
else
set_Value (COLUMNNAME_UserElement2_ID, Integer.valueOf(UserElement2_ID));
}
/** Get Nutzer-Element 2.
@return User defined accounting Element
*/
@Override
public int getUserElement2_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_UserElement2_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public void setUserElementString1 (final @Nullable java.lang.String UserElementString1)
{
set_Value (COLUMNNAME_UserElementString1, UserElementString1);
}
@Override
public java.lang.String getUserElementString1()
{
return get_ValueAsString(COLUMNNAME_UserElementString1);
}
@Override
public void setUserElementString2 (final @Nullable java.lang.String UserElementString2)
{
set_Value (COLUMNNAME_UserElementString2, UserElementString2);
}
@Override
public java.lang.String getUserElementString2()
{
return get_ValueAsString(COLUMNNAME_UserElementString2);
}
@Override
public void setUserElementString3 (final @Nullable java.lang.String UserElementString3)
{
set_Value (COLUMNNAME_UserElementString3, UserElementString3);
}
@Override
public java.lang.String getUserElementString3()
{
return get_ValueAsString(COLUMNNAME_UserElementString3);
}
@Override
public void setUserElementString4 (final @Nullable java.lang.String UserElementString4)
|
{
set_Value (COLUMNNAME_UserElementString4, UserElementString4);
}
@Override
public java.lang.String getUserElementString4()
{
return get_ValueAsString(COLUMNNAME_UserElementString4);
}
@Override
public void setUserElementString5 (final @Nullable java.lang.String UserElementString5)
{
set_Value (COLUMNNAME_UserElementString5, UserElementString5);
}
@Override
public java.lang.String getUserElementString5()
{
return get_ValueAsString(COLUMNNAME_UserElementString5);
}
@Override
public void setUserElementString6 (final @Nullable java.lang.String UserElementString6)
{
set_Value (COLUMNNAME_UserElementString6, UserElementString6);
}
@Override
public java.lang.String getUserElementString6()
{
return get_ValueAsString(COLUMNNAME_UserElementString6);
}
@Override
public void setUserElementString7 (final @Nullable java.lang.String UserElementString7)
{
set_Value (COLUMNNAME_UserElementString7, UserElementString7);
}
@Override
public java.lang.String getUserElementString7()
{
return get_ValueAsString(COLUMNNAME_UserElementString7);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_ValidCombination.java
| 1
|
请完成以下Java代码
|
public class EdgeEventController extends BaseController {
@Autowired
private EdgeEventService edgeEventService;
public static final String EDGE_ID = "edgeId";
@ApiOperation(value = "Get Edge Events (getEdgeEvents)",
notes = "Returns a page of edge events for the requested edge. " +
PAGE_DATA_PARAMETERS)
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
@GetMapping(value = "/edge/{edgeId}/events")
public PageData<EdgeEvent> getEdgeEvents(
@Parameter(description = EDGE_ID_PARAM_DESCRIPTION, required = true)
@PathVariable(EDGE_ID) String strEdgeId,
@Parameter(description = PAGE_SIZE_DESCRIPTION, required = true)
@RequestParam int pageSize,
@Parameter(description = PAGE_NUMBER_DESCRIPTION, required = true)
@RequestParam int page,
@Parameter(description = "The case insensitive 'substring' filter based on the edge event type name.")
@RequestParam(required = false) String textSearch,
|
@Parameter(description = SORT_PROPERTY_DESCRIPTION, schema = @Schema(allowableValues = {"createdTime", "name", "type", "label", "customerTitle"}))
@RequestParam(required = false) String sortProperty,
@Parameter(description = SORT_ORDER_DESCRIPTION, schema = @Schema(allowableValues = {"ASC", "DESC"}))
@RequestParam(required = false) String sortOrder,
@Parameter(description = "Timestamp. Edge events with creation time before it won't be queried")
@RequestParam(required = false) Long startTime,
@Parameter(description = "Timestamp. Edge events with creation time after it won't be queried")
@RequestParam(required = false) Long endTime) throws ThingsboardException {
checkParameter(EDGE_ID, strEdgeId);
TenantId tenantId = getCurrentUser().getTenantId();
EdgeId edgeId = new EdgeId(toUUID(strEdgeId));
checkEdgeId(edgeId, Operation.READ);
TimePageLink pageLink = createTimePageLink(pageSize, page, textSearch, sortProperty, sortOrder, startTime, endTime);
return checkNotNull(edgeEventService.findEdgeEvents(tenantId, edgeId, 0L, null, pageLink));
}
}
|
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\controller\EdgeEventController.java
| 1
|
请完成以下Java代码
|
public static SimpleItem create(String param[])
{
if (param.length % 2 == 1) return null;
SimpleItem item = new SimpleItem();
int natureCount = (param.length) / 2;
for (int i = 0; i < natureCount; ++i)
{
item.labelMap.put(param[2 * i], Integer.parseInt(param[1 + 2 * i]));
}
return item;
}
/**
* 合并两个条目,两者的标签map会合并
* @param other
*/
public void combine(SimpleItem other)
{
for (Map.Entry<String, Integer> entry : other.labelMap.entrySet())
{
addLabel(entry.getKey(), entry.getValue());
}
}
/**
* 获取全部频次
* @return
*/
|
public int getTotalFrequency()
{
int frequency = 0;
for (Integer f : labelMap.values())
{
frequency += f;
}
return frequency;
}
public String getMostLikelyLabel()
{
return labelMap.entrySet().iterator().next().getKey();
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\corpus\dictionary\item\SimpleItem.java
| 1
|
请完成以下Java代码
|
public void setLocalCorrelationKeys(Map<String, VariableValueDto> localCorrelationKeys) {
this.localCorrelationKeys = localCorrelationKeys;
}
public Map<String, VariableValueDto> getProcessVariables() {
return processVariables;
}
public void setProcessVariables(Map<String, VariableValueDto> processVariables) {
this.processVariables = processVariables;
}
public Map<String, VariableValueDto> getProcessVariablesLocal() {
return processVariablesLocal;
}
public void setProcessVariablesLocal(Map<String, VariableValueDto> processVariablesLocal) {
this.processVariablesLocal = processVariablesLocal;
}
public Map<String, VariableValueDto> getProcessVariablesToTriggeredScope() {
return processVariablesToTriggeredScope;
}
public void setProcessVariablesToTriggeredScope(Map<String, VariableValueDto> processVariablesToTriggeredScope) {
this.processVariablesToTriggeredScope = processVariablesToTriggeredScope;
}
public boolean isAll() {
return all;
}
public void setAll(boolean all) {
this.all = all;
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public boolean isWithoutTenantId() {
return withoutTenantId;
}
public void setWithoutTenantId(boolean withoutTenantId) {
this.withoutTenantId = withoutTenantId;
|
}
public String getProcessInstanceId() {
return processInstanceId;
}
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
public boolean isResultEnabled() {
return resultEnabled;
}
public void setResultEnabled(boolean resultEnabled) {
this.resultEnabled = resultEnabled;
}
public boolean isVariablesInResultEnabled() {
return variablesInResultEnabled;
}
public void setVariablesInResultEnabled(boolean variablesInResultEnabled) {
this.variablesInResultEnabled = variablesInResultEnabled;
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\message\CorrelationMessageDto.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class CreateProductRequest
{
@NonNull
OrgId orgId;
@Nullable
String productValue;
@NonNull
String productName;
@NonNull
ProductCategoryId productCategoryId;
@NonNull
String productType;
@NonNull
UomId uomId;
boolean purchased;
boolean sold;
@Nullable
Boolean bomVerified;
@Nullable
ProductPlanningSchemaSelector planningSchemaSelector;
@Nullable
String ean;
@Nullable
|
String gtin;
@Nullable
String description;
@Nullable
Boolean discontinued;
@Nullable
LocalDate discontinuedFrom;
@Nullable
Boolean active;
@Nullable
Boolean stocked;
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\product\CreateProductRequest.java
| 2
|
请完成以下Java代码
|
public void setAD_Product_Category_BoilerPlate_ID (final int AD_Product_Category_BoilerPlate_ID)
{
if (AD_Product_Category_BoilerPlate_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_Product_Category_BoilerPlate_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_Product_Category_BoilerPlate_ID, AD_Product_Category_BoilerPlate_ID);
}
@Override
public int getAD_Product_Category_BoilerPlate_ID()
{
return get_ValueAsInt(COLUMNNAME_AD_Product_Category_BoilerPlate_ID);
}
@Override
public void setM_Product_Category_ID (final int M_Product_Category_ID)
{
if (M_Product_Category_ID < 1)
set_Value (COLUMNNAME_M_Product_Category_ID, null);
else
set_Value (COLUMNNAME_M_Product_Category_ID, M_Product_Category_ID);
}
|
@Override
public int getM_Product_Category_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_Category_ID);
}
@Override
public void setSeqNo (final int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, SeqNo);
}
@Override
public int getSeqNo()
{
return get_ValueAsInt(COLUMNNAME_SeqNo);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Product_Category_BoilerPlate.java
| 1
|
请完成以下Java代码
|
public Boolean isUnlimited() {
return isUnlimited;
}
public void setUnlimited(Boolean isUnlimited) {
this.isUnlimited = isUnlimited;
}
public Map<String, String> getFeatures() {
return features;
}
public void setFeatures(Map<String, String> features) {
this.features = features;
}
public String getRaw() {
return raw;
}
|
public void setRaw(String raw) {
this.raw = raw;
}
public static LicenseKeyDataDto fromEngineDto(LicenseKeyData other) {
return new LicenseKeyDataDto(
other.getCustomer(),
other.getType(),
other.getValidUntil(),
other.isUnlimited(),
other.getFeatures(),
other.getRaw());
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\telemetry\LicenseKeyDataDto.java
| 1
|
请完成以下Java代码
|
private OAuth2Error readErrorFromWwwAuthenticate(HttpHeaders headers) {
String wwwAuthenticateHeader = headers.getFirst(HttpHeaders.WWW_AUTHENTICATE);
if (!StringUtils.hasText(wwwAuthenticateHeader)) {
return null;
}
BearerTokenError bearerTokenError = getBearerToken(wwwAuthenticateHeader);
if (bearerTokenError == null) {
return new OAuth2Error(OAuth2ErrorCodes.SERVER_ERROR, null, null);
}
String errorCode = (bearerTokenError.getCode() != null) ? bearerTokenError.getCode()
: OAuth2ErrorCodes.SERVER_ERROR;
String errorDescription = bearerTokenError.getDescription();
String errorUri = (bearerTokenError.getURI() != null) ? bearerTokenError.getURI().toString() : null;
return new OAuth2Error(errorCode, errorDescription, errorUri);
}
private BearerTokenError getBearerToken(String wwwAuthenticateHeader) {
try {
return BearerTokenError.parse(wwwAuthenticateHeader);
}
catch (Exception ex) {
return null;
|
}
}
/**
* Sets the {@link HttpMessageConverter} for an OAuth 2.0 Error.
* @param oauth2ErrorConverter A {@link HttpMessageConverter} for an
* {@link OAuth2Error OAuth 2.0 Error}.
* @since 5.7
*/
public final void setErrorConverter(HttpMessageConverter<OAuth2Error> oauth2ErrorConverter) {
Assert.notNull(oauth2ErrorConverter, "oauth2ErrorConverter cannot be null");
this.oauth2ErrorConverter = oauth2ErrorConverter;
}
}
|
repos\spring-security-main\oauth2\oauth2-client\src\main\java\org\springframework\security\oauth2\client\http\OAuth2ErrorResponseErrorHandler.java
| 1
|
请完成以下Java代码
|
protected String composeMapKey(String attributeUri, String attributeName) {
StringBuilder strb = new StringBuilder();
if (attributeUri != null && !attributeUri.equals("")) {
strb.append(attributeUri);
strb.append(":");
}
strb.append(attributeName);
return strb.toString();
}
public List<Element> elements() {
return elements;
}
public String toString() {
return "<"+tagName+"...";
}
public String getUri() {
return uri;
}
public String getTagName() {
return tagName;
}
public int getLine() {
return line;
}
public int getColumn() {
return column;
}
/**
* Due to the nature of SAX parsing, sometimes the characters of an element
* are not processed at once. So instead of a setText operation, we need
* to have an appendText operation.
*/
public void appendText(String text) {
|
this.text.append(text);
}
public String getText() {
return text.toString();
}
/**
* allows to recursively collect the ids of all elements in the tree.
*/
public void collectIds(List<String> ids) {
ids.add(attribute("id"));
for (Element child : elements) {
child.collectIds(ids);
}
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\util\xml\Element.java
| 1
|
请完成以下Spring Boot application配置
|
spring:
application:
name: Zuul-Gateway
server:
port: 12580
eureka:
client:
serviceUrl:
defaultZone: http://mrbird:123456@peer1:8080/eureka/,http://mrbird:123456@peer2:8081/eureka/
zuul:
routes:
api-a:
path: /api-a/**
url: http://localhost:8082
api-b:
path: /api-b/**
serviceId: server-provider
api-c:
path: /api-c/**
serviceId: server-consumer
api-d:
|
path: /api-c/user/1
serviceId: lol
api-e:
path: /api-e/**
url: forward:/test
ignored-services: server-consumer
sensitive-headers:
add-host-header: true
|
repos\SpringAll-master\39.Spring-Cloud-Zuul-Router\Zuul-Gateway\src\main\resources\application.yml
| 2
|
请完成以下Java代码
|
public String getJobHandlerType() {
return jobHandlerType;
}
public void setJobHandlerType(String jobHandlerType) {
this.jobHandlerType = jobHandlerType;
}
public String getJobHandlerConfiguration() {
return jobHandlerConfiguration;
}
public void setJobHandlerConfiguration(String jobHandlerConfiguration) {
this.jobHandlerConfiguration = jobHandlerConfiguration;
}
public String getJobType() {
return jobType;
}
public void setJobType(String jobType) {
this.jobType = jobType;
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public String getExceptionStacktrace() {
if (exceptionByteArrayRef == null) {
return null;
}
byte[] bytes = exceptionByteArrayRef.getBytes();
if (bytes == null) {
return null;
}
try {
return new String(bytes, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new ActivitiException("UTF-8 is not a supported encoding");
}
|
}
public void setExceptionStacktrace(String exception) {
if (exceptionByteArrayRef == null) {
exceptionByteArrayRef = new ByteArrayRef();
}
exceptionByteArrayRef.setValue("stacktrace", getUtf8Bytes(exception));
}
public String getExceptionMessage() {
return exceptionMessage;
}
public void setExceptionMessage(String exceptionMessage) {
this.exceptionMessage = StringUtils.abbreviate(exceptionMessage, MAX_EXCEPTION_MESSAGE_LENGTH);
}
public ByteArrayRef getExceptionByteArrayRef() {
return exceptionByteArrayRef;
}
protected byte[] getUtf8Bytes(String str) {
if (str == null) {
return null;
}
try {
return str.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
throw new ActivitiException("UTF-8 is not a supported encoding");
}
}
@Override
public String toString() {
return getClass().getName() + " [id=" + id + "]";
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\persistence\entity\AbstractJobEntityImpl.java
| 1
|
请完成以下Java代码
|
public int getEndNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_EndNo);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Name.
@param Name Name */
@Override
public void setName (java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Name */
@Override
public java.lang.String getName ()
{
return (java.lang.String)get_Value(COLUMNNAME_Name);
}
/** Set Skript.
@param Script
Dynamic Java Language Script to calculate result
*/
@Override
public void setScript (java.lang.String Script)
{
set_Value (COLUMNNAME_Script, Script);
}
/** Get Skript.
@return Dynamic Java Language Script to calculate result
*/
@Override
public java.lang.String getScript ()
{
return (java.lang.String)get_Value(COLUMNNAME_Script);
}
/** Set Reihenfolge.
@param SeqNo
Method of ordering records; lowest number comes first
*/
@Override
public void setSeqNo (int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo));
}
/** Get Reihenfolge.
@return Method of ordering records; lowest number comes first
*/
|
@Override
public int getSeqNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Start No.
@param StartNo
Starting number/position
*/
@Override
public void setStartNo (int StartNo)
{
set_Value (COLUMNNAME_StartNo, Integer.valueOf(StartNo));
}
/** Get Start No.
@return Starting number/position
*/
@Override
public int getStartNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_StartNo);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_ImpFormat_Row.java
| 1
|
请完成以下Java代码
|
public String getSymbol() {
return symbol;
}
public Quote symbol(String symbol) {
this.symbol = symbol;
return this;
}
public void setSymbol(String symbol) {
this.symbol = symbol;
}
public BigDecimal getPrice() {
return price;
}
public Quote price(BigDecimal price) {
this.price = price;
return this;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public ZonedDateTime getLastTrade() {
return lastTrade;
}
public Quote lastTrade(ZonedDateTime lastTrade) {
this.lastTrade = lastTrade;
return this;
}
public void setLastTrade(ZonedDateTime lastTrade) {
|
this.lastTrade = lastTrade;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Quote quote = (Quote) o;
if (quote.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), quote.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "Quote{" +
"id=" + getId() +
", symbol='" + getSymbol() + "'" +
", price=" + getPrice() +
", lastTrade='" + getLastTrade() + "'" +
"}";
}
}
|
repos\tutorials-master\jhipster-modules\jhipster-uaa\quotes\src\main\java\com\baeldung\jhipster\quotes\domain\Quote.java
| 1
|
请完成以下Java代码
|
public RateLimitConfig setKeyResolver(Function<ServerRequest, String> keyResolver) {
Objects.requireNonNull(keyResolver, "keyResolver may not be null");
this.keyResolver = keyResolver;
return this;
}
public HttpStatusCode getStatusCode() {
return statusCode;
}
public RateLimitConfig setStatusCode(HttpStatusCode statusCode) {
this.statusCode = statusCode;
return this;
}
public @Nullable Duration getTimeout() {
return timeout;
}
public RateLimitConfig setTimeout(Duration timeout) {
this.timeout = timeout;
return this;
}
public int getTokens() {
return tokens;
}
|
public RateLimitConfig setTokens(int tokens) {
Assert.isTrue(tokens > 0, "tokens must be greater than zero");
this.tokens = tokens;
return this;
}
public String getHeaderName() {
return headerName;
}
public RateLimitConfig setHeaderName(String headerName) {
Objects.requireNonNull(headerName, "headerName may not be null");
this.headerName = headerName;
return this;
}
}
public static class FilterSupplier extends SimpleFilterSupplier {
public FilterSupplier() {
super(Bucket4jFilterFunctions.class);
}
}
}
|
repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webmvc\src\main\java\org\springframework\cloud\gateway\server\mvc\filter\Bucket4jFilterFunctions.java
| 1
|
请完成以下Java代码
|
public DigestMethodType getDigestMethod() {
return digestMethod;
}
/**
* Sets the value of the digestMethod property.
*
* @param value
* allowed object is
* {@link DigestMethodType }
*
*/
public void setDigestMethod(DigestMethodType value) {
this.digestMethod = value;
}
/**
* Gets the value of the digestValue property.
*
* @return
* possible object is
* byte[]
*/
public byte[] getDigestValue() {
return digestValue;
}
/**
* Sets the value of the digestValue property.
*
* @param value
* allowed object is
* byte[]
*/
public void setDigestValue(byte[] value) {
this.digestValue = value;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
|
public void setId(String value) {
this.id = value;
}
/**
* Gets the value of the uri property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getURI() {
return uri;
}
/**
* Sets the value of the uri property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setURI(String value) {
this.uri = value;
}
/**
* Gets the value of the type property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getType() {
return type;
}
/**
* Sets the value of the type property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setType(String value) {
this.type = 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\ReferenceType2.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getAgreementNumber() {
return agreementNumber;
}
/**
* Sets the value of the agreementNumber property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAgreementNumber(String value) {
this.agreementNumber = value;
}
/**
* Gets the value of the timeForPayment property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getTimeForPayment() {
return timeForPayment;
}
/**
* Sets the value of the timeForPayment property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setTimeForPayment(BigInteger value) {
this.timeForPayment = value;
}
/**
|
* Consignment reference.
*
* @return
* possible object is
* {@link String }
*
*/
public String getConsignmentReference() {
return consignmentReference;
}
/**
* Sets the value of the consignmentReference property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setConsignmentReference(String value) {
this.consignmentReference = value;
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\extensions\edifact\RECADVExtensionType.java
| 2
|
请完成以下Java代码
|
public int getRecord_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Record_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_R_RequestType getR_RequestType() throws RuntimeException
{
return (I_R_RequestType)MTable.get(getCtx(), I_R_RequestType.Table_Name)
.getPO(getR_RequestType_ID(), get_TrxName()); }
/** Set Request Type.
@param R_RequestType_ID
Type of request (e.g. Inquiry, Complaint, ..)
*/
public void setR_RequestType_ID (int R_RequestType_ID)
{
if (R_RequestType_ID < 1)
set_ValueNoCheck (COLUMNNAME_R_RequestType_ID, null);
else
set_ValueNoCheck (COLUMNNAME_R_RequestType_ID, Integer.valueOf(R_RequestType_ID));
}
/** Get Request Type.
@return Type of request (e.g. Inquiry, Complaint, ..)
*/
public int getR_RequestType_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_R_RequestType_ID);
if (ii == null)
return 0;
|
return ii.intValue();
}
/** Set Source Updated.
@param SourceUpdated
Date the source document was updated
*/
public void setSourceUpdated (Timestamp SourceUpdated)
{
set_Value (COLUMNNAME_SourceUpdated, SourceUpdated);
}
/** Get Source Updated.
@return Date the source document was updated
*/
public Timestamp getSourceUpdated ()
{
return (Timestamp)get_Value(COLUMNNAME_SourceUpdated);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_K_Index.java
| 1
|
请完成以下Java代码
|
public String toString()
{
return "MPeriod[" + get_ID()
+ "-" + getName()
+ ", " + getStartDate() + "-" + getEndDate()
+ "]";
} // toString
/**
* Convenient method for testing if a period is open
* @deprecated
*/
@Deprecated
public static void testPeriodOpen(final Properties ctx, final Timestamp dateAcct, final DocBaseType docBaseType)
throws PeriodClosedException
{
if (!MPeriod.isOpen(ctx, dateAcct, docBaseType)) {
throw new PeriodClosedException(dateAcct, docBaseType);
}
}
/**
* Convenient method for testing if a period is open
*/
public static void testPeriodOpen(final Properties ctx, final Timestamp dateAcct, final DocBaseType docBaseType, final int AD_Org_ID)
throws PeriodClosedException
{
if (!MPeriod.isOpen(ctx, dateAcct, docBaseType, AD_Org_ID)) {
throw new PeriodClosedException(dateAcct, docBaseType);
}
}
/**
* Convenient method for testing if a period is open
* @deprecated
*/
@Deprecated
public static void testPeriodOpen(final Properties ctx, final Timestamp dateAcct, final int C_DocType_ID)
throws PeriodClosedException
{
final MDocType dt = MDocType.get(ctx, C_DocType_ID);
testPeriodOpen(ctx, dateAcct, DocBaseType.ofCode(dt.getDocBaseType()));
}
/**
* Convenient method for testing if a period is open
*/
public static void testPeriodOpen(Properties ctx, Timestamp dateAcct, int C_DocType_ID, int AD_Org_ID)
throws PeriodClosedException
{
MDocType dt = MDocType.get(ctx, C_DocType_ID);
testPeriodOpen(ctx, dateAcct, DocBaseType.ofCode(dt.getDocBaseType()), AD_Org_ID);
}
/**
* Get Calendar of Period
* @return calendar
*/
public int getC_Calendar_ID()
{
if (m_C_Calendar_ID == 0)
{
MYear year = (MYear) getC_Year();
|
if (year != null)
{
m_C_Calendar_ID = year.getC_Calendar_ID();
}
else
{
log.error("@NotFound@ C_Year_ID=" + getC_Year_ID());
}
}
return m_C_Calendar_ID;
} // getC_Calendar_ID
/**
* Get Calendar for Organization
* @param ctx Context
* @param orgRepoId Organization
*/
public static int getC_Calendar_ID(final Properties ctx, final int orgRepoId)
{
int C_Calendar_ID = 0;
final OrgId orgId = OrgId.ofRepoIdOrAny(orgRepoId);
if (orgId.isRegular())
{
OrgInfo info = Services.get(IOrgDAO.class).getOrgInfoById(orgId);
C_Calendar_ID = CalendarId.toRepoId(info.getCalendarId());
}
if (C_Calendar_ID <= 0)
{
I_AD_ClientInfo cInfo = Services.get(IClientDAO.class).retrieveClientInfo(ctx);
C_Calendar_ID = cInfo.getC_Calendar_ID();
}
return C_Calendar_ID;
} // getC_Calendar_ID
} // MPeriod
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MPeriod.java
| 1
|
请完成以下Java代码
|
public class MD_Cockpit_DocumentDetail_Display extends MaterialCockpitViewBasedProcess
{
@Override
protected ProcessPreconditionsResolution checkPreconditionsApplicable()
{
if (getSelectedRowIds().isEmpty())
{
return ProcessPreconditionsResolution.rejectWithInternalReason("No MaterialCockpitrows are selected");
}
final Set<Integer> cockpitRowIds = getSelectedCockpitRecordIdsRecursively();
if (cockpitRowIds.isEmpty())
{
return ProcessPreconditionsResolution.rejectWithInternalReason("The selected rows are just dummys with all-zero");
}
return ProcessPreconditionsResolution.accept();
}
@Override
protected String doIt()
{
final Set<Integer> cockpitRowIds = getSelectedCockpitRecordIdsRecursively();
final List<TableRecordReference> cockpitDetailRecords = retrieveCockpitDetailRecordReferences(cockpitRowIds);
getResult().setRecordsToOpen(cockpitDetailRecords, MaterialCockpitUtil.WINDOWID_MaterialCockpit_Detail_String);
|
return MSG_OK;
}
private List<TableRecordReference> retrieveCockpitDetailRecordReferences(final Set<Integer> cockpitRowIds)
{
Check.assumeNotEmpty(cockpitRowIds, "cockpitRowIds is not empty");
return Services.get(IQueryBL.class)
.createQueryBuilder(I_MD_Cockpit_DocumentDetail.class)
.addOnlyActiveRecordsFilter()
.addInArrayFilter(I_MD_Cockpit_DocumentDetail.COLUMN_MD_Cockpit_ID, cockpitRowIds)
.create()
.listIds()
.stream()
.map(cockpitDetailRecordId -> TableRecordReference.of(I_MD_Cockpit_DocumentDetail.Table_Name, cockpitDetailRecordId))
.collect(ImmutableList.toImmutableList());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\material\cockpit\process\MD_Cockpit_DocumentDetail_Display.java
| 1
|
请完成以下Java代码
|
public Cookie getCookie() {
return this.cookie;
}
public SessionStoreDirectory getSessionStoreDirectory() {
return this.sessionStoreDirectory;
}
/**
* Available session tracking modes (mirrors
* {@link jakarta.servlet.SessionTrackingMode}).
*/
public enum SessionTrackingMode {
/**
* Send a cookie in response to the client's first request.
*/
|
COOKIE,
/**
* Rewrite the URL to append a session ID.
*/
URL,
/**
* Use SSL build-in mechanism to track the session.
*/
SSL
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-web-server\src\main\java\org\springframework\boot\web\server\servlet\Session.java
| 1
|
请完成以下Java代码
|
public class ExecutorRouteLFU extends ExecutorRouter {
private static ConcurrentMap<Integer, HashMap<String, Integer>> jobLfuMap = new ConcurrentHashMap<Integer, HashMap<String, Integer>>();
private static long CACHE_VALID_TIME = 0;
public String route(int jobId, List<String> addressList) {
// cache clear
if (System.currentTimeMillis() > CACHE_VALID_TIME) {
jobLfuMap.clear();
CACHE_VALID_TIME = System.currentTimeMillis() + 1000*60*60*24;
}
// lfu item init
HashMap<String, Integer> lfuItemMap = jobLfuMap.get(jobId); // Key排序可以用TreeMap+构造入参Compare;Value排序暂时只能通过ArrayList;
if (lfuItemMap == null) {
lfuItemMap = new HashMap<String, Integer>();
jobLfuMap.putIfAbsent(jobId, lfuItemMap); // 避免重复覆盖
}
// put new
for (String address: addressList) {
if (!lfuItemMap.containsKey(address) || lfuItemMap.get(address) >1000000 ) {
lfuItemMap.put(address, new Random().nextInt(addressList.size())); // 初始化时主动Random一次,缓解首次压力
}
}
// remove old
List<String> delKeys = new ArrayList<>();
for (String existKey: lfuItemMap.keySet()) {
if (!addressList.contains(existKey)) {
delKeys.add(existKey);
}
}
if (delKeys.size() > 0) {
for (String delKey: delKeys) {
lfuItemMap.remove(delKey);
}
}
|
// load least userd count address
List<Map.Entry<String, Integer>> lfuItemList = new ArrayList<Map.Entry<String, Integer>>(lfuItemMap.entrySet());
Collections.sort(lfuItemList, new Comparator<Map.Entry<String, Integer>>() {
@Override
public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
return o1.getValue().compareTo(o2.getValue());
}
});
Map.Entry<String, Integer> addressItem = lfuItemList.get(0);
String minAddress = addressItem.getKey();
addressItem.setValue(addressItem.getValue() + 1);
return addressItem.getKey();
}
@Override
public ReturnT<String> route(TriggerParam triggerParam, List<String> addressList) {
String address = route(triggerParam.getJobId(), addressList);
return new ReturnT<String>(address);
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-server-cloud\jeecg-visual\jeecg-cloud-xxljob\src\main\java\com\xxl\job\admin\core\route\strategy\ExecutorRouteLFU.java
| 1
|
请完成以下Java代码
|
public class InitStageInstanceOperation extends AbstractPlanItemInstanceOperation {
public InitStageInstanceOperation(CommandContext commandContext, PlanItemInstanceEntity planItemInstanceEntity) {
super(commandContext, planItemInstanceEntity);
}
@Override
public void run() {
Stage stage = getStage(planItemInstanceEntity);
String oldState = planItemInstanceEntity.getState();
String newState = PlanItemInstanceState.ACTIVE;
planItemInstanceEntity.setState(newState);
CommandContextUtil.getCmmnEngineConfiguration(commandContext).getListenerNotificationHelper()
.executeLifecycleListeners(commandContext, planItemInstanceEntity, oldState, newState);
planItemInstanceEntity.setStage(true);
// create case stage started event
FlowableEventDispatcher eventDispatcher = CommandContextUtil.getCmmnEngineConfiguration(commandContext).getEventDispatcher();
if (eventDispatcher != null && eventDispatcher.isEnabled()) {
eventDispatcher.dispatchEvent(FlowableCmmnEventBuilder.createStageStartedEvent(getCaseInstance(), planItemInstanceEntity),
EngineConfigurationConstants.KEY_CMMN_ENGINE_CONFIG);
}
Case caseModel = CaseDefinitionUtil.getCase(planItemInstanceEntity.getCaseDefinitionId());
CaseInstanceEntity caseInstanceEntity = CommandContextUtil.getCmmnEngineConfiguration(commandContext).getCaseInstanceEntityManager()
.findById(planItemInstanceEntity.getCaseInstanceId());
|
createPlanItemInstancesForNewOrReactivatedStage(commandContext, caseModel,
stage.getPlanItems(), null,
caseInstanceEntity,
planItemInstanceEntity,
planItemInstanceEntity.getTenantId());
planItemInstanceEntity.setLastStartedTime(getCurrentTime(commandContext));
CommandContextUtil.getCmmnHistoryManager(commandContext).recordPlanItemInstanceStarted(planItemInstanceEntity);
}
@Override
public String toString() {
return "[Init Stage] Using plan item " + planItemInstanceEntity.getName() + " (" + planItemInstanceEntity.getId() + ")";
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\agenda\operation\InitStageInstanceOperation.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class ApplicationTest {
@Autowired
private UserService userService;
@Test
public void test() throws Exception {
// User user = new User();
// user.setId(userService.getSequence("seq_user"));
// user.setUsername("scott");
// user.setPasswd("ac089b11709f9b9e9980e7c497268dfa");
// user.setCreateTime(new Date());
// user.setStatus("0");
// this.userService.save(user);
// Example example = new Example(User.class);
// example.createCriteria().andCondition("username like '%i%'");
// example.setOrderByClause("id desc");
// List<User> userList = this.userService.selectByExample(example);
// for (User u : userList) {
// System.out.println(u.getUsername());
// }
//
// List<User> all = this.userService.selectAll();
// for (User u : all) {
// System.out.println(u.getUsername());
// }
//
// User user = new User();
|
// user.setId(1l);
// user = this.userService.selectByKey(user);
// System.out.println(user.getUsername());
//
// user.setId(4l);
// this.userService.delete(user);
PageHelper.startPage(2, 2);
List<User> list = userService.selectAll();
PageInfo<User> pageInfo = new PageInfo<User>(list);
List<User> result = pageInfo.getList();
for (User u : result) {
System.out.println(u.getUsername());
}
}
}
|
repos\SpringAll-master\27.Spring-Boot-Mapper-PageHelper\src\main\java\com\springboot\ApplicationTest.java
| 2
|
请完成以下Java代码
|
private void start(WFNodeComponent node)
{
log.debug("Node=" + node);
final String adLanguage = Env.getADLanguageOrBaseLanguage();
WorkflowNodeModel model = node.getModel();
// Info Text
StringBuffer msg = new StringBuffer("<HTML>");
msg.append("<H2>").append(model.getName().translate(adLanguage)).append("</H2>");
String s = model.getDescription().translate(adLanguage);
if (s != null && s.length() > 0)
{
msg.append("<B>").append(s).append("</B>");
}
s = model.getHelp().translate(adLanguage);
if (s != null && s.length() > 0)
{
msg.append("<BR>").append(s);
}
msg.append("</HTML>");
infoTextPane.setText(msg.toString());
infoTextPane.setCaretPosition(0);
wfStartNode.setEnabled(true);
m_activeNode = node;
} // start
private void resetLayout()
{
Point p0 = new Point(0, 0);
for (int i = 0; i < centerPanel.getComponentCount(); i++)
{
Component comp = centerPanel.getComponent(i);
comp.setLocation(p0);
}
centerPanel.validate();
} // resetLayout
/**
* Zoom to WorkFlow
*/
private void zoom()
{
if (m_WF_Window_ID == null)
|
{
m_WF_Window_ID = Services.get(IADTableDAO.class).retrieveWindowId(I_AD_Workflow.Table_Name).orElse(null);
}
if (m_WF_Window_ID == null)
{
throw new AdempiereException("@NotFound@ @AD_Window_ID@");
}
MQuery query = null;
if (workflowModel != null)
{
query = MQuery.getEqualQuery("AD_Workflow_ID", workflowModel.getId().getRepoId());
}
AWindow frame = new AWindow();
if (!frame.initWindow(m_WF_Window_ID, query))
{
return;
}
AEnv.addToWindowManager(frame);
AEnv.showCenterScreen(frame);
frame = null;
} // zoom
/**
* String Representation
*
* @return info
*/
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder("WFPanel[");
if (workflowModel != null)
{
sb.append(workflowModel.getId().getRepoId());
}
sb.append("]");
return sb.toString();
} // toString
} // WFPanel
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\apps\wf\WFPanel.java
| 1
|
请完成以下Java代码
|
public void setPriceDate(Timestamp priceDate)
{
pricingCtx.setPriceDate(TimeUtil.asLocalDate(priceDate));
resetResult();
} // setPriceDate
/**
* Round
*
* @param bd number
* @return rounded number
*/
private BigDecimal round(BigDecimal bd)
{
final CurrencyPrecision precision = result.getPrecision();
if (precision != null)
{
return precision.roundIfNeeded(bd);
}
return bd;
} // round
/**************************************************************************
* Get C_UOM_ID
*
* @return uom
*/
public int getC_UOM_ID()
{
calculatePrice(false);
return UomId.toRepoId(result.getPriceUomId());
}
/**
* Get Price List
*
* @return list
*/
public BigDecimal getPriceList()
{
calculatePrice(false);
return round(result.getPriceList());
}
/**
* Get Price Std
*
* @return std
*/
public BigDecimal getPriceStd()
{
calculatePrice(false);
return round(result.getPriceStd());
}
/**
* Get Price Limit
*
* @return limit
*/
public BigDecimal getPriceLimit()
{
calculatePrice(false);
return round(result.getPriceLimit());
}
/**
* Is Price List enforded?
*
* @return enforce limit
*/
public boolean isEnforcePriceLimit()
{
calculatePrice(false);
return result.getEnforcePriceLimit().isTrue();
} // isEnforcePriceLimit
/**
* Is a DiscountSchema active?
*
* @return active Discount Schema
*/
public boolean isDiscountSchema()
{
return !result.isDisallowDiscount()
&& result.isUsesDiscountSchema();
} // isDiscountSchema
/**
* Is the Price Calculated (i.e. found)?
*
* @return calculated
*/
public boolean isCalculated()
{
return result.isCalculated();
} // isCalculated
|
/**
* Convenience method to get priceStd with the discount already subtracted. Note that the result matches the former behavior of {@link #getPriceStd()}.
*/
public BigDecimal mkPriceStdMinusDiscount()
{
calculatePrice(false);
return result.getDiscount().subtractFromBase(result.getPriceStd(), result.getPrecision().toInt());
}
@Override
public String toString()
{
return "MProductPricing ["
+ pricingCtx
+ ", " + result
+ "]";
}
public void setConvertPriceToContextUOM(boolean convertPriceToContextUOM)
{
pricingCtx.setConvertPriceToContextUOM(convertPriceToContextUOM);
}
public void setReferencedObject(Object referencedObject)
{
pricingCtx.setReferencedObject(referencedObject);
}
// metas: end
public int getC_TaxCategory_ID()
{
return TaxCategoryId.toRepoId(result.getTaxCategoryId());
}
public boolean isManualPrice()
{
return pricingCtx.getManualPriceEnabled().isTrue();
}
public void setManualPrice(boolean manualPrice)
{
pricingCtx.setManualPriceEnabled(manualPrice);
}
public void throwProductNotOnPriceListException()
{
throw new ProductNotOnPriceListException(pricingCtx);
}
} // MProductPrice
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\MProductPricing.java
| 1
|
请完成以下Java代码
|
public String toString()
{
return "all public fields";
}
@Override
public boolean test(final IDocumentFieldView field)
{
return field.isPublicField();
}
};
private static final Predicate<DocumentFieldChange> FILTER_DocumentFieldChange_ALL_PUBLIC_FIELDS = new Predicate<DocumentFieldChange>()
{
@Override
public String toString()
{
return "all public fields";
}
@Override
public boolean test(final DocumentFieldChange field)
{
return field.isPublicField();
}
};
private static final class FILTER_DocumentFieldView_ByFieldNamesSet implements Predicate<IDocumentFieldView>
{
private final Set<String> fieldNamesSet;
private final Predicate<IDocumentFieldView> parentFilter;
private FILTER_DocumentFieldView_ByFieldNamesSet(final Set<String> fieldNamesSet, final Predicate<IDocumentFieldView> parentFilter)
{
super();
this.fieldNamesSet = fieldNamesSet;
this.parentFilter = parentFilter;
}
@Override
public String toString()
{
return "field name in " + fieldNamesSet + " and " + parentFilter;
}
|
@Override
public boolean test(final IDocumentFieldView field)
{
if (!fieldNamesSet.contains(field.getFieldName()))
{
return false;
}
return parentFilter.test(field);
}
}
private static final class FILTER_DocumentFieldChange_ByFieldNamesSet implements Predicate<DocumentFieldChange>
{
private final Set<String> fieldNamesSet;
private final Predicate<DocumentFieldChange> parentFilter;
private FILTER_DocumentFieldChange_ByFieldNamesSet(final Set<String> fieldNamesSet, final Predicate<DocumentFieldChange> parentFilter)
{
super();
this.fieldNamesSet = fieldNamesSet;
this.parentFilter = parentFilter;
}
@Override
public String toString()
{
return "field name in " + fieldNamesSet + " and " + parentFilter;
}
@Override
public boolean test(final DocumentFieldChange field)
{
if (!fieldNamesSet.contains(field.getFieldName()))
{
return false;
}
return parentFilter.test(field);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\datatypes\json\JSONDocumentOptions.java
| 1
|
请完成以下Java代码
|
protected void registerConnectorInstance(String connectorId, Connector<?> connector) {
ensureConnectorProvidersInitialized();
synchronized (Connectors.class) {
availableConnectors.put(connectorId, connector);
}
}
protected void unregisterConnectorInstance(String connectorId) {
ensureConnectorProvidersInitialized();
synchronized (Connectors.class) {
availableConnectors.remove(connectorId);
}
}
@SuppressWarnings("rawtypes")
protected void applyConfigurators(Map<String, Connector<?>> connectors, ClassLoader classLoader) {
ServiceLoader<ConnectorConfigurator> configurators = ServiceLoader.load(ConnectorConfigurator.class, classLoader);
|
for (ConnectorConfigurator configurator : configurators) {
LOG.connectorConfiguratorDiscovered(configurator);
applyConfigurator(connectors, configurator);
}
}
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void applyConfigurator(Map<String, Connector<?>> connectors, ConnectorConfigurator configurator) {
for (Connector<?> connector : connectors.values()) {
if (configurator.getConnectorClass().isAssignableFrom(connector.getClass())) {
configurator.configure(connector);
}
}
}
}
|
repos\camunda-bpm-platform-master\connect\core\src\main\java\org\camunda\connect\Connectors.java
| 1
|
请完成以下Java代码
|
public Mono<Instance> find(InstanceId id) {
return this.eventStore.find(id)
.collectList()
.filter((e) -> !e.isEmpty())
.map((e) -> Instance.create(id).apply(e));
}
@Override
public Flux<Instance> findByName(String name) {
return findAll().filter((a) -> a.isRegistered() && name.equals(a.getRegistration().getName()));
}
@Override
public Mono<Instance> compute(InstanceId id, BiFunction<InstanceId, Instance, Mono<Instance>> remappingFunction) {
return this.find(id)
.flatMap((application) -> remappingFunction.apply(id, application))
|
.switchIfEmpty(Mono.defer(() -> remappingFunction.apply(id, null)))
.flatMap(this::save)
.retryWhen(this.retryOptimisticLockException);
}
@Override
public Mono<Instance> computeIfPresent(InstanceId id,
BiFunction<InstanceId, Instance, Mono<Instance>> remappingFunction) {
return this.find(id)
.flatMap((application) -> remappingFunction.apply(id, application))
.flatMap(this::save)
.retryWhen(this.retryOptimisticLockException);
}
}
|
repos\spring-boot-admin-master\spring-boot-admin-server\src\main\java\de\codecentric\boot\admin\server\domain\entities\EventsourcingInstanceRepository.java
| 1
|
请完成以下Java代码
|
public String getNamespace() {
return namespaceAttribute.getValue(this);
}
public void setNamespace(String namespace) {
namespaceAttribute.setValue(this, namespace);
}
public String getLocation() {
return locationAttribute.getValue(this);
}
public void setLocation(String location) {
locationAttribute.setValue(this, location);
}
public String getImportType() {
return importTypeAttribute.getValue(this);
}
public void setImportType(String importType) {
importTypeAttribute.setValue(this, importType);
}
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Import.class, CMMN_ELEMENT_IMPORT)
|
.namespaceUri(CMMN11_NS)
.instanceProvider(new ModelTypeInstanceProvider<Import>() {
public Import newInstance(ModelTypeInstanceContext instanceContext) {
return new ImportImpl(instanceContext);
}
});
namespaceAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_NAMESPACE)
.build();
locationAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_LOCATION)
.required()
.build();
importTypeAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_IMPORT_TYPE)
.required()
.build();
typeBuilder.build();
}
}
|
repos\camunda-bpm-platform-master\model-api\cmmn-model\src\main\java\org\camunda\bpm\model\cmmn\impl\instance\ImportImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public boolean isCachable() {
return forceCacheable;
}
@Override
public boolean isAbleToStore(Object value) {
if (value == null) {
return true;
}
return mappings.isJPAEntity(value);
}
@Override
public void setValue(Object value, ValueFields valueFields) {
EntityManagerSession entityManagerSession = Context.getCommandContext().getSession(EntityManagerSession.class);
if (entityManagerSession == null) {
throw new FlowableException("Cannot set JPA variable: " + EntityManagerSession.class + " not configured");
} else {
// Before we set the value we must flush all pending changes from
// the entitymanager
// If we don't do this, in some cases the primary key will not yet
// be set in the object
// which will cause exceptions down the road.
entityManagerSession.flush();
}
if (value != null) {
String className = mappings.getJPAClassString(value);
String idString = mappings.getJPAIdString(value);
valueFields.setTextValue(className);
|
valueFields.setTextValue2(idString);
} else {
valueFields.setTextValue(null);
valueFields.setTextValue2(null);
}
}
@Override
public Object getValue(ValueFields valueFields) {
if (valueFields.getTextValue() != null && valueFields.getTextValue2() != null) {
return mappings.getJPAEntity(valueFields.getTextValue(), valueFields.getTextValue2());
}
return null;
}
/**
* Force the value to be cacheable.
*/
@Override
public void setForceCacheable(boolean forceCachedValue) {
this.forceCacheable = forceCachedValue;
}
}
|
repos\flowable-engine-main\modules\flowable-variable-service\src\main\java\org\flowable\variable\service\impl\types\JPAEntityVariableType.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class BookstoreService {
private final AuthorRepository authorRepository;
private final BookRepository bookRepository;
public BookstoreService(AuthorRepository authorRepository,
BookRepository bookRepository) {
this.authorRepository = authorRepository;
this.bookRepository = bookRepository;
}
@Transactional(readOnly = true)
public void displayAuthorsAndBooks() {
List<Author> authors = authorRepository.findAll();
|
for (Author author : authors) {
System.out.println("Author: " + author.getName());
System.out.println("No of books: "
+ author.getBooks().size() + ", " + author.getBooks());
}
}
@Transactional(readOnly = true)
public void displayBooksAndAuthors() {
List<Book> books = bookRepository.findAll();
for (Book book : books) {
System.out.println("Book: " + book.getTitle());
System.out.println("Author: " + book.getAuthor());
}
}
}
|
repos\Hibernate-SpringBoot-master\HibernateSpringBootLoadBatchAssociation\src\main\java\com\bookstore\service\BookstoreService.java
| 2
|
请完成以下Java代码
|
public int getAD_Find_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Find_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), String.valueOf(getAD_Find_ID()));
}
/** AndOr AD_Reference_ID=204 */
public static final int ANDOR_AD_Reference_ID=204;
/** And = A */
public static final String ANDOR_And = "A";
/** Or = O */
public static final String ANDOR_Or = "O";
/** Set And/Or.
@param AndOr
Logical operation: AND or OR
*/
public void setAndOr (String AndOr)
{
set_Value (COLUMNNAME_AndOr, AndOr);
}
/** Get And/Or.
@return Logical operation: AND or OR
*/
public String getAndOr ()
{
return (String)get_Value(COLUMNNAME_AndOr);
}
/** Set Find_ID.
@param Find_ID Find_ID */
public void setFind_ID (BigDecimal Find_ID)
{
set_Value (COLUMNNAME_Find_ID, Find_ID);
}
/** Get Find_ID.
@return Find_ID */
public BigDecimal getFind_ID ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Find_ID);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Operation AD_Reference_ID=205 */
public static final int OPERATION_AD_Reference_ID=205;
/** = = == */
public static final String OPERATION_Eq = "==";
/** >= = >= */
public static final String OPERATION_GtEq = ">=";
/** > = >> */
public static final String OPERATION_Gt = ">>";
/** < = << */
public static final String OPERATION_Le = "<<";
/** ~ = ~~ */
public static final String OPERATION_Like = "~~";
/** <= = <= */
public static final String OPERATION_LeEq = "<=";
/** |<x>| = AB */
public static final String OPERATION_X = "AB";
/** sql = SQ */
public static final String OPERATION_Sql = "SQ";
/** != = != */
public static final String OPERATION_NotEq = "!=";
/** Set Operation.
@param Operation
Compare Operation
*/
public void setOperation (String Operation)
{
set_Value (COLUMNNAME_Operation, Operation);
}
/** Get Operation.
@return Compare Operation
|
*/
public String getOperation ()
{
return (String)get_Value(COLUMNNAME_Operation);
}
/** 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);
}
/** Set Value To.
@param Value2
Value To
*/
public void setValue2 (String Value2)
{
set_Value (COLUMNNAME_Value2, Value2);
}
/** Get Value To.
@return Value To
*/
public String getValue2 ()
{
return (String)get_Value(COLUMNNAME_Value2);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Find.java
| 1
|
请完成以下Java代码
|
public int getAD_User_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_CM_ChatType getCM_ChatType() throws RuntimeException
{
return (I_CM_ChatType)MTable.get(getCtx(), I_CM_ChatType.Table_Name)
.getPO(getCM_ChatType_ID(), get_TrxName()); }
/** Set Chat Type.
@param CM_ChatType_ID
Type of discussion / chat
*/
public void setCM_ChatType_ID (int CM_ChatType_ID)
{
if (CM_ChatType_ID < 1)
set_ValueNoCheck (COLUMNNAME_CM_ChatType_ID, null);
else
set_ValueNoCheck (COLUMNNAME_CM_ChatType_ID, Integer.valueOf(CM_ChatType_ID));
}
/** Get Chat Type.
@return Type of discussion / chat
*/
public int getCM_ChatType_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_CM_ChatType_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;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_CM_ChatTypeUpdate.java
| 1
|
请完成以下Java代码
|
public List<I_M_HU> getAvailableHUsToReverse()
{
return hus;
}
/**
* @param huId
* @return receipt which contains the given HU or <code>null</code> if no receipt is matching.
*/
private I_M_InOut getReceiptOrNull(final int huId)
{
final I_M_InOut receipt = huId2inout.get(huId);
return receipt;
}
public List<I_M_InOut> getReceiptsToReverseFromHUs(final Collection<I_M_HU> huAwareList)
{
return getReceiptsToReverse(IHUAware.transformHUCollection(hus));
}
/**
* Get the receipts to be reversed based on given HUs.
*
* @param huAwareList
* @return receipts
*/
public List<I_M_InOut> getReceiptsToReverse(final Collection<? extends IHUAware> huAwareList)
{
if (huAwareList == null || huAwareList.isEmpty())
{
return ImmutableList.of();
}
return getReceiptsToReverse(huAwareList
.stream()
.map(huAware -> huAware.getM_HU().getM_HU_ID()));
}
public List<I_M_InOut> getReceiptsToReverseFromHUIds(final Collection<Integer> huIds)
{
if (huIds == null || huIds.isEmpty())
{
return ImmutableList.of();
}
return getReceiptsToReverse(huIds.stream());
}
private final List<I_M_InOut> getReceiptsToReverse(final Stream<Integer> huIds)
{
return huIds
.map(huId -> getReceiptOrNull(huId))
// skip if no receipt found because
// * it could be that user selected not a top level HU.... skip it for now
// * or we were really asked to as much as we can
.filter(receipt -> receipt != null)
.collect(GuavaCollectors.toImmutableList());
}
/**
* Get all HUs which are assigned to given receipts.
*
* @param receipts
* @return HUs
*/
|
public Set<I_M_HU> getHUsForReceipts(final Collection<? extends I_M_InOut> receipts)
{
final Set<I_M_HU> hus = new TreeSet<>(HUByIdComparator.instance);
for (final I_M_InOut receipt : receipts)
{
final int inoutId = receipt.getM_InOut_ID();
final Collection<I_M_HU> husForReceipt = inoutId2hus.get(inoutId);
if (Check.isEmpty(husForReceipt))
{
continue;
}
hus.addAll(husForReceipt);
}
return hus;
}
public static final class Builder
{
private I_M_ReceiptSchedule receiptSchedule;
private boolean tolerateNoHUsFound = false;
private Builder()
{
super();
}
public ReceiptCorrectHUsProcessor build()
{
return new ReceiptCorrectHUsProcessor(this);
}
public Builder setM_ReceiptSchedule(final I_M_ReceiptSchedule receiptSchedule)
{
this.receiptSchedule = receiptSchedule;
return this;
}
private I_M_ReceiptSchedule getM_ReceiptSchedule()
{
Check.assumeNotNull(receiptSchedule, "Parameter receiptSchedule is not null");
return receiptSchedule;
}
public Builder tolerateNoHUsFound()
{
tolerateNoHUsFound = true;
return this;
}
private boolean isFailOnNoHUsFound()
{
return !tolerateNoHUsFound;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\inout\ReceiptCorrectHUsProcessor.java
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.