instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请完成以下Java代码
|
public ChangeActivityStateBuilder enableEventSubProcessStartEvent(String eventSubProcessStartEventId) {
EnableActivityIdContainer enableActivityIdContainer = new EnableActivityIdContainer(eventSubProcessStartEventId);
enableActivityIdList.add(enableActivityIdContainer);
return this;
}
@Override
public ChangeActivityStateBuilder processVariable(String processVariableName, Object processVariableValue) {
if (this.processVariables == null) {
this.processVariables = new HashMap<>();
}
this.processVariables.put(processVariableName, processVariableValue);
return this;
}
@Override
public ChangeActivityStateBuilder processVariables(Map<String, Object> processVariables) {
this.processVariables = processVariables;
return this;
}
@Override
public ChangeActivityStateBuilder localVariable(String startActivityId, String localVariableName, Object localVariableValue) {
if (this.localVariables == null) {
this.localVariables = new HashMap<>();
}
Map<String, Object> localVariableMap = null;
if (localVariables.containsKey(startActivityId)) {
localVariableMap = localVariables.get(startActivityId);
} else {
localVariableMap = new HashMap<>();
}
localVariableMap.put(localVariableName, localVariableValue);
this.localVariables.put(startActivityId, localVariableMap);
return this;
}
@Override
public ChangeActivityStateBuilder localVariables(String startActivityId, Map<String, Object> localVariables) {
if (this.localVariables == null) {
this.localVariables = new HashMap<>();
}
|
this.localVariables.put(startActivityId, localVariables);
return this;
}
@Override
public void changeState() {
if (runtimeService == null) {
throw new FlowableException("RuntimeService cannot be null, Obtain your builder instance from the RuntimeService to access this feature");
}
runtimeService.changeActivityState(this);
}
public String getProcessInstanceId() {
return processInstanceId;
}
public List<MoveExecutionIdContainer> getMoveExecutionIdList() {
return moveExecutionIdList;
}
public List<MoveActivityIdContainer> getMoveActivityIdList() {
return moveActivityIdList;
}
public List<EnableActivityIdContainer> getEnableActivityIdList() {
return enableActivityIdList;
}
public Map<String, Object> getProcessInstanceVariables() {
return processVariables;
}
public Map<String, Map<String, Object>> getLocalVariables() {
return localVariables;
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\runtime\ChangeActivityStateBuilderImpl.java
| 1
|
请完成以下Java代码
|
public boolean isPrimitiveValueType() {
return false;
}
public Map<String, Object> getValueInfo(TypedValue typedValue) {
if(!(typedValue instanceof SpinValue)) {
throw new IllegalArgumentException("Value not of type Spin Value.");
}
SpinValue spinValue = (SpinValue) typedValue;
Map<String, Object> valueInfo = new HashMap<String, Object>();
if (spinValue.isTransient()) {
valueInfo.put(VALUE_INFO_TRANSIENT, spinValue.isTransient());
}
|
return valueInfo;
}
protected void applyValueInfo(SpinValueBuilder<?> builder, Map<String, Object> valueInfo) {
if(valueInfo != null) {
builder.setTransient(isTransient(valueInfo));
}
}
protected abstract SpinValueBuilder<?> createValue(SpinValue value);
protected abstract SpinValueBuilder<?> createValueFromSerialized(String value);
}
|
repos\camunda-bpm-platform-master\engine-plugins\spin-plugin\src\main\java\org\camunda\spin\plugin\variable\type\impl\SpinValueTypeImpl.java
| 1
|
请完成以下Java代码
|
private int retrieveReceiptDocTypeId(final org.compiere.model.I_C_OrderLine orderLine)
{
final IDocTypeDAO docTypeDAO = Services.get(IDocTypeDAO.class);
final I_C_Order order = orderLine.getC_Order();
//
// Get Document Type from order
DocTypeId docTypeId = DocTypeId.ofRepoIdOrNull(order.getC_DocType_ID());
if (docTypeId == null)
{
docTypeId = DocTypeId.ofRepoIdOrNull(order.getC_DocTypeTarget_ID());
}
//
// If document type is set, get it's C_DocTypeShipment_ID (if any)
if (docTypeId != null)
{
final I_C_DocType docType = docTypeDAO.getById(docTypeId);
final int receiptDocTypeId = docType.getC_DocTypeShipment_ID();
if (receiptDocTypeId > 0)
{
return receiptDocTypeId;
}
}
//
// Fallback: get standard Material Receipt document type
final DocTypeQuery query = DocTypeQuery.builder()
.docBaseType(X_C_DocType.DOCBASETYPE_MaterialReceipt)
.docSubType(DocTypeQuery.DOCSUBTYPE_Any)
.adClientId(orderLine.getAD_Client_ID())
.adOrgId(orderLine.getAD_Org_ID())
.build();
return DocTypeId.toRepoId(docTypeDAO.getDocTypeIdOrNull(query));
}
/**
* Wraps {@link I_C_OrderLine} as {@link IReceiptScheduleWarehouseDestProvider.IContext}
*/
private static final class OrderLineWarehouseDestProviderContext implements IReceiptScheduleWarehouseDestProvider.IContext
{
public static OrderLineWarehouseDestProviderContext of(final Properties ctx, final org.compiere.model.I_C_OrderLine orderLine)
{
return new OrderLineWarehouseDestProviderContext(ctx, orderLine);
}
private final Properties ctx;
private final org.compiere.model.I_C_OrderLine orderLine;
private OrderLineWarehouseDestProviderContext(final Properties ctx, final org.compiere.model.I_C_OrderLine orderLine)
{
super();
this.ctx = ctx;
this.orderLine = orderLine;
}
@Override
public String toString()
{
return MoreObjects.toStringHelper(this).addValue(orderLine).toString();
}
@Override
public Properties getCtx()
{
return ctx;
|
}
@Override
public int getAD_Client_ID()
{
return orderLine.getAD_Client_ID();
}
@Override
public int getAD_Org_ID()
{
return orderLine.getAD_Org_ID();
}
@Override
public int getM_Product_ID()
{
return orderLine.getM_Product_ID();
}
@Override
public int getM_Warehouse_ID()
{
return orderLine.getM_Warehouse_ID();
}
@Override
public I_M_AttributeSetInstance getM_AttributeSetInstance()
{
return orderLine.getM_AttributeSetInstance();
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\inoutcandidate\spi\impl\OrderLineReceiptScheduleProducer.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public boolean wasProcessed(String className) {
return this.properties.containsKey(className);
}
@Override
public @Nullable Integer getInteger(String className, String key) {
return getInteger(className, key, null);
}
@Override
public @Nullable Integer getInteger(String className, String key, @Nullable Integer defaultValue) {
String value = get(className, key);
return (value != null) ? Integer.valueOf(value) : defaultValue;
}
@Override
public @Nullable Set<String> getSet(String className, String key) {
return getSet(className, key, null);
}
@Override
public @Nullable Set<String> getSet(String className, String key, @Nullable Set<String> defaultValue) {
|
String value = get(className, key);
return (value != null) ? StringUtils.commaDelimitedListToSet(value) : defaultValue;
}
@Override
public @Nullable String get(String className, String key) {
return get(className, key, null);
}
@Override
public @Nullable String get(String className, String key, @Nullable String defaultValue) {
String value = this.properties.getProperty(className + "." + key);
return (value != null) ? value : defaultValue;
}
}
}
|
repos\spring-boot-4.0.1\core\spring-boot-autoconfigure\src\main\java\org\springframework\boot\autoconfigure\AutoConfigurationMetadataLoader.java
| 2
|
请完成以下Java代码
|
public static List<Term> parse(String text)
{
return new NShortSegment().seg(text);
}
/**
* 开启词性标注
* @param enable
* @return
*/
public NShortSegment enablePartOfSpeechTagging(boolean enable)
{
config.speechTagging = enable;
return this;
}
/**
* 开启地名识别
* @param enable
* @return
*/
public NShortSegment enablePlaceRecognize(boolean enable)
{
config.placeRecognize = enable;
config.updateNerConfig();
return this;
}
/**
* 开启机构名识别
* @param enable
* @return
*/
public NShortSegment enableOrganizationRecognize(boolean enable)
{
config.organizationRecognize = enable;
config.updateNerConfig();
return this;
}
/**
* 是否启用音译人名识别
*
* @param enable
*/
public NShortSegment enableTranslatedNameRecognize(boolean enable)
{
config.translatedNameRecognize = enable;
config.updateNerConfig();
|
return this;
}
/**
* 是否启用日本人名识别
*
* @param enable
*/
public NShortSegment enableJapaneseNameRecognize(boolean enable)
{
config.japaneseNameRecognize = enable;
config.updateNerConfig();
return this;
}
/**
* 是否启用偏移量计算(开启后Term.offset才会被计算)
* @param enable
* @return
*/
public NShortSegment enableOffset(boolean enable)
{
config.offset = enable;
return this;
}
public NShortSegment enableAllNamedEntityRecognize(boolean enable)
{
config.nameRecognize = enable;
config.japaneseNameRecognize = enable;
config.translatedNameRecognize = enable;
config.placeRecognize = enable;
config.organizationRecognize = enable;
config.updateNerConfig();
return this;
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\seg\NShort\NShortSegment.java
| 1
|
请完成以下Java代码
|
public List<GroupDto> queryGroups(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
GroupQueryDto queryDto = new GroupQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
return queryGroups(queryDto, firstResult, maxResults);
}
@Override
public List<GroupDto> queryGroups(GroupQueryDto queryDto, Integer firstResult, Integer maxResults) {
queryDto.setObjectMapper(getObjectMapper());
GroupQuery query = queryDto.toQuery(getProcessEngine());
List<Group> resultList = QueryUtil.list(query, firstResult, maxResults);
return GroupDto.fromGroupList(resultList);
}
@Override
public CountResultDto getGroupCount(UriInfo uriInfo) {
GroupQueryDto queryDto = new GroupQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
return queryGroupCount(queryDto);
}
@Override
public CountResultDto queryGroupCount(GroupQueryDto queryDto) {
GroupQuery query = queryDto.toQuery(getProcessEngine());
long count = query.count();
return new CountResultDto(count);
}
@Override
public void createGroup(GroupDto groupDto) {
final IdentityService identityService = getIdentityService();
if(identityService.isReadOnly()) {
throw new InvalidRequestException(Status.FORBIDDEN, "Identity service implementation is read-only.");
}
Group newGroup = identityService.newGroup(groupDto.getId());
groupDto.update(newGroup);
identityService.saveGroup(newGroup);
}
@Override
public ResourceOptionsDto availableOperations(UriInfo context) {
final IdentityService identityService = getIdentityService();
UriBuilder baseUriBuilder = context.getBaseUriBuilder()
.path(relativeRootResourcePath)
.path(GroupRestService.PATH);
ResourceOptionsDto resourceOptionsDto = new ResourceOptionsDto();
|
// GET /
URI baseUri = baseUriBuilder.build();
resourceOptionsDto.addReflexiveLink(baseUri, HttpMethod.GET, "list");
// GET /count
URI countUri = baseUriBuilder.clone().path("/count").build();
resourceOptionsDto.addReflexiveLink(countUri, HttpMethod.GET, "count");
// POST /create
if(!identityService.isReadOnly() && isAuthorized(CREATE)) {
URI createUri = baseUriBuilder.clone().path("/create").build();
resourceOptionsDto.addReflexiveLink(createUri, HttpMethod.POST, "create");
}
return resourceOptionsDto;
}
// utility methods //////////////////////////////////////
protected IdentityService getIdentityService() {
return getProcessEngine().getIdentityService();
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\impl\GroupRestServiceImpl.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);
}
/** EntityType AD_Reference_ID=389 */
public static final int ENTITYTYPE_AD_Reference_ID=389;
/** Set Entity Type.
@param EntityType
Dictionary Entity Type; Determines ownership and synchronization
*/
public void setEntityType (String EntityType)
{
set_Value (COLUMNNAME_EntityType, EntityType);
}
/** Get Entity Type.
@return Dictionary Entity Type; Determines ownership and synchronization
*/
public String getEntityType ()
{
return (String)get_Value(COLUMNNAME_EntityType);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
|
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Sql ORDER BY.
@param OrderByClause
Fully qualified ORDER BY clause
*/
public void setOrderByClause (String OrderByClause)
{
set_Value (COLUMNNAME_OrderByClause, OrderByClause);
}
/** Get Sql ORDER BY.
@return Fully qualified ORDER BY clause
*/
public String getOrderByClause ()
{
return (String)get_Value(COLUMNNAME_OrderByClause);
}
/** Set Sql WHERE.
@param WhereClause
Fully qualified SQL WHERE clause
*/
public void setWhereClause (String WhereClause)
{
set_Value (COLUMNNAME_WhereClause, WhereClause);
}
/** Get Sql WHERE.
@return Fully qualified SQL WHERE clause
*/
public String getWhereClause ()
{
return (String)get_Value(COLUMNNAME_WhereClause);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_ReportView.java
| 1
|
请完成以下Java代码
|
public void setC_BPartner_Location_ID (int C_BPartner_Location_ID)
{
if (C_BPartner_Location_ID < 1)
set_Value (COLUMNNAME_C_BPartner_Location_ID, null);
else
set_Value (COLUMNNAME_C_BPartner_Location_ID, Integer.valueOf(C_BPartner_Location_ID));
}
/** Get Standort.
@return Identifiziert die (Liefer-) Adresse des Geschäftspartners
*/
public int getC_BPartner_Location_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_BPartner_Location_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Geschlossen.
@param IsClosed
The status is closed
*/
public void setIsClosed (boolean IsClosed)
{
set_Value (COLUMNNAME_IsClosed, Boolean.valueOf(IsClosed));
}
/** Get Geschlossen.
@return The status is closed
*/
public boolean isClosed ()
{
Object oo = get_Value(COLUMNNAME_IsClosed);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
public org.compiere.model.I_M_Package getM_Package() throws RuntimeException
{
return (org.compiere.model.I_M_Package)MTable.get(getCtx(), org.compiere.model.I_M_Package.Table_Name)
.getPO(getM_Package_ID(), get_TrxName()); }
/** Set PackstĂĽck.
|
@param M_Package_ID
Shipment Package
*/
public void setM_Package_ID (int M_Package_ID)
{
if (M_Package_ID < 1)
set_Value (COLUMNNAME_M_Package_ID, null);
else
set_Value (COLUMNNAME_M_Package_ID, Integer.valueOf(M_Package_ID));
}
/** Get PackstĂĽck.
@return Shipment Package
*/
public int getM_Package_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Package_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Virtual Package.
@param M_PackageTree_ID Virtual Package */
public void setM_PackageTree_ID (int M_PackageTree_ID)
{
if (M_PackageTree_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_PackageTree_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_PackageTree_ID, Integer.valueOf(M_PackageTree_ID));
}
/** Get Virtual Package.
@return Virtual Package */
public int getM_PackageTree_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_PackageTree_ID);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\org\compiere\model\X_M_PackageTree.java
| 1
|
请完成以下Java代码
|
public class SetJobRetriesCmd implements Command<Void>, Serializable {
private static final long serialVersionUID = 1L;
private final String jobId;
private final int retries;
public SetJobRetriesCmd(String jobId, int retries) {
if (jobId == null || jobId.length() < 1) {
throw new ActivitiIllegalArgumentException(
"The job id is mandatory, but '" + jobId + "' has been provided."
);
}
if (retries < 0) {
throw new ActivitiIllegalArgumentException(
"The number of job retries must be a non-negative Integer, but '" + retries + "' has been provided."
);
}
this.jobId = jobId;
|
this.retries = retries;
}
public Void execute(CommandContext commandContext) {
JobEntity job = commandContext.getJobEntityManager().findById(jobId);
if (job != null) {
job.setRetries(retries);
if (commandContext.getEventDispatcher().isEnabled()) {
commandContext
.getEventDispatcher()
.dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_UPDATED, job));
}
} else {
throw new ActivitiObjectNotFoundException("No job found with id '" + jobId + "'.", Job.class);
}
return null;
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\cmd\SetJobRetriesCmd.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class DataConfig extends AbstractJdbcConfiguration {
@Override
protected List<?> userConverters() {
return List.of(new OffsetDateTimeToInstantConverter());
}
@Override
@Bean
public JdbcDialect jdbcDialect(NamedParameterJdbcOperations operations) {
return new JdbcH2Dialect() {
@Override
public IdentifierProcessing getIdentifierProcessing() {
return IdentifierProcessing.create(IdentifierProcessing.Quoting.ANSI,
IdentifierProcessing.LetterCasing.AS_IS);
}
|
};
}
// an additional converter required by h2 to work properly in native image
// org.springframework.data.convert.Jsr310Converters
@ReadingConverter
static class OffsetDateTimeToInstantConverter implements Converter<OffsetDateTime, Instant> {
@Override
public Instant convert(OffsetDateTime source) {
return source.toInstant();
}
}
}
|
repos\realworld-backend-spring-master\service\src\main\java\com\github\al\realworld\infrastructure\config\DataConfig.java
| 2
|
请完成以下Java代码
|
public void setAD_Window_Access_ID (int AD_Window_Access_ID)
{
if (AD_Window_Access_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_Window_Access_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_Window_Access_ID, Integer.valueOf(AD_Window_Access_ID));
}
/** Get AD_Window_Access.
@return AD_Window_Access */
@Override
public int getAD_Window_Access_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Window_Access_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public org.compiere.model.I_AD_Window getAD_Window() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_AD_Window_ID, org.compiere.model.I_AD_Window.class);
}
@Override
public void setAD_Window(org.compiere.model.I_AD_Window AD_Window)
{
set_ValueFromPO(COLUMNNAME_AD_Window_ID, org.compiere.model.I_AD_Window.class, AD_Window);
}
/** Set Fenster.
@param AD_Window_ID
Data entry or display window
*/
@Override
public void setAD_Window_ID (int AD_Window_ID)
{
if (AD_Window_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_Window_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_Window_ID, Integer.valueOf(AD_Window_ID));
|
}
/** Get Fenster.
@return Data entry or display window
*/
@Override
public int getAD_Window_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Window_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Lesen und Schreiben.
@param IsReadWrite
Field is read / write
*/
@Override
public void setIsReadWrite (boolean IsReadWrite)
{
set_Value (COLUMNNAME_IsReadWrite, Boolean.valueOf(IsReadWrite));
}
/** Get Lesen und Schreiben.
@return Field is read / write
*/
@Override
public boolean isReadWrite ()
{
Object oo = get_Value(COLUMNNAME_IsReadWrite);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Window_Access.java
| 1
|
请完成以下Java代码
|
public String getId() {
return id;
}
public String getName() {
return name;
}
public String getNameLike() {
return nameLike;
}
public Integer getVersion() {
return version;
}
public String getCategory() {
return category;
}
public String getCategoryLike() {
return categoryLike;
}
public String getCategoryNotEquals() {
return categoryNotEquals;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public String getKey() {
return key;
}
public boolean isLatest() {
|
return latest;
}
public String getDeploymentId() {
return deploymentId;
}
public boolean isNotDeployed() {
return notDeployed;
}
public boolean isDeployed() {
return deployed;
}
public String getTenantId() {
return tenantId;
}
public String getTenantIdLike() {
return tenantIdLike;
}
public boolean isWithoutTenantId() {
return withoutTenantId;
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\ModelQueryImpl.java
| 1
|
请完成以下Java代码
|
public void run() {
CompletableFuture[] anyOfFutures = new CompletableFuture[futureOperations.size()];
for (int i = 0; i < futureOperations.size(); i++) {
anyOfFutures[i] = futureOperations.get(i).getFuture();
}
try {
CompletableFuture<Object> anyOfFuture = CompletableFuture.anyOf(anyOfFutures);
if (timeout == null) {
// This blocks until at least one is future is done
anyOfFuture.get();
} else {
try {
// This blocks until at least one is future is done or the timeout is reached
anyOfFuture.get(timeout.toMillis(), TimeUnit.MILLISECONDS);
} catch (TimeoutException e) {
// When the timeout is reached we need to cancel all the futures that are not done
for (ExecuteFutureActionOperation<?> futureOperation : futureOperations) {
if (!futureOperation.isDone()) {
// If there was a timeout then we need to cancel all the futures that have not completed already
futureOperation.getFuture().cancel(true);
}
}
|
throw new FlowableException("None of the available futures completed within the max timeout of " + timeout, e);
}
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new FlowableException("Future was interrupted", e);
} catch (ExecutionException e) {
// If there was any exception then it will be handled by the appropriate action
}
// Now go through future operation and schedule them for execution if they are done
for (ExecuteFutureActionOperation<?> futureOperation : futureOperations) {
if (futureOperation.isDone()) {
// If it is done then schedule it for execution
agenda.planOperation(futureOperation);
} else {
// Otherwise plan a new future operation
agenda.planFutureOperation((CompletableFuture<Object>) futureOperation.getFuture(),
(BiConsumer<Object, Throwable>) futureOperation.getAction());
}
}
}
}
|
repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\agenda\WaitForAnyFutureToFinishOperation.java
| 1
|
请完成以下Java代码
|
public class LdapHealthIndicator extends AbstractHealthIndicator {
private static final ContextExecutor<String> versionContextExecutor = new VersionContextExecutor();
private final LdapOperations ldapOperations;
public LdapHealthIndicator(LdapOperations ldapOperations) {
super("LDAP health check failed");
Assert.notNull(ldapOperations, "'ldapOperations' must not be null");
this.ldapOperations = ldapOperations;
}
@Override
protected void doHealthCheck(Health.Builder builder) throws Exception {
String version = this.ldapOperations.executeReadOnly(versionContextExecutor);
builder.up().withDetail("version", version);
|
}
private static final class VersionContextExecutor implements ContextExecutor<String> {
@Override
public @Nullable String executeWithContext(DirContext ctx) throws NamingException {
Object version = ctx.getEnvironment().get("java.naming.ldap.version");
if (version != null) {
return (String) version;
}
return null;
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-ldap\src\main\java\org\springframework\boot\ldap\health\LdapHealthIndicator.java
| 1
|
请完成以下Java代码
|
private void createTUPackingInstructions(@NonNull final I_I_Product importRecord)
{
final ProductId productId = ProductId.ofRepoIdOrNull(importRecord.getM_Product_ID());
if (productId == null)
{
return;
}
final String piName = StringUtils.trimBlankToNull(importRecord.getM_HU_PI_Value());
if (piName == null)
{
return;
}
if (BigDecimal.ONE.compareTo(importRecord.getQtyCU()) == 0 )
{
return;
}
handlingUnitsDAO.createTUPackingInstructions(
CreateTUPackingInstructionsRequest.builder()
.name(piName)
.productId(productId)
.bpartnerId(BPartnerId.ofRepoIdOrNull(importRecord.getC_BPartner_ID()))
.qtyCU(extractQtyCU(importRecord))
.isDefault(importRecord.isDefaultPacking())
.build()
);
}
@NonNull
private Quantity extractQtyCU(final I_I_Product importRecord)
{
final UomId uomId = UomId.ofRepoIdOrNull(importRecord.getQtyCU_UOM_ID());
if (uomId == null)
|
{
throw new FillMandatoryException(I_I_Product.COLUMNNAME_QtyCU_UOM_ID);
}
final I_C_UOM uom = uomDAO.getById(uomId);
if (InterfaceWrapperHelper.isNull(importRecord, I_I_Product.COLUMNNAME_QtyCU))
{
return Quantity.infinite(uom);
}
final BigDecimal qtyBD = importRecord.getQtyCU();
if (qtyBD.signum() <= 0)
{
throw new AdempiereException("QtyCU must be > 0");
}
return Quantity.of(qtyBD, uom);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\product\impexp\interceptor\ImportProductInterceptor.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getSignalEventSubscriptionName() {
return signalEventSubscriptionName;
}
public void setSignalEventSubscriptionName(String signalEventSubscriptionName) {
this.signalEventSubscriptionName = signalEventSubscriptionName;
}
public String getMessageEventSubscriptionName() {
return messageEventSubscriptionName;
}
public void setMessageEventSubscriptionName(String messageEventSubscriptionName) {
this.messageEventSubscriptionName = messageEventSubscriptionName;
}
public String getActivityId() {
return activityId;
}
public void setActivityId(String activityId) {
this.activityId = activityId;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getTenantId() {
return tenantId;
}
|
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public String getTenantIdLike() {
return tenantIdLike;
}
public void setTenantIdLike(String tenantIdLike) {
this.tenantIdLike = tenantIdLike;
}
public Boolean getWithoutTenantId() {
return withoutTenantId;
}
public void setWithoutTenantId(Boolean withoutTenantId) {
this.withoutTenantId = withoutTenantId;
}
public Set<String> getProcessInstanceIds() {
return processInstanceIds;
}
public void setProcessInstanceIds(Set<String> processInstanceIds) {
this.processInstanceIds = processInstanceIds;
}
}
|
repos\flowable-engine-main\modules\flowable-rest\src\main\java\org\flowable\rest\service\api\runtime\process\ExecutionQueryRequest.java
| 2
|
请完成以下Java代码
|
public static BigDecimal toBigDecimalOrNull(@Nullable final Quantity quantity)
{
return toBigDecimalOr(quantity, null);
}
@NonNull
public static BigDecimal toBigDecimalOrZero(@Nullable final Quantity quantity)
{
return toBigDecimalOr(quantity, BigDecimal.ZERO);
}
@Contract(value = "null, null -> null; _, !null -> !null; !null, _ -> !null", pure = true)
@Nullable
private static BigDecimal toBigDecimalOr(@Nullable final Quantity quantity, @Nullable final BigDecimal defaultValue)
{
if (quantity == null)
{
return defaultValue;
}
return quantity.toBigDecimal();
}
public static class QuantityDeserializer extends StdDeserializer<Quantity>
{
private static final long serialVersionUID = -5406622853902102217L;
public QuantityDeserializer()
{
super(Quantity.class);
}
@Override
public Quantity deserialize(final JsonParser p, final DeserializationContext ctx) throws IOException
{
final JsonNode node = p.getCodec().readTree(p);
final String qtyStr = node.get("qty").asText();
final int uomRepoId = (Integer)node.get("uomId").numberValue();
final String sourceQtyStr;
final int sourceUomRepoId;
if (node.has("sourceQty"))
{
sourceQtyStr = node.get("sourceQty").asText();
sourceUomRepoId = (Integer)node.get("sourceUomId").numberValue();
}
else
{
sourceQtyStr = qtyStr;
sourceUomRepoId = uomRepoId;
}
return Quantitys.of(
new BigDecimal(qtyStr), UomId.ofRepoId(uomRepoId),
new BigDecimal(sourceQtyStr), UomId.ofRepoId(sourceUomRepoId));
}
}
public static class QuantitySerializer extends StdSerializer<Quantity>
|
{
private static final long serialVersionUID = -8292209848527230256L;
public QuantitySerializer()
{
super(Quantity.class);
}
@Override
public void serialize(final Quantity value, final JsonGenerator gen, final SerializerProvider provider) throws IOException
{
gen.writeStartObject();
final String qtyStr = value.toBigDecimal().toString();
final int uomId = value.getUomId().getRepoId();
gen.writeFieldName("qty");
gen.writeString(qtyStr);
gen.writeFieldName("uomId");
gen.writeNumber(uomId);
final String sourceQtyStr = value.getSourceQty().toString();
final int sourceUomId = value.getSourceUomId().getRepoId();
if (!qtyStr.equals(sourceQtyStr) || uomId != sourceUomId)
{
gen.writeFieldName("sourceQty");
gen.writeString(sourceQtyStr);
gen.writeFieldName("sourceUomId");
gen.writeNumber(sourceUomId);
}
gen.writeEndObject();
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\quantity\Quantitys.java
| 1
|
请完成以下Java代码
|
public void setAD_Table_ID (int AD_Table_ID)
{
if (AD_Table_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_Table_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_Table_ID, Integer.valueOf(AD_Table_ID));
}
/** Get DB-Tabelle.
@return Database Table information
*/
@Override
public int getAD_Table_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Table_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public de.metas.document.refid.model.I_C_ReferenceNo_Type getC_ReferenceNo_Type() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_C_ReferenceNo_Type_ID, de.metas.document.refid.model.I_C_ReferenceNo_Type.class);
}
@Override
public void setC_ReferenceNo_Type(de.metas.document.refid.model.I_C_ReferenceNo_Type C_ReferenceNo_Type)
{
set_ValueFromPO(COLUMNNAME_C_ReferenceNo_Type_ID, de.metas.document.refid.model.I_C_ReferenceNo_Type.class, C_ReferenceNo_Type);
}
/** Set Reference No Type.
@param C_ReferenceNo_Type_ID Reference No Type */
@Override
public void setC_ReferenceNo_Type_ID (int C_ReferenceNo_Type_ID)
{
if (C_ReferenceNo_Type_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_ReferenceNo_Type_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_ReferenceNo_Type_ID, Integer.valueOf(C_ReferenceNo_Type_ID));
}
/** Get Reference No Type.
@return Reference No Type */
@Override
public int getC_ReferenceNo_Type_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_ReferenceNo_Type_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);
}
/**
* 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);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.document.refid\src\main\java-gen\de\metas\document\refid\model\X_C_ReferenceNo_Type_Table.java
| 1
|
请完成以下Java代码
|
public WebuiASIEditingInfo getWebuiASIEditingInfo(@NonNull final AttributeSetInstanceId asiId)
{
final ProductId productId = product.getIdAs(ProductId::ofRepoIdOrNull);
final ASIEditingInfo info = ASIEditingInfo.builder()
.type(WindowType.Regular)
.productId(productId)
.attributeSetInstanceId(asiId)
.callerTableName(null)
.callerColumnId(-1)
.soTrx(SOTrx.SALES)
.build();
return WebuiASIEditingInfo.builder(info).build();
}
Optional<ShipmentScheduleUserChangeRequest> createShipmentScheduleUserChangeRequest()
{
final ShipmentScheduleUserChangeRequestBuilder builder = ShipmentScheduleUserChangeRequest.builder()
.shipmentScheduleId(shipmentScheduleId);
boolean changes = false;
if (qtyToDeliverUserEnteredInitial.compareTo(qtyToDeliverUserEntered) != 0)
{
BigDecimal qtyCUsToDeliver = packingInfo.computeQtyCUsByQtyUserEntered(qtyToDeliverUserEntered);
builder.qtyToDeliverStockOverride(qtyCUsToDeliver);
changes = true;
}
if (qtyToDeliverCatchOverrideIsChanged())
{
builder.qtyToDeliverCatchOverride(qtyToDeliverCatchOverride);
changes = true;
}
final AttributeSetInstanceId asiId = asi.getIdAs(AttributeSetInstanceId::ofRepoIdOrNone);
if (!Objects.equals(asiIdInitial, asiId))
{
builder.asiId(asiId);
changes = true;
}
return changes
? Optional.of(builder.build())
: Optional.empty();
}
private boolean qtyToDeliverCatchOverrideIsChanged()
{
final Optional<Boolean> nullValuechanged = isNullValuesChanged(qtyToDeliverCatchOverrideInitial, qtyToDeliverCatchOverride);
return nullValuechanged.orElseGet(() -> qtyToDeliverCatchOverrideInitial.compareTo(qtyToDeliverCatchOverride) != 0);
|
}
private static Optional<Boolean> isNullValuesChanged(
@Nullable final Object initial,
@Nullable final Object current)
{
final boolean wasNull = initial == null;
final boolean isNull = current == null;
if (wasNull)
{
if (isNull)
{
return Optional.of(false);
}
return Optional.of(true); // was null and is not null anymore
}
if (isNull)
{
return Optional.of(true); // was not null and is now
}
return Optional.empty(); // was not null and still is not null; will need to compare the current values
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\shipment_candidates_editor\ShipmentCandidateRow.java
| 1
|
请完成以下Java代码
|
public void setValueDate (final @Nullable java.sql.Timestamp ValueDate)
{
set_Value (COLUMNNAME_ValueDate, ValueDate);
}
@Override
public java.sql.Timestamp getValueDate()
{
return get_ValueAsTimestamp(COLUMNNAME_ValueDate);
}
@Override
public void setValueNumber (final @Nullable BigDecimal ValueNumber)
{
set_Value (COLUMNNAME_ValueNumber, ValueNumber);
}
@Override
public BigDecimal getValueNumber()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_ValueNumber);
|
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setValueString (final @Nullable java.lang.String ValueString)
{
set_Value (COLUMNNAME_ValueString, ValueString);
}
@Override
public java.lang.String getValueString()
{
return get_ValueAsString(COLUMNNAME_ValueString);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_Record_Attribute.java
| 1
|
请完成以下Java代码
|
public void handleReactivate(final I_C_Order order)
{
final List<I_C_OrderLine> orderLines = orderDAO.retrieveOrderLines(order, I_C_OrderLine.class);
for (final I_C_OrderLine ol : orderLines)
{
if (ol.getC_Flatrate_Conditions_ID() <= 0)
{
logger.debug("Order line " + ol + " has no contract term assigned");
continue;
}
handleOrderLineReactivate(ol);
}
}
/**
* Make sure the orderLine still has processed='Y', even if the order is reactivated. <br>
* This was apparently added in task 03152.<br>
* I can guess that if an order line already has a C_Flatrate_Term, then we don't want that order line to be editable, because it could create inconsistencies with the term.
*/
private void handleOrderLineReactivate(final I_C_OrderLine ol)
{
logger.info("Setting order line's processed status " + ol + " back to Processed='Y'" + " as it references a contract term");
ol.setProcessed(true);
InterfaceWrapperHelper.save(ol);
}
@DocValidate(timings = { ModelValidator.TIMING_AFTER_COMPLETE })
public void updateCustomerRetention(final I_C_Order order)
{
final CustomerRetentionRepository customerRetentionRepo = SpringContextHolder.instance.getBean(CustomerRetentionRepository.class);
|
if (!order.isSOTrx())
{
// nothing to do
return;
}
final OrderId orderId = OrderId.ofRepoId(order.getC_Order_ID());
customerRetentionRepo.updateCustomerRetentionOnOrderComplete(orderId);
}
@ModelChange(timings = {
ModelValidator.TYPE_BEFORE_CHANGE
}, ifColumnsChanged = I_C_Order.COLUMNNAME_DatePromised)
public void updateOrderLineFromContract(final I_C_Order order)
{
orderDAO.retrieveOrderLines(order)
.stream()
.map(ol -> InterfaceWrapperHelper.create(ol, de.metas.contracts.order.model.I_C_OrderLine.class))
.filter(subscriptionBL::isSubscription)
.forEach(orderLineBL::updatePrices);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\interceptor\C_Order.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Map<String, String> getValuesForPrefix(
@NonNull final String prefix,
@NonNull final ClientId adClientId,
@NonNull final OrgId adOrgId)
{
final boolean removePrefix = false;
return getValuesForPrefix(prefix, removePrefix, ClientAndOrgId.ofClientAndOrg(adClientId, adOrgId));
}
@Override
public Map<String, String> getValuesForPrefix(
@NonNull final String prefix,
@NonNull final ClientAndOrgId clientAndOrgId)
{
final boolean removePrefix = false;
return getValuesForPrefix(prefix, removePrefix, clientAndOrgId);
}
@Override
public Map<String, String> getValuesForPrefix(final String prefix, final int adClientId, final int adOrgId)
{
final boolean removePrefix = false;
return getValuesForPrefix(prefix, removePrefix, ClientAndOrgId.ofClientAndOrg(adClientId, adOrgId));
}
@Override
public Map<String, String> getValuesForPrefix(final String prefix, final boolean removePrefix, @NonNull final ClientAndOrgId clientAndOrgId)
{
final Set<String> paramNames = getNamesForPrefix(prefix, clientAndOrgId);
final ImmutableMap.Builder<String, String> result = ImmutableMap.builder();
for (final String paramName : paramNames)
{
final String value = sysConfigDAO.getValue(paramName, clientAndOrgId).orElse(null);
if (value == null)
{
continue;
}
final String name;
if (removePrefix && paramName.startsWith(prefix) && !paramName.equals(prefix))
{
name = paramName.substring(prefix.length());
}
else
{
name = paramName;
}
result.put(name, value);
}
|
return result.build();
}
@Override
@Nullable
@Contract("_, !null, _ -> !null")
public String getValue(@NonNull final String name, @Nullable final String defaultValue, @NonNull final ClientAndOrgId clientAndOrgId)
{
return sysConfigDAO.getValue(name, clientAndOrgId).orElse(defaultValue);
}
@Override
public <T extends ReferenceListAwareEnum> T getReferenceListAware(final String name, final T defaultValue, final Class<T> type)
{
final String code = sysConfigDAO.getValue(name, ClientAndOrgId.SYSTEM).orElse(null);
return code != null && !Check.isBlank(code)
? ReferenceListAwareEnums.ofCode(code, type)
: defaultValue;
}
@Override
public <T extends Enum<T>> ImmutableSet<T> getCommaSeparatedEnums(@NonNull final String sysconfigName, @NonNull final Class<T> enumType)
{
final String string = StringUtils.trimBlankToNull(sysConfigDAO.getValue(sysconfigName, ClientAndOrgId.SYSTEM).orElse(null));
if (string == null || string.equals("-"))
{
return ImmutableSet.of();
}
return Splitter.on(",")
.trimResults()
.omitEmptyStrings()
.splitToList(string)
.stream()
.map(name -> {
try
{
return Enum.valueOf(enumType, name);
}
catch (final Exception ex)
{
logger.warn("Failed converting `{}` to enum {}. Ignoring it.", name, enumType, ex);
return null;
}
})
.filter(Objects::nonNull)
.collect(ImmutableSet.toImmutableSet());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\service\impl\SysConfigBL.java
| 2
|
请完成以下Java代码
|
public class GetStaticCalledProcessDefinitionCmd implements Command<Collection<CalledProcessDefinition>> {
protected String processDefinitionId;
public GetStaticCalledProcessDefinitionCmd(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
}
protected List<ActivityImpl> findCallActivitiesInProcess(ProcessDefinitionEntity processDefinition) {
List<ActivityImpl> callActivities = new ArrayList<>();
Queue<ActivityImpl> toCheck = new LinkedList<>(processDefinition.getActivities());
while (!toCheck.isEmpty()) {
ActivityImpl candidate = toCheck.poll();
if (!candidate.getActivities().isEmpty()) {
toCheck.addAll(candidate.getActivities());
}
if (candidate.getActivityBehavior() instanceof CallActivityBehavior) {
callActivities.add(candidate);
}
}
return callActivities;
}
@Override
public Collection<CalledProcessDefinition> execute(CommandContext commandContext) {
ProcessDefinitionEntity processDefinition = new GetDeployedProcessDefinitionCmd(processDefinitionId, true).execute(commandContext);
List<ActivityImpl> callActivities = findCallActivitiesInProcess(processDefinition);
Map<String, CalledProcessDefinitionImpl> calledProcessDefinitionsById = new HashMap<>();
for (ActivityImpl activity : callActivities) {
CallActivityBehavior behavior = (CallActivityBehavior) activity.getActivityBehavior();
CallableElement callableElement = behavior.getCallableElement();
String activityId = activity.getActivityId();
String tenantId = processDefinition.getTenantId();
|
ProcessDefinition calledProcess = CallableElementUtil.getStaticallyBoundProcessDefinition(
processDefinitionId,
activityId,
callableElement,
tenantId);
if (calledProcess != null) {
if (!calledProcessDefinitionsById.containsKey(calledProcess.getId())) {
try {
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadProcessDefinition(calledProcess);
}
CalledProcessDefinitionImpl result = new CalledProcessDefinitionImpl(calledProcess, processDefinitionId);
result.addCallingCallActivity(activityId);
calledProcessDefinitionsById.put(calledProcess.getId(), result);
} catch (AuthorizationException e) {
// unauthorized Process definitions will not be added.
CMD_LOGGER.debugNotAllowedToResolveCalledProcess(calledProcess.getId(), processDefinitionId, activityId, e);
}
} else {
calledProcessDefinitionsById.get(calledProcess.getId()).addCallingCallActivity(activityId);
}
}
}
return new ArrayList<>(calledProcessDefinitionsById.values());
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmd\GetStaticCalledProcessDefinitionCmd.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class OptionalLiveReloadServer implements InitializingBean {
private static final Log logger = LogFactory.getLog(OptionalLiveReloadServer.class);
private @Nullable LiveReloadServer server;
/**
* Create a new {@link OptionalLiveReloadServer} instance.
* @param server the server to manage or {@code null}
*/
public OptionalLiveReloadServer(@Nullable LiveReloadServer server) {
this.server = server;
}
@Override
public void afterPropertiesSet() throws Exception {
startServer();
}
void startServer() {
if (this.server != null) {
try {
int port = this.server.getPort();
if (!this.server.isStarted()) {
port = this.server.start();
}
logger.info(LogMessage.format("LiveReload server is running on port %s", port));
}
catch (Exception ex) {
|
logger.warn("Unable to start LiveReload server");
logger.debug("Live reload start error", ex);
this.server = null;
}
}
}
/**
* Trigger LiveReload if the server is up and running.
*/
public void triggerReload() {
if (this.server != null) {
this.server.triggerReload();
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-devtools\src\main\java\org\springframework\boot\devtools\autoconfigure\OptionalLiveReloadServer.java
| 2
|
请完成以下Java代码
|
public class BooleanObject {
@NotNull(message = "boolField cannot be null")
Boolean boolField;
@AssertTrue(message = "trueField must have true value")
Boolean trueField;
@NotNull(message = "falseField cannot be null")
@AssertFalse(message = "falseField must have false value")
Boolean falseField;
@JsonDeserialize(using = BooleanDeserializer.class)
Boolean boolStringVar;
public Boolean getBoolField() {
return boolField;
}
public void setBoolField(Boolean boolField) {
this.boolField = boolField;
}
public Boolean getTrueField() {
return trueField;
}
public void setTrueField(Boolean trueField) {
this.trueField = trueField;
}
|
public Boolean getFalseField() {
return falseField;
}
public void setFalseField(Boolean falseField) {
this.falseField = falseField;
}
public Boolean getBoolStringVar() {
return boolStringVar;
}
public void setBoolStringVar(Boolean boolStringVar) {
this.boolStringVar = boolStringVar;
}
}
|
repos\tutorials-master\spring-boot-modules\spring-boot-validations\src\main\java\com\baeldung\dto\BooleanObject.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class GetAuthResponse {
@XmlElement(name = "return", required = true)
protected Login _return;
/**
* Gets the value of the return property.
*
* @return
* possible object is
* {@link Login }
*
*/
public Login getReturn() {
return _return;
|
}
/**
* Sets the value of the return property.
*
* @param value
* allowed object is
* {@link Login }
*
*/
public void setReturn(Login value) {
this._return = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.dpd\src\main\java-xjc\com\dpd\common\ws\loginservice\v2_0\types\GetAuthResponse.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class POSPaymentId implements RepoIdAware
{
int repoId;
private POSPaymentId(final int repoId)
{
this.repoId = Check.assumeGreaterThanZero(repoId, "C_POS_Payment_ID");
}
@JsonCreator
public static POSPaymentId ofRepoId(final int repoId)
{
return new POSPaymentId(repoId);
}
@Nullable
public static POSPaymentId ofRepoIdOrNull(final int repoId)
{
return repoId > 0 ? new POSPaymentId(repoId) : null;
}
public static int toRepoId(@Nullable final POSPaymentId id)
|
{
return id != null ? id.getRepoId() : -1;
}
@Override
@JsonValue
public int getRepoId()
{
return repoId;
}
public static boolean equals(@Nullable final POSPaymentId id1, @Nullable final POSPaymentId id2)
{
return Objects.equals(id1, id2);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.pos.base\src\main\java\de\metas\pos\POSPaymentId.java
| 2
|
请完成以下Java代码
|
public class PasswordPolicyUpperCaseRuleImpl implements PasswordPolicyRule {
public static final String PLACEHOLDER = DefaultPasswordPolicyImpl.PLACEHOLDER_PREFIX + "UPPERCASE";
protected int minUpperCase;
public PasswordPolicyUpperCaseRuleImpl(int minUpperCase) {
this.minUpperCase = minUpperCase;
}
@Override
public String getPlaceholder() {
return PasswordPolicyUpperCaseRuleImpl.PLACEHOLDER;
}
@Override
public Map<String, String> getParameters() {
Map<String, String> parameter = new HashMap<String, String>();
parameter.put("minUpperCase", "" + this.minUpperCase);
return parameter;
}
|
@Override
public boolean execute(String password) {
int upperCaseCount = 0;
for (Character c : password.toCharArray()) {
if (Character.isUpperCase(c)) {
upperCaseCount++;
}
if (upperCaseCount >= this.minUpperCase) {
return true;
}
}
return false;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\identity\PasswordPolicyUpperCaseRuleImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private String getUsername(HttpServletRequest httpRequest) {
try {
TokenUtils.getTokenByRequest();
String token;
if (null != httpRequest) {
token = TokenUtils.getTokenByRequest(httpRequest);
} else {
token = TokenUtils.getTokenByRequest();
}
if (TokenUtils.verifyToken(token, sysBaseApi, redisUtil)) {
return JwtUtil.getUsername(token);
}
} catch (Exception e) {
return null;
}
return null;
|
}
/**
* 打印耗时
* @param requestId
* @param message
* @author chenrui
* @date 2025/4/28 15:15
*/
private static void printChatDuration(String requestId,String message) {
Long beginTime = AiragLocalCache.get(AiragConsts.CACHE_TYPE_SSE_SEND_TIME, requestId);
if (null != beginTime) {
log.info("[AI-CHAT]{},requestId:{},耗时:{}s", message, requestId, (System.currentTimeMillis() - beginTime) / 1000);
}
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-boot-module\jeecg-boot-module-airag\src\main\java\org\jeecg\modules\airag\app\service\impl\AiragChatServiceImpl.java
| 2
|
请完成以下Java代码
|
public double getScaleFactor() {
if (!p_sizeCalculated)
p_sizeCalculated = calculateSize();
return m_scaleFactor;
}
/**
* Paint Image
* @param g2D Graphics
* @param pageStart top left Location of page
* @param pageNo page number for multi page support (0 = header/footer) - ignored
* @param ctx print context
* @param isView true if online view (IDs are links)
*/
@Override
public void paint(final Graphics2D g2D, final int pageNo, final Point2D pageStart, final Properties ctx, final boolean isView)
{
if (m_image == null)
return;
// Position
|
Point2D.Double location = getAbsoluteLocation(pageStart);
int x = (int)location.x;
if (MPrintFormatItem.FIELDALIGNMENTTYPE_TrailingRight.equals(p_FieldAlignmentType))
x += p_maxWidth - p_width;
else if (MPrintFormatItem.FIELDALIGNMENTTYPE_Center.equals(p_FieldAlignmentType))
x += (p_maxWidth - p_width) / 2;
int y = (int)location.y;
// map a scaled and shifted version of the image to device space
AffineTransform transform = new AffineTransform();
transform.translate(x,y);
transform.scale(m_scaleFactor, m_scaleFactor);
g2D.drawImage(m_image, transform, this);
} // paint
} // ImageElement
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\print\layout\ImageElement.java
| 1
|
请完成以下Java代码
|
public java.math.BigDecimal getRoundOffFactor ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_RoundOffFactor);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Standardgenauigkeit.
@param StdPrecision
Rule for rounding calculated amounts
*/
@Override
public void setStdPrecision (int StdPrecision)
{
|
set_Value (COLUMNNAME_StdPrecision, Integer.valueOf(StdPrecision));
}
/** Get Standardgenauigkeit.
@return Rule for rounding calculated amounts
*/
@Override
public int getStdPrecision ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_StdPrecision);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Currency.java
| 1
|
请完成以下Java代码
|
public String getRmtId() {
return rmtId;
}
/**
* Sets the value of the rmtId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRmtId(String value) {
this.rmtId = value;
}
/**
* Gets the value of the rmtLctnDtls property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the rmtLctnDtls property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getRmtLctnDtls().add(newItem);
* </pre>
*
|
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link RemittanceLocationDetails1 }
*
*
*/
public List<RemittanceLocationDetails1> getRmtLctnDtls() {
if (rmtLctnDtls == null) {
rmtLctnDtls = new ArrayList<RemittanceLocationDetails1>();
}
return this.rmtLctnDtls;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.esr\src\main\java-xjc_camt054_001_06\de\metas\payment\camt054_001_06\RemittanceLocation4.java
| 1
|
请完成以下Java代码
|
static void simpleProcessing() throws Exception {
final Path testPath = Paths.get("./testio.txt");
testPath.toFile().createNewFile();
ScheduledExecutorService executorService = Executors.newScheduledThreadPool(100);
Set<Future> futures = new HashSet<>();
for (int i = 0; i < 50000; i++) {
futures.add(executorService.submit(() -> {
try {
Files.write(testPath, Collections.singleton(Thread.currentThread().getName()), StandardOpenOption.APPEND);
} catch (IOException e) {
e.printStackTrace();
}
}));
}
long start = System.currentTimeMillis();
for (Future future : futures) {
future.get();
}
System.out.println("Time: " + (System.currentTimeMillis() - start));
executorService.shutdown();
}
static void batchedProcessing() throws Exception {
final Path testPath = Paths.get("./testio.txt");
testPath.toFile().createNewFile();
SmartBatcher batcher = new SmartBatcher(10, strings -> {
|
List<String> content = new ArrayList<>(strings);
content.add("-----Batch Operation-----");
try {
Files.write(testPath, content, StandardOpenOption.APPEND);
} catch (IOException e) {
e.printStackTrace();
}
});
for (int i = 0; i < 50000; i++) {
batcher.submit(Thread.currentThread().getName() + "-1");
}
long start = System.currentTimeMillis();
while (!batcher.finished()) {
Thread.sleep(10);
}
System.out.println("Time: " + (System.currentTimeMillis() - start));
}
public static void main(String[] args) throws Exception {
// simpleProcessing();
batchedProcessing();
}
}
|
repos\tutorials-master\patterns-modules\design-patterns-behavioral-2\src\main\java\com\baeldung\smartbatching\BatchingApp.java
| 1
|
请完成以下Java代码
|
public Builder setPaymentDate(final Date paymentDate)
{
this.paymentDate = paymentDate;
return this;
}
/**
* task 09643: separate transaction date from the accounting date
*
* @param dateAcct
* @return
*/
public Builder setDateAcct(final Date dateAcct)
{
this.dateAcct = dateAcct;
return this;
}
public Builder setCurrencyISOCode(@Nullable final CurrencyCode currencyISOCode)
{
this.currencyISOCode = currencyISOCode;
return this;
}
public Builder setPayAmt(final BigDecimal payAmt)
{
this.payAmt = payAmt;
return this;
}
public Builder setPayAmtConv(final BigDecimal payAmtConv)
{
this.payAmtConv = payAmtConv;
return this;
}
public Builder setC_BPartner_ID(final int C_BPartner_ID)
{
|
this.C_BPartner_ID = C_BPartner_ID;
return this;
}
public Builder setOpenAmtConv(final BigDecimal openAmtConv)
{
this.openAmtConv = openAmtConv;
return this;
}
public Builder setMultiplierAP(final BigDecimal multiplierAP)
{
this.multiplierAP = multiplierAP;
return this;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.swingui\src\main\java\de\metas\banking\payment\paymentallocation\model\PaymentRow.java
| 1
|
请完成以下Java代码
|
public WFProcess setTarget(
@NonNull final WFProcessId wfProcessId,
@Nullable final HUConsolidationTarget target,
@NonNull final UserId callerId)
{
final HUConsolidationJob job = jobService.setTarget(HUConsolidationJobId.ofWFProcessId(wfProcessId), target, callerId);
return toWFProcess(job);
}
public WFProcess closeTarget(
@NonNull final WFProcessId wfProcessId,
final @NotNull UserId callerId)
{
final HUConsolidationJob job = jobService.closeTarget(HUConsolidationJobId.ofWFProcessId(wfProcessId), callerId);
return toWFProcess(job);
}
public void printTargetLabel(
@NonNull final WFProcessId wfProcessId,
@NotNull final UserId callerId)
|
{
jobService.printTargetLabel(HUConsolidationJobId.ofWFProcessId(wfProcessId), callerId);
}
public WFProcess consolidate(@NonNull final JsonConsolidateRequest request, @NonNull final UserId callerId)
{
final HUConsolidationJob job = jobService.consolidate(ConsolidateRequest.builder()
.callerId(callerId)
.jobId(HUConsolidationJobId.ofWFProcessId(request.getWfProcessIdNotNull()))
.fromPickingSlotId(request.getFromPickingSlotId())
.huId(request.getHuId())
.build());
return toWFProcess(job);
}
public JsonHUConsolidationJobPickingSlotContent getPickingSlotContent(final HUConsolidationJobId jobId, final PickingSlotId pickingSlotId)
{
return jobService.getPickingSlotContent(jobId, pickingSlotId);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.hu_consolidation.mobile\src\main\java\de\metas\hu_consolidation\mobile\HUConsolidationApplication.java
| 1
|
请完成以下Java代码
|
public String getCamundaVariableName() {
return camundaVariableName.getValue(this);
}
@Override
public void setCamundaVariableName(String variableName) {
camundaVariableName.setValue(this, variableName);
}
@Override
public String getCamundaVariableEvents() {
return camundaVariableEvents.getValue(this);
}
@Override
|
public void setCamundaVariableEvents(String variableEvents) {
camundaVariableEvents.setValue(this, variableEvents);
}
@Override
public List<String> getCamundaVariableEventsList() {
String variableEvents = camundaVariableEvents.getValue(this);
return StringUtil.splitCommaSeparatedList(variableEvents);
}
@Override
public void setCamundaVariableEventsList(List<String> variableEventsList) {
String variableEvents = StringUtil.joinCommaSeparatedList(variableEventsList);
camundaVariableEvents.setValue(this, variableEvents);
}
}
|
repos\camunda-bpm-platform-master\model-api\bpmn-model\src\main\java\org\camunda\bpm\model\bpmn\impl\instance\ConditionalEventDefinitionImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private void setIdGenerator(SpringProcessEngineConfiguration configuration) {
idGenerator.ifPresent(configuration::setIdGenerator);
}
private void setDefaultSerializationFormat(SpringProcessEngineConfiguration configuration) {
String defaultSerializationFormat = camundaBpmProperties.getDefaultSerializationFormat();
if (StringUtils.hasText(defaultSerializationFormat)) {
configuration.setDefaultSerializationFormat(defaultSerializationFormat);
} else {
logger.warn("Ignoring invalid defaultSerializationFormat='{}'", defaultSerializationFormat);
}
}
private void setProcessEngineName(SpringProcessEngineConfiguration configuration) {
String processEngineName = StringUtils.trimAllWhitespace(camundaBpmProperties.getProcessEngineName());
if (!StringUtils.isEmpty(processEngineName) && !processEngineName.contains("-")) {
if (camundaBpmProperties.getGenerateUniqueProcessEngineName()) {
if (!processEngineName.equals(ProcessEngines.NAME_DEFAULT)) {
throw new RuntimeException(String.format("A unique processEngineName cannot be generated "
+ "if a custom processEngineName is already set: %s", processEngineName));
}
processEngineName = CamundaBpmProperties.getUniqueName(camundaBpmProperties.UNIQUE_ENGINE_NAME_PREFIX);
|
}
configuration.setProcessEngineName(processEngineName);
} else {
logger.warn("Ignoring invalid processEngineName='{}' - must not be null, blank or contain hyphen", camundaBpmProperties.getProcessEngineName());
}
}
private void setJobExecutorAcquireByPriority(SpringProcessEngineConfiguration configuration) {
Optional.ofNullable(camundaBpmProperties.getJobExecutorAcquireByPriority())
.ifPresent(configuration::setJobExecutorAcquireByPriority);
}
private void setDefaultNumberOfRetries(SpringProcessEngineConfiguration configuration) {
Optional.ofNullable(camundaBpmProperties.getDefaultNumberOfRetries())
.ifPresent(configuration::setDefaultNumberOfRetries);
}
}
|
repos\camunda-bpm-platform-master\spring-boot-starter\starter\src\main\java\org\camunda\bpm\spring\boot\starter\configuration\impl\DefaultProcessEngineConfiguration.java
| 2
|
请完成以下Java代码
|
public class GL_Journal_Builder
{
public static GL_Journal_Builder newBuilder(final GLJournalRequest glJournalRequest)
{
return new GL_Journal_Builder(glJournalRequest);
}
// services
private final transient ICurrencyDAO currencyDAO = Services.get(ICurrencyDAO.class);
private final GLCategoryRepository glCategoryRepository = GLCategoryRepository.get();
private final I_GL_Journal glJournal;
private final List<GL_JournalLine_Builder> glJournalLineBuilders = new ArrayList<>();
private GL_Journal_Builder(final GLJournalRequest request)
{
glJournal = InterfaceWrapperHelper.newInstance(I_GL_Journal.class);
glJournal.setC_AcctSchema_ID(request.getAcctSchemaId().getRepoId());
glJournal.setAD_Org_ID(request.getOrgId().getRepoId());
glJournal.setDateAcct(TimeUtil.asTimestamp(request.getDateAcct()));
glJournal.setDateDoc(TimeUtil.asTimestamp(request.getDateDoc()));
glJournal.setPostingType(request.getPostingType());
glJournal.setDescription(request.getDescription());
final IGLJournalBL glJournalBL = Services.get(IGLJournalBL.class);
final DocTypeId docTypeId = glJournalBL.getDocTypeGLJournal(request.getClientId(), request.getOrgId());
glJournal.setC_DocType_ID(docTypeId.getRepoId());
glJournal.setC_Currency_ID(request.getCurrencyId().getRepoId());
final CurrencyConversionTypeId conversionTypeDefaultId = getConversionTypeDefaultId(request);
glJournal.setC_ConversionType_ID(conversionTypeDefaultId.getRepoId());
final GLCategoryId glCategoryId = request.getGlCategoryId();
if (glCategoryId != null)
{
glJournal.setGL_Category_ID(glCategoryId.getRepoId());
}
else
{
final GLCategoryId defaultGLCategoryId = getDefaultGLCategoryId(request.getClientId()).orElse(null);
glJournal.setGL_Category_ID(GLCategoryId.toRepoId(defaultGLCategoryId));
}
}
public I_GL_Journal build()
{
InterfaceWrapperHelper.save(glJournal);
for (final GL_JournalLine_Builder glJournalLineBuilder : glJournalLineBuilders)
|
{
glJournalLineBuilder.build();
}
return glJournal;
}
public GL_JournalLine_Builder newLine()
{
final GL_JournalLine_Builder glJournalLineBuilder = new GL_JournalLine_Builder(this);
glJournalLineBuilders.add(glJournalLineBuilder);
return glJournalLineBuilder;
}
I_GL_Journal getGL_Journal()
{
return glJournal;
}
public CurrencyConversionTypeId getConversionTypeDefaultId(@NonNull GLJournalRequest request)
{
return currencyDAO.getDefaultConversionTypeId(
request.getClientId(),
request.getOrgId(),
request.getDateAcct());
}
private Optional<GLCategoryId> getDefaultGLCategoryId(@NonNull final ClientId clientId)
{
return glCategoryRepository.getDefaultId(clientId, GLCategoryType.Manual);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\gljournal\GL_Journal_Builder.java
| 1
|
请完成以下Java代码
|
protected final ProductsProposalRow getSingleSelectedRow()
{
return ProductsProposalRow.cast(super.getSingleSelectedRow());
}
protected final ViewId getInitialViewId()
{
return getView().getInitialViewId();
}
protected final ProductsProposalView getInitialView()
{
return ProductsProposalView.cast(viewsRepo.getView(getInitialViewId()));
}
protected final void closeAllViewsAndShowInitialView()
{
closeAllViewsExcludingInitialView();
afterCloseOpenView(getInitialViewId());
}
private final void closeAllViewsExcludingInitialView()
{
IView currentView = getView();
while (currentView != null && currentView.getParentViewId() != null)
{
try
|
{
viewsRepo.closeView(currentView.getViewId(), ViewCloseAction.CANCEL);
}
catch (Exception ex)
{
logger.warn("Failed closing view {}. Ignored", currentView, ex);
}
final ViewId viewId = currentView.getParentViewId();
currentView = viewsRepo.getViewIfExists(viewId);
}
}
protected final void afterCloseOpenView(final ViewId viewId)
{
getResult().setWebuiViewToOpen(WebuiViewToOpen.builder()
.viewId(viewId.toJson())
.target(ViewOpenTarget.ModalOverlay)
.build());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\order\products_proposal\process\ProductsProposalViewBasedProcess.java
| 1
|
请完成以下Java代码
|
public Insets getBorderInsets(final Component c)
{
final Insets insets = new Insets(0, 0, 0, 0);
if (c instanceof BasicSplitPaneDivider)
{
final BasicSplitPaneUI bspui = ((BasicSplitPaneDivider)c).getBasicSplitPaneUI();
if (bspui != null)
{
final JSplitPane splitPane = bspui.getSplitPane();
if (splitPane != null)
{
if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT)
{
insets.top = insets.bottom = 0;
insets.left = insets.right = 1;
return insets;
}
// VERTICAL_SPLIT
|
insets.top = insets.bottom = 1;
insets.left = insets.right = 0;
return insets;
}
}
}
insets.top = insets.bottom = insets.left = insets.right = 1;
return insets;
}
@Override
public boolean isBorderOpaque()
{
return true;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\plaf\AdempiereSplitPaneUI.java
| 1
|
请完成以下Java代码
|
public void updateSuspensionState(ProcessEngine engine) {
int params = (jobDefinitionId != null ? 1 : 0)
+ (processDefinitionId != null ? 1 : 0)
+ (processDefinitionKey != null ? 1 : 0);
if (params > 1) {
String message = "Only one of jobDefinitionId, processDefinitionId or processDefinitionKey should be set to update the suspension state.";
throw new InvalidRequestException(Status.BAD_REQUEST, message);
} else if (params == 0) {
String message = "Either jobDefinitionId, processDefinitionId or processDefinitionKey should be set to update the suspension state.";
throw new InvalidRequestException(Status.BAD_REQUEST, message);
}
UpdateJobDefinitionSuspensionStateBuilder updateSuspensionStateBuilder = createUpdateSuspensionStateBuilder(engine);
if (executionDate != null && !executionDate.equals("")) {
Date delayedExecutionDate = DateTimeUtil.parseDate(executionDate);
updateSuspensionStateBuilder.executionDate(delayedExecutionDate);
}
updateSuspensionStateBuilder.includeJobs(includeJobs);
if (getSuspended()) {
updateSuspensionStateBuilder.suspend();
} else {
updateSuspensionStateBuilder.activate();
|
}
}
protected UpdateJobDefinitionSuspensionStateBuilder createUpdateSuspensionStateBuilder(ProcessEngine engine) {
UpdateJobDefinitionSuspensionStateSelectBuilder selectBuilder = engine.getManagementService().updateJobDefinitionSuspensionState();
if (jobDefinitionId != null) {
return selectBuilder.byJobDefinitionId(jobDefinitionId);
} else if (processDefinitionId != null) {
return selectBuilder.byProcessDefinitionId(processDefinitionId);
} else {
UpdateJobDefinitionSuspensionStateTenantBuilder tenantBuilder = selectBuilder.byProcessDefinitionKey(processDefinitionKey);
if (processDefinitionTenantId != null) {
tenantBuilder.processDefinitionTenantId(processDefinitionTenantId);
} else if (processDefinitionWithoutTenantId) {
tenantBuilder.processDefinitionWithoutTenantId();
}
return tenantBuilder;
}
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\management\JobDefinitionSuspensionStateDto.java
| 1
|
请完成以下Java代码
|
public synchronized ValueNamePair getLastErrorAndReset()
{
final ValueNamePair lastErrorToReturn = lastError;
lastError = null;
return lastErrorToReturn;
}
public synchronized void setLastError(final ValueNamePair lastError)
{
this.lastError = lastError;
}
public synchronized Throwable getLastExceptionAndReset()
{
final Throwable lastExceptionAndClear = lastException;
lastException = null;
return lastExceptionAndClear;
}
public synchronized void setLastException(final Throwable lastException)
{
this.lastException = lastException;
}
|
public synchronized ValueNamePair getLastWarningAndReset()
{
final ValueNamePair lastWarningToReturn = lastWarning;
lastWarning = null;
return lastWarningToReturn;
}
public synchronized void setLastWarning(final ValueNamePair lastWarning)
{
this.lastWarning = lastWarning;
}
public synchronized void reset()
{
lastError = null;
lastException = null;
lastWarning = null;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\logging\MetasfreshLastError.java
| 1
|
请完成以下Java代码
|
public void setR_RequestType_ID (int R_RequestType_ID)
{
if (R_RequestType_ID < 1)
set_ValueNoCheck (COLUMNNAME_R_RequestType_ID, null);
else
set_ValueNoCheck (COLUMNNAME_R_RequestType_ID, Integer.valueOf(R_RequestType_ID));
}
/** Get Request Type.
@return Type of request (e.g. Inquiry, Complaint, ..)
*/
public int getR_RequestType_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_R_RequestType_ID);
if (ii == null)
return 0;
return ii.intValue();
}
|
/** Set Source Updated.
@param SourceUpdated
Date the source document was updated
*/
public void setSourceUpdated (Timestamp SourceUpdated)
{
set_Value (COLUMNNAME_SourceUpdated, SourceUpdated);
}
/** Get Source Updated.
@return Date the source document was updated
*/
public Timestamp getSourceUpdated ()
{
return (Timestamp)get_Value(COLUMNNAME_SourceUpdated);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_K_Index.java
| 1
|
请完成以下Java代码
|
public int getAD_ReplicationTable_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_ReplicationTable_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Replicated.
@param IsReplicated
The data is successfully replicated
*/
public void setIsReplicated (boolean IsReplicated)
{
set_Value (COLUMNNAME_IsReplicated, Boolean.valueOf(IsReplicated));
}
/** Get Replicated.
@return The data is successfully replicated
*/
public boolean isReplicated ()
{
Object oo = get_Value(COLUMNNAME_IsReplicated);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
|
return false;
}
/** Set Process Message.
@param P_Msg Process Message */
public void setP_Msg (String P_Msg)
{
set_Value (COLUMNNAME_P_Msg, P_Msg);
}
/** Get Process Message.
@return Process Message */
public String getP_Msg ()
{
return (String)get_Value(COLUMNNAME_P_Msg);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Replication_Log.java
| 1
|
请完成以下Java代码
|
public TransactionInterest3 getIntrst() {
return intrst;
}
/**
* Sets the value of the intrst property.
*
* @param value
* allowed object is
* {@link TransactionInterest3 }
*
*/
public void setIntrst(TransactionInterest3 value) {
this.intrst = value;
}
/**
* Gets the value of the cardTx property.
*
* @return
* possible object is
* {@link CardEntry1 }
*
*/
public CardEntry1 getCardTx() {
return cardTx;
}
/**
* Sets the value of the cardTx property.
*
* @param value
* allowed object is
* {@link CardEntry1 }
*
*/
public void setCardTx(CardEntry1 value) {
this.cardTx = value;
}
/**
* Gets the value of the ntryDtls property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the ntryDtls property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getNtryDtls().add(newItem);
* </pre>
|
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link EntryDetails3 }
*
*
*/
public List<EntryDetails3> getNtryDtls() {
if (ntryDtls == null) {
ntryDtls = new ArrayList<EntryDetails3>();
}
return this.ntryDtls;
}
/**
* Gets the value of the addtlNtryInf property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAddtlNtryInf() {
return addtlNtryInf;
}
/**
* Sets the value of the addtlNtryInf property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAddtlNtryInf(String value) {
this.addtlNtryInf = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_04\ReportEntry4.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public static class FanoutExchangeDemoConfiguration {
// 创建 Queue A
@Bean
public Queue demo03QueueA() {
return new Queue(Demo03Message.QUEUE_A, // Queue 名字
true, // durable: 是否持久化
false, // exclusive: 是否排它
false); // autoDelete: 是否自动删除
}
// 创建 Queue B
@Bean
public Queue demo03QueueB() {
return new Queue(Demo03Message.QUEUE_B, // Queue 名字
true, // durable: 是否持久化
false, // exclusive: 是否排它
false); // autoDelete: 是否自动删除
}
// 创建 Fanout Exchange
@Bean
public FanoutExchange demo03Exchange() {
return new FanoutExchange(Demo03Message.EXCHANGE,
true, // durable: 是否持久化
false); // exclusive: 是否排它
}
// 创建 Binding A
// Exchange:Demo03Message.EXCHANGE
// Queue:Demo03Message.QUEUE_A
@Bean
public Binding demo03BindingA() {
return BindingBuilder.bind(demo03QueueA()).to(demo03Exchange());
}
// 创建 Binding B
// Exchange:Demo03Message.EXCHANGE
// Queue:Demo03Message.QUEUE_B
@Bean
public Binding demo03BindingB() {
return BindingBuilder.bind(demo03QueueB()).to(demo03Exchange());
}
}
/**
* Headers Exchange 示例的配置类
*/
public static class HeadersExchangeDemoConfiguration {
|
// 创建 Queue
@Bean
public Queue demo04Queue() {
return new Queue(Demo04Message.QUEUE, // Queue 名字
true, // durable: 是否持久化
false, // exclusive: 是否排它
false); // autoDelete: 是否自动删除
}
// 创建 Headers Exchange
@Bean
public HeadersExchange demo04Exchange() {
return new HeadersExchange(Demo04Message.EXCHANGE,
true, // durable: 是否持久化
false); // exclusive: 是否排它
}
// 创建 Binding
// Exchange:Demo04Message.EXCHANGE
// Queue:Demo04Message.QUEUE
// Headers: Demo04Message.HEADER_KEY + Demo04Message.HEADER_VALUE
@Bean
public Binding demo4Binding() {
return BindingBuilder.bind(demo04Queue()).to(demo04Exchange())
.where(Demo04Message.HEADER_KEY).matches(Demo04Message.HEADER_VALUE); // 配置 Headers 匹配
}
}
}
|
repos\SpringBoot-Labs-master\lab-04-rabbitmq\lab-04-rabbitmq-demo\src\main\java\cn\iocoder\springboot\lab04\rabbitmqdemo\config\RabbitConfig.java
| 2
|
请完成以下Java代码
|
public int getRecipientBankCountryId()
{
return get_ValueAsInt(COLUMNNAME_RecipientBankCountryId);
}
@Override
public void setRecipientCountryId (final int RecipientCountryId)
{
set_Value (COLUMNNAME_RecipientCountryId, RecipientCountryId);
}
@Override
public int getRecipientCountryId()
{
return get_ValueAsInt(COLUMNNAME_RecipientCountryId);
}
/**
* RecipientType AD_Reference_ID=541372
* Reference name: RecipientTypeList
*/
public static final int RECIPIENTTYPE_AD_Reference_ID=541372;
/** COMPANY = COMPANY */
public static final String RECIPIENTTYPE_COMPANY = "COMPANY";
/** INDIVIDUAL = INDIVIDUAL */
public static final String RECIPIENTTYPE_INDIVIDUAL = "INDIVIDUAL";
@Override
public void setRecipientType (final java.lang.String RecipientType)
{
set_Value (COLUMNNAME_RecipientType, RecipientType);
}
@Override
public java.lang.String getRecipientType()
{
return get_ValueAsString(COLUMNNAME_RecipientType);
}
@Override
public void setRecord_ID (final int Record_ID)
{
if (Record_ID < 0)
set_Value (COLUMNNAME_Record_ID, null);
else
set_Value (COLUMNNAME_Record_ID, Record_ID);
}
|
@Override
public int getRecord_ID()
{
return get_ValueAsInt(COLUMNNAME_Record_ID);
}
@Override
public void setRegionName (final @Nullable java.lang.String RegionName)
{
set_Value (COLUMNNAME_RegionName, RegionName);
}
@Override
public java.lang.String getRegionName()
{
return get_ValueAsString(COLUMNNAME_RegionName);
}
@Override
public void setRevolut_Payment_Export_ID (final int Revolut_Payment_Export_ID)
{
if (Revolut_Payment_Export_ID < 1)
set_ValueNoCheck (COLUMNNAME_Revolut_Payment_Export_ID, null);
else
set_ValueNoCheck (COLUMNNAME_Revolut_Payment_Export_ID, Revolut_Payment_Export_ID);
}
@Override
public int getRevolut_Payment_Export_ID()
{
return get_ValueAsInt(COLUMNNAME_Revolut_Payment_Export_ID);
}
@Override
public void setRoutingNo (final @Nullable java.lang.String RoutingNo)
{
set_Value (COLUMNNAME_RoutingNo, RoutingNo);
}
@Override
public java.lang.String getRoutingNo()
{
return get_ValueAsString(COLUMNNAME_RoutingNo);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.revolut\src\main\java-gen\de\metas\payment\revolut\model\X_Revolut_Payment_Export.java
| 1
|
请完成以下Java代码
|
public de.metas.material.cockpit.model.I_MD_Cockpit getMD_Cockpit()
{
return get_ValueAsPO(COLUMNNAME_MD_Cockpit_ID, de.metas.material.cockpit.model.I_MD_Cockpit.class);
}
@Override
public void setMD_Cockpit(final de.metas.material.cockpit.model.I_MD_Cockpit MD_Cockpit)
{
set_ValueFromPO(COLUMNNAME_MD_Cockpit_ID, de.metas.material.cockpit.model.I_MD_Cockpit.class, MD_Cockpit);
}
@Override
public void setMD_Cockpit_ID (final int MD_Cockpit_ID)
{
if (MD_Cockpit_ID < 1)
set_Value (COLUMNNAME_MD_Cockpit_ID, null);
else
set_Value (COLUMNNAME_MD_Cockpit_ID, MD_Cockpit_ID);
}
@Override
public int getMD_Cockpit_ID()
{
return get_ValueAsInt(COLUMNNAME_MD_Cockpit_ID);
}
@Override
public void setM_Warehouse_ID (final int M_Warehouse_ID)
{
if (M_Warehouse_ID < 1)
set_Value (COLUMNNAME_M_Warehouse_ID, null);
else
set_Value (COLUMNNAME_M_Warehouse_ID, M_Warehouse_ID);
|
}
@Override
public int getM_Warehouse_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Warehouse_ID);
}
@Override
public void setQtyPending (final BigDecimal QtyPending)
{
set_Value (COLUMNNAME_QtyPending, QtyPending);
}
@Override
public BigDecimal getQtyPending()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyPending);
return bd != null ? bd : BigDecimal.ZERO;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.material\cockpit\src\main\java-gen\de\metas\material\cockpit\model\X_MD_Cockpit_DDOrder_Detail.java
| 1
|
请完成以下Java代码
|
protected String evaluateExpression(EvaluationContext context, Expression expression) {
return Objects.requireNonNull(expression.getValue(context, String.class));
}
protected EvaluationContext createEvaluationContext(InstanceEvent event, Instance instance) {
Map<String, Object> root = new HashMap<>();
root.put("event", event);
root.put("instance", instance);
root.put("lastStatus", getLastStatus(event.getInstance()));
return SimpleEvaluationContext
.forPropertyAccessors(DataBindingPropertyAccessor.forReadOnlyAccess(), new MapAccessor())
.withRootObject(root)
.build();
}
@Nullable
public URI getWebhookUrl() {
return webhookUrl;
}
public void setWebhookUrl(@Nullable URI webhookUrl) {
this.webhookUrl = webhookUrl;
}
public String getThemeColor() {
return themeColor.getExpressionString();
}
public void setThemeColor(String themeColor) {
this.themeColor = parser.parseExpression(themeColor, ParserContext.TEMPLATE_EXPRESSION);
}
public String getDeregisterActivitySubtitle() {
return deregisterActivitySubtitle.getExpressionString();
}
public void setDeregisterActivitySubtitle(String deregisterActivitySubtitle) {
this.deregisterActivitySubtitle = parser.parseExpression(deregisterActivitySubtitle,
ParserContext.TEMPLATE_EXPRESSION);
}
public String getRegisterActivitySubtitle() {
return registerActivitySubtitle.getExpressionString();
}
|
public void setRegisterActivitySubtitle(String registerActivitySubtitle) {
this.registerActivitySubtitle = parser.parseExpression(registerActivitySubtitle,
ParserContext.TEMPLATE_EXPRESSION);
}
public String getStatusActivitySubtitle() {
return statusActivitySubtitle.getExpressionString();
}
public void setStatusActivitySubtitle(String statusActivitySubtitle) {
this.statusActivitySubtitle = parser.parseExpression(statusActivitySubtitle, ParserContext.TEMPLATE_EXPRESSION);
}
@Data
@Builder
public static class Message {
private final String summary;
private final String themeColor;
private final String title;
@Builder.Default
private final List<Section> sections = new ArrayList<>();
}
@Data
@Builder
public static class Section {
private final String activityTitle;
private final String activitySubtitle;
@Builder.Default
private final List<Fact> facts = new ArrayList<>();
}
public record Fact(String name, @Nullable String value) {
}
}
|
repos\spring-boot-admin-master\spring-boot-admin-server\src\main\java\de\codecentric\boot\admin\server\notify\MicrosoftTeamsNotifier.java
| 1
|
请完成以下Java代码
|
public class ActivitiEventImpl implements ActivitiEvent {
protected ActivitiEventType type;
protected String executionId;
protected String processInstanceId;
protected String processDefinitionId;
private String reason;
private String actor;
/**
* Creates a new event implementation, not part of an execution context.
*/
public ActivitiEventImpl(ActivitiEventType type) {
this(type, null, null, null);
}
/**
* Creates a new event implementation, part of an execution context.
*/
public ActivitiEventImpl(
ActivitiEventType type,
String executionId,
String processInstanceId,
String processDefinitionId
) {
if (type == null) {
throw new ActivitiIllegalArgumentException("type is null");
}
this.type = type;
this.executionId = executionId;
this.processInstanceId = processInstanceId;
this.processDefinitionId = processDefinitionId;
}
public ActivitiEventType getType() {
return type;
}
public void setType(ActivitiEventType type) {
this.type = type;
}
public String getExecutionId() {
return executionId;
}
public void setExecutionId(String executionId) {
this.executionId = executionId;
}
public String getProcessDefinitionId() {
return processDefinitionId;
}
public void setProcessDefinitionId(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
}
public String getProcessInstanceId() {
return processInstanceId;
|
}
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
@Override
public String toString() {
return getClass() + " - " + type;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public String getActor() {
return actor;
}
public void setActor(String actor) {
this.actor = actor;
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\delegate\event\impl\ActivitiEventImpl.java
| 1
|
请完成以下Java代码
|
public CSVWriter setAllowMultilineFields(final boolean allowMultilineFields)
{
this.allowMultilineFields = allowMultilineFields;
return this;
}
public void setHeader(final List<String> header)
{
Check.assumeNotNull(header, "header not null");
Check.assume(!header.isEmpty(), "header not empty");
Check.assume(!headerAppended, "header was not already appended");
this.header = header;
}
private void appendHeader() throws IOException
{
if (headerAppended)
{
return;
}
Check.assumeNotNull(header, "header not null");
final StringBuilder headerLine = new StringBuilder();
for (final String headerCol : header)
{
if (headerLine.length() > 0)
{
headerLine.append(fieldDelimiter);
}
final String headerColQuoted = quoteCsvValue(headerCol);
headerLine.append(headerColQuoted);
}
writer.append(headerLine.toString());
writer.append(lineEnding);
headerAppended = true;
}
@Override
public void appendLine(List<Object> values) throws IOException
{
appendHeader();
final StringBuilder line = new StringBuilder();
final int cols = header.size();
final int valuesCount = values.size();
for (int i = 0; i < cols; i++)
{
final Object csvValue;
if (i < valuesCount)
{
csvValue = values.get(i);
}
else
{
csvValue = null;
}
final String csvValueQuoted = toCsvValue(csvValue);
if (line.length() > 0)
{
line.append(fieldDelimiter);
}
line.append(csvValueQuoted);
}
writer.append(line.toString());
writer.append(lineEnding);
}
private String toCsvValue(Object value)
{
final String valueStr;
if (value == null)
{
valueStr = "";
}
else if (value instanceof java.util.Date)
{
valueStr = dateFormat.format(value);
}
else
|
{
valueStr = value.toString();
}
return quoteCsvValue(valueStr);
}
private String quoteCsvValue(String valueStr)
{
return fieldQuote
+ valueStr.replace(fieldQuote, fieldQuote + fieldQuote)
+ fieldQuote;
}
@Override
public void close() throws IOException
{
if (writer == null)
{
return;
}
try
{
writer.flush();
}
finally
{
if (writer != null)
{
try
{
writer.close();
}
catch (IOException e)
{
// shall not happen
e.printStackTrace(); // NOPMD by tsa on 3/13/13 1:46 PM
}
writer = null;
}
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\data\export\api\impl\CSVWriter.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
static class RoleVoterBeanFactory extends AbstractGrantedAuthorityDefaultsBeanFactory {
private RoleVoter voter = new RoleVoter();
@Override
public RoleVoter getBean() {
this.voter.setRolePrefix(this.rolePrefix);
return this.voter;
}
}
static class SecurityContextHolderAwareRequestFilterBeanFactory
extends GrantedAuthorityDefaultsParserUtils.AbstractGrantedAuthorityDefaultsBeanFactory {
private SecurityContextHolderAwareRequestFilter filter = new SecurityContextHolderAwareRequestFilter();
private SecurityContextHolderStrategy securityContextHolderStrategy = SecurityContextHolder
.getContextHolderStrategy();
@Override
public SecurityContextHolderAwareRequestFilter getBean() {
this.filter.setSecurityContextHolderStrategy(this.securityContextHolderStrategy);
this.filter.setRolePrefix(this.rolePrefix);
return this.filter;
}
void setSecurityContextHolderStrategy(SecurityContextHolderStrategy securityContextHolderStrategy) {
this.securityContextHolderStrategy = securityContextHolderStrategy;
}
}
static class SecurityContextHolderStrategyFactory implements FactoryBean<SecurityContextHolderStrategy> {
@Override
public SecurityContextHolderStrategy getObject() throws Exception {
return SecurityContextHolder.getContextHolderStrategy();
}
@Override
public Class<?> getObjectType() {
|
return SecurityContextHolderStrategy.class;
}
}
static class ObservationRegistryFactory implements FactoryBean<ObservationRegistry> {
@Override
public ObservationRegistry getObject() throws Exception {
return ObservationRegistry.NOOP;
}
@Override
public Class<?> getObjectType() {
return ObservationRegistry.class;
}
}
}
|
repos\spring-security-main\config\src\main\java\org\springframework\security\config\http\HttpConfigurationBuilder.java
| 2
|
请完成以下Java代码
|
public int length()
{
return word.length();
}
/**
* 获取本词语在HanLP词库中的频次
* @return 频次,0代表这是个OOV
*/
public int getFrequency()
{
return LexiconUtility.getFrequency(word);
}
|
/**
* 判断Term是否相等
*/
@Override
public boolean equals(Object obj) {
if (obj instanceof Term)
{
Term term = (Term)obj;
if (this.nature == term.nature && this.word.equals(term.word))
{
return true;
}
}
return super.equals(obj);
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\seg\common\Term.java
| 1
|
请完成以下Java代码
|
public org.compiere.model.I_C_ValidCombination getW_Revaluation_A() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_W_Revaluation_Acct, org.compiere.model.I_C_ValidCombination.class);
}
@Override
public void setW_Revaluation_A(org.compiere.model.I_C_ValidCombination W_Revaluation_A)
{
set_ValueFromPO(COLUMNNAME_W_Revaluation_Acct, org.compiere.model.I_C_ValidCombination.class, W_Revaluation_A);
}
/** Set Lager Wert Korrektur Währungsdifferenz.
@param W_Revaluation_Acct
Konto für Lager Wert Korrektur Währungsdifferenz
*/
@Override
public void setW_Revaluation_Acct (int W_Revaluation_Acct)
{
set_Value (COLUMNNAME_W_Revaluation_Acct, Integer.valueOf(W_Revaluation_Acct));
}
/** Get Lager Wert Korrektur Währungsdifferenz.
@return Konto für Lager Wert Korrektur Währungsdifferenz
*/
@Override
public int getW_Revaluation_Acct ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_W_Revaluation_Acct);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public org.compiere.model.I_C_ValidCombination getWithholding_A() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_Withholding_Acct, org.compiere.model.I_C_ValidCombination.class);
}
@Override
public void setWithholding_A(org.compiere.model.I_C_ValidCombination Withholding_A)
{
set_ValueFromPO(COLUMNNAME_Withholding_Acct, org.compiere.model.I_C_ValidCombination.class, Withholding_A);
}
/** Set Einbehalt.
@param Withholding_Acct
Account for Withholdings
*/
@Override
public void setWithholding_Acct (int Withholding_Acct)
{
set_Value (COLUMNNAME_Withholding_Acct, Integer.valueOf(Withholding_Acct));
|
}
/** Get Einbehalt.
@return Account for Withholdings
*/
@Override
public int getWithholding_Acct ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Withholding_Acct);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public org.compiere.model.I_C_ValidCombination getWriteOff_A() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_WriteOff_Acct, org.compiere.model.I_C_ValidCombination.class);
}
@Override
public void setWriteOff_A(org.compiere.model.I_C_ValidCombination WriteOff_A)
{
set_ValueFromPO(COLUMNNAME_WriteOff_Acct, org.compiere.model.I_C_ValidCombination.class, WriteOff_A);
}
/** Set Forderungsverluste.
@param WriteOff_Acct
Konto für Forderungsverluste
*/
@Override
public void setWriteOff_Acct (int WriteOff_Acct)
{
set_Value (COLUMNNAME_WriteOff_Acct, Integer.valueOf(WriteOff_Acct));
}
/** Get Forderungsverluste.
@return Konto für Forderungsverluste
*/
@Override
public int getWriteOff_Acct ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_WriteOff_Acct);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_AcctSchema_Default.java
| 1
|
请完成以下Java代码
|
public int getC_Print_PackageInfo_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Print_PackageInfo_ID);
}
@Override
public void setCreatedby_Print_Job_Instructions (int Createdby_Print_Job_Instructions)
{
set_ValueNoCheck (COLUMNNAME_Createdby_Print_Job_Instructions, Integer.valueOf(Createdby_Print_Job_Instructions));
}
@Override
public int getCreatedby_Print_Job_Instructions()
{
return get_ValueAsInt(COLUMNNAME_Createdby_Print_Job_Instructions);
}
@Override
public void setCreated_Print_Job_Instructions (java.sql.Timestamp Created_Print_Job_Instructions)
{
set_ValueNoCheck (COLUMNNAME_Created_Print_Job_Instructions, Created_Print_Job_Instructions);
}
@Override
public java.sql.Timestamp getCreated_Print_Job_Instructions()
{
return get_ValueAsTimestamp(COLUMNNAME_Created_Print_Job_Instructions);
}
@Override
public void setPrintServiceName (java.lang.String PrintServiceName)
{
set_ValueNoCheck (COLUMNNAME_PrintServiceName, PrintServiceName);
}
@Override
public java.lang.String getPrintServiceName()
{
return (java.lang.String)get_Value(COLUMNNAME_PrintServiceName);
}
@Override
public void setPrintServiceTray (java.lang.String PrintServiceTray)
{
set_ValueNoCheck (COLUMNNAME_PrintServiceTray, PrintServiceTray);
}
@Override
public java.lang.String getPrintServiceTray()
{
return (java.lang.String)get_Value(COLUMNNAME_PrintServiceTray);
}
@Override
public void setStatus_Print_Job_Instructions (boolean Status_Print_Job_Instructions)
|
{
set_ValueNoCheck (COLUMNNAME_Status_Print_Job_Instructions, Boolean.valueOf(Status_Print_Job_Instructions));
}
@Override
public boolean isStatus_Print_Job_Instructions()
{
return get_ValueAsBoolean(COLUMNNAME_Status_Print_Job_Instructions);
}
@Override
public void setTrayNumber (int TrayNumber)
{
set_ValueNoCheck (COLUMNNAME_TrayNumber, Integer.valueOf(TrayNumber));
}
@Override
public int getTrayNumber()
{
return get_ValueAsInt(COLUMNNAME_TrayNumber);
}
@Override
public void setUpdatedby_Print_Job_Instructions (int Updatedby_Print_Job_Instructions)
{
set_ValueNoCheck (COLUMNNAME_Updatedby_Print_Job_Instructions, Integer.valueOf(Updatedby_Print_Job_Instructions));
}
@Override
public int getUpdatedby_Print_Job_Instructions()
{
return get_ValueAsInt(COLUMNNAME_Updatedby_Print_Job_Instructions);
}
@Override
public void setUpdated_Print_Job_Instructions (java.sql.Timestamp Updated_Print_Job_Instructions)
{
set_ValueNoCheck (COLUMNNAME_Updated_Print_Job_Instructions, Updated_Print_Job_Instructions);
}
@Override
public java.sql.Timestamp getUpdated_Print_Job_Instructions()
{
return get_ValueAsTimestamp(COLUMNNAME_Updated_Print_Job_Instructions);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.printing\de.metas.printing.base\src\main\java-gen\de\metas\printing\model\X_C_Printing_Queue_PrintInfo_v.java
| 1
|
请完成以下Java代码
|
private static boolean isValid(final I_C_Queue_WorkPackage workPackage)
{
if (workPackage == null)
{
return false;
}
if (workPackage.isProcessed())
{
return false;
}
if (workPackage.isError())
{
return false;
}
return true;
}
private static void setupNewCtxForWorkPackage(@NonNull final I_C_Queue_WorkPackage workPackage, @NonNull final Properties commonCtx)
|
{
final Properties newCtx = Env.copyCtx(commonCtx);
InterfaceWrapperHelper.setCtx(workPackage, newCtx);
WorkPackageQueue.setupWorkPackageContext(newCtx, workPackage);
}
protected abstract boolean handleWorkPackageProcessing(@NonNull final IQueueProcessor queueProcessor, @NonNull final I_C_Queue_WorkPackage workPackage);
protected abstract void startPlanner();
protected abstract void shutdownPlanner();
protected abstract Set<Class<? extends AbstractQueueProcessor>> getSupportedQueueProcessors();
protected abstract boolean isStopOnFailedRun();
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.async\src\main\java\de\metas\async\processor\impl\planner\QueueProcessorPlanner.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_CCM_Bundle_Result[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set Bundle Result.
@param CCM_Bundle_Result_ID Bundle Result */
public void setCCM_Bundle_Result_ID (int CCM_Bundle_Result_ID)
{
if (CCM_Bundle_Result_ID < 1)
set_ValueNoCheck (COLUMNNAME_CCM_Bundle_Result_ID, null);
else
set_ValueNoCheck (COLUMNNAME_CCM_Bundle_Result_ID, Integer.valueOf(CCM_Bundle_Result_ID));
}
/** Get Bundle Result.
@return Bundle Result */
public int getCCM_Bundle_Result_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_CCM_Bundle_Result_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** CCM_Success AD_Reference_ID=319 */
public static final int CCM_SUCCESS_AD_Reference_ID=319;
/** Yes = Y */
public static final String CCM_SUCCESS_Yes = "Y";
/** No = N */
public static final String CCM_SUCCESS_No = "N";
/** Set Is Success.
@param CCM_Success Is Success */
public void setCCM_Success (String CCM_Success)
{
set_Value (COLUMNNAME_CCM_Success, CCM_Success);
}
/** Get Is Success.
@return Is Success */
public String getCCM_Success ()
{
return (String)get_Value(COLUMNNAME_CCM_Success);
}
/** 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 Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set 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.swat\de.metas.swat.base\src\main\java-gen\de\metas\callcenter\model\X_CCM_Bundle_Result.java
| 1
|
请完成以下Java代码
|
protected boolean beforeSave(boolean newRecord)
{
if (isView() && isDeleteable())
{
setIsDeleteable(false);
}
//
return true;
} // beforeSave
/**
* After Save
*
* @param newRecord new
* @param success success
* @return success
*/
@Override
protected boolean afterSave(boolean newRecord, boolean success)
{
//
// Create/Update table sequences
// NOTE: we shall do this only if it's a new table, else we will change the sequence's next value
// which could be OK on our local development database,
// but when the migration script will be executed on target customer database, their sequences will be wrongly changed (08607)
if (success && newRecord)
{
final ISequenceDAO sequenceDAO = Services.get(ISequenceDAO.class);
sequenceDAO.createTableSequenceChecker(getCtx())
.setFailOnFirstError(true)
.setSequenceRangeCheck(false)
.setTable(this)
.setTrxName(get_TrxName())
|
.run();
}
if (!newRecord && is_ValueChanged(COLUMNNAME_TableName))
{
final IADTableDAO adTableDAO = Services.get(IADTableDAO.class);
adTableDAO.onTableNameRename(this);
}
return success;
} // afterSave
public Query createQuery(String whereClause, String trxName)
{
return new Query(this.getCtx(), this, whereClause, trxName);
}
@Override
public String toString()
{
return "MTable[" + get_ID() + "-" + getTableName() + "]";
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MTable.java
| 1
|
请完成以下Java代码
|
public class HUToReportWrapper implements HUToReport
{
public static HUToReportWrapper of(final I_M_HU hu)
{
return new HUToReportWrapper(hu);
}
public static List<HUToReportWrapper> ofList(final List<I_M_HU> hus)
{
if (hus.isEmpty())
{
return ImmutableList.of();
}
return hus.stream().map(HUToReportWrapper::of).collect(ImmutableList.toImmutableList());
}
private final I_M_HU hu;
private final HuId huId;
private final BPartnerId bpartnerId;
private final HuUnitType huUnitType;
private List<HUToReport> _includedHUs; // lazy
private HUToReportWrapper(@NonNull final I_M_HU hu)
{
this.hu = hu;
this.huId = HuId.ofRepoId(hu.getM_HU_ID());
this.bpartnerId = BPartnerId.ofRepoIdOrNull(hu.getC_BPartner_ID());
this.huUnitType = extractHUType(hu);
}
private static HuUnitType extractHUType(final I_M_HU hu)
{
final IHandlingUnitsBL handlingUnitsBL = Services.get(IHandlingUnitsBL.class);
if (handlingUnitsBL.isLoadingUnit(hu))
{
return HuUnitType.LU;
}
else if (handlingUnitsBL.isTransportUnitOrAggregate(hu))
{
return HuUnitType.TU;
}
else if (handlingUnitsBL.isVirtual(hu))
{
return HuUnitType.VHU;
}
else
{
throw new HUException("Unknown HU type: " + hu); // shall hot happen
}
|
}
@Override
public HuId getHUId()
{
return huId;
}
@Override
public BPartnerId getBPartnerId()
{
return bpartnerId;
}
@Override
public HuUnitType getHUUnitType()
{
return huUnitType;
}
@Override
public boolean isTopLevel()
{
return Services.get(IHandlingUnitsBL.class).isTopLevel(hu);
}
@Override
public List<HUToReport> getIncludedHUs()
{
if (_includedHUs == null)
{
final IHandlingUnitsDAO handlingUnitsDAO = Services.get(IHandlingUnitsDAO.class);
this._includedHUs = handlingUnitsDAO.retrieveIncludedHUs(hu)
.stream()
.map(HUToReportWrapper::of)
.collect(ImmutableList.toImmutableList());
}
return _includedHUs;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\report\HUToReportWrapper.java
| 1
|
请完成以下Java代码
|
private long getCurrentSecond() {
long currentSecond = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());
if (currentSecond - epochSeconds > bitsAllocator.getMaxDeltaSeconds()) {
throw new UidGenerateException("Timestamp bits is exhausted. Refusing UID generate. Now: " + currentSecond);
}
return currentSecond;
}
/**
* Setters for spring property
*/
public void setWorkerIdAssigner(WorkerIdAssigner workerIdAssigner) {
this.workerIdAssigner = workerIdAssigner;
}
public void setTimeBits(int timeBits) {
if (timeBits > 0) {
this.timeBits = timeBits;
}
}
|
public void setWorkerBits(int workerBits) {
if (workerBits > 0) {
this.workerBits = workerBits;
}
}
public void setSeqBits(int seqBits) {
if (seqBits > 0) {
this.seqBits = seqBits;
}
}
public void setEpochStr(String epochStr) {
if (StringUtils.isNotBlank(epochStr)) {
this.epochStr = epochStr;
this.epochSeconds = TimeUnit.MILLISECONDS.toSeconds(DateUtils.parseByDayPattern(epochStr).getTime());
}
}
}
|
repos\Spring-Boot-In-Action-master\id-spring-boot-starter\src\main\java\com\baidu\fsg\uid\impl\DefaultUidGenerator.java
| 1
|
请完成以下Java代码
|
public FormService getFormService() {
return formService;
}
@Override
public AuthorizationService getAuthorizationService() {
return authorizationService;
}
@Override
public CaseService getCaseService() {
return caseService;
}
@Override
|
public FilterService getFilterService() {
return filterService;
}
@Override
public ExternalTaskService getExternalTaskService() {
return externalTaskService;
}
@Override
public DecisionService getDecisionService() {
return decisionService;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\ProcessEngineImpl.java
| 1
|
请完成以下Java代码
|
private boolean updateHeaderTax()
{
// Recalculate Tax for this Tax
if (!getParent().isProcessed())
{
if (!updateOrderTax(false))
{
return false;
}
}
// task 08999:
// Avoid a possible deadlock by updating the C_Order *after* the current transaction, because at this point we might already hold a lot of locks to different objects.
// The updates in updateHeader0 will try aggregate and obtain any number of additional shared locks.
// Concrete, we observed a deadlock between this code and M_ReceiptSchedule.propagateQtysToOrderLine()
final ITrxManager trxManager = get_TrxManager();
trxManager.accumulateAndProcessAfterCommit(
"ordersToUpdateHeader",
ImmutableSet.of(OrderId.ofRepoId(getC_Order_ID())),
this::updateHeaderInNewTrx
);
return true;
} // updateHeaderTax
private void updateHeaderInNewTrx(final Collection<OrderId> orderIds)
{
final ITrxManager trxManager = get_TrxManager();
trxManager.runInNewTrx(() -> updateHeaderNow(ImmutableSet.copyOf(orderIds)));
}
private static void updateHeaderNow(final Set<OrderId> orderIds)
{
// shall not happen
if (orderIds.isEmpty())
{
return;
}
// Update Order Header: TotalLines
{
final ArrayList<Object> sqlParams = new ArrayList<>();
final String sql = "UPDATE C_Order o"
+ " SET TotalLines="
+ "(SELECT COALESCE(SUM(ol.LineNetAmt),0) FROM C_OrderLine ol WHERE ol.C_Order_ID=o.C_Order_ID) "
+ "WHERE " + DB.buildSqlList("C_Order_ID", orderIds, sqlParams);
final int no = DB.executeUpdateAndThrowExceptionOnFail(sql, sqlParams.toArray(), ITrx.TRXNAME_ThreadInherited);
|
if (no != 1)
{
new AdempiereException("Updating TotalLines failed for C_Order_IDs=" + orderIds);
}
}
// Update Order Header: GrandTotal
{
final ArrayList<Object> sqlParams = new ArrayList<>();
final String sql = "UPDATE C_Order o "
+ " SET GrandTotal=TotalLines+"
// SUM up C_OrderTax.TaxAmt only for those lines which does not have Tax Included
+ "(SELECT COALESCE(SUM(TaxAmt),0) FROM C_OrderTax ot WHERE o.C_Order_ID=ot.C_Order_ID AND ot.IsActive='Y' AND ot.IsTaxIncluded='N') "
+ "WHERE " + DB.buildSqlList("C_Order_ID", orderIds, sqlParams);
final int no = DB.executeUpdateAndThrowExceptionOnFail(sql, sqlParams.toArray(), ITrx.TRXNAME_ThreadInherited);
if (no != 1)
{
new AdempiereException("Updating GrandTotal failed for C_Order_IDs=" + orderIds);
}
}
}
} // MOrderLine
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\MOrderLine.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public File fileDown(Date fileDate, String dir) throws Exception {
LOG.info("======开始下载支付宝对账单");
// 格式化账单日期
String bill_begin_date = billDateSDF.format(fileDate);
String bill_end_date = billDateSDF.format(DateUtils.addDay(fileDate, 1));
gmt_start_time = bill_begin_date + " 00:00:00";
gmt_end_time = bill_end_date + " 00:00:00";
HttpResponse response = null;
// 把请求参数打包成数组
Map<String, String> sParaTemp = new HashMap<String, String>();
sParaTemp.put("service", "account.page.query");
sParaTemp.put("partner", partner);
sParaTemp.put("_input_charset", charset);
sParaTemp.put("page_no", pageNo);
sParaTemp.put("gmt_start_time", gmt_start_time);
sParaTemp.put("gmt_end_time", gmt_end_time);
response = this.buildRequest(sParaTemp);
if (response == null) {
return null;
}
// 得到支付宝接口返回数据
String stringResult = response.getStringResult();
// 创建保存对账单的本地文件
File file = this.createFile(bill_begin_date, stringResult, dir);
return file;
}
/**
* 建立请求,以模拟远程HTTP的POST请求方式构造并获取支付宝的处理结果
*
* @param sParaTemp
* 请求参数
* @return 支付宝处理结果
* @throws Exception
*/
public HttpResponse buildRequest(Map<String, String> sParaTemp) throws Exception {
// 待请求参数数组
Map<String, String> sPara = AlipaySubmit.buildRequestPara(sParaTemp);
HttpProtocolHandler httpProtocolHandler = HttpProtocolHandler.getInstance();
HttpRequest request = new HttpRequest(HttpResultType.BYTES);
// 设置编码集
request.setCharset(charset);
// 设置请求参数
request.setParameters(AlipaySubmit.generatNameValuePair(sPara));
// 设置请求地址
request.setUrl(url + "_input_charset=" + charset);
// 请求接口
HttpResponse response = httpProtocolHandler.execute(request, "", "");
if (response == null) {
return null;
}
return response;
}
/**
* 创建账单文件
*
* @param bill_date
* 账单日
* @param stringResult
* 文件内容
|
* @param dir
* 文件保存路径
* @return
* @throws IOException
*/
private File createFile(String bill_date, String stringResult, String dir) throws IOException {
// 创建本地文件,用于存储支付宝对账文件
// String dir = "/home/roncoo/app/accountcheck/billfile/alipay";
File file = new File(dir, bill_date + "_" + ".xml");
int index = 1;
// 判断文件是否已经存在
while (file.exists()) {
file = new File(dir, bill_date + "_" + index + ".xml");
index++;
}
// 判断父文件是否存在,不存在就创建
if (!file.getParentFile().exists()) {
if (!file.getParentFile().mkdirs()) {
// 新建文件目录失败,抛异常
throw new IOException("创建文件(父层文件夹)失败, filepath: " + file.getAbsolutePath());
}
}
// 判断文件是否存在,不存在则创建
if (!file.exists()) {
if (!file.createNewFile()) {
// 新建文件失败,抛异常
throw new IOException("创建文件失败, filepath: " + file.getAbsolutePath());
}
}
try {
// 把支付宝返回数据写入文件
FileWriter fileWriter = new FileWriter(file);
fileWriter.write(stringResult);
fileWriter.close(); // 关闭数据流
} catch (IOException e) {
LOG.info("把支付宝返回的对账数据写入文件异常:" + e);
}
return file;
}
}
|
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\reconciliation\fileDown\impl\AlipayFileDown.java
| 2
|
请完成以下Java代码
|
public <T> T unwrap(Class<T> iface) throws SQLException {
if (iface.isInstance(this)) {
return (T) this;
}
throw new SQLException("Cannot unwrap " + getClass().getName() + " as an instance of " + iface.getName());
}
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return iface.isInstance(this);
}
public Map<Object, DataSource> getDataSources() {
return dataSources;
}
public void setDataSources(Map<Object, DataSource> dataSources) {
|
this.dataSources = dataSources;
}
// Unsupported //////////////////////////////////////////////////////////
public PrintWriter getLogWriter() throws SQLException {
throw new UnsupportedOperationException();
}
public void setLogWriter(PrintWriter out) throws SQLException {
throw new UnsupportedOperationException();
}
public void setLoginTimeout(int seconds) throws SQLException {
throw new UnsupportedOperationException();
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\cfg\multitenant\TenantAwareDataSource.java
| 1
|
请完成以下Java代码
|
public void setAD_Image_ID (int AD_Image_ID)
{
if (AD_Image_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_Image_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_Image_ID, Integer.valueOf(AD_Image_ID));
}
/** Get Image.
@return Image or Icon
*/
public int getAD_Image_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Image_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set BinaryData.
@param BinaryData
Binary Data
*/
public void setBinaryData (byte[] BinaryData)
{
set_Value (COLUMNNAME_BinaryData, BinaryData);
}
/** Get BinaryData.
@return Binary Data
*/
public byte[] getBinaryData ()
{
return (byte[])get_Value(COLUMNNAME_BinaryData);
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** EntityType AD_Reference_ID=389 */
public static final int ENTITYTYPE_AD_Reference_ID=389;
/** Set Entity Type.
@param EntityType
Dictionary Entity Type; Determines ownership and synchronization
*/
public void setEntityType (String EntityType)
{
set_Value (COLUMNNAME_EntityType, EntityType);
}
/** Get Entity Type.
@return Dictionary Entity Type; Determines ownership and synchronization
*/
public String getEntityType ()
{
return (String)get_Value(COLUMNNAME_EntityType);
}
/** Set Image URL.
|
@param ImageURL
URL of image
*/
public void setImageURL (String ImageURL)
{
set_Value (COLUMNNAME_ImageURL, ImageURL);
}
/** Get Image URL.
@return URL of image
*/
public String getImageURL ()
{
return (String)get_Value(COLUMNNAME_ImageURL);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Image.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
}
@ApiModelProperty(example = "The One Channel")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@ApiModelProperty(example = "inbound", allowableValues = "inbound,outbound")
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@ApiModelProperty(example = "kafka")
public String getImplementation() {
return implementation;
}
public void setImplementation(String implementation) {
this.implementation = implementation;
}
@ApiModelProperty(example = "2010-10-13T14:54:26.750+02:00")
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@ApiModelProperty(example = "null")
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
@ApiModelProperty(example = "2")
public String getDeploymentId() {
return deploymentId;
}
public void setDeploymentId(String deploymentId) {
this.deploymentId = deploymentId;
}
@ApiModelProperty(example = "http://localhost:8182/event-registry-repository/deployments/2")
public String getDeploymentUrl() {
return deploymentUrl;
|
}
public void setDeploymentUrl(String deploymentUrl) {
this.deploymentUrl = deploymentUrl;
}
@ApiModelProperty(example = "Examples")
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public void setResource(String resource) {
this.resource = resource;
}
@ApiModelProperty(example = "oneChannel.channel")
public String getResourceName() {
return resourceName;
}
public void setResourceName(String resourceName) {
this.resourceName = resourceName;
}
@ApiModelProperty(example = "http://localhost:8182/event-registry-repository/deployments/2/resources/oneChannel.channel", value = "Contains the actual deployed channel definition JSON.")
public String getResource() {
return resource;
}
@ApiModelProperty(example = "This is a channel definition for testing purposes")
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
|
repos\flowable-engine-main\modules\flowable-event-registry-rest\src\main\java\org\flowable\eventregistry\rest\service\api\repository\ChannelDefinitionResponse.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class BatchConfig {
@Bean
public FlatFileItemReader<Customer> customerReader() {
return new FlatFileItemReaderBuilder<Customer>().name("customerItemReader")
.resource(new ClassPathResource("customers.csv"))
.delimited()
.names("id", "name", "email", "type")
.linesToSkip(1)
.fieldSetMapper(new BeanWrapperFieldSetMapper<>() {{
setTargetType(Customer.class);
}})
.build();
}
@Bean
public TypeAProcessor typeAProcessor() {
return new TypeAProcessor();
}
@Bean
public TypeBProcessor typeBProcessor() {
return new TypeBProcessor();
}
@Bean
public CustomerProcessorRouter processorRouter(TypeAProcessor typeAProcessor, TypeBProcessor typeBProcessor) {
return new CustomerProcessorRouter(typeAProcessor, typeBProcessor);
}
@Bean
public JpaItemWriter<Customer> jpaDBWriter(EntityManagerFactory entityManagerFactory) {
JpaItemWriter<Customer> writer = new JpaItemWriter<>();
writer.setEntityManagerFactory(entityManagerFactory);
return writer;
}
@Bean
public FlatFileItemWriter<Customer> fileWriter() {
return new FlatFileItemWriterBuilder<Customer>().name("customerItemWriter")
.resource(new FileSystemResource("output/processed_customers.txt"))
.delimited()
|
.delimiter(",")
.names("id", "name", "email", "type")
.build();
}
@Bean
public CompositeItemWriter<Customer> compositeWriter(JpaItemWriter<Customer> jpaDBWriter, FlatFileItemWriter<Customer> fileWriter) {
return new CompositeItemWriterBuilder<Customer>().delegates(List.of(jpaDBWriter, fileWriter))
.build();
}
@Bean
public Step processCustomersStep(JobRepository jobRepository, PlatformTransactionManager transactionManager, FlatFileItemReader<Customer> reader,
CustomerProcessorRouter processorRouter, CompositeItemWriter<Customer> compositeWriter) {
return new StepBuilder("processCustomersStep", jobRepository).<Customer, Customer> chunk(10, transactionManager)
.reader(reader)
.processor(processorRouter)
.writer(compositeWriter)
.build();
}
@Bean
public Job processCustomersJob(JobRepository jobRepository, Step processCustomersStep) {
return new JobBuilder("customerProcessingJob", jobRepository).start(processCustomersStep)
.build();
}
}
|
repos\tutorials-master\spring-batch-2\src\main\java\com\baeldung\multiprocessorandwriter\config\BatchConfig.java
| 2
|
请完成以下Java代码
|
public boolean isEqual()
{
return isEqual;
}
/**
* Checks and casts <code>other</code> to same class as <code>obj</code>.
*
* This method shall be used as first statement in an {@link Object#equals(Object)} implementation. <br/>
* <br/>
* Example:
*
* <pre>
* public boolean equals(Object obj)
* {
* if (this == obj)
* {
* return true;
* }
* final MyClass other = EqualsBuilder.getOther(this, obj);
* if (other == null)
* {
* return false;
* }
*
* return new EqualsBuilder()
* .append(prop1, other.prop1)
* .append(prop2, other.prop2)
* .append(prop3, other.prop3)
* // ....
* .isEqual();
* }
* </pre>
*
* @param thisObj this object
* @param obj other object
* @return <code>other</code> casted to same class as <code>obj</code> or null if <code>other</code> is null or does not have the same class
*/
public static <T> T getOther(final T thisObj, final Object obj)
|
{
if (thisObj == null)
{
throw new IllegalArgumentException("obj is null");
}
if (thisObj == obj)
{
@SuppressWarnings("unchecked")
final T otherCasted = (T)obj;
return otherCasted;
}
if (obj == null)
{
return null;
}
if (thisObj.getClass() != obj.getClass())
{
return null;
}
@SuppressWarnings("unchecked")
final T otherCasted = (T)obj;
return otherCasted;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\org\adempiere\util\lang\EqualsBuilder.java
| 1
|
请完成以下Java代码
|
private Comparator<OLCand> createColumnOrderingComparator(final OLCandAggregationColumn column)
{
return new OLCandColumnOrderingComparator(column);
}
private static final class NopOrderingComparator implements Comparator<OLCand>
{
@Override
public int compare(final OLCand o1, final OLCand o2)
{
return 0;
}
}
private static final class OLCandColumnOrderingComparator implements Comparator<OLCand>
{
private final OLCandAggregationColumn column;
private OLCandColumnOrderingComparator(@NonNull final OLCandAggregationColumn column)
{
this.column = column;
}
@Override
public int compare(final OLCand o1, final OLCand o2)
{
final Object val1 = o1.getValueByColumn(column);
final Object val2 = o2.getValueByColumn(column);
// allow null values
if (val1 == val2)
{
return 0;
}
if (val1 == null)
{
return -1;
|
}
if (val2 == null)
{
return 1;
}
Check.assume(val1.getClass() == val2.getClass(), "{} and {} have the same class", val1, val2);
final Comparable<Object> comparableVal1 = toComparable(val1);
final Comparable<Object> comparableVal2 = toComparable(val2);
return comparableVal1.compareTo(comparableVal2);
}
@SuppressWarnings("unchecked")
private Comparable<Object> toComparable(final Object value)
{
return (Comparable<Object>)value;
}
}
@NonNull
public String computeHeaderAggregationKey(@NonNull final OLCand olCand)
{
return getOrderByColumns()
.stream()
.map(olCand::getValueByColumn)
.map(String::valueOf)
.collect(Collectors.joining(OrderCandidate_Constants.HEADER_AGGREGATION_KEY_DELIMITER));
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.salescandidate.base\src\main\java\de\metas\ordercandidate\api\OLCandAggregation.java
| 1
|
请完成以下Java代码
|
public class PasswordPolicyResultImpl implements PasswordPolicyResult {
protected List<PasswordPolicyRule> violatedRules;
protected List<PasswordPolicyRule> fulfilledRules;
public PasswordPolicyResultImpl(List<PasswordPolicyRule> violatedRules, List<PasswordPolicyRule> fulfilledRules) {
this.violatedRules = violatedRules;
this.fulfilledRules = fulfilledRules;
}
public boolean isValid() {
return violatedRules == null || violatedRules.size() == 0;
}
public List<PasswordPolicyRule> getViolatedRules() {
|
return violatedRules;
}
public void setViolatedRules(List<PasswordPolicyRule> violatedRules) {
this.violatedRules = violatedRules;
}
public List<PasswordPolicyRule> getFulfilledRules() {
return fulfilledRules;
}
public void setFulfilledRules(List<PasswordPolicyRule> fulfilledRules) {
this.fulfilledRules = fulfilledRules;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\identity\PasswordPolicyResultImpl.java
| 1
|
请完成以下Java代码
|
public void setGraceDays (final int GraceDays)
{
set_Value (COLUMNNAME_GraceDays, GraceDays);
}
@Override
public int getGraceDays()
{
return get_ValueAsInt(COLUMNNAME_GraceDays);
}
@Override
public void setIsValid (final boolean IsValid)
{
set_Value (COLUMNNAME_IsValid, IsValid);
}
@Override
public boolean isValid()
{
return get_ValueAsBoolean(COLUMNNAME_IsValid);
}
/**
* NetDay AD_Reference_ID=167
* Reference name: Weekdays
*/
public static final int NETDAY_AD_Reference_ID=167;
/** Sunday = 7 */
public static final String NETDAY_Sunday = "7";
/** Monday = 1 */
public static final String NETDAY_Monday = "1";
/** Tuesday = 2 */
public static final String NETDAY_Tuesday = "2";
/** Wednesday = 3 */
public static final String NETDAY_Wednesday = "3";
/** Thursday = 4 */
public static final String NETDAY_Thursday = "4";
/** Friday = 5 */
public static final String NETDAY_Friday = "5";
/** Saturday = 6 */
public static final String NETDAY_Saturday = "6";
@Override
public void setNetDay (final @Nullable java.lang.String NetDay)
{
set_Value (COLUMNNAME_NetDay, NetDay);
}
@Override
|
public java.lang.String getNetDay()
{
return get_ValueAsString(COLUMNNAME_NetDay);
}
@Override
public void setNetDays (final int NetDays)
{
set_Value (COLUMNNAME_NetDays, NetDays);
}
@Override
public int getNetDays()
{
return get_ValueAsInt(COLUMNNAME_NetDays);
}
@Override
public void setPercentage (final BigDecimal Percentage)
{
set_Value (COLUMNNAME_Percentage, Percentage);
}
@Override
public BigDecimal getPercentage()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Percentage);
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_PaySchedule.java
| 1
|
请完成以下Java代码
|
class PreviewPanel extends CPanel
{
/**
*
*/
private static final long serialVersionUID = 6028614986952449622L;
private boolean capture = true;
private LookAndFeel laf = null;
private MetalTheme theme = null;
private BufferedImage image;
@Override
public void paint(Graphics g)
{
if (capture) {
//capture preview image
image = (BufferedImage)createImage(this.getWidth(),this.getHeight());
super.paint(image.createGraphics());
g.drawImage(image, 0, 0, null);
capture = false;
if (laf != null)
{
//reset to original setting
if (laf instanceof MetalLookAndFeel)
AdempierePLAF.setCurrentMetalTheme((MetalLookAndFeel)laf, theme);
try {
UIManager.setLookAndFeel(laf);
} catch (UnsupportedLookAndFeelException e) {
|
}
laf = null;
theme = null;
}
} else {
//draw captured preview image
if (image != null)
g.drawImage(image, 0, 0, null);
}
}
/**
* Refresh look and feel preview, reset to original setting after
* refresh.
* @param currentLaf Current Look and feel
* @param currentTheme Current Theme
*/
void refresh(LookAndFeel currentLaf, MetalTheme currentTheme)
{
this.laf = currentLaf;
this.theme = currentTheme;
capture = true;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\adempiere\plaf\PLAFEditorPanel.java
| 1
|
请完成以下Java代码
|
public boolean hasNextPartition() {
return isDesc() ? partitionIndex >= 0 : partitionIndex <= partitions.size() - 1;
}
public boolean isFull() {
return currentLimit <= 0;
}
@Override
public long getNextPartition() {
long partition = partitions.get(partitionIndex);
if (isDesc()) {
partitionIndex--;
} else {
partitionIndex++;
}
|
return partition;
}
public int getCurrentLimit() {
return currentLimit;
}
public void addData(List<TsKvEntry> newData) {
currentLimit -= newData.size();
data.addAll(newData);
}
private boolean isDesc() {
return orderBy.equals(DESC_ORDER);
}
}
|
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\timeseries\TsKvQueryCursor.java
| 1
|
请完成以下Java代码
|
public class DefaultOperationMethod implements OperationMethod {
private static final ParameterNameDiscoverer DEFAULT_PARAMETER_NAME_DISCOVERER = new DefaultParameterNameDiscoverer();
private final Method method;
private final OperationParameters operationParameters;
/**
* Create a new {@link DefaultOperationMethod} instance.
* @param method the source method
*/
public DefaultOperationMethod(Method method) {
Objects.requireNonNull(method, "Method must not be null");
this.method = method;
this.operationParameters = new OperationMethodParameters(method, DEFAULT_PARAMETER_NAME_DISCOVERER);
}
/**
* Return the source Java method.
* @return the method
*/
|
@Override
public Method getMethod() {
return this.method;
}
/**
* Return the operation parameters.
* @return the operation parameters
*/
@Override
public OperationParameters getParameters() {
return this.operationParameters;
}
@Override
public String toString() {
return "Operation method " + this.method;
}
}
|
repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webmvc\src\main\java\org\springframework\cloud\gateway\server\mvc\invoke\reflect\DefaultOperationMethod.java
| 1
|
请完成以下Java代码
|
public static void updateSession(HttpSession session, Authentications authentications) {
if (session != null) {
session.setAttribute(CAM_AUTH_SESSION_KEY, authentications);
}
}
/**
* <p>Update/remove authentications when cache validation time (= x + TTL) is due.
*
* <p>The following information is updated:<ul>
* <li>{@code groupIds}
* <li>{@code tenantIds}
* <li>{@code authorizedApps}
*
* <p>An authorization is only removed if the user doesn't exist anymore (user was deleted).
*/
public static void updateCache(Authentications authentications,
HttpSession session,
long cacheTimeToLive) {
synchronized (getSessionMutex(session)) {
for (UserAuthentication authentication : authentications.getAuthentications()) {
Date cacheValidationTime = authentication.getCacheValidationTime();
if (cacheValidationTime == null ||
ClockUtil.getCurrentTime().after(cacheValidationTime)) {
String userId = authentication.getIdentityId();
String engineName = authentication.getProcessEngineName();
UserAuthentication updatedAuth = createAuthentication(engineName, userId);
if (updatedAuth != null) {
if (cacheTimeToLive > 0) {
Date newCacheValidationTime = new Date(ClockUtil.getCurrentTime().getTime() + cacheTimeToLive);
updatedAuth.setCacheValidationTime(newCacheValidationTime);
LOGGER.traceCacheValidationTimeUpdated(cacheValidationTime, newCacheValidationTime);
}
LOGGER.traceAuthenticationUpdated(engineName);
authentications.addOrReplace(updatedAuth);
} else {
|
authentications.removeByEngineName(engineName);
LOGGER.traceAuthenticationRemoved(engineName);
}
}
}
}
}
/**
* <p>Returns the session mutex to synchronize on.
* <p>Avoids updating the auth cache by multiple HTTP requests in parallel.
*/
protected static Object getSessionMutex(HttpSession session) {
Object mutex = session.getAttribute(AUTH_TIME_SESSION_MUTEX);
if (mutex == null) {
mutex = session; // synchronize on session if session mutex doesn't exist
}
return mutex;
}
}
|
repos\camunda-bpm-platform-master\webapps\assembly\src\main\java\org\camunda\bpm\webapp\impl\security\auth\AuthenticationUtil.java
| 1
|
请完成以下Java代码
|
default boolean isAnyComponentIssue(final I_PP_Cost_Collector cc)
{
final CostCollectorType costCollectorType = CostCollectorType.ofCode(cc.getCostCollectorType());
final PPOrderBOMLineId orderBOMLineId = PPOrderBOMLineId.ofRepoIdOrNull(cc.getPP_Order_BOMLine_ID());
return costCollectorType.isAnyComponentIssue(orderBOMLineId);
}
default boolean isAnyComponentIssueOrCoProduct(final I_PP_Cost_Collector cc)
{
final CostCollectorType costCollectorType = CostCollectorType.ofCode(cc.getCostCollectorType());
final PPOrderBOMLineId orderBOMLineId = PPOrderBOMLineId.ofRepoIdOrNull(cc.getPP_Order_BOMLine_ID());
return costCollectorType.isAnyComponentIssueOrCoProduct(orderBOMLineId);
}
/**
* Create and process material issue cost collector. The given qtys are converted to the UOM of the given <code>orderBOMLine</code>. The Cost collector's type is determined from the given
* <code>orderBOMLine</code> alone.
* <p>
* Note that this method is also used internally to handle the case of a "co-product receipt".
*
* @return processed cost collector
*/
I_PP_Cost_Collector createIssue(ComponentIssueCreateRequest request);
/**
* Create Receipt (finished good or co/by-products). If the given <code>candidate</code>'s {@link PP_Order_BOMLine} is not <code>!= null</code>, then a finished product receipt is created.
* Otherwise a co-product receipt is created. Note that under the hood a co-product receipt is a "negative issue".
*
* @param candidate the candidate to create the receipt from.
*
* @return processed cost collector
*/
I_PP_Cost_Collector createReceipt(ReceiptCostCollectorCandidate candidate);
void createActivityControl(ActivityControlCreateRequest request);
|
void createMaterialUsageVariance(I_PP_Order ppOrder, I_PP_Order_BOMLine line);
void createResourceUsageVariance(I_PP_Order ppOrder, PPOrderRoutingActivity activity);
/**
* Checks if given cost collector is a reversal.
*
* We consider given cost collector as a reversal if it's ID is bigger then the Reversal_ID.
*
* @param cc cost collector
* @return true if given cost collector is actually a reversal.
*/
boolean isReversal(I_PP_Cost_Collector cc);
boolean isFloorStock(I_PP_Cost_Collector cc);
void updateCostCollectorFromOrder(I_PP_Cost_Collector cc, I_PP_Order order);
List<I_PP_Cost_Collector> getByOrderId(PPOrderId ppOrderId);
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\api\IPPCostCollectorBL.java
| 1
|
请完成以下Java代码
|
private boolean isProcessedByFutureEvent(final I_PMM_Week aggregate, final I_PMM_WeekReport_Event currentEvent)
{
if (aggregate == null)
{
return false;
}
final int lastEventId = aggregate.getLast_WeekReport_Event_ID();
if (lastEventId > currentEvent.getPMM_WeekReport_Event_ID())
{
return true;
}
return false;
}
/**
* Create an planning {@link I_PMM_QtyReport_Event}, for 2 weeks ago.
* <p>
* The main reason for doing this is because when the user is reporting a trend, we want to see that trend in PMM Purchase Candidates window. So we are creating an ZERO planning QtyReport event
* which will trigger the candidate creation if is not already there. And yes, we report for 2 weeks ago because in the candidates window we display the planning for next 2 weeks.
*
* @task FRESH-167
*/
private final void createWeeklyPlanningQtyReportEvents(final I_PMM_WeekReport_Event weekReportEvent)
{
final Timestamp dateWeek = TimeUtil.trunc(weekReportEvent.getWeekDate(), TimeUtil.TRUNC_WEEK);
final Timestamp dateTwoWeeksAgo = TimeUtil.addDays(dateWeek, -2 * 7);
final SyncProductSupply syncProductSupply_TwoWeeksAgo = SyncProductSupply.builder()
.bpartner_uuid(SyncUUIDs.toUUIDString(weekReportEvent.getC_BPartner()))
.product_uuid(SyncUUIDs.toUUIDString(weekReportEvent.getPMM_Product()))
.contractLine_uuid(null) // unknown
.qty(BigDecimal.ZERO)
.weekPlanning(true)
.day(TimeUtil.asLocalDate(dateTwoWeeksAgo))
.build();
Services.get(IServerSyncBL.class).reportProductSupplies(PutProductSuppliesRequest.of(syncProductSupply_TwoWeeksAgo));
}
private void markError(
@NonNull final I_PMM_WeekReport_Event event,
|
@NonNull final Exception e)
{
event.setProcessed(true);
final AdempiereException metasfreshException = AdempiereException.wrapIfNeeded(e);
final String errorMsg = CoalesceUtil.firstNotEmptyTrimmed(metasfreshException.getLocalizedMessage(), metasfreshException.getMessage());
event.setErrorMsg(errorMsg);
final AdIssueId issueId = Services.get(IErrorManager.class).createIssue(metasfreshException);
event.setAD_Issue_ID(issueId.getRepoId());
InterfaceWrapperHelper.save(event);
Loggables.addLog("Event has error with message: {}; event={}", errorMsg, event);
}
public String getProcessSummary()
{
return "@Processed@ #" + countProcessed.get() + ", @Skipped@ #" + countSkipped.get();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.procurement.base\src\main\java\de\metas\procurement\base\event\impl\PMMWeekReportEventTrxItemProcessor.java
| 1
|
请完成以下Java代码
|
public class CompositeAttributeValueListener implements IAttributeValueListener
{
private final List<IAttributeValueListener> listeners = new ArrayList<IAttributeValueListener>();
public void addAttributeValueListener(final IAttributeValueListener listener)
{
Check.assumeNotNull(listener, "listener not null");
if (listeners.contains(listener))
{
return;
}
listeners.add(listener);
}
public void removeAttributeValueListener(final IAttributeValueListener listener)
{
listeners.remove(listener);
}
|
@Override
public void onValueChanged(final IAttributeValueContext attributeValueContext, final IAttributeValue attributeValue, final Object valueOld, final Object valueNew)
{
for (final IAttributeValueListener listener : listeners)
{
listener.onValueChanged(attributeValueContext, attributeValue, valueOld, valueNew);
}
}
@Override
public String toString()
{
return "CompositeAttributeValueListener [listeners=" + listeners + "]";
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\attribute\impl\CompositeAttributeValueListener.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void setTime(Date time) {
this.time = time;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getTaskUrl() {
return taskUrl;
}
public void setTaskUrl(String taskUrl) {
this.taskUrl = taskUrl;
|
}
public String getProcessInstanceId() {
return processInstanceId;
}
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
public String getProcessInstanceUrl() {
return processInstanceUrl;
}
public void setProcessInstanceUrl(String processInstanceUrl) {
this.processInstanceUrl = processInstanceUrl;
}
}
|
repos\flowable-engine-main\modules\flowable-rest\src\main\java\org\flowable\rest\service\api\engine\CommentResponse.java
| 2
|
请完成以下Java代码
|
public BigDecimal getInvoicedAmt()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_InvoicedAmt);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setInvoicedQty (final BigDecimal InvoicedQty)
{
set_Value (COLUMNNAME_InvoicedQty, InvoicedQty);
}
@Override
public BigDecimal getInvoicedQty()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_InvoicedQty);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setIsPrinted (final boolean IsPrinted)
{
set_Value (COLUMNNAME_IsPrinted, IsPrinted);
}
@Override
public boolean isPrinted()
{
return get_ValueAsBoolean(COLUMNNAME_IsPrinted);
}
@Override
public void setLine (final int Line)
{
set_Value (COLUMNNAME_Line, Line);
}
@Override
public int getLine()
{
return get_ValueAsInt(COLUMNNAME_Line);
}
@Override
public void setM_Product_Category_ID (final int M_Product_Category_ID)
{
if (M_Product_Category_ID < 1)
set_Value (COLUMNNAME_M_Product_Category_ID, null);
else
set_Value (COLUMNNAME_M_Product_Category_ID, M_Product_Category_ID);
}
@Override
public int getM_Product_Category_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_Category_ID);
}
@Override
public void 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 setPlannedAmt (final BigDecimal PlannedAmt)
{
set_Value (COLUMNNAME_PlannedAmt, PlannedAmt);
}
@Override
public BigDecimal getPlannedAmt()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PlannedAmt);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setPlannedMarginAmt (final BigDecimal PlannedMarginAmt)
|
{
set_Value (COLUMNNAME_PlannedMarginAmt, PlannedMarginAmt);
}
@Override
public BigDecimal getPlannedMarginAmt()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PlannedMarginAmt);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setPlannedPrice (final BigDecimal PlannedPrice)
{
set_Value (COLUMNNAME_PlannedPrice, PlannedPrice);
}
@Override
public BigDecimal getPlannedPrice()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PlannedPrice);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setPlannedQty (final BigDecimal PlannedQty)
{
set_Value (COLUMNNAME_PlannedQty, PlannedQty);
}
@Override
public BigDecimal getPlannedQty()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PlannedQty);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setProcessed (final boolean Processed)
{
set_Value (COLUMNNAME_Processed, Processed);
}
@Override
public boolean isProcessed()
{
return get_ValueAsBoolean(COLUMNNAME_Processed);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_ProjectLine.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public PickingJob executeAndGetSingleResult()
{
if (initialPickingJobs.size() != 1)
{
throw new AdempiereException(ONLY_ONE_PICKING_JOB_ERROR_MSG);
}
final ImmutableList<PickingJob> result = execute();
return CollectionUtils.singleElement(result);
}
public ImmutableList<PickingJob> execute()
{
initialPickingJobs.forEach(PickingJob::assertNotProcessed);
final boolean isAbortAllowed = initialPickingJobs.stream().allMatch(PickingJob::isAllowAbort);
if (!isAbortAllowed)
{
throw new AdempiereException(ABORT_IS_NOT_ALLOWED);
}
return trxManager.callInThreadInheritedTrx(this::executeInTrx);
}
private ImmutableList<PickingJob> executeInTrx()
{
final ImmutableList.Builder<PickingJob> result = ImmutableList.builder();
for (final PickingJob initialPickingJob : initialPickingJobs)
{
final PickingJob pickingJob = execute(initialPickingJob);
result.add(pickingJob);
}
return result.build();
}
private PickingJob execute(@NonNull final PickingJob initialPickingJob)
{
//noinspection OptionalGetWithoutIsPresent
return Stream.of(initialPickingJob)
.sequential()
.map(this::releasePickingSlotAndSave)
// NOTE: abort is not "reversing", so we don't have to reverse (unpick) what we picked.
// Even more, imagine that those picked things are already phisically splitted out.
//.map(this::unpickAllStepsAndSave)
.peek(huService::releaseAllReservations)
.peek(pickingJobLockService::unlockSchedules)
.map(this::markAsVoidedAndSave)
.findFirst()
.get();
}
private PickingJob markAsVoidedAndSave(PickingJob pickingJob)
{
pickingJob = pickingJob.withDocStatus(PickingJobDocStatus.Voided);
pickingJobRepository.save(pickingJob);
return pickingJob;
|
}
// private PickingJob unpickAllStepsAndSave(final PickingJob pickingJob)
// {
// return PickingJobUnPickCommand.builder()
// .pickingJobRepository(pickingJobRepository)
// .pickingCandidateService(pickingCandidateService)
// .pickingJob(pickingJob)
// .build()
// .execute();
// }
private PickingJob releasePickingSlotAndSave(PickingJob pickingJob)
{
final PickingJobId pickingJobId = pickingJob.getId();
final PickingSlotId pickingSlotId = pickingJob.getPickingSlotId().orElse(null);
if (pickingSlotId != null)
{
pickingJob = pickingJob.withPickingSlot(null);
pickingJobRepository.save(pickingJob);
pickingSlotService.release(pickingSlotId, pickingJobId);
}
return pickingJob;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\job\service\commands\PickingJobAbortCommand.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public Builder setAD_Language(final String AD_Language)
{
this.AD_Language = AD_Language;
return this;
}
public Builder setOutputType(final OutputType outputType)
{
this.outputType = outputType;
return this;
}
public Builder setType(@NonNull final ProcessType type)
{
this.type = type;
return this;
}
public Builder setJSONPath(final String JSONPath)
{
this.JSONPath = JSONPath;
return this;
}
public Builder setRecord(final int AD_Table_ID, final int Record_ID)
{
this.AD_Table_ID = AD_Table_ID;
this.Record_ID = Record_ID;
return this;
}
public Builder setReportTemplatePath(final String reportTemplatePath)
{
this.reportTemplatePath = reportTemplatePath;
return this;
}
public Builder setSQLStatement(final String sqlStatement)
{
this.sqlStatement = sqlStatement;
return this;
}
public Builder setApplySecuritySettings(final boolean applySecuritySettings)
{
this.applySecuritySettings = applySecuritySettings;
return this;
}
private ImmutableList<ProcessInfoParameter> getProcessInfoParameters()
|
{
return Services.get(IADPInstanceDAO.class).retrieveProcessInfoParameters(pinstanceId)
.stream()
.map(this::transformProcessInfoParameter)
.collect(ImmutableList.toImmutableList());
}
private ProcessInfoParameter transformProcessInfoParameter(final ProcessInfoParameter piParam)
{
//
// Corner case: REPORT_SQL_QUERY
// => replace @AD_PInstance_ID@ placeholder with actual value
if (ReportConstants.REPORT_PARAM_SQL_QUERY.equals(piParam.getParameterName()))
{
final String parameterValue = piParam.getParameterAsString();
if (parameterValue != null)
{
final String parameterValueEffective = parameterValue.replace(ReportConstants.REPORT_PARAM_SQL_QUERY_AD_PInstance_ID_Placeholder, String.valueOf(pinstanceId.getRepoId()));
return ProcessInfoParameter.of(ReportConstants.REPORT_PARAM_SQL_QUERY, parameterValueEffective);
}
}
//
// Default: don't touch the original parameter
return piParam;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.report\metasfresh-report-service\src\main\java\de\metas\report\server\ReportContext.java
| 2
|
请完成以下Java代码
|
public static <T> List<List<T>> partition(List<T> list, final int partitionSize) {
List<List<T>> parts = new ArrayList<>();
final int listSize = list.size();
if (listSize <= partitionSize) {
// no need for partitioning
parts.add(list);
} else {
for (int i = 0; i < listSize; i += partitionSize) {
parts.add(new ArrayList<>(list.subList(i, Math.min(listSize, i + partitionSize))));
}
}
return parts;
}
public static <T> List<T> collectInList(Iterator<T> iterator) {
List<T> result = new ArrayList<>();
while (iterator.hasNext()) {
result.add(iterator.next());
}
|
return result;
}
public static <T> T getLastElement(final Iterable<T> elements) {
T lastElement = null;
if (elements instanceof List) {
return ((List<T>) elements).get(((List<T>) elements).size() - 1);
}
for (T element : elements) {
lastElement = element;
}
return lastElement;
}
public static boolean isEmpty(Collection<?> collection) {
return collection == null || collection.isEmpty();
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\util\CollectionUtil.java
| 1
|
请完成以下Java代码
|
public MapDelegateVariableContainer addTransientVariable(String key, Object variable) {
setTransientVariable(key, variable);
return this;
}
/**
* Clears all transient variables of this variable container (not touching the delegate).
*/
public void clearTransientVariables() {
this.transientVariables.clear();
}
/**
* @return all available transient variables
*/
public Map<String, Object> getTransientVariables(){
return this.transientVariables;
}
public MapDelegateVariableContainer removeTransientVariable(String key){
this.transientVariables.remove(key);
return this;
}
@Override
public String getTenantId() {
return this.delegate.getTenantId();
}
|
@Override
public Set<String> getVariableNames() {
if (delegate == null || delegate == VariableContainer.empty()) {
return this.transientVariables.keySet();
}
if (transientVariables.isEmpty()) {
return delegate.getVariableNames();
}
Set<String> keys = new LinkedHashSet<>(delegate.getVariableNames());
keys.addAll(transientVariables.keySet());
return keys;
}
@Override
public String toString() {
return new StringJoiner(", ", getClass().getSimpleName() + "[", "]")
.add("delegate=" + delegate)
.add("tenantId=" + getTenantId())
.toString();
}
}
|
repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\variable\MapDelegateVariableContainer.java
| 1
|
请完成以下Spring Boot application配置
|
spring:
application:
name: user-service # 服务名
# Zipkin 配置项,对应 ZipkinProperties 类
zipkin:
base-url: http://127.0.0.1:9411 # Zipkin 服务的地址
# Spring Cloud Sleuth 配置项
sleuth:
# Spring Cloud Sleuth 针对 Web 组件的配置项,例如说 SpringMVC
web:
enabled: true # 是否开启,默认为 true
# datasource 数据源配置内容
datasource:
url: jdbc:mysql://127.0.0.1:3306/lab-39-mysql?useSSL=false&useUnicode=true&characterEncod
|
ing=UTF-8&statementInterceptors=brave.mysql.TracingStatementInterceptor&zipkinServiceName=demo-db-mysql
driver-class-name: com.mysql.jdbc.Driver
username: root
password:
|
repos\SpringBoot-Labs-master\labx-13\labx-13-sc-sleuth-db-mysql\src\main\resources\application.yml
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public boolean updatePassword(Long userId, String oldPassword, String newPassword, String newPassword1) {
User user = getById(userId);
if (!newPassword.equals(newPassword1)) {
throw new ServiceException("请输入正确的确认密码!");
}
if (!user.getPassword().equals(DigestUtil.encrypt(oldPassword))) {
throw new ServiceException("原密码不正确!");
}
return this.update(Wrappers.<User>update().lambda().set(User::getPassword, DigestUtil.encrypt(newPassword)).eq(User::getId, userId));
}
@Override
public List<String> getRoleName(String roleIds) {
return baseMapper.getRoleName(Func.toStrArray(roleIds));
}
@Override
public List<String> getDeptName(String deptIds) {
return baseMapper.getDeptName(Func.toStrArray(deptIds));
}
@Override
public void importUser(List<UserExcel> data) {
data.forEach(userExcel -> {
User user = Objects.requireNonNull(BeanUtil.copyProperties(userExcel, User.class));
// 设置部门ID
user.setDeptId(sysClient.getDeptIds(userExcel.getTenantId(), userExcel.getDeptName()));
// 设置岗位ID
user.setPostId(sysClient.getPostIds(userExcel.getTenantId(), userExcel.getPostName()));
// 设置角色ID
user.setRoleId(sysClient.getRoleIds(userExcel.getTenantId(), userExcel.getRoleName()));
// 设置默认密码
user.setPassword(CommonConstant.DEFAULT_PASSWORD);
this.submit(user);
});
}
@Override
public List<UserExcel> exportUser(Wrapper<User> queryWrapper) {
List<UserExcel> userList = baseMapper.exportUser(queryWrapper);
userList.forEach(user -> {
user.setRoleName(StringUtil.join(sysClient.getRoleNames(user.getRoleId())));
user.setDeptName(StringUtil.join(sysClient.getDeptNames(user.getDeptId())));
|
user.setPostName(StringUtil.join(sysClient.getPostNames(user.getPostId())));
});
return userList;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean registerGuest(User user, Long oauthId) {
R<Tenant> result = sysClient.getTenant(user.getTenantId());
Tenant tenant = result.getData();
if (!result.isSuccess() || tenant == null || tenant.getId() == null) {
throw new ServiceException("租户信息错误!");
}
UserOauth userOauth = userOauthService.getById(oauthId);
if (userOauth == null || userOauth.getId() == null) {
throw new ServiceException("第三方登陆信息错误!");
}
user.setRealName(user.getName());
user.setAvatar(userOauth.getAvatar());
user.setRoleId(MINUS_ONE);
user.setDeptId(MINUS_ONE);
user.setPostId(MINUS_ONE);
boolean userTemp = this.submit(user);
userOauth.setUserId(user.getId());
userOauth.setTenantId(user.getTenantId());
boolean oauthTemp = userOauthService.updateById(userOauth);
return (userTemp && oauthTemp);
}
}
|
repos\SpringBlade-master\blade-service\blade-system\src\main\java\org\springblade\system\service\impl\UserServiceImpl.java
| 2
|
请完成以下Java代码
|
public ProcessPreconditionsResolution checkPreconditionsApplicable(@NonNull final IProcessPreconditionsContext context)
{
if (context.isNoSelection())
{
return ProcessPreconditionsResolution.rejectBecauseNoSelection();
}
return ProcessPreconditionsResolution.accept();
}
@Override
protected String doIt() throws Exception
{
final PInstanceId pinstanceId = getPinstanceId();
final Iterator<I_PP_Order_Candidate> orderCandidates = ppOrderCandidateService.retrieveOCForSelection(pinstanceId);
while (orderCandidates.hasNext())
{
ppOrderCandidateService.reopenCandidate(orderCandidates.next());
}
return MSG_OK;
}
@Override
@RunOutOfTrx
protected void prepare()
{
if (createSelection() <= 0)
{
throw new AdempiereException(MSG_SELECTED_CLOSED_CANDIDATE);
}
}
private int createSelection()
{
final IQueryBuilder<I_PP_Order_Candidate> queryBuilder = createOCQueryBuilder();
final PInstanceId adPInstanceId = getPinstanceId();
|
Check.assumeNotNull(adPInstanceId, "adPInstanceId is not null");
DB.deleteT_Selection(adPInstanceId, ITrx.TRXNAME_ThreadInherited);
return queryBuilder
.create()
.createSelection(adPInstanceId);
}
@NonNull
private IQueryBuilder<I_PP_Order_Candidate> createOCQueryBuilder()
{
final IQueryFilter<I_PP_Order_Candidate> userSelectionFilter = getProcessInfo().getQueryFilterOrElse(null);
if (userSelectionFilter == null)
{
throw new AdempiereException("@NoSelection@");
}
return queryBL
.createQueryBuilder(I_PP_Order_Candidate.class, getCtx(), ITrx.TRXNAME_None)
.addEqualsFilter(I_PP_Order_Candidate.COLUMNNAME_Processed, true)
.addEqualsFilter(I_PP_Order_Candidate.COLUMNNAME_IsClosed, false)
.filter(userSelectionFilter)
.addOnlyActiveRecordsFilter();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\productioncandidate\process\PP_Order_Candidate_ReOpenSelection.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Serde<IotSensorData> iotSerde() {
return Serdes.serdeFrom(new JsonSerializer<>(), new JsonDeserializer<>(IotSensorData.class));
}
@Bean
public KStream<String, IotSensorData> iotStream(StreamsBuilder streamsBuilder) {
KStream<String, IotSensorData> stream = streamsBuilder.stream(iotTopicName, Consumed.with(Serdes.String(), iotSerde()));
stream.split()
.branch((key, value) -> value.getSensorType() != null,
Branched.withConsumer(ks -> ks.to((key, value, recordContext) -> String.format("%s_%s", iotTopicName, value.getSensorType()))))
.noDefaultBranch();
return stream;
}
@Bean
public KStream<String, IotSensorData> iotBrancher(StreamsBuilder streamsBuilder) {
KStream<String, IotSensorData> stream = streamsBuilder.stream(iotTopicName, Consumed.with(Serdes.String(), iotSerde()));
new KafkaStreamBrancher<String, IotSensorData>()
.branch((key, value) -> "temp".equals(value.getSensorType()), (ks) -> ks.to(iotTopicName + "_temp"))
|
.branch((key, value) -> "move".equals(value.getSensorType()), (ks) -> ks.to(iotTopicName + "_move"))
.branch((key, value) -> "hum".equals(value.getSensorType()), (ks) -> ks.to(iotTopicName + "_hum"))
.defaultBranch(ks -> ks.to(String.format("%s_unknown", iotTopicName)))
.onTopOf(stream);
return stream;
}
@Bean
public KStream<String, IotSensorData> iotTopicExtractor(StreamsBuilder streamsBuilder) {
KStream<String, IotSensorData> stream = streamsBuilder.stream(iotTopicName, Consumed.with(Serdes.String(), iotSerde()));
TopicNameExtractor<String, IotSensorData> sensorTopicExtractor = (key, value, recordContext) -> String.format("%s_%s", iotTopicName, value.getSensorType());
stream.to(sensorTopicExtractor);
return stream;
}
}
|
repos\tutorials-master\spring-kafka-2\src\main\java\com\baeldung\spring\kafka\kafkasplitting\KafkaStreamsConfig.java
| 2
|
请完成以下Java代码
|
public <T> void warnUp(@NonNull final Collection<T> objects, Function<T, WarehouseId> idMapper)
{
if (objects.isEmpty()) {return;}
final ImmutableSet<WarehouseId> ids = objects.stream().map(idMapper).filter(Objects::nonNull).collect(ImmutableSet.toImmutableSet());
getByIds(ids);
}
public WarehouseInfo getById(@NonNull final WarehouseId id)
{
return CollectionUtils.singleElement(getByIds(ImmutableSet.of(id)));
}
private Collection<WarehouseInfo> getByIds(final Set<WarehouseId> id)
{
return CollectionUtils.getAllOrLoad(warehousesByWarehouseId, id, this::retrieveByIds);
}
private ImmutableMap<WarehouseId, WarehouseInfo> retrieveByIds(final Set<WarehouseId> ids)
{
if (ids.isEmpty()) {return ImmutableMap.of();}
return dao.getByIds(ids)
.stream()
.map(WarehousesLoadingCache::fromRecord)
.collect(ImmutableMap.toImmutableMap(WarehouseInfo::getWarehouseId, Function.identity()));
}
private static WarehouseInfo fromRecord(final I_M_Warehouse record)
{
return WarehouseInfo.builder()
.warehouseId(WarehouseId.ofRepoId(record.getM_Warehouse_ID()))
.warehouseName(record.getName())
.build();
}
public String getLocatorName(final LocatorId locatorId)
{
return getWarehouseLocators(locatorId.getWarehouseId()).getLocatorName(locatorId);
}
private WarehouseLocatorsInfo getWarehouseLocators(@NonNull final WarehouseId warehouseId)
|
{
return locatorsByWarehouseId.computeIfAbsent(warehouseId, this::retrieveWarehouseLocators);
}
private WarehouseLocatorsInfo retrieveWarehouseLocators(@NonNull final WarehouseId warehouseId)
{
return WarehouseLocatorsInfo.builder()
.warehouseId(warehouseId)
.locators(dao.getLocators(warehouseId)
.stream()
.map(WarehousesLoadingCache::fromRecord)
.collect(ImmutableList.toImmutableList()))
.build();
}
private static LocatorInfo fromRecord(final I_M_Locator record)
{
return LocatorInfo.builder()
.locatorId(LocatorId.ofRepoId(record.getM_Warehouse_ID(), record.getM_Locator_ID()))
.locatorName(record.getValue())
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.inventory.mobileui\src\main\java\de\metas\inventory\mobileui\deps\warehouse\WarehousesLoadingCache.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
//
@Autowired
private UserService userService;
@Autowired
private JwtFilter jwtFilter;
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userService);
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf()
.disable()
.authorizeRequests()
.antMatchers("/authenticate")
|
.permitAll()
.anyRequest()
.authenticated()
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS);
http.addFilterBefore(jwtFilter, UsernamePasswordAuthenticationFilter.class);
}
@Override
@Bean
protected AuthenticationManager authenticationManager() throws Exception {
return super.authenticationManager();
}
}
|
repos\SpringBoot-Projects-FullStack-master\Advanced-SpringSecure\secure-jwt-project\secure-jwt-project\src\main\java\uz\bepro\securejwtproject\config\SecurityConfiguration.java
| 2
|
请完成以下Java代码
|
public class SequenceFlowTakenListenerDelegate implements ActivitiEventListener {
private List<BPMNElementEventListener<BPMNSequenceFlowTakenEvent>> listeners;
private ToSequenceFlowTakenConverter converter;
public SequenceFlowTakenListenerDelegate(
List<BPMNElementEventListener<BPMNSequenceFlowTakenEvent>> listeners,
ToSequenceFlowTakenConverter converter
) {
this.listeners = listeners;
this.converter = converter;
}
@Override
public void onEvent(ActivitiEvent event) {
if (event instanceof ActivitiSequenceFlowTakenEvent) {
|
converter
.from((ActivitiSequenceFlowTakenEvent) event)
.ifPresent(convertedEvent -> {
for (BPMNElementEventListener<BPMNSequenceFlowTakenEvent> listener : listeners) {
listener.onEvent(convertedEvent);
}
});
}
}
@Override
public boolean isFailOnException() {
return false;
}
}
|
repos\Activiti-develop\activiti-core\activiti-api-impl\activiti-api-process-runtime-impl\src\main\java\org\activiti\runtime\api\event\internal\SequenceFlowTakenListenerDelegate.java
| 1
|
请完成以下Java代码
|
public void execute() {
validateParameters();
if (byJobId || byJobDefinitionId) {
commandExecutor.execute(new SetJobRetriesCmd(jobId, jobDefinitionId, retries, dueDate, isDueDateSet));
} else if (byJobIds) {
commandExecutor.execute(new SetJobRetriesCmd(jobIds, retries, dueDate, isDueDateSet));
}
}
protected void validateParameters() {
ensureNotNull("commandExecutor", commandExecutor);
ensureNotNull("retries", retries);
if (retries < 0) {
throw LOG.exceptionJobRetriesMustNotBeNegative(retries);
}
|
if (!(byJobId ^ byJobIds ^ byJobDefinitionId)) {
// more than one or no method specified
throw LOG.exceptionSettingJobRetriesJobsNotSpecifiedCorrectly();
}
if(byJobId || byJobDefinitionId) {
if ((jobId == null || jobId.isEmpty()) && (jobDefinitionId == null || jobDefinitionId.isEmpty())) {
throw LOG.exceptionSettingJobRetriesJobsNotSpecifiedCorrectly();
}
} else if(byJobIds) {
ensureNotEmpty("job ids", jobIds);
}
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\management\SetJobRetriesBuilderImpl.java
| 1
|
请完成以下Java代码
|
protected org.compiere.model.POInfo initPO(final Properties ctx)
{
return org.compiere.model.POInfo.getPOInfo(Table_Name);
}
@Override
public void setAD_BoilerPlate_ID (final int AD_BoilerPlate_ID)
{
if (AD_BoilerPlate_ID < 1)
set_Value (COLUMNNAME_AD_BoilerPlate_ID, null);
else
set_Value (COLUMNNAME_AD_BoilerPlate_ID, AD_BoilerPlate_ID);
}
@Override
public int getAD_BoilerPlate_ID()
{
return get_ValueAsInt(COLUMNNAME_AD_BoilerPlate_ID);
}
@Override
public void setAD_DocType_BoilerPlate_ID (final int AD_DocType_BoilerPlate_ID)
{
if (AD_DocType_BoilerPlate_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_DocType_BoilerPlate_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_DocType_BoilerPlate_ID, AD_DocType_BoilerPlate_ID);
}
@Override
public int getAD_DocType_BoilerPlate_ID()
{
return get_ValueAsInt(COLUMNNAME_AD_DocType_BoilerPlate_ID);
}
@Override
public void setC_DocType_ID (final int C_DocType_ID)
{
|
if (C_DocType_ID < 0)
set_Value (COLUMNNAME_C_DocType_ID, null);
else
set_Value (COLUMNNAME_C_DocType_ID, C_DocType_ID);
}
@Override
public int getC_DocType_ID()
{
return get_ValueAsInt(COLUMNNAME_C_DocType_ID);
}
@Override
public void setSeqNo (final int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, SeqNo);
}
@Override
public int getSeqNo()
{
return get_ValueAsInt(COLUMNNAME_SeqNo);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_DocType_BoilerPlate.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
class HUManagerProfilesMap
{
public static final HUManagerProfilesMap EMPTY = new HUManagerProfilesMap(ImmutableList.of());
private final ImmutableMap<OrgId, HUManagerProfile> byOrgId;
private HUManagerProfilesMap(final List<HUManagerProfile> list)
{
this.byOrgId = Maps.uniqueIndex(list, HUManagerProfile::getOrgId);
}
public static Collector<HUManagerProfile, ?, HUManagerProfilesMap> collect()
{
return GuavaCollectors.collectUsingListAccumulator(HUManagerProfilesMap::ofList);
}
|
private static HUManagerProfilesMap ofList(List<HUManagerProfile> list)
{
return list.isEmpty() ? EMPTY : new HUManagerProfilesMap(list);
}
@NonNull
public HUManagerProfile getByOrgId(@NonNull final OrgId orgId)
{
return CoalesceUtil.coalesceSuppliersNotNull(
() -> byOrgId.get(orgId),
() -> byOrgId.get(OrgId.ANY),
() -> HUManagerProfile.DEFAULT
);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.mobileui\src\main\java\de\metas\handlingunits\mobileui\config\HUManagerProfilesMap.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public SqlRenderer sqlRenderer(R2dbcDialect dialect) {
RenderContextFactory factory = new RenderContextFactory(dialect);
return SqlRenderer.create(factory.createRenderContext());
}
@WritingConverter
public enum InstantWriteConverter implements Converter<Instant, LocalDateTime> {
INSTANCE;
public LocalDateTime convert(Instant source) {
return LocalDateTime.ofInstant(source, ZoneOffset.UTC);
}
}
@ReadingConverter
public enum InstantReadConverter implements Converter<LocalDateTime, Instant> {
INSTANCE;
@Override
public Instant convert(LocalDateTime localDateTime) {
return localDateTime.toInstant(ZoneOffset.UTC);
}
}
@ReadingConverter
public enum BitSetReadConverter implements Converter<BitSet, Boolean> {
INSTANCE;
@Override
public Boolean convert(BitSet bitSet) {
return bitSet.get(0);
}
}
@ReadingConverter
public enum ZonedDateTimeReadConverter implements Converter<LocalDateTime, ZonedDateTime> {
INSTANCE;
|
@Override
public ZonedDateTime convert(LocalDateTime localDateTime) {
// Be aware - we are using the UTC timezone
return ZonedDateTime.of(localDateTime, ZoneOffset.UTC);
}
}
@WritingConverter
public enum ZonedDateTimeWriteConverter implements Converter<ZonedDateTime, LocalDateTime> {
INSTANCE;
@Override
public LocalDateTime convert(ZonedDateTime zonedDateTime) {
return zonedDateTime.toLocalDateTime();
}
}
@WritingConverter
public enum DurationWriteConverter implements Converter<Duration, Long> {
INSTANCE;
@Override
public Long convert(Duration source) {
return source != null ? source.toMillis() : null;
}
}
@ReadingConverter
public enum DurationReadConverter implements Converter<Long, Duration> {
INSTANCE;
@Override
public Duration convert(Long source) {
return source != null ? Duration.ofMillis(source) : null;
}
}
}
|
repos\tutorials-master\jhipster-8-modules\jhipster-8-microservice\gateway-app\src\main\java\com\gateway\config\DatabaseConfiguration.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public Citizen findByEmail(String email) {
Criteria emailCriteria = Criteria.where("email");
if (encryptionConfig.isAutoEncryption()) {
emailCriteria.is(email);
} else {
emailCriteria
.is(encrypt(email, DETERMINISTIC_ALGORITHM));
}
Query byEmail = new Query(emailCriteria);
if (encryptionConfig.isAutoDecryption()) {
return mongo.findOne(byEmail, Citizen.class);
} else {
EncryptedCitizen encryptedCitizen = mongo.findOne(byEmail, EncryptedCitizen.class);
return decrypt(encryptedCitizen);
}
}
public Binary encrypt(BsonValue bsonValue, String algorithm) {
Objects.requireNonNull(bsonValue);
Objects.requireNonNull(algorithm);
EncryptOptions options = new EncryptOptions(algorithm);
options.keyId(encryptionConfig.getDataKeyId());
BsonBinary encryptedValue = clientEncryption.encrypt(bsonValue, options);
return new Binary(encryptedValue.getType(), encryptedValue.getData());
}
public Binary encrypt(String value, String algorithm) {
Objects.requireNonNull(value);
Objects.requireNonNull(algorithm);
return encrypt(new BsonString(value), algorithm);
}
public Binary encrypt(Integer value, String algorithm) {
Objects.requireNonNull(value);
Objects.requireNonNull(algorithm);
return encrypt(new BsonInt32(value), algorithm);
}
public BsonValue decryptProperty(Binary value) {
Objects.requireNonNull(value);
return clientEncryption.decrypt(new BsonBinary(value.getType(), value.getData()));
|
}
private Citizen decrypt(EncryptedCitizen encrypted) {
Objects.requireNonNull(encrypted);
Citizen citizen = new Citizen();
citizen.setName(encrypted.getName());
BsonValue decryptedBirthYear = encrypted.getBirthYear() != null ? decryptProperty(encrypted.getBirthYear()) : null;
if (decryptedBirthYear != null) {
citizen.setBirthYear(decryptedBirthYear.asInt32().intValue());
}
BsonValue decryptedEmail = encrypted.getEmail() != null ? decryptProperty(encrypted.getEmail()) : null;
if (decryptedEmail != null) {
citizen.setEmail(decryptedEmail.asString().getValue());
}
return citizen;
}
}
|
repos\tutorials-master\persistence-modules\spring-boot-persistence-mongodb-3\src\main\java\com\baeldung\boot\csfle\service\CitizenService.java
| 2
|
请完成以下Java代码
|
private boolean confirmRecordsToProcess(final IQuery<I_PMM_PurchaseCandidate> query)
{
if (confirmationCallback == null)
{
return true; // OK, autoconfirmed
}
//
// Fail if there is nothing to update
final int countToProcess = query.count();
if (countToProcess <= 0)
{
throw new AdempiereException("@NoSelection@");
}
//
// Ask the callback if we shall process
return confirmationCallback.confirmRecordsToProcess(countToProcess);
}
private IQuery<I_PMM_PurchaseCandidate> createRecordsToProcessQuery()
{
final IQueryBuilder<I_PMM_PurchaseCandidate> queryBuilder = queryBL.createQueryBuilder(I_PMM_PurchaseCandidate.class);
if (candidatesFilter != null)
{
queryBuilder.filter(candidatesFilter);
}
return queryBuilder
.addOnlyActiveRecordsFilter()
|
.filter(lockManager.getNotLockedFilter(I_PMM_PurchaseCandidate.class))
.addCompareFilter(I_PMM_PurchaseCandidate.COLUMNNAME_QtyToOrder, CompareQueryFilter.Operator.GREATER, BigDecimal.ZERO)
.orderBy()
.addColumn(I_PMM_PurchaseCandidate.COLUMNNAME_AD_Org_ID)
.addColumn(I_PMM_PurchaseCandidate.COLUMNNAME_M_Warehouse_ID)
.addColumn(I_PMM_PurchaseCandidate.COLUMNNAME_C_BPartner_ID)
.addColumn(I_PMM_PurchaseCandidate.COLUMNNAME_DatePromised)
.addColumn(I_PMM_PurchaseCandidate.COLUMNNAME_M_PricingSystem_ID)
.addColumn(I_PMM_PurchaseCandidate.COLUMNNAME_C_Currency_ID)
.endOrderBy()
//
.create();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.procurement.base\src\main\java\de\metas\procurement\base\order\async\PMM_GenerateOrdersEnqueuer.java
| 1
|
请完成以下Java代码
|
public void setDPD_StoreOrder_ID (int DPD_StoreOrder_ID)
{
if (DPD_StoreOrder_ID < 1)
set_Value (COLUMNNAME_DPD_StoreOrder_ID, null);
else
set_Value (COLUMNNAME_DPD_StoreOrder_ID, Integer.valueOf(DPD_StoreOrder_ID));
}
/** Get DPD StoreOrder.
@return DPD StoreOrder */
@Override
public int getDPD_StoreOrder_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_DPD_StoreOrder_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Dpd StoreOrder Log.
@param DPD_StoreOrder_Log_ID Dpd StoreOrder Log */
@Override
public void setDPD_StoreOrder_Log_ID (int DPD_StoreOrder_Log_ID)
{
if (DPD_StoreOrder_Log_ID < 1)
set_ValueNoCheck (COLUMNNAME_DPD_StoreOrder_Log_ID, null);
else
set_ValueNoCheck (COLUMNNAME_DPD_StoreOrder_Log_ID, Integer.valueOf(DPD_StoreOrder_Log_ID));
}
/** Get Dpd StoreOrder Log.
@return Dpd StoreOrder Log */
@Override
public int getDPD_StoreOrder_Log_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_DPD_StoreOrder_Log_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Duration (ms).
@param DurationMillis Duration (ms) */
@Override
public void setDurationMillis (int DurationMillis)
{
set_Value (COLUMNNAME_DurationMillis, Integer.valueOf(DurationMillis));
}
/** Get Duration (ms).
@return Duration (ms) */
@Override
public int getDurationMillis ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_DurationMillis);
if (ii == null)
return 0;
return ii.intValue();
}
|
/** Set Fehler.
@param IsError
Ein Fehler ist bei der Durchführung aufgetreten
*/
@Override
public void setIsError (boolean IsError)
{
set_Value (COLUMNNAME_IsError, Boolean.valueOf(IsError));
}
/** Get Fehler.
@return Ein Fehler ist bei der Durchführung aufgetreten
*/
@Override
public boolean isError ()
{
Object oo = get_Value(COLUMNNAME_IsError);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Request Message.
@param RequestMessage Request Message */
@Override
public void setRequestMessage (java.lang.String RequestMessage)
{
set_Value (COLUMNNAME_RequestMessage, RequestMessage);
}
/** Get Request Message.
@return Request Message */
@Override
public java.lang.String getRequestMessage ()
{
return (java.lang.String)get_Value(COLUMNNAME_RequestMessage);
}
/** Set Response Message.
@param ResponseMessage Response Message */
@Override
public void setResponseMessage (java.lang.String ResponseMessage)
{
set_Value (COLUMNNAME_ResponseMessage, ResponseMessage);
}
/** Get Response Message.
@return Response Message */
@Override
public java.lang.String getResponseMessage ()
{
return (java.lang.String)get_Value(COLUMNNAME_ResponseMessage);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.dpd\src\main\java-gen\de\metas\shipper\gateway\dpd\model\X_DPD_StoreOrder_Log.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private void resolveUniqueApplicationConfigBean(BeanDefinitionRegistry registry, ListableBeanFactory beanFactory) {
String[] beansNames = beanNamesForTypeIncludingAncestors(beanFactory, ApplicationConfig.class);
if (beansNames.length < 2) { // If the number of ApplicationConfig beans is less than two, return immediately.
return;
}
Environment environment = beanFactory.getBean(ENVIRONMENT_BEAN_NAME, Environment.class);
// Remove ApplicationConfig Beans that are configured by "dubbo.application.*"
Stream.of(beansNames)
.filter(beansName -> isConfiguredApplicationConfigBeanName(environment, beansName))
.forEach(registry::removeBeanDefinition);
beansNames = beanNamesForTypeIncludingAncestors(beanFactory, ApplicationConfig.class);
if (beansNames.length > 1) {
throw new IllegalStateException(String.format("There are more than one instances of %s, whose bean definitions : %s",
ApplicationConfig.class.getSimpleName(),
Stream.of(beansNames)
.map(registry::getBeanDefinition)
.collect(Collectors.toList()))
);
}
}
private boolean isConfiguredApplicationConfigBeanName(Environment environment, String beanName) {
boolean removed = BeanFactoryUtils.isGeneratedBeanName(beanName)
|
// Dubbo ApplicationConfig id as bean name
|| Objects.equals(beanName, environment.getProperty("dubbo.application.id"));
if (removed) {
if (logger.isDebugEnabled()) {
logger.debug("The {} bean [ name : {} ] has been removed!", ApplicationConfig.class.getSimpleName(), beanName);
}
}
return removed;
}
@Override
public int getOrder() {
return LOWEST_PRECEDENCE;
}
}
|
repos\dubbo-spring-boot-project-master\dubbo-spring-boot-compatible\autoconfigure\src\main\java\org\apache\dubbo\spring\boot\context\event\DubboConfigBeanDefinitionConflictApplicationListener.java
| 2
|
请完成以下Java代码
|
private ForecastRequest.ForecastLineRequest toForecastLineRequest(@NonNull final MaterialNeedsPlannerRow row)
{
final ProductId productId = row.getProductId();
final UomId uomId = productBL.getStockUOMId(productId);
return ForecastRequest.ForecastLineRequest.builder()
.productId(productId)
.quantity(Quantitys.of(row.getLevelMin(), uomId))
.build();
}
@NonNull
private Instant getDefaultDatePromised()
{
final OrgId orgId = getOrgId() != null ? getOrgId() : Env.getOrgId();
final ZoneId timeZone = orgDAO.getTimeZone(orgId);
return SystemTime.asLocalDate()
.with(TemporalAdjusters.next(DayOfWeek.MONDAY))
|
.atStartOfDay(timeZone)
.toInstant();
}
private String provideName(@NonNull final WarehouseId warehouseId, @NonNull final List<ForecastRequest.ForecastLineRequest> lineRequests)
{
if (lineRequests.size() != 1)
{
return warehouseBL.getWarehouseName(warehouseId) + "_" + p_DatePromised;
}
final ForecastRequest.ForecastLineRequest singleRequest = Check.singleElement(lineRequests);
return productBL.getProductValueAndName(singleRequest.getProductId())
+ " | " + singleRequest.getQuantity()
+ " | " + warehouseBL.getWarehouseName(warehouseId);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\replenish\process\WEBUI_M_Replenish_Generate_Forecasts.java
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.