instruction string | input string | output string | source_file string | priority int64 |
|---|---|---|---|---|
请完成以下Java代码 | private LdapAuthenticator getAuthenticator() {
return this.authenticator;
}
private void setAuthoritiesPopulator(LdapAuthoritiesPopulator authoritiesPopulator) {
Assert.notNull(authoritiesPopulator, "An LdapAuthoritiesPopulator must be supplied");
this.authoritiesPopulator = authoritiesPopulator;
}
protected LdapAuthoritiesPopulator getAuthoritiesPopulator() {
return this.authoritiesPopulator;
}
public void setHideUserNotFoundExceptions(boolean hideUserNotFoundExceptions) {
this.hideUserNotFoundExceptions = hideUserNotFoundExceptions;
}
@Override
protected DirContextOperations doAuthentication(UsernamePasswordAuthenticationToken authentication) {
try {
return getAuthenticator().authenticate(authentication);
}
catch (PasswordPolicyException ex) {
// The only reason a ppolicy exception can occur during a bind is that the
// account is locked. | throw new LockedException(
this.messages.getMessage(ex.getStatus().getErrorCode(), ex.getStatus().getDefaultMessage()));
}
catch (UsernameNotFoundException ex) {
if (this.hideUserNotFoundExceptions) {
throw new BadCredentialsException(
this.messages.getMessage("LdapAuthenticationProvider.badCredentials", "Bad credentials"));
}
throw ex;
}
catch (NamingException ex) {
throw new InternalAuthenticationServiceException(ex.getMessage(), ex);
}
}
@Override
protected Collection<? extends GrantedAuthority> loadUserAuthorities(DirContextOperations userData, String username,
String password) {
return getAuthoritiesPopulator().getGrantedAuthorities(userData, username);
}
} | repos\spring-security-main\ldap\src\main\java\org\springframework\security\ldap\authentication\LdapAuthenticationProvider.java | 1 |
请完成以下Java代码 | public Set<ConvertiblePair> getConvertibleTypes() {
return Collections.singleton(new ConvertiblePair(Collection.class, String.class));
}
@Override
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
TypeDescriptor sourceElementType = sourceType.getElementTypeDescriptor();
if (targetType == null || sourceElementType == null) {
return true;
}
return this.conversionService.canConvert(sourceElementType, targetType)
|| sourceElementType.getType().isAssignableFrom(targetType.getType());
}
@Override
@Contract("!null, _, _ -> !null")
public @Nullable Object convert(@Nullable Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
if (source == null) {
return null;
}
Collection<?> sourceCollection = (Collection<?>) source;
return convert(sourceCollection, sourceType, targetType);
}
private Object convert(Collection<?> source, TypeDescriptor sourceType, TypeDescriptor targetType) { | if (source.isEmpty()) {
return "";
}
return source.stream()
.map((element) -> convertElement(element, sourceType, targetType))
.collect(Collectors.joining(getDelimiter(sourceType)));
}
private CharSequence getDelimiter(TypeDescriptor sourceType) {
Delimiter annotation = sourceType.getAnnotation(Delimiter.class);
return (annotation != null) ? annotation.value() : ",";
}
private String convertElement(Object element, TypeDescriptor sourceType, TypeDescriptor targetType) {
return String
.valueOf(this.conversionService.convert(element, sourceType.elementTypeDescriptor(element), targetType));
}
} | repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\convert\CollectionToDelimitedStringConverter.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class BookstoreService {
private final AuthorRepository authorRepository;
public BookstoreService(AuthorRepository authorRepository) {
this.authorRepository = authorRepository;
}
@Transactional(readOnly = true)
public List<AuthorDto> fetchAll() {
List<AuthorDto> authors = authorRepository.fetchAll();
return authors;
} | @Transactional(readOnly = true)
public List<AuthorDto> fetchAgeNameGenre() {
List<AuthorDto> authors = authorRepository.fetchAgeNameGenre();
return authors;
}
@Transactional(readOnly = true)
public List<AuthorDto> fetchNameEmail() {
List<AuthorDto> authors = authorRepository.fetchNameEmail();
return authors;
}
} | repos\Hibernate-SpringBoot-master\HibernateSpringBootReuseProjection\src\main\java\com\bookstore\service\BookstoreService.java | 2 |
请完成以下Java代码 | protected org.compiere.model.POInfo initPO(final Properties ctx)
{
return org.compiere.model.POInfo.getPOInfo(Table_Name);
}
@Override
public void setC_HierarchyCommissionSettings_ID (final int C_HierarchyCommissionSettings_ID)
{
if (C_HierarchyCommissionSettings_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_HierarchyCommissionSettings_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_HierarchyCommissionSettings_ID, C_HierarchyCommissionSettings_ID);
}
@Override
public int getC_HierarchyCommissionSettings_ID()
{
return get_ValueAsInt(COLUMNNAME_C_HierarchyCommissionSettings_ID);
}
@Override
public void setCommission_Product_ID (final int Commission_Product_ID)
{
if (Commission_Product_ID < 1)
set_Value (COLUMNNAME_Commission_Product_ID, null);
else
set_Value (COLUMNNAME_Commission_Product_ID, Commission_Product_ID);
}
@Override
public int getCommission_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_Commission_Product_ID);
}
@Override
public void setDescription (final @Nullable java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
@Override
public java.lang.String getDescription()
{
return get_ValueAsString(COLUMNNAME_Description);
}
@Override
public void setIsCreateShareForOwnRevenue (final boolean IsCreateShareForOwnRevenue)
{
set_Value (COLUMNNAME_IsCreateShareForOwnRevenue, IsCreateShareForOwnRevenue);
}
@Override
public boolean isCreateShareForOwnRevenue()
{
return get_ValueAsBoolean(COLUMNNAME_IsCreateShareForOwnRevenue);
}
@Override
public void setIsSubtractLowerLevelCommissionFromBase (final boolean IsSubtractLowerLevelCommissionFromBase)
{ | set_Value (COLUMNNAME_IsSubtractLowerLevelCommissionFromBase, IsSubtractLowerLevelCommissionFromBase);
}
@Override
public boolean isSubtractLowerLevelCommissionFromBase()
{
return get_ValueAsBoolean(COLUMNNAME_IsSubtractLowerLevelCommissionFromBase);
}
@Override
public void setName (final java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
@Override
public void setPointsPrecision (final int PointsPrecision)
{
set_Value (COLUMNNAME_PointsPrecision, PointsPrecision);
}
@Override
public int getPointsPrecision()
{
return get_ValueAsInt(COLUMNNAME_PointsPrecision);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java-gen\de\metas\contracts\commission\model\X_C_HierarchyCommissionSettings.java | 1 |
请完成以下Java代码 | private static Function<RegisteredClient, OAuth2TokenValidator<Jwt>> defaultJwtValidatorFactory() {
return (registeredClient) -> {
String clientId = registeredClient.getClientId();
return new DelegatingOAuth2TokenValidator<>(new JwtClaimValidator<>(JwtClaimNames.ISS, clientId::equals),
new JwtClaimValidator<>(JwtClaimNames.SUB, clientId::equals),
new JwtClaimValidator<>(JwtClaimNames.AUD, containsAudience()),
new JwtClaimValidator<>(JwtClaimNames.EXP, Objects::nonNull), new JwtTimestampValidator());
};
}
private static Predicate<List<String>> containsAudience() {
return (audienceClaim) -> {
if (CollectionUtils.isEmpty(audienceClaim)) {
return false;
}
List<String> audienceList = getAudience();
for (String audience : audienceClaim) {
if (audienceList.contains(audience)) {
return true;
}
}
return false;
};
}
private static List<String> getAudience() { | AuthorizationServerContext authorizationServerContext = AuthorizationServerContextHolder.getContext();
if (!StringUtils.hasText(authorizationServerContext.getIssuer())) {
return Collections.emptyList();
}
AuthorizationServerSettings authorizationServerSettings = authorizationServerContext
.getAuthorizationServerSettings();
List<String> audience = new ArrayList<>();
audience.add(authorizationServerContext.getIssuer());
audience.add(asUrl(authorizationServerContext.getIssuer(), authorizationServerSettings.getTokenEndpoint()));
audience.add(asUrl(authorizationServerContext.getIssuer(),
authorizationServerSettings.getTokenIntrospectionEndpoint()));
audience.add(asUrl(authorizationServerContext.getIssuer(),
authorizationServerSettings.getTokenRevocationEndpoint()));
audience.add(asUrl(authorizationServerContext.getIssuer(),
authorizationServerSettings.getPushedAuthorizationRequestEndpoint()));
return audience;
}
private static String asUrl(String issuer, String endpoint) {
return UriComponentsBuilder.fromUriString(issuer).path(endpoint).build().toUriString();
}
} | repos\spring-security-main\oauth2\oauth2-authorization-server\src\main\java\org\springframework\security\oauth2\server\authorization\authentication\JwtClientAssertionDecoderFactory.java | 1 |
请完成以下Java代码 | public class BeansConfigurationHelper {
public static AbstractEngineConfiguration parseEngineConfiguration(Resource springResource, String beanName) {
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(beanFactory);
xmlBeanDefinitionReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD);
xmlBeanDefinitionReader.loadBeanDefinitions(springResource);
// Check non singleton beans for types
// Do not eagerly initialize FactorBeans when getting BeanFactoryPostProcessor beans
Collection<BeanFactoryPostProcessor> factoryPostProcessors = beanFactory.getBeansOfType(BeanFactoryPostProcessor.class, true, false).values();
if (factoryPostProcessors.isEmpty()) {
factoryPostProcessors = Collections.singleton(new PropertyPlaceholderConfigurer());
}
for (BeanFactoryPostProcessor factoryPostProcessor : factoryPostProcessors) {
factoryPostProcessor.postProcessBeanFactory(beanFactory);
}
AbstractEngineConfiguration engineConfiguration = (AbstractEngineConfiguration) beanFactory.getBean(beanName); | engineConfiguration.setBeans(new SpringBeanFactoryProxyMap(beanFactory));
return engineConfiguration;
}
public static AbstractEngineConfiguration parseEngineConfigurationFromInputStream(InputStream inputStream, String beanName) {
Resource springResource = new InputStreamResource(inputStream);
return parseEngineConfiguration(springResource, beanName);
}
public static AbstractEngineConfiguration parseEngineConfigurationFromResource(String resource, String beanName) {
Resource springResource = new ClassPathResource(resource);
return parseEngineConfiguration(springResource, beanName);
}
} | repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\cfg\BeansConfigurationHelper.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public static String getSign(SortedMap<String, Object> paramMap, String key) {
StringBuilder signBuilder = new StringBuilder();
for (Map.Entry<String, Object> entry : paramMap.entrySet()) {
if (!"sign".equals(entry.getKey()) && !StringUtil.isEmpty(entry.getValue())) {
signBuilder.append(entry.getKey()).append("=").append(entry.getValue()).append("&");
}
}
signBuilder.append("key=").append(key);
logger.info("微信待签名参数字符串:{}", signBuilder.toString());
return MD5Util.encode(signBuilder.toString()).toUpperCase();
}
/**
* 转xml格式
*
* @param paramMap | * @return
*/
private static String mapToXml(SortedMap<String, Object> paramMap) {
StringBuilder dataBuilder = new StringBuilder("<xml>");
for (Map.Entry<String, Object> entry : paramMap.entrySet()) {
if (!StringUtil.isEmpty(entry.getValue())) {
dataBuilder.append("<").append(entry.getKey()).append(">").append(entry.getValue()).append("</").append(entry.getKey()).append(">");
}
}
dataBuilder.append("</xml>");
logger.info("Map转Xml结果:{}", dataBuilder.toString());
return dataBuilder.toString();
}
} | repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\trade\utils\weixin\WeiXinPayUtil.java | 2 |
请完成以下Java代码 | public final class SessionInformationExpiredEvent extends ApplicationEvent {
private final HttpServletRequest request;
private final HttpServletResponse response;
private final @Nullable FilterChain filterChain;
/**
* Creates a new instance
* @param sessionInformation the SessionInformation that is expired
* @param request the HttpServletRequest
* @param response the HttpServletResponse
*/
public SessionInformationExpiredEvent(SessionInformation sessionInformation, HttpServletRequest request,
HttpServletResponse response) {
this(sessionInformation, request, response, null);
}
/**
* Creates a new instance
* @param sessionInformation the SessionInformation that is expired
* @param request the HttpServletRequest
* @param response the HttpServletResponse
* @param filterChain the FilterChain
* @since 6.4
*/
public SessionInformationExpiredEvent(SessionInformation sessionInformation, HttpServletRequest request,
HttpServletResponse response, @Nullable FilterChain filterChain) {
super(sessionInformation);
Assert.notNull(request, "request cannot be null");
Assert.notNull(response, "response cannot be null");
this.request = request;
this.response = response;
this.filterChain = filterChain;
}
/** | * @return the request
*/
public HttpServletRequest getRequest() {
return this.request;
}
/**
* @return the response
*/
public HttpServletResponse getResponse() {
return this.response;
}
public SessionInformation getSessionInformation() {
return (SessionInformation) getSource();
}
/**
* @return the filter chain. Can be {@code null}.
* @since 6.4
*/
public @Nullable FilterChain getFilterChain() {
return this.filterChain;
}
} | repos\spring-security-main\web\src\main\java\org\springframework\security\web\session\SessionInformationExpiredEvent.java | 1 |
请在Spring Boot框架中完成以下Java代码 | static final class SqlServerFlywayConfigurationCustomizer implements FlywayConfigurationCustomizer {
private final FlywayProperties properties;
SqlServerFlywayConfigurationCustomizer(FlywayProperties properties) {
this.properties = properties;
}
@Override
public void customize(FluentConfiguration configuration) {
Extension<SQLServerConfigurationExtension> extension = new Extension<>(configuration,
SQLServerConfigurationExtension.class, "SQL Server");
Sqlserver properties = this.properties.getSqlserver();
PropertyMapper map = PropertyMapper.get();
map.from(properties::getKerberosLoginFile).to(extension.via(this::setKerberosLoginFile));
}
private void setKerberosLoginFile(SQLServerConfigurationExtension configuration, String file) {
configuration.getKerberos().getLogin().setFile(file);
}
}
/**
* Helper class used to map properties to a {@link ConfigurationExtension}.
*
* @param <E> the extension type
*/ | static class Extension<E extends ConfigurationExtension> {
private final Supplier<E> extension;
Extension(FluentConfiguration configuration, Class<E> type, String name) {
this.extension = SingletonSupplier.of(() -> {
E extension = configuration.getPluginRegister().getExact(type);
Assert.state(extension != null, () -> "Flyway %s extension missing".formatted(name));
return extension;
});
}
<T> Consumer<T> via(BiConsumer<E, T> action) {
return (value) -> action.accept(this.extension.get(), value);
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-flyway\src\main\java\org\springframework\boot\flyway\autoconfigure\FlywayAutoConfiguration.java | 2 |
请完成以下Java代码 | public void setDepreciationType (int DepreciationType)
{
set_Value (COLUMNNAME_DepreciationType, Integer.valueOf(DepreciationType));
}
/** Get DepreciationType.
@return DepreciationType */
public int getDepreciationType ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_DepreciationType);
if (ii == null)
return 0;
return ii.intValue();
}
/** PostingType AD_Reference_ID=125 */
public static final int POSTINGTYPE_AD_Reference_ID=125;
/** Actual = A */
public static final String POSTINGTYPE_Actual = "A";
/** Budget = B */
public static final String POSTINGTYPE_Budget = "B";
/** Commitment = E */
public static final String POSTINGTYPE_Commitment = "E";
/** Statistical = S */
public static final String POSTINGTYPE_Statistical = "S";
/** Reservation = R */
public static final String POSTINGTYPE_Reservation = "R";
/** Set PostingType.
@param PostingType
The type of posted amount for the transaction
*/
public void setPostingType (String PostingType)
{
set_Value (COLUMNNAME_PostingType, PostingType);
}
/** Get PostingType.
@return The type of posted amount for the transaction
*/
public String getPostingType ()
{
return (String)get_Value(COLUMNNAME_PostingType);
}
/** Set Process Now.
@param Processing Process Now */
public void setProcessing (boolean Processing)
{
set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
}
/** Get Process Now.
@return Process Now */
public boolean isProcessing ()
{
Object oo = get_Value(COLUMNNAME_Processing);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Usable Life - Months.
@param UseLifeMonths | Months of the usable life of the asset
*/
public void setUseLifeMonths (int UseLifeMonths)
{
set_Value (COLUMNNAME_UseLifeMonths, Integer.valueOf(UseLifeMonths));
}
/** Get Usable Life - Months.
@return Months of the usable life of the asset
*/
public int getUseLifeMonths ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_UseLifeMonths);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Usable Life - Years.
@param UseLifeYears
Years of the usable life of the asset
*/
public void setUseLifeYears (int UseLifeYears)
{
set_Value (COLUMNNAME_UseLifeYears, Integer.valueOf(UseLifeYears));
}
/** Get Usable Life - Years.
@return Years of the usable life of the asset
*/
public int getUseLifeYears ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_UseLifeYears);
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_A_Asset_Group_Acct.java | 1 |
请完成以下Java代码 | public String toString()
{
return MoreObjects.toStringHelper(this)
.add("C_BPartner_ID", C_BPartner_ID)
.add("M_Product_ID", M_Product_ID)
.add("ASI", M_AttributeSetInstance_ID)
// .add("M_HU_PI_Item_Product_ID", M_HU_PI_Item_Product_ID)
.add("C_Flatrate_DataEntry_ID", C_Flatrate_DataEntry_ID)
.toString();
}
@Override
public boolean equals(final Object obj)
{
if (this == obj)
{
return true;
}
final PMMBalanceSegment other = EqualsBuilder.getOther(this, obj);
if (other == null)
{
return false;
}
return new EqualsBuilder()
.append(C_BPartner_ID, other.C_BPartner_ID)
.append(M_Product_ID, other.M_Product_ID)
.append(M_AttributeSetInstance_ID, other.M_AttributeSetInstance_ID)
// .append(M_HU_PI_Item_Product_ID, other.M_HU_PI_Item_Product_ID)
.append(C_Flatrate_DataEntry_ID, other.C_Flatrate_DataEntry_ID)
.isEqual();
}
@Override
public int hashCode()
{
if (_hashCode == null)
{
_hashCode = new HashcodeBuilder()
.append(C_BPartner_ID)
.append(M_Product_ID)
.append(M_AttributeSetInstance_ID)
// .append(M_HU_PI_Item_Product_ID)
.append(C_Flatrate_DataEntry_ID)
.toHashcode();
}
return _hashCode;
}
public int getC_BPartner_ID()
{
return C_BPartner_ID;
}
public int getM_Product_ID()
{
return M_Product_ID;
}
public int getM_AttributeSetInstance_ID()
{
return M_AttributeSetInstance_ID;
}
// public int getM_HU_PI_Item_Product_ID() | // {
// return M_HU_PI_Item_Product_ID;
// }
public int getC_Flatrate_DataEntry_ID()
{
return C_Flatrate_DataEntry_ID;
}
public static final class Builder
{
private Integer C_BPartner_ID;
private Integer M_Product_ID;
private int M_AttributeSetInstance_ID = 0;
// private Integer M_HU_PI_Item_Product_ID;
private int C_Flatrate_DataEntry_ID = -1;
private Builder()
{
super();
}
public PMMBalanceSegment build()
{
return new PMMBalanceSegment(this);
}
public Builder setC_BPartner_ID(final int C_BPartner_ID)
{
this.C_BPartner_ID = C_BPartner_ID;
return this;
}
public Builder setM_Product_ID(final int M_Product_ID)
{
this.M_Product_ID = M_Product_ID;
return this;
}
public Builder setM_AttributeSetInstance_ID(final int M_AttributeSetInstance_ID)
{
this.M_AttributeSetInstance_ID = M_AttributeSetInstance_ID;
return this;
}
// public Builder setM_HU_PI_Item_Product_ID(final int M_HU_PI_Item_Product_ID)
// {
// this.M_HU_PI_Item_Product_ID = M_HU_PI_Item_Product_ID;
// return this;
// }
public Builder setC_Flatrate_DataEntry_ID(final int C_Flatrate_DataEntry_ID)
{
this.C_Flatrate_DataEntry_ID = C_Flatrate_DataEntry_ID;
return this;
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.procurement.base\src\main\java\de\metas\procurement\base\balance\PMMBalanceSegment.java | 1 |
请完成以下Spring Boot application配置 | ########################
# Timefold properties
########################
# The solver runs for 30 seconds. To run for 5 minutes use "5m" and for 2 hours use "2h".
timefold.solver.termination.spent-limit=30s
# When benchmarking, each individual solver runs for 15 seconds. To run for 5 minutes use "5m" and for 2 hours use "2h".
timefold.benchmark.solver.termination.spent-limit=15s
# To change how many solvers to run in parallel
# timefold.solver-manager.parallel-solver-count=4
# To run increase CPU cores usage per solver
# timefold.solver.move-thread-count=2
# Temporary comment this out to detect bugs in your code (lowers performance)
# timefold.solver.environment-mode=FULL_ASSERT
# To see what Timefold is doing, turn on DEBUG or TRACE logging.
logging.level.ai.timefold.solver=DEBUG
# XML file for power | tweaking, defaults to solverConfig.xml (directly under src/main/resources)
# timefold.solver-config-xml=org/.../timeTableSolverConfig.xml
########################
# Spring Boot properties
########################
# Make it easier to read Timefold logging
logging.pattern.console=%d{HH:mm:ss.SSS} %clr(${LOG_LEVEL_PATTERN:%5p}) %blue([%-15.15t]) %m%n | repos\springboot-demo-master\Timefold Solver\src\main\resources\application.properties | 2 |
请在Spring Boot框架中完成以下Java代码 | private QueueStatsId getQueueStatsId(TenantId tenantId, String queueName) {
TenantQueueKey key = new TenantQueueKey(tenantId, queueName);
QueueStatsId queueStatsId = tenantQueueStats.get(key);
if (queueStatsId == null) {
lock.lock();
try {
queueStatsId = tenantQueueStats.get(key);
if (queueStatsId == null) {
QueueStats queueStats = queueStatsService.findByTenantIdAndNameAndServiceId(tenantId, queueName , serviceInfoProvider.getServiceId());
if (queueStats == null) {
queueStats = new QueueStats();
queueStats.setTenantId(tenantId);
queueStats.setQueueName(queueName);
queueStats.setServiceId(serviceInfoProvider.getServiceId());
queueStats = queueStatsService.save(tenantId, queueStats);
}
queueStatsId = queueStats.getId(); | tenantQueueStats.put(key, queueStatsId);
}
} finally {
lock.unlock();
}
}
return queueStatsId;
}
@Data
private static class TenantQueueKey {
private final TenantId tenantId;
private final String queueName;
}
} | repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\stats\DefaultRuleEngineStatisticsService.java | 2 |
请完成以下Java代码 | private Optional<QtyAvailableStatus> computeQtyAvailableStatus()
{
return QtyAvailableStatus.computeOfLines(byProductId.values(), product -> product.getQtyAvailableStatus().orElse(null));
}
public PickingJobCandidateProducts updatingEachProduct(@NonNull UnaryOperator<PickingJobCandidateProduct> updater)
{
if (byProductId.isEmpty())
{
return this;
}
final ImmutableMap<ProductId, PickingJobCandidateProduct> byProductIdNew = byProductId.values()
.stream()
.map(updater)
.collect(ImmutableMap.toImmutableMap(PickingJobCandidateProduct::getProductId, product -> product));
return Objects.equals(this.byProductId, byProductIdNew)
? this
: new PickingJobCandidateProducts(byProductIdNew);
}
@Nullable
public ProductId getSingleProductIdOrNull()
{
return singleProduct != null ? singleProduct.getProductId() : null;
} | @Nullable
public Quantity getSingleQtyToDeliverOrNull()
{
return singleProduct != null ? singleProduct.getQtyToDeliver() : null;
}
@Nullable
public Quantity getSingleQtyAvailableToPickOrNull()
{
return singleProduct != null ? singleProduct.getQtyAvailableToPick() : null;
}
@Nullable
public ITranslatableString getSingleProductNameOrNull()
{
return singleProduct != null ? singleProduct.getProductName() : null;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\job\model\PickingJobCandidateProducts.java | 1 |
请完成以下Java代码 | public org.compiere.model.I_M_Requisition getM_Requisition() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_M_Requisition_ID, org.compiere.model.I_M_Requisition.class);
}
@Override
public void setM_Requisition(org.compiere.model.I_M_Requisition M_Requisition)
{
set_ValueFromPO(COLUMNNAME_M_Requisition_ID, org.compiere.model.I_M_Requisition.class, M_Requisition);
}
/** Set Bedarf.
@param M_Requisition_ID
Material Requisition
*/
@Override
public void setM_Requisition_ID (int M_Requisition_ID)
{
if (M_Requisition_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Requisition_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Requisition_ID, Integer.valueOf(M_Requisition_ID));
}
/** Get Bedarf.
@return Material Requisition
*/
@Override
public int getM_Requisition_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Requisition_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Bedarfs-Position.
@param M_RequisitionLine_ID
Material Requisition Line
*/
@Override
public void setM_RequisitionLine_ID (int M_RequisitionLine_ID)
{
if (M_RequisitionLine_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_RequisitionLine_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_RequisitionLine_ID, Integer.valueOf(M_RequisitionLine_ID));
}
/** Get Bedarfs-Position.
@return Material Requisition Line
*/
@Override | public int getM_RequisitionLine_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_RequisitionLine_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Einzelpreis.
@param PriceActual
Actual Price
*/
@Override
public void setPriceActual (java.math.BigDecimal PriceActual)
{
set_Value (COLUMNNAME_PriceActual, PriceActual);
}
/** Get Einzelpreis.
@return Actual Price
*/
@Override
public java.math.BigDecimal getPriceActual ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PriceActual);
if (bd == null)
return BigDecimal.ZERO;
return bd;
}
/** Set Menge.
@param Qty
Quantity
*/
@Override
public void setQty (java.math.BigDecimal Qty)
{
set_Value (COLUMNNAME_Qty, Qty);
}
/** Get Menge.
@return Quantity
*/
@Override
public java.math.BigDecimal getQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty);
if (bd == null)
return BigDecimal.ZERO;
return bd;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_RequisitionLine.java | 1 |
请完成以下Java代码 | public static void retrieveValueAggregationUsingDocument() {
ArrayList<Document> response = new ArrayList<>();
ArrayList<Document> pipeline = new ArrayList<>(Arrays.asList(new Document("$project", new Document("passengerId", 1L))));
database = mongoClient.getDatabase(databaseName);
database.getCollection(testCollectionName)
.aggregate(pipeline)
.allowDiskUse(true)
.into(response);
System.out.println("response:- " + response);
}
public static void main(String args[]) {
//
// Connect to cluster (default is localhost:27017)
//
setUp();
//
// Fetch the data using find query with projected fields | //
retrieveValueUsingFind();
//
// Fetch the data using aggregate pipeline query with projected fields
//
retrieveValueUsingAggregation();
//
// Fetch the data using aggregate pipeline document query with projected fields
//
retrieveValueAggregationUsingDocument();
}
} | repos\tutorials-master\persistence-modules\java-mongodb-2\src\main\java\com\baeldung\mongo\RetrieveValue.java | 1 |
请完成以下Java代码 | public String toString() {return toStringShort();}
private String toStringShort() {return type + "[" + startPosition + "-" + endPosition + "]";}
BooleanWithReason parseAndUpdateResult(@NonNull final ScannedCode scannedCode, @NonNull final ParsedScannedCodeBuilder result)
{
try
{
final String valueStr = extractAsString(scannedCode).orElse(null);
if (valueStr == null)
{
return BooleanWithReason.falseBecause("Cannot extract part " + this);
}
switch (type)
{
case Ignored:
break;
case Constant:
if (!Objects.equals(valueStr, constantValue))
{
return BooleanWithReason.falseBecause("Invalid constant marker, expected `" + constantValue + "` but was `" + valueStr + "`");
}
break;
case ProductCode:
result.productNo(valueStr);
break;
case WeightInKg:
result.weightKg(toBigDecimal(valueStr));
break;
case LotNo:
result.lotNo(trimLeadingZeros(valueStr.trim()));
break;
case BestBeforeDate:
result.bestBeforeDate(toLocalDate(valueStr));
break;
case ProductionDate:
result.productionDate(toLocalDate(valueStr));
break;
}
return BooleanWithReason.TRUE;
}
catch (final Exception ex)
{
return BooleanWithReason.falseBecause("Failed extracting " + this + " because " + ex.getLocalizedMessage());
}
}
private Optional<String> extractAsString(final ScannedCode scannedCode)
{
int startIndex = startPosition - 1;
int endIndex = endPosition - 1 + 1;
if (endIndex > scannedCode.length())
{
return Optional.empty();
}
return Optional.of(scannedCode.substring(startIndex, endIndex)); | }
private BigDecimal toBigDecimal(final String valueStr)
{
BigDecimal valueBD = new BigDecimal(valueStr);
if (decimalPointPosition > 0)
{
valueBD = valueBD.scaleByPowerOfTen(-decimalPointPosition);
}
return valueBD;
}
private LocalDate toLocalDate(final String valueStr)
{
final PatternedDateTimeFormatter dateFormat = coalesceNotNull(this.dateFormat, DEFAULT_DATE_FORMAT);
return dateFormat.parseLocalDate(valueStr);
}
private static String trimLeadingZeros(final String valueStr)
{
int index = 0;
while (index < valueStr.length() && valueStr.charAt(index) == '0')
{
index++;
}
return index == 0 ? valueStr : valueStr.substring(index);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\scannable_code\format\ScannableCodeFormatPart.java | 1 |
请完成以下Java代码 | private String readNumericDataField(int minLength, int maxLength)
{
String dataField = readDataField(minLength, maxLength);
if (!StringUtils.isNumber(dataField))
{
throw new AdempiereException("data field must be numeric: " + dataField);
}
return dataField;
}
private String readDataField(int minLength, int maxLength)
{
int length = 0;
int endIndex = position;
while (length < maxLength && endIndex < sequence.length())
{
if (sequence.charAt(endIndex) == SEPARATOR_CHAR)
{
break;
}
endIndex++;
length++;
}
if (length < minLength && minLength == maxLength)
{
throw new IllegalArgumentException("data field must be exactly " + minLength + " characters long");
}
if (length < minLength)
{
throw new IllegalArgumentException("data field must be at least " + minLength + " characters long");
}
String dataField = sequence.substring(position, endIndex);
position = endIndex;
return dataField;
}
private void skipSeparatorIfPresent()
{
if (position < sequence.length() && sequence.charAt(position) == SEPARATOR_CHAR)
{
position++;
}
}
public int remainingLength()
{ | return sequence.length() - position;
}
public boolean startsWith(String prefix)
{
return sequence.startsWith(prefix, position);
}
private char readChar()
{
return sequence.charAt(position++);
}
public String read(int length)
{
String s = peek(length);
position += length;
return s;
}
public String peek(int length)
{
return sequence.substring(position, position + length);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\gs1\GS1SequenceReader.java | 1 |
请完成以下Java代码 | protected void prepare()
{
for (final ProcessInfoParameter para : getParametersAsArray())
{
if (para.getParameter() == null)
{
continue;
}
final String parameterName = para.getParameterName();
if (PARAM_DeliveryDate.equals(parameterName))
{
p_deliveryDate = para.getParameterAsTimestamp();
}
if (PARAM_PreparationDate.equals(parameterName))
{
p_preparationDate = para.getParameterAsTimestamp();
}
}
final IShipmentSchedulePA shipmentSchedulePA = Services.get(IShipmentSchedulePA.class);
final IQueryFilter<I_M_ShipmentSchedule> userSelectionFilter = getProcessInfo().getQueryFilterOrElseFalse();
final IQueryBuilder<I_M_ShipmentSchedule> queryBuilderForShipmentSchedulesSelection = shipmentSchedulePA.createQueryForShipmentScheduleSelection(getCtx(), userSelectionFilter);
//
// Create selection and return how many items were added
final int selectionCount = queryBuilderForShipmentSchedulesSelection
.create()
.createSelection(getPinstanceId());
if (selectionCount <= 0)
{
throw new AdempiereException("@NoSelection@");
}
}
@Override
protected String doIt() throws Exception | {
final PInstanceId pinstanceId = getPinstanceId();
final IShipmentSchedulePA shipmentSchedulePA = Services.get(IShipmentSchedulePA.class);
// update delivery date
// no invalidation
shipmentSchedulePA.updateDeliveryDate_Override(p_deliveryDate, pinstanceId);
// In case preparation date is set as parameter, update the preparation date too
if (p_preparationDate != null)
{
// no invalidation. Just set the preparation date that was given
shipmentSchedulePA.updatePreparationDate_Override(p_preparationDate, pinstanceId);
}
else
{
// Initially, set null in preparation date. It will be calculated later, during the updating process.
// This update will invalidate the selected schedules.
shipmentSchedulePA.updatePreparationDate_Override(null, pinstanceId);
}
return MSG_OK;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\inoutcandidate\process\M_ShipmentSchedule_ChangeDeliveryDate.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public List<Employee> getAllEmployeesUsingCriteriaAPI() {
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<Employee> criteriaQuery = criteriaBuilder.createQuery(Employee.class);
Root<Employee> employeeRoot = criteriaQuery.from(Employee.class);
criteriaQuery.select(employeeRoot);
Query query = entityManager.createQuery(criteriaQuery);
return query.getResultList();
}
public List<Employee> getAllEmployeesByDepartmentUsingCriteriaAPI(String department) {
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<Employee> criteriaQuery = criteriaBuilder.createQuery(Employee.class);
Root<Employee> employeeRoot = criteriaQuery.from(Employee.class);
Predicate departmentPredicate = criteriaBuilder.equal(employeeRoot.get("department"), department);
Path<Object> sortByPath = employeeRoot.get("lastName");
criteriaQuery.orderBy(criteriaBuilder.asc(sortByPath));
criteriaQuery.select(employeeRoot)
.where(departmentPredicate);
Query query = entityManager.createQuery(criteriaQuery); | return query.getResultList();
}
public List<Employee> getAllEmployeesByDepartmentUsingOneToManyAnnotations(String departmentName) {
try {
// Retrieve the department by its name
Department department = entityManager.createQuery("SELECT d FROM Department d WHERE d.name = :name", Department.class)
.setParameter("name", departmentName)
.getSingleResult();
// Return the list of employees associated with the department
return department.getEmployees();
} catch (NoResultException e) {
return Collections.emptyList();
}
}
} | repos\tutorials-master\persistence-modules\hibernate-queries-2\src\main\java\com\baeldung\hibernate\listentity\service\EmployeeService.java | 2 |
请完成以下Java代码 | public final class NullStringExpression implements ICachedStringExpression
{
public static final NullStringExpression instance = new NullStringExpression();
private NullStringExpression()
{
super();
}
@Override
public String getExpressionString()
{
return "";
}
@Override
public String getFormatedExpressionString()
{
return "";
}
@Override
public Set<CtxName> getParameters()
{
return ImmutableSet.of();
}
@Override
public String evaluate(final Evaluatee ctx, final boolean ignoreUnparsable)
{
return EMPTY_RESULT;
}
@Override
public String evaluate(final Evaluatee ctx, final OnVariableNotFound onVariableNotFound)
{
return EMPTY_RESULT; | }
@Override
public final IStringExpression resolvePartial(final Evaluatee ctx)
{
return this;
}
@Override
public boolean isNullExpression()
{
return true;
}
@Override
public Class<String> getValueClass()
{
// TODO Auto-generated method stub
return null;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\expression\api\NullStringExpression.java | 1 |
请完成以下Java代码 | public void setISO_Code (String ISO_Code)
{
set_Value (COLUMNNAME_ISO_Code, ISO_Code);
}
/** Get ISO Currency Code.
@return Three letter ISO 4217 Code of the Currency
*/
public String getISO_Code ()
{
return (String)get_Value(COLUMNNAME_ISO_Code);
}
/** Set ISO Currency To Code.
@param ISO_Code_To
Three letter ISO 4217 Code of the To Currency
*/
public void setISO_Code_To (String ISO_Code_To)
{
set_Value (COLUMNNAME_ISO_Code_To, ISO_Code_To);
}
/** Get ISO Currency To Code.
@return Three letter ISO 4217 Code of the To Currency
*/
public String getISO_Code_To ()
{
return (String)get_Value(COLUMNNAME_ISO_Code_To);
}
/** Set Multiply Rate.
@param MultiplyRate
Rate to multiple the source by to calculate the target.
*/
public void setMultiplyRate (BigDecimal MultiplyRate)
{
set_Value (COLUMNNAME_MultiplyRate, MultiplyRate);
}
/** Get Multiply Rate.
@return Rate to multiple the source by to calculate the target.
*/
public BigDecimal getMultiplyRate ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_MultiplyRate);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Processed.
@param Processed
The document has been processed
*/
public void setProcessed (boolean Processed)
{
set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
}
/** Get Processed.
@return The document has been processed
*/
public boolean isProcessed ()
{
Object oo = get_Value(COLUMNNAME_Processed); | if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Process Now.
@param Processing Process Now */
public void setProcessing (boolean Processing)
{
set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
}
/** Get Process Now.
@return Process Now */
public boolean isProcessing ()
{
Object oo = get_Value(COLUMNNAME_Processing);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Valid from.
@param ValidFrom
Valid from including this date (first day)
*/
public void setValidFrom (Timestamp ValidFrom)
{
set_Value (COLUMNNAME_ValidFrom, ValidFrom);
}
/** Get Valid from.
@return Valid from including this date (first day)
*/
public Timestamp getValidFrom ()
{
return (Timestamp)get_Value(COLUMNNAME_ValidFrom);
}
/** Set Valid to.
@param ValidTo
Valid to including this date (last day)
*/
public void setValidTo (Timestamp ValidTo)
{
set_Value (COLUMNNAME_ValidTo, ValidTo);
}
/** Get Valid to.
@return Valid to including this date (last day)
*/
public Timestamp getValidTo ()
{
return (Timestamp)get_Value(COLUMNNAME_ValidTo);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_I_Conversion_Rate.java | 1 |
请在Spring Boot框架中完成以下Java代码 | class CredentialsService {
private final UserRepository userRepository;
private final PasswordService passwordService;
private final UserTokenProvider tokenProvider;
public Mono<UserView> login(UserAuthenticationRequest request) {
var email = request.getEmail();
var password = request.getPassword();
return userRepository.findByEmailOrFail(email)
.map(user -> loginUser(password, user));
}
public Mono<UserView> signup(UserRegistrationRequest request) {
return userRepository.existsByEmail(request.getEmail())
.flatMap(existsByEmail -> {
if (existsByEmail) {
return Mono.error(emailAlreadyInUseException());
}
return userRepository.existsByUsername(request.getUsername());
})
.flatMap(existsByUsername -> {
if (existsByUsername) {
return Mono.error(usernameAlreadyInUseException());
}
return registerNewUser(request);
});
}
private UserView loginUser(String password, User user) {
var encodedPassword = user.getEncodedPassword();
if (!passwordService.matchesRowPasswordWithEncodedPassword(password, encodedPassword)) { | throw new InvalidRequestException("Password", "invalid");
}
return createAuthenticationResponse(user);
}
private UserView createAuthenticationResponse(User user) {
var token = tokenProvider.getToken(user.getId());
return UserView.fromUserAndToken(user, token);
}
private Mono<UserView> registerNewUser(UserRegistrationRequest request) {
var rowPassword = request.getPassword();
var encodedPassword = passwordService.encodePassword(rowPassword);
var id = UUID.randomUUID().toString();
var user = request.toUser(encodedPassword, id);
return userRepository
.save(user)
.map(this::createAuthenticationResponse);
}
private InvalidRequestException usernameAlreadyInUseException() {
return new InvalidRequestException("Username", "already in use");
}
private InvalidRequestException emailAlreadyInUseException() {
return new InvalidRequestException("Email", "already in use");
}
} | repos\realworld-spring-webflux-master\src\main\java\com\realworld\springmongo\user\CredentialsService.java | 2 |
请完成以下Java代码 | public class AstComposite extends AstRightValue {
private final List<AstNode> nodes;
public AstComposite(List<AstNode> nodes) {
this.nodes = nodes;
}
@Override
public Object eval(Bindings bindings, ELContext context) {
StringBuilder b = new StringBuilder(16);
for (int i = 0; i < getCardinality(); i++) {
b.append(bindings.convert(nodes.get(i).eval(bindings, context), String.class));
}
return b.toString();
}
@Override
public String toString() {
return "composite";
} | @Override
public void appendStructure(StringBuilder b, Bindings bindings) {
for (int i = 0; i < getCardinality(); i++) {
nodes.get(i).appendStructure(b, bindings);
}
}
public int getCardinality() {
return nodes.size();
}
public AstNode getChild(int i) {
return nodes.get(i);
}
} | repos\Activiti-develop\activiti-core-common\activiti-juel-jakarta\src\main\java\org\activiti\core\el\juel\tree\impl\ast\AstComposite.java | 1 |
请完成以下Java代码 | private AttributesKeyPart toAttributeKeyPartOrNull(final Object value)
{
if (AttributeValueType.STRING.equals(attributeValueType))
{
final String valueStr = value != null ? value.toString() : null;
return AttributesKeyPart.ofStringAttribute(attributeId, valueStr);
}
else if (AttributeValueType.NUMBER.equals(attributeValueType))
{
final BigDecimal valueBD = NumberUtils.asBigDecimal(value);
return BigDecimal.ZERO.equals(valueBD)
? null
: AttributesKeyPart.ofNumberAttribute(attributeId, valueBD);
}
else if (AttributeValueType.DATE.equals(attributeValueType)) | {
final LocalDate valueDate = TimeUtil.asLocalDate(value);
return AttributesKeyPart.ofDateAttribute(attributeId, valueDate);
}
else if (AttributeValueType.LIST.equals(attributeValueType))
{
final AttributeValueId attributeValueId = (AttributeValueId)value;
return attributeValueId != null
? AttributesKeyPart.ofAttributeValueId(attributeValueId)
: null;
}
else
{
throw new AdempiereException("Unknown attribute value type: " + attributeValueType);
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\material\interceptor\HUAttributeChange.java | 1 |
请完成以下Java代码 | public ManyToOneMapping withNewOwner(String newOwner) {
this.withNewOwner = newOwner;
return this;
}
@Override
public String getWithNewOwner() {
return withNewOwner;
}
@Override
public ManyToOneMapping withLocalVariable(String variableName, Object variableValue) {
withLocalVariables.put(variableName, variableValue);
return this;
}
@Override
public ManyToOneMapping withLocalVariables(Map<String, Object> variables) {
withLocalVariables.putAll(variables); | return this;
}
@Override
public Map<String, Object> getActivityLocalVariables() {
return withLocalVariables;
}
@Override
public String toString() {
return "ManyToOneMapping{" + "fromActivityIds=" + fromActivityIds + ", toActivityId='" + toActivityId + '\'' + '}';
}
}
} | repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\migration\ActivityMigrationMapping.java | 1 |
请完成以下Java代码 | protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_K_Category[")
.append(get_ID()).append("]");
return sb.toString();
}
/** 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 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 Knowledge Category.
@param K_Category_ID
Knowledge Category
*/
public void setK_Category_ID (int K_Category_ID)
{
if (K_Category_ID < 1)
set_ValueNoCheck (COLUMNNAME_K_Category_ID, null);
else
set_ValueNoCheck (COLUMNNAME_K_Category_ID, Integer.valueOf(K_Category_ID));
}
/** Get Knowledge Category. | @return Knowledge Category
*/
public int getK_Category_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_K_Category_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** 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_K_Category.java | 1 |
请完成以下Java代码 | public boolean isVirtual(final I_M_HU_Item item)
{
return handlingUnitsBL.isVirtual(item);
}
public List<I_M_HU_Item> retrieveItems(@NonNull final I_M_HU hu)
{
return getHandlingUnitsDAO().retrieveItems(hu);
}
public HUItemType getItemType(final I_M_HU_Item item)
{
return HUItemType.ofCode(handlingUnitsBL.getItemType(item));
} | public List<I_M_HU> retrieveIncludedHUs(final I_M_HU_Item item)
{
return getHandlingUnitsDAO().retrieveIncludedHUs(item);
}
public I_M_HU_PI getIncluded_HU_PI(@NonNull final I_M_HU_Item item)
{
return handlingUnitsBL.getIncludedPI(item);
}
public void deleteHU(final I_M_HU hu)
{
getHandlingUnitsDAO().delete(hu);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\allocation\strategy\AllocationStrategySupportingServicesFacade.java | 1 |
请完成以下Java代码 | private ProductsToPickRow toRow_PickFromPickingOrder(final PickingPlanLine planLine)
{
final SourceDocumentInfo sourceDocumentInfo = planLine.getSourceDocumentInfo();
final ProductInfo productInfo = productInfos.getByProductId(planLine.getProductId());
final PickFromPickingOrder pickFromPickingOrder = Objects.requireNonNull(planLine.getPickFromPickingOrder());
final ProductsToPickRowId rowId = ProductsToPickRowId.builder()
.productId(productInfo.getProductId())
.shipmentScheduleId(sourceDocumentInfo.getScheduleId().getShipmentScheduleId())
.pickFromPickingOrderId(pickFromPickingOrder.getOrderId())
.build();
return ProductsToPickRow.builder()
.rowId(rowId)
.rowType(ProductsToPickRowType.PICK_FROM_PICKING_ORDER)
.shipperId(sourceDocumentInfo.getShipperId())
//
.productInfo(productInfo)
.qty(planLine.getQty())
//
.includedRows(pickFromPickingOrder.getIssueToBOMLines()
.stream()
.map(this::toRow)
.collect(ImmutableList.toImmutableList()))
.build()
.withUpdatesFromPickingCandidateIfNotNull(sourceDocumentInfo.getExistingPickingCandidate());
}
private ProductsToPickRow toRow_IssueComponentsToPickingOrder(final PickingPlanLine planLine)
{
final SourceDocumentInfo sourceDocumentInfo = planLine.getSourceDocumentInfo();
final ProductInfo productInfo = productInfos.getByProductId(planLine.getProductId());
final IssueToBOMLine issueToBOMLine = Objects.requireNonNull(planLine.getIssueToBOMLine());
final ProductsToPickRowId rowId = ProductsToPickRowId.builder()
.productId(productInfo.getProductId())
.shipmentScheduleId(sourceDocumentInfo.getScheduleId().getShipmentScheduleId())
.issueToOrderBOMLineId(issueToBOMLine.getIssueToOrderBOMLineId())
.build();
return ProductsToPickRow.builder()
.rowId(rowId)
.rowType(ProductsToPickRowType.ISSUE_COMPONENTS_TO_PICKING_ORDER) | .shipperId(sourceDocumentInfo.getShipperId())
//
.productInfo(productInfo)
.qty(planLine.getQty())
//
.build()
.withUpdatesFromPickingCandidateIfNotNull(sourceDocumentInfo.getExistingPickingCandidate());
}
private ProductsToPickRow toRow_Unallocable(@NonNull final PickingPlanLine planLine)
{
final SourceDocumentInfo sourceDocumentInfo = planLine.getSourceDocumentInfo();
final ProductInfo productInfo = productInfos.getByProductId(planLine.getProductId());
final ProductsToPickRowId rowId = ProductsToPickRowId.builder()
.productId(productInfo.getProductId())
.shipmentScheduleId(sourceDocumentInfo.getScheduleId().getShipmentScheduleId())
.build();
return ProductsToPickRow.builder()
.rowId(rowId)
.rowType(ProductsToPickRowType.UNALLOCABLE)
.shipperId(sourceDocumentInfo.getShipperId())
//
.productInfo(productInfo)
.qty(planLine.getQty())
//
.build()
.withUpdatesFromPickingCandidateIfNotNull(sourceDocumentInfo.getExistingPickingCandidate());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\pickingV2\productsToPick\rows\factory\ProductsToPickRowsDataFactory.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void deleteIdentityLinksByTaskId(String taskId) {
getIdentityLinkEntityManager().deleteIdentityLinksByTaskId(taskId);
}
@Override
public void deleteIdentityLinksByProcessDefinitionId(String processDefinitionId) {
getIdentityLinkEntityManager().deleteIdentityLinksByProcDef(processDefinitionId);
}
@Override
public void deleteIdentityLinksByScopeDefinitionIdAndType(String scopeDefinitionId, String scopeType) {
getIdentityLinkEntityManager().deleteIdentityLinksByScopeDefinitionIdAndScopeType(scopeDefinitionId, scopeType);
}
@Override
public void deleteIdentityLinksByScopeIdAndType(String scopeId, String scopeType) { | getIdentityLinkEntityManager().deleteIdentityLinksByScopeIdAndScopeType(scopeId, scopeType);
}
@Override
public void deleteIdentityLinksByProcessInstanceId(String processInstanceId) {
getIdentityLinkEntityManager().deleteIdentityLinksByProcessInstanceId(processInstanceId);
}
@Override
public void bulkDeleteIdentityLinksForScopeIdsAndScopeType(Collection<String> scopeIds, String scopeType) {
getIdentityLinkEntityManager().bulkDeleteIdentityLinksForScopeIdsAndScopeType(scopeIds, scopeType);
}
public IdentityLinkEntityManager getIdentityLinkEntityManager() {
return configuration.getIdentityLinkEntityManager();
}
} | repos\flowable-engine-main\modules\flowable-identitylink-service\src\main\java\org\flowable\identitylink\service\impl\IdentityLinkServiceImpl.java | 2 |
请完成以下Java代码 | public final class RelatedDocumentsCandidate
{
private static final Logger logger = LogManager.getLogger(RelatedDocumentsCandidate.class);
private final RelatedDocumentsId id;
private final String internalName;
private final ITranslatableString windowCaption;
private final ITranslatableString filterByFieldCaption;
private final RelatedDocumentsTargetWindow targetWindow;
private final Priority priority;
private final RelatedDocumentsQuerySupplier querySupplier;
private final RelatedDocumentsCountSupplier documentsCountSupplier;
@Builder
private RelatedDocumentsCandidate(
@NonNull final RelatedDocumentsId id,
@NonNull final String internalName,
@NonNull final RelatedDocumentsTargetWindow targetWindow,
@NonNull final Priority priority,
@NonNull final ITranslatableString windowCaption,
@Nullable final ITranslatableString filterByFieldCaption,
@NonNull final RelatedDocumentsQuerySupplier querySupplier,
@NonNull final RelatedDocumentsCountSupplier documentsCountSupplier)
{
Check.assumeNotEmpty(internalName, "internalName is not empty");
this.id = id;
this.internalName = internalName;
this.targetWindow = targetWindow;
this.priority = priority;
this.windowCaption = windowCaption;
this.filterByFieldCaption = filterByFieldCaption;
this.querySupplier = querySupplier;
this.documentsCountSupplier = documentsCountSupplier;
}
@Override | public String toString()
{
return MoreObjects.toStringHelper(this)
.omitNullValues()
.add("id", id)
.add("internalName", internalName)
.add("windowCaption", windowCaption.getDefaultValue())
.add("additionalCaption", filterByFieldCaption != null ? filterByFieldCaption.getDefaultValue() : null)
.add("adWindowId", targetWindow)
.toString();
}
public AdWindowId getTargetWindowId()
{
return targetWindow.getAdWindowId();
}
public boolean isMatching(@NonNull final RelatedDocumentsId id)
{
return RelatedDocumentsId.equals(this.id, id);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\document\references\related_documents\RelatedDocumentsCandidate.java | 1 |
请完成以下Java代码 | private byte[] iv(byte[] encrypted) {
return (this.ivGenerator != NULL_IV_GENERATOR)
? EncodingUtils.subArray(encrypted, 0, this.ivGenerator.getKeyLength())
: NULL_IV_GENERATOR.generateKey();
}
private byte[] encrypted(byte[] encryptedBytes, int ivLength) {
return EncodingUtils.subArray(encryptedBytes, ivLength, encryptedBytes.length);
}
private static final BytesKeyGenerator NULL_IV_GENERATOR = new BytesKeyGenerator() {
private final byte[] VALUE = new byte[16];
@Override
public int getKeyLength() {
return this.VALUE.length;
}
@Override
public byte[] generateKey() {
return this.VALUE;
}
};
public enum CipherAlgorithm {
CBC(AES_CBC_ALGORITHM, NULL_IV_GENERATOR),
GCM(AES_GCM_ALGORITHM, KeyGenerators.secureRandom(16));
private BytesKeyGenerator ivGenerator;
private String name;
CipherAlgorithm(String name, BytesKeyGenerator ivGenerator) {
this.name = name;
this.ivGenerator = ivGenerator;
}
@Override | public String toString() {
return this.name;
}
public AlgorithmParameterSpec getParameterSpec(byte[] iv) {
return (this != CBC) ? new GCMParameterSpec(128, iv) : new IvParameterSpec(iv);
}
public Cipher createCipher() {
return CipherUtils.newCipher(this.toString());
}
public BytesKeyGenerator defaultIvGenerator() {
return this.ivGenerator;
}
}
} | repos\spring-security-main\crypto\src\main\java\org\springframework\security\crypto\encrypt\AesBytesEncryptor.java | 1 |
请完成以下Java代码 | protected final <ID extends RepoIdAware> ImmutableSet<ID> getSelectedIds(@NonNull final IntFunction<ID> idMapper, @NonNull final QueryLimit limit)
{
final DocumentIdsSelection selectedRowsIds = getSelectedRowIds();
if (selectedRowsIds.isAll())
{
return streamSelectedRows()
.limit(limit.toIntOr(Integer.MAX_VALUE))
.map(row -> row.getId().toId(idMapper))
.collect(ImmutableSet.toImmutableSet());
}
else
{
return selectedRowsIds.toIdsFromInt(idMapper);
}
}
@OverridingMethodsMustInvokeSuper
protected IViewRow getSingleSelectedRow()
{
final DocumentIdsSelection selectedRowIds = getSelectedRowIds();
final DocumentId documentId = selectedRowIds.getSingleDocumentId();
return getView().getById(documentId);
}
@OverridingMethodsMustInvokeSuper
protected Stream<? extends IViewRow> streamSelectedRows()
{
final DocumentIdsSelection selectedRowIds = getSelectedRowIds();
return getView().streamByIds(selectedRowIds);
}
protected final ViewRowIdsSelection getParentViewRowIdsSelection()
{
return _parentViewRowIdsSelection;
}
protected final ViewRowIdsSelection getChildViewRowIdsSelection()
{
return _childViewRowIdsSelection; | }
@SuppressWarnings("SameParameterValue")
protected final <T extends IView> T getChildView(@NonNull final Class<T> viewType)
{
final ViewRowIdsSelection childViewRowIdsSelection = getChildViewRowIdsSelection();
Check.assumeNotNull(childViewRowIdsSelection, "child view is set");
final IView childView = viewsRepo.getView(childViewRowIdsSelection.getViewId());
return viewType.cast(childView);
}
protected final DocumentIdsSelection getChildViewSelectedRowIds()
{
final ViewRowIdsSelection childViewRowIdsSelection = getChildViewRowIdsSelection();
return childViewRowIdsSelection != null ? childViewRowIdsSelection.getRowIds() : DocumentIdsSelection.EMPTY;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\process\adprocess\ViewBasedProcessTemplate.java | 1 |
请完成以下Java代码 | public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
final TableColumnPermission other = EqualsBuilder.getOther(this, obj);
if (other == null)
{
return false;
}
return new EqualsBuilder()
.append(resource, other.resource)
.append(accesses, other.accesses)
.isEqual();
}
@Override
public String toString()
{
return getClass().getSimpleName() + "["
+ resource
+ ", " + accesses
+ "]";
}
@Override
public boolean hasAccess(final Access access)
{
return accesses.contains(access);
}
@Override
public Permission mergeWith(final Permission permissionFrom)
{
final TableColumnPermission columnPermissionFrom = checkCompatibleAndCast(permissionFrom);
return asNewBuilder()
.addAccesses(columnPermissionFrom.accesses)
.build();
}
public int getAD_Table_ID()
{
return resource.getAD_Table_ID();
}
public int getAD_Column_ID()
{
return resource.getAD_Column_ID();
}
public static class Builder
{
private TableColumnResource resource;
private final Set<Access> accesses = new LinkedHashSet<>();
public TableColumnPermission build()
{
return new TableColumnPermission(this);
}
public Builder setFrom(final TableColumnPermission columnPermission)
{ | setResource(columnPermission.getResource());
setAccesses(columnPermission.accesses);
return this;
}
public Builder setResource(final TableColumnResource resource)
{
this.resource = resource;
return this;
}
public final Builder addAccess(final Access access)
{
accesses.add(access);
return this;
}
public final Builder removeAccess(final Access access)
{
accesses.remove(access);
return this;
}
public final Builder setAccesses(final Set<Access> acceses)
{
accesses.clear();
accesses.addAll(acceses);
return this;
}
public final Builder addAccesses(final Set<Access> acceses)
{
accesses.addAll(acceses);
return this;
}
public final Builder removeAllAccesses()
{
accesses.clear();
return this;
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\security\permissions\TableColumnPermission.java | 1 |
请完成以下Java代码 | public int getQtyRanking ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_QtyRanking);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Ranking.
@param Ranking
Relative Rank Number
*/
@Override
public void setRanking (int Ranking)
{ | set_ValueNoCheck (COLUMNNAME_Ranking, Integer.valueOf(Ranking));
}
/** Get Ranking.
@return Relative Rank Number
*/
@Override
public int getRanking ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Ranking);
if (ii == null)
return 0;
return ii.intValue();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.rfq\src\main\java-gen\de\metas\rfq\model\X_RV_C_RfQResponse.java | 1 |
请完成以下Java代码 | public void setC_ProjectType(final org.compiere.model.I_C_ProjectType C_ProjectType)
{
set_ValueFromPO(COLUMNNAME_C_ProjectType_ID, org.compiere.model.I_C_ProjectType.class, C_ProjectType);
}
@Override
public void setC_ProjectType_ID (final int C_ProjectType_ID)
{
if (C_ProjectType_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_ProjectType_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_ProjectType_ID, C_ProjectType_ID);
}
@Override
public int getC_ProjectType_ID()
{
return get_ValueAsInt(COLUMNNAME_C_ProjectType_ID);
}
@Override
public void setDescription (final java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
@Override
public java.lang.String getDescription()
{
return get_ValueAsString(COLUMNNAME_Description);
}
@Override
public void setHelp (final java.lang.String Help)
{
set_Value (COLUMNNAME_Help, Help);
}
@Override
public java.lang.String getHelp()
{
return get_ValueAsString(COLUMNNAME_Help);
}
@Override
public void setM_Product_ID (final int M_Product_ID)
{
if (M_Product_ID < 1)
set_Value (COLUMNNAME_M_Product_ID, null);
else
set_Value (COLUMNNAME_M_Product_ID, M_Product_ID);
}
@Override | public int getM_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_ID);
}
@Override
public void setName (final java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
@Override
public void setSeqNo (final int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, SeqNo);
}
@Override
public int getSeqNo()
{
return get_ValueAsInt(COLUMNNAME_SeqNo);
}
@Override
public void setStandardQty (final BigDecimal StandardQty)
{
set_Value (COLUMNNAME_StandardQty, StandardQty);
}
@Override
public BigDecimal getStandardQty()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_StandardQty);
return bd != null ? bd : BigDecimal.ZERO;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Phase.java | 1 |
请完成以下Java代码 | public class AuthController {
@Autowired
private AuthenticationManager authenticationManager;
@Autowired
private JwtUtil jwtUtil;
/**
* 登录
*/
@PostMapping("/login")
public ApiResponse login(@Valid @RequestBody LoginRequest loginRequest) {
Authentication authentication = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(loginRequest.getUsernameOrEmailOrPhone(), loginRequest.getPassword()));
SecurityContextHolder.getContext().setAuthentication(authentication); | String jwt = jwtUtil.createJWT(authentication, loginRequest.getRememberMe());
return ApiResponse.ofSuccess(new JwtResponse(jwt));
}
@PostMapping("/logout")
public ApiResponse logout(HttpServletRequest request) {
try {
// 设置JWT过期
jwtUtil.invalidateJWT(request);
} catch (SecurityException e) {
throw new SecurityException(Status.UNAUTHORIZED);
}
return ApiResponse.ofStatus(Status.LOGOUT);
}
} | repos\spring-boot-demo-master\demo-rbac-security\src\main\java\com\xkcoding\rbac\security\controller\AuthController.java | 1 |
请完成以下Java代码 | public int compareTo(Role o) {
if(id == o.getId()){
return 0;
}else if(id > o.getId()){
return 1;
}else{
return -1;
}
}
@Override
public boolean equals(Object obj) {
// TODO Auto-generated method stub
if(obj instanceof Role){
if(this.id == ((Role)obj).getId()){ | return true;
}
}
return false;
}
@Override
public String toString() {
return "Role{" +
"id=" + id +
", name=" + name +
", roleLevel=" + roleLevel +
", description=" + description +
'}';
}
} | repos\springBoot-master\springboot-springSecurity4\src\main\java\com\yy\example\bean\Role.java | 1 |
请完成以下Java代码 | ValidateImportRecordsResult validateImportRecords(@NonNull final ValidateImportRecordsRequest request)
{
final Stopwatch stopwatch = Stopwatch.createStarted();
try
{
final ImportProcessResult processResult = importProcessFactory.newImportProcessForTableName(request.getImportTableName())
.validate(request);
stopwatch.stop();
return processResult.getImportRecordsValidation()
.withDuration(TimeUtil.toDuration(stopwatch));
}
finally
{
logger.debug("Took {} to validate import records for {}", stopwatch, request);
}
}
public ValidateAndActualImportRecordsResult validateAndImportRecordsNow(@NonNull final ImportRecordsRequest request)
{
final ImportProcessResult result = importProcessFactory.newImportProcessForTableName(request.getImportTableName())
.validateAndImport(request);
if (request.getNotifyUserId() != null)
{
notifyImportDone(result.getActualImport(), request.getNotifyUserId());
}
return ValidateAndActualImportRecordsResult.builder()
.importRecordsValidation(result.getImportRecordsValidation())
.actualImport(result.getActualImport())
.build();
}
AsyncImportRecordsResponse importRecordsAsync(@NonNull final ImportRecordsRequest request)
{
if (importRecordsAsyncExecutor == null)
{
throw new AdempiereException("No " + ImportRecordsAsyncExecutor.class + " defined");
}
return importRecordsAsyncExecutor.schedule(request);
}
private void notifyImportDone(
@NonNull final ActualImportRecordsResult result, | @NonNull final UserId recipientUserId)
{
try
{
final String targetTableName = result.getTargetTableName();
final String windowName = adTableDAO.retrieveWindowName(Env.getCtx(), targetTableName);
notificationBL.send(UserNotificationRequest.builder()
.topic(USER_NOTIFICATIONS_TOPIC)
.recipientUserId(recipientUserId)
.contentADMessage(MSG_Event_RecordsImported)
.contentADMessageParam(result.getCountInsertsIntoTargetTableString())
.contentADMessageParam(result.getCountUpdatesIntoTargetTableString())
.contentADMessageParam(windowName)
.build());
}
catch (final Exception ex)
{
logger.warn("Failed notifying user '{}' about {}. Ignored.", recipientUserId, result, ex);
}
}
public int deleteImportRecords(@NonNull final ImportDataDeleteRequest request)
{
return importProcessFactory.newImportProcessForTableName(request.getImportTableName())
.setParameters(request.getAdditionalParameters())
.deleteImportRecords(request);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\impexp\DataImportService.java | 1 |
请完成以下Java代码 | public static final JSONDocumentActionsList ofList(final List<WebuiRelatedProcessDescriptor> processDescriptors, final JSONOptions jsonOpts)
{
return new JSONDocumentActionsList(processDescriptors, jsonOpts);
}
@JsonProperty("actions")
private final List<JSONDocumentAction> actions;
private JSONDocumentActionsList(final List<WebuiRelatedProcessDescriptor> processDescriptors, final JSONOptions jsonOpts)
{
super();
actions = processDescriptors.stream()
.map(processDescriptor -> new JSONDocumentAction(processDescriptor, jsonOpts))
.sorted(JSONDocumentAction.ORDERBY_QuickActionFirst_Caption)
.collect(GuavaCollectors.toImmutableList());
} | @Override
public String toString()
{
return MoreObjects.toStringHelper(this)
.omitNullValues()
.add("actions", actions.isEmpty() ? null : actions)
.toString();
}
public List<JSONDocumentAction> getActions()
{
return actions;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\process\json\JSONDocumentActionsList.java | 1 |
请完成以下Java代码 | public OrderFactory shipBPartner(final BPartnerId bpartnerId)
{
shipBPartner(bpartnerId, null, null);
return this;
}
public BPartnerId getShipBPartnerId()
{
return BPartnerId.ofRepoId(order.getC_BPartner_ID());
}
public OrderFactory pricingSystemId(@NonNull final PricingSystemId pricingSystemId)
{
assertNotBuilt();
order.setM_PricingSystem_ID(pricingSystemId.getRepoId());
return this;
}
public OrderFactory poReference(@Nullable final String poReference)
{
assertNotBuilt();
order.setPOReference(poReference);
return this;
}
public OrderFactory salesRepId(@Nullable final UserId salesRepId)
{
assertNotBuilt();
order.setSalesRep_ID(UserId.toRepoId(salesRepId));
return this;
} | public OrderFactory projectId(@Nullable final ProjectId projectId)
{
assertNotBuilt();
order.setC_Project_ID(ProjectId.toRepoId(projectId));
return this;
}
public OrderFactory campaignId(final int campaignId)
{
assertNotBuilt();
order.setC_Campaign_ID(campaignId);
return this;
}
public DocTypeId getDocTypeTargetId()
{
return docTypeTargetId;
}
public void setDocTypeTargetId(final DocTypeId docTypeTargetId)
{
this.docTypeTargetId = docTypeTargetId;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\order\OrderFactory.java | 1 |
请完成以下Java代码 | public void setIsAdvised (boolean IsAdvised)
{
set_Value (COLUMNNAME_IsAdvised, Boolean.valueOf(IsAdvised));
}
@Override
public boolean isAdvised()
{
return get_ValueAsBoolean(COLUMNNAME_IsAdvised);
}
@Override
public de.metas.material.dispo.model.I_MD_Candidate getMD_Candidate()
{
return get_ValueAsPO(COLUMNNAME_MD_Candidate_ID, de.metas.material.dispo.model.I_MD_Candidate.class);
}
@Override
public void setMD_Candidate(de.metas.material.dispo.model.I_MD_Candidate MD_Candidate)
{
set_ValueFromPO(COLUMNNAME_MD_Candidate_ID, de.metas.material.dispo.model.I_MD_Candidate.class, MD_Candidate);
}
@Override
public void setMD_Candidate_ID (int MD_Candidate_ID)
{
if (MD_Candidate_ID < 1)
set_ValueNoCheck (COLUMNNAME_MD_Candidate_ID, null);
else
set_ValueNoCheck (COLUMNNAME_MD_Candidate_ID, Integer.valueOf(MD_Candidate_ID));
}
@Override
public int getMD_Candidate_ID()
{
return get_ValueAsInt(COLUMNNAME_MD_Candidate_ID);
}
@Override
public void setMD_Candidate_Purchase_Detail_ID (int MD_Candidate_Purchase_Detail_ID)
{
if (MD_Candidate_Purchase_Detail_ID < 1)
set_ValueNoCheck (COLUMNNAME_MD_Candidate_Purchase_Detail_ID, null);
else
set_ValueNoCheck (COLUMNNAME_MD_Candidate_Purchase_Detail_ID, Integer.valueOf(MD_Candidate_Purchase_Detail_ID));
}
@Override
public int getMD_Candidate_Purchase_Detail_ID()
{
return get_ValueAsInt(COLUMNNAME_MD_Candidate_Purchase_Detail_ID);
}
@Override
public void setM_ReceiptSchedule_ID (int M_ReceiptSchedule_ID)
{
if (M_ReceiptSchedule_ID < 1)
set_Value (COLUMNNAME_M_ReceiptSchedule_ID, null);
else
set_Value (COLUMNNAME_M_ReceiptSchedule_ID, Integer.valueOf(M_ReceiptSchedule_ID));
}
@Override
public int getM_ReceiptSchedule_ID()
{
return get_ValueAsInt(COLUMNNAME_M_ReceiptSchedule_ID);
}
@Override
public void setPlannedQty (java.math.BigDecimal PlannedQty) | {
set_Value (COLUMNNAME_PlannedQty, PlannedQty);
}
@Override
public java.math.BigDecimal getPlannedQty()
{
BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PlannedQty);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setPP_Product_Planning_ID (int PP_Product_Planning_ID)
{
if (PP_Product_Planning_ID < 1)
set_Value (COLUMNNAME_PP_Product_Planning_ID, null);
else
set_Value (COLUMNNAME_PP_Product_Planning_ID, Integer.valueOf(PP_Product_Planning_ID));
}
@Override
public int getPP_Product_Planning_ID()
{
return get_ValueAsInt(COLUMNNAME_PP_Product_Planning_ID);
}
@Override
public void setQtyOrdered (java.math.BigDecimal QtyOrdered)
{
set_Value (COLUMNNAME_QtyOrdered, QtyOrdered);
}
@Override
public java.math.BigDecimal getQtyOrdered()
{
BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyOrdered);
return bd != null ? bd : BigDecimal.ZERO;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.material\dispo-commons\src\main\java-gen\de\metas\material\dispo\model\X_MD_Candidate_Purchase_Detail.java | 1 |
请完成以下Java代码 | public class ProductAddedEvent {
private final String orderId;
private final String productId;
public ProductAddedEvent(String orderId, String productId) {
this.orderId = orderId;
this.productId = productId;
}
public String getOrderId() {
return orderId;
}
public String getProductId() {
return productId;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false; | }
ProductAddedEvent that = (ProductAddedEvent) o;
return Objects.equals(orderId, that.orderId) && Objects.equals(productId, that.productId);
}
@Override
public int hashCode() {
return Objects.hash(orderId, productId);
}
@Override
public String toString() {
return "ProductAddedEvent{" + "orderId='" + orderId + '\'' + ", productId='" + productId + '\'' + '}';
}
} | repos\tutorials-master\patterns-modules\axon\src\main\java\com\baeldung\axon\coreapi\events\ProductAddedEvent.java | 1 |
请完成以下Java代码 | private static class Context
{
@NonNull I_M_Product product;
@NonNull ProductPlanning productPlanning;
@NonNull PPRouting routing;
}
@lombok.Getter
@lombok.ToString
private static class RoutingDurationsAndYield
{
private Percent yield = Percent.ONE_HUNDRED;
private Duration queuingTime = Duration.ZERO;
private Duration setupTime = Duration.ZERO;
private Duration durationPerOneUnit = Duration.ZERO;
private Duration waitingTime = Duration.ZERO;
private Duration movingTime = Duration.ZERO;
public void addActivity(final PPRoutingActivity activity)
{
if (!activity.getYield().isZero())
{
yield = yield.multiply(activity.getYield(), 0);
}
queuingTime = queuingTime.plus(activity.getQueuingTime());
setupTime = setupTime.plus(activity.getSetupTime());
waitingTime = waitingTime.plus(activity.getWaitingTime());
movingTime = movingTime.plus(activity.getMovingTime());
// We use node.getDuration() instead of m_routingService.estimateWorkingTime(node) because
// this will be the minimum duration of this node. So even if the node have defined units/cycle
// we consider entire duration of the node.
durationPerOneUnit = durationPerOneUnit.plus(activity.getDurationPerOneUnit());
}
}
@lombok.Value(staticConstructor = "of")
private static class RoutingActivitySegmentCost | {
public static Collector<RoutingActivitySegmentCost, ?, Map<CostElementId, BigDecimal>> groupByCostElementId()
{
return Collectors.groupingBy(RoutingActivitySegmentCost::getCostElementId, sumCostsAsBigDecimal());
}
private static Collector<RoutingActivitySegmentCost, ?, BigDecimal> sumCostsAsBigDecimal()
{
return Collectors.reducing(BigDecimal.ZERO, RoutingActivitySegmentCost::getCostAsBigDecimal, BigDecimal::add);
}
@NonNull
CostAmount cost;
@NonNull
PPRoutingActivityId routingActivityId;
@NonNull
CostElementId costElementId;
public BigDecimal getCostAsBigDecimal()
{
return cost.toBigDecimal();
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\process\RollupWorkflow.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public Person findOne() {
Person p = personRepository.findOne(2L);
logger.info("为id、key为:" + p.getId() + "数据做了缓存");
return p;
}
@Override
@Cacheable(value = "people1", key = "#person.id", sync = true)//3
public Person findOne1(Person person, String a, String[] b, List<Long> c) {
Person p = personRepository.findOne(person.getId());
if (p != null) {
logger.info("为id、key为:" + p.getId() + "数据做了缓存");
}
return p;
} | @Override
@Cacheable(value = "people2")//3
public Person findOne2(Person person) {
Person p = personRepository.findOne(person.getId());
logger.info("为id、key为:" + p.getId() + "数据做了缓存");
return p;
}
@Override
@Cacheable(value = "people3")//3
public Person findOne3(Person person) {
Person p = personRepository.findOne(person.getId());
logger.info("为id、key为:" + p.getId() + "数据做了缓存");
return p;
}
} | repos\spring-boot-student-master\spring-boot-student-cache-redis-caffeine\src\main\java\com\xiaolyuh\service\impl\PersonServiceImpl.java | 2 |
请完成以下Java代码 | public abstract class PlanItemDefinitionImpl extends CmmnElementImpl implements PlanItemDefinition {
protected static Attribute<String> nameAttribute;
protected static ChildElement<DefaultControl> defaultControlChild;
public PlanItemDefinitionImpl(ModelTypeInstanceContext instanceContext) {
super(instanceContext);
}
public String getName() {
return nameAttribute.getValue(this);
}
public void setName(String name) {
nameAttribute.setValue(this, name);
}
public DefaultControl getDefaultControl() {
return defaultControlChild.getChild(this);
}
public void setDefaultControl(DefaultControl defaultControl) {
defaultControlChild.setChild(this, defaultControl);
}
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(PlanItemDefinition.class, CMMN_ELEMENT_PLAN_ITEM_DEFINITION)
.namespaceUri(CMMN11_NS) | .abstractType()
.extendsType(CmmnElement.class);
nameAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_NAME)
.build();
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
defaultControlChild = sequenceBuilder.element(DefaultControl.class)
.build();
typeBuilder.build();
}
} | repos\camunda-bpm-platform-master\model-api\cmmn-model\src\main\java\org\camunda\bpm\model\cmmn\impl\instance\PlanItemDefinitionImpl.java | 1 |
请完成以下Spring Boot application配置 | # Spring boot application
spring.application.name=dubbo-registry-zookeeper-provider-sample
# Base packages to scan Dubbo Component: @org.apache.dubbo.config.annotation.Service
dubbo.scan.base-packages=org.apache.dubbo.spring.boot.sample.provider.service
# Dubbo Application
## The default value of dubbo.application.name is ${spring.application.name}
## dubbo.application.name=${spring.application.name}
# Dubbo Protocol
dubbo.protocol.name=dubbo
## Random port
dubbo.protocol.port= | -1
## Dubbo Registry
dubbo.registry.address=zookeeper://127.0.0.1:2181
dubbo.registry.file = ${user.home}/dubbo-cache/${spring.application.name}/dubbo.cache
## DemoService version
demo.service.version=1.0.0 | repos\dubbo-spring-boot-project-master\dubbo-spring-boot-samples\registry-samples\zookeeper-samples\provider-sample\src\main\resources\application.properties | 2 |
请完成以下Java代码 | public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public boolean isStoreResultVariableAsTransient() {
return storeResultVariableAsTransient;
}
public void setStoreResultVariableAsTransient(boolean storeResultVariableAsTransient) {
this.storeResultVariableAsTransient = storeResultVariableAsTransient;
}
@Override
public ServiceTask clone() {
ServiceTask clone = new ServiceTask();
clone.setValues(this); | return clone;
}
public void setValues(ServiceTask otherElement) {
super.setValues(otherElement);
setImplementation(otherElement.getImplementation());
setImplementationType(otherElement.getImplementationType());
setResultVariableName(otherElement.getResultVariableName());
setType(otherElement.getType());
setStoreResultVariableAsTransient(otherElement.isStoreResultVariableAsTransient());
fieldExtensions = new ArrayList<>();
if (otherElement.getFieldExtensions() != null && !otherElement.getFieldExtensions().isEmpty()) {
for (FieldExtension extension : otherElement.getFieldExtensions()) {
fieldExtensions.add(extension.clone());
}
}
}
} | repos\flowable-engine-main\modules\flowable-cmmn-model\src\main\java\org\flowable\cmmn\model\ServiceTask.java | 1 |
请完成以下Java代码 | public List<I_C_Invoice> retrieveDunnedInvoices(@NonNull final DunningDocId dunningDocId)
{
return Services
.get(IQueryBL.class)
.createQueryBuilder(I_C_DunningDoc_Line.class)
.addEqualsFilter(I_C_DunningDoc_Line.COLUMN_C_DunningDoc_ID, dunningDocId)
.andCollectChildren(I_C_DunningDoc_Line_Source.COLUMN_C_DunningDoc_Line_ID)
.andCollect(I_C_DunningDoc_Line_Source.COLUMN_C_Dunning_Candidate_ID)
.addEqualsFilter(I_C_Dunning_Candidate.COLUMN_AD_Table_ID, getTableId(I_C_Invoice.class))
.andCollect(I_C_Dunning_Candidate.COLUMN_Record_ID, I_C_Invoice.class)
.create()
.list();
}
@Nullable
public String getLocationEmail(@NonNull final DunningDocId dunningDocId)
{
final I_C_DunningDoc dunningDocRecord = dunningDAO.getByIdInTrx(dunningDocId);
final BPartnerId bpartnerId = BPartnerId.ofRepoId(dunningDocRecord.getC_BPartner_ID()); | final I_C_BPartner_Location bpartnerLocation = partnersRepo.getBPartnerLocationByIdInTrx(BPartnerLocationId.ofRepoId(bpartnerId, dunningDocRecord.getC_BPartner_Location_ID()));
final String locationEmail = bpartnerLocation.getEMail();
if (!Check.isEmpty(locationEmail))
{
return locationEmail;
}
final BPartnerContactId dunningContactId = BPartnerContactId.ofRepoIdOrNull(bpartnerId, dunningDocRecord.getC_Dunning_Contact_ID());
if (dunningContactId == null)
{
return null;
}
return partnersRepo.getContactLocationEmail(dunningContactId);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.dunning\src\main\java\de\metas\dunning\invoice\DunningService.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class FTSConfigFieldId implements RepoIdAware
{
@JsonCreator
public static FTSConfigFieldId ofRepoId(final int repoId)
{
return new FTSConfigFieldId(repoId);
}
@Nullable
public static FTSConfigFieldId ofRepoIdOrNull(final int repoId)
{
return repoId > 0 ? new FTSConfigFieldId(repoId) : null;
}
int repoId;
private FTSConfigFieldId(final int repoId) | {
this.repoId = Check.assumeGreaterThanZero(repoId, "ES_FTS_Config_Field_ID");
}
@JsonValue
@Override
public int getRepoId()
{
return repoId;
}
public static int toRepoId(@Nullable final FTSConfigFieldId id)
{
return id != null ? id.getRepoId() : -1;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.elasticsearch\src\main\java\de\metas\fulltextsearch\config\FTSConfigFieldId.java | 2 |
请完成以下Java代码 | public DefaultBuilder mapHeader(String... headers) {
for (String header : headers) {
initMapper(header, null);
}
return this;
}
@Override
public DefaultBuilder mapHeaderToKey(String header, String contextKey) {
initMapper(header, contextKey);
return this;
}
private void initMapper(String header, @Nullable String key) {
this.mappers.add((headers, target) -> {
Object value = headers.getFirst(header);
if (value != null) {
target.put((key != null) ? key : header, value);
}
});
}
@Override
public DefaultBuilder mapMultiValueHeader(String... headers) {
for (String header : headers) {
initMultiValueMapper(header, null);
} | return this;
}
@Override
public DefaultBuilder mapMultiValueHeaderToKey(String header, String contextKey) {
initMultiValueMapper(header, contextKey);
return this;
}
private void initMultiValueMapper(String header, @Nullable String key) {
this.mappers.add((headers, target) -> {
List<?> list = headers.getValuesAsList(header);
if (!ObjectUtils.isEmpty(list)) {
target.put((key != null) ? key : header, list);
}
});
}
@Override
public HttpRequestHeaderInterceptor build() {
return new HttpRequestHeaderInterceptor(this.mappers);
}
}
} | repos\spring-graphql-main\spring-graphql\src\main\java\org\springframework\graphql\server\support\HttpRequestHeaderInterceptor.java | 1 |
请完成以下Java代码 | public void initAsyncExecutor() {
if (asyncExecutor == null) {
asyncExecutor = new ExecutorPerTenantAsyncExecutor(tenantInfoHolder);
}
super.initAsyncExecutor();
if (asyncExecutor instanceof TenantAwareAsyncExecutor) {
for (String tenantId : tenantInfoHolder.getAllTenants()) {
((TenantAwareAsyncExecutor) asyncExecutor).addTenantAsyncExecutor(tenantId, false); // false -> will be started later with all the other executors
}
}
}
@Override
public ProcessEngine buildProcessEngine() {
// Disable schema creation/validation by setting it to null.
// We'll do it manually, see buildProcessEngine() method (hence why it's copied first)
String originalDatabaseSchemaUpdate = this.databaseSchemaUpdate;
this.databaseSchemaUpdate = null;
// Also, we shouldn't start the async executor until *after* the schema's have been created
boolean originalIsAutoActivateAsyncExecutor = this.asyncExecutorActivate;
this.asyncExecutorActivate = false;
ProcessEngine processEngine = super.buildProcessEngine();
// Reset to original values
this.databaseSchemaUpdate = originalDatabaseSchemaUpdate;
this.asyncExecutorActivate = originalIsAutoActivateAsyncExecutor;
// Create tenant schema
for (String tenantId : tenantInfoHolder.getAllTenants()) {
createTenantSchema(tenantId);
}
// Start async executor
if (asyncExecutor != null && originalIsAutoActivateAsyncExecutor) {
asyncExecutor.start();
}
booted = true;
return processEngine;
}
protected void createTenantSchema(String tenantId) {
logger.info("creating/validating database schema for tenant " + tenantId);
tenantInfoHolder.setCurrentTenantId(tenantId);
getCommandExecutor().execute(getSchemaCommandConfig(), new ExecuteSchemaOperationCommand(databaseSchemaUpdate));
tenantInfoHolder.clearCurrentTenantId(); | }
protected void createTenantAsyncJobExecutor(String tenantId) {
((TenantAwareAsyncExecutor) asyncExecutor).addTenantAsyncExecutor(
tenantId,
isAsyncExecutorActivate() && booted
);
}
@Override
public CommandInterceptor createTransactionInterceptor() {
return null;
}
@Override
protected void postProcessEngineInitialisation() {
// empty here. will be done in registerTenant
}
@Override
public UserGroupManager getUserGroupManager() {
return null; //no external identity provider supplied
}
} | repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\cfg\multitenant\MultiSchemaMultiTenantProcessEngineConfiguration.java | 1 |
请完成以下Java代码 | public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Set 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_LabelPrinter.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public ServiceClassPostProcessor serviceClassPostProcessor(@Qualifier(BASE_PACKAGES_BEAN_NAME)
Set<String> packagesToScan) {
return new ServiceClassPostProcessor(packagesToScan);
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
if (applicationContext instanceof ConfigurableApplicationContext) {
ConfigurableApplicationContext context = (ConfigurableApplicationContext) applicationContext;
DubboLifecycleComponentApplicationListener dubboLifecycleComponentApplicationListener
= new DubboLifecycleComponentApplicationListener(applicationContext);
context.addApplicationListener(dubboLifecycleComponentApplicationListener);
DubboBootstrapApplicationListener dubboBootstrapApplicationListener = new DubboBootstrapApplicationListener(applicationContext);
context.addApplicationListener(dubboBootstrapApplicationListener);
}
} | @Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
// Remove the BeanDefinitions of ApplicationListener from DubboBeanUtils#registerCommonBeans(BeanDefinitionRegistry)
// TODO Refactoring in Dubbo 2.7.9
removeBeanDefinition(registry, DubboLifecycleComponentApplicationListener.BEAN_NAME);
removeBeanDefinition(registry, DubboBootstrapApplicationListener.BEAN_NAME);
}
private void removeBeanDefinition(BeanDefinitionRegistry registry, String beanName) {
if (registry.containsBeanDefinition(beanName)) {
registry.removeBeanDefinition(beanName);
}
}
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
// DO NOTHING
}
} | repos\dubbo-spring-boot-project-master\dubbo-spring-boot-compatible\autoconfigure\src\main\java\org\apache\dubbo\spring\boot\autoconfigure\DubboAutoConfiguration.java | 2 |
请完成以下Java代码 | public Object remove(Object key) {
if (UNSTORED_KEYS.contains(key)) {
return null;
}
return defaultBindings.remove(key);
}
@Override
public void clear() {
throw new UnsupportedOperationException();
}
@Override
public boolean containsValue(Object value) {
throw new UnsupportedOperationException();
}
@Override | public boolean isEmpty() {
throw new UnsupportedOperationException();
}
public void addUnstoredKey(String unstoredKey) {
UNSTORED_KEYS.add(unstoredKey);
}
protected Map<String, Object> getVariables() {
if (this.scopeContainer instanceof VariableScope) {
return ((VariableScope) this.scopeContainer).getVariables();
}
return Collections.emptyMap();
}
} | repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\scripting\ScriptBindings.java | 1 |
请完成以下Java代码 | public String toString()
{
StringBuffer sb = new StringBuffer ("X_AD_InfoWindow_From[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set Info Window From.
@param AD_InfoWindow_From_ID Info Window From */
@Override
public void setAD_InfoWindow_From_ID (int AD_InfoWindow_From_ID)
{
if (AD_InfoWindow_From_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_InfoWindow_From_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_InfoWindow_From_ID, Integer.valueOf(AD_InfoWindow_From_ID));
}
/** Get Info Window From.
@return Info Window From */
@Override
public int getAD_InfoWindow_From_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_InfoWindow_From_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public org.compiere.model.I_AD_InfoWindow getAD_InfoWindow() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_AD_InfoWindow_ID, org.compiere.model.I_AD_InfoWindow.class);
}
@Override
public void setAD_InfoWindow(org.compiere.model.I_AD_InfoWindow AD_InfoWindow)
{
set_ValueFromPO(COLUMNNAME_AD_InfoWindow_ID, org.compiere.model.I_AD_InfoWindow.class, AD_InfoWindow);
}
/** Set Info-Fenster.
@param AD_InfoWindow_ID
Info and search/select Window
*/
@Override
public void setAD_InfoWindow_ID (int AD_InfoWindow_ID)
{
if (AD_InfoWindow_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_InfoWindow_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_InfoWindow_ID, Integer.valueOf(AD_InfoWindow_ID));
}
/** Get Info-Fenster.
@return Info and search/select Window
*/
@Override
public int getAD_InfoWindow_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_InfoWindow_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/**
* EntityType AD_Reference_ID=389 | * Reference name: _EntityTypeNew
*/
public static final int ENTITYTYPE_AD_Reference_ID=389;
/** Set Entitäts-Art.
@param EntityType
Dictionary Entity Type; Determines ownership and synchronization
*/
@Override
public void setEntityType (java.lang.String EntityType)
{
set_Value (COLUMNNAME_EntityType, EntityType);
}
/** Get Entitäts-Art.
@return Dictionary Entity Type; Determines ownership and synchronization
*/
@Override
public java.lang.String getEntityType ()
{
return (java.lang.String)get_Value(COLUMNNAME_EntityType);
}
/** Set Sql FROM.
@param FromClause
SQL FROM clause
*/
@Override
public void setFromClause (java.lang.String FromClause)
{
set_Value (COLUMNNAME_FromClause, FromClause);
}
/** Get Sql FROM.
@return SQL FROM clause
*/
@Override
public java.lang.String getFromClause ()
{
return (java.lang.String)get_Value(COLUMNNAME_FromClause);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_InfoWindow_From.java | 1 |
请完成以下Java代码 | public void setHasStartFormKey(boolean hasStartFormKey) {
this.hasStartFormKey = hasStartFormKey;
}
@Override
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
@Override
public List<IdentityLinkEntity> getIdentityLinks() {
if (!isIdentityLinksInitialized) {
definitionIdentityLinkEntities = CommandContextUtil.getCmmnEngineConfiguration().getIdentityLinkServiceConfiguration()
.getIdentityLinkService().findIdentityLinksByScopeDefinitionIdAndType(id, ScopeTypes.CMMN);
isIdentityLinksInitialized = true;
}
return definitionIdentityLinkEntities;
} | public String getLocalizedName() {
return localizedName;
}
@Override
public void setLocalizedName(String localizedName) {
this.localizedName = localizedName;
}
public String getLocalizedDescription() {
return localizedDescription;
}
@Override
public void setLocalizedDescription(String localizedDescription) {
this.localizedDescription = localizedDescription;
}
} | repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\persistence\entity\CaseDefinitionEntityImpl.java | 1 |
请完成以下Java代码 | public void setDt(CashAvailabilityDate1Choice value) {
this.dt = value;
}
/**
* Gets the value of the amt property.
*
* @return
* possible object is
* {@link ActiveOrHistoricCurrencyAndAmount }
*
*/
public ActiveOrHistoricCurrencyAndAmount getAmt() {
return amt;
}
/**
* Sets the value of the amt property.
*
* @param value
* allowed object is
* {@link ActiveOrHistoricCurrencyAndAmount }
*
*/
public void setAmt(ActiveOrHistoricCurrencyAndAmount value) {
this.amt = value;
}
/**
* Gets the value of the cdtDbtInd property.
* | * @return
* possible object is
* {@link CreditDebitCode }
*
*/
public CreditDebitCode getCdtDbtInd() {
return cdtDbtInd;
}
/**
* Sets the value of the cdtDbtInd property.
*
* @param value
* allowed object is
* {@link CreditDebitCode }
*
*/
public void setCdtDbtInd(CreditDebitCode value) {
this.cdtDbtInd = value;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.payment.esr\src\main\java-xjc_camt054_001_06\de\metas\payment\camt054_001_06\CashAvailability1.java | 1 |
请完成以下Java代码 | public void setDeploymentTime(Date deploymentTime) {
this.deploymentTime = deploymentTime;
}
@Override
public boolean isNew() {
return isNew;
}
@Override
public void setNew(boolean isNew) {
this.isNew = isNew;
}
@Override
public String getKey() {
return null;
}
@Override
public String getDerivedFrom() {
return null;
}
@Override | public String getDerivedFromRoot() {
return null;
}
@Override
public String getEngineVersion() {
return null;
}
// common methods //////////////////////////////////////////////////////////
@Override
public String toString() {
return "DmnDeploymentEntity[id=" + id + ", name=" + name + "]";
}
} | repos\flowable-engine-main\modules\flowable-dmn-engine\src\main\java\org\flowable\dmn\engine\impl\persistence\entity\DmnDeploymentEntityImpl.java | 1 |
请完成以下Java代码 | public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
public Author getAuthor() {
return author;
}
public void setAuthor(Author author) {
this.author = author;
}
@Override
public boolean equals(Object obj) { | if (this == obj) {
return true;
}
if (getClass() != obj.getClass()) {
return false;
}
return id != null && id.equals(((Book) obj).id);
}
@Override
public int hashCode() {
return 2021;
}
} | repos\Hibernate-SpringBoot-master\HibernateSpringBootNamedEntityGraphBasicAttrs\src\main\java\com\bookstore\entity\Book.java | 1 |
请完成以下Spring Boot application配置 | server:
port: 8080
servlet:
context-path: /demo
spring:
session:
store-type: redis
redis:
flush-mode: immediate
namespace: "spring:session"
redis:
host: localhost
port: 6379
# 连接超时时间(记得添加单位,Duration)
timeout: 10000ms
# Redis默认情况下有16个分片,这里配置具体使用的分片
# database: 0
lettuce:
pool:
# 连接池最大连接数(使用负值表示没有限制) 默认 8
ma | x-active: 8
# 连接池最大阻塞等待时间(使用负值表示没有限制) 默认 -1
max-wait: -1ms
# 连接池中的最大空闲连接 默认 8
max-idle: 8
# 连接池中的最小空闲连接 默认 0
min-idle: 0 | repos\spring-boot-demo-master\demo-session\src\main\resources\application.yml | 2 |
请完成以下Java代码 | default void setTrxName(final Object model, final String trxName, final boolean ignoreIfNotHandled)
{
if (!ignoreIfNotHandled)
{
throw new AdempiereException("Not supported model " + model + " (class:" + (model == null ? null : model.getClass()) + ")");
}
}
int getId(final Object model);
/**
* Get TableName of wrapped model.
* <p>
* This method returns null when:
* <ul>
* <li>model is null
* <li>model is not supported
* </ul>
*
* @return table name or null
*/
String getModelTableNameOrNull(Object model);
/**
* @return true if model is a new record (not yet saved in database)
*/
boolean isNew(Object model);
<T> T getValue(final Object model,
final String columnName,
final boolean throwExIfColumnNotFound,
final boolean useOverrideColumnIfAvailable);
boolean setValue(final Object model, final String columnName, final Object value, final boolean throwExIfColumnNotFound);
boolean isValueChanged(Object model, String columnName);
/**
* @return true if any of given column names where changed
*/
boolean isValueChanged(Object model, Set<String> columnNames);
/**
* Checks if given columnName's value is <code>null</code>
*
* @return <code>true</code> if columnName's value is <code>null</code>
*/
boolean isNull(Object model, String columnName);
@Nullable
<T> T getDynAttribute(@NonNull Object model, final String attributeName);
Object setDynAttribute(final Object model, final String attributeName, final Object value);
@Nullable
default <T> T computeDynAttributeIfAbsent(@NonNull final Object model, @NonNull final String attributeName, @NonNull final Supplier<T> supplier) | {
T value = getDynAttribute(model, attributeName);
if(value == null)
{
value = supplier.get();
setDynAttribute(model, attributeName, value);
}
return value;
}
<T extends PO> T getPO(final Object model, final boolean strict);
Evaluatee getEvaluatee(Object model);
default boolean isCopy(final Object model)
{
return false;
}
default boolean isCopying(final Object model)
{
return false;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\wrapper\IInterfaceWrapperHelper.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public static class SecurityAwareClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
private final Environment environment;
public SecurityAwareClientHttpRequestInterceptor(Environment environment) {
Assert.notNull(environment, "Environment is required");
this.environment = environment;
}
protected boolean isAuthenticationEnabled() {
return StringUtils.hasText(getUsername()) && StringUtils.hasText(getPassword());
}
protected String getUsername() {
return this.environment.getProperty(SPRING_DATA_GEMFIRE_SECURITY_USERNAME_PROPERTY);
}
protected String getPassword() {
return this.environment.getProperty(SPRING_DATA_GEMFIRE_SECURITY_PASSWORD_PROPERTY); | }
@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body,
ClientHttpRequestExecution execution) throws IOException {
if (isAuthenticationEnabled()) {
HttpHeaders requestHeaders = request.getHeaders();
requestHeaders.add(GeodeConstants.USERNAME, getUsername());
requestHeaders.add(GeodeConstants.PASSWORD, getPassword());
}
return execution.execute(request, body);
}
}
} | repos\spring-boot-data-geode-main\spring-geode-project\spring-geode-autoconfigure\src\main\java\org\springframework\geode\boot\autoconfigure\support\HttpBasicAuthenticationSecurityConfiguration.java | 2 |
请完成以下Java代码 | public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Set Default.
@param IsDefault
Default value
*/
public void setIsDefault (boolean IsDefault)
{
set_Value (COLUMNNAME_IsDefault, Boolean.valueOf(IsDefault));
}
/** Get Default.
@return Default value
*/
public boolean isDefault ()
{
Object oo = get_Value(COLUMNNAME_IsDefault);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Summary Level.
@param IsSummary
This is a summary entity
*/
public void setIsSummary (boolean IsSummary)
{
set_Value (COLUMNNAME_IsSummary, Boolean.valueOf(IsSummary));
}
/** Get Summary Level.
@return This is a summary entity
*/
public boolean isSummary ()
{
Object oo = get_Value(COLUMNNAME_IsSummary);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
} | /** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
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 Search Key.
@param Value
Search key for the record in the format required - must be unique
*/
public void setValue (String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
/** Get Search Key.
@return Search key for the record in the format required - must be unique
*/
public String getValue ()
{
return (String)get_Value(COLUMNNAME_Value);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_SalesRegion.java | 1 |
请完成以下Java代码 | protected boolean hasBaseTime(CommandContext commandContext) {
return isStrategyStart(commandContext) || isStrategyEnd(commandContext);
}
protected boolean isStrategyStart(CommandContext commandContext) {
return HISTORY_REMOVAL_TIME_STRATEGY_START.equals(getHistoryRemovalTimeStrategy(commandContext));
}
protected boolean isStrategyEnd(CommandContext commandContext) {
return HISTORY_REMOVAL_TIME_STRATEGY_END.equals(getHistoryRemovalTimeStrategy(commandContext));
}
protected String getHistoryRemovalTimeStrategy(CommandContext commandContext) {
return commandContext.getProcessEngineConfiguration()
.getHistoryRemovalTimeStrategy();
}
protected DecisionDefinition findDecisionDefinitionById(String decisionDefinitionId, CommandContext commandContext) {
return commandContext.getProcessEngineConfiguration()
.getDeploymentCache()
.findDeployedDecisionDefinitionById(decisionDefinitionId);
}
protected boolean isDmnEnabled(CommandContext commandContext) {
return commandContext.getProcessEngineConfiguration().isDmnEnabled();
}
protected Date calculateRemovalTime(HistoricDecisionInstanceEntity decisionInstance, CommandContext commandContext) {
DecisionDefinition decisionDefinition = findDecisionDefinitionById(decisionInstance.getDecisionDefinitionId(), commandContext);
return commandContext.getProcessEngineConfiguration()
.getHistoryRemovalTimeProvider() | .calculateRemovalTime(decisionInstance, decisionDefinition);
}
protected ByteArrayEntity findByteArrayById(String byteArrayId, CommandContext commandContext) {
return commandContext.getDbEntityManager()
.selectById(ByteArrayEntity.class, byteArrayId);
}
protected HistoricDecisionInstanceEntity findDecisionInstanceById(String instanceId, CommandContext commandContext) {
return commandContext.getHistoricDecisionInstanceManager()
.findHistoricDecisionInstance(instanceId);
}
public JobDeclaration<BatchJobContext, MessageEntity> getJobDeclaration() {
return JOB_DECLARATION;
}
protected SetRemovalTimeBatchConfiguration createJobConfiguration(SetRemovalTimeBatchConfiguration configuration, List<String> decisionInstanceIds) {
return new SetRemovalTimeBatchConfiguration(decisionInstanceIds)
.setRemovalTime(configuration.getRemovalTime())
.setHasRemovalTime(configuration.hasRemovalTime())
.setHierarchical(configuration.isHierarchical());
}
protected SetRemovalTimeJsonConverter getJsonConverterInstance() {
return SetRemovalTimeJsonConverter.INSTANCE;
}
public String getType() {
return Batch.TYPE_DECISION_SET_REMOVAL_TIME;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\batch\removaltime\DecisionSetRemovalTimeJobHandler.java | 1 |
请完成以下Java代码 | public void onParameterChanged(final String parameterName)
{
if (PARAM_PP_Order_Node_ID.equals(parameterName))
{
final PPOrderRoutingActivityId orderRoutingActivityId = PPOrderRoutingActivityId.ofRepoIdOrNull(getOrderId(), orderRoutingActivityRepoId);
if (orderRoutingActivityId != null)
{
final PPOrderRoutingActivity orderRoutingActivity = orderRoutingRepository.getOrderRoutingActivity(orderRoutingActivityId);
this.durationUnit = orderRoutingActivity.getDurationUnit();
this.durationAlreadyBooked = durationUnit.toInt(orderRoutingActivity.getDurationTotalBooked());
}
}
}
@Override
protected String doIt()
{
final Duration duration = getDuration();
if (duration.isNegative() || duration.isZero())
{
throw new FillMandatoryException("Duration");
}
final PPOrderRoutingActivityId orderRoutingActivityId = getOrderRoutingActivityId();
final PPOrderId orderId = orderRoutingActivityId.getOrderId();
checkPreconditionsApplicable(orderId);
final I_PP_Order order = getOrderById(orderId);
final UomId finishedGoodsUomId = UomId.ofRepoId(order.getC_UOM_ID());
final PPOrderRoutingActivity orderRoutingActivity = orderRoutingRepository.getOrderRoutingActivity(orderRoutingActivityId);
costCollectorBL.createActivityControl(ActivityControlCreateRequest.builder()
.order(order)
.orderActivity(orderRoutingActivity)
.movementDate(SystemTime.asZonedDateTime())
.qtyMoved(Quantitys.zero(finishedGoodsUomId))
.durationSetup(Duration.ZERO)
.duration(duration)
.build());
return MSG_OK;
} | private I_PP_Order getOrderById(@NonNull final PPOrderId orderId)
{
return ordersCache.computeIfAbsent(orderId, orderBL::getById);
}
private PPOrderRoutingActivityId getOrderRoutingActivityId()
{
return PPOrderRoutingActivityId.ofRepoId(getOrderId(), orderRoutingActivityRepoId);
}
private PPOrderId getOrderId()
{
return PPOrderId.ofRepoId(getRecord_ID());
}
private Duration getDuration()
{
return DurationUtils.toWorkDurationRoundUp(duration, durationUnit.getTemporalUnit());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\pporder\process\PP_Order_RecordWork.java | 1 |
请完成以下Java代码 | public void setCopies(final int copies)
{
parameters.processValueChange(PARAM_Copies, copies, ReasonSupplier.NONE, DocumentFieldLogicExpressionResultRevaluator.ALWAYS_RETURN_FALSE);
}
public PrintCopies getCopies()
{
return PrintCopies.ofInt(parameters.getFieldView(PARAM_Copies).getValueAsInt(0));
}
public AdProcessId getJasperProcess_ID()
{
final IDocumentFieldView field = parameters.getFieldViewOrNull(PARAM_AD_Process_ID);
if (field != null)
{
final int processId = field.getValueAsInt(0);
if (processId > 0)
{ | return AdProcessId.ofRepoId(processId);
}
}
return null;
}
public boolean isPrintPreview()
{
final IDocumentFieldView field = parameters.getFieldViewOrNull(PARAM_IsPrintPreview);
if (field != null)
{
return field.getValueAsBoolean();
}
return true;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\report\HUReportProcessInstance.java | 1 |
请完成以下Java代码 | public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Employee other = (Employee) obj;
if (id == null) {
if (other.id != null) {
return false;
}
} else if (!id.equals(other.id)) {
return false;
}
return true;
} | public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getSalary() {
return salary;
}
public void setSalary(Long salary) {
this.salary = salary;
}
} | repos\tutorials-master\persistence-modules\hibernate-queries\src\main\java\com\baeldung\hibernate\criteria\model\Employee.java | 1 |
请完成以下Java代码 | public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getTodoItem() {
return todoItem;
}
public void setTodoItem(String todoItem) {
this.todoItem = todoItem;
} | public String getCompleted() {
return completed;
}
public void setCompleted(String completed) {
this.completed = completed;
}
public ToDo(String todoItem, String completed){
super();
this.todoItem = todoItem;
this.completed = completed;
}
} | repos\Spring-Boot-Advanced-Projects-main\SpringBoot-Todo-Project\src\main\java\spring\project\entity\ToDo.java | 1 |
请完成以下Java代码 | private I_C_SubscriptionProgress insertNewRecordAfter(final I_C_SubscriptionProgress predecessor)
{
final I_C_SubscriptionProgress sdNew = newInstance(I_C_SubscriptionProgress.class);
sdNew.setC_Flatrate_Term_ID(predecessor.getC_Flatrate_Term_ID());
sdNew.setQty(predecessor.getQty());
sdNew.setStatus(predecessor.getStatus());
sdNew.setM_ShipmentSchedule_ID(predecessor.getM_ShipmentSchedule_ID());
sdNew.setEventDate(predecessor.getEventDate());
sdNew.setSeqNo(predecessor.getSeqNo() + 1);
sdNew.setDropShip_BPartner_ID(predecessor.getDropShip_BPartner_ID());
sdNew.setDropShip_Location_ID(predecessor.getDropShip_Location_ID());
sdNew.setDropShip_User_ID(predecessor.getDropShip_User_ID());
save(sdNew);
logger.info("Created new C_SubscriptionProgress={}", sdNew);
return sdNew;
}
public final I_C_SubscriptionProgress retrieveLastSP(
final int termId,
final int seqNo)
{
return Services.get(IQueryBL.class)
.createQueryBuilder(I_C_SubscriptionProgress.class)
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_C_SubscriptionProgress.COLUMN_C_Flatrate_Term_ID, termId)
.addCompareFilter(I_C_SubscriptionProgress.COLUMN_SeqNo, Operator.GREATER_OR_EQUAL, seqNo) | .orderBy().addColumn(I_C_SubscriptionProgress.COLUMNNAME_SeqNo, Direction.Ascending, Nulls.Last).endOrderBy()
.create()
.first();
}
@Override
public final List<I_C_SubscriptionProgress> retrievePlannedAndDelayedDeliveries(
@NonNull final Properties ctx,
@NonNull final Timestamp date,
final String trxName)
{
return Services.get(IQueryBL.class)
.createQueryBuilder(I_C_SubscriptionProgress.class, ctx, trxName)
.addOnlyActiveRecordsFilter()
.addOnlyContextClient()
.addEqualsFilter(I_C_SubscriptionProgress.COLUMN_EventType, X_C_SubscriptionProgress.EVENTTYPE_Delivery)
.addInArrayFilter(I_C_SubscriptionProgress.COLUMN_Status, X_C_SubscriptionProgress.STATUS_Planned, X_C_SubscriptionProgress.STATUS_Delayed)
.addCompareFilter(I_C_SubscriptionProgress.COLUMN_EventDate, Operator.LESS_OR_EQUAL, date)
.orderBy()
.addColumn(I_C_SubscriptionProgress.COLUMN_EventDate)
.addColumn(I_C_SubscriptionProgress.COLUMN_C_Flatrate_Term_ID)
.addColumn(I_C_SubscriptionProgress.COLUMN_SeqNo).endOrderBy()
.create().list();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\impl\AbstractSubscriptionDAO.java | 1 |
请完成以下Java代码 | protected String getSelectSQL(final String searchInput, final int caretPosition, final List<Object> params)
{
final String searchSQL = getSearchStringSQL(searchInput, caretPosition);
final MLookupInfo.SqlQuery sqlQuery = lookupInfo.getSqlQuery();
final String sqlSelect = sqlQuery.getSelectSqlPart().translate();
if (Check.isBlank(sqlSelect))
{
log.warn("Empty SELECT SQL found for: {}", lookupInfo);
return null;
}
final StringBuilder sqlWhere = new StringBuilder();
{
if (!Check.isEmpty(sqlQuery.getSqlWhereClauseStatic()))
{
sqlWhere.append("(").append(sqlQuery.getSqlWhereClauseStatic()).append(")");
}
final IStringExpression sqlWhereValRuleExpr = validationRule.getPrefilterWhereClause();
final String sqlWhereValRule = sqlWhereValRuleExpr.evaluate(getValidationContext(), OnVariableNotFound.ReturnNoResult);
if (sqlWhereValRuleExpr.isNoResult(sqlWhereValRule))
{
return null;
}
else if (!Check.isEmpty(sqlWhereValRule, true))
{
if (sqlWhere.length() > 0)
{
sqlWhere.append(" AND ");
}
sqlWhere.append("(").append(sqlWhereValRule).append(")");
params.addAll(autocompleterValidationRule.getParameterValues(searchSQL));
}
}
final StringBuilder sqlBuilder = new StringBuilder();
sqlBuilder.append(sqlSelect);
if (sqlWhere.length() > 0)
{
sqlBuilder.append(" WHERE ").append(sqlWhere);
}
final String sqlOrderBy = sqlQuery.getSqlOrderBy();
if (!Check.isEmpty(sqlOrderBy, true))
{
sqlBuilder.append(" ORDER BY ").append(sqlOrderBy);
}
// Add Security
final String sqlFinal;
if (sqlQuery.isSecurityDisabled())
{
sqlFinal = sqlBuilder.toString();
}
else
{
final TableName tableName = sqlQuery.getTableName(); | sqlFinal = Env.getUserRolePermissions().addAccessSQL(sqlBuilder.toString(), tableName.getAsString(), IUserRolePermissions.SQL_FULLYQUALIFIED, Access.READ);
}
//
return sqlFinal;
}
@Override
public void setUserObject(final Object userObject)
{
final String textOld = getText();
final int caretPosition = getTextCaretPosition();
//
super.setUserObject(userObject);
// Object valueOld = editor.getValue();
Object value = null;
if (userObject == null)
{
editor.setValue(null);
}
else if (userObject instanceof ValueNamePair)
{
ValueNamePair vnp = (ValueNamePair)userObject;
value = vnp.getValue();
}
else if (userObject instanceof KeyNamePair)
{
KeyNamePair knp = (KeyNamePair)userObject;
value = knp.getKey();
}
else
{
log.warn("Not supported - {}, class={}", userObject, userObject.getClass());
return;
}
editor.actionCombo(value);
if (value == null)
{
setText(textOld);
setTextCaretPosition(caretPosition);
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\org\compiere\grid\ed\VLookupAutoCompleter.java | 1 |
请完成以下Java代码 | public class DatabaseProperty {
public static final List<String> SCHEMA_UPDATE_VALUES = Arrays.asList(
DB_SCHEMA_UPDATE_TRUE,
DB_SCHEMA_UPDATE_FALSE,
DB_SCHEMA_UPDATE_CREATE,
DB_SCHEMA_UPDATE_CREATE_DROP,
DB_SCHEMA_UPDATE_DROP_CREATE);
/**
* enables automatic schema update
*/
private String schemaUpdate = DB_SCHEMA_UPDATE_TRUE;
/**
* the database type
*/
private String type;
/**
* the database table prefix to use
*/
private String tablePrefix = Defaults.INSTANCE.getDatabaseTablePrefix();
/**
* the database schema to use
*/
private String schemaName = Defaults.INSTANCE.getDatabaseSchema();
/**
* enables batch processing mode for db operations
*/
private boolean jdbcBatchProcessing = true;
public String getSchemaUpdate() {
return schemaUpdate;
}
/**
* @param schemaUpdate the schemaUpdate to set
*/
public void setSchemaUpdate(String schemaUpdate) {
Assert.isTrue(SCHEMA_UPDATE_VALUES.contains(schemaUpdate), String.format("schemaUpdate: '%s' is not valid (%s)", schemaUpdate, SCHEMA_UPDATE_VALUES));
this.schemaUpdate = schemaUpdate;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getTablePrefix() {
return tablePrefix;
}
public void setTablePrefix(String tablePrefix) {
this.tablePrefix = tablePrefix;
} | public static List<String> getSchemaUpdateValues() {
return SCHEMA_UPDATE_VALUES;
}
public String getSchemaName() {
return schemaName;
}
public void setSchemaName(String schemaName) {
this.schemaName = schemaName;
}
public boolean isJdbcBatchProcessing() {
return jdbcBatchProcessing;
}
public void setJdbcBatchProcessing(boolean jdbcBatchProcessing) {
this.jdbcBatchProcessing = jdbcBatchProcessing;
}
@Override
public String toString() {
return joinOn(this.getClass())
.add("type=" + type)
.add("schemaUpdate=" + schemaUpdate)
.add("schemaName=" + schemaName)
.add("tablePrefix=" + tablePrefix)
.add("jdbcBatchProcessing=" + jdbcBatchProcessing)
.toString();
}
} | repos\camunda-bpm-platform-master\spring-boot-starter\starter\src\main\java\org\camunda\bpm\spring\boot\starter\property\DatabaseProperty.java | 1 |
请完成以下Java代码 | protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_CM_AccessListBPGroup[")
.append(get_ID()).append("]");
return sb.toString();
}
public I_C_BP_Group getC_BP_Group() throws RuntimeException
{
return (I_C_BP_Group)MTable.get(getCtx(), I_C_BP_Group.Table_Name)
.getPO(getC_BP_Group_ID(), get_TrxName()); }
/** Set Business Partner Group.
@param C_BP_Group_ID
Business Partner Group
*/
public void setC_BP_Group_ID (int C_BP_Group_ID)
{
if (C_BP_Group_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_BP_Group_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_BP_Group_ID, Integer.valueOf(C_BP_Group_ID));
}
/** Get Business Partner Group.
@return Business Partner Group
*/
public int getC_BP_Group_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_BP_Group_ID); | if (ii == null)
return 0;
return ii.intValue();
}
public I_CM_AccessProfile getCM_AccessProfile() throws RuntimeException
{
return (I_CM_AccessProfile)MTable.get(getCtx(), I_CM_AccessProfile.Table_Name)
.getPO(getCM_AccessProfile_ID(), get_TrxName()); }
/** Set Web Access Profile.
@param CM_AccessProfile_ID
Web Access Profile
*/
public void setCM_AccessProfile_ID (int CM_AccessProfile_ID)
{
if (CM_AccessProfile_ID < 1)
set_ValueNoCheck (COLUMNNAME_CM_AccessProfile_ID, null);
else
set_ValueNoCheck (COLUMNNAME_CM_AccessProfile_ID, Integer.valueOf(CM_AccessProfile_ID));
}
/** Get Web Access Profile.
@return Web Access Profile
*/
public int getCM_AccessProfile_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_CM_AccessProfile_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_CM_AccessListBPGroup.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public TaskQuery createTaskQuery(CommandExecutor commandExecutor, AbstractEngineConfiguration engineConfiguration) {
return new TaskQueryImpl(commandExecutor, configuration, getVariableServiceConfiguration(engineConfiguration), configuration.getIdmIdentityService());
}
@Override
public void changeTaskAssignee(TaskEntity taskEntity, String userId) {
getTaskEntityManager().changeTaskAssignee(taskEntity, userId);
}
@Override
public void changeTaskOwner(TaskEntity taskEntity, String ownerId) {
getTaskEntityManager().changeTaskOwner(taskEntity, ownerId);
}
@Override
public void updateTaskTenantIdForDeployment(String deploymentId, String tenantId) {
getTaskEntityManager().updateTaskTenantIdForDeployment(deploymentId, tenantId);
}
@Override
public void updateTask(TaskEntity taskEntity, boolean fireUpdateEvent) {
getTaskEntityManager().update(taskEntity, fireUpdateEvent);
}
@Override
public void updateAllTaskRelatedEntityCountFlags(boolean configProperty) {
getTaskEntityManager().updateAllTaskRelatedEntityCountFlags(configProperty);
}
@Override
public TaskEntity createTask() {
return getTaskEntityManager().create();
}
@Override
public void insertTask(TaskEntity taskEntity, boolean fireCreateEvent) {
getTaskEntityManager().insert(taskEntity, fireCreateEvent); | }
@Override
public void deleteTask(TaskEntity task, boolean fireEvents) {
getTaskEntityManager().delete(task, fireEvents);
}
@Override
public void deleteTasksByExecutionId(String executionId) {
getTaskEntityManager().deleteTasksByExecutionId(executionId);
}
public TaskEntityManager getTaskEntityManager() {
return configuration.getTaskEntityManager();
}
@Override
public TaskEntity createTask(TaskBuilder taskBuilder) {
return getTaskEntityManager().createTask(taskBuilder);
}
protected VariableServiceConfiguration getVariableServiceConfiguration(AbstractEngineConfiguration engineConfiguration) {
return (VariableServiceConfiguration) engineConfiguration.getServiceConfigurations().get(EngineConfigurationConstants.KEY_VARIABLE_SERVICE_CONFIG);
}
} | repos\flowable-engine-main\modules\flowable-task-service\src\main\java\org\flowable\task\service\impl\TaskServiceImpl.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public void setPlantName(String value) {
this.plantName = value;
}
/**
* Gets the value of the plantCity property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPlantCity() {
return plantCity;
}
/**
* Sets the value of the plantCity property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPlantCity(String value) {
this.plantCity = value;
}
/**
* Gets the value of the deliverTo property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDeliverTo() {
return deliverTo;
}
/**
* Sets the value of the deliverTo property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDeliverTo(String value) {
this.deliverTo = value;
}
/**
* Gets the value of the productionDescription property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getProductionDescription() {
return productionDescription;
}
/**
* Sets the value of the productionDescription property. | *
* @param value
* allowed object is
* {@link String }
*
*/
public void setProductionDescription(String value) {
this.productionDescription = value;
}
/**
* Gets the value of the kanbanCardNumberRange1Start property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getKanbanCardNumberRange1Start() {
return kanbanCardNumberRange1Start;
}
/**
* Sets the value of the kanbanCardNumberRange1Start property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setKanbanCardNumberRange1Start(String value) {
this.kanbanCardNumberRange1Start = value;
}
/**
* Gets the value of the kanbanCardNumberRange1End property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getKanbanCardNumberRange1End() {
return kanbanCardNumberRange1End;
}
/**
* Sets the value of the kanbanCardNumberRange1End property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setKanbanCardNumberRange1End(String value) {
this.kanbanCardNumberRange1End = value;
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\PackagingIdentificationType.java | 2 |
请完成以下Java代码 | protected org.compiere.model.POInfo initPO (Properties ctx)
{
org.compiere.model.POInfo poi = org.compiere.model.POInfo.getPOInfo (ctx, Table_Name, get_TrxName());
return poi;
}
@Override
public org.compiere.model.I_C_Country getC_Country() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_C_Country_ID, org.compiere.model.I_C_Country.class);
}
@Override
public void setC_Country(org.compiere.model.I_C_Country C_Country)
{
set_ValueFromPO(COLUMNNAME_C_Country_ID, org.compiere.model.I_C_Country.class, C_Country);
}
/** Set Land.
@param C_Country_ID
Country
*/
@Override
public void setC_Country_ID (int C_Country_ID)
{
if (C_Country_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Country_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Country_ID, Integer.valueOf(C_Country_ID));
}
/** Get Land.
@return Country
*/
@Override
public int getC_Country_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Country_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Region.
@param C_Region_ID
Identifies a geographical Region
*/
@Override
public void setC_Region_ID (int C_Region_ID)
{
if (C_Region_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Region_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Region_ID, Integer.valueOf(C_Region_ID));
}
/** Get Region.
@return Identifies a geographical Region
*/
@Override
public int getC_Region_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Region_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Beschreibung.
@param Description Beschreibung */
@Override
public void setDescription (java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Beschreibung.
@return Beschreibung */
@Override
public java.lang.String getDescription ()
{
return (java.lang.String)get_Value(COLUMNNAME_Description);
} | /** Set Standard.
@param IsDefault
Default value
*/
@Override
public void setIsDefault (boolean IsDefault)
{
set_Value (COLUMNNAME_IsDefault, Boolean.valueOf(IsDefault));
}
/** Get Standard.
@return Default value
*/
@Override
public boolean isDefault ()
{
Object oo = get_Value(COLUMNNAME_IsDefault);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
@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);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Region.java | 1 |
请完成以下Java代码 | public List<FlowNode> getEnabledActivitiesFromAdhocSubProcess(String executionId) {
return commandExecutor.execute(new GetEnabledActivitiesForAdhocSubProcessCmd(executionId));
}
@Override
public Execution executeActivityInAdhocSubProcess(String executionId, String activityId) {
return commandExecutor.execute(new ExecuteActivityForAdhocSubProcessCmd(executionId, activityId));
}
@Override
public void completeAdhocSubProcess(String executionId) {
commandExecutor.execute(new CompleteAdhocSubProcessCmd(executionId));
}
@Override
public ProcessInstanceBuilder createProcessInstanceBuilder() {
return new ProcessInstanceBuilderImpl(this);
}
@Override
public ProcessInstance startCreatedProcessInstance(
ProcessInstance createdProcessInstance,
Map<String, Object> variables
) { | return commandExecutor.execute(new StartCreatedProcessInstanceCmd<>(createdProcessInstance, variables));
}
public ProcessInstance startProcessInstance(ProcessInstanceBuilderImpl processInstanceBuilder) {
if (processInstanceBuilder.hasProcessDefinitionIdOrKey()) {
return commandExecutor.execute(new StartProcessInstanceCmd<ProcessInstance>(processInstanceBuilder));
} else if (processInstanceBuilder.getMessageName() != null) {
return commandExecutor.execute(new StartProcessInstanceByMessageCmd(processInstanceBuilder));
} else {
throw new ActivitiIllegalArgumentException(
"No processDefinitionId, processDefinitionKey nor messageName provided"
);
}
}
public ProcessInstance createProcessInstance(ProcessInstanceBuilderImpl processInstanceBuilder) {
if (processInstanceBuilder.hasProcessDefinitionIdOrKey()) {
return commandExecutor.execute(new CreateProcessInstanceCmd(processInstanceBuilder));
} else {
throw new ActivitiIllegalArgumentException(
"No processDefinitionId, processDefinitionKey nor messageName provided"
);
}
}
} | repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\RuntimeServiceImpl.java | 1 |
请完成以下Java代码 | public static void recognition(List<Vertex> segResult, WordNet wordNetOptimum, WordNet wordNetAll)
{
StringBuilder sbName = new StringBuilder();
int appendTimes = 0;
char[] charArray = wordNetAll.charArray;
DoubleArrayTrie<Character>.LongestSearcher searcher = JapanesePersonDictionary.getSearcher(charArray);
int activeLine = 1;
int preOffset = 0;
while (searcher.next())
{
Character label = searcher.value;
int offset = searcher.begin;
String key = new String(charArray, offset, searcher.length);
if (preOffset != offset)
{
if (appendTimes > 1 && sbName.length() > 2) // 日本人名最短为3字
{
insertName(sbName.toString(), activeLine, wordNetOptimum, wordNetAll);
}
sbName.setLength(0);
appendTimes = 0;
}
if (appendTimes == 0)
{
if (label == JapanesePersonDictionary.X)
{
sbName.append(key);
++appendTimes;
activeLine = offset + 1;
}
}
else
{
if (label == JapanesePersonDictionary.M)
{
sbName.append(key);
++appendTimes;
}
else
{
if (appendTimes > 1 && sbName.length() > 2)
{
insertName(sbName.toString(), activeLine, wordNetOptimum, wordNetAll);
}
sbName.setLength(0);
appendTimes = 0;
}
}
preOffset = offset + key.length();
}
if (sbName.length() > 0) | {
if (appendTimes > 1)
{
insertName(sbName.toString(), activeLine, wordNetOptimum, wordNetAll);
}
}
}
/**
* 是否是bad case
* @param name
* @return
*/
public static boolean isBadCase(String name)
{
Character label = JapanesePersonDictionary.get(name);
if (label == null) return false;
return label.equals(JapanesePersonDictionary.A);
}
/**
* 插入日本人名
* @param name
* @param activeLine
* @param wordNetOptimum
* @param wordNetAll
*/
private static void insertName(String name, int activeLine, WordNet wordNetOptimum, WordNet wordNetAll)
{
if (isBadCase(name)) return;
wordNetOptimum.insert(activeLine, new Vertex(Predefine.TAG_PEOPLE, name, new CoreDictionary.Attribute(Nature.nrj), WORD_ID), wordNetAll);
}
} | repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\recognition\nr\JapanesePersonRecognition.java | 1 |
请完成以下Java代码 | public Map<String, Object> execute(CommandContext commandContext) {
if (taskId == null) {
throw new ActivitiIllegalArgumentException("taskId is null");
}
TaskEntity task = commandContext
.getTaskEntityManager()
.findTaskById(taskId);
if (task == null) {
throw new ActivitiObjectNotFoundException("task " + taskId + " doesn't exist", Task.class);
}
if (variableNames == null) {
if (isLocal) { | return task.getVariablesLocal();
} else {
return task.getVariables();
}
} else {
if (isLocal) {
return task.getVariablesLocal(variableNames, false);
} else {
return task.getVariables(variableNames, false);
}
}
}
} | repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\cmd\GetTaskVariablesCmd.java | 1 |
请完成以下Java代码 | private static String extractAdLanguageFromUserSession(@NonNull final UserSession userSession)
{
final String sessionADLanguage = userSession.getAD_Language();
if (sessionADLanguage != null)
{
return sessionADLanguage;
}
//
// Try fetching the AD_Language from "Accept-Language" HTTP header
if (userSession.isUseHttpAcceptLanguage())
{
HttpServletRequest httpServletRequest = getHttpServletRequest();
if (httpServletRequest != null)
{
final String httpAcceptLanguage = httpServletRequest.getHeader(HttpHeaders.ACCEPT_LANGUAGE);
if (!Check.isEmpty(httpAcceptLanguage, true))
{
final String requestLanguage = Services.get(ILanguageDAO.class).retrieveAvailableLanguages()
.getAD_LanguageFromHttpAcceptLanguage(httpAcceptLanguage, null);
if (requestLanguage != null)
{
return requestLanguage;
}
}
}
}
throw new IllegalStateException("Cannot extract the AD_Language from user session");
}
private static HttpServletRequest getHttpServletRequest()
{ | RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
if (requestAttributes == null)
{
return null;
}
if (!(requestAttributes instanceof ServletRequestAttributes))
{
return null;
}
return ((ServletRequestAttributes)requestAttributes).getRequest();
}
public DocumentFieldLogicExpressionResultRevaluator getLogicExpressionResultRevaluator()
{
return documentPermissions != null ? documentPermissions.getLogicExpressionResultRevaluator() : DocumentFieldLogicExpressionResultRevaluator.DEFAULT;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\datatypes\json\JSONOptions.java | 1 |
请完成以下Java代码 | public class DeserializedObject {
protected SerializableType type;
protected Object deserializedObject;
protected byte[] originalBytes;
protected VariableInstanceEntity variableInstanceEntity;
public DeserializedObject(
SerializableType type,
Object deserializedObject,
byte[] serializedBytes,
VariableInstanceEntity variableInstanceEntity
) {
this.type = type;
this.deserializedObject = deserializedObject;
this.originalBytes = serializedBytes;
this.variableInstanceEntity = variableInstanceEntity;
}
public void verifyIfBytesOfSerializedObjectChanged() { | // this first check verifies if the variable value was not overwritten with another object
if (deserializedObject == variableInstanceEntity.getCachedValue() && !variableInstanceEntity.isDeleted()) {
byte[] bytes = type.serialize(deserializedObject, variableInstanceEntity);
if (!Arrays.equals(originalBytes, bytes)) {
// Add an additional check to prevent byte differences due to JDK changes etc
Object originalObject = type.deserialize(originalBytes, variableInstanceEntity);
byte[] refreshedOriginalBytes = type.serialize(originalObject, variableInstanceEntity);
if (!Arrays.equals(refreshedOriginalBytes, bytes)) {
variableInstanceEntity.setBytes(bytes);
}
}
}
}
} | repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\variable\DeserializedObject.java | 1 |
请完成以下Java代码 | private PickingSlotView getOrCreatePickingSlotView(@NonNull final ViewId pickingSlotViewId, final boolean create)
{
final PackageableView packageableView = getPackageableViewByPickingSlotViewId(pickingSlotViewId);
final DocumentId packageableRowId = extractRowId(pickingSlotViewId);
if (create)
{
return packageableView.computePickingSlotViewIfAbsent(
packageableRowId,
() -> {
final PackageableRow packageableRow = packageableView.getById(packageableRowId);
final CreateViewRequest createViewRequest = CreateViewRequest
.builder(PickingConstants.WINDOWID_PickingSlotView, JSONViewDataType.includedView)
.setParentViewId(packageableView.getViewId())
.setParentRowId(packageableRow.getId())
.build();
// provide all pickingView's M_ShipmentSchedule_IDs to the factory, because we want to show the same picking slots and picked HU-rows for all of them.
final Set<ShipmentScheduleId> allShipmentScheduleIds = packageableView
.streamByIds(DocumentIdsSelection.ALL)
.map(PackageableRow::cast)
.map(PackageableRow::getShipmentScheduleId)
.collect(ImmutableSet.toImmutableSet());
return pickingSlotViewFactory.createView(createViewRequest, allShipmentScheduleIds);
});
}
else
{
return packageableView.getPickingSlotViewOrNull(packageableRowId);
}
}
@Override
public void closeById(@NonNull final ViewId pickingSlotViewId, @NonNull final ViewCloseAction closeAction)
{
final DocumentId rowId = extractRowId(pickingSlotViewId); | final PackageableView packageableView = getPackageableViewByPickingSlotViewId(pickingSlotViewId);
packageableView.removePickingSlotView(rowId, closeAction);
}
@Override
public void invalidateView(final ViewId pickingSlotViewId)
{
final PickingSlotView pickingSlotView = getOrCreatePickingSlotView(pickingSlotViewId, false/* create */);
if (pickingSlotView == null)
{
return;
}
final PackageableView packageableView = getPackageableViewByPickingSlotViewId(pickingSlotViewId);
if (packageableView != null)
{
//we have to invalidate all the related pickingSlotViews in order to make sure the
//changes available in UI when selecting different `packageableRows`
packageableView.invalidatePickingSlotViews();
}
pickingSlotView.invalidateAll();
ViewChangesCollector.getCurrentOrAutoflush()
.collectFullyChanged(pickingSlotView);
}
@Override
public Stream<IView> streamAllViews()
{
// Do we really have to implement this?
return Stream.empty();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\picking\pickingslot\PickingSlotViewsIndexStorage.java | 1 |
请完成以下Java代码 | public Quantity handleQuantityDecrease(final @NonNull SupplyRequiredDecreasedEvent event,
final Quantity qtyToDistribute)
{
final Set<DDOrderCandidateId> candidateIds = getDDOrderCandidateIds(event);
if (candidateIds.isEmpty())
{
return qtyToDistribute;
}
final Collection<DDOrderCandidate> candidates = ddOrderCandidateService.getByIds(candidateIds);
Quantity remainingQtyToDistribute = qtyToDistribute;
for (final DDOrderCandidate candidate : candidates)
{
remainingQtyToDistribute = doDecreaseQty(candidate, remainingQtyToDistribute);
if (remainingQtyToDistribute.signum() <= 0)
{
return remainingQtyToDistribute.toZero();
}
}
return remainingQtyToDistribute;
}
private @NonNull Set<DDOrderCandidateId> getDDOrderCandidateIds(final @NonNull SupplyRequiredDecreasedEvent event)
{
final Candidate demandCandidate = candidateRepositoryRetrieval.retrieveById(CandidateId.ofRepoId(event.getSupplyRequiredDescriptor().getDemandCandidateId()));
return candidateRepositoryWriteService.getSupplyCandidatesForDemand(demandCandidate, CandidateBusinessCase.DISTRIBUTION)
.stream()
.map(DDOrderCandidateAdvisedEventCreator::getDDOrderCandidateIdOrNull)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
}
@Nullable
private static DDOrderCandidateId getDDOrderCandidateIdOrNull(@NonNull final Candidate candidate)
{
final DistributionDetail distributionDetail = DistributionDetail.castOrNull(candidate.getBusinessCaseDetail());
if (distributionDetail == null)
{
return null;
}
final DDOrderRef ddOrderRef = distributionDetail.getDdOrderRef(); | if (ddOrderRef == null)
{
return null;
}
return DDOrderCandidateId.ofRepoId(ddOrderRef.getDdOrderCandidateId());
}
private Quantity doDecreaseQty(final DDOrderCandidate ddOrderCandidate, final Quantity remainingQtyToDistribute)
{
if (isCandidateEligibleForBeingDecreased(ddOrderCandidate))
{
final Quantity qtyToDecrease = remainingQtyToDistribute.min(ddOrderCandidate.getQtyToProcess());
ddOrderCandidate.setQtyEntered(ddOrderCandidate.getQtyEntered().subtract(qtyToDecrease));
ddOrderCandidateService.save(ddOrderCandidate);
return remainingQtyToDistribute.subtract(qtyToDecrease);
}
return remainingQtyToDistribute;
}
private static boolean isCandidateEligibleForBeingDecreased(final DDOrderCandidate ddOrderCandidate)
{
return !ddOrderCandidate.isProcessed()
&& ddOrderCandidate.getQtyToProcess().signum() > 0;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\de\metas\distribution\ddordercandidate\material_dispo\DDOrderCandidateAdvisedEventCreator.java | 1 |
请完成以下Java代码 | <T> WebSocketMessage encode(WebSocketSession session, GraphQlWebSocketMessage message) {
DataBuffer buffer = ((Encoder<T>) this.encoder).encodeValue(
(T) message, session.bufferFactory(), MESSAGE_TYPE, MimeTypeUtils.APPLICATION_JSON, null);
this.messagesEncoded = true;
return new WebSocketMessage(WebSocketMessage.Type.TEXT, buffer);
}
@SuppressWarnings("ConstantConditions")
@Nullable GraphQlWebSocketMessage decode(WebSocketMessage webSocketMessage) {
DataBuffer buffer = DataBufferUtils.retain(webSocketMessage.getPayload());
return (GraphQlWebSocketMessage) this.decoder.decode(buffer, MESSAGE_TYPE, null, null);
}
WebSocketMessage encodeConnectionAck(WebSocketSession session, Object ackPayload) {
return encode(session, GraphQlWebSocketMessage.connectionAck(ackPayload));
}
WebSocketMessage encodeNext(WebSocketSession session, String id, Map<String, Object> responseMap) {
return encode(session, GraphQlWebSocketMessage.next(id, responseMap)); | }
WebSocketMessage encodeError(WebSocketSession session, String id, List<GraphQLError> errors) {
return encode(session, GraphQlWebSocketMessage.error(id, errors));
}
WebSocketMessage encodeComplete(WebSocketSession session, String id) {
return encode(session, GraphQlWebSocketMessage.complete(id));
}
boolean checkMessagesEncodedAndClear() {
boolean result = this.messagesEncoded;
this.messagesEncoded = false;
return result;
}
} | repos\spring-graphql-main\spring-graphql\src\main\java\org\springframework\graphql\server\webflux\WebSocketCodecDelegate.java | 1 |
请完成以下Java代码 | public GL_JournalLine_Builder setAccountDR(final I_C_ElementValue accountDR)
{
final I_C_ValidCombination vc = createValidCombination(accountDR);
setAccountDR(vc);
return this;
}
public GL_JournalLine_Builder setAccountDR(final I_C_ValidCombination vc)
{
glJournalLine.setAccount_DR(vc);
return this;
}
public GL_JournalLine_Builder setAccountDR(final AccountId accountId)
{
glJournalLine.setAccount_DR_ID(accountId.getRepoId());
return this;
}
public GL_JournalLine_Builder setAccountCR(final I_C_ElementValue accountCR)
{
final I_C_ValidCombination vc = createValidCombination(accountCR);
setAccountCR(vc);
return this;
}
public GL_JournalLine_Builder setAccountCR(final I_C_ValidCombination vc)
{
glJournalLine.setAccount_CR(vc);
return this; | }
public GL_JournalLine_Builder setAccountCR(final AccountId accountId)
{
glJournalLine.setAccount_CR_ID(accountId.getRepoId());
return this;
}
public GL_JournalLine_Builder setAmount(final BigDecimal amount)
{
glJournalLine.setAmtSourceDr(amount);
glJournalLine.setAmtSourceCr(amount);
// NOTE: AmtAcctDr/Cr will be set on before save
return this;
}
private final I_C_ValidCombination createValidCombination(final I_C_ElementValue ev)
{
final Properties ctx = InterfaceWrapperHelper.getCtx(ev);
final AcctSchemaId acctSchemaId = AcctSchemaId.ofRepoId(getGL_Journal().getC_AcctSchema_ID());
final AccountDimension dim = accountBL.createAccountDimension(ev, acctSchemaId);
return MAccount.get(ctx, dim);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\gljournal\GL_JournalLine_Builder.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class WebConfig implements WebMvcConfigurer {
@Override
public void configureMessageConverters(final List<HttpMessageConverter<?>> messageConverters) {
messageConverters.add(new MappingJackson2HttpMessageConverter());
messageConverters.add(createXmlHttpMessageConverter());
}
/**
* There is another possibility to add a message converter, see {@link ConverterExtensionsConfig}
*/
private HttpMessageConverter<Object> createXmlHttpMessageConverter() {
final MarshallingHttpMessageConverter xmlConverter = new MarshallingHttpMessageConverter();
final XStreamMarshaller xstreamMarshaller = new XStreamMarshaller();
xmlConverter.setMarshaller(xstreamMarshaller);
xmlConverter.setUnmarshaller(xstreamMarshaller);
return xmlConverter;
}
// Etags
// If we're not using Spring Boot we can make use of | // AbstractAnnotationConfigDispatcherServletInitializer#getServletFilters
@Bean
public FilterRegistrationBean<ShallowEtagHeaderFilter> shallowEtagHeaderFilter() {
FilterRegistrationBean<ShallowEtagHeaderFilter> filterRegistrationBean =
new FilterRegistrationBean<>(new ShallowEtagHeaderFilter());
filterRegistrationBean.addUrlPatterns("/foos/*");
filterRegistrationBean.setName("etagFilter");
return filterRegistrationBean;
}
// We can also just declare the filter directly
// @Bean
// public ShallowEtagHeaderFilter shallowEtagHeaderFilter() {
// return new ShallowEtagHeaderFilter();
// }
} | repos\tutorials-master\spring-web-modules\spring-boot-rest\src\main\java\com\baeldung\spring\WebConfig.java | 2 |
请完成以下Java代码 | public final class DistributionJobStepId
{
@NonNull private final DDOrderMoveScheduleId scheduleId;
private DistributionJobStepId(@NonNull final DDOrderMoveScheduleId scheduleId)
{
this.scheduleId = scheduleId;
}
public static DistributionJobStepId ofScheduleId(final @NonNull DDOrderMoveScheduleId scheduleId)
{
return new DistributionJobStepId(scheduleId);
}
@JsonCreator
public static DistributionJobStepId ofJson(final @NonNull Object json)
{
final DDOrderMoveScheduleId scheduleId = RepoIdAwares.ofObject(json, DDOrderMoveScheduleId.class, DDOrderMoveScheduleId::ofRepoId);
return ofScheduleId(scheduleId);
} | @JsonValue
public String toString()
{
return toJson();
}
@NonNull
private String toJson()
{
return String.valueOf(scheduleId.getRepoId());
}
@NonNull
public DDOrderMoveScheduleId toScheduleId() {return scheduleId;}
public static boolean equals(@Nullable DistributionJobStepId id1, @Nullable DistributionJobStepId id2) {return Objects.equals(id1, id2);}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.distribution.rest-api\src\main\java\de\metas\distribution\mobileui\job\model\DistributionJobStepId.java | 1 |
请完成以下Java代码 | public PlanItemInstanceEntity getContinueParentPlanItemInstance(String planItemInstanceId) {
return continueParentPlanItemInstanceMap.get(planItemInstanceId);
}
public Map<String, PlanItemMoveEntry> getMoveToPlanItemMap() {
return moveToPlanItemMap;
}
public void setMoveToPlanItemMap(Map<String, PlanItemMoveEntry> moveToPlanItemMap) {
this.moveToPlanItemMap = moveToPlanItemMap;
}
public PlanItemMoveEntry getMoveToPlanItem(String planItemId) {
return moveToPlanItemMap.get(planItemId);
}
public List<PlanItemMoveEntry> getMoveToPlanItems() {
return new ArrayList<>(moveToPlanItemMap.values());
}
public static class PlanItemMoveEntry { | protected PlanItem originalPlanItem;
protected PlanItem newPlanItem;
public PlanItemMoveEntry(PlanItem originalPlanItem, PlanItem newPlanItem) {
this.originalPlanItem = originalPlanItem;
this.newPlanItem = newPlanItem;
}
public PlanItem getOriginalPlanItem() {
return originalPlanItem;
}
public PlanItem getNewPlanItem() {
return newPlanItem;
}
}
} | repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\runtime\MovePlanItemInstanceEntityContainer.java | 1 |
请完成以下Java代码 | public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Resolution.
@param R_Resolution_ID
Request Resolution
*/
public void setR_Resolution_ID (int R_Resolution_ID)
{ | if (R_Resolution_ID < 1)
set_ValueNoCheck (COLUMNNAME_R_Resolution_ID, null);
else
set_ValueNoCheck (COLUMNNAME_R_Resolution_ID, Integer.valueOf(R_Resolution_ID));
}
/** Get Resolution.
@return Request Resolution
*/
public int getR_Resolution_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_R_Resolution_ID);
if (ii == null)
return 0;
return ii.intValue();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_R_Resolution.java | 1 |
请完成以下Java代码 | public String toString()
{
StringBuffer sb = new StringBuffer ("X_AD_Preference[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set Preference.
@param AD_Preference_ID
Personal Value Preference
*/
public void setAD_Preference_ID (int AD_Preference_ID)
{
if (AD_Preference_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_Preference_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_Preference_ID, Integer.valueOf(AD_Preference_ID));
}
/** Get Preference.
@return Personal Value Preference
*/
public int getAD_Preference_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Preference_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_AD_User getAD_User() throws RuntimeException
{
return (I_AD_User)MTable.get(getCtx(), I_AD_User.Table_Name)
.getPO(getAD_User_ID(), get_TrxName()); }
/** Set User/Contact.
@param AD_User_ID
User within the system - Internal or Business Partner Contact
*/
public void setAD_User_ID (int AD_User_ID)
{
if (AD_User_ID < 1)
set_Value (COLUMNNAME_AD_User_ID, null);
else
set_Value (COLUMNNAME_AD_User_ID, Integer.valueOf(AD_User_ID));
}
/** Get User/Contact.
@return User within the system - Internal or Business Partner Contact
*/
public int getAD_User_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_AD_Window getAD_Window() throws RuntimeException
{
return (I_AD_Window)MTable.get(getCtx(), I_AD_Window.Table_Name)
.getPO(getAD_Window_ID(), get_TrxName()); }
/** Set Window.
@param AD_Window_ID
Data entry or display window
*/
public void setAD_Window_ID (int AD_Window_ID)
{
if (AD_Window_ID < 1)
set_Value (COLUMNNAME_AD_Window_ID, null);
else
set_Value (COLUMNNAME_AD_Window_ID, Integer.valueOf(AD_Window_ID));
} | /** Get Window.
@return Data entry or display window
*/
public int getAD_Window_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Window_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Attribute.
@param Attribute Attribute */
public void setAttribute (String Attribute)
{
set_Value (COLUMNNAME_Attribute, Attribute);
}
/** Get Attribute.
@return Attribute */
public String getAttribute ()
{
return (String)get_Value(COLUMNNAME_Attribute);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getAttribute());
}
/** Set Search Key.
@param Value
Search key for the record in the format required - must be unique
*/
public void setValue (String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
/** Get Search Key.
@return Search key for the record in the format required - must be unique
*/
public String getValue ()
{
return (String)get_Value(COLUMNNAME_Value);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Preference.java | 1 |
请完成以下Java代码 | void environmentPrepared(ConfigurableBootstrapContext bootstrapContext, ConfigurableEnvironment environment) {
doWithListeners("spring.boot.application.environment-prepared",
(listener) -> listener.environmentPrepared(bootstrapContext, environment));
}
void contextPrepared(ConfigurableApplicationContext context) {
doWithListeners("spring.boot.application.context-prepared", (listener) -> listener.contextPrepared(context));
}
void contextLoaded(ConfigurableApplicationContext context) {
doWithListeners("spring.boot.application.context-loaded", (listener) -> listener.contextLoaded(context));
}
void started(ConfigurableApplicationContext context, Duration timeTaken) {
doWithListeners("spring.boot.application.started", (listener) -> listener.started(context, timeTaken));
}
void ready(ConfigurableApplicationContext context, Duration timeTaken) {
doWithListeners("spring.boot.application.ready", (listener) -> listener.ready(context, timeTaken));
}
void failed(@Nullable ConfigurableApplicationContext context, Throwable exception) {
doWithListeners("spring.boot.application.failed",
(listener) -> callFailedListener(listener, context, exception), (step) -> {
step.tag("exception", exception.getClass().toString());
String message = exception.getMessage();
if (message != null) {
step.tag("message", message);
}
});
}
private void callFailedListener(SpringApplicationRunListener listener,
@Nullable ConfigurableApplicationContext context, Throwable exception) {
try {
listener.failed(context, exception);
}
catch (Throwable ex) {
if (exception == null) {
ReflectionUtils.rethrowRuntimeException(ex);
} | if (this.log.isDebugEnabled()) {
this.log.error("Error handling failed", ex);
}
else {
String message = ex.getMessage();
message = (message != null) ? message : "no error message";
this.log.warn("Error handling failed (" + message + ")");
}
}
}
private void doWithListeners(String stepName, Consumer<SpringApplicationRunListener> listenerAction) {
doWithListeners(stepName, listenerAction, null);
}
private void doWithListeners(String stepName, Consumer<SpringApplicationRunListener> listenerAction,
@Nullable Consumer<StartupStep> stepAction) {
StartupStep step = this.applicationStartup.start(stepName);
this.listeners.forEach(listenerAction);
if (stepAction != null) {
stepAction.accept(step);
}
step.end();
}
} | repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\SpringApplicationRunListeners.java | 1 |
请完成以下Java代码 | 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 |
请在Spring Boot框架中完成以下Java代码 | public String getPropagatedStageInstanceId() {
return propagatedStageInstanceId;
}
public void setPropagatedStageInstanceId(String propagatedStageInstanceId) {
this.propagatedStageInstanceId = propagatedStageInstanceId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public String getTenantId() {
return tenantId;
}
public void setTenantIdLike(String tenantIdLike) {
this.tenantIdLike = tenantIdLike;
}
public String getTenantIdLike() {
return tenantIdLike;
}
public void setWithoutTenantId(Boolean withoutTenantId) {
this.withoutTenantId = withoutTenantId;
}
public Boolean getWithoutTenantId() {
return withoutTenantId;
}
public String getCandidateOrAssigned() {
return candidateOrAssigned;
}
public void setCandidateOrAssigned(String candidateOrAssigned) {
this.candidateOrAssigned = candidateOrAssigned;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public List<String> getCategoryIn() {
return categoryIn;
}
public void setCategoryIn(List<String> categoryIn) {
this.categoryIn = categoryIn;
}
public List<String> getCategoryNotIn() {
return categoryNotIn;
}
public void setCategoryNotIn(List<String> categoryNotIn) { | this.categoryNotIn = categoryNotIn;
}
public Boolean getWithoutCategory() {
return withoutCategory;
}
public void setWithoutCategory(Boolean withoutCategory) {
this.withoutCategory = withoutCategory;
}
public String getRootScopeId() {
return rootScopeId;
}
public void setRootScopeId(String rootScopeId) {
this.rootScopeId = rootScopeId;
}
public String getParentScopeId() {
return parentScopeId;
}
public void setParentScopeId(String parentScopeId) {
this.parentScopeId = parentScopeId;
}
public Set<String> getScopeIds() {
return scopeIds;
}
public void setScopeIds(Set<String> scopeIds) {
this.scopeIds = scopeIds;
}
} | repos\flowable-engine-main\modules\flowable-rest\src\main\java\org\flowable\rest\service\api\runtime\task\TaskQueryRequest.java | 2 |
请完成以下Java代码 | public static class Builder {
private String id;
private String type;
private String name;
private String homeTown;
public static Builder newInstance() {
return new Builder();
}
public Person build() {
return new Person(this);
}
public Builder id(String id) {
this.id = id;
return this;
} | public Builder type(String type) {
this.type = type;
return this;
}
public Builder name(String name) {
this.name = name;
return this;
}
public Builder homeTown(String homeTown) {
this.homeTown = homeTown;
return this;
}
}
} | repos\tutorials-master\persistence-modules\couchbase\src\main\java\com\baeldung\couchbase\async\person\Person.java | 1 |
请完成以下Java代码 | public org.compiere.model.I_C_Location getC_Location()
{
return get_ValueAsPO(COLUMNNAME_C_Location_ID, org.compiere.model.I_C_Location.class);
}
@Override
public void setC_Location(final org.compiere.model.I_C_Location C_Location)
{
set_ValueFromPO(COLUMNNAME_C_Location_ID, org.compiere.model.I_C_Location.class, C_Location);
}
@Override
public void setC_Location_ID (final int C_Location_ID)
{
if (C_Location_ID < 1)
set_Value (COLUMNNAME_C_Location_ID, null);
else
set_Value (COLUMNNAME_C_Location_ID, C_Location_ID);
}
@Override
public int getC_Location_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Location_ID);
}
@Override
public void setDescription (final @Nullable java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
@Override
public java.lang.String getDescription()
{
return get_ValueAsString(COLUMNNAME_Description);
}
@Override
public void setESR_PostBank (final boolean ESR_PostBank)
{
set_Value (COLUMNNAME_ESR_PostBank, ESR_PostBank);
}
@Override
public boolean isESR_PostBank()
{
return get_ValueAsBoolean(COLUMNNAME_ESR_PostBank);
}
@Override
public void setIsCashBank (final boolean IsCashBank)
{
set_Value (COLUMNNAME_IsCashBank, IsCashBank);
}
@Override
public boolean isCashBank()
{
return get_ValueAsBoolean(COLUMNNAME_IsCashBank);
}
@Override
public void setIsImportAsSingleSummaryLine (final boolean IsImportAsSingleSummaryLine)
{
set_Value (COLUMNNAME_IsImportAsSingleSummaryLine, IsImportAsSingleSummaryLine);
} | @Override
public boolean isImportAsSingleSummaryLine()
{
return get_ValueAsBoolean(COLUMNNAME_IsImportAsSingleSummaryLine);
}
@Override
public void setIsOwnBank (final boolean IsOwnBank)
{
set_Value (COLUMNNAME_IsOwnBank, IsOwnBank);
}
@Override
public boolean isOwnBank()
{
return get_ValueAsBoolean(COLUMNNAME_IsOwnBank);
}
@Override
public void setName (final java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
@Override
public void setRoutingNo (final java.lang.String RoutingNo)
{
set_Value (COLUMNNAME_RoutingNo, RoutingNo);
}
@Override
public java.lang.String getRoutingNo()
{
return get_ValueAsString(COLUMNNAME_RoutingNo);
}
@Override
public void setSwiftCode (final @Nullable java.lang.String SwiftCode)
{
set_Value (COLUMNNAME_SwiftCode, SwiftCode);
}
@Override
public java.lang.String getSwiftCode()
{
return get_ValueAsString(COLUMNNAME_SwiftCode);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Bank.java | 1 |
请完成以下Java代码 | public int getSubKeyLayout_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SubKeyLayout_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Text.
@param Text Text */
public void setText (String Text)
{
set_Value (COLUMNNAME_Text, Text);
}
/** Get Text.
@return Text */
public String getText ()
{
return (String)get_Value(COLUMNNAME_Text);
}
@Override
public I_AD_Reference getAD_Reference() throws RuntimeException
{
return (I_AD_Reference)MTable.get(getCtx(), I_AD_Reference.Table_Name)
.getPO(getAD_Reference_ID(), get_TrxName()); | }
@Override
public int getAD_Reference_ID()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Reference_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public void setAD_Reference_ID(int AD_Reference_ID)
{
if (AD_Reference_ID < 1)
set_Value (COLUMNNAME_AD_Reference_ID, null);
else
set_Value (COLUMNNAME_AD_Reference_ID, Integer.valueOf(AD_Reference_ID));
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_POSKey.java | 1 |
请完成以下Java代码 | public static SubscriptionProgressQueryBuilder startingWith(@NonNull final I_C_SubscriptionProgress subscriptionProgress)
{
final I_C_Flatrate_Term term = subscriptionProgress.getC_Flatrate_Term();
return term(term).seqNoNotLessThan(subscriptionProgress.getSeqNo());
}
public static SubscriptionProgressQueryBuilder endingRightBefore(@NonNull final I_C_SubscriptionProgress subscriptionProgress)
{
final I_C_Flatrate_Term term = subscriptionProgress.getC_Flatrate_Term();
return term(term).seqNoLessThan(subscriptionProgress.getSeqNo());
}
public static SubscriptionProgressQueryBuilder term(@NonNull final I_C_Flatrate_Term term)
{
return builder().term(term);
}
@NonNull
I_C_Flatrate_Term term;
Timestamp eventDateNotBefore;
Timestamp eventDateNotAfter;
@Default
int seqNoNotLessThan = 0;
@Default
int seqNoLessThan = 0;
/** never {@code null}. Empty means "don't filter by status altogether". */
@Singular
List<String> excludedStatuses;
/** never {@code null}. Empty means "don't filter by status altogether". */
@Singular
List<String> includedStatuses;
/** never {@code null}. Empty means "don't filter by status altogether". */
@Singular
List<String> includedContractStatuses;
}
/**
* Loads all {@link I_C_SubscriptionProgress} records that have event type
* {@link X_C_SubscriptionProgress#EVENTTYPE_Lieferung} and status {@link X_C_SubscriptionProgress#STATUS_Geplant} | * or {@link X_C_SubscriptionProgress#STATUS_Verzoegert}, ordered by
* {@link I_C_SubscriptionProgress#COLUMNNAME_EventDate} and {@link I_C_SubscriptionProgress#COLUMNNAME_SeqNo}.
*
* @param date
* the records' event date is before or equal.
* @param trxName
* @return
*/
List<I_C_SubscriptionProgress> retrievePlannedAndDelayedDeliveries(Properties ctx, Timestamp date, String trxName);
/**
*
* @param ol
* @return {@code true} if there is at lease one term that references the given <code>ol</code> via its <code>C_OrderLine_Term_ID</code> column.
*/
boolean existsTermForOl(I_C_OrderLine ol);
/**
* Retrieves the terms that are connection to the given <code>olCand</code> via an active
* <code>C_Contract_Term_Alloc</code> record.
*
* @param olCand
* @return
*/
List<I_C_Flatrate_Term> retrieveTermsForOLCand(I_C_OLCand olCand);
/**
* Insert a new {@link I_C_SubscriptionProgress} after the given predecessor. All values from the predecessor are
* copied to the new one, only <code>SeqNo</code> is set to the predecessor's <code>SeqNo+1</code>. The
* <code>SeqNo</code>s of all existing {@link I_C_SubscriptionProgress} s that are already after
* <code>predecessor</code> are increased by one.
*
* @param predecessor
* @param trxName
* @return
*/
I_C_SubscriptionProgress insertNewDelivery(I_C_SubscriptionProgress predecessor);
<T extends I_C_OLCand> List<T> retrieveOLCands(I_C_Flatrate_Term term, Class<T> clazz);
} | repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\subscription\ISubscriptionDAO.java | 1 |
请完成以下Java代码 | public int getPA_Measure_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_PA_Measure_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Relative Weight.
@param RelativeWeight
Relative weight of this step (0 = ignored)
*/
public void setRelativeWeight (BigDecimal RelativeWeight)
{
set_Value (COLUMNNAME_RelativeWeight, RelativeWeight);
}
/** Get Relative Weight.
@return Relative weight of this step (0 = ignored)
*/
public BigDecimal getRelativeWeight ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_RelativeWeight);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Sequence.
@param SeqNo | Method of ordering records; lowest number comes first
*/
public void setSeqNo (int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo));
}
/** Get Sequence.
@return Method of ordering records; lowest number comes first
*/
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.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_PA_Goal.java | 1 |
请在Spring Boot框架中完成以下Java代码 | private ProductAvailableStock getByProductId(final ProductId productId)
{
return CollectionUtils.getOrLoad(map, productId, this::loadByProductIds);
}
public void warmUpByProductIds(final Set<ProductId> productIds)
{
CollectionUtils.getAllOrLoad(map, productIds, this::loadByProductIds);
}
private Map<ProductId, ProductAvailableStock> loadByProductIds(final Set<ProductId> productIds)
{
final HashMap<ProductId, ProductAvailableStock> result = new HashMap<>();
productIds.forEach(productId -> result.put(productId, new ProductAvailableStock()));
streamHUProductStorages(productIds)
.forEach(huStorageProduct -> result.get(huStorageProduct.getProductId()).addQtyOnHand(huStorageProduct.getQty()));
return result;
} | private Stream<IHUProductStorage> streamHUProductStorages(final Set<ProductId> productIds)
{
final List<I_M_HU> hus = handlingUnitsBL.createHUQueryBuilder()
.onlyContextClient(false) // fails when running from non-context threads like websockets value producers
.addOnlyWithProductIds(productIds)
.addOnlyInLocatorIds(pickFromLocatorIds)
.setOnlyActiveHUs(true)
.list();
final IHUStorageFactory storageFactory = handlingUnitsBL.getStorageFactory();
return storageFactory.streamHUProductStorages(hus);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\job\service\external\hu\ProductAvailableStocks.java | 2 |
请完成以下Java代码 | public class DefaultElementTransformHandlerRegistry implements DmnElementTransformHandlerRegistry {
protected final Map<Class<? extends DmnModelElementInstance>, DmnElementTransformHandler> handlers = getDefaultElementTransformHandlers();
protected static Map<Class<? extends DmnModelElementInstance>, DmnElementTransformHandler> getDefaultElementTransformHandlers() {
Map<Class<? extends DmnModelElementInstance>, DmnElementTransformHandler> handlers = new HashMap<>();
handlers.put(Definitions.class, new DmnDecisionRequirementsGraphTransformHandler());
handlers.put(Decision.class, new DmnDecisionTransformHandler());
handlers.put(DecisionTable.class, new DmnDecisionTableTransformHandler());
handlers.put(Input.class, new DmnDecisionTableInputTransformHandler());
handlers.put(InputExpression.class, new DmnDecisionTableInputExpressionTransformHandler());
handlers.put(Output.class, new DmnDecisionTableOutputTransformHandler());
handlers.put(Rule.class, new DmnDecisionTableRuleTransformHandler());
handlers.put(InputEntry.class, new DmnDecisionTableConditionTransformHandler());
handlers.put(OutputEntry.class, new DmnLiternalExpressionTransformHandler());
handlers.put(LiteralExpression.class, new DmnLiternalExpressionTransformHandler()); | handlers.put(Variable.class, new DmnVariableTransformHandler());
return handlers;
}
public <Source extends DmnModelElementInstance, Target> void addHandler(Class<Source> sourceClass, DmnElementTransformHandler<Source, Target> handler) {
handlers.put(sourceClass, handler);
}
@SuppressWarnings("unchecked")
public <Source extends DmnModelElementInstance, Target> DmnElementTransformHandler<Source, Target> getHandler(Class<Source> sourceClass) {
return handlers.get(sourceClass);
}
} | repos\camunda-bpm-platform-master\engine-dmn\engine\src\main\java\org\camunda\bpm\dmn\engine\impl\transform\DefaultElementTransformHandlerRegistry.java | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.