instruction string | input string | output string | source_file string | priority int64 |
|---|---|---|---|---|
请完成以下Java代码 | public InputStream getInputStream() throws IOException {
connect();
return new ConnectionInputStream(this.resources.getInputStream());
}
@Override
public void connect() throws IOException {
if (this.connected) {
return;
}
this.resources.connect();
this.connected = true;
}
/**
* Connection {@link InputStream}.
*/
class ConnectionInputStream extends FilterInputStream {
private volatile boolean closing;
ConnectionInputStream(InputStream in) {
super(in);
}
@Override
public void close() throws IOException {
if (this.closing) {
return;
}
this.closing = true;
try { | super.close();
}
finally {
try {
NestedUrlConnection.this.cleanup.clean();
}
catch (UncheckedIOException ex) {
throw ex.getCause();
}
}
}
}
} | repos\spring-boot-4.0.1\loader\spring-boot-loader\src\main\java\org\springframework\boot\loader\net\protocol\nested\NestedUrlConnection.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class RabbitMQEventBusConfiguration
{
public static final String APPLICATION_NAME_SPEL = "${spring.application.name:spring.application.name-not-set}";
@Value(APPLICATION_NAME_SPEL) private String appName;
@Bean
public org.springframework.amqp.support.converter.MessageConverter amqpMessageConverter(final ObjectMapper jsonObjectMapper)
{
return new Jackson2JsonMessageConverter(jsonObjectMapper);
}
@Bean
public org.springframework.messaging.converter.MessageConverter messageConverter()
{
return new MappingJackson2MessageConverter();
}
@Bean
public MessageHandlerMethodFactory messageHandlerMethodFactory()
{
final DefaultMessageHandlerMethodFactory factory = new DefaultMessageHandlerMethodFactory();
factory.setMessageConverter(messageConverter());
return factory;
}
/** | * Attempt to set the application name (e.g. metasfresh-webui-api) as the rabbitmq connection name.
* Thx to <a href="https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-messaging.html#boot-features-rabbitmq">spring-boot-features-rabbitmq</a>
* <p>
* (although right now it doesn't need to work..)
*/
@Bean
public ConnectionNameStrategy connectionNameStrategy()
{
return connectionFactory -> appName;
}
@Bean
public EventBusMonitoringService eventBusMonitoringService(@NonNull final Optional<PerformanceMonitoringService> performanceMonitoringService)
{
return new EventBusMonitoringService(performanceMonitoringService.orElse(NoopPerformanceMonitoringService.INSTANCE));
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\event\remote\rabbitmq\RabbitMQEventBusConfiguration.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class NettyProperties {
/**
* Level of leak detection for reference-counted buffers. If not configured via
* 'ResourceLeakDetector.setLevel' or the 'io.netty.leakDetection.level' system
* property, default to 'simple'.
*/
private @Nullable LeakDetection leakDetection;
public @Nullable LeakDetection getLeakDetection() {
return this.leakDetection;
}
public void setLeakDetection(@Nullable LeakDetection leakDetection) {
this.leakDetection = leakDetection;
}
public enum LeakDetection {
/**
* Disable leak detection completely.
*/
DISABLED, | /**
* Detect leaks for 1% of buffers.
*/
SIMPLE,
/**
* Detect leaks for 1% of buffers and track where they were accessed.
*/
ADVANCED,
/**
* Detect leaks for 100% of buffers and track where they were accessed.
*/
PARANOID
}
} | repos\spring-boot-4.0.1\module\spring-boot-netty\src\main\java\org\springframework\boot\netty\autoconfigure\NettyProperties.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class MainApplication {
private final BookstoreService bookstoreService;
public MainApplication(BookstoreService bookstoreService) {
this.bookstoreService = bookstoreService;
}
public static void main(String[] args) {
SpringApplication.run(MainApplication.class, args);
}
@Bean
public ApplicationRunner init() {
return args -> {
System.out.println("\nNamed stored procedure ...");
bookstoreService.fetchAnthologyAuthorsViaNamedStoredProcedure();
System.out.println("\n---------------------------------------------------------"); | System.out.println("\nStored procedure ...");
bookstoreService.fetchAnthologyAuthorsViaStoredProcedure();
System.out.println("\n---------------------------------------------------------");
System.out.println("\nStored procedure and DTO ...");
bookstoreService.fetchAnthologyDtoAuthorsViaStoredProcedure();
System.out.println("\n---------------------------------------------------------");
System.out.println("\nStored procedure and manually mapping DTO ...");
bookstoreService.fetchAnthologyManualMappingDtoAuthorsViaStoredProcedure();
};
}
} | repos\Hibernate-SpringBoot-master\HibernateSpringBootCallStoredProcedureReturnResultSet\src\main\java\com\bookstore\MainApplication.java | 2 |
请完成以下Java代码 | public final class CrossOriginEmbedderPolicyHeaderWriter implements HeaderWriter {
private static final String EMBEDDER_POLICY = "Cross-Origin-Embedder-Policy";
private @Nullable CrossOriginEmbedderPolicy policy;
/**
* Sets the {@link CrossOriginEmbedderPolicy} value to be used in the
* {@code Cross-Origin-Embedder-Policy} header
* @param embedderPolicy the {@link CrossOriginEmbedderPolicy} to use
*/
public void setPolicy(CrossOriginEmbedderPolicy embedderPolicy) {
Assert.notNull(embedderPolicy, "embedderPolicy cannot be null");
this.policy = embedderPolicy;
}
@Override
public void writeHeaders(HttpServletRequest request, HttpServletResponse response) {
if (this.policy != null && !response.containsHeader(EMBEDDER_POLICY)) {
response.addHeader(EMBEDDER_POLICY, this.policy.getPolicy());
}
}
public enum CrossOriginEmbedderPolicy {
UNSAFE_NONE("unsafe-none"),
REQUIRE_CORP("require-corp"),
CREDENTIALLESS("credentialless");
private final String policy; | CrossOriginEmbedderPolicy(String policy) {
this.policy = policy;
}
public String getPolicy() {
return this.policy;
}
public static @Nullable CrossOriginEmbedderPolicy from(String embedderPolicy) {
for (CrossOriginEmbedderPolicy policy : values()) {
if (policy.getPolicy().equals(embedderPolicy)) {
return policy;
}
}
return null;
}
}
} | repos\spring-security-main\web\src\main\java\org\springframework\security\web\header\writers\CrossOriginEmbedderPolicyHeaderWriter.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public int add(MemberBrandAttention memberBrandAttention) {
int count = 0;
if(memberBrandAttention.getBrandId()==null){
return 0;
}
UmsMember member = memberService.getCurrentMember();
memberBrandAttention.setMemberId(member.getId());
memberBrandAttention.setMemberNickname(member.getNickname());
memberBrandAttention.setMemberIcon(member.getIcon());
memberBrandAttention.setCreateTime(new Date());
MemberBrandAttention findAttention = memberBrandAttentionRepository.findByMemberIdAndBrandId(memberBrandAttention.getMemberId(), memberBrandAttention.getBrandId());
if (findAttention == null) {
if(sqlEnable){
PmsBrand brand = brandMapper.selectByPrimaryKey(memberBrandAttention.getBrandId());
if(brand==null){
return 0;
}else{
memberBrandAttention.setBrandCity(null);
memberBrandAttention.setBrandName(brand.getName());
memberBrandAttention.setBrandLogo(brand.getLogo());
}
}
memberBrandAttentionRepository.save(memberBrandAttention);
count = 1;
}
return count;
}
@Override
public int delete(Long brandId) {
UmsMember member = memberService.getCurrentMember();
return memberBrandAttentionRepository.deleteByMemberIdAndBrandId(member.getId(),brandId);
}
@Override | public Page<MemberBrandAttention> list(Integer pageNum, Integer pageSize) {
UmsMember member = memberService.getCurrentMember();
Pageable pageable = PageRequest.of(pageNum-1,pageSize);
return memberBrandAttentionRepository.findByMemberId(member.getId(),pageable);
}
@Override
public MemberBrandAttention detail(Long brandId) {
UmsMember member = memberService.getCurrentMember();
return memberBrandAttentionRepository.findByMemberIdAndBrandId(member.getId(), brandId);
}
@Override
public void clear() {
UmsMember member = memberService.getCurrentMember();
memberBrandAttentionRepository.deleteAllByMemberId(member.getId());
}
} | repos\mall-master\mall-portal\src\main\java\com\macro\mall\portal\service\impl\MemberAttentionServiceImpl.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class Author {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
Integer id;
@Column(name = "firstname")
String firstName;
@Column(name = "lastname")
String lastName;
@Column(name = "bookid")
Integer bookId;
public Author(Integer id, String firstName, String lastName, Integer bookId) {
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
this.bookId = bookId;
}
public Author() {
}
public Integer getId() {
return id;
}
public String getFirstName() {
return firstName;
}
public String getLastName() { | return lastName;
}
public void setId(Integer id) {
this.id = id;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public Integer getBookId() {
return bookId;
}
public void setBookId(Integer bookId) {
this.bookId = bookId;
}
} | repos\springboot-demo-master\GraphQL\src\main\java\com\et\graphql\model\Author.java | 2 |
请完成以下Spring Boot application配置 | spring:
kafka:
producer:
value-serializer: org.springframework.kafka.support.serializer.JsonSerializer
consumer:
value-deserial | izer: org.apache.kafka.common.serialization.ByteArrayDeserializer | repos\spring-kafka-main\samples\sample-01\src\main\resources\application.yml | 2 |
请完成以下Java代码 | public static AttributeSetInstanceId ofRepoId(final int repoId)
{
final AttributeSetInstanceId id = ofRepoIdOrNull(repoId);
if (id == null)
{
throw new AdempiereException("Invalid repoId: " + repoId);
}
return id;
}
public static AttributeSetInstanceId ofRepoIdOrNone(final int repoId)
{
final AttributeSetInstanceId asiId = ofRepoIdOrNull(repoId);
return asiId != null ? asiId : NONE;
}
@Nullable
public static AttributeSetInstanceId ofRepoIdOrNull(final int repoId)
{
if (repoId == NONE.repoId)
{
return NONE;
}
else if (repoId > 0)
{
return new AttributeSetInstanceId(repoId);
}
else
{
return null;
}
}
public static AttributeSetInstanceId nullToNone(@Nullable final AttributeSetInstanceId asiId) {return asiId != null ? asiId : NONE;}
public static int toRepoId(@Nullable final AttributeSetInstanceId attributeSetInstanceId)
{
return attributeSetInstanceId != null ? attributeSetInstanceId.getRepoId() : -1;
}
private AttributeSetInstanceId()
{
this.repoId = 0;
}
@Override
@JsonValue
public int getRepoId()
{
return repoId;
}
public boolean isNone()
{
return repoId == NONE.repoId;
} | /**
* @return true if this is about a "real" greater-than-zero {@code M_AttributeSetInstance_ID}.
*/
public boolean isRegular()
{
return repoId > NONE.repoId;
}
public static boolean isRegular(@Nullable final AttributeSetInstanceId asiId)
{
return asiId != null && asiId.isRegular();
}
@Nullable
public AttributeSetInstanceId asRegularOrNull() {return isRegular() ? this : null;}
/**
* Note that currently, according to this method, "NONE" ist not equal to an emptpy ASI
*/
public static boolean equals(@Nullable final AttributeSetInstanceId id1, @Nullable final AttributeSetInstanceId id2)
{
return Objects.equals(id1, id2);
}
@SuppressWarnings("unused")
public void assertRegular()
{
if (!isRegular())
{
throw new AdempiereException("Expected regular ASI but got " + this);
}
}
@Contract("!null -> !null")
public AttributeSetInstanceId orElseIfNone(final AttributeSetInstanceId other) {return isNone() ? other : this;}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\mm\attributes\AttributeSetInstanceId.java | 1 |
请完成以下Java代码 | public class PlainTrxSavepoint implements ITrxSavepoint
{
private final ITrx trx;
private final String name;
public PlainTrxSavepoint(final ITrx trx, final String name)
{
this.trx = trx;
this.name = name;
}
@Override
public String toString()
{
return getClass().getSimpleName() + "["
+ "name=" + name
+ ", trx=" + trx.getTrxName() // prevent stackoverflow
+ "]"; | }
@Override
public Object getNativeSavepoint()
{
// dummy
return name;
}
@Override
public ITrx getTrx()
{
return trx;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\trx\api\impl\PlainTrxSavepoint.java | 1 |
请在Spring Boot框架中完成以下Java代码 | class LogCorrelationEnvironmentPostProcessor implements EnvironmentPostProcessor {
@Override
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
if (ClassUtils.isPresent("io.micrometer.tracing.Tracer", application.getClassLoader())) {
environment.getPropertySources().addLast(new LogCorrelationPropertySource(this, environment));
}
}
/**
* Log correlation {@link PropertySource}.
*/
private static class LogCorrelationPropertySource extends EnumerablePropertySource<Object> {
private static final String NAME = "logCorrelation";
private final Environment environment;
LogCorrelationPropertySource(Object source, Environment environment) {
super(NAME, source);
this.environment = environment;
} | @Override
public String[] getPropertyNames() {
return new String[] { LoggingSystem.EXPECT_CORRELATION_ID_PROPERTY };
}
@Override
public @Nullable Object getProperty(String name) {
if (name.equals(LoggingSystem.EXPECT_CORRELATION_ID_PROPERTY)) {
return this.environment.getProperty("management.tracing.export.enabled", Boolean.class, Boolean.TRUE);
}
return null;
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-micrometer-tracing\src\main\java\org\springframework\boot\micrometer\tracing\autoconfigure\LogCorrelationEnvironmentPostProcessor.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public String getPlanItemInstanceId() {
return planItemInstanceId;
}
public void setPlanItemInstanceId(String planItemInstanceId) {
this.planItemInstanceId = planItemInstanceId;
}
@ApiModelProperty(example = "scriptTask1")
public String getElementId() {
return elementId;
}
public void setElementId(String elementId) {
this.elementId = elementId;
}
@ApiModelProperty(example = "Script task")
public String getElementName() {
return elementName;
}
public void setElementName(String elementName) {
this.elementName = elementName;
}
public void setHandlerType(String handlerType) {
this.handlerType = handlerType;
}
@ApiModelProperty(example = "cmmn-trigger-timer")
public String getHandlerType() {
return handlerType;
}
@ApiModelProperty(example = "3")
public Integer getRetries() {
return retries;
}
public void setRetries(Integer retries) {
this.retries = retries;
}
@ApiModelProperty(example = "null")
public String getExceptionMessage() {
return exceptionMessage;
}
public void setExceptionMessage(String exceptionMessage) {
this.exceptionMessage = exceptionMessage;
} | @ApiModelProperty(example = "2023-06-04T22:05:05.474+0000")
public Date getDueDate() {
return dueDate;
}
public void setDueDate(Date dueDate) {
this.dueDate = dueDate;
}
@ApiModelProperty(example = "2023-06-03T22:05:05.474+0000")
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@ApiModelProperty(example = "node1")
public String getLockOwner() {
return lockOwner;
}
public void setLockOwner(String lockOwner) {
this.lockOwner = lockOwner;
}
@ApiModelProperty(example = "2023-06-03T22:05:05.474+0000")
public Date getLockExpirationTime() {
return lockExpirationTime;
}
public void setLockExpirationTime(Date lockExpirationTime) {
this.lockExpirationTime = lockExpirationTime;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
@ApiModelProperty(example = "null")
public String getTenantId() {
return tenantId;
}
} | repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\management\JobResponse.java | 2 |
请完成以下Java代码 | public void setIsQtyPerWarehouse (final boolean IsQtyPerWarehouse)
{
set_Value (COLUMNNAME_IsQtyPerWarehouse, IsQtyPerWarehouse);
}
@Override
public boolean isQtyPerWarehouse()
{
return get_ValueAsBoolean(COLUMNNAME_IsQtyPerWarehouse);
}
@Override
public void setMD_AvailableForSales_Config_ID (final int MD_AvailableForSales_Config_ID)
{
if (MD_AvailableForSales_Config_ID < 1)
set_ValueNoCheck (COLUMNNAME_MD_AvailableForSales_Config_ID, null);
else
set_ValueNoCheck (COLUMNNAME_MD_AvailableForSales_Config_ID, MD_AvailableForSales_Config_ID);
}
@Override
public int getMD_AvailableForSales_Config_ID()
{
return get_ValueAsInt(COLUMNNAME_MD_AvailableForSales_Config_ID);
}
@Override
public void setSalesOrderLookBehindHours (final int SalesOrderLookBehindHours)
{
set_Value (COLUMNNAME_SalesOrderLookBehindHours, SalesOrderLookBehindHours);
}
@Override | public int getSalesOrderLookBehindHours()
{
return get_ValueAsInt(COLUMNNAME_SalesOrderLookBehindHours);
}
@Override
public void setShipmentDateLookAheadHours (final int ShipmentDateLookAheadHours)
{
set_Value (COLUMNNAME_ShipmentDateLookAheadHours, ShipmentDateLookAheadHours);
}
@Override
public int getShipmentDateLookAheadHours()
{
return get_ValueAsInt(COLUMNNAME_ShipmentDateLookAheadHours);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.material\cockpit\src\main\java-gen\de\metas\material\cockpit\model\X_MD_AvailableForSales_Config.java | 1 |
请完成以下Java代码 | public Optional<HasId<?>> findEntity(TenantId tenantId, EntityId entityId) {
return Optional.ofNullable(findById(tenantId, new RpcId(entityId.getId())));
}
@Override
public FluentFuture<Optional<HasId<?>>> findEntityAsync(TenantId tenantId, EntityId entityId) {
return FluentFuture.from(findRpcByIdAsync(tenantId, new RpcId(entityId.getId())))
.transform(Optional::ofNullable, directExecutor());
}
@Override
public EntityType getEntityType() {
return EntityType.RPC;
} | private final PaginatedRemover<TenantId, Rpc> tenantRpcRemover = new PaginatedRemover<>() {
@Override
protected PageData<Rpc> findEntities(TenantId tenantId, TenantId id, PageLink pageLink) {
return rpcDao.findAllRpcByTenantId(id, pageLink);
}
@Override
protected void removeEntity(TenantId tenantId, Rpc entity) {
deleteRpc(tenantId, entity.getId());
}
};
} | repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\rpc\BaseRpcService.java | 1 |
请完成以下Java代码 | public class UmsMemberTag implements Serializable {
private Long id;
private String name;
@ApiModelProperty(value = "自动打标签完成订单数量")
private Integer finishOrderCount;
@ApiModelProperty(value = "自动打标签完成订单金额")
private BigDecimal finishOrderAmount;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getFinishOrderCount() {
return finishOrderCount;
}
public void setFinishOrderCount(Integer finishOrderCount) {
this.finishOrderCount = finishOrderCount;
}
public BigDecimal getFinishOrderAmount() {
return finishOrderAmount;
} | public void setFinishOrderAmount(BigDecimal finishOrderAmount) {
this.finishOrderAmount = finishOrderAmount;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", name=").append(name);
sb.append(", finishOrderCount=").append(finishOrderCount);
sb.append(", finishOrderAmount=").append(finishOrderAmount);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\UmsMemberTag.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public AggregationTemporality aggregationTemporality() {
return obtain(OtlpMetricsProperties::getAggregationTemporality, OtlpConfig.super::aggregationTemporality);
}
@Override
public Map<String, String> resourceAttributes() {
Map<String, String> resourceAttributes = new LinkedHashMap<>();
new OpenTelemetryResourceAttributes(this.environment, this.openTelemetryProperties.getResourceAttributes())
.applyTo(resourceAttributes::put);
return Collections.unmodifiableMap(resourceAttributes);
}
@Override
public Map<String, String> headers() {
return obtain(OtlpMetricsProperties::getHeaders, OtlpConfig.super::headers);
}
@Override
public HistogramFlavor histogramFlavor() {
return obtain(OtlpMetricsProperties::getHistogramFlavor, OtlpConfig.super::histogramFlavor);
}
@Override
public Map<String, HistogramFlavor> histogramFlavorPerMeter() {
return obtain(perMeter(Meter::getHistogramFlavor), OtlpConfig.super::histogramFlavorPerMeter);
}
@Override
public Map<String, Integer> maxBucketsPerMeter() {
return obtain(perMeter(Meter::getMaxBucketCount), OtlpConfig.super::maxBucketsPerMeter);
}
@Override | public int maxScale() {
return obtain(OtlpMetricsProperties::getMaxScale, OtlpConfig.super::maxScale);
}
@Override
public int maxBucketCount() {
return obtain(OtlpMetricsProperties::getMaxBucketCount, OtlpConfig.super::maxBucketCount);
}
@Override
public TimeUnit baseTimeUnit() {
return obtain(OtlpMetricsProperties::getBaseTimeUnit, OtlpConfig.super::baseTimeUnit);
}
private <V> Getter<OtlpMetricsProperties, Map<String, V>> perMeter(Getter<Meter, V> getter) {
return (properties) -> {
if (CollectionUtils.isEmpty(properties.getMeter())) {
return null;
}
Map<String, V> perMeter = new LinkedHashMap<>();
properties.getMeter().forEach((key, meterProperties) -> {
V value = getter.get(meterProperties);
if (value != null) {
perMeter.put(key, value);
}
});
return (!perMeter.isEmpty()) ? perMeter : null;
};
}
} | repos\spring-boot-4.0.1\module\spring-boot-micrometer-metrics\src\main\java\org\springframework\boot\micrometer\metrics\autoconfigure\export\otlp\OtlpMetricsPropertiesConfigAdapter.java | 2 |
请完成以下Java代码 | private void addGrantedAuthorityCollection(Collection<GrantedAuthority> result, Object value) {
if (value == null) {
return;
}
if (value instanceof Collection<?>) {
addGrantedAuthorityCollection(result, (Collection<?>) value);
}
else if (value instanceof Object[]) {
addGrantedAuthorityCollection(result, (Object[]) value);
}
else if (value instanceof String) {
addGrantedAuthorityCollection(result, (String) value);
}
else if (value instanceof GrantedAuthority) {
result.add((GrantedAuthority) value);
}
else {
throw new IllegalArgumentException("Invalid object type: " + value.getClass().getName());
}
}
private void addGrantedAuthorityCollection(Collection<GrantedAuthority> result, Collection<?> value) {
for (Object elt : value) {
addGrantedAuthorityCollection(result, elt);
}
}
private void addGrantedAuthorityCollection(Collection<GrantedAuthority> result, Object[] value) {
for (Object aValue : value) {
addGrantedAuthorityCollection(result, aValue);
}
}
private void addGrantedAuthorityCollection(Collection<GrantedAuthority> result, String value) {
StringTokenizer tokenizer = new StringTokenizer(value, this.stringSeparator, false);
while (tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken();
if (StringUtils.hasText(token)) {
result.add(new SimpleGrantedAuthority(token));
}
} | }
/**
*
* @see org.springframework.security.core.authority.mapping.MappableAttributesRetriever#getMappableAttributes()
*/
@Override
public Set<String> getMappableAttributes() {
return this.mappableAttributes;
}
/**
* @return Returns the stringSeparator.
*/
public String getStringSeparator() {
return this.stringSeparator;
}
/**
* @param stringSeparator The stringSeparator to set.
*/
public void setStringSeparator(String stringSeparator) {
Assert.notNull(stringSeparator, "stringSeparator cannot be null");
this.stringSeparator = stringSeparator;
}
} | repos\spring-security-main\core\src\main\java\org\springframework\security\core\authority\mapping\MapBasedAttributes2GrantedAuthoritiesMapper.java | 1 |
请完成以下Java代码 | public void setBusinessKey(String businessKey) {
this.businessKey = businessKey;
}
public Date getStartedBefore() {
return startedBefore;
}
@CamundaQueryParam(value="startedBefore", converter = DateConverter.class)
public void setStartedBefore(Date startedBefore) {
this.startedBefore = startedBefore;
}
public Date getStartedAfter() {
return startedAfter;
}
@CamundaQueryParam(value="startedAfter", converter = DateConverter.class)
public void setStartedAfter(Date startedAfter) {
this.startedAfter = startedAfter;
}
public Boolean getWithIncident() {
return withIncident;
}
@CamundaQueryParam(value="withIncident", converter = BooleanConverter.class)
public void setWithIncident(Boolean withIncident) {
this.withIncident = withIncident;
}
@Override
protected String getOrderByValue(String sortBy) {
return ORDER_BY_VALUES.get(sortBy);
}
@Override
protected boolean isValidSortByValue(String value) {
return VALID_SORT_BY_VALUES.contains(value);
}
public String getOuterOrderBy() {
String outerOrderBy = getOrderBy();
if (outerOrderBy == null || outerOrderBy.isEmpty()) {
return "ID_ asc";
}
else if (outerOrderBy.contains(".")) {
return outerOrderBy.substring(outerOrderBy.lastIndexOf(".") + 1);
}
else { | return outerOrderBy;
}
}
private List<QueryVariableValue> createQueryVariableValues(VariableSerializers variableTypes, List<VariableQueryParameterDto> variables, String dbType) {
List<QueryVariableValue> values = new ArrayList<QueryVariableValue>();
if (variables == null) {
return values;
}
for (VariableQueryParameterDto variable : variables) {
QueryVariableValue value = new QueryVariableValue(
variable.getName(),
resolveVariableValue(variable.getValue()),
ConditionQueryParameterDto.getQueryOperator(variable.getOperator()),
false);
value.initialize(variableTypes, dbType);
values.add(value);
}
return values;
}
} | repos\camunda-bpm-platform-master\webapps\assembly\src\main\java\org\camunda\bpm\cockpit\impl\plugin\base\dto\query\AbstractProcessInstanceQueryDto.java | 1 |
请完成以下Java代码 | public String getSitetype() {
return sitetype;
}
public void setSitetype(String sitetype) {
this.sitetype = sitetype;
}
public String getCdate() {
return cdate;
}
public void setCdate(String cdate) {
this.cdate = cdate;
}
public String getComtype() {
return comtype;
}
public void setComtype(String comtype) {
this.comtype = comtype;
}
public String getComname() {
return comname;
}
public void setComname(String comname) {
this.comname = comname;
}
public String getComaddress() {
return comaddress;
}
public void setComaddress(String comaddress) {
this.comaddress = comaddress; | }
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "DomainDetail{" + "id='" + id + '\'' + ", sitename='" + sitename + '\'' + ", sitedomain='" + sitedomain
+ '\'' + ", sitetype='" + sitetype + '\'' + ", cdate='" + cdate + '\'' + ", comtype='" + comtype + '\''
+ ", comname='" + comname + '\'' + ", comaddress='" + comaddress + '\'' + ", updateTime='" + updateTime
+ '\'' + '}';
}
} | repos\spring-boot-quick-master\quick-feign\src\main\java\com\quick\feign\entity\DomainDetail.java | 1 |
请完成以下Java代码 | public int hashCode() {
final int prime = 31;
int result = 1;
result = (prime * result) + ((id == null) ? 0 : id.hashCode());
result = (prime * result) + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Privilege other = (Privilege) obj;
if (id == null) {
if (other.id != null) { | return false;
}
} else if (!id.equals(other.id)) {
return false;
}
if (name == null) {
if (other.name != null) {
return false;
}
} else if (!name.equals(other.name)) {
return false;
}
return true;
}
} | repos\tutorials-master\spring-security-modules\spring-security-web-boot-1\src\main\java\com\baeldung\roles\custom\persistence\model\Privilege.java | 1 |
请完成以下Java代码 | public HUQueryBuilder addPIVersionToInclude(@NonNull final HuPackingInstructionsVersionId huPIVersionId)
{
_huPIVersionIdsToInclude.add(huPIVersionId);
return this;
}
private Set<HuPackingInstructionsVersionId> getPIVersionIdsToInclude()
{
return _huPIVersionIdsToInclude;
}
@Override
public HUQueryBuilder setExcludeAfterPickingLocator(final boolean excludeAfterPickingLocator)
{
locators.setExcludeAfterPickingLocator(excludeAfterPickingLocator);
return this;
}
@Override
public HUQueryBuilder setIncludeAfterPickingLocator(final boolean includeAfterPickingLocator)
{
locators.setIncludeAfterPickingLocator(includeAfterPickingLocator);
return this;
}
@Override
public HUQueryBuilder setExcludeHUsOnPickingSlot(final boolean excludeHUsOnPickingSlot)
{
_excludeHUsOnPickingSlot = excludeHUsOnPickingSlot;
return this;
}
@Override
public IHUQueryBuilder setExcludeReservedToOtherThan(@Nullable final HUReservationDocRef documentRef) | {
_excludeReservedToOtherThanRef = documentRef;
return this;
}
@Override
public IHUQueryBuilder setExcludeReserved()
{
_excludeReserved = true;
return this;
}
@Override
public IHUQueryBuilder setIgnoreHUsScheduledInDDOrder(final boolean ignoreHUsScheduledInDDOrder)
{
this.ignoreHUsScheduledInDDOrder = ignoreHUsScheduledInDDOrder;
return this;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\impl\HUQueryBuilder.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class Hotel implements Serializable {
private static final long serialVersionUID = 5560221391479816650L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String name;
private Double rating;
@ManyToOne(fetch = FetchType.EAGER)
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
private City city;
private String address;
private double lattitude;
private double longitude;
private boolean deleted = false;
public Hotel() {}
public Hotel(
Long id,
String name,
Double rating,
City city,
String address,
double lattitude,
double longitude,
boolean deleted) {
this.id = id;
this.name = name;
this.rating = rating;
this.city = city;
this.address = address;
this.lattitude = lattitude;
this.longitude = longitude;
this.deleted = deleted;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Double getRating() {
return rating;
}
public void setRating(Double rating) {
this.rating = rating;
}
public City getCity() { | return city;
}
public void setCity(City city) {
this.city = city;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public double getLatitude() {
return lattitude;
}
public void setLatitude(double latitude) {
this.lattitude = latitude;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public boolean isDeleted() {
return deleted;
}
public void setDeleted(boolean deleted) {
this.deleted = deleted;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Hotel hotel = (Hotel) o;
if (Double.compare(hotel.lattitude, lattitude) != 0) return false;
if (Double.compare(hotel.longitude, longitude) != 0) return false;
if (deleted != hotel.deleted) return false;
if (!Objects.equals(id, hotel.id)) return false;
if (!Objects.equals(name, hotel.name)) return false;
if (!Objects.equals(rating, hotel.rating)) return false;
if (!Objects.equals(city, hotel.city)) return false;
return Objects.equals(address, hotel.address);
}
} | repos\tutorials-master\spring-boot-modules\spring-boot-caching\src\main\java\com\baeldung\caching\ttl\model\Hotel.java | 2 |
请完成以下Java代码 | private void setEdiEnabledFromOrder(@NonNull final I_M_InOut inout)
{
if (inout.getC_Order_ID() <= 0)
{
return; // nothing to do
}
final I_C_Order order = InterfaceWrapperHelper.create(inout.getC_Order(), de.metas.edi.model.I_C_Order.class);
if (order == null || order.getC_Order_ID() <= 0)
{
// nothing to do
return;
}
// order.isEdiEnabled might be for just DESADV or just INVOIC; so we also need to check the finalRecipient's flag
final int finalRecipientId = CoalesceUtil.firstGreaterThanZero(order.getDropShip_BPartner_ID(), order.getC_BPartner_ID());
final I_C_BPartner finalRecipient = InterfaceWrapperHelper.load(finalRecipientId, I_C_BPartner.class);
final int handOverRecipientId = CoalesceUtil.firstGreaterThanZero(order.getHandOver_Partner_ID(), order.getC_BPartner_ID());
final I_C_BPartner handOverRecipient = InterfaceWrapperHelper.load(handOverRecipientId, I_C_BPartner.class);
if (!finalRecipient.isEdiDesadvRecipient() && !handOverRecipient.isEdiDesadvRecipient())
{
ediDocumentBL.setEdiEnabled(inout, false);
return;
}
ediDocumentBL.setEdiEnabled(inout, order.isEdiEnabled());
}
/**
* If the given <code>inOut</code> is OK to be send as EDI, then we add it to a {@link de.metas.esb.edi.model.I_EDI_Desadv}.
* <p>
* Note that if the EDI-status changes to something else later on, the inOut shall remain assigned. Its not this MV's problem.
*/
@DocValidate(timings = ModelValidator.TIMING_BEFORE_COMPLETE)
public void addToDesadv(final I_M_InOut inOut)
{
if (Services.get(IHUInOutBL.class).isCustomerReturn(inOut))
{
// no EDI for customer return (for the time being)
return;
}
final IEDIDocumentBL ediDocumentBL = Services.get(IEDIDocumentBL.class);
if (!ediDocumentBL.updateEdiEnabled(inOut))
{
return;
} | if (inOut.getEDI_Desadv_ID() <= 0
&& Check.isNotBlank(inOut.getPOReference())) // task 08619: only try if we have a POReference and thus can succeed
{
Services.get(IDesadvBL.class).addToDesadvCreateForInOutIfNotExist(inOut);
}
}
/**
* Calls {@link IDesadvBL#removeInOutFromDesadv(I_M_InOut)} to detach the given inout from it's desadv (if any) when it is reversed, reactivated etc. Also see
* {@link de.metas.handlingunits.model.validator.M_InOut#assertReActivationAllowed(org.compiere.model.I_M_InOut)}. Note that this method will also be fired if the inout's <code>C_Order</code> is reactivated.
*/
@DocValidate(timings = { ModelValidator.TIMING_BEFORE_REACTIVATE,
ModelValidator.TIMING_BEFORE_REVERSEACCRUAL,
ModelValidator.TIMING_BEFORE_REVERSECORRECT,
ModelValidator.TIMING_BEFORE_VOID })
public void removeFromDesadv(final I_M_InOut inOut)
{
if (inOut.getEDI_Desadv_ID() > 0)
{
Services.get(IDesadvBL.class).removeInOutFromDesadv(inOut);
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.edi\src\main\java\de\metas\edi\model\validator\M_InOut.java | 1 |
请完成以下Java代码 | public class User {
private static SecretKeySpec KEY = initKey();
static SecretKeySpec initKey(){
try {
SecretKey secretKey = KeyGenerator.getInstance("AES").generateKey();
return new SecretKeySpec(secretKey.getEncoded(), "AES");
} catch (NoSuchAlgorithmException ex) {
return null;
}
}
private String id;
private String name;
private String password;
private List<Role> roles;
public User(String name, String password, List<Role> roles) {
this.name = Objects.requireNonNull(name);
this.password = this.encrypt(password);
this.roles = Objects.requireNonNull(roles);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
} | public void setPassword(String password) {
this.password = password;
}
public void addRole(Role role) {
roles.add(role);
}
public List<Role> getRoles() {
return Collections.unmodifiableList(roles);
}
public String getId() {
return id;
}
void setId(String id) {
this.id = id;
}
String encrypt(String password) {
Objects.requireNonNull(password);
try {
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, KEY);
final byte[] encryptedBytes = cipher.doFinal(password.getBytes(StandardCharsets.UTF_8));
return new String(encryptedBytes, StandardCharsets.UTF_8);
} catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException e) {
// do nothing
return "";
}
}
} | repos\tutorials-master\patterns-modules\design-patterns-architectural\src\main\java\com\baeldung\dtopattern\domain\User.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class NettyServer {
static final Logger log = LoggerFactory.getLogger(NettyServer.class);
/**
* 端口号
*/
@Value("${webSocket.netty.port:8889}")
int port;
EventLoopGroup bossGroup;
EventLoopGroup workGroup;
@Autowired
ProjectInitializer nettyInitializer;
@PostConstruct
public void start() throws InterruptedException {
new Thread(() -> {
bossGroup = new NioEventLoopGroup();
workGroup = new NioEventLoopGroup();
ServerBootstrap bootstrap = new ServerBootstrap();
// bossGroup辅助客户端的tcp连接请求, workGroup负责与客户端之前的读写操作
bootstrap.group(bossGroup, workGroup);
// 设置NIO类型的channel
bootstrap.channel(NioServerSocketChannel.class);
// 设置监听端口
bootstrap.localAddress(new InetSocketAddress(port));
// 设置管道
bootstrap.childHandler(nettyInitializer); | // 配置完成,开始绑定server,通过调用sync同步方法阻塞直到绑定成功
ChannelFuture channelFuture = null;
try {
channelFuture = bootstrap.bind().sync();
log.info("Server started and listen on:{}", channelFuture.channel().localAddress());
// 对关闭通道进行监听
channelFuture.channel().closeFuture().sync();
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
}
/**
* 释放资源
*/
@PreDestroy
public void destroy() throws InterruptedException {
if (bossGroup != null) {
bossGroup.shutdownGracefully().sync();
}
if (workGroup != null) {
workGroup.shutdownGracefully().sync();
}
}
} | repos\springboot-demo-master\netty\src\main\java\com\et\netty\server\NettyServer.java | 2 |
请完成以下Java代码 | public boolean isExcludeAlreadyExported()
{
return get_ValueAsBoolean(COLUMNNAME_IsExcludeAlreadyExported);
}
@Override
public void setIsNegateInboundAmounts (final boolean IsNegateInboundAmounts)
{
set_Value (COLUMNNAME_IsNegateInboundAmounts, IsNegateInboundAmounts);
}
@Override
public boolean isNegateInboundAmounts()
{
return get_ValueAsBoolean(COLUMNNAME_IsNegateInboundAmounts);
}
@Override
public void setIsPlaceBPAccountsOnCredit (final boolean IsPlaceBPAccountsOnCredit)
{
set_Value (COLUMNNAME_IsPlaceBPAccountsOnCredit, IsPlaceBPAccountsOnCredit);
}
@Override
public boolean isPlaceBPAccountsOnCredit()
{
return get_ValueAsBoolean(COLUMNNAME_IsPlaceBPAccountsOnCredit);
}
/**
* IsSOTrx AD_Reference_ID=319
* Reference name: _YesNo
*/
public static final int ISSOTRX_AD_Reference_ID=319;
/** Yes = Y */
public static final String ISSOTRX_Yes = "Y";
/** No = N */ | public static final String ISSOTRX_No = "N";
@Override
public void setIsSOTrx (final @Nullable java.lang.String IsSOTrx)
{
set_Value (COLUMNNAME_IsSOTrx, IsSOTrx);
}
@Override
public java.lang.String getIsSOTrx()
{
return get_ValueAsString(COLUMNNAME_IsSOTrx);
}
@Override
public void setIsSwitchCreditMemo (final boolean IsSwitchCreditMemo)
{
set_Value (COLUMNNAME_IsSwitchCreditMemo, IsSwitchCreditMemo);
}
@Override
public boolean isSwitchCreditMemo()
{
return get_ValueAsBoolean(COLUMNNAME_IsSwitchCreditMemo);
}
@Override
public void setProcessed (final boolean Processed)
{
set_Value (COLUMNNAME_Processed, Processed);
}
@Override
public boolean isProcessed()
{
return get_ValueAsBoolean(COLUMNNAME_Processed);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.datev\src\main\java-gen\de\metas\datev\model\X_DATEV_Export.java | 1 |
请完成以下Java代码 | public Attribute getByIdOrNull(final @NotNull AttributeId id)
{
return attributesById.get(id);
}
@NonNull
public Set<Attribute> getByIds(@NonNull final Collection<AttributeId> ids)
{
if (ids.isEmpty()) {return ImmutableSet.of();}
return ids.stream()
.distinct()
.map(this::getById)
.collect(ImmutableSet.toImmutableSet());
}
@NonNull
public AttributeId getIdByCode(@NonNull final AttributeCode attributeCode)
{
return getByCode(attributeCode).getAttributeId();
}
public Set<Attribute> getByCodes(final Set<AttributeCode> attributeCodes)
{
if (attributeCodes.isEmpty()) {return ImmutableSet.of();}
return attributeCodes.stream()
.distinct()
.map(this::getByCode)
.collect(ImmutableSet.toImmutableSet());
}
@NonNull
public ImmutableList<AttributeCode> getOrderedAttributeCodesByIds(@NonNull final List<AttributeId> orderedAttributeIds)
{
if (orderedAttributeIds.isEmpty())
{
return ImmutableList.of();
}
return orderedAttributeIds.stream() | .map(this::getById)
.filter(Attribute::isActive)
.map(Attribute::getAttributeCode)
.collect(ImmutableList.toImmutableList());
}
public Stream<Attribute> streamActive()
{
return attributesById.values().stream().filter(Attribute::isActive);
}
public boolean isActiveAttribute(final AttributeId id)
{
final Attribute attribute = getByIdOrNull(id);
return attribute != null && attribute.isActive();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\org\adempiere\mm\attributes\api\impl\AttributesMap.java | 1 |
请完成以下Java代码 | public void debugException(Throwable throwable) {
logDebug(
"002",
"Exception while closing command context: {}",throwable.getMessage(), throwable);
}
public void infoException(Throwable throwable) {
logInfo(
"003",
"Exception while closing command context: {}",throwable.getMessage(), throwable);
}
public void errorException(Throwable throwable) {
logError(
"004",
"Exception while closing command context: {}",throwable.getMessage(), throwable); | }
public void exceptionWhileInvokingOnCommandFailed(Throwable t) {
logError(
"005",
"Exception while invoking onCommandFailed()", t);
}
public void bpmnStackTrace(String string) {
log(Context.getProcessEngineConfiguration().getLogLevelBpmnStackTrace(),
"006",
string);
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\interceptor\ContextLogger.java | 1 |
请完成以下Java代码 | public class AccessInterceptor implements HandlerInterceptor {
/**
* 请求拦截器
* preHandle:在业务处理器处理请求之前被调用。预处理,可以进行编码、安全控制、权限校验等处理;
* postHandle:在业务处理器处理请求执行完成后,生成视图之前执行。后处理(调用了Service并返回ModelAndView,但未进行页面渲染),有机会修改ModelAndView (这个博主就基本不怎么用了);
* afterCompletion:在DispatcherServlet完全处理完请求后被调用,可用于清理资源等。返回处理(已经渲染了页面);
* 验证用户登录权限
* @param request current HTTP request
* @param response current HTTP response
* @param handler chosen handler to execute, for type and/or instance evaluation
* @return
* @throws Exception
*/
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
log.info("AccessInterceptor preHandle");
Enumeration<String> headerNames = request.getHeaderNames();
while(headerNames.hasMoreElements()) {
String name = (String)headerNames.nextElement();
System.out.println(name+": "+ request.getHeader(name));
} | return HandlerInterceptor.super.preHandle(request, response, handler);
}
// @Override
// public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
// log.info("AccessInterceptor postHandle");
// HandlerInterceptor.super.postHandle(request, response, handler, modelAndView);
// }
//
// @Override
// public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
// log.info("AccessInterceptor afterCompletion");
// HandlerInterceptor.super.afterCompletion(request, response, handler, ex);
// }
} | repos\spring-boot-quick-master\quick-spring-shiro\src\main\java\com\shiro\shiro\interceptor\AccessInterceptor.java | 1 |
请完成以下Java代码 | public class TbStopWatch extends StopWatch {
public static TbStopWatch create(){
TbStopWatch stopWatch = new TbStopWatch();
stopWatch.start();
return stopWatch;
}
public static TbStopWatch create(String taskName){
TbStopWatch stopWatch = new TbStopWatch();
stopWatch.start(taskName);
return stopWatch;
}
public void startNew(String taskName){
stop();
start(taskName);
}
public long stopAndGetTotalTimeMillis(){
stop();
return getTotalTimeMillis();
}
public long stopAndGetTotalTimeNanos(){ | stop();
return getLastTaskTimeNanos();
}
public long stopAndGetLastTaskTimeMillis(){
stop();
return getLastTaskTimeMillis();
}
public long stopAndGetLastTaskTimeNanos(){
stop();
return getLastTaskTimeNanos();
}
} | repos\thingsboard-master\common\util\src\main\java\org\thingsboard\common\util\TbStopWatch.java | 1 |
请完成以下Spring Boot application配置 | test:
hostport: httpbin.org:80
# hostport: localhost:5000
uri: http://${test.hostport}
#uri: lb://httpbin
spring:
cloud:
gateway.server.webflux:
filter:
default-filters:
#- PrefixPath=/httpbin
#- AddResponseHeader=X-Response-Default-Foo, Default-Bar
routes:
# =====================================
# to run server
# $ wscat --listen 9000
# to run client
# $ wscat --connect ws://localhost:8080/echo
- id: websocket_test
uri: ws://localhost:9000
order: 9000
predicates:
- Path=/echo
# =====================================
- id: default_path_to_httpbin_secureheaders
uri: ${test.uri}
order: 10000
predicates:
- Path=/**
filters:
- name: SecureHeaders
args:
disable: x-frame-op | tions
enable: permissions-policy
permissions-policy : geolocation=("https://example.net")
logging:
level:
org.springframework.cloud.gateway: TRACE
org.springframework.http.server.reactive: DEBUG
org.springframework.web.reactive: DEBUG
reactor.ipc.netty: DEBUG
reactor.netty: DEBUG
management.endpoints.web.exposure.include: '*' | repos\spring-cloud-gateway-main\spring-cloud-gateway-sample\src\main\resources\application-secureheaders.yml | 2 |
请完成以下Java代码 | public MigratingDependentInstanceParseHandler<MigratingTransitionInstance, List<JobEntity>> getDependentTransitionInstanceJobHandler() {
return dependentTransitionInstanceJobHandler;
}
public MigratingInstanceParseHandler<IncidentEntity> getIncidentHandler() {
return incidentHandler;
}
public MigratingDependentInstanceParseHandler<MigratingProcessElementInstance, List<VariableInstanceEntity>> getDependentVariablesHandler() {
return dependentVariableHandler;
}
protected List<ExecutionEntity> fetchExecutions(CommandContext commandContext, String processInstanceId) {
return commandContext.getExecutionManager().findExecutionsByProcessInstanceId(processInstanceId);
}
protected List<EventSubscriptionEntity> fetchEventSubscriptions(CommandContext commandContext, String processInstanceId) {
return commandContext.getEventSubscriptionManager().findEventSubscriptionsByProcessInstanceId(processInstanceId);
}
protected List<ExternalTaskEntity> fetchExternalTasks(CommandContext commandContext, String processInstanceId) {
return commandContext.getExternalTaskManager().findExternalTasksByProcessInstanceId(processInstanceId);
}
protected List<JobEntity> fetchJobs(CommandContext commandContext, String processInstanceId) {
return commandContext.getJobManager().findJobsByProcessInstanceId(processInstanceId);
} | protected List<IncidentEntity> fetchIncidents(CommandContext commandContext, String processInstanceId) {
return commandContext.getIncidentManager().findIncidentsByProcessInstance(processInstanceId);
}
protected List<TaskEntity> fetchTasks(CommandContext commandContext, String processInstanceId) {
return commandContext.getTaskManager().findTasksByProcessInstanceId(processInstanceId);
}
protected List<JobDefinitionEntity> fetchJobDefinitions(CommandContext commandContext, String processDefinitionId) {
return commandContext.getJobDefinitionManager().findByProcessDefinitionId(processDefinitionId);
}
protected List<VariableInstanceEntity> fetchVariables(CommandContext commandContext, String processInstanceId) {
return commandContext.getVariableInstanceManager().findVariableInstancesByProcessInstanceId(processInstanceId);
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\migration\instance\parser\MigratingInstanceParser.java | 1 |
请完成以下Java代码 | public static CaseInstanceHelper getCaseInstanceHelper() {
return getCaseInstanceHelper(getCommandContext());
}
public static CaseInstanceHelper getCaseInstanceHelper(CommandContext commandContext) {
return getCmmnEngineConfiguration(commandContext).getCaseInstanceHelper();
}
public static CommandContext getCommandContext() {
return Context.getCommandContext();
}
public static DmnEngineConfigurationApi getDmnEngineConfiguration(CommandContext commandContext) {
return (DmnEngineConfigurationApi) commandContext.getEngineConfigurations().get(EngineConfigurationConstants.KEY_DMN_ENGINE_CONFIG);
} | public static DmnDecisionService getDmnRuleService(CommandContext commandContext) {
DmnEngineConfigurationApi dmnEngineConfiguration = getDmnEngineConfiguration(commandContext);
if (dmnEngineConfiguration == null) {
throw new FlowableException("Dmn engine is not configured");
}
return dmnEngineConfiguration.getDmnDecisionService();
}
public static InternalTaskAssignmentManager getInternalTaskAssignmentManager(CommandContext commandContext) {
return getCmmnEngineConfiguration(commandContext).getTaskServiceConfiguration().getInternalTaskAssignmentManager();
}
public static InternalTaskAssignmentManager getInternalTaskAssignmentManager() {
return getInternalTaskAssignmentManager(getCommandContext());
}
} | repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\util\CommandContextUtil.java | 1 |
请完成以下Java代码 | public BigDecimal getOldCostPrice()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_OldCostPrice);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQty (final BigDecimal Qty)
{
set_Value (COLUMNNAME_Qty, Qty);
}
@Override
public BigDecimal getQty()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty);
return bd != null ? bd : BigDecimal.ZERO;
}
/**
* RevaluationType AD_Reference_ID=541641
* Reference name: M_CostRevaluation_Detail_RevaluationType
*/
public static final int REVALUATIONTYPE_AD_Reference_ID=541641;
/** CurrentCostBeforeRevaluation = CCB */
public static final String REVALUATIONTYPE_CurrentCostBeforeRevaluation = "CCB";
/** CurrentCostAfterRevaluation = CCA */
public static final String REVALUATIONTYPE_CurrentCostAfterRevaluation = "CCA";
/** CostDetailAdjustment = CDA */
public static final String REVALUATIONTYPE_CostDetailAdjustment = "CDA";
@Override
public void setRevaluationType (final java.lang.String RevaluationType)
{
set_Value (COLUMNNAME_RevaluationType, RevaluationType); | }
@Override
public java.lang.String getRevaluationType()
{
return get_ValueAsString(COLUMNNAME_RevaluationType);
}
@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_M_CostRevaluation_Detail.java | 1 |
请完成以下Java代码 | public BigDecimal getPriceList()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PriceList);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setPriceStd (final BigDecimal PriceStd)
{
set_Value (COLUMNNAME_PriceStd, PriceStd);
}
@Override
public BigDecimal getPriceStd()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PriceStd);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setValidFrom (final java.sql.Timestamp ValidFrom)
{
set_Value (COLUMNNAME_ValidFrom, ValidFrom); | }
@Override
public java.sql.Timestamp getValidFrom()
{
return get_ValueAsTimestamp(COLUMNNAME_ValidFrom);
}
@Override
public void setValidTo (final java.sql.Timestamp ValidTo)
{
set_Value (COLUMNNAME_ValidTo, ValidTo);
}
@Override
public java.sql.Timestamp getValidTo()
{
return get_ValueAsTimestamp(COLUMNNAME_ValidTo);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Campaign_Price.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class Student {
@Id
@GeneratedValue
private Long id;
private String firstName;
private String lastName;
public Student() {
}
public Student(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getFirstName() {
return firstName; | }
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
@Override
public String toString() {
return "Student{" + "id=" + id + ", firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + '}';
}
} | repos\tutorials-master\persistence-modules\spring-boot-persistence-3\src\main\java\com\baeldung\largeresultset\Student.java | 2 |
请完成以下Java代码 | public void beforeMobileApplicationTrlChanged(final I_Mobile_Application_Trl mobileApplicationTrl)
{
assertNotChangingRegularAndCustomizationFields(mobileApplicationTrl);
}
@ModelChange(timings = ModelValidator.TYPE_AFTER_CHANGE)
public void afterMobileApplicationTrlChanged(final I_Mobile_Application_Trl mobileApplicationTrl)
{
final MobileApplicationRepoId mobileApplicationRepoId = MobileApplicationRepoId.ofRepoId(mobileApplicationTrl.getMobile_Application_ID());
final String adLanguage = mobileApplicationTrl.getAD_Language();
mobileApplicationInfoRepository.updateMobileApplicationTrl(mobileApplicationRepoId, adLanguage);
}
private static void assertNotChangingRegularAndCustomizationFields(final I_Mobile_Application_Trl mobileApplicationTrl)
{
final Set<String> changedRegularFields = new HashSet<>();
final Set<String> changedCustomizationFields = new HashSet<>();
if (isValueChanged(mobileApplicationTrl, I_Mobile_Application_Trl.COLUMNNAME_IsUseCustomization))
{
changedCustomizationFields.add(I_Mobile_Application_Trl.COLUMNNAME_IsUseCustomization);
}
//
for (final MobileApplicationTranslatedColumn field : MobileApplicationTranslatedColumn.values())
{
if (field.hasCustomizedField() && isValueChanged(mobileApplicationTrl, field.getCustomizationColumnName()))
{
changedCustomizationFields.add(field.getCustomizationColumnName());
}
if (isValueChanged(mobileApplicationTrl, field.getColumnName()))
{
changedRegularFields.add(field.getColumnName());
}
}
//
if (!changedRegularFields.isEmpty() && !changedCustomizationFields.isEmpty())
{
throw new AdempiereException("Changing regular fields and customization fields is not allowed."
+ "\n Regular fields changed: " + changedRegularFields
+ "\n Customization fields changed: " + changedCustomizationFields)
.markAsUserValidationError();
}
} | private static boolean isValueChanged(final I_Mobile_Application_Trl mobileApplicationTrl, final String columnName)
{
return InterfaceWrapperHelper.isValueChanged(mobileApplicationTrl, columnName);
}
private enum MobileApplicationTranslatedColumn
{
Name(I_Mobile_Application_Trl.COLUMNNAME_Name, I_Mobile_Application_Trl.COLUMNNAME_Name_Customized), //
Description(I_Mobile_Application_Trl.COLUMNNAME_Description, I_Mobile_Application_Trl.COLUMNNAME_Description_Customized), //
;
@Getter
private final String columnName;
@Getter
private final String customizationColumnName;
MobileApplicationTranslatedColumn(
@NonNull final String columnName,
@Nullable final String customizationColumnName)
{
this.columnName = columnName;
this.customizationColumnName = customizationColumnName;
}
public boolean hasCustomizedField()
{
return getCustomizationColumnName() != null;
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\translation\interceptor\Mobile_Application_Trl.java | 1 |
请完成以下Java代码 | public final class UserSpecificationsBuilder {
private final List<SpecSearchCriteria> params;
public UserSpecificationsBuilder() {
params = new ArrayList<>();
}
// API
public final UserSpecificationsBuilder with(final String key, final String operation, final Object value, final String prefix, final String suffix) {
return with(null, key, operation, value, prefix, suffix);
}
public final UserSpecificationsBuilder with(final String orPredicate, final String key, final String operation, final Object value, final String prefix, final String suffix) {
SearchOperation op = SearchOperation.getSimpleOperation(operation.charAt(0));
if (op != null) {
if (op == SearchOperation.EQUALITY) { // the operation may be complex operation
final boolean startWithAsterisk = prefix != null && prefix.contains(SearchOperation.ZERO_OR_MORE_REGEX);
final boolean endWithAsterisk = suffix != null && suffix.contains(SearchOperation.ZERO_OR_MORE_REGEX);
if (startWithAsterisk && endWithAsterisk) {
op = SearchOperation.CONTAINS;
} else if (startWithAsterisk) {
op = SearchOperation.ENDS_WITH;
} else if (endWithAsterisk) {
op = SearchOperation.STARTS_WITH;
}
}
params.add(new SpecSearchCriteria(orPredicate, key, op, value));
}
return this;
}
public Specification<User> build() {
if (params.size() == 0)
return null; | Specification<User> result = new UserSpecification(params.get(0));
for (int i = 1; i < params.size(); i++) {
result = params.get(i).isOrPredicate()
? Specification.where(result).or(new UserSpecification(params.get(i)))
: Specification.where(result).and(new UserSpecification(params.get(i)));
}
return result;
}
public final UserSpecificationsBuilder with(UserSpecification spec) {
params.add(spec.getCriteria());
return this;
}
public final UserSpecificationsBuilder with(SpecSearchCriteria criteria) {
params.add(criteria);
return this;
}
} | repos\tutorials-master\spring-web-modules\spring-rest-query-language\src\main\java\com\baeldung\persistence\dao\UserSpecificationsBuilder.java | 1 |
请完成以下Java代码 | public nobr addElement(String hashcode,Element element)
{
addElementToRegistry(hashcode,element);
return(this);
}
/**
Adds an Element to the element.
@param hashcode name of element for hash table
@param element Adds an Element to the element.
*/
public nobr addElement(String hashcode,String element)
{
addElementToRegistry(hashcode,element);
return(this);
}
/**
Adds an Element to the element.
@param element Adds an Element to the element.
*/
public nobr addElement(Element element)
{
addElementToRegistry(element);
return(this);
} | /**
Adds an Element to the element.
@param element Adds an Element to the element.
*/
public nobr addElement(String element)
{
addElementToRegistry(element);
return(this);
}
/**
Removes an Element from the element.
@param hashcode the name of the element to be removed.
*/
public nobr removeElement(String hashcode)
{
removeElementFromRegistry(hashcode);
return(this);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\tools\src\main\java-legacy\org\apache\ecs\xhtml\nobr.java | 1 |
请完成以下Java代码 | private void performNestedProcessInvocation(@NonNull final InvoiceId invoiceId)
{
final StringBuilder logMessage = new StringBuilder("Export C_Invoice_ID={} ==>").append(invoiceId.getRepoId());
try
{
final ProcessExecutor processExecutor = ProcessInfo
.builder()
.setProcessCalledFrom(getProcessInfo().getProcessCalledFrom())
.setAD_ProcessByClassname(C_Invoice_EDI_Export_JSON.class.getName())
.addParameter(PARAM_C_INVOICE_ID, invoiceId.getRepoId())
.setRecord(I_C_Invoice.Table_Name, invoiceId.getRepoId()) // will be stored in the AD_Pinstance
.buildAndPrepareExecution()
.executeSync();
final ProcessExecutionResult result = processExecutor.getResult();
final String summary = result.getSummary();
if (MSG_OK.equals(summary))
countExported++;
else
countErrors++;
logMessage.append("AD_PInstance_ID=").append(PInstanceId.toRepoId(processExecutor.getProcessInfo().getPinstanceId()))
.append("; Summary=").append(summary);
}
catch (final Exception e)
{
final AdIssueId issueId = errorManager.createIssue(e);
logMessage
.append("Failed with AD_Issue_ID=").append(issueId.getRepoId())
.append("; Exception: ").append(e.getMessage());
countErrors++;
} | finally
{
addLog(logMessage.toString());
}
}
@NonNull
private Stream<InvoiceId> retrieveValidSelectedDocuments()
{
return createSelectedInvoicesQueryBuilder()
.addOnlyActiveRecordsFilter()
.addEqualsFilter(org.compiere.model.I_C_Invoice.COLUMNNAME_IsSOTrx, true)
.addEqualsFilter(org.compiere.model.I_C_Invoice.COLUMNNAME_DocStatus, I_C_Invoice.DOCSTATUS_Completed)
.addEqualsFilter(I_C_Invoice.COLUMNNAME_IsEdiEnabled, true)
.addEqualsFilter(I_C_Invoice.COLUMNNAME_EDI_ExportStatus, I_EDI_Document.EDI_EXPORTSTATUS_Pending)
.create()
.iterateAndStreamIds(InvoiceId::ofRepoId);
}
protected IQueryBuilder<I_C_Invoice> createSelectedInvoicesQueryBuilder()
{
return queryBL
.createQueryBuilder(I_C_Invoice.class)
.filter(getProcessInfo().getQueryFilterOrElseFalse());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.edi\src\main\java\de\metas\edi\process\export\json\C_Invoice_Selection_Export_JSON.java | 1 |
请完成以下Java代码 | public String toString()
{
return "MDesktop ID=" + AD_Desktop_ID + " " + Name;
}
/**************************************************************************
* Get AD_Desktop_ID
* @return desktop
*/
public int getAD_Desktop_ID()
{
return AD_Desktop_ID;
}
/**
* Get Name
* @return name
*/
public String getName()
{
return Name;
}
/**
* Get Description
* @return description
*/
public String getDescription()
{
return Description;
}
/**
* Get Help
* @return help
*/
public String getHelp()
{
return Help;
}
/**
* Get AD_Column_ID
* @return column
*/
public int getAD_Column_ID()
{
return AD_Column_ID;
}
/**
* Get AD_Image_ID
* @return image
*/
public int getAD_Image_ID()
{
return AD_Image_ID;
}
/**
* Get AD_Color_ID
* @return color
*/
public int getAD_Color_ID()
{
return AD_Color_ID;
}
/**
* Get PA_Goal_ID
* @return goal
*/
public int getPA_Goal_ID()
{
return PA_Goal_ID;
}
/*************************************************************************/ | /**
* Init Workbench Windows
* @return true if initilized
*/
private boolean initDesktopWorkbenches()
{
String sql = "SELECT AD_Workbench_ID "
+ "FROM AD_DesktopWorkbench "
+ "WHERE AD_Desktop_ID=? AND IsActive='Y' "
+ "ORDER BY SeqNo";
try
{
PreparedStatement pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, AD_Desktop_ID);
ResultSet rs = pstmt.executeQuery();
while (rs.next())
{
int AD_Workbench_ID = rs.getInt(1);
m_workbenches.add (new Integer(AD_Workbench_ID));
}
rs.close();
pstmt.close();
}
catch (SQLException e)
{
log.error("MWorkbench.initDesktopWorkbenches", e);
return false;
}
return true;
} // initDesktopWorkbenches
/**
* Get Window Count
* @return no of windows
*/
public int getWindowCount()
{
return m_workbenches.size();
} // getWindowCount
/**
* Get AD_Workbench_ID of index
* @param index index
* @return -1 if not valid
*/
public int getAD_Workbench_ID (int index)
{
if (index < 0 || index > m_workbenches.size())
return -1;
Integer id = (Integer)m_workbenches.get(index);
return id.intValue();
} // getAD_Workbench_ID
} // MDesktop | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MDesktop.java | 1 |
请完成以下Java代码 | public class StructuredRemittanceInformationSEPA1 {
@XmlElement(name = "CdtrRefInf")
protected CreditorReferenceInformationSEPA1 cdtrRefInf;
/**
* Gets the value of the cdtrRefInf property.
*
* @return
* possible object is
* {@link CreditorReferenceInformationSEPA1 }
*
*/
public CreditorReferenceInformationSEPA1 getCdtrRefInf() {
return cdtrRefInf; | }
/**
* Sets the value of the cdtrRefInf property.
*
* @param value
* allowed object is
* {@link CreditorReferenceInformationSEPA1 }
*
*/
public void setCdtrRefInf(CreditorReferenceInformationSEPA1 value) {
this.cdtrRefInf = value;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.payment.sepa\schema-pain_008_003_02\src\main\java-xjc\de\metas\payment\sepa\jaxb\sct\pain_008_003_02\StructuredRemittanceInformationSEPA1.java | 1 |
请完成以下Java代码 | public void setResourceType(String resourceType) {
this.resourceType = resourceType;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getPermission() {
return permission;
}
public void setPermission(String permission) {
this.permission = permission;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public String getParentIds() { | return parentIds;
}
public void setParentIds(String parentIds) {
this.parentIds = parentIds;
}
public Boolean getAvailable() {
return available;
}
public void setAvailable(Boolean available) {
this.available = available;
}
public List<SysRole> getRoles() {
return roles;
}
public void setRoles(List<SysRole> roles) {
this.roles = roles;
}
} | repos\springboot-demo-master\shiro\src\main\java\com\et\shiro\entity\SysPermission.java | 1 |
请完成以下Java代码 | public String getRootProcessInstanceId() {
return rootProcessInstanceId;
}
public void setRootProcessInstanceId(String rootProcessInstanceId) {
this.rootProcessInstanceId = rootProcessInstanceId;
}
public String getRestartedProcessInstanceId() {
return restartedProcessInstanceId;
}
public void setRestartedProcessInstanceId(String restartedProcessInstanceId) {
this.restartedProcessInstanceId = restartedProcessInstanceId;
}
public static HistoricProcessInstanceDto fromHistoricProcessInstance(HistoricProcessInstance historicProcessInstance) {
HistoricProcessInstanceDto dto = new HistoricProcessInstanceDto();
dto.id = historicProcessInstance.getId();
dto.businessKey = historicProcessInstance.getBusinessKey();
dto.processDefinitionId = historicProcessInstance.getProcessDefinitionId();
dto.processDefinitionKey = historicProcessInstance.getProcessDefinitionKey(); | dto.processDefinitionName = historicProcessInstance.getProcessDefinitionName();
dto.processDefinitionVersion = historicProcessInstance.getProcessDefinitionVersion();
dto.startTime = historicProcessInstance.getStartTime();
dto.endTime = historicProcessInstance.getEndTime();
dto.removalTime = historicProcessInstance.getRemovalTime();
dto.durationInMillis = historicProcessInstance.getDurationInMillis();
dto.startUserId = historicProcessInstance.getStartUserId();
dto.startActivityId = historicProcessInstance.getStartActivityId();
dto.deleteReason = historicProcessInstance.getDeleteReason();
dto.rootProcessInstanceId = historicProcessInstance.getRootProcessInstanceId();
dto.superProcessInstanceId = historicProcessInstance.getSuperProcessInstanceId();
dto.superCaseInstanceId = historicProcessInstance.getSuperCaseInstanceId();
dto.caseInstanceId = historicProcessInstance.getCaseInstanceId();
dto.tenantId = historicProcessInstance.getTenantId();
dto.state = historicProcessInstance.getState();
dto.restartedProcessInstanceId = historicProcessInstance.getRestartedProcessInstanceId();
return dto;
}
} | repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\history\HistoricProcessInstanceDto.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public DataSourceProperties usersDataSourceProperties() {
return new DataSourceProperties();
}
/**
* 创建 users 数据源
*/
@Bean(name = "usersDataSource")
@ConfigurationProperties(prefix = "spring.datasource.users.hikari")
public DataSource usersDataSource() {
// 获得 DataSourceProperties 对象
DataSourceProperties properties = this.usersDataSourceProperties();
// 创建 HikariDataSource 对象
return createHikariDataSource(properties);
}
private static HikariDataSource createHikariDataSource(DataSourceProperties properties) {
// 创建 HikariDataSource 对象 | HikariDataSource dataSource = properties.initializeDataSourceBuilder().type(HikariDataSource.class).build();
// 设置线程池名
if (StringUtils.hasText(properties.getName())) {
dataSource.setPoolName(properties.getName());
}
return dataSource;
}
// /**
// * 创建 orders 数据源
// */
// @Bean(name = "ordersDataSource")
// @ConfigurationProperties(prefix = "spring.datasource.orders")
// public DataSource ordersDataSource() {
// return DataSourceBuilder.create().build();
// }
} | repos\SpringBoot-Labs-master\lab-19\lab-19-datasource-pool-hikaricp-multiple\src\main\java\cn\iocoder\springboot\lab19\datasourcepool\config\DataSourceConfig.java | 2 |
请完成以下Java代码 | public class OAuth2LoginAuthenticationWebFilter extends AuthenticationWebFilter {
private final ServerOAuth2AuthorizedClientRepository authorizedClientRepository;
/**
* Creates an instance
* @param authenticationManager the authentication manager to use
* @param authorizedClientRepository
*/
public OAuth2LoginAuthenticationWebFilter(ReactiveAuthenticationManager authenticationManager,
ServerOAuth2AuthorizedClientRepository authorizedClientRepository) {
super(authenticationManager);
Assert.notNull(authorizedClientRepository, "authorizedClientService cannot be null");
this.authorizedClientRepository = authorizedClientRepository;
}
@Override | protected Mono<Void> onAuthenticationSuccess(Authentication authentication, WebFilterExchange webFilterExchange) {
OAuth2LoginAuthenticationToken authenticationResult = (OAuth2LoginAuthenticationToken) authentication;
OAuth2AuthorizedClient authorizedClient = new OAuth2AuthorizedClient(
authenticationResult.getClientRegistration(), authenticationResult.getName(),
authenticationResult.getAccessToken(), authenticationResult.getRefreshToken());
OAuth2AuthenticationToken result = new OAuth2AuthenticationToken(authenticationResult.getPrincipal(),
authenticationResult.getAuthorities(),
authenticationResult.getClientRegistration().getRegistrationId());
// @formatter:off
return this.authorizedClientRepository
.saveAuthorizedClient(authorizedClient, authenticationResult, webFilterExchange.getExchange())
.then(super.onAuthenticationSuccess(result, webFilterExchange));
// @formatter:on
}
} | repos\spring-security-main\oauth2\oauth2-client\src\main\java\org\springframework\security\oauth2\client\web\server\authentication\OAuth2LoginAuthenticationWebFilter.java | 1 |
请完成以下Java代码 | public boolean isReadOnly(ELContext context) throws ELException {
return node.isReadOnly(bindings, context);
}
/**
* Evaluates the expression as an lvalue and assigns the given value.
* @param context used to resolve properties (<code>base.property</code> and <code>base[property]</code>)
* and to perform the assignment to the last base/property pair
* @throws ELException if evaluation fails (e.g. property not found, type conversion failed, assignment failed...)
*/
@Override
public void setValue(ELContext context, Object value) throws ELException {
node.setValue(bindings, context, value);
}
/**
* @return <code>true</code> if this is a literal text expression
*/
@Override
public boolean isLiteralText() {
return node.isLiteralText();
}
@Override
public ValueReference getValueReference(ELContext context) {
return node.getValueReference(bindings, context);
}
/**
* Answer <code>true</code> if this could be used as an lvalue.
* This is the case for eval expressions consisting of a simple identifier or
* a nonliteral prefix, followed by a sequence of property operators (<code>.</code> or <code>[]</code>)
*/
public boolean isLeftValue() {
return node.isLeftValue();
}
/**
* Answer <code>true</code> if this is a deferred expression (containing
* sub-expressions starting with <code>#{</code>)
*/
public boolean isDeferred() {
return deferred;
}
/**
* Expressions are compared using the concept of a <em>structural id</em>:
* variable and function names are anonymized such that two expressions with
* same tree structure will also have the same structural id and vice versa.
* Two value expressions are equal if
* <ol>
* <li>their structural id's are equal</li>
* <li>their bindings are equal</li>
* <li>their expected types are equal</li>
* </ol>
*/
@Override
public boolean equals(Object obj) {
if (obj != null && obj.getClass() == getClass()) {
TreeValueExpression other = (TreeValueExpression)obj;
if (!builder.equals(other.builder)) {
return false;
}
if (type != other.type) {
return false;
} | return getStructuralId().equals(other.getStructuralId()) && bindings.equals(other.bindings);
}
return false;
}
@Override
public int hashCode() {
return getStructuralId().hashCode();
}
@Override
public String toString() {
return "TreeValueExpression(" + expr + ")";
}
/**
* Print the parse tree.
* @param writer
*/
public void dump(PrintWriter writer) {
NodePrinter.dump(writer, node);
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
try {
node = builder.build(expr).getRoot();
} catch (ELException e) {
throw new IOException(e.getMessage());
}
}
} | repos\camunda-bpm-platform-master\juel\src\main\java\org\camunda\bpm\impl\juel\TreeValueExpression.java | 1 |
请完成以下Java代码 | public ViewRowAttributesLayout getLayout()
{
return layout;
}
@Override
public void processChanges(final List<JSONDocumentChangedEvent> events)
{
throw new UnsupportedOperationException();
}
@Override
public LookupValuesList getAttributeTypeahead(final String attributeName, final String query)
{
throw new UnsupportedOperationException();
// return asiDoc.getFieldLookupValuesForQuery(attributeName, query);
}
@Override
public LookupValuesList getAttributeDropdown(final String attributeName)
{
throw new UnsupportedOperationException();
// return asiDoc.getFieldLookupValues(attributeName);
}
@Override
public JSONViewRowAttributes toJson(final JSONOptions jsonOpts)
{
final JSONViewRowAttributes jsonDocument = new JSONViewRowAttributes(documentPath);
final List<JSONDocumentField> jsonFields = asiDoc.getFieldViews()
.stream() | .map(field -> toJSONDocumentField(field, jsonOpts))
.collect(Collectors.toList());
jsonDocument.setFields(jsonFields);
return jsonDocument;
}
private JSONDocumentField toJSONDocumentField(final IDocumentFieldView field, final JSONOptions jsonOpts)
{
final String fieldName = field.getFieldName();
final Object jsonValue = field.getValueAsJsonObject(jsonOpts);
final DocumentFieldWidgetType widgetType = field.getWidgetType();
return JSONDocumentField.ofNameAndValue(fieldName, jsonValue)
.setDisplayed(true)
.setMandatory(false)
.setReadonly(true)
.setWidgetType(JSONLayoutWidgetType.fromNullable(widgetType));
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\view\ASIViewRowAttributes.java | 1 |
请完成以下Java代码 | public String getProjectValue ()
{
return (String)get_Value(COLUMNNAME_ProjectValue);
}
/** Set Ordered Quantity.
@param QtyOrdered
Ordered Quantity
*/
public void setQtyOrdered (BigDecimal QtyOrdered)
{
set_Value (COLUMNNAME_QtyOrdered, QtyOrdered);
}
/** Get Ordered Quantity.
@return Ordered Quantity
*/
public BigDecimal getQtyOrdered ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyOrdered);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Region.
@param RegionName
Name of the Region
*/
public void setRegionName (String RegionName)
{
set_Value (COLUMNNAME_RegionName, RegionName);
}
/** Get Region.
@return Name of the Region
*/
public String getRegionName ()
{
return (String)get_Value(COLUMNNAME_RegionName);
}
public I_AD_User getSalesRep() throws RuntimeException
{
return (I_AD_User)MTable.get(getCtx(), I_AD_User.Table_Name)
.getPO(getSalesRep_ID(), get_TrxName()); }
/** Set Sales Representative.
@param SalesRep_ID
Sales Representative or Company Agent
*/
public void setSalesRep_ID (int SalesRep_ID)
{
if (SalesRep_ID < 1)
set_Value (COLUMNNAME_SalesRep_ID, null);
else
set_Value (COLUMNNAME_SalesRep_ID, Integer.valueOf(SalesRep_ID));
}
/** Get Sales Representative.
@return Sales Representative or Company Agent
*/
public int getSalesRep_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SalesRep_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set SKU.
@param SKU
Stock Keeping Unit
*/
public void setSKU (String SKU)
{
set_Value (COLUMNNAME_SKU, SKU);
}
/** Get SKU.
@return Stock Keeping Unit | */
public String getSKU ()
{
return (String)get_Value(COLUMNNAME_SKU);
}
/** Set Tax Amount.
@param TaxAmt
Tax Amount for a document
*/
public void setTaxAmt (BigDecimal TaxAmt)
{
set_Value (COLUMNNAME_TaxAmt, TaxAmt);
}
/** Get Tax Amount.
@return Tax Amount for a document
*/
public BigDecimal getTaxAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TaxAmt);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Tax Indicator.
@param TaxIndicator
Short form for Tax to be printed on documents
*/
public void setTaxIndicator (String TaxIndicator)
{
set_Value (COLUMNNAME_TaxIndicator, TaxIndicator);
}
/** Get Tax Indicator.
@return Short form for Tax to be printed on documents
*/
public String getTaxIndicator ()
{
return (String)get_Value(COLUMNNAME_TaxIndicator);
}
/** Set UPC/EAN.
@param UPC
Bar Code (Universal Product Code or its superset European Article Number)
*/
public void setUPC (String UPC)
{
set_Value (COLUMNNAME_UPC, UPC);
}
/** Get UPC/EAN.
@return Bar Code (Universal Product Code or its superset European Article Number)
*/
public String getUPC ()
{
return (String)get_Value(COLUMNNAME_UPC);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_I_Invoice.java | 1 |
请完成以下Java代码 | protected IDatabase createDatabase()
{
return new SQLDatabase(config.getDbUrl(), config.getDbUsername(), config.getDbPassword());
}
@Override
protected ScriptsApplier createScriptApplier(final IDatabase database)
{
final ScriptsApplier scriptApplier = super.createScriptApplier(database);
scriptApplier.setSkipExecutingAfterScripts(config.isSkipExecutingAfterScripts());
return scriptApplier;
}
@Override
protected IScriptsApplierListener createScriptsApplierListener() | {
switch (config.getOnScriptFailure())
{
case FAIL:
return NullScriptsApplierListener.instance;
case ASK:
if (GraphicsEnvironment.isHeadless())
{
return ConsoleScriptsApplierListener.instance;
}
return new SwingUIScriptsApplierListener();
default:
throw new RuntimeException("Unexpected WorkspaceMigrateConfig.onScriptFailure=" + config.getOnScriptFailure());
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.migration\de.metas.migration.cli\src\main\java\de\metas\migration\cli\workspace_migrate\WorkspaceScriptsApplier.java | 1 |
请完成以下Java代码 | private void reload()
{
final UserId userId;
if (m_allNodes)
{
userId = null;
}
else
{
userId = getUserRolePermissions().getUserId();
}
log.trace("Reloaded tree for AD_User_ID={}", userId);
this._rootNode = retrieveRootWithChildren(userId);
}
public final IUserRolePermissions getUserRolePermissions()
{
if (_userRolePermissions == null)
{
return Env.getUserRolePermissions(getCtx());
}
return _userRolePermissions;
}
//
//
//
//
//
public static final class Builder
{
private Properties ctx;
private int AD_Tree_ID;
private boolean editable;
private boolean clientTree;
private boolean allNodes = false;
@Nullable private String trxName = ITrx.TRXNAME_None;
private String adLanguage = null;
private IUserRolePermissions userRolePermissions;
private Builder()
{
super();
}
/**
* Construct & Load Tree
*/
public MTree build()
{
return new MTree(this);
}
public Builder setCtx(final Properties ctx)
{
this.ctx = ctx;
return this;
}
public Properties getCtx()
{
Check.assumeNotNull(ctx, "Parameter ctx is not null");
return ctx;
}
public Builder setUserRolePermissions(final IUserRolePermissions userRolePermissions)
{
this.userRolePermissions = userRolePermissions;
return this;
}
public IUserRolePermissions getUserRolePermissions()
{
if (userRolePermissions == null)
{
return Env.getUserRolePermissions(getCtx());
}
return userRolePermissions;
}
public Builder setAD_Tree_ID(final int AD_Tree_ID)
{
this.AD_Tree_ID = AD_Tree_ID;
return this;
}
public int getAD_Tree_ID()
{
if (AD_Tree_ID <= 0) | {
throw new IllegalArgumentException("Param 'AD_Tree_ID' may not be null");
}
return AD_Tree_ID;
}
public Builder setTrxName(@Nullable final String trxName)
{
this.trxName = trxName;
return this;
}
@Nullable
public String getTrxName()
{
return trxName;
}
/**
* @param editable True, if tree can be modified
* - includes inactive and empty summary nodes
*/
public Builder setEditable(final boolean editable)
{
this.editable = editable;
return this;
}
public boolean isEditable()
{
return editable;
}
/**
* @param clientTree the tree is displayed on the java client (not on web)
*/
public Builder setClientTree(final boolean clientTree)
{
this.clientTree = clientTree;
return this;
}
public boolean isClientTree()
{
return clientTree;
}
public Builder setAllNodes(final boolean allNodes)
{
this.allNodes = allNodes;
return this;
}
public boolean isAllNodes()
{
return allNodes;
}
public Builder setLanguage(final String adLanguage)
{
this.adLanguage = adLanguage;
return this;
}
private String getAD_Language()
{
if (adLanguage == null)
{
return Env.getADLanguageOrBaseLanguage(getCtx());
}
return adLanguage;
}
}
} // MTree | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MTree.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public Long saveCity(City city) {
return cityDao.saveCity(city);
}
/**
* 更新城市逻辑:
* 如果缓存存在,删除
* 如果缓存不存在,不操作
*/
@Override
public Long updateCity(City city) {
Long ret = cityDao.updateCity(city);
// 缓存存在,删除缓存
String key = "city_" + city.getId();
boolean hasKey = redisTemplate.hasKey(key);
if (hasKey) {
redisTemplate.delete(key);
LOGGER.info("CityServiceImpl.updateCity() : 从缓存中删除城市 >> " + city.toString());
}
return ret;
} | @Override
public Long deleteCity(Long id) {
Long ret = cityDao.deleteCity(id);
// 缓存存在,删除缓存
String key = "city_" + id;
boolean hasKey = redisTemplate.hasKey(key);
if (hasKey) {
redisTemplate.delete(key);
LOGGER.info("CityServiceImpl.deleteCity() : 从缓存中删除城市 ID >> " + id);
}
return ret;
}
} | repos\springboot-learning-example-master\springboot-mybatis-redis\src\main\java\org\spring\springboot\service\impl\CityServiceImpl.java | 2 |
请完成以下Java代码 | public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** EntityType AD_Reference_ID=389 */
public static final int ENTITYTYPE_AD_Reference_ID=389;
/** Set Entity Type.
@param EntityType
Dictionary Entity Type; Determines ownership and synchronization
*/
public void setEntityType (String EntityType)
{
set_Value (COLUMNNAME_EntityType, EntityType);
}
/** Get Entity Type.
@return Dictionary Entity Type; Determines ownership and synchronization
*/
public String getEntityType ()
{
return (String)get_Value(COLUMNNAME_EntityType);
}
/** Set Image URL.
@param ImageURL
URL of image
*/
public void setImageURL (String ImageURL)
{
set_Value (COLUMNNAME_ImageURL, ImageURL);
}
/** Get Image URL.
@return URL of image
*/
public String getImageURL ()
{
return (String)get_Value(COLUMNNAME_ImageURL);
} | /** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Image.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class StoreService {
private final ProductRepository productRepository;
private final StoreRepository storeRepository;
public StoreService(ProductRepository productRepository, StoreRepository storeRepository) {
this.productRepository = productRepository;
this.storeRepository = storeRepository;
}
public void updateProductPrice(Integer productId, Double price) {
Optional<Product> productOpt = productRepository.findById(productId);
productOpt.ifPresent(product -> {
product.setPrice(price);
productRepository.save(product);
});
}
public void rebrandStore(int storeId, String updatedName) {
Optional<Store> storeOpt = storeRepository.findById(storeId);
storeOpt.ifPresent(store -> {
store.setName(updatedName);
store.getProducts().forEach(product -> {
product.setNamePrefix(updatedName);
});
storeRepository.save(store); | });
}
public void createRandomProduct(Integer storeId) {
Optional<Store> storeOpt = this.storeRepository.findById(storeId);
storeOpt.ifPresent(store -> {
Random random = new Random();
Product product = new Product("Product#" + random.nextInt(), random.nextDouble() * 100);
store.addProduct(product);
storeRepository.save(store);
});
}
public Store findStoreById(int storeId) {
return storeRepository.findById(storeId).get();
}
public Product findProductById(int id) {
return this.productRepository.findById(id).get();
}
} | repos\tutorials-master\spring-boot-modules\spring-boot-data-2\src\main\java\com\baeldung\javers\service\StoreService.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public String getOpenId() {
return openId;
}
public void setOpenId(String openId) {
this.openId = openId;
}
public String getNotifyUrl() {
return notifyUrl;
}
public void setNotifyUrl(String notifyUrl) {
this.notifyUrl = notifyUrl;
}
@Override
public String toString() { | return "ProgramPayRequestBo{" +
"payKey='" + payKey + '\'' +
", openId='" + openId + '\'' +
", productName='" + productName + '\'' +
", orderNo='" + orderNo + '\'' +
", orderPrice=" + orderPrice +
", orderIp='" + orderIp + '\'' +
", orderDate='" + orderDate + '\'' +
", orderTime='" + orderTime + '\'' +
", notifyUrl='" + notifyUrl + '\'' +
", sign='" + sign + '\'' +
", remark='" + remark + '\'' +
", payType='" + payType + '\'' +
'}';
}
} | repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\trade\bo\ProgramPayRequestBo.java | 2 |
请完成以下Java代码 | public String getProcessInstanceId() {
return processInstanceId;
}
public String getExecutionId() {
return executionId;
}
public boolean getExecutable() {
return executable;
}
public Date getNow() {
return Context.getProcessEngineConfiguration().getClock().getCurrentTime();
}
public boolean isWithException() {
return withException;
}
public String getExceptionMessage() {
return exceptionMessage;
}
public String getTenantId() {
return tenantId;
}
public String getTenantIdLike() {
return tenantIdLike;
}
public boolean isWithoutTenantId() {
return withoutTenantId;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public String getId() {
return id;
} | public String getProcessDefinitionId() {
return processDefinitionId;
}
public boolean isOnlyTimers() {
return onlyTimers;
}
public boolean isOnlyMessages() {
return onlyMessages;
}
public Date getDuedateHigherThan() {
return duedateHigherThan;
}
public Date getDuedateLowerThan() {
return duedateLowerThan;
}
public Date getDuedateHigherThanOrEqual() {
return duedateHigherThanOrEqual;
}
public Date getDuedateLowerThanOrEqual() {
return duedateLowerThanOrEqual;
}
} | repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\DeadLetterJobQueryImpl.java | 1 |
请完成以下Java代码 | private Set<Access> getPermissionsToGrant()
{
final Access permission = getPermissionOrNull();
if (permission == null)
{
throw new FillMandatoryException(PARAM_PermissionCode);
}
if (Access.WRITE.equals(permission))
{
return ImmutableSet.of(Access.READ, Access.WRITE);
}
else
{
return ImmutableSet.of(permission); | }
}
private Access getPermissionOrNull()
{
if (Check.isEmpty(permissionCode))
{
return null;
}
else
{
return Access.ofCode(permissionCode);
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\security\process\UserGroupRecordAccess_Base.java | 1 |
请完成以下Java代码 | private String convertStreamToStr(InputStream is) throws IOException {
if (is != null) {
Writer writer = new StringWriter();
char[] buffer = new char[1024];
try {
Reader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
int n;
while ((n = reader.read(buffer)) != -1) {
writer.write(buffer, 0, n);
}
} finally {
is.close();
}
return writer.toString();
} else {
return "";
}
}
public Boolean getWaitFlag() {
return waitFlag;
}
public void setWaitFlag(Boolean waitFlag) {
this.waitFlag = waitFlag; | }
public Boolean getCleanEnvBoolean() {
return cleanEnvBoolean;
}
public Boolean getRedirectErrorFlag() {
return redirectErrorFlag;
}
public String getDirectoryStr() {
return directoryStr;
}
public String getResultVariableStr() {
return resultVariableStr;
}
public String getErrorCodeVariableStr() {
return errorCodeVariableStr;
}
public List<String> getArgList() {
return argList;
}
} | repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\util\ShellCommandExecutor.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public String getContent() {
return content;
}
/**
* Sets the value of the content property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setContent(String value) {
this.content = value;
}
/**
* Attribute defining the type of article number.
*
* @return
* possible object is
* {@link ArticleNumberTypeType }
*
*/ | public ArticleNumberTypeType getArticleNumberType() {
return articleNumberType;
}
/**
* Sets the value of the articleNumberType property.
*
* @param value
* allowed object is
* {@link ArticleNumberTypeType }
*
*/
public void setArticleNumberType(ArticleNumberTypeType value) {
this.articleNumberType = value;
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\ArticleNumberType.java | 2 |
请完成以下Java代码 | public <T> T getTransientProperty(final String name)
{
@SuppressWarnings("unchecked")
final T value = (T)transientProperties.get(name);
return value;
}
public void putTransientProperty(final String name, final Object value)
{
transientProperties.put(name, value);
}
/**
* Export attributes from session to context.
*
* Used context prefix is {@link #CTX_Prefix}.
*
* Attributes that will be exported to context are: String with FieldLength <= 60.
*
* @return true if context was updated
*/
public boolean updateContext(final Properties ctx)
{
final int sessionId = getAD_Session_ID();
if (sessionId <= 0)
{
log.warn("Cannot update context because session is not saved yet");
return false;
}
if (!sessionPO.isActive())
{
log.debug("Cannot update context because session is not active");
return false;
}
if (isDestroyed())
{
log.debug("Cannot update context because session is destroyed");
return false;
}
//
// If not force, update the context only if the context #AD_Session_ID is same as our session ID.
// Even if there is no value in context, the session won't be updated.
// Keep this logic because we are calling this method on afterSave too.
final int ctxSessionId = Env.getContextAsInt(ctx, Env.CTXNAME_AD_Session_ID);
if (ctxSessionId > 0 && ctxSessionId != sessionId)
{
log.debug("Different AD_Session_ID found in context and force=false.");
} | Env.setContext(ctx, Env.CTXNAME_AD_Session_ID, sessionId);
final PO po = InterfaceWrapperHelper.getStrictPO(sessionPO);
final int cols = po.get_ColumnCount();
for (int i = 0; i < cols; i++)
{
if (!isContextAttribute(i))
{
continue;
}
final String columnName = po.get_ColumnName(i);
final String value = po.get_ValueAsString(columnName);
Env.setContext(ctx, CTX_Prefix + columnName, value);
}
return true;
}
private boolean isContextAttribute(final int columnIndex)
{
if (columnIndex < 0)
{
return false;
}
final PO po = InterfaceWrapperHelper.getStrictPO(sessionPO);
final String columnName = po.get_ColumnName(columnIndex);
if (columnName == null)
{
return false;
}
if (CTX_IgnoredColumnNames.contains(columnName))
{
return false;
}
final POInfo poInfo = po.getPOInfo();
final int displayType = poInfo.getColumnDisplayType(columnIndex);
if (displayType == DisplayType.String)
{
return poInfo.getFieldLength(columnIndex) <= 60;
}
return true;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\session\MFSession.java | 1 |
请完成以下Java代码 | protected org.compiere.model.POInfo initPO(final Properties ctx)
{
return org.compiere.model.POInfo.getPOInfo(Table_Name);
}
@Override
public void setAttributeName (final @Nullable java.lang.String AttributeName)
{
set_ValueNoCheck (COLUMNNAME_AttributeName, AttributeName);
}
@Override
public java.lang.String getAttributeName()
{
return get_ValueAsString(COLUMNNAME_AttributeName);
}
/**
* DocumentName AD_Reference_ID=53258
* Reference name: A_Asset_ID
*/
public static final int DOCUMENTNAME_AD_Reference_ID=53258;
@Override
public void setDocumentName (final @Nullable java.lang.String DocumentName)
{
set_ValueNoCheck (COLUMNNAME_DocumentName, DocumentName);
}
@Override
public java.lang.String getDocumentName()
{
return get_ValueAsString(COLUMNNAME_DocumentName);
}
@Override
public void setDocumentNo (final @Nullable java.lang.String DocumentNo)
{
set_ValueNoCheck (COLUMNNAME_DocumentNo, DocumentNo);
}
@Override
public java.lang.String getDocumentNo()
{
return get_ValueAsString(COLUMNNAME_DocumentNo);
}
@Override
public void setM_Attribute_ID (final int M_Attribute_ID)
{
if (M_Attribute_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Attribute_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Attribute_ID, M_Attribute_ID);
}
@Override
public int getM_Attribute_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Attribute_ID); | }
@Override
public void setM_HU_ID (final int M_HU_ID)
{
if (M_HU_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_HU_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_HU_ID, M_HU_ID);
}
@Override
public int getM_HU_ID()
{
return get_ValueAsInt(COLUMNNAME_M_HU_ID);
}
@Override
public void setPIName (final @Nullable java.lang.String PIName)
{
set_ValueNoCheck (COLUMNNAME_PIName, PIName);
}
@Override
public java.lang.String getPIName()
{
return get_ValueAsString(COLUMNNAME_PIName);
}
@Override
public void setValue (final @Nullable java.lang.String Value)
{
set_ValueNoCheck (COLUMNNAME_Value, Value);
}
@Override
public java.lang.String getValue()
{
return get_ValueAsString(COLUMNNAME_Value);
}
@Override
public void setValueNumber (final @Nullable BigDecimal ValueNumber)
{
set_ValueNoCheck (COLUMNNAME_ValueNumber, ValueNumber);
}
@Override
public BigDecimal getValueNumber()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_ValueNumber);
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_HU_Instance_Properties_v.java | 1 |
请完成以下Java代码 | protected boolean isValidSortByValue(String value) {
return VALID_SORT_BY_VALUES.contains(value);
}
@Override
protected CleanableHistoricProcessInstanceReport createNewQuery(ProcessEngine engine) {
return engine.getHistoryService().createCleanableHistoricProcessInstanceReport();
}
@Override
protected void applyFilters(CleanableHistoricProcessInstanceReport query) {
if (processDefinitionIdIn != null && processDefinitionIdIn.length > 0) {
query.processDefinitionIdIn(processDefinitionIdIn);
}
if (processDefinitionKeyIn != null && processDefinitionKeyIn.length > 0) {
query.processDefinitionKeyIn(processDefinitionKeyIn);
}
if (Boolean.TRUE.equals(withoutTenantId)) {
query.withoutTenantId(); | }
if (tenantIdIn != null && tenantIdIn.length > 0) {
query.tenantIdIn(tenantIdIn);
}
if (Boolean.TRUE.equals(compact)) {
query.compact();
}
}
@Override
protected void applySortBy(CleanableHistoricProcessInstanceReport query, String sortBy, Map<String, Object> parameters, ProcessEngine engine) {
if (sortBy.equals(SORT_BY_FINISHED_VALUE)) {
query.orderByFinished();
}
}
} | repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\history\CleanableHistoricProcessInstanceReportDto.java | 1 |
请完成以下Java代码 | public ClassLoader getOriginalClassLoader() {
return getParent();
}
private URL createFileUrl(String name, ClassLoaderFile file) {
try {
return new URL("reloaded", null, -1, "/" + name, new ClassLoaderFileURLStreamHandler(file));
}
catch (MalformedURLException ex) {
throw new IllegalStateException(ex);
}
}
@Override
public boolean isClassReloadable(Class<?> classType) {
return (classType.getClassLoader() instanceof RestartClassLoader);
}
/**
* Compound {@link Enumeration} that adds an item to the front.
*/
private static class CompoundEnumeration<E> implements Enumeration<E> {
private @Nullable E firstElement;
private final Enumeration<E> enumeration;
CompoundEnumeration(@Nullable E firstElement, Enumeration<E> enumeration) {
this.firstElement = firstElement;
this.enumeration = enumeration;
} | @Override
public boolean hasMoreElements() {
return (this.firstElement != null || this.enumeration.hasMoreElements());
}
@Override
public E nextElement() {
if (this.firstElement == null) {
return this.enumeration.nextElement();
}
E element = this.firstElement;
this.firstElement = null;
return element;
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-devtools\src\main\java\org\springframework\boot\devtools\restart\classloader\RestartClassLoader.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class JsonVendorContact
{
@NonNull
@JsonProperty("METASFRESHID")
JsonMetasfreshId metasfreshId;
@JsonProperty("NACHNAME")
String lastName;
@JsonProperty("VORNAME")
String firstName;
@JsonProperty("ANREDE")
String greeting;
@JsonProperty("TITEL")
String title;
@JsonProperty("POSITION")
String position;
@JsonProperty("EMAIL")
String email;
@JsonProperty("TELEFON")
String phone;
@JsonProperty("MOBIL")
String phone2;
@JsonProperty("FAX")
String fax;
@JsonProperty("ROLLEN")
List<String> contactRoles;
@Builder
public JsonVendorContact(
@JsonProperty("METASFRESHID") final @NonNull JsonMetasfreshId metasfreshId,
@JsonProperty("NACHNAME") final @Nullable String lastName,
@JsonProperty("VORNAME") final @Nullable String firstName,
@JsonProperty("ANREDE") final @Nullable String greeting,
@JsonProperty("TITEL") final @Nullable String title,
@JsonProperty("POSITION") final @Nullable String position,
@JsonProperty("EMAIL") final @Nullable String email,
@JsonProperty("TELEFON") final @Nullable String phone, | @JsonProperty("MOBIL") final @Nullable String phone2,
@JsonProperty("FAX") final @Nullable String fax,
@JsonProperty("ROLLEN") final @Nullable List<String> contactRoles)
{
this.metasfreshId = metasfreshId;
this.lastName = lastName;
this.firstName = firstName;
this.greeting = greeting;
this.title = title;
this.position = position;
this.email = email;
this.phone = phone;
this.phone2 = phone2;
this.fax = fax;
this.contactRoles = contactRoles;
}
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonPOJOBuilder(withPrefix = "")
public static class JsonVendorContactBuilder
{
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\de-metas-camel-grssignum\src\main\java\de\metas\camel\externalsystems\grssignum\to_grs\api\model\JsonVendorContact.java | 2 |
请在Spring Boot框架中完成以下Java代码 | private ConditionOutcome checkDefaultDispatcherName(ConfigurableListableBeanFactory beanFactory) {
boolean containsDispatcherBean = beanFactory.containsBean(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME);
if (!containsDispatcherBean) {
return ConditionOutcome.match();
}
List<String> servlets = Arrays
.asList(beanFactory.getBeanNamesForType(DispatcherServlet.class, false, false));
if (!servlets.contains(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME)) {
return ConditionOutcome.noMatch(
startMessage().found("non dispatcher servlet").items(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME));
}
return ConditionOutcome.match();
}
private ConditionOutcome checkServletRegistration(ConfigurableListableBeanFactory beanFactory) {
ConditionMessage.Builder message = startMessage();
List<String> registrations = Arrays
.asList(beanFactory.getBeanNamesForType(ServletRegistrationBean.class, false, false));
boolean containsDispatcherRegistrationBean = beanFactory
.containsBean(DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME);
if (registrations.isEmpty()) {
if (containsDispatcherRegistrationBean) {
return ConditionOutcome.noMatch(message.found("non servlet registration bean")
.items(DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME));
}
return ConditionOutcome.match(message.didNotFind("servlet registration bean").atAll());
}
if (registrations.contains(DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME)) { | return ConditionOutcome.noMatch(message.found("servlet registration bean")
.items(DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME));
}
if (containsDispatcherRegistrationBean) {
return ConditionOutcome.noMatch(message.found("non servlet registration bean")
.items(DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME));
}
return ConditionOutcome.match(message.found("servlet registration beans")
.items(Style.QUOTE, registrations)
.append("and none is named " + DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME));
}
private ConditionMessage.Builder startMessage() {
return ConditionMessage.forCondition("DispatcherServlet Registration");
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-webmvc\src\main\java\org\springframework\boot\webmvc\autoconfigure\DispatcherServletAutoConfiguration.java | 2 |
请完成以下Java代码 | public final class CounterDocHandlerInterceptor extends AbstractModelInterceptor
{
public static final Builder builder()
{
return new Builder();
}
private final String tableName;
private final boolean async;
private CounterDocHandlerInterceptor(final Builder builder)
{
super();
this.tableName = builder.getTableName();
this.async = builder.isAsync();
}
@Override
public String toString()
{
return MoreObjects.toStringHelper(this)
.add("tableName", tableName)
.add("async", async)
.toString();
}
@Override
protected void onInit(final IModelValidationEngine engine, final I_AD_Client client)
{
engine.addDocValidate(tableName, this);
}
@Override
public void onDocValidate(final Object model, final DocTimingType timing) throws Exception
{
if (timing != DocTimingType.AFTER_COMPLETE)
{
return; // nothing to do
}
final ICounterDocBL counterDocumentBL = Services.get(ICounterDocBL.class);
if (!counterDocumentBL.isCreateCounterDocument(model))
{
return; // nothing to do
}
counterDocumentBL.createCounterDocument(model, async);
}
/** {@link CounterDocHandlerInterceptor} instance builder */
public static final class Builder
{ | private String tableName;
private boolean async = false;
private Builder()
{
super();
}
public CounterDocHandlerInterceptor build()
{
return new CounterDocHandlerInterceptor(this);
}
public Builder setTableName(String tableName)
{
this.tableName = tableName;
return this;
}
private final String getTableName()
{
Check.assumeNotEmpty(tableName, "tableName not empty");
return tableName;
}
public Builder setAsync(boolean async)
{
this.async = async;
return this;
}
private boolean isAsync()
{
return async;
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\document\model\interceptor\CounterDocHandlerInterceptor.java | 1 |
请完成以下Java代码 | protected Mono<InstanceId> registerInstance(ServiceInstance instance) {
try {
Registration registration = converter.convert(instance).toBuilder().source(SOURCE).build();
log.debug("Registering discovered instance {}", registration);
return registry.register(registration);
}
catch (Exception ex) {
log.error("Couldn't register instance for discovered instance ({})", toString(instance), ex);
return Mono.empty();
}
}
protected String toString(ServiceInstance instance) {
String httpScheme = instance.isSecure() ? "https" : "http";
return String.format("serviceId=%s, instanceId=%s, url= %s://%s:%d", instance.getServiceId(),
instance.getInstanceId(), (instance.getScheme() != null) ? instance.getScheme() : httpScheme,
instance.getHost(), instance.getPort());
}
public void setConverter(ServiceInstanceConverter converter) {
this.converter = converter;
}
public void setIgnoredServices(Set<String> ignoredServices) {
this.ignoredServices = ignoredServices;
}
public Set<String> getIgnoredServices() {
return ignoredServices;
}
public Set<String> getServices() {
return services;
}
public void setServices(Set<String> services) {
this.services = services;
}
public Map<String, String> getInstancesMetadata() {
return instancesMetadata;
}
public void setInstancesMetadata(Map<String, String> instancesMetadata) {
this.instancesMetadata = instancesMetadata;
}
public Map<String, String> getIgnoredInstancesMetadata() {
return ignoredInstancesMetadata;
} | public void setIgnoredInstancesMetadata(Map<String, String> ignoredInstancesMetadata) {
this.ignoredInstancesMetadata = ignoredInstancesMetadata;
}
private boolean isInstanceAllowedBasedOnMetadata(ServiceInstance instance) {
if (instancesMetadata.isEmpty()) {
return true;
}
for (Map.Entry<String, String> metadata : instance.getMetadata().entrySet()) {
if (isMapContainsEntry(instancesMetadata, metadata)) {
return true;
}
}
return false;
}
private boolean isInstanceIgnoredBasedOnMetadata(ServiceInstance instance) {
if (ignoredInstancesMetadata.isEmpty()) {
return false;
}
for (Map.Entry<String, String> metadata : instance.getMetadata().entrySet()) {
if (isMapContainsEntry(ignoredInstancesMetadata, metadata)) {
return true;
}
}
return false;
}
private boolean isMapContainsEntry(Map<String, String> map, Map.Entry<String, String> entry) {
String value = map.get(entry.getKey());
return value != null && value.equals(entry.getValue());
}
} | repos\spring-boot-admin-master\spring-boot-admin-server-cloud\src\main\java\de\codecentric\boot\admin\server\cloud\discovery\InstanceDiscoveryListener.java | 1 |
请完成以下Java代码 | public I_W_Basket getW_Basket() throws RuntimeException
{
return (I_W_Basket)MTable.get(getCtx(), I_W_Basket.Table_Name)
.getPO(getW_Basket_ID(), get_TrxName()); }
/** 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();
}
/** Set Basket Line.
@param W_BasketLine_ID
Web Basket Line
*/
public void setW_BasketLine_ID (int W_BasketLine_ID)
{ | if (W_BasketLine_ID < 1)
set_ValueNoCheck (COLUMNNAME_W_BasketLine_ID, null);
else
set_ValueNoCheck (COLUMNNAME_W_BasketLine_ID, Integer.valueOf(W_BasketLine_ID));
}
/** Get Basket Line.
@return Web Basket Line
*/
public int getW_BasketLine_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_W_BasketLine_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_BasketLine.java | 1 |
请完成以下Java代码 | void setColumn(String column) {
this.column = column;
setColumnMapper();
}
void setTable(String table) {
this.table = table;
}
void setFilter(Predicate<String> filter) {
whereFilter = filter;
}
/**
* Clears the context to defaults.
* No filters, match all columns.
*/
void clear() {
column = "";
columnMapper = matchAllColumns;
whereFilter = matchAnyString;
}
List<String> search() {
List<String> result = tables.entrySet()
.stream()
.filter(entry -> entry.getKey().equalsIgnoreCase(table))
.flatMap(entry -> Stream.of(entry.getValue()))
.flatMap(Collection::stream)
.map(Row::toString)
.flatMap(columnMapper)
.filter(whereFilter)
.collect(Collectors.toList()); | clear();
return result;
}
/**
* Sets column mapper based on {@link #column} attribute.
* Note: If column is unknown, will remain to look for all columns.
*/
private void setColumnMapper() {
switch (column) {
case "*":
colIndex = -1;
break;
case "name":
colIndex = 0;
break;
case "surname":
colIndex = 1;
break;
}
if (colIndex != -1) {
columnMapper = s -> Stream.of(s.split(" ")[colIndex]);
}
}
} | repos\tutorials-master\patterns-modules\design-patterns-behavioral-2\src\main\java\com\baeldung\interpreter\Context.java | 1 |
请完成以下Java代码 | public boolean isProductAndUomMatching(@Nullable final ProductId productId, @Nullable final UomId uomId)
{
return ProductId.equals(getProductId(), productId)
&& UomId.equals(getUomId(), uomId);
}
public OrderLineBuilder description(@Nullable final String description)
{
this.description = description;
return this;
}
public OrderLineBuilder hideWhenPrinting(final boolean hideWhenPrinting)
{
this.hideWhenPrinting = hideWhenPrinting;
return this;
} | public OrderLineBuilder details(@NonNull final Collection<OrderLineDetailCreateRequest> details)
{
assertNotBuilt();
detailCreateRequests.addAll(details);
return this;
}
public OrderLineBuilder detail(@NonNull final OrderLineDetailCreateRequest detail)
{
assertNotBuilt();
detailCreateRequests.add(detail);
return this;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\order\OrderLineBuilder.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class SessionConfig implements BeanClassLoaderAware {
private ClassLoader loader;
/**
* Note that the bean name for this bean is intentionally
* {@code springSessionDefaultRedisSerializer}. It must be named this way to override
* the default {@link RedisSerializer} used by Spring Session.
*/
@Bean
public RedisSerializer<Object> springSessionDefaultRedisSerializer() {
return new JacksonJsonRedisSerializer<>(objectMapper(), Object.class);
}
/**
* Customized {@link JsonMapper} to add mix-in for class that doesn't have default
* constructors
* @return the {@link JsonMapper} to use | */
private JsonMapper objectMapper() {
return JsonMapper.builder().addModules(SecurityJacksonModules.getModules(this.loader)).build();
}
/*
* @see
* org.springframework.beans.factory.BeanClassLoaderAware#setBeanClassLoader(java.lang
* .ClassLoader)
*/
@Override
public void setBeanClassLoader(ClassLoader classLoader) {
this.loader = classLoader;
}
}
// end::class[] | repos\spring-session-main\spring-session-samples\spring-session-sample-boot-redis-json\src\main\java\sample\config\SessionConfig.java | 2 |
请完成以下Java代码 | public abstract class BaseCheckParamComponent extends BaseComponent {
@Override
public void handle(OrderProcessContext orderProcessContext) {
preHandle(orderProcessContext);
// 通用参数校验
commonParamCheck(orderProcessContext);
// 子校验组件特有的参数校验
privateParamCheck(orderProcessContext);
afterHandle(orderProcessContext);
}
/**
* 子校验组件特有的参数校验
* @param orderProcessContext 订单受理上下文
*/
protected abstract void privateParamCheck(OrderProcessContext orderProcessContext);
/**
* 校验组件通用的参数校验
* @param orderProcessContext 订单受理上下文
*/
private void commonParamCheck(OrderProcessContext orderProcessContext) {
// context不能为空
checkParam(orderProcessContext, ExpCodeEnum.PROCESSCONTEXT_NULL);
// OrderProcessReq不能为空
checkParam(orderProcessContext.getOrderProcessReq(), ExpCodeEnum.PROCESSREQ_NULL);
// 受理人ID不能为空
checkParam(orderProcessContext.getOrderProcessReq().getUserId(), ExpCodeEnum.USERID_NULL);
// ProcessReqEnum不能为空
checkParam(orderProcessContext.getOrderProcessReq().getProcessReqEnum(), ExpCodeEnum.PROCESSREQ_ENUM_NULL);
// orderId不能为空(下单请求除外)
if (orderProcessContext.getOrderProcessReq().getProcessReqEnum() != ProcessReqEnum.PlaceOrder) {
checkParam(orderProcessContext.getOrderProcessReq().getOrderId(), ExpCodeEnum.PROCESSREQ_ORDERID_NULL); | }
}
/**
* 参数校验
* @param param 待校验参数
* @param expCodeEnum 异常错误码
*/
protected <T> void checkParam(T param, ExpCodeEnum expCodeEnum) {
if (param == null) {
throw new CommonBizException(expCodeEnum);
}
if (param instanceof String && StringUtils.isEmpty((String) param)) {
throw new CommonBizException(expCodeEnum);
}
if (param instanceof Collection && CollectionUtils.isEmpty((Collection<?>) param)) {
throw new CommonBizException(expCodeEnum);
}
}
} | repos\SpringBoot-Dubbo-Docker-Jenkins-master\Gaoxi-Order\src\main\java\com\gaoxi\order\component\checkparam\BaseCheckParamComponent.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void clear() {
this.loaded.clear();
}
@Override
public boolean containsValue(Object value) {
return this.loaded.containsValue(value);
}
@Override
public Collection<V> values() {
return this.loaded.values();
}
@Override
public Set<Entry<K, V>> entrySet() {
return this.loaded.entrySet();
}
@Override | public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
LoadingMap<?, ?> that = (LoadingMap<?, ?>) o;
return this.loaded.equals(that.loaded);
}
@Override
public int hashCode() {
return this.loaded.hashCode();
}
}
} | repos\spring-security-main\config\src\main\java\org\springframework\security\config\annotation\web\configuration\SecurityReactorContextConfiguration.java | 2 |
请完成以下Java代码 | public final void executeLongOperation(final Object component, final Runnable runnable)
{
invoke()
.setParentComponent(component)
.setLongOperation(true)
.setOnFail(OnFail.ThrowException) // backward compatibility
.invoke(runnable);
}
@Override
public void invokeLater(final int windowNo, final Runnable runnable)
{
invoke()
.setParentComponentByWindowNo(windowNo)
.setInvokeLater(true)
.setOnFail(OnFail.ThrowException) // backward compatibility
.invoke(runnable);
}
/**
* This method does nothing.
*
* @deprecated please check out the deprecation notice in {@link IClientUIInstance#hideBusyDialog()}.
*/
@Deprecated
@Override
public void hideBusyDialog()
{ | // nothing
}
/**
* This method does nothing.
*
* @deprecated please check out the deprecation notice in {@link IClientUIInstance#disableServerPush()}.
*/
@Deprecated
@Override
public void disableServerPush()
{
// nothing
}
/**
* This method throws an UnsupportedOperationException.
*
* @deprecated please check out the deprecation notice in {@link IClientUIInstance#infoNoWait(int, String)}.
* @throws UnsupportedOperationException
*/
@Deprecated
@Override
public void infoNoWait(int WindowNo, String AD_Message)
{
throw new UnsupportedOperationException("not implemented");
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\adempiere\form\AbstractClientUIInstance.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class DictQueryBlackListHandler extends AbstractQueryBlackListHandler {
@Override
protected List<QueryTable> getQueryTableInfo(String dictCodeString) {
//针对转义字符进行解码
try {
if (dictCodeString.contains("%")) {
dictCodeString = URLDecoder.decode(dictCodeString, "UTF-8");
}
} catch (Exception e) {
//e.printStackTrace();
}
dictCodeString = dictCodeString.trim();
// 无论什么场景 第二、三个元素一定是表的字段,直接add
if (dictCodeString != null && dictCodeString.indexOf(SymbolConstant.COMMA) > 0) {
String[] arr = dictCodeString.split(SymbolConstant.COMMA);
if (arr.length != 3 && arr.length != 4) {
return null;
}
//获取表名
String tableName = getTableName(arr[0]);
QueryTable table = new QueryTable(tableName, "");
// 无论什么场景 第二、三个元素一定是表的字段,直接add
//参数字段1
table.addField(arr[1].trim());
//参数字段2
String filed = arr[2].trim();
if (oConvertUtils.isNotEmpty(filed)) {
table.addField(filed);
}
List<QueryTable> list = new ArrayList<>();
list.add(table);
return list;
}
return null; | }
/**
* 取where前面的为:table name
*
* @param str
* @return
*/
private String getTableName(String str) {
String[] arr = str.split("\\s+(?i)where\\s+");
String tableName = arr[0].trim();
//【20230814】解决使用参数tableName=sys_user t&复测,漏洞仍然存在
if (tableName.contains(".")) {
tableName = tableName.substring(tableName.indexOf(".")+1, tableName.length()).trim();
}
if (tableName.contains(" ")) {
tableName = tableName.substring(0, tableName.indexOf(" ")).trim();
}
//【issues/4393】 sys_user , (sys_user), sys_user%20, %60sys_user%60
String reg = "\\s+|\\(|\\)|`";
return tableName.replaceAll(reg, "");
}
} | repos\JeecgBoot-main\jeecg-boot\jeecg-module-system\jeecg-system-biz\src\main\java\org\jeecg\modules\system\security\DictQueryBlackListHandler.java | 2 |
请完成以下Java代码 | public String getNm() {
return nm;
}
/**
* Sets the value of the nm property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNm(String value) {
this.nm = value;
}
/**
* Gets the value of the pstlAdr property.
*
* @return
* possible object is
* {@link PostalAddress6 }
*
*/ | public PostalAddress6 getPstlAdr() {
return pstlAdr;
}
/**
* Sets the value of the pstlAdr property.
*
* @param value
* allowed object is
* {@link PostalAddress6 }
*
*/
public void setPstlAdr(PostalAddress6 value) {
this.pstlAdr = value;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_02\BranchData2.java | 1 |
请完成以下Java代码 | public void setDATEV_ExportFormat(de.metas.datev.model.I_DATEV_ExportFormat DATEV_ExportFormat)
{
set_ValueFromPO(COLUMNNAME_DATEV_ExportFormat_ID, de.metas.datev.model.I_DATEV_ExportFormat.class, DATEV_ExportFormat);
}
/** Set DATEV Export Format.
@param DATEV_ExportFormat_ID DATEV Export Format */
@Override
public void setDATEV_ExportFormat_ID (int DATEV_ExportFormat_ID)
{
if (DATEV_ExportFormat_ID < 1)
set_ValueNoCheck (COLUMNNAME_DATEV_ExportFormat_ID, null);
else
set_ValueNoCheck (COLUMNNAME_DATEV_ExportFormat_ID, Integer.valueOf(DATEV_ExportFormat_ID));
}
/** Get DATEV Export Format.
@return DATEV Export Format */
@Override
public int getDATEV_ExportFormat_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_DATEV_ExportFormat_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set DATEV Export Format Column.
@param DATEV_ExportFormatColumn_ID DATEV Export Format Column */
@Override
public void setDATEV_ExportFormatColumn_ID (int DATEV_ExportFormatColumn_ID)
{
if (DATEV_ExportFormatColumn_ID < 1)
set_ValueNoCheck (COLUMNNAME_DATEV_ExportFormatColumn_ID, null);
else
set_ValueNoCheck (COLUMNNAME_DATEV_ExportFormatColumn_ID, Integer.valueOf(DATEV_ExportFormatColumn_ID));
}
/** Get DATEV Export Format Column.
@return DATEV Export Format Column */
@Override
public int getDATEV_ExportFormatColumn_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_DATEV_ExportFormatColumn_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Format Pattern.
@param FormatPattern
The pattern used to format a number or date.
*/
@Override
public void setFormatPattern (java.lang.String FormatPattern)
{
set_Value (COLUMNNAME_FormatPattern, FormatPattern);
}
/** Get Format Pattern.
@return The pattern used to format a number or date.
*/
@Override
public java.lang.String getFormatPattern ()
{
return (java.lang.String)get_Value(COLUMNNAME_FormatPattern);
} | /** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
@Override
public void setName (java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
@Override
public java.lang.String getName ()
{
return (java.lang.String)get_Value(COLUMNNAME_Name);
}
/** Set Reihenfolge.
@param SeqNo
Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst
*/
@Override
public void setSeqNo (int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo));
}
/** Get Reihenfolge.
@return Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst
*/
@Override
public int getSeqNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
if (ii == null)
return 0;
return ii.intValue();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.datev\src\main\java-gen\de\metas\datev\model\X_DATEV_ExportFormatColumn.java | 1 |
请完成以下Java代码 | public class WebauthnJacksonModule extends SecurityJacksonModule {
/**
* Creates a new instance.
*/
public WebauthnJacksonModule() {
super(WebauthnJacksonModule.class.getName(), new Version(1, 0, 0, null, null, null));
}
@Override
public void configurePolymorphicTypeValidator(BasicPolymorphicTypeValidator.Builder builder) {
}
@Override
public void setupModule(SetupContext context) {
context.setMixIn(Bytes.class, BytesMixin.class);
context.setMixIn(AttestationConveyancePreference.class, AttestationConveyancePreferenceMixin.class);
context.setMixIn(AuthenticationExtensionsClientInput.class, AuthenticationExtensionsClientInputMixin.class);
context.setMixIn(AuthenticationExtensionsClientInputs.class, AuthenticationExtensionsClientInputsMixin.class);
context.setMixIn(AuthenticationExtensionsClientOutputs.class, AuthenticationExtensionsClientOutputsMixin.class);
context.setMixIn(AuthenticatorAssertionResponse.AuthenticatorAssertionResponseBuilder.class,
AuthenticatorAssertionResponseMixin.AuthenticatorAssertionResponseBuilderMixin.class);
context.setMixIn(AuthenticatorAssertionResponse.class, AuthenticatorAssertionResponseMixin.class);
context.setMixIn(AuthenticatorAttachment.class, AuthenticatorAttachmentMixin.class);
context.setMixIn(AuthenticatorAttestationResponse.class, AuthenticatorAttestationResponseMixin.class);
context.setMixIn(AuthenticatorAttestationResponse.AuthenticatorAttestationResponseBuilder.class,
AuthenticatorAttestationResponseMixin.AuthenticatorAttestationResponseBuilderMixin.class);
context.setMixIn(AuthenticatorSelectionCriteria.class, AuthenticatorSelectionCriteriaMixin.class);
context.setMixIn(AuthenticatorTransport.class, AuthenticatorTransportMixin.class);
context.setMixIn(COSEAlgorithmIdentifier.class, COSEAlgorithmIdentifierMixin.class); | context.setMixIn(CredentialPropertiesOutput.class, CredentialPropertiesOutputMixin.class);
context.setMixIn(CredProtectAuthenticationExtensionsClientInput.class,
CredProtectAuthenticationExtensionsClientInputMixin.class);
context.setMixIn(PublicKeyCredential.PublicKeyCredentialBuilder.class,
PublicKeyCredentialMixin.PublicKeyCredentialBuilderMixin.class);
context.setMixIn(PublicKeyCredential.class, PublicKeyCredentialMixin.class);
context.setMixIn(PublicKeyCredentialCreationOptions.class, PublicKeyCredentialCreationOptionsMixin.class);
context.setMixIn(PublicKeyCredentialRequestOptions.class, PublicKeyCredentialRequestOptionsMixin.class);
context.setMixIn(PublicKeyCredentialType.class, PublicKeyCredentialTypeMixin.class);
context.setMixIn(RelyingPartyPublicKey.class, RelyingPartyPublicKeyMixin.class);
context.setMixIn(ResidentKeyRequirement.class, ResidentKeyRequirementMixin.class);
context.setMixIn(UserVerificationRequirement.class, UserVerificationRequirementMixin.class);
}
} | repos\spring-security-main\webauthn\src\main\java\org\springframework\security\web\webauthn\jackson\WebauthnJacksonModule.java | 1 |
请完成以下Java代码 | public void setSuspenseError_Acct (int SuspenseError_Acct)
{
set_Value (COLUMNNAME_SuspenseError_Acct, Integer.valueOf(SuspenseError_Acct));
}
/** Get CpD-Fehlerkonto.
@return CpD-Fehlerkonto */
@Override
public int getSuspenseError_Acct ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SuspenseError_Acct);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Wähungsunterschiede verbuchen.
@param UseCurrencyBalancing
Sollen Währungsdifferenzen verbucht werden?
*/
@Override
public void setUseCurrencyBalancing (boolean UseCurrencyBalancing)
{
set_Value (COLUMNNAME_UseCurrencyBalancing, Boolean.valueOf(UseCurrencyBalancing));
}
/** Get Wähungsunterschiede verbuchen.
@return Sollen Währungsdifferenzen verbucht werden?
*/
@Override
public boolean isUseCurrencyBalancing ()
{
Object oo = get_Value(COLUMNNAME_UseCurrencyBalancing);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set doppelte Buchführung.
@param UseSuspenseBalancing
Verwendet doppelte Buchführung über Zwischenkonto bei manuellen Buchungen.
*/
@Override
public void setUseSuspenseBalancing (boolean UseSuspenseBalancing)
{
set_Value (COLUMNNAME_UseSuspenseBalancing, Boolean.valueOf(UseSuspenseBalancing));
}
/** Get doppelte Buchführung.
@return Verwendet doppelte Buchführung über Zwischenkonto bei manuellen Buchungen.
*/
@Override
public boolean isUseSuspenseBalancing ()
{
Object oo = get_Value(COLUMNNAME_UseSuspenseBalancing);
if (oo != null)
{ | if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set CpD-Fehlerkonto verwenden.
@param UseSuspenseError CpD-Fehlerkonto verwenden */
@Override
public void setUseSuspenseError (boolean UseSuspenseError)
{
set_Value (COLUMNNAME_UseSuspenseError, Boolean.valueOf(UseSuspenseError));
}
/** Get CpD-Fehlerkonto verwenden.
@return CpD-Fehlerkonto verwenden */
@Override
public boolean isUseSuspenseError ()
{
Object oo = get_Value(COLUMNNAME_UseSuspenseError);
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_C_AcctSchema_GL.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void publish() {
int si = stopIndex(users.size(), startIndex, n);
LOG.info("Publishing started size={} fromIndex={} n={} stopIndex={}", users.size(), startIndex, n, si);
int i = startIndex;
if (startIndex < users.size()) {
for (; i<si; i++) {
if (stopped) {
LOG.info("interrupted {}", i);
return;
}
UserData userData = users.get(i);
LOG.info(" Publishing {} {}:{}:{}", i, userData.getId(), userData.getEmail(), userData.getName());
subscriber.onNext(userData);
/*
try {
Thread.sleep(10);
} catch (InterruptedException e) {
LOG.error("Error: {}", e.getMessage());
}
*/
}
if (i == users.size()) {
LOG.info("onComplete");
subscriber.onComplete();
}
} else {
LOG.info("onComplete"); | subscriber.onComplete();
}
LOG.info("Publishing done {}", i);
}
private int stopIndex(int size, int startIndex, int n) {
if ((startIndex + n) >= size) {
return size;
} else {
return (startIndex + n);
}
}
public void setStopped() {
LOG.info("setStopped");
this.stopped = true;
}
} | repos\spring-examples-java-17\spring-webflux\src\main\java\itx\examples\webflux\services\PublishTask.java | 2 |
请完成以下Spring Boot application配置 | server:
port: 8080
context-path: /admin-server
spring:
mail:
host: smtp.163.com
username: xxx@163.com
password: xxx
properties:
mail:
smtp:
auth: true
starttls:
enable: true
required: t | rue
boot:
admin:
notify:
mail:
from: xxx@163.com
to: xxx@qq.com | repos\SpringAll-master\23.Spring-Boot-Admin\Spring Boot Admin Server\src\main\resources\application.yml | 2 |
请在Spring Boot框架中完成以下Java代码 | public class AssetBulkImportService extends AbstractBulkImportService<Asset> {
private final AssetService assetService;
private final TbAssetService tbAssetService;
private final AssetProfileService assetProfileService;
@Override
protected void setEntityFields(Asset entity, Map<BulkImportColumnType, String> fields) {
ObjectNode additionalInfo = getOrCreateAdditionalInfoObj(entity);
fields.forEach((columnType, value) -> {
switch (columnType) {
case NAME:
entity.setName(value);
break;
case TYPE:
entity.setType(value);
break;
case LABEL:
entity.setLabel(value);
break;
case DESCRIPTION:
additionalInfo.set("description", new TextNode(value));
break;
}
});
entity.setAdditionalInfo(additionalInfo);
}
@Override
@SneakyThrows
protected Asset saveEntity(SecurityUser user, Asset entity, Map<BulkImportColumnType, String> fields) {
AssetProfile assetProfile;
if (StringUtils.isNotEmpty(entity.getType())) {
assetProfile = assetProfileService.findOrCreateAssetProfile(entity.getTenantId(), entity.getType());
} else {
assetProfile = assetProfileService.findDefaultAssetProfile(entity.getTenantId());
} | entity.setAssetProfileId(assetProfile.getId());
return tbAssetService.save(entity, user);
}
@Override
protected Asset findOrCreateEntity(TenantId tenantId, String name) {
return Optional.ofNullable(assetService.findAssetByTenantIdAndName(tenantId, name))
.orElseGet(Asset::new);
}
@Override
protected void setOwners(Asset entity, SecurityUser user) {
entity.setTenantId(user.getTenantId());
entity.setCustomerId(user.getCustomerId());
}
@Override
protected EntityType getEntityType() {
return EntityType.ASSET;
}
} | repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\asset\AssetBulkImportService.java | 2 |
请完成以下Java代码 | public class VerfuegbarkeitsanfrageEinzelne {
@XmlElement(name = "Artikel", required = true)
protected List<ArtikelMenge> artikel;
@XmlAttribute(name = "Id", required = true)
protected String id;
@XmlAttribute(name = "EinsAusNBedarf", required = true)
protected boolean einsAusNBedarf;
/**
* Gets the value of the artikel property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the artikel property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getArtikel().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ArtikelMenge }
*
*
*/
public List<ArtikelMenge> getArtikel() {
if (artikel == null) {
artikel = new ArrayList<ArtikelMenge>();
}
return this.artikel;
}
/**
* 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 einsAusNBedarf property.
*
*/
public boolean isEinsAusNBedarf() {
return einsAusNBedarf;
}
/**
* Sets the value of the einsAusNBedarf property.
*
*/
public void setEinsAusNBedarf(boolean value) {
this.einsAusNBedarf = value;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.msv3.schema.v1\src\main\java-xjc\de\metas\vertical\pharma\vendor\gateway\msv3\schema\v1\VerfuegbarkeitsanfrageEinzelne.java | 1 |
请完成以下Java代码 | public int getC_AcctSchema_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_AcctSchema_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Date From.
@param DateFrom
Starting date for a range
*/
public void setDateFrom (Timestamp DateFrom)
{
set_Value (COLUMNNAME_DateFrom, DateFrom);
}
/** Get Date From.
@return Starting date for a range
*/
public Timestamp getDateFrom ()
{
return (Timestamp)get_Value(COLUMNNAME_DateFrom);
}
/** Set Date To.
@param DateTo
End date of a date range
*/
public void setDateTo (Timestamp DateTo)
{
set_Value (COLUMNNAME_DateTo, DateTo);
}
/** Get Date To.
@return End date of a date range
*/
public Timestamp getDateTo ()
{
return (Timestamp)get_Value(COLUMNNAME_DateTo);
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Set GL Fund.
@param GL_Fund_ID
General Ledger Funds Control
*/
public void setGL_Fund_ID (int GL_Fund_ID)
{
if (GL_Fund_ID < 1)
set_ValueNoCheck (COLUMNNAME_GL_Fund_ID, null);
else
set_ValueNoCheck (COLUMNNAME_GL_Fund_ID, Integer.valueOf(GL_Fund_ID));
}
/** Get GL Fund.
@return General Ledger Funds Control
*/
public int getGL_Fund_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_GL_Fund_ID);
if (ii == null)
return 0;
return ii.intValue();
} | /** Set Comment/Help.
@param Help
Comment or Hint
*/
public void setHelp (String Help)
{
set_Value (COLUMNNAME_Help, Help);
}
/** Get Comment/Help.
@return Comment or Hint
*/
public String getHelp ()
{
return (String)get_Value(COLUMNNAME_Help);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_GL_Fund.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class FanoutRabbitConfig {
@Bean
public Queue AMessage() {
return new Queue("fanout.A");
}
@Bean
public Queue BMessage() {
return new Queue("fanout.B");
}
@Bean
public Queue CMessage() {
return new Queue("fanout.C");
}
@Bean
FanoutExchange fanoutExchange() {
return new FanoutExchange("fanoutExchange"); | }
@Bean
Binding bindingExchangeA(Queue AMessage,FanoutExchange fanoutExchange) {
return BindingBuilder.bind(AMessage).to(fanoutExchange);
}
@Bean
Binding bindingExchangeB(Queue BMessage, FanoutExchange fanoutExchange) {
return BindingBuilder.bind(BMessage).to(fanoutExchange);
}
@Bean
Binding bindingExchangeC(Queue CMessage, FanoutExchange fanoutExchange) {
return BindingBuilder.bind(CMessage).to(fanoutExchange);
}
} | repos\spring-boot-leaning-master\1.x\第11课:RabbitMQ 详解\spring-boot-rabbitmq\src\main\java\com\neo\rabbit\FanoutRabbitConfig.java | 2 |
请完成以下Java代码 | public EsrAddressType getCreditor() {
return creditor;
}
/**
* Sets the value of the creditor property.
*
* @param value
* allowed object is
* {@link EsrAddressType }
*
*/
public void setCreditor(EsrAddressType value) {
this.creditor = value;
}
/**
* Gets the value of the type property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getType() {
if (type == null) {
return "16or27";
} else {
return type;
}
}
/**
* Sets the value of the type property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setType(String value) {
this.type = value;
}
/**
* Gets the value of the participantNumber property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getParticipantNumber() {
return participantNumber;
}
/**
* Sets the value of the participantNumber property.
*
* @param value
* allowed object is | * {@link String }
*
*/
public void setParticipantNumber(String value) {
this.participantNumber = value;
}
/**
* Gets the value of the referenceNumber property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getReferenceNumber() {
return referenceNumber;
}
/**
* Sets the value of the referenceNumber property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setReferenceNumber(String value) {
this.referenceNumber = value;
}
/**
* Gets the value of the codingLine property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCodingLine() {
return codingLine;
}
/**
* Sets the value of the codingLine property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCodingLine(String value) {
this.codingLine = value;
}
} | repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_450_request\src\main\java-xjc\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_450\request\Esr9Type.java | 1 |
请完成以下Java代码 | public void configure(Map<String, ?> configs, boolean isKey) {
if (isKey) {
this.typeInfoHeader = KEY_TYPE;
}
if (configs.containsKey(ADD_TYPE_INFO_HEADERS)) {
Object config = configs.get(ADD_TYPE_INFO_HEADERS);
if (config instanceof Boolean) {
this.addTypeInfo = (Boolean) config;
}
else if (config instanceof String) {
this.addTypeInfo = Boolean.parseBoolean((String) config);
}
else {
throw new IllegalStateException(
ADD_TYPE_INFO_HEADERS + " must be Boolean or String");
}
}
}
@Override
public byte[] serialize(String topic, @Nullable T data) {
return serialize(topic, null, data);
}
@Override
@SuppressWarnings("NullAway") // Dataflow analysis limitation
public byte[] serialize(String topic, @Nullable Headers headers, @Nullable T data) {
if (data == null) {
return null;
}
if (this.addTypeInfo && headers != null) {
headers.add(this.typeInfoHeader, data.getClass().getName().getBytes());
}
return data.toString().getBytes(this.charset);
}
@Override
public void close() {
// No-op
}
/**
* Get the addTypeInfo property.
* @return the addTypeInfo
*/
public boolean isAddTypeInfo() {
return this.addTypeInfo;
} | /**
* Set to false to disable adding type info headers.
* @param addTypeInfo true to add headers
*/
public void setAddTypeInfo(boolean addTypeInfo) {
this.addTypeInfo = addTypeInfo;
}
/**
* Set a charset to use when converting {@link String} to byte[]. Default UTF-8.
* @param charset the charset.
*/
public void setCharset(Charset charset) {
Assert.notNull(charset, "'charset' cannot be null");
this.charset = charset;
}
/**
* Get the configured charset.
* @return the charset.
*/
public Charset getCharset() {
return this.charset;
}
} | repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\support\serializer\ToStringSerializer.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public TaskBuilder parentTaskId(String parentTaskId) {
this.parentTaskId = parentTaskId;
return this;
}
@Override
public TaskBuilder tenantId(String tenantId) {
this.tenantId = tenantId;
return this;
}
@Override
public TaskBuilder formKey(String formKey) {
this.formKey = formKey;
return this;
}
@Override
public TaskBuilder taskDefinitionId(String taskDefinitionId) {
this.taskDefinitionId = taskDefinitionId;
return this;
}
@Override
public TaskBuilder taskDefinitionKey(String taskDefinitionKey) {
this.taskDefinitionKey = taskDefinitionKey;
return this;
}
@Override
public TaskBuilder identityLinks(Set<? extends IdentityLinkInfo> identityLinks) {
this.identityLinks = identityLinks;
return this;
}
@Override
public TaskBuilder scopeId(String scopeId) {
this.scopeId = scopeId;
return this;
}
@Override
public TaskBuilder scopeType(String scopeType) {
this.scopeType = scopeType;
return this;
}
@Override
public String getId() {
return id;
}
@Override
public String getName() {
return name;
}
@Override
public String getDescription() {
return description;
}
@Override
public int getPriority() {
return priority;
} | @Override
public String getOwner() {
return ownerId;
}
@Override
public String getAssignee() {
return assigneeId;
}
@Override
public String getTaskDefinitionId() {
return taskDefinitionId;
}
@Override
public String getTaskDefinitionKey() {
return taskDefinitionKey;
}
@Override
public Date getDueDate() {
return dueDate;
}
@Override
public String getCategory() {
return category;
}
@Override
public String getParentTaskId() {
return parentTaskId;
}
@Override
public String getTenantId() {
return tenantId;
}
@Override
public String getFormKey() {
return formKey;
}
@Override
public Set<? extends IdentityLinkInfo> getIdentityLinks() {
return identityLinks;
}
@Override
public String getScopeId() {
return this.scopeId;
}
@Override
public String getScopeType() {
return this.scopeType;
}
} | repos\flowable-engine-main\modules\flowable-task-service\src\main\java\org\flowable\task\service\impl\BaseTaskBuilderImpl.java | 2 |
请完成以下Java代码 | public Stream<I_M_Product> streamAllProducts(@Nullable final Instant since)
{
return productsRepo.streamAllProducts(since);
}
public List<I_M_Product> getProductsById(@NonNull final Set<ProductId> productIds)
{
return productsRepo.getByIds(productIds);
}
@NonNull
public I_M_Product getProductById(@NonNull final ProductId productId)
{
return productsRepo.getById(productId);
}
public String getUOMSymbol(@NonNull final UomId uomId)
{
final I_C_UOM uom = uomsRepo.getById(uomId);
return uom.getUOMSymbol();
}
@NonNull
public String getX12DE355(@NonNull final UomId uomId)
{
final I_C_UOM uom = uomsRepo.getById(uomId);
return uom.getX12DE355();
}
public List<I_C_BPartner_Product> getBPartnerProductRecords(final Set<ProductId> productIds)
{
return partnerProductsRepo.retrieveForProductIds(productIds);
}
public List<I_M_HU_PI_Item_Product> getMHUPIItemProductRecords(final Set<ProductId> productIds)
{
return huPIItemProductDAO.retrieveAllForProducts(productIds);
}
public List<UOMConversionsMap> getProductUOMConversions(final Set<ProductId> productIds)
{
if (productIds.isEmpty())
{ | return ImmutableList.of();
}
return productIds.stream().map(uomConversionDAO::getProductConversions).collect(ImmutableList.toImmutableList());
}
public Stream<I_M_Product_Category> streamAllProductCategories()
{
return productsRepo.streamAllProductCategories();
}
public List<I_C_BPartner> getPartnerRecords(@NonNull final ImmutableSet<BPartnerId> manufacturerIds)
{
return queryBL.createQueryBuilder(I_C_BPartner.class)
.addInArrayFilter(I_C_BPartner.COLUMN_C_BPartner_ID, manufacturerIds)
.create()
.list();
}
@NonNull
public JsonCreatedUpdatedInfo extractCreatedUpdatedInfo(@NonNull final I_M_Product_Category record)
{
final ZoneId orgZoneId = orgDAO.getTimeZone(OrgId.ofRepoId(record.getAD_Org_ID()));
return JsonCreatedUpdatedInfo.builder()
.created(TimeUtil.asZonedDateTime(record.getCreated(), orgZoneId))
.createdBy(UserId.optionalOfRepoId(record.getCreatedBy()).orElse(UserId.SYSTEM))
.updated(TimeUtil.asZonedDateTime(record.getUpdated(), orgZoneId))
.updatedBy(UserId.optionalOfRepoId(record.getUpdatedBy()).orElse(UserId.SYSTEM))
.build();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business.rest-api-impl\src\main\java\de\metas\rest_api\v2\product\ProductsServicesFacade.java | 1 |
请完成以下Java代码 | public Employee[] getForEntityEmployeesAsArray() {
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<Employee[]> response =
restTemplate.getForEntity(
"http://localhost:8080/spring-rest/employees/",
Employee[].class);
Employee[] employees = response.getBody();
assert employees != null;
asList(employees).forEach(System.out::println);
return employees;
}
public List<Employee> getAllEmployeesUsingParameterizedTypeReference() {
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<List<Employee>> response =
restTemplate.exchange(
"http://localhost:8080/spring-rest/employees/",
HttpMethod.GET,
null,
new ParameterizedTypeReference<List<Employee>>() {
});
List<Employee> employees = response.getBody();
assert employees != null;
employees.forEach(System.out::println);
return employees;
}
public List<Employee> getAllEmployeesUsingWrapperClass() {
RestTemplate restTemplate = new RestTemplate();
EmployeeList response = | restTemplate.getForObject(
"http://localhost:8080/spring-rest/employees/v2",
EmployeeList.class);
List<Employee> employees = response.getEmployees();
employees.forEach(System.out::println);
return employees;
}
public void createEmployeesUsingLists() {
RestTemplate restTemplate = new RestTemplate();
List<Employee> newEmployees = new ArrayList<>();
newEmployees.add(new Employee(3, "Intern"));
newEmployees.add(new Employee(4, "CEO"));
restTemplate.postForObject(
"http://localhost:8080/spring-rest/employees/",
newEmployees,
ResponseEntity.class);
}
public void createEmployeesUsingWrapperClass() {
RestTemplate restTemplate = new RestTemplate();
List<Employee> newEmployees = new ArrayList<>();
newEmployees.add(new Employee(3, "Intern"));
newEmployees.add(new Employee(4, "CEO"));
restTemplate.postForObject(
"http://localhost:8080/spring-rest/employees/v2",
new EmployeeList(newEmployees),
ResponseEntity.class);
}
} | repos\tutorials-master\spring-web-modules\spring-resttemplate-1\src\main\java\com\baeldung\resttemplate\lists\client\EmployeeClient.java | 1 |
请完成以下Java代码 | public Access getRequiredAccess()
{
return requiredAccess;
}
@Override
public void setRequiredAccess(final Access requiredAccess)
{
this.requiredAccess = requiredAccess;
}
@Override
public Integer getCopies()
{
return copies;
}
@Override | public void setCopies(int copies)
{
this.copies = copies;
}
@Override
public String getAggregationKey()
{
return aggregationKey;
}
@Override
public void setAggregationKey(final String aggregationKey)
{
this.aggregationKey=aggregationKey;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.printing\de.metas.printing.base\src\main\java\de\metas\printing\api\impl\PrintingQueueQuery.java | 1 |
请完成以下Java代码 | public void setRootCauseIncidentId(String rootCauseIncidentId) {
this.rootCauseIncidentId = rootCauseIncidentId;
}
public String getConfiguration() {
return configuration;
}
public void setConfiguration(String configuration) {
this.configuration = configuration;
}
public String getHistoryConfiguration() {
return historyConfiguration;
}
public void setHistoryConfiguration(String historyConfiguration) {
this.historyConfiguration = historyConfiguration;
}
public String getIncidentMessage() {
return incidentMessage;
}
public void setIncidentMessage(String incidentMessage) {
this.incidentMessage = incidentMessage;
}
public void setIncidentState(int incidentState) {
this.incidentState = incidentState;
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public String getJobDefinitionId() {
return jobDefinitionId;
} | public void setJobDefinitionId(String jobDefinitionId) {
this.jobDefinitionId = jobDefinitionId;
}
public boolean isOpen() {
return IncidentState.DEFAULT.getStateCode() == incidentState;
}
public boolean isDeleted() {
return IncidentState.DELETED.getStateCode() == incidentState;
}
public boolean isResolved() {
return IncidentState.RESOLVED.getStateCode() == incidentState;
}
public String getRootProcessInstanceId() {
return rootProcessInstanceId;
}
public void setRootProcessInstanceId(String rootProcessInstanceId) {
this.rootProcessInstanceId = rootProcessInstanceId;
}
public String getFailedActivityId() {
return failedActivityId;
}
public void setFailedActivityId(String failedActivityId) {
this.failedActivityId = failedActivityId;
}
public String getAnnotation() {
return annotation;
}
public void setAnnotation(String annotation) {
this.annotation = annotation;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\history\event\HistoricIncidentEventEntity.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class Login {
@XmlElement(required = true)
protected String delisId;
@XmlElement(required = true)
protected String customerUid;
@XmlElement(required = true)
protected String authToken;
@XmlElement(required = true)
protected String depot;
/**
* Gets the value of the delisId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDelisId() {
return delisId;
}
/**
* Sets the value of the delisId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDelisId(String value) {
this.delisId = value;
}
/**
* Gets the value of the customerUid property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCustomerUid() {
return customerUid;
}
/**
* Sets the value of the customerUid property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCustomerUid(String value) {
this.customerUid = value;
} | /**
* Gets the value of the authToken property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAuthToken() {
return authToken;
}
/**
* Sets the value of the authToken property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAuthToken(String value) {
this.authToken = value;
}
/**
* Gets the value of the depot property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDepot() {
return depot;
}
/**
* Sets the value of the depot property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDepot(String value) {
this.depot = value;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.dpd\src\main\java-xjc\com\dpd\common\ws\loginservice\v2_0\types\Login.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public Class<?> getObjectType() {
return Collection.class;
}
/**
* Sets the location of a Resource that is a Properties file in the format defined in
* {@link UserDetailsResourceFactoryBean}.
* @param resourceLocation the location of the properties file that contains the users
* (i.e. "classpath:users.properties")
*/
public void setResourceLocation(String resourceLocation) {
this.resourceLocation = resourceLocation;
}
/**
* Sets a Resource that is a Properties file in the format defined in
* {@link UserDetailsResourceFactoryBean}.
* @param resource the Resource to use
*/
public void setResource(Resource resource) {
this.resource = resource;
}
private Resource getPropertiesResource() {
Resource result = this.resource;
if (result == null && this.resourceLocation != null) {
result = this.resourceLoader.getResource(this.resourceLocation);
}
Assert.notNull(result, "resource cannot be null if resourceLocation is null");
return result;
}
/**
* Create a UserDetailsResourceFactoryBean with the location of a Resource that is a
* Properties file in the format defined in {@link UserDetailsResourceFactoryBean}.
* @param resourceLocation the location of the properties file that contains the users
* (i.e. "classpath:users.properties")
* @return the UserDetailsResourceFactoryBean
*/
public static UserDetailsResourceFactoryBean fromResourceLocation(String resourceLocation) {
UserDetailsResourceFactoryBean result = new UserDetailsResourceFactoryBean();
result.setResourceLocation(resourceLocation);
return result;
}
/**
* Create a UserDetailsResourceFactoryBean with a Resource that is a Properties file
* in the format defined in {@link UserDetailsResourceFactoryBean}. | * @param propertiesResource the Resource that is a properties file that contains the
* users
* @return the UserDetailsResourceFactoryBean
*/
public static UserDetailsResourceFactoryBean fromResource(Resource propertiesResource) {
UserDetailsResourceFactoryBean result = new UserDetailsResourceFactoryBean();
result.setResource(propertiesResource);
return result;
}
/**
* Creates a UserDetailsResourceFactoryBean with a resource from the provided String
* @param users the string representing the users
* @return the UserDetailsResourceFactoryBean
*/
public static UserDetailsResourceFactoryBean fromString(String users) {
InMemoryResource resource = new InMemoryResource(users);
return fromResource(resource);
}
} | repos\spring-security-main\config\src\main\java\org\springframework\security\config\core\userdetails\UserDetailsResourceFactoryBean.java | 2 |
请完成以下Java代码 | public IMutableAllocationResult call()
{
//
// Create a context identical like the one we got, but using our local transaction name
final IHUContext huContextInLocalTrx = huContextFactory.deriveWithTrxName(huContextInitial, ITrx.TRXNAME_ThreadInherited);
//
// Create HU Attribute transactions collector and register it to Attribute Storage
// TODO: for now, we are storing the transaction collector in a class field, but in future it shall be wrapped somewhere in HUContext
trxAttributesBuilder = new HUTransactionAttributeBuilder(huContextInLocalTrx);
//
// Do the actual processing
final IMutableAllocationResult result = processor.process(huContextInLocalTrx);
//
// If there are remaining attribute transactions, add them in a new transaction and process it
{
final IAllocationResult attributeTrxsResult = trxAttributesBuilder.createAndProcessAllocationResult();
//
// Merge result back to our final result (which will be returned at the end)
// NOTE: it could be that the result is null because we don't care about it
if (result != null)
{
AllocationUtils.mergeAllocationResult(result, attributeTrxsResult);
}
}
//
// Create packing material movements (if needed and required)
final List<HUPackingMaterialDocumentLineCandidate> candidates = huContextInLocalTrx
.getHUPackingMaterialsCollector()
.getAndClearCandidates();
if (!candidates.isEmpty())
{
huEmptiesService.newEmptiesMovementProducer()
.setEmptiesMovementDirectionAuto()
.addCandidates(candidates)
.createMovements();
} | //
// If we reach this point it was a success
success = true;
return result;
}
@Override
public boolean doCatch(final Throwable e) throws Throwable
{
success = false;
// Just pass it through
throw e;
}
@Override
public void doFinally()
{
//
// NOTE: don't do any kind of processing here because we are running out-of-transaction
//
//
// Dispose the attribute transactiosn builder/listeners
if (trxAttributesBuilder != null)
{
// If there was a failure, discard all collected transactions first
if (!success)
{
trxAttributesBuilder.clearTransactions();
}
// We are disposing (i.e. unregistering all underlying listeners) of this builder,
// no matter if this processing was a success or not because,
// there nothing we can do anyway with this builder
trxAttributesBuilder.dispose();
trxAttributesBuilder = null;
}
}
});
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\allocation\impl\HUContextProcessorExecutor.java | 1 |
请完成以下Java代码 | public int getC_BP_BankAccount_ID()
{
return get_ValueAsInt(COLUMNNAME_C_BP_BankAccount_ID);
}
@Override
public void setDateLastUsed (final @Nullable java.sql.Timestamp DateLastUsed)
{
set_Value (COLUMNNAME_DateLastUsed, DateLastUsed);
}
@Override
public java.sql.Timestamp getDateLastUsed()
{
return get_ValueAsTimestamp(COLUMNNAME_DateLastUsed);
}
@Override
public void setIsRecurring (final boolean IsRecurring)
{
set_Value (COLUMNNAME_IsRecurring, IsRecurring);
}
@Override
public boolean isRecurring()
{
return get_ValueAsBoolean(COLUMNNAME_IsRecurring);
}
@Override
public void setMandateDate (final java.sql.Timestamp MandateDate)
{
set_Value (COLUMNNAME_MandateDate, MandateDate);
}
@Override
public java.sql.Timestamp getMandateDate()
{
return get_ValueAsTimestamp(COLUMNNAME_MandateDate);
} | @Override
public void setMandateReference (final java.lang.String MandateReference)
{
set_Value (COLUMNNAME_MandateReference, MandateReference);
}
@Override
public java.lang.String getMandateReference()
{
return get_ValueAsString(COLUMNNAME_MandateReference);
}
/**
* MandateStatus AD_Reference_ID=541976
* Reference name: Mandat Status
*/
public static final int MANDATESTATUS_AD_Reference_ID=541976;
/** FirstTime = F */
public static final String MANDATESTATUS_FirstTime = "F";
/** Recurring = R */
public static final String MANDATESTATUS_Recurring = "R";
/** LastTime = L */
public static final String MANDATESTATUS_LastTime = "L";
@Override
public void setMandateStatus (final java.lang.String MandateStatus)
{
set_Value (COLUMNNAME_MandateStatus, MandateStatus);
}
@Override
public java.lang.String getMandateStatus()
{
return get_ValueAsString(COLUMNNAME_MandateStatus);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_BP_BankAccount_DirectDebitMandate.java | 1 |
请完成以下Java代码 | private final MFSession getFromCache(final Properties ctx, final int AD_Session_ID)
{
if (AD_Session_ID <= 0)
{
return null;
}
final MFSession session = s_sessions.get(AD_Session_ID);
if (session == null)
{
return null;
}
if (session.getAD_Session_ID() != AD_Session_ID)
{
return null;
}
return session;
}
@Override
public void logoutCurrentSession()
{
final Properties ctx = Env.getCtx();
final MFSession session = getCurrentSession(ctx);
if (session == null)
{
// no currently running session
return;
}
final boolean alreadyDestroyed = session.isDestroyed();
// Fire BeforeLogout event only if current session is not yet closes(i.e. processed)
if (!alreadyDestroyed)
{
ModelValidationEngine.get().fireBeforeLogout(session);
}
session.setDestroyed();
Env.removeContext(ctx, Env.CTXNAME_AD_Session_ID);
s_sessions.remove(session.getAD_Session_ID()); | // Fire AfterLogout event only if current session was closed right now
if (!alreadyDestroyed && session.isDestroyed())
{
ModelValidationEngine.get().fireAfterLogout(session);
}
}
@Override
public void setDisableChangeLogsForThread(final boolean disable)
{
disableChangeLogsThreadLocal.set(disable);
}
@Override
public boolean isChangeLogEnabled()
{
//
// Check if it's disabled for current thread
final Boolean disableChangeLogsThreadLocalValue = disableChangeLogsThreadLocal.get();
if (Boolean.TRUE.equals(disableChangeLogsThreadLocalValue))
{
return false;
}
//
// Check if role allows us to create the change log
final IUserRolePermissions role = Env.getUserRolePermissionsOrNull();
if (role != null && !role.hasPermission(IUserRolePermissions.PERMISSION_ChangeLog))
{
return false;
}
return true; // enabled
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\session\impl\SessionBL.java | 1 |
请完成以下Java代码 | public void handle(Document document)
{
for (List<Word> sentence : document.getSimpleSentenceList(true))
{
for (Word word : sentence)
{
if (shouldInclude(word))
dictionaryMaker.add(word);
}
}
// for (List<Word> sentence : document.getSimpleSentenceList(false))
// {
// for (Word word : sentence)
// {
// if (shouldInclude(word))
// dictionaryMaker.add(word);
// }
// }
}
/**
* 是否应当计算这个词语
* @param word
* @return
*/ | boolean shouldInclude(Word word)
{
if ("m".equals(word.label) || "mq".equals(word.label) || "w".equals(word.label) || "t".equals(word.label))
{
if (!TextUtility.isAllChinese(word.value)) return false;
}
else if ("nr".equals(word.label))
{
return false;
}
return true;
}
});
if (outPath != null)
return dictionaryMaker.saveTxtTo(outPath);
return false;
}
} | repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\corpus\dictionary\NatureDictionaryMaker.java | 1 |
请完成以下Java代码 | public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getEdition() {
return edition;
}
public void setEdition(String edition) {
this.edition = edition;
}
public InternalsDto getInternals() { | return internals;
}
public void setInternals(InternalsDto internals) {
this.internals = internals;
}
public static ProductDto fromEngineDto(Product other) {
return new ProductDto(
other.getName(),
other.getVersion(),
other.getEdition(),
InternalsDto.fromEngineDto(other.getInternals()));
}
} | repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\telemetry\ProductDto.java | 1 |
请完成以下Java代码 | public class NotificationEntity extends BaseSqlEntity<Notification> {
@Column(name = ModelConstants.NOTIFICATION_REQUEST_ID_PROPERTY, nullable = false)
private UUID requestId;
@Column(name = ModelConstants.NOTIFICATION_RECIPIENT_ID_PROPERTY, nullable = false)
private UUID recipientId;
@Enumerated(EnumType.STRING)
@Column(name = ModelConstants.NOTIFICATION_TYPE_PROPERTY, nullable = false)
private NotificationType type;
@Enumerated(EnumType.STRING)
@Column(name = ModelConstants.NOTIFICATION_DELIVERY_METHOD_PROPERTY, nullable = false)
private NotificationDeliveryMethod deliveryMethod;
@Column(name = ModelConstants.NOTIFICATION_SUBJECT_PROPERTY)
private String subject;
@Column(name = ModelConstants.NOTIFICATION_TEXT_PROPERTY, nullable = false)
private String text;
@Convert(converter = JsonConverter.class)
@Column(name = ModelConstants.NOTIFICATION_ADDITIONAL_CONFIG_PROPERTY)
private JsonNode additionalConfig;
@Convert(converter = JsonConverter.class)
@Formula("(SELECT r.info FROM notification_request r WHERE r.id = request_id)")
private JsonNode info;
@Enumerated(EnumType.STRING)
@Column(name = ModelConstants.NOTIFICATION_STATUS_PROPERTY)
private NotificationStatus status;
public NotificationEntity() {}
public NotificationEntity(Notification notification) {
setId(notification.getUuidId());
setCreatedTime(notification.getCreatedTime()); | setRequestId(getUuid(notification.getRequestId()));
setRecipientId(getUuid(notification.getRecipientId()));
setType(notification.getType());
setDeliveryMethod(notification.getDeliveryMethod());
setSubject(notification.getSubject());
setText(notification.getText());
setAdditionalConfig(notification.getAdditionalConfig());
setInfo(toJson(notification.getInfo()));
setStatus(notification.getStatus());
}
@Override
public Notification toData() {
Notification notification = new Notification();
notification.setId(new NotificationId(id));
notification.setCreatedTime(createdTime);
notification.setRequestId(getEntityId(requestId, NotificationRequestId::new));
notification.setRecipientId(getEntityId(recipientId, UserId::new));
notification.setType(type);
notification.setDeliveryMethod(deliveryMethod);
notification.setSubject(subject);
notification.setText(text);
notification.setAdditionalConfig(additionalConfig);
notification.setInfo(fromJson(info, NotificationInfo.class));
notification.setStatus(status);
return notification;
}
} | repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\model\sql\NotificationEntity.java | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.