instruction string | input string | output string | source_file string | priority int64 |
|---|---|---|---|---|
请完成以下Java代码 | public Map<ShipperId, I_M_Shipper> getByIds(@NonNull final Set<ShipperId> shipperIds)
{
if (Check.isEmpty(shipperIds))
{
return ImmutableMap.of();
}
final List<I_M_Shipper> shipperList = queryBL.createQueryBuilder(I_M_Shipper.class)
.addOnlyActiveRecordsFilter()
.addInArrayFilter(I_M_Shipper.COLUMNNAME_M_Shipper_ID, shipperIds)
.create()
.list();
return Maps.uniqueIndex(shipperList, (shipper) -> ShipperId.ofRepoId(shipper.getM_Shipper_ID()));
}
@NonNull
public ImmutableMap<String, I_M_Shipper> getByInternalName(@NonNull final Set<String> internalNameSet)
{
if (Check.isEmpty(internalNameSet))
{
return ImmutableMap.of();
}
final List<I_M_Shipper> shipperList = queryBL.createQueryBuilder(I_M_Shipper.class)
.addOnlyActiveRecordsFilter()
.addInArrayFilter(I_M_Shipper.COLUMNNAME_InternalName, internalNameSet)
.create() | .list();
return Maps.uniqueIndex(shipperList, I_M_Shipper::getInternalName);
}
@Override
public ExplainedOptional<ShipperGatewayId> getShipperGatewayId(@NonNull final ShipperId shipperId)
{
final I_M_Shipper shipper = getById(shipperId);
final ShipperGatewayId shipperGatewayId = ShipperGatewayId.ofNullableString(shipper.getShipperGateway());
return shipperGatewayId != null
? ExplainedOptional.of(shipperGatewayId)
: ExplainedOptional.emptyBecause("Shipper " + shipper.getName() + " has no gateway configured");
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\shipping\impl\ShipperDAO.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class MessageDocument {
@Id
private String id;
private String message;
public String getId() {
return id;
}
public MessageDocument() {
}
public MessageDocument(String id, String message) {
this.id = id; | this.message = message;
}
public void setId(String id) {
this.id = id;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
} | repos\spring-examples-java-17\spring-mongo\src\main\java\itx\examples\springmongo\repository\MessageDocument.java | 2 |
请完成以下Java代码 | protected org.compiere.model.POInfo initPO(final Properties ctx)
{
return org.compiere.model.POInfo.getPOInfo(Table_Name);
}
@Override
public void setC_Invoice_Verification_Set_ID (final int C_Invoice_Verification_Set_ID)
{
if (C_Invoice_Verification_Set_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Invoice_Verification_Set_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Invoice_Verification_Set_ID, C_Invoice_Verification_Set_ID);
}
@Override
public int getC_Invoice_Verification_Set_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Invoice_Verification_Set_ID);
}
@Override
public void setDescription (final @Nullable java.lang.String Description) | {
set_Value (COLUMNNAME_Description, Description);
}
@Override
public java.lang.String getDescription()
{
return get_ValueAsString(COLUMNNAME_Description);
}
@Override
public void setName (final java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Invoice_Verification_Set.java | 1 |
请完成以下Java代码 | public ExternalSystem getByType(@NonNull final ExternalSystemType type)
{
return getMap().getByType(type);
}
@NonNull
public ExternalSystemId getIdByType(@NonNull final ExternalSystemType type)
{
return getMap().getByType(type).getId();
}
public Optional<ExternalSystem> getOptionalByType(@NonNull final ExternalSystemType type)
{
return getMap().getOptionalByType(type);
}
public Optional<ExternalSystem> getOptionalByValue(@NonNull final String value)
{
return getMap().getOptionalByType(ExternalSystemType.ofValue(value));
}
@NonNull
public ExternalSystem getById(@NonNull final ExternalSystemId id)
{
return getMap().getById(id);
}
private static ExternalSystem fromRecord(@NonNull final I_ExternalSystem externalSystemRecord)
{
return ExternalSystem.builder()
.id(ExternalSystemId.ofRepoId(externalSystemRecord.getExternalSystem_ID()))
.type(ExternalSystemType.ofValue(externalSystemRecord.getValue())) | .name(externalSystemRecord.getName())
.build();
}
public ExternalSystem create(@NonNull final ExternalSystemCreateRequest request)
{
final I_ExternalSystem record = InterfaceWrapperHelper.newInstance(I_ExternalSystem.class);
record.setName(request.getName());
record.setValue(request.getType().getValue());
InterfaceWrapperHelper.save(record);
return fromRecord(record);
}
@Nullable
public ExternalSystem getByLegacyCodeOrValueOrNull(@NonNull final String value)
{
final ExternalSystemMap map = getMap();
return CoalesceUtil.coalesceSuppliers(
() -> map.getByTypeOrNull(ExternalSystemType.ofValue(value)),
() -> {
final ExternalSystemType externalSystemType = ExternalSystemType.ofLegacyCodeOrNull(value);
return externalSystemType != null ? map.getByTypeOrNull(externalSystemType) : null;
}
);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\externalsystem\ExternalSystemRepository.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class UserController {
private Logger logger = LoggerFactory.getLogger(getClass());
/**
* 获得指定用户编号的用户
*
* 提供不使用 CommonResult 包装
*
* @param id 用户编号
* @return 用户
*/
@GetMapping("/get")
public UserVO get(@RequestParam("id") Integer id) {
// 查询并返回用户
return new UserVO().setId(id).setUsername(UUID.randomUUID().toString());
}
/**
* 获得指定用户编号的用户
*
* 提供使用 CommonResult 包装
*
* @param id 用户编号
* @return 用户
*/
@GetMapping("/get2")
public CommonResult<UserVO> get2(@RequestParam("id") Integer id) {
// 查询用户
UserVO user = new UserVO().setId(id).setUsername(UUID.randomUUID().toString());
// 返回结果
return CommonResult.success(user);
}
/**
* 获得指定用户编号的用户
*
* 测试个问题
*
* @param id 用户编号
* @return 用户
*/
@PostMapping("/get")
public UserVO get3(@RequestParam("id") Integer id) {
// 查询并返回用户
return new UserVO().setId(id).setUsername(UUID.randomUUID().toString());
}
/**
* 测试抛出 NullPointerException 异常
*/
@GetMapping("/exception-01")
public UserVO exception01() {
throw new NullPointerException("没有粗面鱼丸");
}
/**
* 测试抛出 ServiceException 异常
*/
@GetMapping("/exception-02") | public UserVO exception02() {
throw new ServiceException(ServiceExceptionEnum.USER_NOT_FOUND);
}
@GetMapping("/do_something")
public void doSomething() {
logger.info("[doSomething]");
}
@GetMapping("/current_user")
public UserVO currentUser() {
logger.info("[currentUser]");
return new UserVO().setId(10).setUsername(UUID.randomUUID().toString());
}
@GetMapping("/exception-03")
public void exception03() {
logger.info("[exception03]");
throw new ServiceException(ServiceExceptionEnum.USER_NOT_FOUND);
}
@PostMapping(value = "/add",
// ↓ 增加 "application/xml"、"application/json" ,针对 Content-Type 请求头
consumes = {MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE},
// ↓ 增加 "application/xml"、"application/json" ,针对 Accept 请求头
produces = {MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE}
)
public UserVO add(@RequestBody UserVO user) {
return user;
}
} | repos\SpringBoot-Labs-master\lab-23\lab-springmvc-23-02\src\main\java\cn\iocoder\springboot\lab23\springmvc\controller\UserController.java | 2 |
请完成以下Java代码 | protected void checkInvalidDefinitionId(String definitionId) {
ensureNotNull("Invalid process definition id", "processDefinitionId", definitionId);
}
@Override
protected void checkDefinitionFound(String definitionId, ProcessDefinitionEntity definition) {
ensureNotNull(NotFoundException.class, "no deployed process definition found with id '" + definitionId + "'", "processDefinition", definition);
}
@Override
protected void checkInvalidDefinitionByKey(String definitionKey, ProcessDefinitionEntity definition) {
ensureNotNull("no processes deployed with key '" + definitionKey + "'", "processDefinition", definition);
}
@Override
protected void checkInvalidDefinitionByKeyAndTenantId(String definitionKey, String tenantId, ProcessDefinitionEntity definition) {
ensureNotNull("no processes deployed with key '" + definitionKey + "' and tenant-id '" + tenantId + "'", "processDefinition", definition);
}
@Override
protected void checkInvalidDefinitionByKeyVersionAndTenantId(String definitionKey, Integer definitionVersion, String tenantId, ProcessDefinitionEntity definition) { | ensureNotNull("no processes deployed with key = '" + definitionKey + "', version = '" + definitionVersion
+ "' and tenant-id = '" + tenantId + "'", "processDefinition", definition);
}
@Override
protected void checkInvalidDefinitionByKeyVersionTagAndTenantId(String definitionKey, String definitionVersionTag, String tenantId,
ProcessDefinitionEntity definition) {
ensureNotNull("no processes deployed with key = '" + definitionKey + "', versionTag = '" + definitionVersionTag
+ "' and tenant-id = '" + tenantId + "'", "processDefinition", definition);
}
@Override
protected void checkInvalidDefinitionByDeploymentAndKey(String deploymentId, String definitionKey, ProcessDefinitionEntity definition) {
ensureNotNull("no processes deployed with key = '" + definitionKey + "' in deployment = '" + deploymentId + "'", "processDefinition", definition);
}
@Override
protected void checkInvalidDefinitionWasCached(String deploymentId, String definitionId, ProcessDefinitionEntity definition) {
ensureNotNull("deployment '" + deploymentId + "' didn't put process definition '" + definitionId + "' in the cache", "cachedProcessDefinition", definition);
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\deploy\cache\ProcessDefinitionCache.java | 1 |
请完成以下Java代码 | public class UnlockFailedException extends LockException
{
/**
*
*/
private static final long serialVersionUID = 1714489085379778609L;
public static final UnlockFailedException wrapIfNeeded(final Exception e)
{
if (e instanceof UnlockFailedException)
{
return (UnlockFailedException)e;
}
else
{
return new UnlockFailedException("Unlock failed: " + e.getLocalizedMessage(), e);
}
}
public UnlockFailedException(String message)
{
super(message);
}
public UnlockFailedException(String message, Throwable cause)
{
super(message, cause);
}
public UnlockFailedException setUnlockCommand(final IUnlockCommand unlockCommand)
{
setParameter("Unlock command", unlockCommand);
return this;
}
@Override
public UnlockFailedException setSql(final String sql, final Object[] sqlParams)
{ | super.setSql(sql, sqlParams);
return this;
}
public UnlockFailedException setRecordToLock(final TableRecordReference recordToLock)
{
super.setRecord(recordToLock);
return this;
}
@Override
public UnlockFailedException setParameter(@NonNull String name, Object value)
{
super.setParameter(name, value);
return this;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.async\src\main\java\de\metas\lock\exceptions\UnlockFailedException.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void registrationForm() {
result.use(FreemarkerView.class).withTemplate("auth/register");
}
@Post("/register")
public void register(User user, HttpServletRequest request) {
validator.validate(user);
if(validator.hasErrors()) {
result.include("errors", validator.getErrors());
}
validator.onErrorRedirectTo(this).registrationForm();
if(!user.getPassword()
.equals(request.getParameter("password_confirmation"))) {
result.include("error", "Passwords Do Not Match");
result.redirectTo(this).registrationForm();
}
user.setPassword(
BCrypt.hashpw(user.getPassword(), BCrypt.gensalt()));
Object resp = userDao.add(user);
if(resp != null) {
result.include("status", "Registration Successful! Now Login");
result.redirectTo(this).loginForm();
} else {
result.include("error", "There was an error during registration");
result.redirectTo(this).registrationForm();
}
}
@Get("/login")
public void loginForm() {
result.use(FreemarkerView.class).withTemplate("auth/login");
}
@Post("/login") | public void login(HttpServletRequest request) {
String password = request.getParameter("user.password");
String email = request.getParameter("user.email");
if(email.isEmpty() || password.isEmpty()) {
result.include("error", "Email/Password is Required!");
result.redirectTo(AuthController.class).loginForm();
}
User user = userDao.findByEmail(email);
if(user != null && BCrypt.checkpw(password, user.getPassword())) {
userInfo.setUser(user);
result.include("status", "Login Successful!");
result.redirectTo(IndexController.class).index();
} else {
result.include("error", "Email/Password Does Not Match!");
result.redirectTo(AuthController.class).loginForm();
}
}
} | repos\tutorials-master\web-modules\vraptor\src\main\java\com\baeldung\controllers\AuthController.java | 2 |
请完成以下Java代码 | public int getMaxTrx()
{
return maxTrx;
}
@Override
public ITrxConstraints setMaxSavepoints(int maxSavepoints)
{
this.maxSavepoints = maxSavepoints;
return this;
}
@Override
public int getMaxSavepoints()
{
return maxSavepoints;
}
@Override
public ITrxConstraints setActive(boolean active)
{
this.active = active;
return this;
}
@Override
public boolean isActive()
{
return active;
}
@Override
public boolean isOnlyAllowedTrxNamePrefixes()
{
return onlyAllowedTrxNamePrefixes;
}
@Override
public ITrxConstraints setOnlyAllowedTrxNamePrefixes(boolean onlyAllowedTrxNamePrefixes)
{
this.onlyAllowedTrxNamePrefixes = onlyAllowedTrxNamePrefixes;
return this;
}
@Override
public ITrxConstraints addAllowedTrxNamePrefix(final String trxNamePrefix)
{
allowedTrxNamePrefixes.add(trxNamePrefix);
return this;
}
@Override
public ITrxConstraints removeAllowedTrxNamePrefix(final String trxNamePrefix)
{
allowedTrxNamePrefixes.remove(trxNamePrefix);
return this;
}
@Override
public Set<String> getAllowedTrxNamePrefixes()
{
return allowedTrxNamePrefixesRO;
}
@Override
public boolean isAllowTrxAfterThreadEnd()
{ | return allowTrxAfterThreadEnd;
}
@Override
public void reset()
{
setActive(DEFAULT_ACTIVE);
setAllowTrxAfterThreadEnd(DEFAULT_ALLOW_TRX_AFTER_TREAD_END);
setMaxSavepoints(DEFAULT_MAX_SAVEPOINTS);
setMaxTrx(DEFAULT_MAX_TRX);
setTrxTimeoutSecs(DEFAULT_TRX_TIMEOUT_SECS, DEFAULT_TRX_TIMEOUT_LOG_ONLY);
setOnlyAllowedTrxNamePrefixes(DEFAULT_ONLY_ALLOWED_TRXNAME_PREFIXES);
allowedTrxNamePrefixes.clear();
}
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder();
sb.append("TrxConstraints[");
sb.append("active=" + this.active);
sb.append(", allowedTrxNamePrefixes=" + getAllowedTrxNamePrefixes());
sb.append(", allowTrxAfterThreadEnd=" + isAllowTrxAfterThreadEnd());
sb.append(", maxSavepoints=" + getMaxSavepoints());
sb.append(", maxTrx=" + getMaxTrx());
sb.append(", onlyAllowedTrxNamePrefixes=" + isOnlyAllowedTrxNamePrefixes());
sb.append(", trxTimeoutLogOnly=" + isTrxTimeoutLogOnly());
sb.append(", trxTimeoutSecs=" + getTrxTimeoutSecs());
sb.append("]");
return sb.toString();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\util\trxConstraints\api\impl\TrxConstraints.java | 1 |
请完成以下Java代码 | public static Builder of(final String name, final AttributeDefinition... valueTypes) {
return new Builder(name, valueTypes);
}
public static Builder of(final String name,
final AttributeDefinition[] valueTypes,
final AttributeDefinition[] moreValueTypes) {
ArrayList<AttributeDefinition> list = new ArrayList<>(Arrays.asList(valueTypes));
list.addAll(Arrays.asList(moreValueTypes));
AttributeDefinition[] allValueTypes = new AttributeDefinition[list.size()];
list.toArray(allValueTypes);
return new Builder(name, allValueTypes);
}
public FixedObjectTypeAttributeDefinition build() {
ParameterValidator validator = getValidator();
if (validator == null) {
ObjectTypeValidator objectTypeValidator = new ObjectTypeValidator(isAllowNull(), valueTypes);
setValidator(objectTypeValidator); | }
return new FixedObjectTypeAttributeDefinition(this, suffix, valueTypes);
}
/*
--------------------------
added for binary compatibility for running compatibilty tests
*/
@Override
public Builder setAllowNull(boolean allowNull) {
return super.setAllowNull(allowNull);
}
}
} | repos\camunda-bpm-platform-master\distro\wildfly26\subsystem\src\main\java\org\camunda\bpm\container\impl\jboss\util\FixedObjectTypeAttributeDefinition.java | 1 |
请完成以下Java代码 | public String getMessageName() {
return messageName;
}
public void setMessageName(String messageName) {
this.messageName = messageName;
}
public String getBusinessKey() {
return businessKey;
}
public void setBusinessKey(String businessKey) {
this.businessKey = businessKey;
}
public Map<String, VariableValueDto> getCorrelationKeys() {
return correlationKeys;
}
public void setCorrelationKeys(Map<String, VariableValueDto> correlationKeys) {
this.correlationKeys = correlationKeys;
}
public Map<String, VariableValueDto> getLocalCorrelationKeys() {
return localCorrelationKeys;
}
public void setLocalCorrelationKeys(Map<String, VariableValueDto> localCorrelationKeys) {
this.localCorrelationKeys = localCorrelationKeys;
}
public Map<String, VariableValueDto> getProcessVariables() {
return processVariables;
}
public void setProcessVariables(Map<String, VariableValueDto> processVariables) {
this.processVariables = processVariables;
}
public Map<String, VariableValueDto> getProcessVariablesLocal() {
return processVariablesLocal;
}
public void setProcessVariablesLocal(Map<String, VariableValueDto> processVariablesLocal) {
this.processVariablesLocal = processVariablesLocal;
}
public Map<String, VariableValueDto> getProcessVariablesToTriggeredScope() {
return processVariablesToTriggeredScope;
}
public void setProcessVariablesToTriggeredScope(Map<String, VariableValueDto> processVariablesToTriggeredScope) { | this.processVariablesToTriggeredScope = processVariablesToTriggeredScope;
}
public boolean isAll() {
return all;
}
public void setAll(boolean all) {
this.all = all;
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public boolean isWithoutTenantId() {
return withoutTenantId;
}
public void setWithoutTenantId(boolean withoutTenantId) {
this.withoutTenantId = withoutTenantId;
}
public String getProcessInstanceId() {
return processInstanceId;
}
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
public boolean isResultEnabled() {
return resultEnabled;
}
public void setResultEnabled(boolean resultEnabled) {
this.resultEnabled = resultEnabled;
}
public boolean isVariablesInResultEnabled() {
return variablesInResultEnabled;
}
public void setVariablesInResultEnabled(boolean variablesInResultEnabled) {
this.variablesInResultEnabled = variablesInResultEnabled;
}
} | repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\message\CorrelationMessageDto.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class JsonRequestBPartnerLocationAndContact
{
@ApiModelProperty(required = true, value = BPARTNER_IDENTIFIER_DOC)
String bPartnerIdentifier;
@ApiModelProperty(required = true, value = LOCATION_IDENTIFIER_DOC)
String bPartnerLocationIdentifier;
@ApiModelProperty(value = CONTACT_IDENTIFIER_DOC)
String contactIdentifier;
@JsonCreator
@Builder
public JsonRequestBPartnerLocationAndContact(
@JsonProperty("bpartnerIdentifier") final String bPartnerIdentifier,
@JsonProperty("bpartnerLocationIdentifier") final String bPartnerLocationIdentifier,
@JsonProperty("contactIdentifier") final String contactIdentifier)
{ | this.bPartnerIdentifier = bPartnerIdentifier;
this.bPartnerLocationIdentifier = bPartnerLocationIdentifier;
this.contactIdentifier = contactIdentifier;
}
@NonNull
public String getBPartnerIdentifier()
{
return bPartnerIdentifier;
}
@NonNull
public String getBPartnerLocationIdentifier()
{
return bPartnerLocationIdentifier;
}
} | repos\metasfresh-new_dawn_uat\misc\de-metas-common\de-metas-common-ordercandidates\src\main\java\de\metas\common\ordercandidates\v2\request\JsonRequestBPartnerLocationAndContact.java | 2 |
请完成以下Java代码 | public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public String getProfession() {
return profession;
}
public void setProfession(String profession) {
this.profession = profession;
} | @Override
public String toString() {
return "User [name=" + name + ", email=" + email + ", password=" + password + ", gender=" + gender + ", note="
+ note + ", married=" + married + ", birthday=" + birthday + ", profession=" + profession + ", income="
+ income + "]";
}
public long getIncome() {
return income;
}
public void setIncome(long income) {
this.income = income;
}
} | repos\SpringBoot-Projects-FullStack-master\Part-5 Spring Boot Web Application\SpringBootThymeleafFormValidation\src\main\java\spting\validation\model\User.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public String getSign() {
return sign;
}
public void setSign(String sign) {
this.sign = sign;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getPayType() {
return payType;
}
public void setPayType(String payType) {
this.payType = payType;
}
public String getOpenId() {
return openId;
}
public void setOpenId(String openId) {
this.openId = openId;
}
public String getNotifyUrl() {
return notifyUrl;
}
public void setNotifyUrl(String notifyUrl) {
this.notifyUrl = notifyUrl;
} | @Override
public String toString() {
return "ProgramPayRequestBo{" +
"payKey='" + payKey + '\'' +
", openId='" + openId + '\'' +
", productName='" + productName + '\'' +
", orderNo='" + orderNo + '\'' +
", orderPrice=" + orderPrice +
", orderIp='" + orderIp + '\'' +
", orderDate='" + orderDate + '\'' +
", orderTime='" + orderTime + '\'' +
", notifyUrl='" + notifyUrl + '\'' +
", sign='" + sign + '\'' +
", remark='" + remark + '\'' +
", payType='" + payType + '\'' +
'}';
}
} | repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\trade\bo\ProgramPayRequestBo.java | 2 |
请完成以下Java代码 | public void propertyChange(PropertyChangeEvent evt)
{
if (evt.getPropertyName().equals(org.compiere.model.GridField.PROPERTY))
setValue(evt.getNewValue());
// metas: request focus (2009_0027_G131)
if (evt.getPropertyName().equals(org.compiere.model.GridField.REQUEST_FOCUS))
requestFocus();
// metas end
} // propertyChange
/**
* Start dialog and set value
*/
private final void onButtonPressed()
{
try
{
// Show the dialog
final VImageDialog vid = new VImageDialog(Env.getWindow(m_WindowNo), m_WindowNo, m_mImage);
vid.setVisible(true);
// Do nothing if user canceled (i.e. closed the window)
if (vid.isCanceled())
{
return;
}
final int AD_Image_ID = vid.getAD_Image_ID();
final Integer newValue = AD_Image_ID > 0 ? AD_Image_ID : null;
//
m_mImage = null; // force reload
setValue(newValue); // set explicitly
//
try
{
fireVetoableChange(m_columnName, null, newValue);
}
catch (PropertyVetoException pve) {}
}
catch (Exception e)
{
Services.get(IClientUI.class).error(m_WindowNo, e);
}
} // actionPerformed
// Field for Value Preference
private GridField m_mField = null; | /**
* Set Field/WindowNo for ValuePreference (NOP)
* @param mField
*/
@Override
public void setField (GridField mField)
{
m_mField = mField;
} // setField
@Override
public GridField getField() {
return m_mField;
}
// metas
@Override
public boolean isAutoCommit()
{
return true;
}
} // VImage | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\grid\ed\VImage.java | 1 |
请完成以下Java代码 | public String getCamundaCaseTenantId() {
return camundaCaseTenantIdAttribute.getValue(this);
}
public void setCamundaCaseTenantId(String camundaCaseTenantId) {
camundaCaseTenantIdAttribute.setValue(this, camundaCaseTenantId);
}
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(CaseTask.class, CMMN_ELEMENT_CASE_TASK)
.extendsType(Task.class)
.namespaceUri(CMMN11_NS)
.instanceProvider(new ModelTypeInstanceProvider<CaseTask>() {
public CaseTask newInstance(ModelTypeInstanceContext instanceContext) {
return new CaseTaskImpl(instanceContext);
}
});
caseRefAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_CASE_REF)
.build();
/** camunda extensions */
camundaCaseBindingAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_CASE_BINDING)
.namespace(CAMUNDA_NS)
.build();
camundaCaseVersionAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_CASE_VERSION)
.namespace(CAMUNDA_NS)
.build(); | camundaCaseTenantIdAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_CASE_TENANT_ID)
.namespace(CAMUNDA_NS)
.build();
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
parameterMappingCollection = sequenceBuilder.elementCollection(ParameterMapping.class)
.build();
caseRefExpressionChild = sequenceBuilder.element(CaseRefExpression.class)
.build();
typeBuilder.build();
}
} | repos\camunda-bpm-platform-master\model-api\cmmn-model\src\main\java\org\camunda\bpm\model\cmmn\impl\instance\CaseTaskImpl.java | 1 |
请完成以下Java代码 | private SwingRelatedProcessDescriptor createSwingRelatedProcess(final RelatedProcessDescriptor relatedProcess, final IProcessPreconditionsContext preconditionsContext)
{
final Supplier<ProcessPreconditionsResolution> preconditionsResolutionSupplier = () -> checkPreconditionApplicable(relatedProcess, preconditionsContext);
return SwingRelatedProcessDescriptor.of(relatedProcess, preconditionsResolutionSupplier);
}
private boolean isExecutionGrantedOrLog(final RelatedProcessDescriptor relatedProcess, final IUserRolePermissions permissions)
{
if (relatedProcess.isExecutionGranted(permissions))
{
return true;
}
if (logger.isDebugEnabled())
{
logger.debug("Skip process {} because execution was not granted using {}", relatedProcess, permissions);
}
return false;
}
private boolean isEnabledOrLog(final SwingRelatedProcessDescriptor relatedProcess)
{
if (relatedProcess.isEnabled())
{
return true;
}
if (!relatedProcess.isSilentRejection()) | {
return true;
}
//
// Log and filter it out
if (logger.isDebugEnabled())
{
final String disabledReason = relatedProcess.getDisabledReason(Env.getAD_Language(Env.getCtx()));
logger.debug("Skip process {} because {} (silent={})", relatedProcess, disabledReason, relatedProcess.isSilentRejection());
}
return false;
}
@VisibleForTesting
/* package */ProcessPreconditionsResolution checkPreconditionApplicable(final RelatedProcessDescriptor relatedProcess, final IProcessPreconditionsContext preconditionsContext)
{
return ProcessPreconditionChecker.newInstance()
.setProcess(relatedProcess)
.setPreconditionsContext(preconditionsContext)
.checkApplies();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\process\ui\AProcessModel.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void migrateHistoricCaseInstance(@ApiParam(name = "caseInstanceId") @PathVariable String caseInstanceId,
@RequestBody String migrationDocumentJson) {
HistoricCaseInstance caseInstance = getHistoricCaseInstanceFromRequestWithoutAccessCheck(caseInstanceId);
if (restApiInterceptor != null) {
restApiInterceptor.migrateHistoricCaseInstance(caseInstance, migrationDocumentJson);
}
HistoricCaseInstanceMigrationDocument migrationDocument = HistoricCaseInstanceMigrationDocumentConverter.convertFromJson(migrationDocumentJson);
cmmnMigrationService.migrateHistoricCaseInstance(caseInstanceId, migrationDocument);
}
protected Date getPlanItemInstanceEndTime(List<HistoricPlanItemInstance> stagePlanItemInstances, Stage stage) {
return getPlanItemInstance(stagePlanItemInstances, stage)
.map(HistoricPlanItemInstance::getEndedTime)
.orElse(null);
}
protected Optional<HistoricPlanItemInstance> getPlanItemInstance(List<HistoricPlanItemInstance> stagePlanItemInstances, Stage stage) { | HistoricPlanItemInstance planItemInstance = null;
for (HistoricPlanItemInstance p : stagePlanItemInstances) {
if (p.getPlanItemDefinitionId().equals(stage.getId())) {
if (p.getEndedTime() == null) {
planItemInstance = p; // one that's not ended yet has precedence
} else {
if (planItemInstance == null) {
planItemInstance = p;
}
}
}
}
return Optional.ofNullable(planItemInstance);
}
} | repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\history\caze\HistoricCaseInstanceResource.java | 2 |
请完成以下Java代码 | public IReturnsInOutProducer setMovementDate(final Date movementDate)
{
Check.assumeNotNull(movementDate, "movementDate not null");
_movementDate = movementDate;
return this;
}
protected final Timestamp getMovementDateToUse()
{
if (_movementDate != null)
{
return TimeUtil.asTimestamp(_movementDate);
}
final Properties ctx = getCtx();
final Timestamp movementDate = Env.getDate(ctx); // use Login date (08306)
return movementDate;
}
@Override
public IReturnsInOutProducer setC_Order(final I_C_Order order)
{
assertConfigurable();
_order = order;
return this;
} | protected I_C_Order getC_Order()
{
return _order;
}
@Override
public IReturnsInOutProducer dontComplete()
{
_complete = false;
return this;
}
protected boolean isComplete()
{
return _complete;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\inout\returns\AbstractReturnsInOutProducer.java | 1 |
请完成以下Java代码 | public void setGO_ServiceType (java.lang.String GO_ServiceType)
{
set_Value (COLUMNNAME_GO_ServiceType, GO_ServiceType);
}
/** Get Service type.
@return Service type */
@Override
public java.lang.String getGO_ServiceType ()
{
return (java.lang.String)get_Value(COLUMNNAME_GO_ServiceType);
}
@Override
public org.compiere.model.I_M_Shipper getM_Shipper() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_M_Shipper_ID, org.compiere.model.I_M_Shipper.class);
}
@Override
public void setM_Shipper(org.compiere.model.I_M_Shipper M_Shipper)
{
set_ValueFromPO(COLUMNNAME_M_Shipper_ID, org.compiere.model.I_M_Shipper.class, M_Shipper);
}
/** Set Lieferweg.
@param M_Shipper_ID
Methode oder Art der Warenlieferung
*/
@Override
public void setM_Shipper_ID (int M_Shipper_ID)
{
if (M_Shipper_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Shipper_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Shipper_ID, Integer.valueOf(M_Shipper_ID));
}
/** Get Lieferweg.
@return Methode oder Art der Warenlieferung
*/
@Override
public int getM_Shipper_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Shipper_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Transport Auftrag. | @param M_ShipperTransportation_ID Transport Auftrag */
@Override
public void setM_ShipperTransportation_ID (int M_ShipperTransportation_ID)
{
if (M_ShipperTransportation_ID < 1)
set_Value (COLUMNNAME_M_ShipperTransportation_ID, null);
else
set_Value (COLUMNNAME_M_ShipperTransportation_ID, Integer.valueOf(M_ShipperTransportation_ID));
}
/** Get Transport Auftrag.
@return Transport Auftrag */
@Override
public int getM_ShipperTransportation_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_ShipperTransportation_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Verarbeitet.
@param Processed
Checkbox sagt aus, ob der Beleg verarbeitet wurde.
*/
@Override
public void setProcessed (boolean Processed)
{
set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
}
/** Get Verarbeitet.
@return Checkbox sagt aus, ob der Beleg verarbeitet wurde.
*/
@Override
public boolean isProcessed ()
{
Object oo = get_Value(COLUMNNAME_Processed);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.go\src\main\java-gen\de\metas\shipper\gateway\go\model\X_GO_DeliveryOrder.java | 1 |
请完成以下Java代码 | public final class KotlinLanguage extends AbstractLanguage {
// Taken from https://kotlinlang.org/docs/keyword-reference.html#hard-keywords
// except keywords contains `!` or `?` because they should be handled as invalid
// package names already
private static final Set<String> KEYWORDS = Set.of("package", "as", "typealias", "class", "this", "super", "val",
"var", "fun", "for", "null", "true", "false", "is", "in", "throw", "return", "break", "continue", "object",
"if", "try", "else", "while", "do", "when", "interface", "typeof");
/**
* Kotlin {@link Language} identifier.
*/
public static final String ID = "kotlin";
/**
* Creates a new instance with the JVM version {@value #DEFAULT_JVM_VERSION}.
*/
public KotlinLanguage() {
this(DEFAULT_JVM_VERSION);
}
/**
* Creates a new instance. | * @param jvmVersion the JVM version
*/
public KotlinLanguage(String jvmVersion) {
super(ID, jvmVersion, "kt");
}
@Override
public boolean supportsEscapingKeywordsInPackage() {
return true;
}
@Override
public boolean isKeyword(String input) {
return KEYWORDS.contains(input);
}
} | repos\initializr-main\initializr-generator\src\main\java\io\spring\initializr\generator\language\kotlin\KotlinLanguage.java | 1 |
请完成以下Java代码 | public static void main(String[] args) {
setup();
publishMessageWithCustomHeaders();
consumeMessageWithCustomHeaders();
}
private static void consumeMessageWithCustomHeaders() {
consumer.subscribe(Arrays.asList(TOPIC));
ConsumerRecords<String, String> records = consumer.poll(Duration.ofMinutes(1));
for (ConsumerRecord<String, String> record : records) {
logger.info(record.key());
logger.info(record.value());
Headers headers = record.headers();
for (Header header : headers) {
logger.info(header.key());
logger.info(new String(header.value()));
}
}
}
private static void publishMessageWithCustomHeaders() {
List<Header> headers = new ArrayList<>();
headers.add(new RecordHeader(HEADER_KEY, HEADER_VALUE.getBytes()));
ProducerRecord<String, String> record1 = new ProducerRecord<>(TOPIC, null, MESSAGE_KEY, MESSAGE_VALUE, headers);
producer.send(record1);
ProducerRecord<String, String> record2 = new ProducerRecord<>(TOPIC, null, System.currentTimeMillis(), MESSAGE_KEY, MESSAGE_VALUE, headers);
producer.send(record2);
} | private static void setup() {
Properties producerProperties = new Properties();
producerProperties.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
producerProperties.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
producerProperties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
Properties consumerProperties = new Properties();
consumerProperties.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
consumerProperties.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
consumerProperties.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
consumerProperties.put(ConsumerConfig.GROUP_ID_CONFIG, "ConsumerGroup1");
producer = new KafkaProducer<>(producerProperties);
consumer = new KafkaConsumer<>(consumerProperties);
}
} | repos\tutorials-master\apache-kafka\src\main\java\com\baeldung\kafka\headers\KafkaMessageHeaders.java | 1 |
请完成以下Java代码 | private JsonSalesOrder createOrder0(@RequestBody final JsonSalesOrderCreateRequest request)
{
final IBPartnerDAO bpartnersRepo = Services.get(IBPartnerDAO.class);
final OrderFactory salesOrderFactory = OrderFactory.newSalesOrder();
if (!Check.isEmpty(request.getDocTypeName(), true))
{
final IDocTypeDAO docTypeDAO = Services.get(IDocTypeDAO.class);
final DocTypeQuery query = DocTypeQuery.builder()
.docBaseType(X_C_DocType.DOCBASETYPE_SalesOrder)
.adClientId(Env.getAD_Client_ID())
.name(request.getDocTypeName())
.build();
final DocTypeId docTypeId = docTypeDAO.getDocTypeId(query);
salesOrderFactory.docType(docTypeId);
}
final BPartnerQuery query = BPartnerQuery.builder()
.bpartnerValue(request.getShipBPartnerCode())
.onlyOrgId(OrgId.ANY)
.onlyOrgId(Env.getOrgId())
.failIfNotExists(true)
.build();
final BPartnerId shipBPartnerId = bpartnersRepo
.retrieveBPartnerIdBy(query)
.get()/* bc failIfNotExists(true) */;
salesOrderFactory.shipBPartner(shipBPartnerId);
salesOrderFactory.datePromised(request.getDatePromised());
request.getLines().forEach(line -> createOrderLine(salesOrderFactory, line));
final I_C_Order salesOrderRecord = salesOrderFactory.createAndComplete();
return toSalesOrder(salesOrderRecord);
}
private void createOrderLine(final OrderFactory salesOrderFactory, final JsonSalesOrderLine salesOrderLine)
{
final IProductDAO productsRepo = Services.get(IProductDAO.class);
final IProductBL productBL = Services.get(IProductBL.class);
final ProductId productId = productsRepo.retrieveProductIdByValue(salesOrderLine.getProductCode());
if (productId == null)
{
throw new AdempiereException("@NotFound@ M_Product_ID@ (@Value=" + salesOrderLine.getProductCode() + ")");
}
final I_C_UOM uom = productBL.getStockUOM(productId);
final Quantity qty = Quantity.of(salesOrderLine.getQty(), uom); | salesOrderFactory.newOrderLine()
.productId(productId)
.addQty(qty)
.manualPrice(salesOrderLine.getPrice());
}
@NonNull
private static JsonSalesOrder toSalesOrder(@NonNull final I_C_Order salesOrderRecord)
{
return JsonSalesOrder.builder()
.salesOrderId(String.valueOf(salesOrderRecord.getC_Order_ID()))
.documentNo(salesOrderRecord.getDocumentNo())
.build();
}
private JsonSalesOrderAttachment toSalesOrderAttachment(final int salesOrderId, final AttachmentEntry entry)
{
return JsonSalesOrderAttachment.builder()
.salesOrderId(String.valueOf(salesOrderId))
.id(AttachmentEntryId.getRepoId(entry.getId()))
.type(JsonConverters.toJsonAttachmentSourceType(entry.getType()))
.filename(entry.getFilename())
.mimeType(entry.getMimeType())
.url(entry.getUrl() != null ? entry.getUrl().toString() : null)
.build();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business.rest-api-impl\src\main\java\de\metas\rest_api\v2\order\sales\SalesOrderRestController.java | 1 |
请完成以下Java代码 | public class ComplexGatewayImpl extends GatewayImpl implements ComplexGateway {
protected static AttributeReference<SequenceFlow> defaultAttribute;
protected static ChildElement<ActivationCondition> activationConditionChild;
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(ComplexGateway.class, BPMN_ELEMENT_COMPLEX_GATEWAY)
.namespaceUri(BPMN20_NS)
.extendsType(Gateway.class)
.instanceProvider(new ModelTypeInstanceProvider<ComplexGateway>() {
public ComplexGateway newInstance(ModelTypeInstanceContext instanceContext) {
return new ComplexGatewayImpl(instanceContext);
}
});
defaultAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_DEFAULT)
.idAttributeReference(SequenceFlow.class)
.build();
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
activationConditionChild = sequenceBuilder.element(ActivationCondition.class)
.build();
typeBuilder.build();
}
public ComplexGatewayImpl(ModelTypeInstanceContext context) {
super(context);
}
@Override
public ComplexGatewayBuilder builder() {
return new ComplexGatewayBuilder((BpmnModelInstance) modelInstance, this);
} | public SequenceFlow getDefault() {
return defaultAttribute.getReferenceTargetElement(this);
}
public void setDefault(SequenceFlow defaultFlow) {
defaultAttribute.setReferenceTargetElement(this, defaultFlow);
}
public ActivationCondition getActivationCondition() {
return activationConditionChild.getChild(this);
}
public void setActivationCondition(ActivationCondition activationCondition) {
activationConditionChild.setChild(this, activationCondition);
}
} | repos\camunda-bpm-platform-master\model-api\bpmn-model\src\main\java\org\camunda\bpm\model\bpmn\impl\instance\ComplexGatewayImpl.java | 1 |
请完成以下Java代码 | private void deleteSelectedIncludedRecords(final PInstanceId pinstanceId)
{
DB.executeUpdateAndThrowExceptionOnFail(SQL_DeleteFrom_AD_PInstance_SelectedIncludedRecords, new Object[] { pinstanceId }, ITrx.TRXNAME_ThreadInherited);
}
private void insertLogs(@NonNull final PInstanceId pInstanceId, @NonNull final List<ProcessInfoLog> logsToSave, @Nullable final String trxName)
{
final String sql = "INSERT INTO " + I_AD_PInstance_Log.Table_Name
+ " ("
+ I_AD_PInstance_Log.COLUMNNAME_AD_PInstance_ID
+ ", "
+ I_AD_PInstance_Log.COLUMNNAME_Log_ID
+ ", "
+ I_AD_PInstance_Log.COLUMNNAME_P_Date
+ ", "
+ I_AD_PInstance_Log.COLUMNNAME_P_Number
+ ", "
+ I_AD_PInstance_Log.COLUMNNAME_P_Msg
+ ", "
+ I_AD_PInstance_Log.COLUMNNAME_AD_Table_ID
+ ", "
+ I_AD_PInstance_Log.COLUMNNAME_Record_ID
+ ", "
+ I_AD_PInstance_Log.COLUMNNAME_AD_Issue_ID
+ ", "
+ I_AD_PInstance_Log.COLUMNNAME_Warnings
+ ")"
+ " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement(sql, trxName);
for (final ProcessInfoLog log : logsToSave)
{
final Integer tableId = Optional.ofNullable(log.getTableRecordReference())
.map(ITableRecordReference::getAD_Table_ID)
.orElse(null);
final Integer recordId = Optional.ofNullable(log.getTableRecordReference())
.map(ITableRecordReference::getRecord_ID)
.orElse(null);
final Integer adIssueId = Optional.ofNullable(log.getAdIssueId())
.map(AdIssueId::getRepoId)
.orElse(null);
final Object[] sqlParams = new Object[] { | pInstanceId.getRepoId(),
log.getLog_ID(),
log.getP_Date(),
log.getP_Number(),
log.getP_Msg(),
tableId,
recordId,
adIssueId,
log.getWarningMessages()
};
DB.setParameters(pstmt, sqlParams);
pstmt.addBatch();
}
pstmt.executeBatch();
logsToSave.forEach(ProcessInfoLog::markAsSavedInDB);
}
catch (final SQLException e)
{
// log only, don't fail
logger.error("Error while saving the process log lines", e);
}
finally
{
DB.close(pstmt);
}
DB.executeUpdateAndThrowExceptionOnFail(SQL_DeleteFrom_AD_PInstance_SelectedIncludedRecords, new Object[] { pInstanceId }, ITrx.TRXNAME_ThreadInherited);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\process\impl\ADPInstanceDAO.java | 1 |
请完成以下Java代码 | public java.lang.String getDocumentNo()
{
return (java.lang.String)get_Value(COLUMNNAME_DocumentNo);
}
@Override
public void setFirstname (java.lang.String Firstname)
{
set_Value (COLUMNNAME_Firstname, Firstname);
}
@Override
public java.lang.String getFirstname()
{
return (java.lang.String)get_Value(COLUMNNAME_Firstname);
}
@Override
public void setGrandTotal (java.math.BigDecimal GrandTotal)
{
set_Value (COLUMNNAME_GrandTotal, GrandTotal);
}
@Override
public java.math.BigDecimal getGrandTotal()
{
BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_GrandTotal);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override | public void setLastname (java.lang.String Lastname)
{
set_Value (COLUMNNAME_Lastname, Lastname);
}
@Override
public java.lang.String getLastname()
{
return (java.lang.String)get_Value(COLUMNNAME_Lastname);
}
@Override
public void setprintjob (java.lang.String printjob)
{
set_Value (COLUMNNAME_printjob, printjob);
}
@Override
public java.lang.String getprintjob()
{
return (java.lang.String)get_Value(COLUMNNAME_printjob);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.printing\de.metas.printing.base\src\main\java-gen\de\metas\printing\model\X_RV_Printing_Bericht_List_Per_Print_Job.java | 1 |
请完成以下Java代码 | public Integer getNavStatus() {
return navStatus;
}
public void setNavStatus(Integer navStatus) {
this.navStatus = navStatus;
}
public Integer getShowStatus() {
return showStatus;
}
public void setShowStatus(Integer showStatus) {
this.showStatus = showStatus;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getKeywords() {
return keywords;
}
public void setKeywords(String keywords) {
this.keywords = keywords;
} | public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", parentId=").append(parentId);
sb.append(", name=").append(name);
sb.append(", level=").append(level);
sb.append(", productCount=").append(productCount);
sb.append(", productUnit=").append(productUnit);
sb.append(", navStatus=").append(navStatus);
sb.append(", showStatus=").append(showStatus);
sb.append(", sort=").append(sort);
sb.append(", icon=").append(icon);
sb.append(", keywords=").append(keywords);
sb.append(", description=").append(description);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\PmsProductCategory.java | 1 |
请完成以下Java代码 | public Long getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return the iban
*/
public String getIban() {
return iban;
}
/**
* @param iban the iban to set
*/
public void setIban(String iban) { | this.iban = iban;
}
/**
* @return the balance
*/
public BigDecimal getBalance() {
return balance;
}
/**
* @param balance the balance to set
*/
public void setBalance(BigDecimal balance) {
this.balance = balance;
}
} | repos\tutorials-master\persistence-modules\r2dbc\src\main\java\com\baeldung\examples\r2dbc\Account.java | 1 |
请完成以下Java代码 | public class SortingDto {
protected String sortBy;
protected String sortOrder;
@JsonInclude(NON_NULL)
protected Map<String, Object> parameters;
public String getSortBy() {
return sortBy;
}
public void setSortBy(String sortBy) {
this.sortBy = sortBy;
} | public String getSortOrder() {
return sortOrder;
}
public void setSortOrder(String sortOrder) {
this.sortOrder = sortOrder;
}
public Map<String, Object> getParameters() {
return parameters;
}
public void setParameters(Map<String, Object> parameters) {
this.parameters = parameters;
}
} | repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\SortingDto.java | 1 |
请完成以下Java代码 | public boolean isCreateCounterDocument(IDocument document)
{
if (isCounterDocument(document))
{
return false;
}
// Document Type
if (retrieveCounterDocTypeOrNull(document) == null)
{
return false;
}
if (retrieveCounterPartnerOrNull(document) == null)
{
return false;
}
final IBPartnerAware bpartnerAware = InterfaceWrapperHelper.asColumnReferenceAwareOrNull(document, IBPartnerAware.class);
if (bpartnerAware.getC_BPartner().getAD_OrgBP_ID() <= 0)
{
// document's BPartner is not linked to any (counter-)org
return false;
}
return true;
}
protected final I_C_DocType retrieveCounterDocTypeOrNull(IDocument document)
{
final IDocumentBL docActionBL = Services.get(IDocumentBL.class);
final I_C_DocType docType = docActionBL.getDocTypeOrNull(document);
if (docType == null)
{
return null;
}
if (!docType.isCreateCounter())
{
return null;
}
int C_DocTypeTarget_ID = 0;
MDocTypeCounter counterDT = MDocTypeCounter.getCounterDocType(document.getCtx(), docType.getC_DocType_ID());
if (counterDT != null)
{
logger.debug(counterDT.toString());
if (counterDT.isCreateCounter() && counterDT.isValid())
{
return counterDT.getCounter_C_DocType();
}
}
else
// indirect
{ | C_DocTypeTarget_ID = MDocTypeCounter.getCounterDocType_ID(document.getCtx(), docType.getC_DocType_ID());
logger.debug("Indirect C_DocTypeTarget_ID=" + C_DocTypeTarget_ID);
if (C_DocTypeTarget_ID > 0)
{
return InterfaceWrapperHelper.create(document.getCtx(), C_DocTypeTarget_ID, I_C_DocType.class, document.get_TrxName());
}
}
return null;
}
protected final I_C_BPartner retrieveCounterPartnerOrNull(IDocument document)
{
// our own org's bpartner would be the the counter document's C_BPartner.
MOrg org = MOrg.get(document.getCtx(), document.getAD_Org_ID());
int counterC_BPartner_ID = org.getLinkedC_BPartner_ID(document.get_TrxName());
if (counterC_BPartner_ID > 0)
{
return InterfaceWrapperHelper.create(document.getCtx(), counterC_BPartner_ID, I_C_BPartner.class, document.get_TrxName());
}
return null;
}
protected final I_AD_Org retrieveCounterOrgOrNull(IDocument document)
{
final IBPartnerAware bpartnerAware = InterfaceWrapperHelper.asColumnReferenceAwareOrNull(document, IBPartnerAware.class);
if (bpartnerAware.getC_BPartner_ID() > 0 && bpartnerAware.getC_BPartner().getAD_OrgBP_ID() > 0)
{
return InterfaceWrapperHelper.create(document.getCtx(), bpartnerAware.getC_BPartner().getAD_OrgBP_ID(), I_AD_Org.class, document.get_TrxName());
}
// document's BPartner is not linked to any (counter-)org
return null;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\document\spi\CounterDocumentHandlerAdapter.java | 1 |
请完成以下Java代码 | public class RejectPickingCommand
{
private final ITrxManager trxManager = Services.get(ITrxManager.class);
private final PickingCandidateRepository pickingCandidateRepository;
private final RejectPickingRequest request;
@Builder
private RejectPickingCommand(
@NonNull final PickingCandidateRepository pickingCandidateRepository,
@NonNull final RejectPickingRequest request)
{
this.pickingCandidateRepository = pickingCandidateRepository;
this.request = request;
}
public RejectPickingResult perform()
{
return trxManager.callInThreadInheritedTrx(this::performInTrx);
}
private RejectPickingResult performInTrx()
{
final PickingCandidate pickingCandidate = getOrCreatePickingCandidate();
pickingCandidate.assertDraft();
pickingCandidate.rejectPicking(request.getQtyToReject());
pickingCandidateRepository.save(pickingCandidate);
return RejectPickingResult.of(pickingCandidate);
}
private PickingCandidate getOrCreatePickingCandidate()
{ | if (request.getExistingPickingCandidateId() != null)
{
final PickingCandidate existingPickingCandidate = pickingCandidateRepository.getById(request.getExistingPickingCandidateId());
if (!request.getShipmentScheduleId().equals(existingPickingCandidate.getShipmentScheduleId()))
{
throw new AdempiereException("ShipmentScheduleId does not match.")
.appendParametersToMessage()
.setParameter("expectedShipmentScheduleId", request.getShipmentScheduleId())
.setParameter("pickingCandidate", existingPickingCandidate);
}
return existingPickingCandidate;
}
else
{
return PickingCandidate.builder()
.processingStatus(PickingCandidateStatus.Draft)
.qtyPicked(request.getQtyToReject())
.shipmentScheduleId(request.getShipmentScheduleId())
.pickFrom(PickFrom.ofHuId(request.getRejectPickingFromHuId()))
.build();
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\candidate\commands\RejectPickingCommand.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void bindTo(MeterRegistry registry) {
List<DataSourcePoolMetadataProvider> metadataProvidersList = this.metadataProviders.stream().toList();
this.dataSources.forEach((name, dataSource) -> bindDataSourceToRegistry(name, dataSource,
metadataProvidersList, registry));
}
private void bindDataSourceToRegistry(String beanName, DataSource dataSource,
Collection<DataSourcePoolMetadataProvider> metadataProviders, MeterRegistry registry) {
String dataSourceName = getDataSourceName(beanName);
new DataSourcePoolMetrics(dataSource, metadataProviders, dataSourceName, Collections.emptyList())
.bindTo(registry);
}
/**
* Get the name of a DataSource based on its {@code beanName}.
* @param beanName the name of the data source bean
* @return a name for the given data source
*/
private String getDataSourceName(String beanName) {
if (beanName.length() > DATASOURCE_SUFFIX.length()
&& StringUtils.endsWithIgnoreCase(beanName, DATASOURCE_SUFFIX)) {
return beanName.substring(0, beanName.length() - DATASOURCE_SUFFIX.length());
}
return beanName;
}
}
}
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(HikariDataSource.class)
static class HikariDataSourceMetricsConfiguration {
@Bean
HikariDataSourceMeterBinder hikariDataSourceMeterBinder(ObjectProvider<DataSource> dataSources) {
return new HikariDataSourceMeterBinder(dataSources);
} | static class HikariDataSourceMeterBinder implements MeterBinder {
private static final Log logger = LogFactory.getLog(HikariDataSourceMeterBinder.class);
private final ObjectProvider<DataSource> dataSources;
HikariDataSourceMeterBinder(ObjectProvider<DataSource> dataSources) {
this.dataSources = dataSources;
}
@Override
public void bindTo(MeterRegistry registry) {
this.dataSources.stream(ObjectProvider.UNFILTERED, false).forEach((dataSource) -> {
HikariDataSource hikariDataSource = DataSourceUnwrapper.unwrap(dataSource, HikariConfigMXBean.class,
HikariDataSource.class);
if (hikariDataSource != null) {
bindMetricsRegistryToHikariDataSource(hikariDataSource, registry);
}
});
}
private void bindMetricsRegistryToHikariDataSource(HikariDataSource hikari, MeterRegistry registry) {
if (hikari.getMetricRegistry() == null && hikari.getMetricsTrackerFactory() == null) {
try {
hikari.setMetricsTrackerFactory(new MicrometerMetricsTrackerFactory(registry));
}
catch (Exception ex) {
logger.warn(LogMessage.format("Failed to bind Hikari metrics: %s", ex.getMessage()));
}
}
}
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-jdbc\src\main\java\org\springframework\boot\jdbc\autoconfigure\metrics\DataSourcePoolMetricsAutoConfiguration.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public String getBuilding() {
return building;
}
/**
* Sets the value of the building property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBuilding(String value) {
this.building = value;
}
/**
* Gets the value of the department property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDepartment() {
return department;
}
/**
* Sets the value of the department property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDepartment(String value) {
this.department = value;
}
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the phone property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPhone() { | return phone;
}
/**
* Sets the value of the phone property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPhone(String value) {
this.phone = value;
}
/**
* Gets the value of the personId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPersonId() {
return personId;
}
/**
* Sets the value of the personId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPersonId(String value) {
this.personId = value;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.dpd\src\main\java-xjc\com\dpd\common\service\types\shipmentservice\_3\PersonalDelivery.java | 2 |
请完成以下Java代码 | public class CamundaOutImpl extends CmmnModelElementInstanceImpl implements CamundaOut {
protected static Attribute<String> camundaSourceAttribute;
protected static Attribute<String> camundaSourceExpressionAttribute;
protected static Attribute<String> camundaVariablesAttribute;
protected static Attribute<String> camundaTargetAttribute;
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(CamundaOut.class, CAMUNDA_ELEMENT_OUT)
.namespaceUri(CAMUNDA_NS)
.instanceProvider(new ModelTypeInstanceProvider<CamundaOut>() {
public CamundaOut newInstance(ModelTypeInstanceContext instanceContext) {
return new CamundaOutImpl(instanceContext);
}
});
camundaSourceAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_SOURCE)
.namespace(CAMUNDA_NS)
.build();
camundaSourceExpressionAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_SOURCE_EXPRESSION)
.namespace(CAMUNDA_NS)
.build();
camundaVariablesAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_VARIABLES)
.namespace(CAMUNDA_NS)
.build();
camundaTargetAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_TARGET)
.namespace(CAMUNDA_NS)
.build();
typeBuilder.build();
}
public CamundaOutImpl(ModelTypeInstanceContext instanceContext) {
super(instanceContext); | }
public String getCamundaSource() {
return camundaSourceAttribute.getValue(this);
}
public void setCamundaSource(String camundaSource) {
camundaSourceAttribute.setValue(this, camundaSource);
}
public String getCamundaSourceExpression() {
return camundaSourceExpressionAttribute.getValue(this);
}
public void setCamundaSourceExpression(String camundaSourceExpression) {
camundaSourceExpressionAttribute.setValue(this, camundaSourceExpression);
}
public String getCamundaVariables() {
return camundaVariablesAttribute.getValue(this);
}
public void setCamundaVariables(String camundaVariables) {
camundaVariablesAttribute.setValue(this, camundaVariables);
}
public String getCamundaTarget() {
return camundaTargetAttribute.getValue(this);
}
public void setCamundaTarget(String camundaTarget) {
camundaTargetAttribute.setValue(this, camundaTarget);
}
} | repos\camunda-bpm-platform-master\model-api\cmmn-model\src\main\java\org\camunda\bpm\model\cmmn\impl\instance\camunda\CamundaOutImpl.java | 1 |
请完成以下Java代码 | public class OrderLine extends CalloutEngine
{
public String product(final ICalloutField calloutField)
{
final I_C_OrderLine orderLine = calloutField.getModel(I_C_OrderLine.class);
final ProductId productId = ProductId.ofRepoIdOrNull(orderLine.getM_Product_ID());
if (productId != null)
{
final IProductBL productBL = Services.get(IProductBL.class);
orderLine.setIsDiverse(productBL.isDiverse(productId));
}
else
{
orderLine.setIsDiverse(false);
}
return NO_ERROR;
}
public String warehouse(final ICalloutField calloutField)
{
final I_C_OrderLine orderLine = calloutField.getModel(I_C_OrderLine.class);
final I_C_Order order = InterfaceWrapperHelper.create(orderLine.getC_Order(), I_C_Order.class);
if (orderLine.getM_Warehouse_ID() == order.getM_Warehouse_ID())
{
// warehouse of order and order line are the same; nothing to do
return NO_ERROR;
}
final IOrgDAO orgsRepo = Services.get(IOrgDAO.class);
final OrgId orgId = OrgId.ofRepoId(order.getAD_Org_ID());
final WarehouseId orgDropShipWarehouseId = orgsRepo.getOrgDropshipWarehouseId(orgId);
if (orgDropShipWarehouseId != null && orderLine.getM_Warehouse_ID() == orgDropShipWarehouseId.getRepoId())
{
// order line's warehouse is the dropship warehouse; nothing to do
return NO_ERROR;
} | // correcting order line's warehouse id
orderLine.setM_Warehouse_ID(order.getM_Warehouse_ID());
return NO_ERROR;
}
/**
* Called for: C_OrderLine.IsPriceManual
*/
public String chkManualPrice(final ICalloutField calloutField)
{
final I_C_OrderLine orderLine = calloutField.getModel(I_C_OrderLine.class);
if (orderLine.isManualPrice())
{
return NO_ERROR;
}
if (orderLine.getM_Product_ID() <= 0)
{
return NO_ERROR; // if we don't even have a product yet, then there is nothing to update
}
Services.get(IOrderLineBL.class).updatePrices(orderLine);
return NO_ERROR;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\adempiere\callout\OrderLine.java | 1 |
请完成以下Java代码 | public void addHeader(String name, String type) {
EventPayload eventPayload = payload.get(name);
if (eventPayload != null) {
eventPayload.setHeader(true);
} else {
payload.put(name, EventPayload.header(name, type));
}
}
public void addPayload(String name, String type) {
EventPayload eventPayload = payload.get(name);
if (eventPayload != null) {
eventPayload.setType(type);
} else {
payload.put(name, new EventPayload(name, type));
}
}
public void addPayload(EventPayload payload) {
this.payload.put(payload.getName(), payload);
} | public void addCorrelation(String name, String type) {
EventPayload eventPayload = payload.get(name);
if (eventPayload != null) {
eventPayload.setCorrelationParameter(true);
} else {
payload.put(name, EventPayload.correlation(name, type));
}
}
public void addFullPayload(String name) {
EventPayload eventPayload = payload.get(name);
if (eventPayload != null) {
eventPayload.setFullPayload(true);
eventPayload.setCorrelationParameter(false);
eventPayload.setHeader(false);
} else {
payload.put(name, EventPayload.fullPayload(name));
}
}
} | repos\flowable-engine-main\modules\flowable-event-registry-model\src\main\java\org\flowable\eventregistry\model\EventModel.java | 1 |
请完成以下Java代码 | protected boolean afterSave (boolean newRecord, boolean success)
{
if (!success)
{
return success;
}
return updateHeader();
} // afterSave
/**
* Update Cash Header.
* Statement Difference, Ending Balance
* @return true if success
*/
private boolean updateHeader()
{
String sql = "UPDATE C_Cash c"
+ " SET StatementDifference="
//replace null with 0 there is no difference with this
+ "(SELECT COALESCE(SUM(currencyConvert(cl.Amount, cl.C_Currency_ID, cb.C_Currency_ID, c.DateAcct, 0, c.AD_Client_ID, c.AD_Org_ID)),0) "
+ "FROM C_CashLine cl, C_CashBook cb "
+ "WHERE cb.C_CashBook_ID=c.C_CashBook_ID"
+ " AND cl.C_Cash_ID=c.C_Cash_ID"
+ " AND cl.IsActive='Y'"
+") "
+ "WHERE C_Cash_ID=" + getC_Cash_ID();
int no = DB.executeUpdateAndSaveErrorOnFail(sql, get_TrxName());
if (no != 1)
{
log.warn("Difference #" + no);
}
// Ending Balance
sql = "UPDATE C_Cash"
+ " SET EndingBalance = BeginningBalance + StatementDifference "
+ "WHERE C_Cash_ID=" + getC_Cash_ID();
no = DB.executeUpdateAndSaveErrorOnFail(sql, get_TrxName());
if (no != 1)
{
log.warn("Balance #" + no);
}
return no == 1;
} // updateHeader
@Override | public MCash getC_Cash() throws RuntimeException
{
return getParent();
}
public String getSummary()
{
// TODO: improve summary message
StringBuffer sb = new StringBuffer();
MCash cash = getC_Cash();
if (cash != null && cash.getC_Cash_ID() > 0)
{
sb.append(cash.getSummary());
}
if (sb.length() > 0)
{
sb.append(" - ");
}
sb.append(Msg.translate(getCtx(), COLUMNNAME_Amount)).append(": ").append(getAmount());
return sb.toString();
}
} // MCashLine | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\MCashLine.java | 1 |
请完成以下Java代码 | private static Optional<Percent> calculateProfitPercent(
@Nullable final Money profitSalesPriceActual,
@Nullable final Money profitPurchasePriceActual)
{
if (profitSalesPriceActual == null || profitPurchasePriceActual == null)
{
return Optional.empty();
}
// If not the same currency then we cannot calculate the profit percentage
if (!Money.isSameCurrency(profitPurchasePriceActual, profitSalesPriceActual))
{
return Optional.empty();
}
final Percent profitPercent = Percent.ofDelta(profitPurchasePriceActual.toBigDecimal(), profitSalesPriceActual.toBigDecimal());
return Optional.of(profitPercent);
}
public BigDecimal getProfitSalesPriceActualAsBigDecimalOr(final BigDecimal defaultValue)
{
return profitSalesPriceActual.map(Money::toBigDecimal).orElse(defaultValue);
}
public BigDecimal getProfitPurchasePriceActualAsBigDecimalOr(@Nullable final BigDecimal defaultValue)
{
return profitPurchasePriceActual.map(Money::toBigDecimal).orElse(defaultValue);
}
public BigDecimal getPurchasePriceActualAsBigDecimalOr(@Nullable final BigDecimal defaultValue)
{
return purchasePriceActual.map(Money::toBigDecimal).orElse(defaultValue);
}
//
//
public static class PurchaseProfitInfoBuilder
{
public PurchaseProfitInfoBuilder profitSalesPriceActual(@Nullable final Money profitSalesPriceActual)
{
return profitSalesPriceActual(Optional.ofNullable(profitSalesPriceActual));
} | public PurchaseProfitInfoBuilder profitSalesPriceActual(@NonNull final Optional<Money> profitSalesPriceActual)
{
this.profitSalesPriceActual = profitSalesPriceActual;
return this;
}
public PurchaseProfitInfoBuilder profitPurchasePriceActual(@Nullable final Money profitPurchasePriceActual)
{
return profitPurchasePriceActual(Optional.ofNullable(profitPurchasePriceActual));
}
public PurchaseProfitInfoBuilder profitPurchasePriceActual(@NonNull final Optional<Money> profitPurchasePriceActual)
{
this.profitPurchasePriceActual = profitPurchasePriceActual;
return this;
}
public PurchaseProfitInfoBuilder purchasePriceActual(@Nullable final Money purchasePriceActual)
{
return purchasePriceActual(Optional.ofNullable(purchasePriceActual));
}
public PurchaseProfitInfoBuilder purchasePriceActual(@NonNull final Optional<Money> purchasePriceActual)
{
this.purchasePriceActual = purchasePriceActual;
return this;
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.purchasecandidate.base\src\main\java\de\metas\purchasecandidate\grossprofit\PurchaseProfitInfo.java | 1 |
请完成以下Java代码 | public CaseInstanceBuilder businessKey(String businessKey) {
this.businessKey = businessKey;
return this;
}
public CaseInstanceBuilder caseDefinitionTenantId(String tenantId) {
this.caseDefinitionTenantId = tenantId;
isTenantIdSet = true;
return this;
}
public CaseInstanceBuilder caseDefinitionWithoutTenantId() {
this.caseDefinitionTenantId = null;
isTenantIdSet = true;
return this;
}
public CaseInstanceBuilder setVariable(String variableName, Object variableValue) {
ensureNotNull(NotValidException.class, "variableName", variableName);
if (variables == null) {
variables = Variables.createVariables();
}
variables.putValue(variableName, variableValue);
return this;
}
public CaseInstanceBuilder setVariables(Map<String, Object> variables) {
if (variables != null) {
if (this.variables == null) {
this.variables = Variables.fromMap(variables);
}
else {
this.variables.putAll(variables);
}
}
return this;
}
public CaseInstance create() {
if (isTenantIdSet && caseDefinitionId != null) {
throw LOG.exceptionCreateCaseInstanceByIdAndTenantId();
}
try {
CreateCaseInstanceCmd command = new CreateCaseInstanceCmd(this);
if(commandExecutor != null) {
return commandExecutor.execute(command);
} else {
return command.execute(commandContext);
}
} catch (CaseDefinitionNotFoundException e) {
throw new NotFoundException(e.getMessage(), e);
} catch (NullValueException e) {
throw new NotValidException(e.getMessage(), e); | } catch (CaseIllegalStateTransitionException e) {
throw new NotAllowedException(e.getMessage(), e);
}
}
// getters ////////////////////////////////////
public String getCaseDefinitionKey() {
return caseDefinitionKey;
}
public String getCaseDefinitionId() {
return caseDefinitionId;
}
public String getBusinessKey() {
return businessKey;
}
public VariableMap getVariables() {
return variables;
}
public String getCaseDefinitionTenantId() {
return caseDefinitionTenantId;
}
public boolean isTenantIdSet() {
return isTenantIdSet;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmmn\CaseInstanceBuilderImpl.java | 1 |
请完成以下Java代码 | public void setAttributesKey (final java.lang.String AttributesKey)
{
set_Value (COLUMNNAME_AttributesKey, AttributesKey);
}
@Override
public java.lang.String getAttributesKey()
{
return get_ValueAsString(COLUMNNAME_AttributesKey);
}
@Override
public void setMD_Stock_ID (final int MD_Stock_ID)
{
if (MD_Stock_ID < 1)
set_ValueNoCheck (COLUMNNAME_MD_Stock_ID, null);
else
set_ValueNoCheck (COLUMNNAME_MD_Stock_ID, MD_Stock_ID);
}
@Override
public int getMD_Stock_ID()
{
return get_ValueAsInt(COLUMNNAME_MD_Stock_ID);
}
@Override
public void setM_Product_ID (final int M_Product_ID)
{
if (M_Product_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Product_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Product_ID, M_Product_ID);
}
@Override
public int getM_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_ID);
}
@Override
public void setM_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 setQtyOnHand (final @Nullable BigDecimal QtyOnHand)
{
set_Value (COLUMNNAME_QtyOnHand, QtyOnHand);
}
@Override
public BigDecimal getQtyOnHand()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyOnHand);
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_Stock.java | 1 |
请完成以下Java代码 | public static void fillBpmnTypes(
Map<Class<? extends BaseElement>, Class<? extends BaseBpmnJsonConverter>> convertersToJsonMap
) {
convertersToJsonMap.put(EndEvent.class, EndEventJsonConverter.class);
}
protected String getStencilId(BaseElement baseElement) {
EndEvent endEvent = (EndEvent) baseElement;
List<EventDefinition> eventDefinitions = endEvent.getEventDefinitions();
if (eventDefinitions.size() != 1) {
return STENCIL_EVENT_END_NONE;
}
EventDefinition eventDefinition = eventDefinitions.get(0);
if (eventDefinition instanceof ErrorEventDefinition) {
return STENCIL_EVENT_END_ERROR;
} else if (eventDefinition instanceof CancelEventDefinition) {
return STENCIL_EVENT_END_CANCEL;
} else if (eventDefinition instanceof TerminateEventDefinition) {
return STENCIL_EVENT_END_TERMINATE;
} else {
return STENCIL_EVENT_END_NONE;
}
}
protected void convertElementToJson(ObjectNode propertiesNode, BaseElement baseElement) {
EndEvent endEvent = (EndEvent) baseElement;
addEventProperties(endEvent, propertiesNode);
}
protected FlowElement convertJsonToElement(
JsonNode elementNode,
JsonNode modelNode,
Map<String, JsonNode> shapeMap
) {
EndEvent endEvent = new EndEvent();
String stencilId = BpmnJsonConverterUtil.getStencilId(elementNode);
if (STENCIL_EVENT_END_ERROR.equals(stencilId)) {
convertJsonToErrorDefinition(elementNode, endEvent); | } else if (STENCIL_EVENT_END_CANCEL.equals(stencilId)) {
CancelEventDefinition eventDefinition = new CancelEventDefinition();
endEvent.getEventDefinitions().add(eventDefinition);
} else if (STENCIL_EVENT_END_TERMINATE.equals(stencilId)) {
TerminateEventDefinition eventDefinition = new TerminateEventDefinition();
String terminateAllStringValue = getPropertyValueAsString(PROPERTY_TERMINATE_ALL, elementNode);
if (StringUtils.isNotEmpty(terminateAllStringValue)) {
eventDefinition.setTerminateAll("true".equals(terminateAllStringValue));
}
String terminateMiStringValue = getPropertyValueAsString(PROPERTY_TERMINATE_MULTI_INSTANCE, elementNode);
if (StringUtils.isNotEmpty(terminateMiStringValue)) {
eventDefinition.setTerminateMultiInstance("true".equals(terminateMiStringValue));
}
endEvent.getEventDefinitions().add(eventDefinition);
}
return endEvent;
}
} | repos\Activiti-develop\activiti-core\activiti-json-converter\src\main\java\org\activiti\editor\language\json\converter\EndEventJsonConverter.java | 1 |
请完成以下Java代码 | public I_AD_Role getAD_Role() throws RuntimeException
{
return (I_AD_Role)MTable.get(getCtx(), I_AD_Role.Table_Name)
.getPO(getAD_Role_ID(), get_TrxName()); }
/** Set Role.
@param AD_Role_ID
Responsibility Role
*/
public void setAD_Role_ID (int AD_Role_ID)
{
if (AD_Role_ID < 0)
set_Value (COLUMNNAME_AD_Role_ID, null);
else
set_Value (COLUMNNAME_AD_Role_ID, Integer.valueOf(AD_Role_ID));
}
/** Get Role.
@return Responsibility Role
*/
public int getAD_Role_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Role_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_AD_User getAD_User() throws RuntimeException
{
return (I_AD_User)MTable.get(getCtx(), I_AD_User.Table_Name)
.getPO(getAD_User_ID(), get_TrxName()); }
/** Set User/Contact.
@param AD_User_ID
User within the system - Internal or Business Partner Contact
*/
public void setAD_User_ID (int AD_User_ID)
{
if (AD_User_ID < 1) | set_Value (COLUMNNAME_AD_User_ID, null);
else
set_Value (COLUMNNAME_AD_User_ID, Integer.valueOf(AD_User_ID));
}
/** Get User/Contact.
@return User within the system - Internal or Business Partner Contact
*/
public int getAD_User_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), String.valueOf(getAD_User_ID()));
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_AlertRecipient.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public RpTradePaymentRecord getSuccessRecordByMerchantNoAndMerchantOrderNo(String merchantNo, String merchantOrderNo) {
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("status", TradeStatusEnum.SUCCESS.name());
paramMap.put("merchantNo", merchantNo);
paramMap.put("merchantOrderNo", merchantOrderNo);
return super.getBy(paramMap);
}
/**
* 根据支付流水号查询支付记录
*
* @param trxNo
* @return
*/
public RpTradePaymentRecord getByTrxNo(String trxNo) {
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("trxNo", trxNo); | return super.getBy(paramMap);
}
public List<Map<String, String>> getPaymentReport(String merchantNo){
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("status", TradeStatusEnum.SUCCESS.name());
paramMap.put("merchantNo", merchantNo);
return super.getSessionTemplate().selectList(getStatement("getPaymentReport"),paramMap);
}
public List<Map<String, String>> getPayWayReport(String merchantNo){
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("status", TradeStatusEnum.SUCCESS.name());
paramMap.put("merchantNo", merchantNo);
return super.getSessionTemplate().selectList(getStatement("getPayWayReport"),paramMap);
}
} | repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\trade\dao\impl\RpTradePaymentRecordDaoImpl.java | 2 |
请完成以下Spring Boot application配置 | spring:
application:
name: demo-application-activemq
# ActiveMQ 配置项,对应 ActiveMQProperties 配置类
activemq:
broker-url: tcp://127.0.0.1:61616 # Activemq Broker 的地址
user: admin # 账号
password: admin # 密码
packages:
trust-all: true # 可信任的反序列化包
# Zipkin 配置项,对应 ZipkinProperties 类
zipkin:
base-url: http://127.0.0.1:9411 # Zipkin 服务的地址
# Spring Cloud | Sleuth 配置项
sleuth:
messaging:
# Spring Cloud Sleuth 针对 JMS 组件的配置项
jms:
enabled: true # 是否开启
remote-service-name: jms # 远程服务名,默认为 jms | repos\SpringBoot-Labs-master\labx-13\labx-13-sc-sleuth-mq-activemq\src\main\resources\application.yaml | 2 |
请完成以下Java代码 | public @Nullable Set<AuthenticatorTransport> getTransports() {
return this.transports;
}
/**
* Creates a new {@link PublicKeyCredentialDescriptorBuilder}
* @return a new {@link PublicKeyCredentialDescriptorBuilder}
*/
public static PublicKeyCredentialDescriptorBuilder builder() {
return new PublicKeyCredentialDescriptorBuilder();
}
/**
* Used to create {@link PublicKeyCredentialDescriptor}
*
* @author Rob Winch
* @since 6.4
*/
public static final class PublicKeyCredentialDescriptorBuilder {
private PublicKeyCredentialType type = PublicKeyCredentialType.PUBLIC_KEY;
private @Nullable Bytes id;
private @Nullable Set<AuthenticatorTransport> transports;
private PublicKeyCredentialDescriptorBuilder() {
}
/**
* Sets the {@link #getType()} property.
* @param type the type
* @return the {@link PublicKeyCredentialDescriptorBuilder}
*/
public PublicKeyCredentialDescriptorBuilder type(PublicKeyCredentialType type) {
this.type = type;
return this;
}
/**
* Sets the {@link #getId()} property. | * @param id the id
* @return the {@link PublicKeyCredentialDescriptorBuilder}
*/
public PublicKeyCredentialDescriptorBuilder id(Bytes id) {
this.id = id;
return this;
}
/**
* Sets the {@link #getTransports()} property.
* @param transports the transports
* @return the {@link PublicKeyCredentialDescriptorBuilder}
*/
public PublicKeyCredentialDescriptorBuilder transports(Set<AuthenticatorTransport> transports) {
this.transports = transports;
return this;
}
/**
* Sets the {@link #getTransports()} property.
* @param transports the transports
* @return the {@link PublicKeyCredentialDescriptorBuilder}
*/
public PublicKeyCredentialDescriptorBuilder transports(AuthenticatorTransport... transports) {
return transports(Set.of(transports));
}
/**
* Create a new {@link PublicKeyCredentialDescriptor}
* @return a new {@link PublicKeyCredentialDescriptor}
*/
public PublicKeyCredentialDescriptor build() {
return new PublicKeyCredentialDescriptor(this.type, this.id, this.transports);
}
}
} | repos\spring-security-main\webauthn\src\main\java\org\springframework\security\web\webauthn\api\PublicKeyCredentialDescriptor.java | 1 |
请完成以下Java代码 | public static abstract class ClientUIAsyncRunnableAdapter<InitialValueType, ResultType, PartialResultType>
implements IClientUIAsyncRunnable<InitialValueType, ResultType, PartialResultType>
{
private static final transient Logger logger = LogManager.getLogger(IClientUIAsyncInvoker.ClientUIAsyncRunnableAdapter.class);
@Override
public void prepareInUI(final IClientUIAsyncExecutor<InitialValueType, ResultType, PartialResultType> executor)
{
// nothing at this level
}
@Override
public abstract ResultType runInBackground(IClientUIAsyncExecutor<InitialValueType, ResultType, PartialResultType> executor);
@Override
public void partialUpdateUI(final IClientUIAsyncExecutor<InitialValueType, ResultType, PartialResultType> executor, final PartialResultType partialResult)
{
logger.warn("Got a partial result which was not handled. Usually this happens when developer publishes partial results but it does not implement the partialUpdateUI method."
+ "\n Partial result: " + partialResult | + "\n Runnable(this): " + this
+ "\n Executor: " + executor);
}
@Override
public void finallyUpdateUI(final IClientUIAsyncExecutor<InitialValueType, ResultType, PartialResultType> executor, final ResultType result)
{
// nothing at this level
}
@Override
public void handleExceptionInUI(final IClientUIAsyncExecutor<InitialValueType, ResultType, PartialResultType> executor, final Throwable ex)
{
throw AdempiereException.wrapIfNeeded(ex);
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\adempiere\form\IClientUIAsyncInvoker.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class MSV3ClientConfig
{
public static final Version VERSION_1 = Version.builder()
.id("1")
.jaxbPackagesToScan(de.metas.vertical.pharma.vendor.gateway.msv3.schema.v1.ObjectFactory.class.getPackage().getName())
.build();
public static final Version VERSION_2 = Version.builder()
.id("2")
.jaxbPackagesToScan(de.metas.vertical.pharma.vendor.gateway.msv3.schema.v2.ObjectFactory.class.getPackage().getName())
.build();
@NonNull
URL baseUrl;
@NonNull
String authUsername;
@NonNull
String authPassword;
@Getter
@NonNull
BPartnerId bpartnerId;
@NonNull
@Default
Version version = VERSION_2; | @NonNull
ClientSoftwareId clientSoftwareId;
/** might be null, if the MSV3ClientConfig wasn't stored yet */
@Getter
MSV3ClientConfigId configId;
public void assertVersion(@NonNull final String expectedVersion)
{
if (!Objects.equals(this.version.getId(), expectedVersion))
{
throw new AdempiereException("Configuration does not have the expected version")
.setParameter("config", this)
.setParameter("expectedVersion", expectedVersion)
.appendParametersToMessage();
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.vendor.gateway.msv3\src\main\java\de\metas\vertical\pharma\vendor\gateway\msv3\config\MSV3ClientConfig.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class ProductController {
@Autowired
private ProductService productService;
@GetMapping("/products")
public ResponseEntity<List<Product>> getAllProduct(){
return ResponseEntity.ok().body(productService.getAllProduct());
}
@GetMapping("/products/{id}")
public ResponseEntity<Product> getProductById(@PathVariable long id){
return ResponseEntity.ok().body(productService.getProductById(id));
}
@PostMapping("/products")
public ResponseEntity<Product> createProduct(@RequestBody Product product){ | return ResponseEntity.ok().body(this.productService.createProduct(product));
}
@PutMapping("/products/{id}")
public ResponseEntity<Product> updateProduct(@PathVariable long id, @RequestBody Product product){
product.setId(id);
return ResponseEntity.ok().body(this.productService.updateProduct(product));
}
@DeleteMapping("/products/{id}")
public HttpStatus deleteProduct(@PathVariable long id){
this.productService.deleteProduct(id);
return HttpStatus.OK;
}
} | repos\Spring-Boot-Advanced-Projects-main\springboot-crud-hibernate-example\src\main\java\net\alanbinu\springboot\controller\ProductController.java | 2 |
请完成以下Java代码 | public Map<String, String> findAll() {
try (Environment environment = openEnvironmentExclusively()) {
Transaction readonlyTransaction = environment.beginReadonlyTransaction();
try {
Store taskStore = environment.openStore(TASK_STORE,
StoreConfig.WITHOUT_DUPLICATES, readonlyTransaction);
Map<String, String> result = new HashMap<>();
try (Cursor cursor = taskStore.openCursor(readonlyTransaction)) {
while (cursor.getNext()) {
result.put(StringBinding.entryToString(cursor.getKey()),
StringBinding.entryToString(cursor.getValue()));
}
}
return result;
} finally {
readonlyTransaction.abort();
}
}
} | public void deleteAll() {
try (Environment environment = openEnvironmentExclusively()) {
Transaction exclusiveTransaction = environment.beginExclusiveTransaction();
try {
Store taskStore = environment.openStore(TASK_STORE,
StoreConfig.WITHOUT_DUPLICATES, exclusiveTransaction);
try (Cursor cursor = taskStore.openCursor(exclusiveTransaction)) {
while (cursor.getNext()) {
taskStore.delete(exclusiveTransaction, cursor.getKey());
}
}
} finally {
exclusiveTransaction.commit();
}
}
}
} | repos\tutorials-master\persistence-modules\persistence-libraries\src\main\java\com\baeldung\jetbrainsxodus\TaskEnvironmentRepository.java | 1 |
请完成以下Java代码 | protected void prepare()
{
recordId = getRecord_ID();
}
@Override
protected String doIt()
{
final IExport<? extends I_EDI_Document> export = ediDocumentBL.createExport(
getCtx(),
getClientID(),
getTable_ID(),
recordId,
get_TrxName());
final List<Exception> feedback = export.doExport();
if (feedback == null || feedback.isEmpty())
{
return MSG_OK;
}
final String errorTitle = buildAndTrlTitle(export.getTableIdentifier(), export.getDocument());
final String errorMessage = ediDocumentBL.buildFeedback(feedback); | final I_EDI_Document document = export.getDocument();
document.setEDIErrorMsg(errorMessage);
saveRecord(document);
throw new AdempiereException(errorTitle + "\n" + errorMessage).markAsUserValidationError();
}
private String buildAndTrlTitle(final String tableNameIdentifier, final I_EDI_Document document)
{
final StringBuilder titleBuilder = new StringBuilder();
titleBuilder.append("@").append(tableNameIdentifier).append("@ ").append(document.getDocumentNo());
final String tableNameIdentifierTrl = Services.get(IMsgBL.class).parseTranslation(getCtx(), titleBuilder.toString());
return tableNameIdentifierTrl;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.edi\src\main\java\de\metas\edi\process\EDIExport.java | 1 |
请完成以下Java代码 | public boolean isNoWaitStatesAsyncLeave() {
return noWaitStatesAsyncLeave;
}
public void setNoWaitStatesAsyncLeave(boolean noWaitStatesAsyncLeave) {
this.noWaitStatesAsyncLeave = noWaitStatesAsyncLeave;
}
public VariableAggregationDefinitions getAggregations() {
return aggregations;
}
public void setAggregations(VariableAggregationDefinitions aggregations) {
this.aggregations = aggregations;
}
public void addAggregation(VariableAggregationDefinition aggregation) {
if (this.aggregations == null) {
this.aggregations = new VariableAggregationDefinitions();
}
this.aggregations.getAggregations().add(aggregation);
}
@Override
public MultiInstanceLoopCharacteristics clone() {
MultiInstanceLoopCharacteristics clone = new MultiInstanceLoopCharacteristics();
clone.setValues(this);
return clone;
} | public void setValues(MultiInstanceLoopCharacteristics otherLoopCharacteristics) {
super.setValues(otherLoopCharacteristics);
setInputDataItem(otherLoopCharacteristics.getInputDataItem());
setCollectionString(otherLoopCharacteristics.getCollectionString());
if (otherLoopCharacteristics.getHandler() != null) {
setHandler(otherLoopCharacteristics.getHandler().clone());
}
setLoopCardinality(otherLoopCharacteristics.getLoopCardinality());
setCompletionCondition(otherLoopCharacteristics.getCompletionCondition());
setElementVariable(otherLoopCharacteristics.getElementVariable());
setElementIndexVariable(otherLoopCharacteristics.getElementIndexVariable());
setSequential(otherLoopCharacteristics.isSequential());
setNoWaitStatesAsyncLeave(otherLoopCharacteristics.isNoWaitStatesAsyncLeave());
if (otherLoopCharacteristics.getAggregations() != null) {
setAggregations(otherLoopCharacteristics.getAggregations().clone());
}
}
} | repos\flowable-engine-main\modules\flowable-bpmn-model\src\main\java\org\flowable\bpmn\model\MultiInstanceLoopCharacteristics.java | 1 |
请完成以下Java代码 | public void collectRemovedRowIds(final Collection<DocumentId> rowIds)
{
if (removedRowIds == null)
{
removedRowIds = new HashSet<>(rowIds);
}
else
{
removedRowIds.addAll(rowIds);
}
}
@Override
public Set<DocumentId> getRemovedRowIds()
{
final HashSet<DocumentId> removedRowIds = this.removedRowIds;
return removedRowIds != null ? removedRowIds : ImmutableSet.of();
}
@Override
public void collectChangedRowIds(final Collection<DocumentId> rowIds)
{
if (changedRowIds == null)
{
changedRowIds = new HashSet<>(rowIds); | }
else
{
changedRowIds.addAll(rowIds);
}
}
@Override
public Set<DocumentId> getChangedRowIds()
{
final HashSet<DocumentId> changedRowIds = this.changedRowIds;
return changedRowIds != null ? changedRowIds : ImmutableSet.of();
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\view\AddRemoveChangedRowIdsCollector.java | 1 |
请完成以下Java代码 | void setEntry(String alias, KeyStore.SecretKeyEntry secretKeyEntry, KeyStore.ProtectionParameter protectionParameter) throws KeyStoreException {
keyStore.setEntry(alias, secretKeyEntry, protectionParameter);
}
KeyStore.Entry getEntry(String alias) throws UnrecoverableEntryException, NoSuchAlgorithmException, KeyStoreException {
KeyStore.ProtectionParameter protParam = new KeyStore.PasswordProtection(keyStorePassword.toCharArray());
return keyStore.getEntry(alias, protParam);
}
void setKeyEntry(String alias, PrivateKey privateKey, String keyPassword, Certificate[] certificateChain) throws KeyStoreException {
keyStore.setKeyEntry(alias, privateKey, keyPassword.toCharArray(), certificateChain);
}
void setCertificateEntry(String alias, Certificate certificate) throws KeyStoreException {
keyStore.setCertificateEntry(alias, certificate);
}
Certificate getCertificate(String alias) throws KeyStoreException {
return keyStore.getCertificate(alias);
}
void deleteEntry(String alias) throws KeyStoreException {
keyStore.deleteEntry(alias); | }
void deleteKeyStore() throws KeyStoreException, IOException {
Enumeration<String> aliases = keyStore.aliases();
while (aliases.hasMoreElements()) {
String alias = aliases.nextElement();
keyStore.deleteEntry(alias);
}
keyStore = null;
Path keyStoreFile = Paths.get(keyStoreName);
Files.delete(keyStoreFile);
}
KeyStore getKeyStore() {
return this.keyStore;
}
} | repos\tutorials-master\core-java-modules\core-java-security\src\main\java\com\baeldung\keystore\JavaKeyStore.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class AccountController {
@Autowired
private RpAccountService rpAccountService;
@Autowired
private RpUserInfoService rpUserInfoService;
@Autowired
private RpAccountHistoryService rpAccountHistoryService;
/**
* 函数功能说明 : 查询账户信息
*
* @参数: @return
* @return String
* @throws
*/
@RequestMapping(value = "/list", method ={RequestMethod.POST, RequestMethod.GET})
public String list(RpAccount rpAccount, PageParam pageParam, Model model) {
PageBean pageBean = rpAccountService.listPage(pageParam, rpAccount);
List<Object> recordList = pageBean.getRecordList();
for(Object obj : recordList){
RpAccount account = (RpAccount)obj;
RpUserInfo userInfo = rpUserInfoService.getDataByMerchentNo(account.getUserNo());
account.setUserName(userInfo.getUserName());
}
model.addAttribute("pageBean", pageBean);
model.addAttribute("pageParam", pageParam);
model.addAttribute("rpAccount",rpAccount);
return "account/list";
}
/**
* 函数功能说明 : 查询账户历史信息
*
* @参数: @return | * @return String
* @throws
*/
@RequestMapping(value = "/historyList", method ={RequestMethod.POST, RequestMethod.GET})
public String historyList(RpAccountHistory rpAccountHistory, PageParam pageParam, Model model) {
PageBean pageBean = rpAccountHistoryService.listPage(pageParam, rpAccountHistory);
List<Object> recordList = pageBean.getRecordList();
for(Object obj : recordList){
RpAccountHistory history = (RpAccountHistory)obj;
RpUserInfo userInfo = rpUserInfoService.getDataByMerchentNo(history.getUserNo());
history.setUserName(userInfo.getUserName());
}
model.addAttribute("pageBean", pageBean);
model.addAttribute("pageParam", pageParam);
model.addAttribute("rpAccountHistory",rpAccountHistory);
return "account/historyList";
}
} | repos\roncoo-pay-master\roncoo-pay-web-boss\src\main\java\com\roncoo\pay\controller\account\AccountController.java | 2 |
请完成以下Java代码 | public final @Nullable String getService() {
return this.service;
}
/**
* Indicates whether the <code>renew</code> parameter should be sent to the CAS login
* URL and CAS validation URL.
* <p>
* If <code>true</code>, it will force CAS to authenticate the user again (even if the
* user has previously authenticated). During ticket validation it will require the
* ticket was generated as a consequence of an explicit login. High security
* applications would probably set this to <code>true</code>. Defaults to
* <code>false</code>, providing automated single sign on.
* @return whether to send the <code>renew</code> parameter to CAS
*/
public final boolean isSendRenew() {
return this.sendRenew;
}
public final void setSendRenew(final boolean sendRenew) {
this.sendRenew = sendRenew;
}
public final void setService(final String service) {
this.service = service;
}
public final String getArtifactParameter() {
return this.artifactParameter;
}
/**
* Configures the Request Parameter to look for when attempting to see if a CAS ticket
* was sent from the server. | * @param artifactParameter the id to use. Default is "ticket".
*/
public final void setArtifactParameter(final String artifactParameter) {
this.artifactParameter = artifactParameter;
}
/**
* Configures the Request parameter to look for when attempting to send a request to
* CAS.
* @return the service parameter to use. Default is "service".
*/
public final String getServiceParameter() {
return this.serviceParameter;
}
public final void setServiceParameter(final String serviceParameter) {
this.serviceParameter = serviceParameter;
}
public final boolean isAuthenticateAllArtifacts() {
return this.authenticateAllArtifacts;
}
/**
* If true, then any non-null artifact (ticket) should be authenticated. Additionally,
* the service will be determined dynamically in order to ensure the service matches
* the expected value for this artifact.
* @param authenticateAllArtifacts
*/
public final void setAuthenticateAllArtifacts(final boolean authenticateAllArtifacts) {
this.authenticateAllArtifacts = authenticateAllArtifacts;
}
} | repos\spring-security-main\cas\src\main\java\org\springframework\security\cas\ServiceProperties.java | 1 |
请完成以下Spring Boot application配置 | server:
port: 9000
spring:
application:
name: server-provider
cloud:
consul:
host: 192.168.140.215
port: 8500
discovery:
health-check-interval: 10s
service-name: ${s | pring.application.name}
register-health-check: true
health-check-path: /check | repos\SpringAll-master\55.Spring-Cloud-Consul\server-proivder\src\main\resources\application.yml | 2 |
请完成以下Java代码 | public HttpServletRequest refreshTokensIfExpiring(HttpServletRequest httpServletRequest, HttpServletResponse
httpServletResponse) {
HttpServletRequest newHttpServletRequest = httpServletRequest;
//get access token from cookie
Cookie accessTokenCookie = OAuth2CookieHelper.getAccessTokenCookie(httpServletRequest);
if (mustRefreshToken(accessTokenCookie)) { //we either have no access token, or it is expired, or it is about to expire
//get the refresh token cookie and, if present, request new tokens
Cookie refreshCookie = OAuth2CookieHelper.getRefreshTokenCookie(httpServletRequest);
if (refreshCookie != null) {
try {
newHttpServletRequest = authenticationService.refreshToken(httpServletRequest, httpServletResponse, refreshCookie);
} catch (HttpClientErrorException ex) {
throw new UnauthorizedClientException("could not refresh OAuth2 token", ex);
}
} else if (accessTokenCookie != null) {
log.warn("access token found, but no refresh token, stripping them all");
OAuth2AccessToken token = tokenStore.readAccessToken(accessTokenCookie.getValue());
if (token.isExpired()) {
throw new InvalidTokenException("access token has expired, but there's no refresh token");
}
}
}
return newHttpServletRequest;
} | /**
* Check if we must refresh the access token.
* We must refresh it, if we either have no access token, or it is expired, or it is about to expire.
*
* @param accessTokenCookie the current access token.
* @return true, if it must be refreshed; false, otherwise.
*/
private boolean mustRefreshToken(Cookie accessTokenCookie) {
if (accessTokenCookie == null) {
return true;
}
OAuth2AccessToken token = tokenStore.readAccessToken(accessTokenCookie.getValue());
//check if token is expired or about to expire
if (token.isExpired() || token.getExpiresIn() < REFRESH_WINDOW_SECS) {
return true;
}
return false; //access token is still fine
}
} | repos\tutorials-master\jhipster-modules\jhipster-uaa\gateway\src\main\java\com\baeldung\jhipster\gateway\web\filter\RefreshTokenFilter.java | 1 |
请完成以下Java代码 | public long getCountAll()
{
return countAll;
}
@Override
public void incrementCountAll()
{
countAll++;
}
@Override
public long getCountProcessed()
{
return countProcessed;
}
@Override
public void incrementCountProcessed()
{
countProcessed++;
}
@Override
public long getCountErrors()
{
return countErrors;
}
@Override
public void incrementCountErrors()
{
countErrors++;
}
@Override
public long getQueueSize()
{
return queueSize;
}
@Override
public void incrementQueueSize() | {
queueSize++;
}
@Override
public void decrementQueueSize()
{
queueSize--;
}
@Override
public long getCountSkipped()
{
return countSkipped;
}
@Override
public void incrementCountSkipped()
{
countSkipped++;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.async\src\main\java\de\metas\async\processor\impl\QueueProcessorStatistics.java | 1 |
请完成以下Java代码 | public boolean isCashJournalOpen() {return cashJournalId != null;}
@NonNull
public POSCashJournalId getCashJournalIdNotNull()
{
if (cashJournalId == null)
{
throw new AdempiereException("No open journals found");
}
return cashJournalId;
}
public POSTerminal openingCashJournal(@NonNull final POSCashJournalId cashJournalId)
{
if (this.cashJournalId != null)
{
throw new AdempiereException("Cash journal already open");
} | return toBuilder()
.cashJournalId(cashJournalId)
.build();
}
public POSTerminal closingCashJournal(@NonNull final Money cashEndingBalance)
{
cashEndingBalance.assertCurrencyId(currency.getId());
return toBuilder()
.cashJournalId(null)
.cashLastBalance(cashEndingBalance)
.build();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.pos.base\src\main\java\de\metas\pos\POSTerminal.java | 1 |
请完成以下Java代码 | private UomId getUomId(@NonNull final X12DE355 x12de355)
{
return uomDAO.getIdByX12DE355IfExists(x12de355)
.orElseThrow(() -> MissingResourceException.builder()
.resourceName("uomCode")
.resourceIdentifier(x12de355.getCode())
.build());
}
@NonNull
private UpdateUOMConversionRequest syncUpdateUOMConversionRequestWithJson(
@NonNull final ProductId productId,
@NonNull final UomId fromUomId,
@NonNull final UomId toUomId,
@NonNull final JsonRequestUOMConversionUpsert jsonRequestUOMConversionUpsert,
@NonNull final UOMConversionRate existingUomConversionRate)
{
final UpdateUOMConversionRequest.UpdateUOMConversionRequestBuilder updateUOMConversionRequestBuilder = UpdateUOMConversionRequest.builder()
.productId(productId)
.fromUomId(fromUomId)
.toUomId(toUomId);
if (jsonRequestUOMConversionUpsert.isFromToMultiplierSet())
{
if (jsonRequestUOMConversionUpsert.getFromToMultiplier() == null)
{
logger.debug("Ignoring property \"fromToMultiplier\" : null ");
updateUOMConversionRequestBuilder.fromToMultiplier(existingUomConversionRate.getFromToMultiplier());
}
else
{
updateUOMConversionRequestBuilder.fromToMultiplier(jsonRequestUOMConversionUpsert.getFromToMultiplier());
}
}
else
{
updateUOMConversionRequestBuilder.fromToMultiplier(existingUomConversionRate.getFromToMultiplier());
} | if (jsonRequestUOMConversionUpsert.isCatchUOMForProductSet())
{
if (jsonRequestUOMConversionUpsert.getCatchUOMForProduct() == null)
{
logger.debug("Ignoring property \"catchUOMForProduct\" : null ");
}
else
{
updateUOMConversionRequestBuilder.catchUOMForProduct(jsonRequestUOMConversionUpsert.getCatchUOMForProduct());
}
}
else
{
updateUOMConversionRequestBuilder.catchUOMForProduct(existingUomConversionRate.isCatchUOMForProduct());
}
return updateUOMConversionRequestBuilder.build();
}
private static void validateJsonRequestUOMConversionUpsert(@NonNull final JsonRequestUOMConversionUpsert jsonRequestUOMConversionUpsert)
{
if (jsonRequestUOMConversionUpsert.getFromUomCode() == null)
{
throw new MissingPropertyException("fromUomCode", jsonRequestUOMConversionUpsert);
}
if (jsonRequestUOMConversionUpsert.getToUomCode() == null)
{
throw new MissingPropertyException("toUomCode", jsonRequestUOMConversionUpsert);
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business.rest-api-impl\src\main\java\de\metas\rest_api\v2\uomconversion\UomConversionRestService.java | 1 |
请完成以下Java代码 | protected void executeInternal(CommandContext commandContext, Job job) {
CommandConfig commandConfig = processEngineConfiguration
.getCommandExecutor()
.getDefaultConfig()
.transactionRequiresNew();
FailedJobCommandFactory failedJobCommandFactory = commandContext.getFailedJobCommandFactory();
Command<Object> cmd = failedJobCommandFactory.getCommand(job.getId(), exception);
log.trace(
"Using FailedJobCommandFactory '" +
failedJobCommandFactory.getClass() +
"' and command of type '" +
cmd.getClass() +
"'"
);
processEngineConfiguration.getCommandExecutor().execute(commandConfig, cmd);
// Dispatch an event, indicating job execution failed in a
// try-catch block, to prevent the original exception to be swallowed
if (commandContext.getEventDispatcher().isEnabled()) { | try {
commandContext
.getEventDispatcher()
.dispatchEvent(
ActivitiEventBuilder.createEntityExceptionEvent(
ActivitiEventType.JOB_EXECUTION_FAILURE,
job,
exception
)
);
} catch (Throwable ignore) {
log.warn("Exception occurred while dispatching job failure event, ignoring.", ignore);
}
}
}
} | repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\cmd\HandleFailedJobCmd.java | 1 |
请完成以下Java代码 | public void setSpecificInvoiceCandidateValues(
@NonNull final I_C_Invoice_Candidate ic,
@NonNull final I_C_Flatrate_Term term)
{
// nothing to do
}
/**
* @return always one, in the respective term's UOM
*/
@Override
public Quantity calculateQtyEntered(@NonNull final I_C_Invoice_Candidate invoiceCandidateRecord)
{
final UomId uomId = HandlerTools.retrieveUomId(invoiceCandidateRecord);
final I_C_UOM uomRecord = loadOutOfTrx(uomId, I_C_UOM.class);
return Quantity.of(ONE, uomRecord);
}
/**
* @return {@link PriceAndTax#NONE} because the tax remains unchanged and the price is updated in {@link CandidateAssignmentService}.
*/
@Override
public PriceAndTax calculatePriceAndTax(@NonNull final I_C_Invoice_Candidate invoiceCandidateRecord)
{
return PriceAndTax.NONE; // no changes to be made
}
@Override
public Consumer<I_C_Invoice_Candidate> getInvoiceScheduleSetterFunction(
@Nullable final Consumer<I_C_Invoice_Candidate> IGNORED_defaultImplementation)
{
return ic -> { | final FlatrateTermId flatrateTermId = FlatrateTermId.ofRepoId(ic.getRecord_ID());
final RefundContractRepository refundContractRepository = SpringContextHolder.instance.getBean(RefundContractRepository.class);
final RefundContract refundContract = refundContractRepository.getById(flatrateTermId);
final NextInvoiceDate nextInvoiceDate = refundContract.computeNextInvoiceDate(asLocalDate(ic.getDeliveryDate()));
ic.setC_InvoiceSchedule_ID(nextInvoiceDate.getInvoiceSchedule().getId().getRepoId());
ic.setDateToInvoice(asTimestamp(nextInvoiceDate.getDateToInvoice()));
};
}
/** Just return the record's current date */
@Override
public Timestamp calculateDateOrdered(@NonNull final I_C_Invoice_Candidate invoiceCandidateRecord)
{
return invoiceCandidateRecord.getDateOrdered();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\refund\invoicecandidatehandler\FlatrateTermRefund_Handler.java | 1 |
请完成以下Java代码 | public Collection<BPartnerBankAccount> getRemainingBankAccounts()
{
return bankAccountsById.values();
}
public void remove(@NonNull final BPartnerBankAccountId bpartnerBankAccountId)
{
bankAccountsById.remove(bpartnerBankAccountId);
}
public BPartnerBankAccount extract(final String iban)
{
return bankAccountsByIBAN.get(iban);
} | public BPartnerBankAccount newBankAccount(@NonNull final String iban, @NonNull final CurrencyId currencyId)
{
final BPartnerBankAccount bankAccount = BPartnerBankAccount.builder()
.iban(iban)
.currencyId(currencyId)
.build();
// bankAccountsById.put(?, bankAccount);
bankAccountsByIBAN.put(bankAccount.getIban(), bankAccount);
bpartnerComposite.addBankAccount(bankAccount);
return bankAccount;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business.rest-api-impl\src\main\java\de\metas\rest_api\v1\bpartner\bpartnercomposite\jsonpersister\ShortTermBankAccountIndex.java | 1 |
请完成以下Java代码 | public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
} | public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
} | repos\spring-boot-student-master\spring-boot-student-drools\src\main\java\com\xiaolyuh\domain\model\Person.java | 1 |
请在Spring Boot框架中完成以下Java代码 | protected static class IntegrationRSocketClientConfiguration {
@Bean
@ConditionalOnMissingBean
@Conditional(RemoteRSocketServerAddressConfigured.class)
ClientRSocketConnector clientRSocketConnector(IntegrationProperties integrationProperties,
RSocketStrategies rSocketStrategies) {
IntegrationProperties.RSocket.Client client = integrationProperties.getRsocket().getClient();
ClientRSocketConnector clientRSocketConnector;
if (client.getUri() != null) {
clientRSocketConnector = new ClientRSocketConnector(client.getUri());
}
else if (client.getHost() != null && client.getPort() != null) {
clientRSocketConnector = new ClientRSocketConnector(client.getHost(), client.getPort());
}
else {
throw new IllegalStateException("Neither uri nor host and port is set");
}
clientRSocketConnector.setRSocketStrategies(rSocketStrategies);
return clientRSocketConnector;
}
/**
* Check if a remote address is configured for the RSocket Integration client.
*/
static class RemoteRSocketServerAddressConfigured extends AnyNestedCondition {
RemoteRSocketServerAddressConfigured() {
super(ConfigurationPhase.REGISTER_BEAN);
}
@ConditionalOnProperty("spring.integration.rsocket.client.uri") | static class WebSocketAddressConfigured {
}
@ConditionalOnProperty({ "spring.integration.rsocket.client.host",
"spring.integration.rsocket.client.port" })
static class TcpAddressConfigured {
}
}
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-integration\src\main\java\org\springframework\boot\integration\autoconfigure\IntegrationAutoConfiguration.java | 2 |
请在Spring Boot框架中完成以下Java代码 | private void configureProcessEngine(AbstractBeanDefinition abstractBeanDefinition, Element element) {
String procEngineRef = element.getAttribute(processEngineAttribute);
if (StringUtils.hasText(procEngineRef))
abstractBeanDefinition.getPropertyValues().add(Conventions.attributeNameToPropertyName(processEngineAttribute), new RuntimeBeanReference(procEngineRef));
}
private void registerStateHandlerAnnotationBeanFactoryPostProcessor(Element element, ParserContext context) {
Class clz = StateHandlerAnnotationBeanFactoryPostProcessor.class;
BeanDefinitionBuilder postProcessorBuilder = BeanDefinitionBuilder.genericBeanDefinition(clz.getName());
BeanDefinitionHolder postProcessorHolder = new BeanDefinitionHolder(
postProcessorBuilder.getBeanDefinition(),
ActivitiContextUtils.ANNOTATION_STATE_HANDLER_BEAN_FACTORY_POST_PROCESSOR_BEAN_NAME);
configureProcessEngine(postProcessorBuilder.getBeanDefinition(), element);
BeanDefinitionReaderUtils.registerBeanDefinition(postProcessorHolder, context.getRegistry());
}
private void registerProcessScope(Element element, ParserContext parserContext) {
Class clz = ProcessScope.class;
BeanDefinitionBuilder processScopeBDBuilder = BeanDefinitionBuilder.genericBeanDefinition(clz);
AbstractBeanDefinition scopeBeanDefinition = processScopeBDBuilder.getBeanDefinition(); | scopeBeanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
configureProcessEngine(scopeBeanDefinition, element);
String beanName = baseBeanName(clz);
parserContext.getRegistry().registerBeanDefinition(beanName, scopeBeanDefinition);
}
private void registerProcessStartAnnotationBeanPostProcessor(Element element, ParserContext parserContext) {
Class clz = ProcessStartAnnotationBeanPostProcessor.class;
BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder.genericBeanDefinition(clz);
AbstractBeanDefinition beanDefinition = beanDefinitionBuilder.getBeanDefinition();
beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
configureProcessEngine(beanDefinition, element);
String beanName = baseBeanName(clz);
parserContext.getRegistry().registerBeanDefinition(beanName, beanDefinition);
}
private String baseBeanName(Class cl) {
return cl.getName().toLowerCase();
}
} | repos\camunda-bpm-platform-master\engine-spring\core\src\main\java\org\camunda\bpm\engine\spring\components\config\xml\ActivitiAnnotationDrivenBeanDefinitionParser.java | 2 |
请在Spring Boot框架中完成以下Java代码 | private static ImmutableList<QRCodeConfiguration> toQRCodeConfiguration(
@NonNull final ImmutableList<I_QRCode_Configuration> qrCodeConfigurations,
@NonNull final ImmutableSetMultimap<QRCodeConfigurationId, AttributeId> configurationId2Attributes)
{
return qrCodeConfigurations.stream()
.map(qrCodeConfiguration -> QRCodeConfiguration.builder()
.id(QRCodeConfigurationId.ofRepoId(qrCodeConfiguration.getQRCode_Configuration_ID()))
.name(qrCodeConfiguration.getName())
.isOneQrCodeForAggregatedHUs(qrCodeConfiguration.isOneQRCodeForAggregatedHUs())
.isOneQrCodeForMatchingAttributes(qrCodeConfiguration.isOneQRCodeForMatchingAttributes())
.groupByAttributeIds(configurationId2Attributes.get(QRCodeConfigurationId.ofRepoId(qrCodeConfiguration.getQRCode_Configuration_ID())))
.build())
.collect(ImmutableList.toImmutableList());
}
@Value
private static class QRCodeConfigurationMap
{
@NonNull
ImmutableMap<QRCodeConfigurationId, QRCodeConfiguration> id2Configuration;
@NonNull
public static QRCodeConfigurationMap ofList(@NonNull final ImmutableList<QRCodeConfiguration> configList)
{
final ImmutableMap<QRCodeConfigurationId, QRCodeConfiguration> id2Configuration = configList.stream() | .collect(ImmutableMap.toImmutableMap(QRCodeConfiguration::getId, Function.identity()));
return new QRCodeConfigurationMap(id2Configuration);
}
@NonNull
public Optional<QRCodeConfiguration> getById(@NonNull final QRCodeConfigurationId id)
{
return Optional.ofNullable(id2Configuration.get(id));
}
@NonNull
public ImmutableMap<QRCodeConfigurationId, QRCodeConfiguration> getByIds(@NonNull final Collection<QRCodeConfigurationId> ids)
{
return ImmutableSet.copyOf(ids)
.stream()
.collect(ImmutableMap.toImmutableMap(Function.identity(), id2Configuration::get));
}
public boolean isEmpty()
{
return id2Configuration.isEmpty();
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\qrcodes\service\QRCodeConfigurationRepository.java | 2 |
请完成以下Java代码 | public static DataTypeEnum urlOf(String jdbcUrl) {
String url = jdbcUrl.toLowerCase().trim();
for (DataTypeEnum dataTypeEnum : values()) {
if (url.startsWith(JDBC_URL_PREFIX + dataTypeEnum.feature)) {
try {
Class<?> aClass = Class.forName(dataTypeEnum.getDriver());
if (null == aClass) {
throw new RuntimeException("Unable to get driver instance for jdbcUrl: " + jdbcUrl);
}
} catch (ClassNotFoundException e) {
throw new RuntimeException("Unable to get driver instance: " + jdbcUrl);
}
return dataTypeEnum;
}
}
return null;
}
public String getFeature() {
return feature;
}
public String getDesc() {
return desc;
}
public String getDriver() {
return driver;
} | public String getKeywordPrefix() {
return keywordPrefix;
}
public String getKeywordSuffix() {
return keywordSuffix;
}
public String getAliasPrefix() {
return aliasPrefix;
}
public String getAliasSuffix() {
return aliasSuffix;
}
} | repos\eladmin-master\eladmin-system\src\main\java\me\zhengjie\modules\maint\domain\enums\DataTypeEnum.java | 1 |
请完成以下Java代码 | public PricingConditionsRow copyAndChangeToEditable()
{
if (editable)
{
return this;
}
return toBuilder().editable(true).build();
}
public LookupValuesPage getFieldTypeahead(final String fieldName, final String query)
{
return lookups.getFieldTypeahead(fieldName, query);
}
public LookupValuesList getFieldDropdown(final String fieldName)
{
return lookups.getFieldDropdown(fieldName);
}
public BPartnerId getBpartnerId()
{ | return BPartnerId.ofRepoId(bpartner.getIdAsInt());
}
public String getBpartnerDisplayName()
{
return bpartner.getDisplayName();
}
public boolean isVendor()
{
return !isCustomer();
}
public CurrencyId getCurrencyId()
{
return CurrencyId.ofRepoId(currency.getIdAsInt());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\order\pricingconditions\view\PricingConditionsRow.java | 1 |
请完成以下Java代码 | public int getM_PickingSlot_ID()
{
return get_ValueAsInt(COLUMNNAME_M_PickingSlot_ID);
}
@Override
public void setM_PickingSlot_Trx_ID (final int M_PickingSlot_Trx_ID)
{
if (M_PickingSlot_Trx_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_PickingSlot_Trx_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_PickingSlot_Trx_ID, M_PickingSlot_Trx_ID);
}
@Override
public int getM_PickingSlot_Trx_ID() | {
return get_ValueAsInt(COLUMNNAME_M_PickingSlot_Trx_ID);
}
@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.handlingunits.base\src\main\java-gen\de\metas\handlingunits\model\X_M_PickingSlot_Trx.java | 1 |
请完成以下Java代码 | public class Session {
/**
* Session timeout. If a duration suffix is not specified, seconds will be used.
*/
@DurationUnit(ChronoUnit.SECONDS)
private @Nullable Duration timeout = Duration.ofMinutes(30);
/**
* Session tracking modes.
*/
private @Nullable Set<Session.SessionTrackingMode> trackingModes;
/**
* Whether to persist session data between restarts.
*/
private boolean persistent;
/**
* Directory used to store session data.
*/
private @Nullable File storeDir;
@NestedConfigurationProperty
private final Cookie cookie = new Cookie();
private final SessionStoreDirectory sessionStoreDirectory = new SessionStoreDirectory();
public @Nullable Duration getTimeout() {
return this.timeout;
}
public void setTimeout(@Nullable Duration timeout) {
this.timeout = timeout;
}
/**
* Return the {@link SessionTrackingMode session tracking modes}.
* @return the session tracking modes
*/
public @Nullable Set<Session.SessionTrackingMode> getTrackingModes() {
return this.trackingModes;
}
public void setTrackingModes(@Nullable Set<Session.SessionTrackingMode> trackingModes) {
this.trackingModes = trackingModes;
}
/**
* Return whether to persist session data between restarts.
* @return {@code true} to persist session data between restarts.
*/
public boolean isPersistent() {
return this.persistent;
}
public void setPersistent(boolean persistent) {
this.persistent = persistent;
}
/**
* Return the directory used to store session data.
* @return the session data store directory
*/
public @Nullable File getStoreDir() {
return this.storeDir;
}
public void setStoreDir(@Nullable File storeDir) {
this.sessionStoreDirectory.setDirectory(storeDir); | this.storeDir = storeDir;
}
public Cookie getCookie() {
return this.cookie;
}
public SessionStoreDirectory getSessionStoreDirectory() {
return this.sessionStoreDirectory;
}
/**
* Available session tracking modes (mirrors
* {@link jakarta.servlet.SessionTrackingMode}).
*/
public enum SessionTrackingMode {
/**
* Send a cookie in response to the client's first request.
*/
COOKIE,
/**
* Rewrite the URL to append a session ID.
*/
URL,
/**
* Use SSL build-in mechanism to track the session.
*/
SSL
}
} | repos\spring-boot-4.0.1\module\spring-boot-web-server\src\main\java\org\springframework\boot\web\server\servlet\Session.java | 1 |
请在Spring Boot框架中完成以下Java代码 | class BinderDubboConfigBinder implements ConfigurationBeanBinder {
@Override
public void bind(Map<String, Object> configurationProperties, boolean ignoreUnknownFields,
boolean ignoreInvalidFields, Object configurationBean) {
Iterable<PropertySource<?>> propertySources = asList(new MapPropertySource("internal", configurationProperties));
// Converts ConfigurationPropertySources
Iterable<ConfigurationPropertySource> configurationPropertySources = from(propertySources);
// Wrap Bindable from DubboConfig instance
Bindable bindable = Bindable.ofInstance(configurationBean);
Binder binder = new Binder(configurationPropertySources, new PropertySourcesPlaceholdersResolver(propertySources));
// Get BindHandler
BindHandler bindHandler = getBindHandler(ignoreUnknownFields, ignoreInvalidFields); | // Bind
binder.bind("", bindable, bindHandler);
}
private BindHandler getBindHandler(boolean ignoreUnknownFields,
boolean ignoreInvalidFields) {
BindHandler handler = BindHandler.DEFAULT;
if (ignoreInvalidFields) {
handler = new IgnoreErrorsBindHandler(handler);
}
if (!ignoreUnknownFields) {
UnboundElementsSourceFilter filter = new UnboundElementsSourceFilter();
handler = new NoUnboundElementsBindHandler(handler, filter);
}
return handler;
}
} | repos\dubbo-spring-boot-project-master\dubbo-spring-boot-autoconfigure\src\main\java\org\apache\dubbo\spring\boot\autoconfigure\BinderDubboConfigBinder.java | 2 |
请完成以下Java代码 | public Product2 getPdct() {
return pdct;
}
/**
* Sets the value of the pdct property.
*
* @param value
* allowed object is
* {@link Product2 }
*
*/
public void setPdct(Product2 value) {
this.pdct = value;
}
/**
* Gets the value of the vldtnDt property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getVldtnDt() {
return vldtnDt;
}
/**
* Sets the value of the vldtnDt property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setVldtnDt(XMLGregorianCalendar value) {
this.vldtnDt = value;
} | /**
* Gets the value of the vldtnSeqNb property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVldtnSeqNb() {
return vldtnSeqNb;
}
/**
* Sets the value of the vldtnSeqNb property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVldtnSeqNb(String value) {
this.vldtnSeqNb = 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\CardIndividualTransaction1.java | 1 |
请在Spring Boot框架中完成以下Java代码 | protected void doInTransactionWithoutResult(TransactionStatus status) {
Author authorA1 = authorRepository.findById(1L).orElseThrow();
System.out.println("Author A1: " + authorA1.getName() + "\n");
// Transaction B
template.execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
Author authorB = authorRepository.findById(1L).orElseThrow();
authorB.setName("Alicia Tom");
System.out.println("Author B: " + authorB.getName() + "\n");
}
});
// Direct fetching via findById(), find() and get() doesn't trigger a SELECT
// It loads the author directly from Persistence Context
Author authorA2 = authorRepository.findById(1L).orElseThrow();
System.out.println("\nAuthor A2: " + authorA2.getName() + "\n");
// JPQL entity queries take advantage of session-level repeatable reads
// The data snapshot returned by the triggered SELECT is ignored
Author authorViaJpql = authorRepository.fetchByIdJpql(1L);
System.out.println("Author via JPQL: " + authorViaJpql.getName() + "\n"); | // SQL entity queries take advantage of session-level repeatable reads
// The data snapshot returned by the triggered SELECT is ignored
Author authorViaSql = authorRepository.fetchByIdSql(1L);
System.out.println("Author via SQL: " + authorViaSql.getName() + "\n");
// JPQL query projections always load the latest database state
String nameViaJpql = authorRepository.fetchNameByIdJpql(1L);
System.out.println("Author name via JPQL: " + nameViaJpql + "\n");
// SQL query projections always load the latest database state
String nameViaSql = authorRepository.fetchNameByIdSql(1L);
System.out.println("Author name via SQL: " + nameViaSql + "\n");
}
});
}
} | repos\Hibernate-SpringBoot-master\HibernateSpringBootSessionRepeatableReads\src\main\java\com\bookstore\service\BookstoreService.java | 2 |
请完成以下Java代码 | 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 |
请完成以下Java代码 | public CaseInstanceEntity getCaseInstanceEntity() {
if (caseInstanceEntity == null) {
caseInstanceEntity = CommandContextUtil.getCaseInstanceEntityManager(commandContext).findById(caseInstanceEntityId);
if (caseInstanceEntity == null) {
throw new FlowableObjectNotFoundException("No case instance found for id " + caseInstanceEntityId);
}
}
return caseInstanceEntity;
}
public boolean isManualTermination() {
return manualTermination;
}
public void setManualTermination(boolean manualTermination) {
this.manualTermination = manualTermination;
}
public String getExitCriterionId() { | return exitCriterionId;
}
public void setExitCriterionId(String exitCriterionId) {
this.exitCriterionId = exitCriterionId;
}
public String getExitType() {
return exitType;
}
public void setExitType(String exitType) {
this.exitType = exitType;
}
public String getExitEventType() {
return exitEventType;
}
public void setExitEventType(String exitEventType) {
this.exitEventType = exitEventType;
}
} | repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\agenda\operation\TerminateCaseInstanceOperation.java | 1 |
请完成以下Java代码 | public class HistoricDecisionInstanceResourceImpl implements HistoricDecisionInstanceResource {
private ProcessEngine engine;
private String decisionInstanceId;
public HistoricDecisionInstanceResourceImpl(ProcessEngine engine, String decisionInstanceId) {
this.engine = engine;
this.decisionInstanceId = decisionInstanceId;
}
public HistoricDecisionInstanceDto getHistoricDecisionInstance(Boolean includeInputs, Boolean includeOutputs, Boolean disableBinaryFetching, Boolean disableCustomObjectDeserialization) {
HistoryService historyService = engine.getHistoryService();
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionInstanceId(decisionInstanceId);
if (includeInputs != null && includeInputs) {
query.includeInputs();
}
if (includeOutputs != null && includeOutputs) {
query.includeOutputs();
} | if (disableBinaryFetching != null && disableBinaryFetching) {
query.disableBinaryFetching();
}
if (disableCustomObjectDeserialization != null && disableCustomObjectDeserialization) {
query.disableCustomObjectDeserialization();
}
HistoricDecisionInstance instance = query.singleResult();
if (instance == null) {
throw new InvalidRequestException(Status.NOT_FOUND, "Historic decision instance with id '" + decisionInstanceId + "' does not exist");
}
return HistoricDecisionInstanceDto.fromHistoricDecisionInstance(instance);
}
} | repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\sub\history\impl\HistoricDecisionInstanceResourceImpl.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public List<JP060P100> getJoinP060P100Lines()
{
return joinP060P100Lines;
}
public void setJoinP060P100Lines(final List<JP060P100> joinP060P100Lines)
{
this.joinP060P100Lines = joinP060P100Lines;
}
public List<P102> getP102Lines()
{
return p102Lines;
}
public void setP102Lines(final List<P102> p102Lines)
{
this.p102Lines = p102Lines;
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + (joinP060P100Lines == null ? 0 : joinP060P100Lines.hashCode());
result = prime * result + (levelNo == null ? 0 : levelNo.hashCode());
result = prime * result + (messageNo == null ? 0 : messageNo.hashCode());
result = prime * result + (p102Lines == null ? 0 : p102Lines.hashCode());
result = prime * result + (packageQty == null ? 0 : packageQty.hashCode());
result = prime * result + (packageType == null ? 0 : packageType.hashCode());
result = prime * result + (partner == null ? 0 : partner.hashCode());
result = prime * result + (record == null ? 0 : record.hashCode());
return result;
}
@Override
public boolean equals(final Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
final P050 other = (P050)obj;
if (joinP060P100Lines == null)
{
if (other.joinP060P100Lines != null)
{
return false;
}
}
else if (!joinP060P100Lines.equals(other.joinP060P100Lines))
{
return false;
}
if (levelNo == null)
{
if (other.levelNo != null)
{
return false;
}
}
else if (!levelNo.equals(other.levelNo))
{
return false;
}
if (messageNo == null)
{
if (other.messageNo != null)
{
return false;
}
}
else if (!messageNo.equals(other.messageNo))
{
return false;
} | if (p102Lines == null)
{
if (other.p102Lines != null)
{
return false;
}
}
else if (!p102Lines.equals(other.p102Lines))
{
return false;
}
if (packageQty == null)
{
if (other.packageQty != null)
{
return false;
}
}
else if (!packageQty.equals(other.packageQty))
{
return false;
}
if (packageType == null)
{
if (other.packageType != null)
{
return false;
}
}
else if (!packageType.equals(other.packageType))
{
return false;
}
if (partner == null)
{
if (other.partner != null)
{
return false;
}
}
else if (!partner.equals(other.partner))
{
return false;
}
if (record == null)
{
if (other.record != null)
{
return false;
}
}
else if (!record.equals(other.record))
{
return false;
}
return true;
}
@Override
public String toString()
{
return "P050 [record=" + record + ", partner=" + partner + ", messageNo=" + messageNo + ", levelNo=" + levelNo + ", packageQty=" + packageQty + ", packageType=" + packageType + ", p102Lines="
+ p102Lines + ", joinP060P100Lines=" + joinP060P100Lines + "]";
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java\de\metas\edi\esb\desadvexport\compudata\P050.java | 2 |
请完成以下Java代码 | protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_M_Substitute[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
public I_M_Product getM_Product() throws RuntimeException
{
return (I_M_Product)MTable.get(getCtx(), I_M_Product.Table_Name)
.getPO(getM_Product_ID(), get_TrxName()); }
/** Set Product.
@param M_Product_ID
Product, Service, Item
*/
public void setM_Product_ID (int M_Product_ID)
{
if (M_Product_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Product_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID));
}
/** Get Product.
@return Product, Service, Item
*/
public int getM_Product_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Name. | @param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
public I_M_Product getSubstitute() throws RuntimeException
{
return (I_M_Product)MTable.get(getCtx(), I_M_Product.Table_Name)
.getPO(getSubstitute_ID(), get_TrxName()); }
/** Set Substitute.
@param Substitute_ID
Entity which can be used in place of this entity
*/
public void setSubstitute_ID (int Substitute_ID)
{
if (Substitute_ID < 1)
set_ValueNoCheck (COLUMNNAME_Substitute_ID, null);
else
set_ValueNoCheck (COLUMNNAME_Substitute_ID, Integer.valueOf(Substitute_ID));
}
/** Get Substitute.
@return Entity which can be used in place of this entity
*/
public int getSubstitute_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Substitute_ID);
if (ii == null)
return 0;
return ii.intValue();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Substitute.java | 1 |
请完成以下Java代码 | public CamundaProperty newInstance(ModelTypeInstanceContext instanceContext) {
return new CamundaPropertyImpl(instanceContext);
}
});
camundaIdAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_ID)
.namespace(CAMUNDA_NS)
.build();
camundaNameAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_NAME)
.namespace(CAMUNDA_NS)
.build();
camundaValueAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_VALUE)
.namespace(CAMUNDA_NS)
.build();
typeBuilder.build();
}
public CamundaPropertyImpl(ModelTypeInstanceContext instanceContext) {
super(instanceContext);
}
public String getCamundaId() {
return camundaIdAttribute.getValue(this); | }
public void setCamundaId(String camundaId) {
camundaIdAttribute.setValue(this, camundaId);
}
public String getCamundaName() {
return camundaNameAttribute.getValue(this);
}
public void setCamundaName(String camundaName) {
camundaNameAttribute.setValue(this, camundaName);
}
public String getCamundaValue() {
return camundaValueAttribute.getValue(this);
}
public void setCamundaValue(String camundaValue) {
camundaValueAttribute.setValue(this, camundaValue);
}
} | repos\camunda-bpm-platform-master\model-api\bpmn-model\src\main\java\org\camunda\bpm\model\bpmn\impl\instance\camunda\CamundaPropertyImpl.java | 1 |
请完成以下Java代码 | protected BigDecimal getInternalValueNumberInitial()
{
return null;
}
@Override
protected void setInternalValueStringInitial(final String value)
{
throw new UnsupportedOperationException("Setting initial value not supported");
}
@Override
protected void setInternalValueNumberInitial(final BigDecimal value)
{
throw new UnsupportedOperationException("Setting initial value not supported");
}
@Override
public boolean isNew()
{
return isGeneratedAttribute;
}
@Override
protected void setInternalValueDate(Date value)
{
attributeInstance.setValueDate(TimeUtil.asTimestamp(value));
}
@Override
protected Date getInternalValueDate()
{
return attributeInstance.getValueDate();
} | @Override
protected void setInternalValueDateInitial(Date value)
{
throw new UnsupportedOperationException("Setting initial value not supported");
}
@Override
protected Date getInternalValueDateInitial()
{
return null;
}
@Override
public boolean isOnlyIfInProductAttributeSet()
{
// FIXME tsa: figure out why this returns false instead of using the flag from M_HU_PI_Attribute?!
return false;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\attribute\storage\impl\AIWithHUPIAttributeValue.java | 1 |
请完成以下Java代码 | public class X_K_EntryRelated extends PO implements I_K_EntryRelated, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20090915L;
/** Standard Constructor */
public X_K_EntryRelated (Properties ctx, int K_EntryRelated_ID, String trxName)
{
super (ctx, K_EntryRelated_ID, trxName);
/** if (K_EntryRelated_ID == 0)
{
setK_Entry_ID (0);
setK_EntryRelated_ID (0);
} */
}
/** Load Constructor */
public X_K_EntryRelated (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AccessLevel
* @return 3 - Client - Org
*/
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_K_EntryRelated[")
.append(get_ID()).append("]");
return sb.toString();
}
public I_K_Entry getK_Entry() throws RuntimeException
{
return (I_K_Entry)MTable.get(getCtx(), I_K_Entry.Table_Name)
.getPO(getK_Entry_ID(), get_TrxName()); }
/** Set Entry.
@param K_Entry_ID
Knowledge Entry
*/
public void setK_Entry_ID (int K_Entry_ID)
{
if (K_Entry_ID < 1)
set_ValueNoCheck (COLUMNNAME_K_Entry_ID, null);
else
set_ValueNoCheck (COLUMNNAME_K_Entry_ID, Integer.valueOf(K_Entry_ID));
}
/** Get Entry.
@return Knowledge Entry
*/
public int getK_Entry_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_K_Entry_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Related Entry.
@param K_EntryRelated_ID
Related Entry for this Enntry
*/
public void setK_EntryRelated_ID (int K_EntryRelated_ID)
{
if (K_EntryRelated_ID < 1)
set_ValueNoCheck (COLUMNNAME_K_EntryRelated_ID, null); | else
set_ValueNoCheck (COLUMNNAME_K_EntryRelated_ID, Integer.valueOf(K_EntryRelated_ID));
}
/** Get Related Entry.
@return Related Entry for this Enntry
*/
public int getK_EntryRelated_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_K_EntryRelated_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), String.valueOf(getK_EntryRelated_ID()));
}
/** 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);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_K_EntryRelated.java | 1 |
请完成以下Java代码 | public class DefaultContentTypeResolver implements ContentTypeResolver {
protected final Map<String, String> fileExtensionToContentType;
protected String unknownFileContentType = MediaType.APPLICATION_OCTET_STREAM_VALUE;
public DefaultContentTypeResolver() {
this.fileExtensionToContentType = new HashMap<>();
this.fileExtensionToContentType.put("png", MediaType.IMAGE_PNG_VALUE);
this.fileExtensionToContentType.put("txt", MediaType.TEXT_PLAIN_VALUE);
this.fileExtensionToContentType.put("xml", MediaType.TEXT_XML_VALUE);
this.fileExtensionToContentType.put("bpmn", MediaType.TEXT_XML_VALUE);
this.fileExtensionToContentType.put("cmmn", MediaType.TEXT_XML_VALUE);
this.fileExtensionToContentType.put("dmn", MediaType.TEXT_XML_VALUE);
this.fileExtensionToContentType.put("app", MediaType.APPLICATION_JSON_VALUE);
this.fileExtensionToContentType.put("event", MediaType.APPLICATION_JSON_VALUE);
this.fileExtensionToContentType.put("form", MediaType.APPLICATION_JSON_VALUE);
this.fileExtensionToContentType.put("channel", MediaType.APPLICATION_JSON_VALUE);
}
@Override
public String resolveContentType(String resourceName) {
if (resourceName != null && !resourceName.isEmpty()) { | String lowerResourceName = resourceName.toLowerCase();
String fileExtension = StringUtils.substringAfterLast(lowerResourceName, '.');
return fileExtensionToContentType.getOrDefault(fileExtension, unknownFileContentType);
}
return null;
}
public void addFileExtensionMapping(String fileExtension, String contentType) {
this.fileExtensionToContentType.put(fileExtension, contentType);
}
public void setUnknownFileContentType(String unknownFileContentType) {
this.unknownFileContentType = unknownFileContentType;
}
} | repos\flowable-engine-main\modules\flowable-common-rest\src\main\java\org\flowable\common\rest\resolver\DefaultContentTypeResolver.java | 1 |
请完成以下Java代码 | default <T extends Authentication> T getAuthentication() {
return (T) get(Authentication.class);
}
/**
* A builder for subclasses of {@link OAuth2AuthenticationContext}.
*
* @param <T> the type of the authentication context
* @param <B> the type of the builder
*/
abstract class AbstractBuilder<T extends OAuth2AuthenticationContext, B extends AbstractBuilder<T, B>> {
private final Map<Object, Object> context = new HashMap<>();
protected AbstractBuilder(Authentication authentication) {
Assert.notNull(authentication, "authentication cannot be null");
put(Authentication.class, authentication);
}
/**
* Associates an attribute.
* @param key the key for the attribute
* @param value the value of the attribute
* @return the {@link AbstractBuilder} for further configuration
*/
public B put(Object key, Object value) {
Assert.notNull(key, "key cannot be null");
Assert.notNull(value, "value cannot be null");
getContext().put(key, value);
return getThis();
}
/**
* A {@code Consumer} of the attributes {@code Map} allowing the ability to add,
* replace, or remove.
* @param contextConsumer a {@link Consumer} of the attributes {@code Map}
* @return the {@link AbstractBuilder} for further configuration
*/
public B context(Consumer<Map<Object, Object>> contextConsumer) { | contextConsumer.accept(getContext());
return getThis();
}
@SuppressWarnings("unchecked")
protected <V> V get(Object key) {
return (V) getContext().get(key);
}
protected Map<Object, Object> getContext() {
return this.context;
}
@SuppressWarnings("unchecked")
protected final B getThis() {
return (B) this;
}
/**
* Builds a new {@link OAuth2AuthenticationContext}.
* @return the {@link OAuth2AuthenticationContext}
*/
public abstract T build();
}
} | repos\spring-security-main\oauth2\oauth2-authorization-server\src\main\java\org\springframework\security\oauth2\server\authorization\authentication\OAuth2AuthenticationContext.java | 1 |
请完成以下Java代码 | public boolean isDefault ()
{
Object oo = get_Value(COLUMNNAME_IsDefault);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Frachtkostenpauschale.
@param M_FreightCost_ID Frachtkostenpauschale */
public void setM_FreightCost_ID (int M_FreightCost_ID)
{
if (M_FreightCost_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_FreightCost_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_FreightCost_ID, Integer.valueOf(M_FreightCost_ID));
}
/** Get Frachtkostenpauschale.
@return Frachtkostenpauschale */
public int getM_FreightCost_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_FreightCost_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set M_FreightCost_includedTab.
@param M_FreightCost_includedTab M_FreightCost_includedTab */
public void setM_FreightCost_includedTab (String M_FreightCost_includedTab)
{
set_ValueNoCheck (COLUMNNAME_M_FreightCost_includedTab, M_FreightCost_includedTab);
}
/** Get M_FreightCost_includedTab.
@return M_FreightCost_includedTab */
public String getM_FreightCost_includedTab ()
{
return (String)get_Value(COLUMNNAME_M_FreightCost_includedTab);
}
public I_M_Product getM_Product() throws RuntimeException
{
return (I_M_Product)MTable.get(getCtx(), I_M_Product.Table_Name)
.getPO(getM_Product_ID(), get_TrxName()); }
/** Set Produkt.
@param M_Product_ID
Produkt, Leistung, Artikel
*/
public void setM_Product_ID (int M_Product_ID)
{
if (M_Product_ID < 1)
set_Value (COLUMNNAME_M_Product_ID, null);
else
set_Value (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID));
}
/** Get Produkt.
@return Produkt, Leistung, Artikel
*/
public int getM_Product_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
if (ii == null)
return 0;
return ii.intValue();
} | /** Set Name.
@param Name
Alphanumerische Bezeichnung fuer diesen Eintrag
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumerische Bezeichnung fuer diesen Eintrag
*/
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 Suchschluessel.
@param Value
Suchschluessel fuer den Eintrag im erforderlichen Format - muss eindeutig sein
*/
public void setValue (String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
/** Get Suchschluessel.
@return Suchschluessel fuer den Eintrag im erforderlichen Format - muss eindeutig sein
*/
public String getValue ()
{
return (String)get_Value(COLUMNNAME_Value);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\adempiere\model\X_M_FreightCost.java | 1 |
请完成以下Java代码 | protected org.compiere.model.POInfo initPO(final Properties ctx)
{
return org.compiere.model.POInfo.getPOInfo(Table_Name);
}
@Override
public void setName (final java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
@Override
public void setSeqNo (final int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, SeqNo);
}
@Override
public int getSeqNo()
{
return get_ValueAsInt(COLUMNNAME_SeqNo);
}
@Override
public de.metas.ui.web.base.model.I_WEBUI_Board getWEBUI_Board()
{
return get_ValueAsPO(COLUMNNAME_WEBUI_Board_ID, de.metas.ui.web.base.model.I_WEBUI_Board.class);
}
@Override
public void setWEBUI_Board(final de.metas.ui.web.base.model.I_WEBUI_Board WEBUI_Board)
{
set_ValueFromPO(COLUMNNAME_WEBUI_Board_ID, de.metas.ui.web.base.model.I_WEBUI_Board.class, WEBUI_Board);
}
@Override
public void setWEBUI_Board_ID (final int WEBUI_Board_ID)
{
if (WEBUI_Board_ID < 1)
set_ValueNoCheck (COLUMNNAME_WEBUI_Board_ID, null); | else
set_ValueNoCheck (COLUMNNAME_WEBUI_Board_ID, WEBUI_Board_ID);
}
@Override
public int getWEBUI_Board_ID()
{
return get_ValueAsInt(COLUMNNAME_WEBUI_Board_ID);
}
@Override
public void setWEBUI_Board_Lane_ID (final int WEBUI_Board_Lane_ID)
{
if (WEBUI_Board_Lane_ID < 1)
set_ValueNoCheck (COLUMNNAME_WEBUI_Board_Lane_ID, null);
else
set_ValueNoCheck (COLUMNNAME_WEBUI_Board_Lane_ID, WEBUI_Board_Lane_ID);
}
@Override
public int getWEBUI_Board_Lane_ID()
{
return get_ValueAsInt(COLUMNNAME_WEBUI_Board_Lane_ID);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java-gen\de\metas\ui\web\base\model\X_WEBUI_Board_Lane.java | 1 |
请完成以下Java代码 | public class DATEVCsvExporter extends AbstractExporter
{
private final DATEVExportFormat exportFormat;
@Builder
private DATEVCsvExporter(
@NonNull final DATEVExportFormat exportFormat,
@NonNull final IExportDataSource dataSource)
{
this.exportFormat = exportFormat;
setDataSource(dataSource);
}
@Override
protected CSVWriter createDataDestination(final OutputStream out) throws UnsupportedEncodingException
{
final Properties config = new Properties(getConfig());
config.setProperty(CSVWriter.CONFIG_Encoding, exportFormat.getCsvEncoding());
config.setProperty(CSVWriter.CONFIG_FieldDelimiter, exportFormat.getCsvFieldDelimiter());
config.setProperty(CSVWriter.CONFIG_FieldQuote, exportFormat.getCsvFieldQuote());
config.setProperty(CSVWriter.CONFIG_AllowMultilineFields, "false");
final CSVWriter csvWriter = new CSVWriter(out, config);
csvWriter.setHeader(getDataSource().getFieldNames());
return csvWriter;
}
@Override
protected void appendRow(final IExportDataDestination dataDestination, final List<Object> row) throws IOException
{
final CSVWriter csvWriter = CSVWriter.cast(dataDestination);
final List<Object> rowFormatted = formatRow(row);
csvWriter.appendLine(rowFormatted);
}
private List<Object> formatRow(final List<Object> row)
{
final List<DATEVExportFormatColumn> formatColumns = exportFormat.getColumns();
final int rowSize = row.size();
final List<Object> rowFormatted = new ArrayList<>(rowSize);
for (int i = 0; i < rowSize; i++)
{
final Object cell = row.get(i);
final DATEVExportFormatColumn columnFormat = formatColumns.get(i);
final Object cellFormated = formatCell(cell, columnFormat);
rowFormatted.add(cellFormated);
}
return rowFormatted;
}
private Object formatCell(final Object value, final DATEVExportFormatColumn columnFormat)
{
if (value == null)
{
return null;
}
if (columnFormat.getDateFormatter() != null)
{
return formatDateCell(value, columnFormat.getDateFormatter());
}
else if (columnFormat.getNumberFormatter() != null)
{
return formatNumberCell(value, columnFormat.getNumberFormatter());
}
else
{
return value; | }
}
private static String formatDateCell(final Object value, final DateTimeFormatter dateFormatter)
{
if (value == null)
{
return null;
}
else if (value instanceof java.util.Date)
{
final java.util.Date date = (java.util.Date)value;
return dateFormatter.format(TimeUtil.asLocalDate(date));
}
else if (value instanceof TemporalAccessor)
{
TemporalAccessor temporal = (TemporalAccessor)value;
return dateFormatter.format(temporal);
}
else
{
throw new AdempiereException("Cannot convert/format value to Date: " + value + " (" + value.getClass() + ")");
}
}
private static String formatNumberCell(final Object value, final ThreadLocalDecimalFormatter numberFormatter)
{
if (value == null)
{
return null;
}
return numberFormatter.format(value);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.datev\src\main\java\de\metas\datev\DATEVCsvExporter.java | 1 |
请完成以下Java代码 | public HUConsolidationJobReferenceBuilder addToCountHUs(final int countHUsToAdd)
{
this.countHUs = this.countHUs == null ? countHUsToAdd : this.countHUs + countHUsToAdd;
return this;
}
}
public static HUConsolidationJobReference ofParams(final Params params)
{
try
{
final BPartnerId bpartnerId = params.getParameterAsId("bpartnerId", BPartnerId.class);
if (bpartnerId == null)
{
throw new AdempiereException("bpartnerId not set");
}
@Nullable final BPartnerLocationId bpartnerLocationId = BPartnerLocationId.ofRepoId(bpartnerId, params.getParameterAsInt("bpartnerLocationId", -1));
@Nullable final ImmutableSet<PickingSlotId> pickingSlotIds = RepoIdAwares.ofCommaSeparatedSet(params.getParameterAsString("pickingSlotIds"), PickingSlotId.class);
@Nullable final HUConsolidationJobId startedJobId = params.getParameterAsId("startedJobId", HUConsolidationJobId.class);
return builder()
.bpartnerLocationId(bpartnerLocationId)
.pickingSlotIds(pickingSlotIds != null ? pickingSlotIds : ImmutableSet.of())
.countHUs(params.getParameterAsInt("countHUs", 0))
.startedJobId(startedJobId)
.build();
}
catch (Exception ex)
{
throw new AdempiereException("Invalid params: " + params, ex);
}
}
public static HUConsolidationJobReference ofJob(@NonNull final HUConsolidationJob job)
{
return builder()
.bpartnerLocationId(job.getShipToBPLocationId())
.pickingSlotIds(job.getPickingSlotIds())
.countHUs(null)
.startedJobId(job.getId())
.build();
}
public Params toParams()
{
return Params.builder()
.value("bpartnerId", bpartnerLocationId.getBpartnerId().getRepoId())
.value("bpartnerLocationId", bpartnerLocationId.getRepoId())
.value("pickingSlotIds", RepoIdAwares.toCommaSeparatedString(pickingSlotIds))
.value("countHUs", countHUs)
.value("startedJobId", startedJobId != null ? startedJobId.getRepoId() : null)
.build();
}
public boolean isStatsMissing()
{
return countHUs == null;
} | public OptionalInt getCountHUs()
{
return countHUs != null ? OptionalInt.of(countHUs) : OptionalInt.empty();
}
public HUConsolidationJobReference withUpdatedStats(@NonNull final PickingSlotQueuesSummary summary)
{
final OptionalInt optionalCountHUs = summary.getCountHUs(pickingSlotIds);
if (optionalCountHUs.isPresent())
{
final int countHUsNew = optionalCountHUs.getAsInt();
if (this.countHUs == null || this.countHUs != countHUsNew)
{
return toBuilder().countHUs(countHUsNew).build();
}
else
{
return this;
}
}
else
{
return this;
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.hu_consolidation.mobile\src\main\java\de\metas\hu_consolidation\mobile\job\HUConsolidationJobReference.java | 1 |
请完成以下Java代码 | public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Integer getFactoryStatus() {
return factoryStatus;
}
public void setFactoryStatus(Integer factoryStatus) {
this.factoryStatus = factoryStatus;
}
public Integer getShowStatus() {
return showStatus;
}
public void setShowStatus(Integer showStatus) {
this.showStatus = showStatus;
}
public Integer getProductCount() {
return productCount;
}
public void setProductCount(Integer productCount) {
this.productCount = productCount;
}
public Integer getProductCommentCount() {
return productCommentCount;
}
public void setProductCommentCount(Integer productCommentCount) {
this.productCommentCount = productCommentCount;
}
public String getLogo() {
return logo;
}
public void setLogo(String logo) {
this.logo = logo; | }
public String getBigPic() {
return bigPic;
}
public void setBigPic(String bigPic) {
this.bigPic = bigPic;
}
public String getBrandStory() {
return brandStory;
}
public void setBrandStory(String brandStory) {
this.brandStory = brandStory;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", name=").append(name);
sb.append(", firstLetter=").append(firstLetter);
sb.append(", sort=").append(sort);
sb.append(", factoryStatus=").append(factoryStatus);
sb.append(", showStatus=").append(showStatus);
sb.append(", productCount=").append(productCount);
sb.append(", productCommentCount=").append(productCommentCount);
sb.append(", logo=").append(logo);
sb.append(", bigPic=").append(bigPic);
sb.append(", brandStory=").append(brandStory);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\PmsBrand.java | 1 |
请完成以下Java代码 | public void setStartedBefore(Date startedBefore) {
this.startedBefore = startedBefore;
}
@CamundaQueryParam(value = "startedAfter", converter = DateConverter.class)
public void setStartedAfter(Date startedAfter) {
this.startedAfter = startedAfter;
}
@CamundaQueryParam(value = "withFailures", converter = BooleanConverter.class)
public void setWithFailures(final Boolean withFailures) {
this.withFailures = withFailures;
}
@CamundaQueryParam(value = "withoutFailures", converter = BooleanConverter.class)
public void setWithoutFailures(final Boolean withoutFailures) {
this.withoutFailures = withoutFailures;
}
protected boolean isValidSortByValue(String value) {
return VALID_SORT_BY_VALUES.contains(value);
}
protected BatchStatisticsQuery createNewQuery(ProcessEngine engine) {
return engine.getManagementService().createBatchStatisticsQuery();
}
protected void applyFilters(BatchStatisticsQuery query) {
if (batchId != null) {
query.batchId(batchId);
}
if (type != null) {
query.type(type);
}
if (TRUE.equals(withoutTenantId)) {
query.withoutTenantId();
}
if (tenantIds != null && !tenantIds.isEmpty()) {
query.tenantIdIn(tenantIds.toArray(new String[tenantIds.size()]));
}
if (TRUE.equals(suspended)) {
query.suspended();
}
if (FALSE.equals(suspended)) {
query.active();
}
if (userId != null) {
query.createdBy(userId);
}
if (startedBefore != null) {
query.startedBefore(startedBefore);
}
if (startedAfter != null) { | query.startedAfter(startedAfter);
}
if (TRUE.equals(withFailures)) {
query.withFailures();
}
if (TRUE.equals(withoutFailures)) {
query.withoutFailures();
}
}
protected void applySortBy(BatchStatisticsQuery query, String sortBy, Map<String, Object> parameters, ProcessEngine engine) {
if (sortBy.equals(SORT_BY_BATCH_ID_VALUE)) {
query.orderById();
}
else if (sortBy.equals(SORT_BY_TENANT_ID_VALUE)) {
query.orderByTenantId();
}
else if (sortBy.equals(SORT_BY_START_TIME_VALUE)) {
query.orderByStartTime();
}
}
} | repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\batch\BatchStatisticsQueryDto.java | 1 |
请完成以下Java代码 | public int getParentElementValue_ID()
{
return get_ValueAsInt(COLUMNNAME_ParentElementValue_ID);
}
@Override
public void setParentValue (final @Nullable java.lang.String ParentValue)
{
set_Value (COLUMNNAME_ParentValue, ParentValue);
}
@Override
public java.lang.String getParentValue()
{
return get_ValueAsString(COLUMNNAME_ParentValue);
}
@Override
public void setPostActual (final boolean PostActual)
{
set_Value (COLUMNNAME_PostActual, PostActual);
}
@Override
public boolean isPostActual()
{
return get_ValueAsBoolean(COLUMNNAME_PostActual);
}
@Override
public void setPostBudget (final boolean PostBudget)
{
set_Value (COLUMNNAME_PostBudget, PostBudget);
}
@Override
public boolean isPostBudget()
{
return get_ValueAsBoolean(COLUMNNAME_PostBudget);
}
@Override
public void setPostEncumbrance (final boolean PostEncumbrance)
{
set_Value (COLUMNNAME_PostEncumbrance, PostEncumbrance);
}
@Override
public boolean isPostEncumbrance()
{
return get_ValueAsBoolean(COLUMNNAME_PostEncumbrance);
}
@Override
public void setPostStatistical (final boolean PostStatistical) | {
set_Value (COLUMNNAME_PostStatistical, PostStatistical);
}
@Override
public boolean isPostStatistical()
{
return get_ValueAsBoolean(COLUMNNAME_PostStatistical);
}
@Override
public void setProcessed (final boolean Processed)
{
set_Value (COLUMNNAME_Processed, Processed);
}
@Override
public boolean isProcessed()
{
return get_ValueAsBoolean(COLUMNNAME_Processed);
}
@Override
public void setProcessing (final boolean Processing)
{
set_Value (COLUMNNAME_Processing, Processing);
}
@Override
public boolean isProcessing()
{
return get_ValueAsBoolean(COLUMNNAME_Processing);
}
@Override
public void setValue (final @Nullable java.lang.String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
@Override
public java.lang.String getValue()
{
return get_ValueAsString(COLUMNNAME_Value);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_I_ElementValue.java | 1 |
请完成以下Java代码 | public Date getDataCollectionStartDate() {
return dataCollectionStartDate;
}
public void setDataCollectionStartDate(Date dataCollectionStartDate) {
this.dataCollectionStartDate = dataCollectionStartDate;
}
@Override
public Map<String, Command> getCommands() {
return commands;
}
public void setCommands(Map<String, Command> commands) {
this.commands = commands;
}
public void putCommand(String commandName, int count) {
if (commands == null) {
commands = new HashMap<>();
}
commands.put(commandName, new CommandImpl(count));
}
@Override
public Map<String, Metric> getMetrics() {
return metrics;
}
public void setMetrics(Map<String, Metric> metrics) {
this.metrics = metrics;
}
public void putMetric(String metricName, int count) {
if (metrics == null) {
metrics = new HashMap<>();
}
metrics.put(metricName, new MetricImpl(count));
}
public void mergeDynamicData(InternalsImpl other) {
this.commands = other.commands;
this.metrics = other.metrics;
}
@Override
public JdkImpl getJdk() {
return jdk;
} | public void setJdk(JdkImpl jdk) {
this.jdk = jdk;
}
@Override
public Set<String> getCamundaIntegration() {
return camundaIntegration;
}
public void setCamundaIntegration(Set<String> camundaIntegration) {
this.camundaIntegration = camundaIntegration;
}
@Override
public LicenseKeyDataImpl getLicenseKey() {
return licenseKey;
}
public void setLicenseKey(LicenseKeyDataImpl licenseKey) {
this.licenseKey = licenseKey;
}
@Override
public Set<String> getWebapps() {
return webapps;
}
public void setWebapps(Set<String> webapps) {
this.webapps = webapps;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\telemetry\dto\InternalsImpl.java | 1 |
请在Spring Boot框架中完成以下Java代码 | TypeElement getType() {
return this.type;
}
boolean isConstructorBindingEnabled() {
return !this.boundConstructors.isEmpty();
}
ExecutableElement getBindConstructor() {
if (this.boundConstructors.isEmpty()) {
return findBoundConstructor();
}
if (this.boundConstructors.size() == 1) {
return this.boundConstructors.get(0);
}
return null;
}
private ExecutableElement findBoundConstructor() {
ExecutableElement boundConstructor = null;
for (ExecutableElement candidate : this.constructors) {
if (!candidate.getParameters().isEmpty()) {
if (boundConstructor != null) {
return null;
}
boundConstructor = candidate;
}
}
return boundConstructor;
}
static Bindable of(TypeElement type, MetadataGenerationEnvironment env) {
List<ExecutableElement> constructors = ElementFilter.constructorsIn(type.getEnclosedElements());
List<ExecutableElement> boundConstructors = getBoundConstructors(type, env, constructors);
return new Bindable(type, constructors, boundConstructors);
} | private static List<ExecutableElement> getBoundConstructors(TypeElement type, MetadataGenerationEnvironment env,
List<ExecutableElement> constructors) {
ExecutableElement bindConstructor = deduceBindConstructor(type, constructors, env);
if (bindConstructor != null) {
return Collections.singletonList(bindConstructor);
}
return constructors.stream().filter(env::hasConstructorBindingAnnotation).toList();
}
private static ExecutableElement deduceBindConstructor(TypeElement type, List<ExecutableElement> constructors,
MetadataGenerationEnvironment env) {
if (constructors.size() == 1) {
ExecutableElement candidate = constructors.get(0);
if (!candidate.getParameters().isEmpty() && !env.hasAutowiredAnnotation(candidate)) {
if (type.getNestingKind() == NestingKind.MEMBER
&& candidate.getModifiers().contains(Modifier.PRIVATE)) {
return null;
}
return candidate;
}
}
return null;
}
}
} | repos\spring-boot-4.0.1\configuration-metadata\spring-boot-configuration-processor\src\main\java\org\springframework\boot\configurationprocessor\PropertyDescriptorResolver.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public boolean isOrActive() {
return orActive;
}
public boolean isUnassigned() {
return unassigned;
}
public boolean isNoDelegationState() {
return noDelegationState;
}
public String getCaseDefinitionKey() {
return caseDefinitionKey;
}
public String getCaseDefinitionKeyLike() {
return caseDefinitionKeyLike;
}
public String getCaseDefinitionKeyLikeIgnoreCase() {
return caseDefinitionKeyLikeIgnoreCase;
}
public Collection<String> getCaseDefinitionKeys() {
return caseDefinitionKeys;
}
public boolean isExcludeSubtasks() {
return excludeSubtasks;
}
public boolean isWithLocalizationFallback() {
return withLocalizationFallback;
}
@Override
public List<Task> list() {
cachedCandidateGroups = null;
return super.list();
}
@Override
public List<Task> listPage(int firstResult, int maxResults) {
cachedCandidateGroups = null;
return super.listPage(firstResult, maxResults);
}
@Override
public long count() {
cachedCandidateGroups = null; | return super.count();
}
public List<List<String>> getSafeCandidateGroups() {
return safeCandidateGroups;
}
public void setSafeCandidateGroups(List<List<String>> safeCandidateGroups) {
this.safeCandidateGroups = safeCandidateGroups;
}
public List<List<String>> getSafeInvolvedGroups() {
return safeInvolvedGroups;
}
public void setSafeInvolvedGroups(List<List<String>> safeInvolvedGroups) {
this.safeInvolvedGroups = safeInvolvedGroups;
}
public List<List<String>> getSafeScopeIds() {
return safeScopeIds;
}
public void setSafeScopeIds(List<List<String>> safeScopeIds) {
this.safeScopeIds = safeScopeIds;
}
} | repos\flowable-engine-main\modules\flowable-task-service\src\main\java\org\flowable\task\service\impl\TaskQueryImpl.java | 2 |
请完成以下Java代码 | public String asString() {
return "spring.rabbit.template.name";
}
},
/**
* The destination exchange (empty if default exchange).
* @since 3.2
*/
EXCHANGE {
@Override
public String asString() {
return "messaging.destination.name";
}
},
/**
* The destination routing key.
* @since 3.2
*/
ROUTING_KEY {
@Override
public String asString() {
return "messaging.rabbitmq.destination.routing_key";
}
}
}
/**
* Default {@link RabbitTemplateObservationConvention} for Rabbit template key values.
*/ | public static class DefaultRabbitTemplateObservationConvention implements RabbitTemplateObservationConvention {
/**
* A singleton instance of the convention.
*/
public static final DefaultRabbitTemplateObservationConvention INSTANCE =
new DefaultRabbitTemplateObservationConvention();
@Override
public KeyValues getLowCardinalityKeyValues(RabbitMessageSenderContext context) {
return KeyValues.of(
TemplateLowCardinalityTags.BEAN_NAME.asString(), context.getBeanName(),
TemplateLowCardinalityTags.EXCHANGE.asString(), context.getExchange(),
TemplateLowCardinalityTags.ROUTING_KEY.asString(), context.getRoutingKey()
);
}
@Override
public String getContextualName(RabbitMessageSenderContext context) {
return context.getDestination() + " send";
}
}
} | repos\spring-amqp-main\spring-rabbit\src\main\java\org\springframework\amqp\rabbit\support\micrometer\RabbitTemplateObservation.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public int update(Long id, OmsOrderReturnReason returnReason) {
returnReason.setId(id);
return returnReasonMapper.updateByPrimaryKey(returnReason);
}
@Override
public int delete(List<Long> ids) {
OmsOrderReturnReasonExample example = new OmsOrderReturnReasonExample();
example.createCriteria().andIdIn(ids);
return returnReasonMapper.deleteByExample(example);
}
@Override
public List<OmsOrderReturnReason> list(Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum,pageSize);
OmsOrderReturnReasonExample example = new OmsOrderReturnReasonExample();
example.setOrderByClause("sort desc");
return returnReasonMapper.selectByExample(example);
}
@Override
public int updateStatus(List<Long> ids, Integer status) { | if(!status.equals(0)&&!status.equals(1)){
return 0;
}
OmsOrderReturnReason record = new OmsOrderReturnReason();
record.setStatus(status);
OmsOrderReturnReasonExample example = new OmsOrderReturnReasonExample();
example.createCriteria().andIdIn(ids);
return returnReasonMapper.updateByExampleSelective(record,example);
}
@Override
public OmsOrderReturnReason getItem(Long id) {
return returnReasonMapper.selectByPrimaryKey(id);
}
} | repos\mall-master\mall-admin\src\main\java\com\macro\mall\service\impl\OmsOrderReturnReasonServiceImpl.java | 2 |
请完成以下Java代码 | public static String getDomain(){
HttpServletRequest request = getHttpServletRequest();
StringBuffer url = request.getRequestURL();
//1.微服务情况下,获取gateway的basePath
String basePath = request.getHeader(ServiceNameConstants.X_GATEWAY_BASE_PATH);
if(oConvertUtils.isNotEmpty(basePath)){
return basePath;
}else{
String domain = url.delete(url.length() - request.getRequestURI().length(), url.length()).toString();
//2.【兼容】SSL认证之后,request.getScheme()获取不到https的问题
// https://blog.csdn.net/weixin_34376986/article/details/89767950
String scheme = request.getHeader(CommonConstant.X_FORWARDED_SCHEME);
if(scheme!=null && !request.getScheme().equals(scheme)){
domain = domain.replace(request.getScheme(),scheme);
}
return domain;
}
}
public static String getOrigin(){
HttpServletRequest request = getHttpServletRequest();
return request.getHeader("Origin");
}
/**
* 通过name获取 Bean.
*
* @param name
* @return
*/
public static Object getBean(String name) {
return getApplicationContext().getBean(name);
} | /**
* 通过class获取Bean.
*
* @param clazz
* @param <T>
* @return
*/
public static <T> T getBean(Class<T> clazz) {
return getApplicationContext().getBean(clazz);
}
/**
* 通过name,以及Clazz返回指定的Bean
*
* @param name
* @param clazz
* @param <T>
* @return
*/
public static <T> T getBean(String name, Class<T> clazz) {
return getApplicationContext().getBean(name, clazz);
}
} | repos\JeecgBoot-main\jeecg-boot\jeecg-boot-base-core\src\main\java\org\jeecg\common\util\SpringContextUtils.java | 1 |
请完成以下Java代码 | private DocumentFieldDescriptor.Builder createProductFieldBuilder(final String fieldName)
{
final IMsgBL msgBL = Services.get(IMsgBL.class);
final ITranslatableString caption = msgBL.translatable(fieldName);
return DocumentFieldDescriptor.builder(fieldName)
.setLookupDescriptorProvider(productLookupDescriptor)
.setCaption(caption)
.setWidgetType(DocumentFieldWidgetType.Lookup)
.setReadonlyLogic(ConstantLogicExpression.FALSE)
.setAlwaysUpdateable(true)
.setMandatoryLogic(ConstantLogicExpression.TRUE)
.setDisplayLogic(ConstantLogicExpression.TRUE)
.addCallout(CableSalesOrderLineQuickInputDescriptorFactory::onProductChangedCallout)
.addCharacteristic(Characteristic.PublicField);
}
private static DocumentFieldDescriptor.Builder createQuantityFieldBuilder(final String fieldName)
{ | return DocumentFieldDescriptor.builder(fieldName)
.setCaption(Services.get(IMsgBL.class).translatable(fieldName))
.setWidgetType(DocumentFieldWidgetType.Quantity)
.setReadonlyLogic(ConstantLogicExpression.FALSE)
.setAlwaysUpdateable(true)
.setMandatoryLogic(ConstantLogicExpression.TRUE)
.setDisplayLogic(ConstantLogicExpression.TRUE)
.addCharacteristic(Characteristic.PublicField);
}
private static void onProductChangedCallout(final ICalloutField calloutField)
{
// TODO
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\vertical\cables\webui\quickinput\CableSalesOrderLineQuickInputDescriptorFactory.java | 1 |
请完成以下Java代码 | private Set<PricingSystemId> getBPartnerPricingSystemIds()
{
final I_C_BPartner bPartner = bpartnerDAO.getById(getBPartnerId());
return Stream.of(bPartner.getM_PricingSystem_ID(), bPartner.getPO_PricingSystem_ID())
.map(PricingSystemId::ofRepoIdOrNull)
.filter(Objects::nonNull)
.collect(ImmutableSet.toImmutableSet());
}
@Nullable
private String getCountryCode(@NonNull final I_M_PriceList priceList)
{
return Optional.ofNullable(CountryId.ofRepoIdOrNull(priceList.getC_Country_ID()))
.map(countryDAO::getById)
.map(I_C_Country::getCountryCode)
.orElse(null);
}
@NonNull
private BPartnerId getBPartnerId()
{
return jsonRetrieverService.resolveBPartnerExternalIdentifier(bpartnerIdentifier, orgId)
.orElseThrow(() -> new InvalidIdentifierException("No BPartner found for identifier")
.appendParametersToMessage()
.setParameter("ExternalIdentifier", bpartnerIdentifier));
}
@NonNull
private ProductId getProductId()
{
return externalIdentifierResolver.resolveProductExternalIdentifier(productIdentifier, orgId)
.orElseThrow(() -> new InvalidIdentifierException("Fail to resolve product external identifier")
.appendParametersToMessage()
.setParameter("ExternalIdentifier", productIdentifier));
}
@NonNull | private ZonedDateTime getTargetDateAndTime()
{
final ZonedDateTime zonedDateTime = TimeUtil.asZonedDateTime(targetDate, orgDAO.getTimeZone(orgId));
Check.assumeNotNull(zonedDateTime, "zonedDateTime is not null!");
return zonedDateTime;
}
@NonNull
private List<JsonResponsePrice> getJsonResponsePrices(
@NonNull final ProductId productId,
@NonNull final String productValue,
@NonNull final PriceListVersionId priceListVersionId)
{
return bpartnerPriceListServicesFacade.getProductPricesByPLVAndProduct(priceListVersionId, productId)
.stream()
.map(productPrice -> JsonResponsePrice.builder()
.productId(JsonMetasfreshId.of(productId.getRepoId()))
.productCode(productValue)
.taxCategoryId(JsonMetasfreshId.of(productPrice.getC_TaxCategory_ID()))
.price(productPrice.getPriceStd())
.build())
.collect(ImmutableList.toImmutableList());
}
@NonNull
private String getCurrencyCode(@NonNull final I_M_PriceList priceList)
{
return bpartnerPriceListServicesFacade
.getCurrencyCodeById(CurrencyId.ofRepoId(priceList.getC_Currency_ID()))
.toThreeLetterCode();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business.rest-api-impl\src\main\java\de\metas\rest_api\v2\pricing\command\SearchProductPricesCommand.java | 1 |
请完成以下Java代码 | public void setIncludeContents(boolean includeContents) {
this.includeContents = includeContents;
}
/**
* The maximum amount of data to be logged for either key or password. As message sizes may vary and
* become fairly large, this allows limiting the amount of data sent to logs.
* Default {@value #DEFAULT_MAX_CONTENT_LOGGED}.
*
* @param maxContentLogged the maximum amount of data being logged.
*/
public void setMaxContentLogged(int maxContentLogged) {
this.maxContentLogged = maxContentLogged;
}
@Override
public void onError(ProducerRecord<K, V> record, @Nullable RecordMetadata recordMetadata, Exception exception) {
this.logger.error(exception, () -> {
StringBuilder logOutput = new StringBuilder();
logOutput.append("Exception thrown when sending a message");
if (this.includeContents) {
logOutput.append(" with key='")
.append(keyOrValue(record.key()))
.append("'")
.append(" and payload='")
.append(keyOrValue(record.value()))
.append("'");
}
logOutput.append(" to topic ").append(record.topic());
if (record.partition() != null) {
logOutput.append(" and partition ").append(recordMetadata != null
? recordMetadata.partition()
: record.partition());
}
logOutput.append(":"); | return logOutput.toString();
});
}
private String keyOrValue(Object keyOrValue) {
if (keyOrValue instanceof byte[]) {
return "byte[" + ((byte[]) keyOrValue).length + "]";
}
else {
return toDisplayString(ObjectUtils.nullSafeToString(keyOrValue), this.maxContentLogged);
}
}
private String toDisplayString(String original, int maxCharacters) {
if (original.length() <= maxCharacters) {
return original;
}
return original.substring(0, maxCharacters) + "...";
}
} | repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\support\LoggingProducerListener.java | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.