instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请完成以下Java代码
|
private Set<String> determineImports(KotlinCompilationUnit compilationUnit) {
List<String> imports = new ArrayList<>();
for (KotlinTypeDeclaration typeDeclaration : compilationUnit.getTypeDeclarations()) {
imports.add(typeDeclaration.getExtends());
imports.addAll(typeDeclaration.getImplements());
imports.addAll(appendImports(typeDeclaration.annotations().values(), Annotation::getImports));
typeDeclaration.getPropertyDeclarations()
.forEach(((propertyDeclaration) -> imports.addAll(determinePropertyImports(propertyDeclaration))));
typeDeclaration.getFunctionDeclarations()
.forEach((functionDeclaration) -> imports.addAll(determineFunctionImports(functionDeclaration)));
}
compilationUnit.getTopLevelFunctions()
.forEach((functionDeclaration) -> imports.addAll(determineFunctionImports(functionDeclaration)));
return imports.stream()
.filter((candidate) -> isImportCandidate(compilationUnit, candidate))
.sorted()
.collect(Collectors.toCollection(LinkedHashSet::new));
}
private Set<String> determinePropertyImports(KotlinPropertyDeclaration propertyDeclaration) {
return (propertyDeclaration.getReturnType() != null) ? Set.of(propertyDeclaration.getReturnType())
: Collections.emptySet();
}
private Set<String> determineFunctionImports(KotlinFunctionDeclaration functionDeclaration) {
Set<String> imports = new LinkedHashSet<>();
imports.add(functionDeclaration.getReturnType());
imports.addAll(appendImports(functionDeclaration.annotations().values(), Annotation::getImports));
for (Parameter parameter : functionDeclaration.getParameters()) {
imports.add(parameter.getType());
imports.addAll(appendImports(parameter.annotations().values(), Annotation::getImports));
}
imports.addAll(functionDeclaration.getCode().getImports());
return imports;
}
private <T> List<String> appendImports(Stream<T> candidates, Function<T, Collection<String>> mapping) {
return candidates.map(mapping).flatMap(Collection::stream).collect(Collectors.toList());
}
private String getUnqualifiedName(String name) {
if (!name.contains(".")) {
return name;
}
|
return name.substring(name.lastIndexOf(".") + 1);
}
private boolean isImportCandidate(CompilationUnit<?> compilationUnit, String name) {
if (name == null || !name.contains(".")) {
return false;
}
String packageName = name.substring(0, name.lastIndexOf('.'));
return !"java.lang".equals(packageName) && !compilationUnit.getPackageName().equals(packageName);
}
static class KotlinFormattingOptions implements FormattingOptions {
@Override
public String statementSeparator() {
return "";
}
@Override
public CodeBlock arrayOf(CodeBlock... values) {
return CodeBlock.of("[$L]", CodeBlock.join(Arrays.asList(values), ", "));
}
@Override
public CodeBlock classReference(ClassName className) {
return CodeBlock.of("$T::class", className);
}
}
}
|
repos\initializr-main\initializr-generator\src\main\java\io\spring\initializr\generator\language\kotlin\KotlinSourceCodeWriter.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public static FTSJoinColumnList ofList(@NonNull final List<FTSJoinColumn> joinColumns)
{
return new FTSJoinColumnList(joinColumns);
}
public int size()
{
return joinColumns.size();
}
@Override
public Iterator<FTSJoinColumn> iterator()
{
return joinColumns.iterator();
}
public String buildJoinCondition(
@NonNull final String targetTableNameOrAlias,
@Nullable final String selectionTableNameOrAlias)
{
Check.assumeNotEmpty(targetTableNameOrAlias, "targetTableNameOrAlias not empty");
final String selectionTableNameOrAliasWithDot = StringUtils.trimBlankToOptional(selectionTableNameOrAlias)
.map(alias -> alias + ".")
.orElse("");
final StringBuilder sql = new StringBuilder();
for (final FTSJoinColumn joinColumn : joinColumns)
{
if (sql.length() > 0)
{
sql.append(" AND ");
}
if (joinColumn.isNullable())
{
|
sql.append("(")
.append(selectionTableNameOrAliasWithDot).append(joinColumn.getSelectionTableColumnName()).append(" IS NULL")
.append(" OR ")
.append(targetTableNameOrAlias).append(".").append(joinColumn.getTargetTableColumnName())
.append(" IS NOT DISTINCT FROM ")
.append(selectionTableNameOrAliasWithDot).append(joinColumn.getSelectionTableColumnName())
.append(")");
}
else
{
sql.append(targetTableNameOrAlias).append(".").append(joinColumn.getTargetTableColumnName())
.append("=")
.append(selectionTableNameOrAliasWithDot).append(joinColumn.getSelectionTableColumnName());
}
}
return sql.toString();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.elasticsearch\src\main\java\de\metas\fulltextsearch\config\FTSJoinColumnList.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public int getMaxLengthString() {
return maxLengthString;
}
public VariableServiceConfiguration setMaxLengthString(int maxLengthString) {
this.maxLengthString = maxLengthString;
return this;
}
public boolean isLoggingSessionEnabled() {
return loggingSessionEnabled;
}
public VariableServiceConfiguration setLoggingSessionEnabled(boolean loggingSessionEnabled) {
this.loggingSessionEnabled = loggingSessionEnabled;
return this;
}
public boolean isSerializableVariableTypeTrackDeserializedObjects() {
return serializableVariableTypeTrackDeserializedObjects;
}
|
public void setSerializableVariableTypeTrackDeserializedObjects(boolean serializableVariableTypeTrackDeserializedObjects) {
this.serializableVariableTypeTrackDeserializedObjects = serializableVariableTypeTrackDeserializedObjects;
}
public VariableJsonMapper getVariableJsonMapper() {
return variableJsonMapper;
}
public void setVariableJsonMapper(VariableJsonMapper variableJsonMapper) {
this.variableJsonMapper = variableJsonMapper;
}
public VariableInstanceValueModifier getVariableInstanceValueModifier() {
return variableInstanceValueModifier;
}
public void setVariableInstanceValueModifier(VariableInstanceValueModifier variableInstanceValueModifier) {
this.variableInstanceValueModifier = variableInstanceValueModifier;
}
}
|
repos\flowable-engine-main\modules\flowable-variable-service\src\main\java\org\flowable\variable\service\VariableServiceConfiguration.java
| 2
|
请完成以下Java代码
|
public void setDescription (java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Beschreibung.
@return Beschreibung */
@Override
public java.lang.String getDescription ()
{
return (java.lang.String)get_Value(COLUMNNAME_Description);
}
/** Set Name.
@param Name Name */
@Override
public void setName (java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Name */
@Override
public java.lang.String getName ()
{
return (java.lang.String)get_Value(COLUMNNAME_Name);
}
|
/** Set Reihenfolge.
@param SeqNo
Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst
*/
@Override
public void setSeqNo (int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo));
}
/** Get Reihenfolge.
@return Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst
*/
@Override
public int getSeqNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\de\metas\dataentry\model\X_DataEntry_ListValue.java
| 1
|
请完成以下Java代码
|
public String getJavaClassFieldForJackson() {
return javaClassFieldForJackson;
}
public void setJavaClassFieldForJackson(String javaClassFieldForJackson) {
this.javaClassFieldForJackson = javaClassFieldForJackson;
}
public Integer getProcessDefinitionCacheLimit() {
return processDefinitionCacheLimit;
}
public void setProcessDefinitionCacheLimit(Integer processDefinitionCacheLimit) {
this.processDefinitionCacheLimit = processDefinitionCacheLimit;
}
public String getProcessDefinitionCacheName() {
|
return processDefinitionCacheName;
}
public void setProcessDefinitionCacheName(String processDefinitionCacheName) {
this.processDefinitionCacheName = processDefinitionCacheName;
}
public void setDisableExistingStartEventSubscriptions(boolean disableExistingStartEventSubscriptions) {
this.disableExistingStartEventSubscriptions = disableExistingStartEventSubscriptions;
}
public boolean shouldDisableExistingStartEventSubscriptions() {
return disableExistingStartEventSubscriptions;
}
}
|
repos\Activiti-develop\activiti-core\activiti-spring-boot-starter\src\main\java\org\activiti\spring\boot\ActivitiProperties.java
| 1
|
请完成以下Java代码
|
public void setEvent_UUID (final @Nullable java.lang.String Event_UUID)
{
set_ValueNoCheck (COLUMNNAME_Event_UUID, Event_UUID);
}
@Override
public java.lang.String getEvent_UUID()
{
return get_ValueAsString(COLUMNNAME_Event_UUID);
}
@Override
public void setHost (final @Nullable java.lang.String Host)
{
set_ValueNoCheck (COLUMNNAME_Host, Host);
}
@Override
public java.lang.String getHost()
{
return get_ValueAsString(COLUMNNAME_Host);
}
@Override
public void setRabbitMQ_Message_Audit_ID (final int RabbitMQ_Message_Audit_ID)
{
if (RabbitMQ_Message_Audit_ID < 1)
set_ValueNoCheck (COLUMNNAME_RabbitMQ_Message_Audit_ID, null);
else
set_ValueNoCheck (COLUMNNAME_RabbitMQ_Message_Audit_ID, RabbitMQ_Message_Audit_ID);
}
@Override
public int getRabbitMQ_Message_Audit_ID()
{
return get_ValueAsInt(COLUMNNAME_RabbitMQ_Message_Audit_ID);
}
@Override
|
public void setRabbitMQ_QueueName (final @Nullable java.lang.String RabbitMQ_QueueName)
{
set_ValueNoCheck (COLUMNNAME_RabbitMQ_QueueName, RabbitMQ_QueueName);
}
@Override
public java.lang.String getRabbitMQ_QueueName()
{
return get_ValueAsString(COLUMNNAME_RabbitMQ_QueueName);
}
@Override
public void setRelated_Event_UUID (final @Nullable java.lang.String Related_Event_UUID)
{
set_ValueNoCheck (COLUMNNAME_Related_Event_UUID, Related_Event_UUID);
}
@Override
public java.lang.String getRelated_Event_UUID()
{
return get_ValueAsString(COLUMNNAME_Related_Event_UUID);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_RabbitMQ_Message_Audit.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void removeAllHandle() {
super.deleteObservers();
}
/**
* 初始化微信配置,即第一次获取access_token
*
* @param refreshTime 刷新时间
*/
private void initToken(final long refreshTime) {
LOG.debug("开始初始化access_token........");
//记住原本的时间,用于出错回滚
final long oldTime = this.weixinTokenStartTime;
this.weixinTokenStartTime = refreshTime;
String url =
"https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + this.appid + "&secret="
+ this.secret;
NetWorkCenter.get(url, null, (resultCode, resultJson) -> {
if (HttpStatus.SC_OK == resultCode) {
GetTokenResponse response = JSON.parseObject(resultJson, GetTokenResponse.class);
LOG.debug("获取access_token:{}", response.getAccessToken());
if (null == response.getAccessToken()) {
//刷新时间回滚
weixinTokenStartTime = oldTime;
throw new WeixinException(
"微信公众号token获取出错,错误信息:" + response.getErrcode() + "," + response.getErrmsg());
}
accessToken = response.getAccessToken();
//设置通知点
setChanged();
notifyObservers(new ConfigChangeNotice(appid, ChangeType.ACCESS_TOKEN, accessToken));
}
});
//刷新工作做完,将标识设置回false
this.tokenRefreshing.set(false);
}
/**
* 初始化微信JS-SDK,获取JS-SDK token
*
|
* @param refreshTime 刷新时间
*/
private void initJSToken(final long refreshTime) {
LOG.debug("初始化 jsapi_ticket........");
//记住原本的时间,用于出错回滚
final long oldTime = this.jsTokenStartTime;
this.jsTokenStartTime = refreshTime;
String url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" + accessToken + "&type=jsapi";
NetWorkCenter.get(url, null, new NetWorkCenter.ResponseCallback() {
@Override
public void onResponse(int resultCode, String resultJson) {
if (HttpStatus.SC_OK == resultCode) {
GetJsApiTicketResponse response = JSON.parseObject(resultJson, GetJsApiTicketResponse.class);
LOG.debug("获取jsapi_ticket:{}", response.getTicket());
if (StringUtils.isBlank(response.getTicket())) {
//刷新时间回滚
jsTokenStartTime = oldTime;
throw new WeixinException(
"微信公众号jsToken获取出错,错误信息:" + response.getErrcode() + "," + response.getErrmsg());
}
jsApiTicket = response.getTicket();
//设置通知点
setChanged();
notifyObservers(new ConfigChangeNotice(appid, ChangeType.JS_TOKEN, jsApiTicket));
}
}
});
//刷新工作做完,将标识设置回false
this.jsRefreshing.set(false);
}
}
|
repos\spring-boot-quick-master\quick-wx-public\src\main\java\com\wx\pn\api\config\ApiConfig.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class Engine {
@Value("3200")
private int capacity;
@Value("250")
private int horsePower;
@Value("6")
private int numberOfCylinders;
public int getCapacity() {
return capacity;
}
public void setCapacity(int capacity) {
this.capacity = capacity;
}
public int getHorsePower() {
return horsePower;
}
public void setHorsePower(int horsePower) {
this.horsePower = horsePower;
|
}
public int getNumberOfCylinders() {
return numberOfCylinders;
}
public void setNumberOfCylinders(int numberOfCylinders) {
this.numberOfCylinders = numberOfCylinders;
}
@Override
public String toString() {
return "Engine{" +
"capacity=" + capacity +
", horsePower=" + horsePower +
", numberOfCylinders=" + numberOfCylinders +
'}';
}
}
|
repos\tutorials-master\spring-spel\src\main\java\com\baeldung\spring\spel\entity\Engine.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public String result(@PathVariable("payWayCode") String payWayCode, HttpServletRequest httpServletRequest, Model model) throws Exception {
Map<String, String> resultMap = new HashMap<String, String>();
Map requestParams = httpServletRequest.getParameterMap();
for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext(); ) {
String name = (String) iter.next();
String[] values = (String[]) requestParams.get(name);
String valueStr = "";
for (int i = 0; i < values.length; i++) {
valueStr = (i == values.length - 1) ? valueStr + values[i]
: valueStr + values[i] + ",";
}
//乱码解决,这段代码在出现乱码时使用。如果mysign和sign不相等也可以使用这段代码转化
// valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8");
valueStr = new String(valueStr);
resultMap.put(name, valueStr);
}
OrderPayResultVo scanPayByResult = rpTradePaymentManagerService.completeScanPayByResult(payWayCode, resultMap);
String bankOrderNo = resultMap.get("out_trade_no");
|
// 根据银行订单号获取支付信息
RpTradePaymentRecord rpTradePaymentRecord = tradePaymentQueryService.getRecordByBankOrderNo(bankOrderNo);
if (rpTradePaymentRecord == null) {
throw new TradeBizException(TradeBizException.TRADE_ORDER_ERROR, ",非法订单,订单不存在");
}
RpUserBankAuth userBankAuth = userBankAuthDao.findByMerchantNoAndPayOrderNo(rpTradePaymentRecord.getMerchantNo(), rpTradePaymentRecord.getMerchantOrderNo());
if (userBankAuth != null) {
return "redirect:/auth/doAuth/" + userBankAuth.getMerchantNo() + "/" + userBankAuth.getPayOrderNo();
}
model.addAttribute("scanPayByResult", scanPayByResult);
return "PayResult";
}
}
|
repos\roncoo-pay-master\roncoo-pay-web-gateway\src\main\java\com\roncoo\pay\controller\ScanPayNotifyController.java
| 2
|
请完成以下Java代码
|
public int getPMM_Week_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_PMM_Week_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Week report event.
@param PMM_WeekReport_Event_ID Week report event */
@Override
public void setPMM_WeekReport_Event_ID (int PMM_WeekReport_Event_ID)
{
if (PMM_WeekReport_Event_ID < 1)
set_ValueNoCheck (COLUMNNAME_PMM_WeekReport_Event_ID, null);
else
set_ValueNoCheck (COLUMNNAME_PMM_WeekReport_Event_ID, Integer.valueOf(PMM_WeekReport_Event_ID));
}
/** Get Week report event.
@return Week report event */
@Override
public int getPMM_WeekReport_Event_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_PMM_WeekReport_Event_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;
}
/** Set Wochenerster.
@param WeekDate Wochenerster */
@Override
public void setWeekDate (java.sql.Timestamp WeekDate)
{
set_Value (COLUMNNAME_WeekDate, WeekDate);
}
/** Get Wochenerster.
@return Wochenerster */
@Override
public java.sql.Timestamp getWeekDate ()
{
return (java.sql.Timestamp)get_Value(COLUMNNAME_WeekDate);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.procurement.base\src\main\java-gen\de\metas\procurement\base\model\X_PMM_WeekReport_Event.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class AcmeProperties {
/**
* Whether to check the location of acme resources.
*/
private boolean checkLocation = true;
/**
* Timeout for establishing a connection to the acme server.
*/
private Duration loginTimeout = Duration.ofSeconds(3);
// @fold:on // getters/setters ...
public boolean isCheckLocation() {
return this.checkLocation;
|
}
public void setCheckLocation(boolean checkLocation) {
this.checkLocation = checkLocation;
}
public Duration getLoginTimeout() {
return this.loginTimeout;
}
public void setLoginTimeout(Duration loginTimeout) {
this.loginTimeout = loginTimeout;
}
// @fold:off
}
|
repos\spring-boot-4.0.1\documentation\spring-boot-docs\src\main\java\org\springframework\boot\docs\features\developingautoconfiguration\customstarter\configurationkeys\AcmeProperties.java
| 2
|
请完成以下Java代码
|
public void setCM_AccessProfile_ID (int CM_AccessProfile_ID)
{
if (CM_AccessProfile_ID < 1)
set_ValueNoCheck (COLUMNNAME_CM_AccessProfile_ID, null);
else
set_ValueNoCheck (COLUMNNAME_CM_AccessProfile_ID, Integer.valueOf(CM_AccessProfile_ID));
}
/** Get Web Access Profile.
@return Web Access Profile
*/
public int getCM_AccessProfile_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_CM_AccessProfile_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_CM_Media getCM_Media() throws RuntimeException
{
return (I_CM_Media)MTable.get(getCtx(), I_CM_Media.Table_Name)
.getPO(getCM_Media_ID(), get_TrxName()); }
|
/** Set Media Item.
@param CM_Media_ID
Contains media content like images, flash movies etc.
*/
public void setCM_Media_ID (int CM_Media_ID)
{
if (CM_Media_ID < 1)
set_ValueNoCheck (COLUMNNAME_CM_Media_ID, null);
else
set_ValueNoCheck (COLUMNNAME_CM_Media_ID, Integer.valueOf(CM_Media_ID));
}
/** Get Media Item.
@return Contains media content like images, flash movies etc.
*/
public int getCM_Media_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_CM_Media_ID);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_CM_AccessMedia.java
| 1
|
请完成以下Java代码
|
public String toString()
{
final StringBuilder sb = new StringBuilder("MAccount=[");
sb.append(getC_ValidCombination_ID());
if (getCombination() != null)
sb.append(",").append(getCombination());
else
{
// .append(",Client=").append(getAD_Client_ID())
sb.append(",Schema=").append(getC_AcctSchema_ID())
.append(",Org=").append(getAD_Org_ID())
.append(",Acct=").append(getAccount_ID())
.append(" ");
if (getC_SubAcct_ID() > 0)
sb.append(",C_SubAcct_ID=").append(getC_SubAcct_ID());
if (getM_Product_ID() > 0)
sb.append(",M_Product_ID=").append(getM_Product_ID());
if (getC_BPartner_ID() > 0)
sb.append(",C_BPartner_ID=").append(getC_BPartner_ID());
if (getAD_OrgTrx_ID() > 0)
sb.append(",AD_OrgTrx_ID=").append(getAD_OrgTrx_ID());
if (getC_LocFrom_ID() > 0)
sb.append(",C_LocFrom_ID=").append(getC_LocFrom_ID());
if (getC_LocTo_ID() > 0)
sb.append(",C_LocTo_ID=").append(getC_LocTo_ID());
if (getC_SalesRegion_ID() > 0)
sb.append(",C_SalesRegion_ID=").append(getC_SalesRegion_ID());
if (getC_Project_ID() > 0)
sb.append(",C_Project_ID=").append(getC_Project_ID());
if (getC_Campaign_ID() > 0)
sb.append(",C_Campaign_ID=").append(getC_Campaign_ID());
if (getC_Activity_ID() > 0)
sb.append(",C_Activity_ID=").append(getC_Activity_ID());
if (getUser1_ID() > 0)
sb.append(",User1_ID=").append(getUser1_ID());
if (getUser2_ID() > 0)
sb.append(",User2_ID=").append(getUser2_ID());
if (getUserElement1_ID() > 0)
sb.append(",UserElement1_ID=").append(getUserElement1_ID());
if (getUserElement2_ID() > 0)
sb.append(",UserElement2_ID=").append(getUserElement2_ID());
}
sb.append("]");
return sb.toString();
}
private final String getAccountType()
{
final I_C_ElementValue elementValue = getAccount();
if (elementValue == null)
|
{
logger.error("No ElementValue for Account_ID={}", getAccount_ID());
return "";
}
return elementValue.getAccountType();
}
@NonNull
public ElementValueId getElementValueId() {return ElementValueId.ofRepoId(getAccount_ID());}
@Nullable
public SalesRegionId getSalesRegionId() {return SalesRegionId.ofRepoIdOrNull(getC_SalesRegion_ID());}
@Nullable
public LocationId getLocFromId() {return LocationId.ofRepoIdOrNull(getC_LocFrom_ID());}
@Nullable
public LocationId getLocToId() {return LocationId.ofRepoIdOrNull(getC_LocTo_ID());}
@Nullable
public OrgId getOrgTrxId() {return OrgId.ofRepoIdOrNull(getAD_OrgTrx_ID());}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MAccount.java
| 1
|
请完成以下Java代码
|
private String get(Client client) {
return get(client, null);
}
private String get(Client client, Long requestTimeout) {
Builder request = client.target(endpoint)
.request();
if (requestTimeout != null) {
request.property(ClientProperties.CONNECT_TIMEOUT, requestTimeout);
request.property(ClientProperties.READ_TIMEOUT, requestTimeout);
}
return request.get(String.class);
}
public String viaClientBuilder() {
ClientBuilder builder = ClientBuilder.newBuilder()
.connectTimeout(TIMEOUT, TimeUnit.MILLISECONDS)
.readTimeout(TIMEOUT, TimeUnit.MILLISECONDS);
return get(builder.build());
}
|
public String viaClientConfig() {
ClientConfig config = new ClientConfig();
config.property(ClientProperties.CONNECT_TIMEOUT, TIMEOUT);
config.property(ClientProperties.READ_TIMEOUT, TIMEOUT);
return get(ClientBuilder.newClient(config));
}
public String viaClientProperty() {
Client client = ClientBuilder.newClient();
client.property(ClientProperties.CONNECT_TIMEOUT, TIMEOUT);
client.property(ClientProperties.READ_TIMEOUT, TIMEOUT);
return get(client);
}
public String viaRequestProperty() {
return get(ClientBuilder.newClient(), TIMEOUT);
}
}
|
repos\tutorials-master\web-modules\jersey-2\src\main\java\com\baeldung\jersey\timeout\client\JerseyTimeoutClient.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
class DatadogPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapter<DatadogProperties>
implements DatadogConfig {
DatadogPropertiesConfigAdapter(DatadogProperties properties) {
super(properties);
}
@Override
public String prefix() {
return "management.datadog.metrics.export";
}
@Override
public String apiKey() {
return obtain(DatadogProperties::getApiKey, DatadogConfig.super::apiKey);
}
@Override
public @Nullable String applicationKey() {
return get(DatadogProperties::getApplicationKey, DatadogConfig.super::applicationKey);
}
@Override
|
public @Nullable String hostTag() {
return get(DatadogProperties::getHostTag, DatadogConfig.super::hostTag);
}
@Override
public String uri() {
return obtain(DatadogProperties::getUri, DatadogConfig.super::uri);
}
@Override
public boolean descriptions() {
return obtain(DatadogProperties::isDescriptions, DatadogConfig.super::descriptions);
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-micrometer-metrics\src\main\java\org\springframework\boot\micrometer\metrics\autoconfigure\export\datadog\DatadogPropertiesConfigAdapter.java
| 2
|
请完成以下Java代码
|
public void onFailure(Throwable t) {
log.error("[{}] Failed to send response {}", requestId, response, t);
sendErrorResponse(requestId, tpi, request, t);
stats.incrementFailed();
}
});
},
e -> {
pendingRequestCount.decrementAndGet();
if (e.getCause() != null && e.getCause() instanceof TimeoutException) {
log.warn("[{}] Timeout to process the request: {}", requestId, request, e);
} else {
log.trace("[{}] Failed to process the request: {}", requestId, request, e);
}
stats.incrementFailed();
},
requestTimeout,
scheduler,
callbackExecutor);
} catch (Throwable e) {
pendingRequestCount.decrementAndGet();
log.warn("[{}] Failed to process the request: {}", requestId, request, e);
stats.incrementFailed();
}
}
});
consumer.commit();
}
private void sendErrorResponse(UUID requestId, TopicPartitionInfo tpi, Request request, Throwable cause) {
Response errorResponseMsg = handler.constructErrorResponseMsg(request, cause);
if (errorResponseMsg != null) {
errorResponseMsg.getHeaders().put(REQUEST_ID_HEADER, uuidToBytes(requestId));
responseProducer.send(tpi, errorResponseMsg, null);
}
}
|
public void subscribe(Set<TopicPartitionInfo> partitions) {
requestConsumer.update(partitions);
}
public void stop() {
if (requestConsumer != null) {
requestConsumer.stop();
requestConsumer.awaitStop();
}
if (responseProducer != null) {
responseProducer.stop();
}
if (scheduler != null) {
scheduler.shutdownNow();
}
}
}
|
repos\thingsboard-master\common\queue\src\main\java\org\thingsboard\server\queue\common\PartitionedQueueResponseTemplate.java
| 1
|
请完成以下Java代码
|
public LUQtysBuilder setQtyTUsPerLU(final BigDecimal qtyTUsPerLU)
{
this.qtyTUsPerLU = NumberUtils.stripTrailingDecimalZeros(qtyTUsPerLU);
return this;
}
public LUQtysBuilder setQtyTUsPerLU(final int qtyTUs)
{
return setQtyTUsPerLU(BigDecimal.valueOf(qtyTUs));
}
private BigDecimal getQtyCUsPerTU()
{
Check.assumeNotNull(qtyCUsPerTU, "qtyCUsPerTU not null");
return qtyCUsPerTU;
}
public LUQtysBuilder setQtyCUsPerTU(final BigDecimal qtyCUsPerTU)
{
this.qtyCUsPerTU = NumberUtils.stripTrailingDecimalZeros(qtyCUsPerTU);
return this;
}
public LUQtysBuilder setQtyCUsPerTU(final int qtyCUsPerTU)
{
return setQtyCUsPerTU(BigDecimal.valueOf(qtyCUsPerTU));
}
/**
* Sets quantity CUs/LU.
*
* Use it only if you have incomplete TUs, else it would be calculated as QtyCUsPerLU = QtyCUsPerTU * QtyTUs.
*
* @param qtyCUsPerLU
*/
public LUQtysBuilder setQtyCUsPerLU_IfGreaterThanZero(BigDecimal qtyCUsPerLU)
{
if (qtyCUsPerLU == null || qtyCUsPerLU.signum() <= 0)
{
return this;
}
this.qtyCUsPerLU = NumberUtils.stripTrailingDecimalZeros(qtyCUsPerLU);
return this;
}
private BigDecimal getQtyCUsPerLU()
{
if (qtyCUsPerLU == null)
{
return getQtyCUsPerTU().multiply(getQtyTUsPerLU());
}
return qtyCUsPerLU;
}
}
}
/** {@link TotalQtyCUBreakdownCalculator} builder */
public static final class Builder
{
private BigDecimal qtyCUsTotal;
private BigDecimal qtyTUsTotal;
private BigDecimal qtyCUsPerTU;
private BigDecimal qtyTUsPerLU;
private Builder()
{
super();
}
public TotalQtyCUBreakdownCalculator build()
{
return new TotalQtyCUBreakdownCalculator(this);
}
public Builder setQtyCUsTotal(final BigDecimal qtyCUsTotal)
|
{
this.qtyCUsTotal = qtyCUsTotal;
return this;
}
public BigDecimal getQtyCUsTotal()
{
Check.assumeNotNull(qtyCUsTotal, "qtyCUsTotal not null");
return qtyCUsTotal;
}
public Builder setQtyTUsTotal(final BigDecimal qtyTUsTotal)
{
this.qtyTUsTotal = qtyTUsTotal;
return this;
}
public BigDecimal getQtyTUsTotal()
{
if (qtyTUsTotal == null)
{
return Quantity.QTY_INFINITE;
}
return qtyTUsTotal;
}
public Builder setStandardQtyCUsPerTU(final BigDecimal qtyCUsPerTU)
{
this.qtyCUsPerTU = qtyCUsPerTU;
return this;
}
public BigDecimal getStandardQtyCUsPerTU()
{
return qtyCUsPerTU;
}
public Builder setStandardQtyTUsPerLU(final BigDecimal qtyTUsPerLU)
{
this.qtyTUsPerLU = qtyTUsPerLU;
return this;
}
public Builder setStandardQtyTUsPerLU(final int qtyTUsPerLU)
{
return setStandardQtyTUsPerLU(BigDecimal.valueOf(qtyTUsPerLU));
}
public BigDecimal getStandardQtyTUsPerLU()
{
return qtyTUsPerLU;
}
public Builder setStandardQtysAsInfinite()
{
setStandardQtyCUsPerTU(BigDecimal.ZERO);
setStandardQtyTUsPerLU(BigDecimal.ZERO);
return this;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\allocation\impl\TotalQtyCUBreakdownCalculator.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class JmxEndpointProperties {
private final Exposure exposure = new Exposure();
/**
* Endpoints JMX domain name. Fallback to 'spring.jmx.default-domain' if set.
*/
private @Nullable String domain;
/**
* Additional static properties to append to all ObjectNames of MBeans representing
* Endpoints.
*/
private final Properties staticNames = new Properties();
public Exposure getExposure() {
return this.exposure;
}
public @Nullable String getDomain() {
return this.domain;
}
public void setDomain(@Nullable String domain) {
this.domain = domain;
}
public Properties getStaticNames() {
return this.staticNames;
}
public static class Exposure {
/**
* Endpoint IDs that should be included or '*' for all.
|
*/
private Set<String> include = new LinkedHashSet<>();
/**
* Endpoint IDs that should be excluded or '*' for all.
*/
private Set<String> exclude = new LinkedHashSet<>();
public Set<String> getInclude() {
return this.include;
}
public void setInclude(Set<String> include) {
this.include = include;
}
public Set<String> getExclude() {
return this.exclude;
}
public void setExclude(Set<String> exclude) {
this.exclude = exclude;
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-actuator-autoconfigure\src\main\java\org\springframework\boot\actuate\autoconfigure\endpoint\jmx\JmxEndpointProperties.java
| 2
|
请完成以下Java代码
|
public OrgId getOrgId()
{
return aggregationKey.getOrgId();
}
public WarehouseId getWarehouseId()
{
return aggregationKey.getWarehouseId();
}
public ProductId getProductId()
{
return aggregationKey.getProductId();
}
public AttributeSetInstanceId getAttributeSetInstanceId()
{
return aggregationKey.getAttributeSetInstanceId();
}
public Quantity getQtyToDeliver()
{
return qtyToDeliver;
}
void setQtyToDeliver(final Quantity qtyToDeliver)
{
this.qtyToDeliver = qtyToDeliver;
}
public ZonedDateTime getDatePromised()
{
return purchaseDatePromised;
}
public List<PurchaseCandidateId> getPurchaseCandidateIds()
{
return purchaseCandidates
.stream()
.map(PurchaseCandidate::getId)
.collect(ImmutableList.toImmutableList());
|
}
public Set<OrderAndLineId> getSalesOrderAndLineIds()
{
return ImmutableSet.copyOf(salesOrderAndLineIds);
}
public void calculateAndSetQtyToDeliver()
{
if (purchaseCandidates.isEmpty())
{
return;
}
final Quantity qtyToPurchase = purchaseCandidates.get(0).getQtyToPurchase();
final Quantity sum = purchaseCandidates
.stream()
.map(PurchaseCandidate::getQtyToPurchase)
.reduce(qtyToPurchase.toZero(), Quantity::add);
setQtyToDeliver(sum);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.purchasecandidate.base\src\main\java\de\metas\purchasecandidate\purchaseordercreation\localorder\PurchaseCandidateAggregate.java
| 1
|
请完成以下Java代码
|
public boolean isFallbackToDefaultTenant() {
return fallbackToDefaultTenant;
}
public void setFallbackToDefaultTenant(boolean fallbackToDefaultTenant) {
this.fallbackToDefaultTenant = fallbackToDefaultTenant;
}
@Override
public List<IOParameter> getInParameters() {
return inParameters;
}
@Override
public void addInParameter(IOParameter inParameter) {
inParameters.add(inParameter);
}
@Override
public void setInParameters(List<IOParameter> inParameters) {
this.inParameters = inParameters;
}
@Override
public List<IOParameter> getOutParameters() {
return outParameters;
}
@Override
public void addOutParameter(IOParameter outParameter) {
this.outParameters.add(outParameter);
}
@Override
public void setOutParameters(List<IOParameter> outParameters) {
this.outParameters = outParameters;
}
public String getCaseInstanceIdVariableName() {
return caseInstanceIdVariableName;
}
|
public void setCaseInstanceIdVariableName(String caseInstanceIdVariableName) {
this.caseInstanceIdVariableName = caseInstanceIdVariableName;
}
@Override
public CaseServiceTask clone() {
CaseServiceTask clone = new CaseServiceTask();
clone.setValues(this);
return clone;
}
public void setValues(CaseServiceTask otherElement) {
super.setValues(otherElement);
setCaseDefinitionKey(otherElement.getCaseDefinitionKey());
setCaseInstanceName(otherElement.getCaseInstanceName());
setBusinessKey(otherElement.getBusinessKey());
setInheritBusinessKey(otherElement.isInheritBusinessKey());
setSameDeployment(otherElement.isSameDeployment());
setFallbackToDefaultTenant(otherElement.isFallbackToDefaultTenant());
setCaseInstanceIdVariableName(otherElement.getCaseInstanceIdVariableName());
inParameters = new ArrayList<>();
if (otherElement.getInParameters() != null && !otherElement.getInParameters().isEmpty()) {
for (IOParameter parameter : otherElement.getInParameters()) {
inParameters.add(parameter.clone());
}
}
outParameters = new ArrayList<>();
if (otherElement.getOutParameters() != null && !otherElement.getOutParameters().isEmpty()) {
for (IOParameter parameter : otherElement.getOutParameters()) {
outParameters.add(parameter.clone());
}
}
}
}
|
repos\flowable-engine-main\modules\flowable-bpmn-model\src\main\java\org\flowable\bpmn\model\CaseServiceTask.java
| 1
|
请完成以下Java代码
|
public String getActivityId() {
return activityId;
}
public SuspensionState getSuspensionState() {
return suspensionState;
}
public Boolean getRetriesLeft() {
return retriesLeft;
}
public Date getNow() {
return ClockUtil.getCurrentTime();
}
|
protected void ensureVariablesInitialized() {
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
VariableSerializers variableSerializers = processEngineConfiguration.getVariableSerializers();
String dbType = processEngineConfiguration.getDatabaseType();
for(QueryVariableValue var : variables) {
var.initialize(variableSerializers, dbType);
}
}
public List<QueryVariableValue> getVariables() {
return variables;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\ExternalTaskQueryImpl.java
| 1
|
请完成以下Java代码
|
public static ResultVo ok() {
return new ResultVo();
}
public static ResultVo ok(Object data) {
ResultVo resultVo = new ResultVo();
resultVo.put("data", data);
return resultVo;
}
public static ResultVo error(String msg) {
ResultVo resultVo = new ResultVo();
resultVo.put("code", 500);
resultVo.put("msg", msg);
return resultVo;
|
}
public static ResultVo error(int code, String msg) {
ResultVo resultVo = new ResultVo();
resultVo.put("code", code);
resultVo.put("msg", msg);
return resultVo;
}
@Override
public ResultVo put(String key, Object value) {
super.put(key, value);
return this;
}
}
|
repos\SpringBootCodeGenerator-master\src\main\java\com\softdev\system\generator\entity\vo\ResultVo.java
| 1
|
请完成以下Java代码
|
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getWriter() {
return writer;
}
public void setWriter(String writer) {
this.writer = writer;
}
public String getIntroduction() {
return introduction;
}
public void setIntroduction(String introduction) {
this.introduction = introduction;
}
|
public Book(Long id, String name, String writer, String introduction) {
this.id = id;
this.name = name;
this.writer = writer;
this.introduction = introduction;
}
public Book(Long id, String name) {
this.id = id;
this.name = name;
}
public Book(String name) {
this.name = name;
}
public Book() {
}
}
|
repos\springboot-learning-example-master\chapter-3-spring-boot-web\src\main\java\demo\springboot\domain\Book.java
| 1
|
请完成以下Java代码
|
public class AlarmCreateOrUpdateActiveRequest implements AlarmModificationRequest {
@NotNull
@Schema(description = "JSON object with Tenant Id", accessMode = Schema.AccessMode.READ_ONLY)
private TenantId tenantId;
@Schema(description = "JSON object with Customer Id", accessMode = Schema.AccessMode.READ_ONLY)
private CustomerId customerId;
@NotNull
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "representing type of the Alarm", example = "High Temperature Alarm")
@Length(fieldName = "type")
private String type;
@NotNull
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "JSON object with alarm originator id")
private EntityId originator;
@NotNull
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "Alarm severity", example = "CRITICAL")
private AlarmSeverity severity;
@Schema(description = "Timestamp of the alarm start time, in milliseconds", example = "1634058704565")
private long startTs;
@Schema(description = "Timestamp of the alarm end time(last time update), in milliseconds", example = "1634111163522")
private long endTs;
@ToString.Exclude
@NoXss
@Schema(description = "JSON object with alarm details")
private JsonNode details;
@Valid
@Schema(description = "JSON object with propagation details")
private AlarmPropagationInfo propagation;
private UserId userId;
private AlarmId edgeAlarmId;
public static AlarmCreateOrUpdateActiveRequest fromAlarm(Alarm a) {
return fromAlarm(a, null);
}
|
public static AlarmCreateOrUpdateActiveRequest fromAlarm(Alarm a, UserId userId) {
return fromAlarm(a, userId, null);
}
public static AlarmCreateOrUpdateActiveRequest fromAlarm(Alarm a, UserId userId, AlarmId edgeAlarmId) {
return AlarmCreateOrUpdateActiveRequest.builder()
.tenantId(a.getTenantId())
.customerId(a.getCustomerId())
.type(a.getType())
.originator(a.getOriginator())
.severity((a.getSeverity()))
.startTs(a.getStartTs())
.endTs(a.getEndTs())
.details(a.getDetails())
.propagation(AlarmPropagationInfo.builder()
.propagate(a.isPropagate())
.propagateToOwner(a.isPropagateToOwner())
.propagateToTenant(a.isPropagateToTenant())
.propagateRelationTypes(a.getPropagateRelationTypes()).build())
.userId(userId)
.edgeAlarmId(edgeAlarmId)
.build();
}
}
|
repos\thingsboard-master\common\data\src\main\java\org\thingsboard\server\common\data\alarm\AlarmCreateOrUpdateActiveRequest.java
| 1
|
请完成以下Java代码
|
public Map<String, Object> execute(CommandContext commandContext) {
// Verify existance of execution
if (executionId == null) {
throw new ActivitiIllegalArgumentException("executionId is null");
}
ExecutionEntity execution = commandContext.getExecutionEntityManager().findById(executionId);
if (execution == null) {
throw new ActivitiObjectNotFoundException("execution " + executionId + " doesn't exist", Execution.class);
}
return getVariable(execution, commandContext);
}
public Map<String, Object> getVariable(ExecutionEntity execution, CommandContext commandContext) {
if (variableNames == null || variableNames.isEmpty()) {
// Fetch all
|
if (isLocal) {
return execution.getVariablesLocal();
} else {
return execution.getVariables();
}
} else {
// Fetch specific collection of variables
if (isLocal) {
return execution.getVariablesLocal(variableNames, false);
} else {
return execution.getVariables(variableNames, false);
}
}
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\cmd\GetExecutionVariablesCmd.java
| 1
|
请完成以下Java代码
|
public boolean isUserInChargeUserEditable()
{
return false;
}
@Override
public void setOrderedData(final I_C_Invoice_Candidate ic)
{
final I_M_InventoryLine inventoryLine = getM_InventoryLine(ic);
final org.compiere.model.I_M_InOutLine originInOutLine = inventoryLine.getM_InOutLine();
Check.assumeNotNull(originInOutLine, "InventoryLine {0} must have an origin inoutline set", inventoryLine);
final I_M_InOut inOut = originInOutLine.getM_InOut();
final I_C_Order order = inOut.getC_Order();
if (inOut.getC_Order_ID() > 0)
{
ic.setC_Order(order); // also set the order; even if the iol does not directly refer to an order line, it is there because of that order
ic.setDateOrdered(order.getDateOrdered());
}
else if (ic.getC_Order_ID() <= 0)
{
// don't attempt to "clear" the order data if it is already set/known.
ic.setC_Order(null);
ic.setDateOrdered(inOut.getMovementDate());
}
final I_M_Inventory inventory = inventoryLine.getM_Inventory();
final DocStatus inventoryDocStatus = DocStatus.ofCode(inventory.getDocStatus());
if (inventoryDocStatus.isCompletedOrClosed())
{
final BigDecimal qtyMultiplier = ONE.negate();
final BigDecimal qtyDelivered = inventoryLine.getQtyInternalUse().multiply(qtyMultiplier);
ic.setQtyEntered(qtyDelivered);
ic.setQtyOrdered(qtyDelivered);
}
else
{
// Corrected, voided etc document. Set qty to zero.
ic.setQtyOrdered(ZERO);
ic.setQtyEntered(ZERO);
}
final IProductBL productBL = Services.get(IProductBL.class);
|
final UomId stockingUOMId = productBL.getStockUOMId(inventoryLine.getM_Product_ID());
ic.setC_UOM_ID(UomId.toRepoId(stockingUOMId));
}
@Override
public void setDeliveredData(final I_C_Invoice_Candidate ic)
{
final BigDecimal qtyDelivered = ic.getQtyOrdered();
ic.setQtyDelivered(qtyDelivered); // when changing this, make sure to threat ProductType.Service specially
final BigDecimal qtyInUOM = Services.get(IUOMConversionBL.class)
.convertFromProductUOM(
ProductId.ofRepoId(ic.getM_Product_ID()),
UomId.ofRepoId(ic.getC_UOM_ID()),
qtyDelivered);
ic.setQtyDeliveredInUOM(qtyInUOM);
ic.setDeliveryDate(ic.getDateOrdered());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\spi\impl\M_InventoryLine_Handler.java
| 1
|
请完成以下Java代码
|
public String getJobDefinitionId() {
return jobDefinitionId;
}
public String getJobDefinitionType() {
return jobDefinitionType;
}
public String getJobDefinitionConfiguration() {
return jobDefinitionConfiguration;
}
public String[] getActivityIds() {
return activityIds;
}
public String[] getFailedActivityIds() {
return failedActivityIds;
}
public String[] getExecutionIds() {
return executionIds;
}
public String getProcessInstanceId() {
return processInstanceId;
}
public String getProcessDefinitionId() {
return processDefinitionId;
}
public String getProcessDefinitionKey() {
return processDefinitionKey;
}
public String getDeploymentId() {
return deploymentId;
}
|
public JobState getState() {
return state;
}
public String[] getTenantIds() {
return tenantIds;
}
public String getHostname() {
return hostname;
}
// setter //////////////////////////////////
protected void setState(JobState state) {
this.state = state;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\HistoricJobLogQueryImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class JSONAttachURLRequest
{
@JsonProperty("name")
String name;
@JsonProperty("url")
String url;
@JsonIgnore
URI uri;
@JsonCreator
private JSONAttachURLRequest(
@JsonProperty("name") final String name,
@JsonProperty("url") final String url)
{
this.name = name;
|
if (Check.isEmpty(name, true))
{
throw new AdempiereException("name cannot be empty");
}
this.url = url;
try
{
this.uri = new URI(url);
}
catch (final URISyntaxException ex)
{
throw new AdempiereException("Invalid URL: " + url, ex);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\attachments\json\JSONAttachURLRequest.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public MyShiroRealm myShiroRealm() {
MyShiroRealm myShiroRealm = new MyShiroRealm();
return myShiroRealm;
}
/**
* 开启shiro aop注解支持. 使用代理方式; 所以需要开启代码支持;
*
* @param securityManager 安全管理器
* @return 授权Advisor
*/
@Bean
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager) {
AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor();
authorizationAttributeSourceAdvisor.setSecurityManager(securityManager);
return authorizationAttributeSourceAdvisor;
}
|
/**
* shiro缓存管理器;
* 需要注入对应的其它的实体类中:
* 1、安全管理器:securityManager
* 可见securityManager是整个shiro的核心;
*
* @return
*/
@Bean
public EhCacheManager ehCacheManager() {
EhCacheManager cacheManager = new EhCacheManager();
cacheManager.setCacheManagerConfigFile("classpath:ehcache.xml");
return cacheManager;
}
}
|
repos\SpringBootBucket-master\springboot-jwt\src\main\java\com\xncoding\jwt\config\ShiroConfig.java
| 2
|
请完成以下Java代码
|
public Object execute(CommandContext commandContext) {
ensureNotNull("historicDecisionInstanceId", historicDecisionInstanceId);
HistoricDecisionInstance historicDecisionInstance = commandContext
.getHistoricDecisionInstanceManager()
.findHistoricDecisionInstance(historicDecisionInstanceId);
ensureNotNull("No historic decision instance found with id: " + historicDecisionInstanceId,
"historicDecisionInstance", historicDecisionInstance);
writeUserOperationLog(commandContext, historicDecisionInstance);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkDeleteHistoricDecisionInstance(historicDecisionInstance);
}
commandContext
|
.getHistoricDecisionInstanceManager()
.deleteHistoricDecisionInstanceByIds(Arrays.asList(historicDecisionInstanceId));
return null;
}
protected void writeUserOperationLog(CommandContext commandContext, HistoricDecisionInstance historicDecisionInstance) {
List<PropertyChange> propertyChanges = new ArrayList<PropertyChange>();
propertyChanges.add(new PropertyChange("nrOfInstances", null, 1));
propertyChanges.add(new PropertyChange("async", null, false));
commandContext.getOperationLogManager().logDecisionInstanceOperation(UserOperationLogEntry.OPERATION_TYPE_DELETE_HISTORY,
historicDecisionInstance.getTenantId(),
propertyChanges);
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\dmn\cmd\DeleteHistoricDecisionInstanceByInstanceIdCmd.java
| 1
|
请完成以下Java代码
|
public void addAvailableUserNotificationsTopic(@NonNull final Topic topic)
{
final boolean added = availableUserNotificationsTopic.add(topic);
logger.info("Registered user notifications topic: {} (already registered: {})", topic, !added);
}
/**
* @return set of available topics on which user can subscribe for UI notifications
*/
private Set<Topic> getAvailableUserNotificationsTopics()
{
return ImmutableSet.copyOf(availableUserNotificationsTopic);
}
@Override
public void registerUserNotificationsListener(@NonNull final IEventListener listener)
{
|
getAvailableUserNotificationsTopics()
.stream()
.map(this::getEventBus)
.forEach(eventBus -> eventBus.subscribe(listener));
}
@Override
public void unregisterUserNotificationsListener(@NonNull final IEventListener listener)
{
getAvailableUserNotificationsTopics()
.stream()
.map(this::getEventBus)
.forEach(eventBus -> eventBus.unsubscribe(listener));
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\event\impl\EventBusFactory.java
| 1
|
请完成以下Java代码
|
public int getAD_SchedulerRecipient_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_SchedulerRecipient_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public org.compiere.model.I_AD_User getAD_User() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_AD_User_ID, org.compiere.model.I_AD_User.class);
}
@Override
public void setAD_User(org.compiere.model.I_AD_User AD_User)
{
set_ValueFromPO(COLUMNNAME_AD_User_ID, org.compiere.model.I_AD_User.class, AD_User);
}
/** Set Ansprechpartner.
@param AD_User_ID
User within the system - Internal or Business Partner Contact
*/
@Override
public void setAD_User_ID (int AD_User_ID)
{
if (AD_User_ID < 0)
set_Value (COLUMNNAME_AD_User_ID, null);
|
else
set_Value (COLUMNNAME_AD_User_ID, Integer.valueOf(AD_User_ID));
}
/** Get Ansprechpartner.
@return User within the system - Internal or Business Partner Contact
*/
@Override
public int getAD_User_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_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_AD_SchedulerRecipient.java
| 1
|
请完成以下Java代码
|
private TableRecordReference retrieveWarningTargetRef_SqlLookup(@NonNull final BusinessRuleWarningTarget.SqlLookup sqlLookup, @NonNull final TableRecordReference rootTargetRecordInfo)
{
final AdTableId warningTargetTableId = sqlLookup.getAdTableId();
final String warningTargetTableName = TableIdsCache.instance.getTableName(warningTargetTableId);
final String warningTargetKeyColumnName = InterfaceWrapperHelper.getKeyColumnName(warningTargetTableName);
final AdTableId rootTableId = rootTargetRecordInfo.getAdTableId();
final String rootTableName = TableIdsCache.instance.getTableName(rootTableId);
final String rootKeyColumnName = InterfaceWrapperHelper.getKeyColumnName(rootTableName);
final String sql = "SELECT target." + warningTargetKeyColumnName
+ " FROM " + rootTableName
+ " JOIN " + warningTargetTableName + " target " + " ON " + "target." + warningTargetKeyColumnName + " = " + sqlLookup.getSql()
+ " WHERE " + rootTableName + "." + rootKeyColumnName + "=?";
final Integer targetRecordId = DB.retrieveFirstRowOrNull(sql, Collections.singletonList(rootTargetRecordInfo.getRecord_ID()), rs -> {
final int intValue = rs.getInt(1);
return rs.wasNull() ? null : intValue;
});
if (targetRecordId == null)
{
return null;
}
final int firstValidId = InterfaceWrapperHelper.getFirstValidIdByColumnName(warningTargetKeyColumnName);
if (targetRecordId < firstValidId)
{
return null;
}
return TableRecordReference.of(warningTargetTableId, targetRecordId);
}
private boolean isPreconditionsMet(
@NonNull final TableRecordReference targetRecordRef,
@NonNull final BusinessRule rule)
|
{
final List<Validation> validations = rule.getPreconditions().stream().map(BusinessRulePrecondition::getValidation).collect(Collectors.toList());
return recordMatcher.isRecordMatching(targetRecordRef, validations);
}
private boolean isRecordValid(
@NonNull final TableRecordReference targetRecordRef,
@NonNull final Validation validation)
{
return recordMatcher.isRecordMatching(targetRecordRef, validation);
}
private AdMessageKey getAdMessageKey(final @NonNull BusinessRule rule)
{
return msgBL.getAdMessageKeyById(rule.getWarningMessageId()).orElseThrow(() -> new AdempiereException("No message defined for business rule ID:" + rule.getId()));
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\business_rule\event\BusinessRuleEventProcessorCommand.java
| 1
|
请完成以下Java代码
|
public void setTooltipType (final java.lang.String TooltipType)
{
set_Value (COLUMNNAME_TooltipType, TooltipType);
}
@Override
public java.lang.String getTooltipType()
{
return get_ValueAsString(COLUMNNAME_TooltipType);
}
@Override
public void setWEBUI_View_PageLength (final int WEBUI_View_PageLength)
{
set_Value (COLUMNNAME_WEBUI_View_PageLength, WEBUI_View_PageLength);
}
@Override
public int getWEBUI_View_PageLength()
{
return get_ValueAsInt(COLUMNNAME_WEBUI_View_PageLength);
}
/**
* WhenChildCloningStrategy AD_Reference_ID=541756
* Reference name: AD_Table_CloningStrategy
*/
public static final int WHENCHILDCLONINGSTRATEGY_AD_Reference_ID=541756;
|
/** Skip = S */
public static final String WHENCHILDCLONINGSTRATEGY_Skip = "S";
/** AllowCloning = A */
public static final String WHENCHILDCLONINGSTRATEGY_AllowCloning = "A";
/** AlwaysInclude = I */
public static final String WHENCHILDCLONINGSTRATEGY_AlwaysInclude = "I";
@Override
public void setWhenChildCloningStrategy (final java.lang.String WhenChildCloningStrategy)
{
set_Value (COLUMNNAME_WhenChildCloningStrategy, WhenChildCloningStrategy);
}
@Override
public java.lang.String getWhenChildCloningStrategy()
{
return get_ValueAsString(COLUMNNAME_WhenChildCloningStrategy);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Table.java
| 1
|
请完成以下Java代码
|
protected int getNextMsgId(boolean multicast) {
if (multicast) {
// Range [65000...65535]
return ThreadLocalRandom.current().nextInt(CoapConfig.DEFAULT_MULTICAST_BASE_MID, MAX_MID + 1);
} else {
// Range [0...64999]
return ThreadLocalRandom.current().nextInt(NONE, CoapConfig.DEFAULT_MULTICAST_BASE_MID);
}
}
private void cancelRpcSubscription(TbCoapClientState state) {
if (state.getRpc() != null) {
clientsByToken.remove(state.getRpc().getToken());
CoapExchange exchange = state.getRpc().getExchange();
state.setRpc(null);
transportService.process(state.getSession(),
TransportProtos.SubscribeToRPCMsg.newBuilder().setUnsubscribe(true).build(),
new CoapResponseCodeCallback(exchange, CoAP.ResponseCode.DELETED, CoAP.ResponseCode.INTERNAL_SERVER_ERROR));
if (state.getAttrs() == null) {
closeAndCleanup(state);
}
}
}
private void cancelAttributeSubscription(TbCoapClientState state) {
if (state.getAttrs() != null) {
clientsByToken.remove(state.getAttrs().getToken());
|
CoapExchange exchange = state.getAttrs().getExchange();
state.setAttrs(null);
transportService.process(state.getSession(),
TransportProtos.SubscribeToAttributeUpdatesMsg.newBuilder().setUnsubscribe(true).build(),
new CoapResponseCodeCallback(exchange, CoAP.ResponseCode.DELETED, CoAP.ResponseCode.INTERNAL_SERVER_ERROR));
if (state.getRpc() == null) {
closeAndCleanup(state);
}
}
}
private void closeAndCleanup(TbCoapClientState state) {
transportService.process(state.getSession(), getSessionEventMsg(TransportProtos.SessionEvent.CLOSED), null);
transportService.deregisterSession(state.getSession());
state.setSession(null);
state.setConfiguration(null);
state.setCredentials(null);
state.setAdaptor(null);
//TODO: add optimistic lock check that the client was already deleted and cleanup "clients" map.
}
private void respond(CoapExchange exchange, Response response, int defContentFormat) {
response.getOptions().setContentFormat(TbCoapContentFormatUtil.getContentFormat(exchange.getRequestOptions().getContentFormat(), defContentFormat));
exchange.respond(response);
}
}
|
repos\thingsboard-master\common\transport\coap\src\main\java\org\thingsboard\server\transport\coap\client\DefaultCoapClientContext.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Saml2ResponseValidatorResult concat(Saml2Error error) {
Assert.notNull(error, "error cannot be null");
Collection<Saml2Error> errors = new ArrayList<>(this.errors);
errors.add(error);
return failure(errors);
}
/**
* Return a new {@link Saml2ResponseValidatorResult} that contains the errors from the
* given {@link Saml2ResponseValidatorResult} as well as this result.
* @param result the {@link Saml2ResponseValidatorResult} to merge with this one
* @return a new {@link Saml2ResponseValidatorResult} for further reporting
*/
public Saml2ResponseValidatorResult concat(Saml2ResponseValidatorResult result) {
Assert.notNull(result, "result cannot be null");
Collection<Saml2Error> errors = new ArrayList<>(this.errors);
errors.addAll(result.getErrors());
return failure(errors);
}
/**
* Construct a successful {@link Saml2ResponseValidatorResult}
* @return an {@link Saml2ResponseValidatorResult} with no errors
*/
public static Saml2ResponseValidatorResult success() {
return NO_ERRORS;
}
/**
* Construct a failure {@link Saml2ResponseValidatorResult} with the provided detail
* @param errors the list of errors
* @return an {@link Saml2ResponseValidatorResult} with the errors specified
|
*/
public static Saml2ResponseValidatorResult failure(Saml2Error... errors) {
return failure(Arrays.asList(errors));
}
/**
* Construct a failure {@link Saml2ResponseValidatorResult} with the provided detail
* @param errors the list of errors
* @return an {@link Saml2ResponseValidatorResult} with the errors specified
*/
public static Saml2ResponseValidatorResult failure(Collection<Saml2Error> errors) {
if (errors.isEmpty()) {
return NO_ERRORS;
}
return new Saml2ResponseValidatorResult(errors);
}
}
|
repos\spring-security-main\saml2\saml2-service-provider\src\main\java\org\springframework\security\saml2\core\Saml2ResponseValidatorResult.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public RetryQueuesInterceptor retryQueuesInterceptor(RabbitTemplate rabbitTemplate, RetryQueues retryQueues) {
return new RetryQueuesInterceptor(rabbitTemplate, retryQueues);
}
@Bean
public SimpleRabbitListenerContainerFactory defaultContainerFactory(ConnectionFactory connectionFactory) {
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
factory.setConnectionFactory(connectionFactory);
return factory;
}
@Bean
public SimpleRabbitListenerContainerFactory retryContainerFactory(ConnectionFactory connectionFactory, RetryOperationsInterceptor retryInterceptor) {
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
factory.setConnectionFactory(connectionFactory);
Advice[] adviceChain = { retryInterceptor };
factory.setAdviceChain(adviceChain);
return factory;
}
@Bean
public SimpleRabbitListenerContainerFactory retryQueuesContainerFactory(ConnectionFactory connectionFactory, RetryQueuesInterceptor retryInterceptor) {
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
factory.setConnectionFactory(connectionFactory);
Advice[] adviceChain = { retryInterceptor };
factory.setAdviceChain(adviceChain);
return factory;
|
}
@RabbitListener(queues = "blocking-queue", containerFactory = "retryContainerFactory")
public void consumeBlocking(String payload) throws Exception {
logger.info("Processing message from blocking-queue: {}", payload);
throw new Exception("exception occured!");
}
@RabbitListener(queues = "non-blocking-queue", containerFactory = "retryQueuesContainerFactory", ackMode = "MANUAL")
public void consumeNonBlocking(String payload) throws Exception {
logger.info("Processing message from non-blocking-queue: {}", payload);
throw new Exception("Error occured!");
}
@RabbitListener(queues = "retry-wait-ended-queue", containerFactory = "defaultContainerFactory")
public void consumeRetryWaitEndedMessage(String payload, Message message, Channel channel) throws Exception {
MessageProperties props = message.getMessageProperties();
rabbitTemplate().convertAndSend(props.getHeader("x-original-exchange"), props.getHeader("x-original-routing-key"), message);
}
}
|
repos\tutorials-master\messaging-modules\spring-amqp\src\main\java\com\baeldung\springamqp\exponentialbackoff\RabbitConfiguration.java
| 2
|
请完成以下Java代码
|
public class UserCreationDto {
@JsonProperty("FIRST_NAME")
private final String firstName;
@JsonProperty("LAST_NAME")
private final String lastName;
@JsonProperty("ADDRESS")
private final String address;
@JsonProperty("BOOKS")
private final List<BookDto> books;
// Default constructor for Jackson deserialization
public UserCreationDto() {
this(null, null, null, null);
}
public UserCreationDto(String firstName, String lastName, String address, List<BookDto> books) {
this.firstName = firstName;
this.lastName = lastName;
this.address = address;
this.books = books;
|
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public String getAddress() {
return address;
}
public List<BookDto> getBooks() {
return books;
}
}
|
repos\tutorials-master\spring-boot-modules\spring-boot-crud\src\main\java\com\baeldung\entitydtodifferences\dto\UserCreationDto.java
| 1
|
请完成以下Java代码
|
public class SimpleSequence
{
//this field might be useful to know when debugging.
final int initial;
final int increment;
int current;
/**
* The first invocation of {@link #next()} will return 10, the second will return 20 and so on.
*/
public static SimpleSequence create()
{
return new SimpleSequence(0, 10);
}
/**
* The first invocation of {@link #next()} will return {code initial + 10}.
*/
public static SimpleSequence createWithInitial(final int initial)
{
return new SimpleSequence(initial, 10);
}
@Builder
|
private SimpleSequence(final int initial, final int increment)
{
this.initial = initial;
Check.errorIf(increment == 0, "The given increment may not be zero");
this.increment = increment;
current = initial;
}
public int next()
{
current = current + increment;
return current;
}
}
|
repos\metasfresh-new_dawn_uat\misc\de-metas-common\de-metas-common-util\src\main\java\de\metas\common\util\SimpleSequence.java
| 1
|
请完成以下Java代码
|
public static final DBNoConnectionException wrapIfNeeded(final Throwable throwable)
{
if (throwable == null)
{
return null;
}
else if (throwable instanceof DBNoConnectionException)
{
return (DBNoConnectionException)throwable;
}
else
{
return new DBNoConnectionException(throwable.getLocalizedMessage(), throwable);
}
}
private static final String MSG = "@NoDBConnection@";
public DBNoConnectionException()
{
super(MSG);
}
|
public DBNoConnectionException(final String additionalMessage)
{
super(MSG + ": " + additionalMessage);
}
public DBNoConnectionException(final String additionalMessage, final Throwable cause)
{
super(MSG + ": " + additionalMessage, cause);
}
private DBNoConnectionException(Throwable cause)
{
super(MSG, cause);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\exceptions\DBNoConnectionException.java
| 1
|
请完成以下Java代码
|
public void addBook(Book book) {
this.books.add(book);
book.setAuthor(this);
}
public void removeBook(Book book) {
book.setAuthor(null);
this.books.remove(book);
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getGenre() {
return genre;
}
public void setGenre(String genre) {
this.genre = genre;
|
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public List<Book> getBooks() {
return books;
}
public void setBooks(List<Book> books) {
this.books = books;
}
@Override
public String toString() {
return "Author{" + "id=" + id + ", name=" + name
+ ", genre=" + genre + ", age=" + age + '}';
}
}
|
repos\Hibernate-SpringBoot-master\HibernateSpringBootDtoEntityViaProjection\src\main\java\com\bookstore\entity\Author.java
| 1
|
请完成以下Java代码
|
public void setC_JobCategory_ID (int C_JobCategory_ID)
{
if (C_JobCategory_ID < 1)
set_Value (COLUMNNAME_C_JobCategory_ID, null);
else
set_Value (COLUMNNAME_C_JobCategory_ID, Integer.valueOf(C_JobCategory_ID));
}
/** Get Position Category.
@return Job Position Category
*/
public int getC_JobCategory_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_JobCategory_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Position.
@param C_Job_ID
Job Position
*/
public void setC_Job_ID (int C_Job_ID)
{
if (C_Job_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Job_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Job_ID, Integer.valueOf(C_Job_ID));
}
/** Get Position.
@return Job Position
*/
public int getC_Job_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Job_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Set Comment/Help.
@param Help
Comment or Hint
*/
public void setHelp (String Help)
{
set_Value (COLUMNNAME_Help, Help);
|
}
/** Get Comment/Help.
@return Comment or Hint
*/
public String getHelp ()
{
return (String)get_Value(COLUMNNAME_Help);
}
/** Set Employee.
@param IsEmployee
Indicates if this Business Partner is an employee
*/
public void setIsEmployee (boolean IsEmployee)
{
set_Value (COLUMNNAME_IsEmployee, Boolean.valueOf(IsEmployee));
}
/** Get Employee.
@return Indicates if this Business Partner is an employee
*/
public boolean isEmployee ()
{
Object oo = get_Value(COLUMNNAME_IsEmployee);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Job.java
| 1
|
请完成以下Java代码
|
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public int getX() {
return x;
}
@Override
public void setX(int x) {
this.x = x;
}
@Override
public int getY() {
return y;
}
@Override
public void setY(int y) {
this.y = y;
}
@Override
|
public int getWidth() {
return width;
}
@Override
public void setWidth(int width) {
this.width = width;
}
@Override
public int getHeight() {
return height;
}
@Override
public void setHeight(int height) {
this.height = height;
}
}
|
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\pvm\process\ParticipantProcess.java
| 1
|
请完成以下Java代码
|
public DecisionRequirementsDefinitionResource getDecisionRequirementsDefinitionById(String decisionRequirementsDefinitionId) {
return new DecisionRequirementsDefinitionResourceImpl(getProcessEngine(), decisionRequirementsDefinitionId);
}
@Override
public DecisionRequirementsDefinitionResource getDecisionRequirementsDefinitionByKey(String decisionRequirementsDefinitionKey) {
DecisionRequirementsDefinition decisionRequirementsDefinition = getProcessEngine().getRepositoryService()
.createDecisionRequirementsDefinitionQuery()
.decisionRequirementsDefinitionKey(decisionRequirementsDefinitionKey)
.withoutTenantId().latestVersion().singleResult();
if (decisionRequirementsDefinition == null) {
String errorMessage = String.format("No matching decision requirements definition with key: %s and no tenant-id", decisionRequirementsDefinitionKey);
throw new RestException(Status.NOT_FOUND, errorMessage);
} else {
return getDecisionRequirementsDefinitionById(decisionRequirementsDefinition.getId());
}
}
@Override
|
public DecisionRequirementsDefinitionResource getDecisionRequirementsDefinitionByKeyAndTenantId(String decisionRequirementsDefinitionKey, String tenantId) {
DecisionRequirementsDefinition decisionRequirementsDefinition = getProcessEngine().getRepositoryService()
.createDecisionRequirementsDefinitionQuery()
.decisionRequirementsDefinitionKey(decisionRequirementsDefinitionKey)
.tenantIdIn(tenantId).latestVersion().singleResult();
if (decisionRequirementsDefinition == null) {
String errorMessage = String.format("No matching decision requirements definition with key: %s and tenant-id: %s", decisionRequirementsDefinitionKey, tenantId);
throw new RestException(Status.NOT_FOUND, errorMessage);
} else {
return getDecisionRequirementsDefinitionById(decisionRequirementsDefinition.getId());
}
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\impl\DecisionRequirementsDefinitionRestServiceImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public @Nullable String getType() {
return this.type;
}
public void setType(@Nullable String type) {
this.type = type;
}
public @Nullable String getCertificate() {
return this.certificate;
}
public void setCertificate(@Nullable String certificate) {
this.certificate = certificate;
}
public @Nullable String getPrivateKey() {
return this.privateKey;
}
public void setPrivateKey(@Nullable String privateKey) {
this.privateKey = privateKey;
}
public @Nullable String getPrivateKeyPassword() {
|
return this.privateKeyPassword;
}
public void setPrivateKeyPassword(@Nullable String privateKeyPassword) {
this.privateKeyPassword = privateKeyPassword;
}
public boolean isVerifyKeys() {
return this.verifyKeys;
}
public void setVerifyKeys(boolean verifyKeys) {
this.verifyKeys = verifyKeys;
}
}
}
|
repos\spring-boot-4.0.1\core\spring-boot-autoconfigure\src\main\java\org\springframework\boot\autoconfigure\ssl\PemSslBundleProperties.java
| 2
|
请完成以下Java代码
|
public class ClassStructureDefinition implements FieldBaseStructureDefinition {
protected String id;
protected Class<?> classStructure;
public ClassStructureDefinition(Class<?> classStructure) {
this(classStructure.getName(), classStructure);
}
public ClassStructureDefinition(String id, Class<?> classStructure) {
this.id = id;
this.classStructure = classStructure;
}
public String getId() {
return this.id;
}
public int getFieldSize() {
// TODO
return 0;
|
}
public String getFieldNameAt(int index) {
// TODO
return null;
}
public Class<?> getFieldTypeAt(int index) {
// TODO
return null;
}
public StructureInstance createInstance() {
return new FieldBaseStructureInstance(this);
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\bpmn\data\ClassStructureDefinition.java
| 1
|
请完成以下Java代码
|
public boolean contains(Object o)
{
if (o.getClass() != String.class) return false;
return contains((String) o);
}
@Override
public Iterator<String> iterator()
{
return getAllStrings().iterator();
}
@Override
public Object[] toArray()
{
return getAllStrings().toArray();
}
@Override
public <T> T[] toArray(T[] a)
{
return getAllStrings().toArray(a);
}
@Override
public boolean add(String s)
{
addString(s);
return true;
}
@Override
public boolean remove(Object o)
{
if (o.getClass() == String.class)
{
removeString((String) o);
}
else
{
removeString(o.toString());
}
return true;
}
@Override
public boolean containsAll(Collection<?> c)
{
for (Object e : c)
if (!contains(e))
return false;
return true;
}
@Override
public boolean addAll(Collection<? extends String> c)
{
boolean modified = false;
for (String e : c)
if (add(e))
modified = true;
|
return modified;
}
@Override
public boolean retainAll(Collection<?> c)
{
boolean modified = false;
Iterator<String> it = iterator();
while (it.hasNext())
{
if (!c.contains(it.next()))
{
it.remove();
modified = true;
}
}
return modified;
}
@Override
public boolean removeAll(Collection<?> c)
{
boolean modified = false;
Iterator<?> it = iterator();
while (it.hasNext())
{
if (c.contains(it.next()))
{
it.remove();
modified = true;
}
}
return modified;
}
@Override
public void clear()
{
sourceNode = new MDAGNode(false);
simplifiedSourceNode = null;
if (equivalenceClassMDAGNodeHashMap != null)
equivalenceClassMDAGNodeHashMap.clear();
mdagDataArray = null;
charTreeSet.clear();
transitionCount = 0;
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\collection\MDAG\MDAGSet.java
| 1
|
请完成以下Java代码
|
public boolean isReadable() {
return readable;
}
public void setReadable(boolean readable) {
this.readable = readable;
}
public boolean isWriteable() {
return writeable;
}
public void setWriteable(boolean writeable) {
this.writeable = writeable;
}
public boolean isRequired() {
return required;
}
public void setRequired(boolean required) {
this.required = required;
}
public List<FormValue> getFormValues() {
return formValues;
}
public void setFormValues(List<FormValue> formValues) {
this.formValues = formValues;
}
public FormProperty clone() {
|
FormProperty clone = new FormProperty();
clone.setValues(this);
return clone;
}
public void setValues(FormProperty otherProperty) {
super.setValues(otherProperty);
setName(otherProperty.getName());
setExpression(otherProperty.getExpression());
setVariable(otherProperty.getVariable());
setType(otherProperty.getType());
setDefaultExpression(otherProperty.getDefaultExpression());
setDatePattern(otherProperty.getDatePattern());
setReadable(otherProperty.isReadable());
setWriteable(otherProperty.isWriteable());
setRequired(otherProperty.isRequired());
formValues = new ArrayList<FormValue>();
if (otherProperty.getFormValues() != null && !otherProperty.getFormValues().isEmpty()) {
for (FormValue formValue : otherProperty.getFormValues()) {
formValues.add(formValue.clone());
}
}
}
}
|
repos\Activiti-develop\activiti-core\activiti-bpmn-model\src\main\java\org\activiti\bpmn\model\FormProperty.java
| 1
|
请完成以下Java代码
|
private String getBPartnerNameById(final int bpartnerRepoId)
{
final IBPartnerBL bpartnerService = Services.get(IBPartnerBL.class);
return bpartnerService.getBPartnerName(BPartnerId.ofRepoIdOrNull(bpartnerRepoId));
}
@NonNull
private PartyIdentification32CHName convertPartyIdentification32CHName(
@NonNull final I_SEPA_Export_Line line,
@Nullable final BankAccount bankAccount,
@NonNull final String paymentType)
{
final PartyIdentification32CHName cdtr = objectFactory.createPartyIdentification32CHName();
if (bankAccount == null)
{
cdtr.setNm(SepaUtils.replaceForbiddenChars(getFirstNonEmpty(
line::getSEPA_MandateRefNo,
() -> getBPartnerNameById(line.getC_BPartner_ID()))));
}
else
{
cdtr.setNm(SepaUtils.replaceForbiddenChars(getFirstNonEmpty(
bankAccount::getAccountName,
line::getSEPA_MandateRefNo,
() -> getBPartnerNameById(line.getC_BPartner_ID()))));
}
final Properties ctx = InterfaceWrapperHelper.getCtx(line);
final I_C_BPartner_Location billToLocation = partnerDAO.retrieveBillToLocation(ctx, line.getC_BPartner_ID(), true, ITrx.TRXNAME_None);
if ((bankAccount == null || !bankAccount.isAddressComplete()) && billToLocation == null)
{
return cdtr;
}
final I_C_Location location = locationDAO.getById(LocationId.ofRepoId(billToLocation.getC_Location_ID()));
final PostalAddress6CH pstlAdr;
if (Objects.equals(paymentType, PAYMENT_TYPE_5) || Objects.equals(paymentType, PAYMENT_TYPE_6))
{
pstlAdr = createUnstructuredPstlAdr(bankAccount, location);
}
|
else
{
pstlAdr = createStructuredPstlAdr(bankAccount, location);
}
cdtr.setPstlAdr(pstlAdr);
return cdtr;
}
@VisibleForTesting
static boolean isInvalidQRReference(@NonNull final String reference)
{
if (reference.length() != 27)
{
return true;
}
final int[] checkSequence = { 0, 9, 4, 6, 8, 2, 7, 1, 3, 5 };
int carryOver = 0;
for (int i = 1; i <= reference.length() - 1; i++)
{
final int idx = ((carryOver + Integer.parseInt(reference.substring(i - 1, i))) % 10);
carryOver = checkSequence[idx];
}
return !(Integer.parseInt(reference.substring(26)) == (10 - carryOver) % 10);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.sepa\base\src\main\java\de\metas\payment\sepa\sepamarshaller\impl\SEPAVendorCreditTransferMarshaler_Pain_001_001_03_CH_02.java
| 1
|
请完成以下Java代码
|
public class Article {
private UUID id;
private String title;
private String author;
public Article(UUID id, String title, String author) {
this.id = id;
this.title = title;
this.author = author;
}
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
|
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
}
|
repos\tutorials-master\persistence-modules\java-cockroachdb\src\main\java\com\baeldung\cockroachdb\domain\Article.java
| 1
|
请完成以下Java代码
|
public class BookSerDe {
static String fileName = "book.ser";
/**
* Method to serialize Book objects to the file
* @throws FileNotFoundException
*/
public static void serialize(Book book) throws Exception {
FileOutputStream file = new FileOutputStream(fileName);
ObjectOutputStream out = new ObjectOutputStream(file);
out.writeObject(book);
out.close();
file.close();
}
/**
|
* Method to deserialize the person object
* @return book
* @throws IOException, ClassNotFoundException
*/
public static Book deserialize() throws Exception {
FileInputStream file = new FileInputStream(fileName);
ObjectInputStream in = new ObjectInputStream(file);
Book book = (Book) in.readObject();
in.close();
file.close();
return book;
}
}
|
repos\tutorials-master\core-java-modules\core-java-lang\src\main\java\com\baeldung\transientkw\BookSerDe.java
| 1
|
请完成以下Java代码
|
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
|
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@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(", title=").append(title);
sb.append(", startDate=").append(startDate);
sb.append(", endDate=").append(endDate);
sb.append(", status=").append(status);
sb.append(", createTime=").append(createTime);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
|
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\SmsFlashPromotion.java
| 1
|
请完成以下Java代码
|
public String getMailServerDefaultFrom() {
return mailServerDefaultFrom;
}
public void setMailServerDefaultFrom(String mailServerDefaultFrom) {
this.mailServerDefaultFrom = mailServerDefaultFrom;
}
public String getMailServerForceTo() {
return mailServerForceTo;
}
public void setMailServerForceTo(String mailServerForceTo) {
this.mailServerForceTo = mailServerForceTo;
}
public String getMailServerHost() {
return mailServerHost;
}
public void setMailServerHost(String mailServerHost) {
this.mailServerHost = mailServerHost;
}
public int getMailServerPort() {
return mailServerPort;
}
public void setMailServerPort(int mailServerPort) {
this.mailServerPort = mailServerPort;
}
public int getMailServerSSLPort() {
return mailServerSSLPort;
}
public void setMailServerSSLPort(int mailServerSSLPort) {
this.mailServerSSLPort = mailServerSSLPort;
}
public String getMailServerUsername() {
return mailServerUsername;
}
public void setMailServerUsername(String mailServerUsername) {
this.mailServerUsername = mailServerUsername;
}
public String getMailServerPassword() {
return mailServerPassword;
}
public void setMailServerPassword(String mailServerPassword) {
|
this.mailServerPassword = mailServerPassword;
}
public boolean isMailServerUseSSL() {
return mailServerUseSSL;
}
public void setMailServerUseSSL(boolean mailServerUseSSL) {
this.mailServerUseSSL = mailServerUseSSL;
}
public boolean isMailServerUseTLS() {
return mailServerUseTLS;
}
public void setMailServerUseTLS(boolean mailServerUseTLS) {
this.mailServerUseTLS = mailServerUseTLS;
}
public Charset getMailServerDefaultCharset() {
return mailServerDefaultCharset;
}
public void setMailServerDefaultCharset(Charset mailServerDefaultCharset) {
this.mailServerDefaultCharset = mailServerDefaultCharset;
}
}
|
repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\cfg\mail\MailServerInfo.java
| 1
|
请完成以下Java代码
|
public int getM_Label_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Label_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Label_ID.
@param M_Product_Certificate_ID Label_ID */
@Override
public void setM_Product_Certificate_ID (int M_Product_Certificate_ID)
{
if (M_Product_Certificate_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Product_Certificate_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Product_Certificate_ID, Integer.valueOf(M_Product_Certificate_ID));
}
/** Get Label_ID.
@return Label_ID */
@Override
public int getM_Product_Certificate_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_Certificate_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public org.compiere.model.I_M_Product getM_Product() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_M_Product_ID, org.compiere.model.I_M_Product.class);
}
|
@Override
public void setM_Product(org.compiere.model.I_M_Product M_Product)
{
set_ValueFromPO(COLUMNNAME_M_Product_ID, org.compiere.model.I_M_Product.class, M_Product);
}
/** Set Produkt.
@param M_Product_ID
Produkt, Leistung, Artikel
*/
@Override
public void setM_Product_ID (int M_Product_ID)
{
if (M_Product_ID < 1)
set_Value (COLUMNNAME_M_Product_ID, null);
else
set_Value (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID));
}
/** Get Produkt.
@return Produkt, Leistung, Artikel
*/
@Override
public int getM_Product_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Product_Certificate.java
| 1
|
请完成以下Java代码
|
protected String[] getPackagesToScan() {
return new String[] { "com.baeldung.hibernate.cache.model" };
}
@Bean
public DataSource dataSource() {
final DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName")));
dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url")));
dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user")));
return dataSource;
}
@Bean
public PlatformTransactionManager transactionManager(final EntityManagerFactory emf) {
final JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(emf);
return transactionManager;
}
|
@Bean
public PersistenceExceptionTranslationPostProcessor exceptionTranslation() {
return new PersistenceExceptionTranslationPostProcessor();
}
final Properties additionalProperties() {
final Properties hibernateProperties = new Properties();
hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect"));
hibernateProperties.setProperty("hibernate.cache.use_second_level_cache", env.getProperty("hibernate.cache.use_second_level_cache"));
hibernateProperties.setProperty("hibernate.cache.use_query_cache", env.getProperty("hibernate.cache.use_query_cache"));
hibernateProperties.setProperty("hibernate.cache.region.factory_class", env.getProperty("hibernate.cache.region.factory_class"));
hibernateProperties.setProperty("hibernate.show_sql", env.getProperty("hibernate.show_sql"));
return hibernateProperties;
}
}
|
repos\tutorials-master\persistence-modules\spring-hibernate-5\src\main\java\com\baeldung\spring\PersistenceJPAConfigL2Cache.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class Order {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@OneToMany(mappedBy = "order", fetch = FetchType.EAGER)
private List<OrderItem> orderItems;
private LocalDate orderDate;
private String name;
private String customerName;
@Version
private Long version;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public List<OrderItem> getOrderItems() {
return orderItems;
}
public void setOrderItems(List<OrderItem> orderItems) {
this.orderItems = orderItems;
}
public LocalDate getOrderDate() {
return orderDate;
}
public void setOrderDate(LocalDate orderDate) {
this.orderDate = orderDate;
}
public String getName() {
|
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public Long getVersion() {
return version;
}
public void setVersion(Long version) {
this.version = version;
}
}
|
repos\tutorials-master\persistence-modules\spring-data-jpa-repo-3\src\main\java\com\baeldung\fetchandrefresh\Order.java
| 2
|
请完成以下Java代码
|
public List<HistoricActivityInstanceEntity> findUnfinishedHistoricActivityInstancesByProcessInstanceId(
String processInstanceId
) {
return historicActivityInstanceDataManager.findUnfinishedHistoricActivityInstancesByProcessInstanceId(
processInstanceId
);
}
@Override
public void deleteHistoricActivityInstancesByProcessInstanceId(String historicProcessInstanceId) {
if (getHistoryManager().isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
historicActivityInstanceDataManager.deleteHistoricActivityInstancesByProcessInstanceId(
historicProcessInstanceId
);
}
}
@Override
public long findHistoricActivityInstanceCountByQueryCriteria(
HistoricActivityInstanceQueryImpl historicActivityInstanceQuery
) {
return historicActivityInstanceDataManager.findHistoricActivityInstanceCountByQueryCriteria(
historicActivityInstanceQuery
);
}
@Override
public List<HistoricActivityInstance> findHistoricActivityInstancesByQueryCriteria(
HistoricActivityInstanceQueryImpl historicActivityInstanceQuery,
Page page
) {
return historicActivityInstanceDataManager.findHistoricActivityInstancesByQueryCriteria(
|
historicActivityInstanceQuery,
page
);
}
@Override
public List<HistoricActivityInstance> findHistoricActivityInstancesByNativeQuery(
Map<String, Object> parameterMap,
int firstResult,
int maxResults
) {
return historicActivityInstanceDataManager.findHistoricActivityInstancesByNativeQuery(
parameterMap,
firstResult,
maxResults
);
}
@Override
public long findHistoricActivityInstanceCountByNativeQuery(Map<String, Object> parameterMap) {
return historicActivityInstanceDataManager.findHistoricActivityInstanceCountByNativeQuery(parameterMap);
}
public HistoricActivityInstanceDataManager getHistoricActivityInstanceDataManager() {
return historicActivityInstanceDataManager;
}
public void setHistoricActivityInstanceDataManager(
HistoricActivityInstanceDataManager historicActivityInstanceDataManager
) {
this.historicActivityInstanceDataManager = historicActivityInstanceDataManager;
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\persistence\entity\HistoricActivityInstanceEntityManagerImpl.java
| 1
|
请完成以下Java代码
|
private PInstanceId createProductsSelection()
{
final Set<ProductId> productIds = inventoryDAO.retrieveUsedProductsByInventoryIds(getSelectedInventoryIds());
if (productIds.isEmpty())
{
throw new AdempiereException("No Products");
}
return DB.createT_Selection(productIds, ITrx.TRXNAME_ThreadInherited);
}
private Set<InventoryId> getSelectedInventoryIds()
{
return retrieveSelectedRecordsQueryBuilder(I_M_Inventory.class)
.create()
.listIds()
.stream()
.map(InventoryId::ofRepoId)
.collect(ImmutableSet.toImmutableSet());
}
private void recomputeCosts(
@NonNull final CostElement costElement,
@NonNull final PInstanceId productsSelectionId,
@NonNull final Instant startDate)
{
DB.executeFunctionCallEx(getTrxName()
, "select \"de_metas_acct\".product_costs_recreate_from_date( p_C_AcctSchema_ID :=" + getAccountingSchemaId().getRepoId()
+ ", p_M_CostElement_ID:=" + costElement.getId().getRepoId()
|
+ ", p_m_product_selection_id:=" + productsSelectionId.getRepoId()
+ " , p_ReorderDocs_DateAcct_Trunc:='MM'"
+ ", p_StartDateAcct:=" + DB.TO_SQL(startDate) + "::date)" //
, null //
);
}
private Instant getStartDate()
{
return inventoryDAO.getMinInventoryDate(getSelectedInventoryIds())
.orElseThrow(() -> new AdempiereException("Cannot determine Start Date"));
}
private List<CostElement> getCostElements()
{
if (p_costingMethod != null)
{
return costElementRepository.getMaterialCostingElementsForCostingMethod(p_costingMethod);
}
return costElementRepository.getActiveMaterialCostingElements(getClientID());
}
private AcctSchemaId getAccountingSchemaId() {return p_C_AcctSchema_ID;}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\inventory\process\M_Inventory_RecomputeCosts.java
| 1
|
请完成以下Java代码
|
public static int modSum(int a, int b) {
return mod(minSymmetricMod(a) + minSymmetricMod(b));
}
public static int modSubtract(int a, int b) {
return mod(minSymmetricMod(a) - minSymmetricMod(b));
}
public static int modMultiply(int a, int b) {
int result = minSymmetricMod((long) minSymmetricMod(a) * (long) minSymmetricMod(b));
return mod(result);
}
public static int modPower(int base, int exp) {
int result = 1;
int b = base;
while (exp > 0) {
if ((exp & 1) == 1) {
result = minSymmetricMod((long) minSymmetricMod(result) * (long) minSymmetricMod(b));
}
b = minSymmetricMod((long) minSymmetricMod(b) * (long) minSymmetricMod(b));
exp >>= 1;
}
return mod(result);
}
private static int[] extendedGcd(int a, int b) {
if (b == 0) {
return new int[] { a, 1, 0 };
}
int[] result = extendedGcd(b, a % b);
int gcd = result[0];
|
int x = result[2];
int y = result[1] - (a / b) * result[2];
return new int[] { gcd, x, y };
}
public static int modInverse(int a) {
int[] result = extendedGcd(a, MOD);
int x = result[1];
return mod(x);
}
public static int modDivide(int a, int b) {
return modMultiply(minSymmetricMod(a), minSymmetricMod(modInverse(b)));
}
}
|
repos\tutorials-master\core-java-modules\core-java-lang-math-4\src\main\java\com\baeldung\math\moduloarithmetic\ModularArithmetic.java
| 1
|
请完成以下Java代码
|
public class ResourceAssignmentExpressionImpl extends BaseElementImpl implements ResourceAssignmentExpression {
protected static ChildElement<Expression> expressionChild;
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(ResourceAssignmentExpression.class, BPMN_ELEMENT_RESOURCE_ASSIGNMENT_EXPRESSION)
.namespaceUri(BPMN20_NS)
.extendsType(BaseElement.class)
.instanceProvider(new ModelTypeInstanceProvider<ResourceAssignmentExpression>() {
public ResourceAssignmentExpression newInstance(ModelTypeInstanceContext instanceContext) {
return new ResourceAssignmentExpressionImpl(instanceContext);
}
});
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
expressionChild = sequenceBuilder.element(Expression.class)
.required()
|
.build();
typeBuilder.build();
}
public ResourceAssignmentExpressionImpl(ModelTypeInstanceContext instanceContext) {
super(instanceContext);
}
public Expression getExpression() {
return expressionChild.getChild(this);
}
public void setExpression(Expression expression) {
expressionChild.setChild(this, expression);
}
}
|
repos\camunda-bpm-platform-master\model-api\bpmn-model\src\main\java\org\camunda\bpm\model\bpmn\impl\instance\ResourceAssignmentExpressionImpl.java
| 1
|
请完成以下Java代码
|
public void setCollapsed(final boolean collapsed)
{
if (container != null)
{
container.setCollapsed(collapsed);
}
}
public JPanel getContentPane()
{
return contentPanel;
}
/**
* Make this field group panel visible if there is at least one component visible inside it.
*
* Analog, hide this field group panel if all containing components are not invisible (or there are no components).
*/
public void updateVisible()
{
if (container == null)
{
return;
}
boolean hasVisibleComponents = false;
for (final Component comp : getContentPane().getComponents())
{
// Ignore layout components
if (comp instanceof Box.Filler)
{
continue;
}
if (comp.isVisible())
{
hasVisibleComponents = true;
break;
}
}
container.setVisible(hasVisibleComponents);
}
private VPanelLayoutCallback getLayoutCallback()
{
return VPanelLayoutCallback.forContainer(contentPanel);
}
private void setLayoutCallback(final VPanelLayoutCallback layoutCallback)
{
VPanelLayoutCallback.setup(contentPanel, layoutCallback);
}
public void addIncludedFieldGroup(final VPanelFieldGroup childGroupPanel)
{
// If it's not an included tab we shall share the same layout constraints as the parent.
// This will enforce same minimum widths to all labels and editors of this field group and also to child group panel.
if (!childGroupPanel.isIncludedTab())
{
childGroupPanel.setLayoutCallback(getLayoutCallback());
}
final CC constraints = new CC()
.spanX()
.growX()
.newline();
contentPanel.add(childGroupPanel.getComponent(), constraints);
}
public void addLabelAndEditor(final CLabel fieldLabel, final VEditor fieldEditor, final boolean sameLine)
{
final GridField gridField = fieldEditor.getField();
|
final GridFieldLayoutConstraints gridFieldConstraints = gridField.getLayoutConstraints();
final boolean longField = gridFieldConstraints != null && gridFieldConstraints.isLongField();
final JComponent editorComp = swingEditorFactory.getEditorComponent(fieldEditor);
//
// Update layout callback.
final VPanelLayoutCallback layoutCallback = getLayoutCallback();
layoutCallback.updateMinWidthFrom(fieldLabel);
// NOTE: skip if long field because in that case the minimum length shall not influence the other fields.
if (!longField)
{
layoutCallback.updateMinWidthFrom(fieldEditor);
}
//
// Link Label to Field
if (fieldLabel != null)
{
fieldLabel.setLabelFor(editorComp);
fieldLabel.setVerticalAlignment(SwingConstants.TOP);
}
//
// Add label
final CC labelConstraints = layoutFactory.createFieldLabelConstraints(sameLine);
contentPanel.add(fieldLabel, labelConstraints);
//
// Add editor
final CC editorConstraints = layoutFactory.createFieldEditorConstraints(gridFieldConstraints);
contentPanel.add(editorComp, editorConstraints);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\org\compiere\grid\VPanelFieldGroup.java
| 1
|
请完成以下Java代码
|
public Builder putPropertyFromObject(final String name, @Nullable final Object value)
{
if (value == null)
{
properties.remove(name);
return this;
}
else if (value instanceof Integer)
{
return putProperty(name, value);
}
else if (value instanceof Long)
{
return putProperty(name, value);
}
else if (value instanceof Double)
{
final double doubleValue = (Double)value;
final int intValue = (int)doubleValue;
if (doubleValue == intValue)
{
return putProperty(name, intValue);
}
else
{
return putProperty(name, BigDecimal.valueOf(doubleValue));
}
}
else if (value instanceof String)
{
return putProperty(name, (String)value);
}
else if (value instanceof Date)
{
return putProperty(name, (Date)value);
}
else if (value instanceof Boolean)
{
return putProperty(name, value);
}
else if (value instanceof ITableRecordReference)
{
return putProperty(name, (ITableRecordReference)value);
}
else if (value instanceof BigDecimal)
{
return putProperty(name, (BigDecimal)value);
}
else if (value instanceof List)
{
return putProperty(name, (List<?>)value);
}
else
|
{
throw new AdempiereException("Unknown value type " + name + " = " + value + " (type " + value.getClass() + ")");
}
}
public Builder setSuggestedWindowId(final int suggestedWindowId)
{
putProperty(PROPERTY_SuggestedWindowId, suggestedWindowId);
return this;
}
public Builder wasLogged()
{
this.loggingStatus = LoggingStatus.WAS_LOGGED;
return this;
}
public Builder shallBeLogged()
{
this.loggingStatus = LoggingStatus.SHALL_BE_LOGGED;
return this;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\event\Event.java
| 1
|
请完成以下Java代码
|
public applet setAlt (String alt)
{
addAttribute ("alt", alt);
return (this);
}
/**
* Sets the lang="" and xml:lang="" attributes
*
* @param lang
* the lang="" and xml:lang="" attributes
*/
public Element setLang (String lang)
{
addAttribute ("lang", lang);
addAttribute ("xml:lang", lang);
return this;
}
/**
* Adds an Element to the element.
*
* @param hashcode
* name of element for hash table
* @param element
* Adds an Element to the element.
*/
public applet addElement (String hashcode, Element element)
{
addElementToRegistry (hashcode, element);
return (this);
}
/**
* Adds an Element to the element.
*
* @param hashcode
* name of element for hash table
* @param element
* Adds an Element to the element.
*/
public applet addElement (String hashcode, String element)
{
addElementToRegistry (hashcode, element);
return (this);
}
/**
* Add an element to the element
*
* @param element
* a string representation of the element
*/
public applet addElement (String element)
{
addElementToRegistry (element);
return (this);
}
|
/**
* Add an element to the element
*
* @param element
* an element to add
*/
public applet addElement (Element element)
{
addElementToRegistry (element);
return (this);
}
/**
* Removes an Element from the element.
*
* @param hashcode
* the name of the element to be removed.
*/
public applet removeElement (String hashcode)
{
removeElementFromRegistry (hashcode);
return (this);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\tools\src\main\java-legacy\org\apache\ecs\xhtml\applet.java
| 1
|
请完成以下Java代码
|
public colgroup setCharOff(String char_off)
{
addAttribute("charoff",char_off);
return(this);
}
/**
Sets the lang="" and xml:lang="" attributes
@param lang the lang="" and xml:lang="" attributes
*/
public Element setLang(String lang)
{
addAttribute("lang",lang);
addAttribute("xml:lang",lang);
return this;
}
/**
Adds an Element to the element.
@param hashcode name of element for hash table
@param element Adds an Element to the element.
*/
public colgroup addElement(String hashcode,Element element)
{
addElementToRegistry(hashcode,element);
return(this);
}
/**
Adds an Element to the element.
@param hashcode name of element for hash table
@param element Adds an Element to the element.
*/
public colgroup addElement(String hashcode,String element)
{
addElementToRegistry(hashcode,element);
|
return(this);
}
/**
Adds an Element to the element.
@param element Adds an Element to the element.
*/
public colgroup addElement(Element element)
{
addElementToRegistry(element);
return(this);
}
/**
Adds an Element to the element.
@param element Adds an Element to the element.
*/
public colgroup addElement(String element)
{
addElementToRegistry(element);
return(this);
}
/**
Removes an Element from the element.
@param hashcode the name of the element to be removed.
*/
public colgroup removeElement(String hashcode)
{
removeElementFromRegistry(hashcode);
return(this);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\tools\src\main\java-legacy\org\apache\ecs\xhtml\colgroup.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void setParametersConsumer(Consumer<LogoutResponseParameters> parametersConsumer) {
Assert.notNull(parametersConsumer, "parametersConsumer cannot be null");
this.delegate
.setParametersConsumer((parameters) -> parametersConsumer.accept(new LogoutResponseParameters(parameters)));
}
/**
* Use this {@link Clock} for determining the issued {@link Instant}
* @param clock the {@link Clock} to use
*/
public void setClock(Clock clock) {
Assert.notNull(clock, "clock must not be null");
this.delegate.setClock(clock);
}
public static final class LogoutResponseParameters {
private final HttpServletRequest request;
private final RelyingPartyRegistration registration;
private final Authentication authentication;
private final LogoutRequest logoutRequest;
public LogoutResponseParameters(HttpServletRequest request, RelyingPartyRegistration registration,
Authentication authentication, LogoutRequest logoutRequest) {
this.request = request;
this.registration = registration;
this.authentication = authentication;
|
this.logoutRequest = logoutRequest;
}
LogoutResponseParameters(BaseOpenSamlLogoutResponseResolver.LogoutResponseParameters parameters) {
this(parameters.getRequest(), parameters.getRelyingPartyRegistration(), parameters.getAuthentication(),
parameters.getLogoutRequest());
}
public HttpServletRequest getRequest() {
return this.request;
}
public RelyingPartyRegistration getRelyingPartyRegistration() {
return this.registration;
}
public Authentication getAuthentication() {
return this.authentication;
}
public LogoutRequest getLogoutRequest() {
return this.logoutRequest;
}
}
}
|
repos\spring-security-main\saml2\saml2-service-provider\src\opensaml5Main\java\org\springframework\security\saml2\provider\service\web\authentication\logout\OpenSaml5LogoutResponseResolver.java
| 2
|
请完成以下Java代码
|
public void setSetupTime (final int SetupTime)
{
set_Value (COLUMNNAME_SetupTime, SetupTime);
}
@Override
public int getSetupTime()
{
return get_ValueAsInt(COLUMNNAME_SetupTime);
}
@Override
public void setSetupTimeReal (final int SetupTimeReal)
{
set_Value (COLUMNNAME_SetupTimeReal, SetupTimeReal);
}
@Override
public int getSetupTimeReal()
{
return get_ValueAsInt(COLUMNNAME_SetupTimeReal);
}
@Override
public void setSetupTimeRequiered (final int SetupTimeRequiered)
{
set_Value (COLUMNNAME_SetupTimeRequiered, SetupTimeRequiered);
}
@Override
public int getSetupTimeRequiered()
{
return get_ValueAsInt(COLUMNNAME_SetupTimeRequiered);
}
@Override
public void setValue (final java.lang.String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
@Override
public java.lang.String getValue()
{
return get_ValueAsString(COLUMNNAME_Value);
}
|
@Override
public void setWaitingTime (final int WaitingTime)
{
set_Value (COLUMNNAME_WaitingTime, WaitingTime);
}
@Override
public int getWaitingTime()
{
return get_ValueAsInt(COLUMNNAME_WaitingTime);
}
@Override
public void setYield (final int Yield)
{
set_Value (COLUMNNAME_Yield, Yield);
}
@Override
public int getYield()
{
return get_ValueAsInt(COLUMNNAME_Yield);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_PP_Order_Node.java
| 1
|
请完成以下Java代码
|
public class LambdaExceptionWrappers {
private static final Logger LOGGER = LoggerFactory.getLogger(LambdaExceptionWrappers.class);
public static Consumer<Integer> lambdaWrapper(Consumer<Integer> consumer) {
return i -> {
try {
consumer.accept(i);
} catch (ArithmeticException e) {
LOGGER.error("Arithmetic Exception occurred : {}", e.getMessage());
}
};
}
static <T, E extends Exception> Consumer<T> consumerWrapper(Consumer<T> consumer, Class<E> clazz) {
return i -> {
try {
consumer.accept(i);
} catch (Exception ex) {
try {
E exCast = clazz.cast(ex);
LOGGER.error("Exception occurred : {}", exCast.getMessage());
} catch (ClassCastException ccEx) {
throw ex;
}
}
};
}
public static <T> Consumer<T> throwingConsumerWrapper(ThrowingConsumer<T, Exception> throwingConsumer) {
return i -> {
try {
throwingConsumer.accept(i);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
};
|
}
public static <T, E extends Exception> Consumer<T> handlingConsumerWrapper(ThrowingConsumer<T, E> throwingConsumer, Class<E> exceptionClass) {
return i -> {
try {
throwingConsumer.accept(i);
} catch (Exception ex) {
try {
E exCast = exceptionClass.cast(ex);
LOGGER.error("Exception occurred : {}", exCast.getMessage());
} catch (ClassCastException ccEx) {
throw new RuntimeException(ex);
}
}
};
}
}
|
repos\tutorials-master\core-java-modules\core-java-lambdas\src\main\java\com\baeldung\java8\lambda\exceptions\LambdaExceptionWrappers.java
| 1
|
请完成以下Java代码
|
public static ImmutableSet<HuUnitType> extractAcceptedHuUnitTypes(final I_M_HU_Label_Config record)
{
final ImmutableSet.Builder<HuUnitType> builder = ImmutableSet.builder();
if (record.isApplyToLUs())
{
builder.add(HuUnitType.LU);
}
if (record.isApplyToTUs())
{
builder.add(HuUnitType.TU);
}
if (record.isApplyToCUs())
{
builder.add(HuUnitType.VHU);
}
return builder.build();
}
//
//
//
//
//
|
private static class HULabelConfigMap
{
private final ImmutableList<HULabelConfigRoute> orderedList;
public HULabelConfigMap(final ImmutableList<HULabelConfigRoute> list)
{
this.orderedList = list.stream()
.sorted(Comparator.comparing(HULabelConfigRoute::getSeqNo))
.collect(ImmutableList.toImmutableList());
}
public ExplainedOptional<HULabelConfig> getFirstMatching(@NonNull final HULabelConfigQuery query)
{
return orderedList.stream()
.filter(route -> route.isMatching(query))
.map(HULabelConfigRoute::getConfig)
.findFirst()
.map(ExplainedOptional::of)
.orElseGet(() -> ExplainedOptional.emptyBecause("No HU Label Config found for " + query));
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\report\labels\HULabelConfigRepository.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.authorizeRequests()
.anyRequest()
.authenticated()
.and()
.apply(securityConfig());
return http.build();
}
@Bean
public AuthenticationManager authManager(HttpSecurity http) throws Exception {
return http.getSharedObject(AuthenticationManagerBuilder.class)
.authenticationProvider(kerberosAuthenticationProvider())
.authenticationProvider(kerberosServiceAuthenticationProvider())
.build();
}
@Bean
public KerberosAuthenticationProvider kerberosAuthenticationProvider() {
KerberosAuthenticationProvider provider = new KerberosAuthenticationProvider();
SunJaasKerberosClient client = new SunJaasKerberosClient();
client.setDebug(true);
provider.setKerberosClient(client);
provider.setUserDetailsService(dummyUserDetailsService());
return provider;
}
@Bean
public SpnegoEntryPoint spnegoEntryPoint() {
return new SpnegoEntryPoint("/login");
}
@Bean
|
public SpnegoAuthenticationProcessingFilter spnegoAuthenticationProcessingFilter(AuthenticationManager authenticationManager) {
SpnegoAuthenticationProcessingFilter filter = new SpnegoAuthenticationProcessingFilter();
filter.setAuthenticationManager(authenticationManager);
return filter;
}
@Bean
public KerberosServiceAuthenticationProvider kerberosServiceAuthenticationProvider() {
KerberosServiceAuthenticationProvider provider = new KerberosServiceAuthenticationProvider();
provider.setTicketValidator(sunJaasKerberosTicketValidator());
provider.setUserDetailsService(dummyUserDetailsService());
return provider;
}
@Bean
public SunJaasKerberosTicketValidator sunJaasKerberosTicketValidator() {
SunJaasKerberosTicketValidator ticketValidator = new SunJaasKerberosTicketValidator();
ticketValidator.setServicePrincipal("HTTP/demo.kerberos.bealdung.com@baeldung.com");
ticketValidator.setKeyTabLocation(new FileSystemResource("baeldung.keytab"));
ticketValidator.setDebug(true);
return ticketValidator;
}
@Bean
public DummyUserDetailsService dummyUserDetailsService() {
return new DummyUserDetailsService();
}
}
|
repos\tutorials-master\spring-security-modules\spring-security-oauth2-sso\spring-security-sso-kerberos\src\main\java\com\baeldung\intro\config\WebSecurityConfig.java
| 2
|
请完成以下Java代码
|
public class AtomicOperationCaseExecutionDeleteCascade implements CmmnAtomicOperation {
public String getCanonicalName() {
return "delete-cascade";
}
protected CmmnExecution findFirstLeaf(CmmnExecution execution) {
List<? extends CmmnExecution> executions = execution.getCaseExecutions();
if (executions.size() > 0) {
return findFirstLeaf(executions.get(0));
}
return execution;
}
public void execute(CmmnExecution execution) {
|
CmmnExecution firstLeaf = findFirstLeaf(execution);
firstLeaf.remove();
CmmnExecution parent = firstLeaf.getParent();
if (parent != null) {
parent.deleteCascade();
}
}
public boolean isAsync(CmmnExecution execution) {
return false;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmmn\operation\AtomicOperationCaseExecutionDeleteCascade.java
| 1
|
请完成以下Java代码
|
private Pickup createPickupDateAndTime(
@NonNull final PickupDate pickupDate, final int numberOfPackages,
@NonNull final de.metas.shipper.gateway.spi.model.Address sender)
{
final Pickup pickup = shipmentServiceOF.createPickup();
pickup.setQuantity(numberOfPackages);
pickup.setDate(DpdConversionUtil.formatDate(pickupDate.getDate()));
pickup.setDay(DpdConversionUtil.getPickupDayOfTheWeek(pickupDate));
pickup.setFromTime1(DpdConversionUtil.formatTime(pickupDate.getTimeFrom()));
pickup.setToTime1(DpdConversionUtil.formatTime(pickupDate.getTimeTo()));
// pickup.setExtraPickup(true); // optional
pickup.setCollectionRequestAddress(createAddress(sender));
return pickup;
}
@NonNull
private PrintOptions createPrintOptions(
@NonNull final DpdOrderCustomDeliveryData customDeliveryData)
{
final PrintOptions printOptions = shipmentServiceOF.createPrintOptions();
printOptions.setPaperFormat(customDeliveryData.getPaperFormat().getCode());
printOptions.setPrinterLanguage(customDeliveryData.getPrinterLanguage());
return printOptions;
}
private Login authenticateRequest()
{
// Login
final GetAuth getAuthValue = loginServiceOF.createGetAuth();
getAuthValue.setDelisId(config.getDelisID());
getAuthValue.setPassword(config.getDelisPassword());
getAuthValue.setMessageLanguage(DpdConstants.DEFAULT_MESSAGE_LANGUAGE);
final ILoggable epicLogger = getEpicLogger();
epicLogger.addLog("Creating login request");
final JAXBElement<GetAuth> getAuthElement = loginServiceOF.createGetAuth(getAuthValue);
@SuppressWarnings("unchecked") final JAXBElement<GetAuthResponse> authenticationElement = (JAXBElement<GetAuthResponse>)doActualRequest(config.getLoginApiUrl(), getAuthElement, null, null);
final Login login = authenticationElement.getValue().getReturn();
epicLogger.addLog("Finished login Request");
return login;
}
|
/**
* no idea what this does, but tobias sais it's useful to have this special log, so here it is!
*/
@NonNull
private ILoggable getEpicLogger()
{
return Loggables.withLogger(logger, Level.TRACE);
}
@Override
public @NonNull JsonDeliveryAdvisorResponse adviseShipment(final @NonNull JsonDeliveryAdvisorRequest request)
{
return JsonDeliveryAdvisorResponse.builder()
.requestId(request.getId())
.shipperProduct(JsonShipperProduct.builder()
.code(DpdShipperProduct.DPD_CLASSIC.getCode())
.build())
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.dpd\src\main\java\de\metas\shipper\gateway\dpd\DpdShipperGatewayClient.java
| 1
|
请完成以下Java代码
|
private @Nullable String getDefaultReplyToAddress() {
Method listenerMethod = getMethod();
if (listenerMethod != null) {
SendTo ann = AnnotationUtils.getAnnotation(listenerMethod, SendTo.class);
if (ann != null) {
String[] destinations = ann.value();
if (destinations.length > 1) {
throw new IllegalStateException("Invalid @" + SendTo.class.getSimpleName() + " annotation on '"
+ listenerMethod + "' one destination must be set (got " + Arrays.toString(destinations) + ")");
}
return destinations.length == 1 ? resolveSendTo(destinations[0]) : "";
}
}
return null;
}
private @Nullable String resolveSendTo(String value) {
BeanExpressionContext beanExpressionContext = getBeanExpressionContext();
if (beanExpressionContext != null) {
String resolvedValue = beanExpressionContext.getBeanFactory().resolveEmbeddedValue(value);
BeanExpressionResolver resolverToUse = getResolver();
if (resolverToUse != null) {
Object newValue = resolverToUse.evaluate(resolvedValue, beanExpressionContext);
Assert.isInstanceOf(String.class, newValue, "Invalid @SendTo expression");
return (String) newValue;
}
}
return value;
}
@Override
protected StringBuilder getEndpointDescription() {
return super.getEndpointDescription()
.append(" | bean='").append(this.bean).append("'")
.append(" | method='").append(this.method).append("'");
}
/**
* Provider of listener adapters.
* @since 2.4
*
*/
public interface AdapterProvider {
/**
* Get an adapter instance.
|
* @param batch true for a batch listener.
* @param bean the bean.
* @param method the method.
* @param returnExceptions true to return exceptions.
* @param errorHandler the error handler.
* @param batchingStrategy the batching strategy for batch listeners.
* @return the adapter.
*/
MessagingMessageListenerAdapter getAdapter(boolean batch, @Nullable Object bean, @Nullable Method method,
boolean returnExceptions, @Nullable RabbitListenerErrorHandler errorHandler,
@Nullable BatchingStrategy batchingStrategy);
}
private static final class DefaultAdapterProvider implements AdapterProvider {
@Override
public MessagingMessageListenerAdapter getAdapter(boolean batch, @Nullable Object bean, @Nullable Method method,
boolean returnExceptions, @Nullable RabbitListenerErrorHandler errorHandler,
@Nullable BatchingStrategy batchingStrategy) {
if (batch) {
return new BatchMessagingMessageListenerAdapter(bean, method, returnExceptions, errorHandler,
batchingStrategy);
}
else {
return new MessagingMessageListenerAdapter(bean, method, returnExceptions, errorHandler);
}
}
}
}
|
repos\spring-amqp-main\spring-rabbit\src\main\java\org\springframework\amqp\rabbit\listener\MethodRabbitListenerEndpoint.java
| 1
|
请完成以下Java代码
|
class LongRunningAction implements Runnable {
private static final Logger log = LoggerFactory.getLogger(LongRunningAction.class);
private final String threadName;
private final Phaser ph;
LongRunningAction(String threadName, Phaser ph) {
this.threadName = threadName;
this.ph = ph;
this.randomWait();
ph.register();
log.info("Thread {} registered during phase {}", threadName, ph.getPhase());
}
@Override
public void run() {
log.info("Thread {} BEFORE long running action in phase {}", threadName, ph.getPhase());
|
ph.arriveAndAwaitAdvance();
randomWait();
log.info("Thread {} AFTER long running action in phase {}", threadName, ph.getPhase());
ph.arriveAndDeregister();
}
// Simulating real work
private void randomWait() {
try {
Thread.sleep((long) (Math.random() * 100));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
|
repos\tutorials-master\core-java-modules\core-java-concurrency-advanced-7\src\main\java\com\baeldung\phaser\LongRunningAction.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
class UserController {
private static String XML_PAYLOAD = "<firstname>Dave</firstname><lastname>Matthews</lastname>";
/**
* Receiving POST requests supporting both JSON and XML.
*
* @param user
* @return
*/
@PostMapping(value = "/")
HttpEntity<String> post(@RequestBody UserPayload user) {
return ResponseEntity
.ok(String.format("Received firstname: %s, lastname: %s", user.getFirstname(), user.getLastname()));
}
/**
* Returns a simple JSON payload.
*
* @return
*/
@GetMapping(path = "/", produces = MediaType.APPLICATION_JSON_VALUE)
Map<String, Object> getJson() {
Map<String, Object> result = new HashMap<>();
result.put("firstname", "Dave");
result.put("lastname", "Matthews");
return result;
}
/**
* Returns the payload of {@link #getJson()} wrapped into another element to simulate a change in the representation.
*
* @return
*/
@GetMapping(path = "/changed", produces = MediaType.APPLICATION_JSON_VALUE)
Map<String, Object> getChangedJson() {
return Collections.singletonMap("user", getJson());
}
/**
* Returns a simple XML payload.
*
* @return
*/
@GetMapping(path = "/", produces = MediaType.APPLICATION_XML_VALUE)
String getXml() {
return "<user>".concat(XML_PAYLOAD).concat("</user>");
}
/**
|
* Returns the payload of {@link #getXml()} wrapped into another XML element to simulate a change in the
* representation structure.
*
* @return
*/
@GetMapping(path = "/changed", produces = MediaType.APPLICATION_XML_VALUE)
String getChangedXml() {
return "<user><username>".concat(XML_PAYLOAD).concat("</username></user>");
}
/**
* The projection interface using XPath and JSON Path expression to selectively pick elements from the payload.
*
* @author Oliver Gierke
*/
@ProjectedPayload
public interface UserPayload {
@XBRead("//firstname")
@JsonPath("$..firstname")
String getFirstname();
@XBRead("//lastname")
@JsonPath("$..lastname")
String getLastname();
}
}
|
repos\spring-data-examples-main\web\projection\src\main\java\example\users\UserController.java
| 2
|
请完成以下Java代码
|
public class DelegatingDecompressingPostProcessor implements MessagePostProcessor, Ordered {
private final Map<String, MessagePostProcessor> decompressors = new HashMap<>();
private int order;
/**
* Construct an instance with the default decompressors (gzip, zip, deflate) with
* the alwaysDecompress flag set to true.
*/
public DelegatingDecompressingPostProcessor() {
this.decompressors.put("gzip", new GUnzipPostProcessor(true));
this.decompressors.put("zip", new UnzipPostProcessor(true));
this.decompressors.put("deflate", new InflaterPostProcessor(true));
}
@Override
public int getOrder() {
return this.order;
}
/**
* Set the order.
* @param order the order.
* @see Ordered
*/
public void setOrder(int order) {
this.order = order;
}
/**
* Add a message post processor to the map of decompressing MessageProcessors.
* @param contentEncoding the content encoding; messages will be decompressed with this post processor
* if its {@code content-encoding} property matches, or begins with this key followed by ":".
* @param decompressor the decompressing {@link MessagePostProcessor}.
*/
public void addDecompressor(String contentEncoding, MessagePostProcessor decompressor) {
this.decompressors.put(contentEncoding, decompressor);
}
/**
* Remove the decompressor for this encoding; content will not be decompressed even if the
* {@link org.springframework.amqp.core.MessageProperties#SPRING_AUTO_DECOMPRESS} header is true.
* @param contentEncoding the content encoding.
* @return the decompressor if it was present.
*/
public MessagePostProcessor removeDecompressor(String contentEncoding) {
return this.decompressors.remove(contentEncoding);
|
}
/**
* Replace all the decompressors.
* @param decompressors the decompressors.
*/
public void setDecompressors(Map<String, MessagePostProcessor> decompressors) {
this.decompressors.clear();
this.decompressors.putAll(decompressors);
}
@Override
public Message postProcessMessage(Message message) throws AmqpException {
String encoding = message.getMessageProperties().getContentEncoding();
if (encoding == null) {
return message;
}
int delimAt = encoding.indexOf(':');
if (delimAt < 0) {
delimAt = encoding.indexOf(',');
}
if (delimAt > 0) {
encoding = encoding.substring(0, delimAt);
}
MessagePostProcessor decompressor = this.decompressors.get(encoding);
if (decompressor != null) {
return decompressor.postProcessMessage(message);
}
return message;
}
}
|
repos\spring-amqp-main\spring-amqp\src\main\java\org\springframework\amqp\support\postprocessor\DelegatingDecompressingPostProcessor.java
| 1
|
请完成以下Java代码
|
public ProcessPreconditionsResolution checkPreconditionsApplicable(final @NonNull IProcessPreconditionsContext context)
{
if (context.isNoSelection())
{
return ProcessPreconditionsResolution.rejectBecauseNoSelection();
}
if (!context.isSingleSelection())
{
return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection();
}
final I_EDI_Desadv desadv = desadvDAO.retrieveById(EDIDesadvId.ofRepoId(context.getSingleSelectedRecordId()));
final EDIExportStatus fromExportStatus = EDIExportStatus.ofNullableCode(desadv.getEDI_ExportStatus());
if (fromExportStatus == null)
{
return ProcessPreconditionsResolution.rejectWithInternalReason("Cannot change ExportStatus from the current one for: " + desadv);
}
if (ChangeEDI_ExportStatusHelper.getAvailableTargetExportStatuses(fromExportStatus).isEmpty())
{
return ProcessPreconditionsResolution.rejectWithInternalReason("Cannot change ExportStatus from the current one: " + fromExportStatus);
}
return ProcessPreconditionsResolution.accept();
}
@ProcessParamLookupValuesProvider(parameterName = PARAM_TargetExportStatus, numericKey = false, lookupSource = LookupSource.list)
private LookupValuesList getTargetExportStatusLookupValues(final LookupDataSourceContext context)
{
final I_EDI_Desadv desadv = desadvDAO.retrieveById(EDIDesadvId.ofRepoId(getRecord_ID()));
final EDIExportStatus fromExportStatus = EDIExportStatus.ofCode(desadv.getEDI_ExportStatus());
|
return ChangeEDI_ExportStatusHelper.computeTargetExportStatusLookupValues(fromExportStatus);
}
@Override
@Nullable
public Object getParameterDefaultValue(final IProcessDefaultParameter parameter)
{
final I_EDI_Desadv desadv = desadvDAO.retrieveById(EDIDesadvId.ofRepoId(getRecord_ID()));
final EDIExportStatus fromExportStatus = EDIExportStatus.ofCode(desadv.getEDI_ExportStatus());
return ChangeEDI_ExportStatusHelper.computeParameterDefaultValue(fromExportStatus);
}
@Override
protected String doIt() throws Exception
{
final EDIExportStatus targetExportStatus = EDIExportStatus.ofCode(p_TargetExportStatus);
final boolean isProcessed = ChangeEDI_ExportStatusHelper.computeIsProcessedByTargetExportStatus(targetExportStatus);
ChangeEDI_ExportStatusHelper.EDI_DesadvDoIt(EDIDesadvId.ofRepoId(getRecord_ID()),
targetExportStatus,
isProcessed);
return MSG_OK;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\edi_desadv\ChangeEDI_ExportStatus_EDI_Desadv_SingleView.java
| 1
|
请完成以下Java代码
|
public long executeCount(CommandContext commandContext) {
return CommandContextUtil.getChannelDefinitionEntityManager(commandContext).findChannelDefinitionCountByQueryCriteria(this);
}
@Override
public List<ChannelDefinition> executeList(CommandContext commandContext) {
return CommandContextUtil.getChannelDefinitionEntityManager(commandContext).findChannelDefinitionsByQueryCriteria(this);
}
// getters ////////////////////////////////////////////
public String getDeploymentId() {
return deploymentId;
}
public Set<String> getDeploymentIds() {
return deploymentIds;
}
public String getParentDeploymentId() {
return parentDeploymentId;
}
public String getId() {
return id;
}
public Set<String> getIds() {
return ids;
}
public String getName() {
return name;
}
public String getNameLike() {
return nameLike;
}
public String getNameLikeIgnoreCase() {
return nameLikeIgnoreCase;
}
public String getKey() {
return key;
}
public String getKeyLike() {
return keyLike;
}
public String getKeyLikeIgnoreCase() {
return keyLikeIgnoreCase;
}
public String getCategory() {
return category;
}
public String getCategoryLike() {
return categoryLike;
}
public Integer getVersion() {
return version;
}
public Integer getVersionGt() {
return versionGt;
}
public Integer getVersionGte() {
return versionGte;
}
public Integer getVersionLt() {
return versionLt;
}
public Integer getVersionLte() {
return versionLte;
}
public boolean isLatest() {
return latest;
}
public boolean isOnlyInbound() {
return onlyInbound;
}
public boolean isOnlyOutbound() {
return onlyOutbound;
}
|
public String getImplementation() {
return implementation;
}
public Date getCreateTime() {
return createTime;
}
public Date getCreateTimeAfter() {
return createTimeAfter;
}
public Date getCreateTimeBefore() {
return createTimeBefore;
}
public String getResourceName() {
return resourceName;
}
public String getResourceNameLike() {
return resourceNameLike;
}
public String getCategoryNotEquals() {
return categoryNotEquals;
}
public String getTenantId() {
return tenantId;
}
public String getTenantIdLike() {
return tenantIdLike;
}
public boolean isWithoutTenantId() {
return withoutTenantId;
}
}
|
repos\flowable-engine-main\modules\flowable-event-registry\src\main\java\org\flowable\eventregistry\impl\ChannelDefinitionQueryImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
class ConditionEvaluationDeltaLoggingListener
implements ApplicationListener<ApplicationReadyEvent>, ApplicationContextAware {
private static final ConcurrentHashMap<String, ConditionEvaluationReport> previousReports = new ConcurrentHashMap<>();
private static final Log logger = LogFactory.getLog(ConditionEvaluationDeltaLoggingListener.class);
@SuppressWarnings("NullAway.Init")
private volatile ApplicationContext context;
@Override
public void onApplicationEvent(ApplicationReadyEvent event) {
if (!event.getApplicationContext().equals(this.context)) {
return;
}
ConditionEvaluationReport report = event.getApplicationContext().getBean(ConditionEvaluationReport.class);
String contextId = event.getApplicationContext().getId();
ConditionEvaluationReport previousReport = previousReports.get(contextId);
if (previousReport != null) {
ConditionEvaluationReport delta = report.getDelta(previousReport);
|
if (!delta.getConditionAndOutcomesBySource().isEmpty() || !delta.getExclusions().isEmpty()
|| !delta.getUnconditionalClasses().isEmpty()) {
if (logger.isInfoEnabled()) {
logger.info("Condition evaluation delta:"
+ new ConditionEvaluationReportMessage(delta, "CONDITION EVALUATION DELTA"));
}
}
else {
logger.info("Condition evaluation unchanged");
}
}
Assert.state(contextId != null, "'contextId' must not be null");
previousReports.put(contextId, report);
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) {
this.context = applicationContext;
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-devtools\src\main\java\org\springframework\boot\devtools\autoconfigure\ConditionEvaluationDeltaLoggingListener.java
| 2
|
请完成以下Java代码
|
public long getId() {
return id;
}
public String getName() {
return name;
}
public String getAuthor() {
return author;
}
public void setId(long id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
|
}
public void setAuthor(String author) {
this.author = author;
}
@Override
public String toString() {
return "Course [id=" + id + ", name=" + name + ", author=" + author + "]";
}
// constructor
// getters
// toString
}
|
repos\master-spring-and-spring-boot-main\03-jpa-getting-started\src\main\java\com\in28minutes\springboot\learnjpaandhibernate\course\Course.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public SqlSessionFactory sqlSessionFactoryBean(DataSource dataSource) throws Exception {
SqlSessionFactoryBean factory = new SqlSessionFactoryBean();
factory.setDataSource(dataSource);
factory.setTypeAliasesPackage(MODEL_PACKAGE);
//配置分页插件,详情请查阅官方文档
PageHelper pageHelper = new PageHelper();
Properties properties = new Properties();
properties.setProperty("pageSizeZero", "true");//分页尺寸为0时查询所有纪录不再执行分页
properties.setProperty("reasonable", "true");//页码<=0 查询第一页,页码>=总页数查询最后一页
properties.setProperty("supportMethodsArguments", "true");//支持通过 Mapper 接口参数来传递分页参数
pageHelper.setProperties(properties);
//添加插件
factory.setPlugins(new Interceptor[]{pageHelper});
//添加XML目录
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
factory.setMapperLocations(resolver.getResources("classpath:mapper/*.xml"));
return factory.getObject();
}
|
@Bean
public MapperScannerConfigurer mapperScannerConfigurer() {
MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactoryBean");
mapperScannerConfigurer.setBasePackage(MAPPER_PACKAGE);
//配置通用Mapper,详情请查阅官方文档
Properties properties = new Properties();
properties.setProperty("mappers", MAPPER_INTERFACE_REFERENCE);
properties.setProperty("notEmpty", "false");//insert、update是否判断字符串类型!='' 即 test="str != null"表达式内是否追加 and str != ''
properties.setProperty("IDENTITY", "MYSQL");
mapperScannerConfigurer.setProperties(properties);
return mapperScannerConfigurer;
}
}
|
repos\spring-boot-api-project-seed-master\src\main\java\com\company\project\configurer\MybatisConfigurer.java
| 2
|
请完成以下Java代码
|
public java.lang.String getMSGRAPH_ClientId()
{
return get_ValueAsString(COLUMNNAME_MSGRAPH_ClientId);
}
@Override
public void setMSGRAPH_ClientSecret (final @Nullable java.lang.String MSGRAPH_ClientSecret)
{
set_Value (COLUMNNAME_MSGRAPH_ClientSecret, MSGRAPH_ClientSecret);
}
@Override
public java.lang.String getMSGRAPH_ClientSecret()
{
return get_ValueAsString(COLUMNNAME_MSGRAPH_ClientSecret);
}
@Override
public void setMSGRAPH_TenantId (final @Nullable java.lang.String MSGRAPH_TenantId)
{
set_Value (COLUMNNAME_MSGRAPH_TenantId, MSGRAPH_TenantId);
}
@Override
public java.lang.String getMSGRAPH_TenantId()
{
return get_ValueAsString(COLUMNNAME_MSGRAPH_TenantId);
}
@Override
public void setPassword (final @Nullable java.lang.String Password)
{
set_Value (COLUMNNAME_Password, Password);
}
@Override
public java.lang.String getPassword()
{
return get_ValueAsString(COLUMNNAME_Password);
}
@Override
public void setSMTPHost (final @Nullable java.lang.String SMTPHost)
{
set_Value (COLUMNNAME_SMTPHost, SMTPHost);
}
@Override
public java.lang.String getSMTPHost()
{
return get_ValueAsString(COLUMNNAME_SMTPHost);
}
@Override
public void setSMTPPort (final int SMTPPort)
{
set_Value (COLUMNNAME_SMTPPort, SMTPPort);
}
|
@Override
public int getSMTPPort()
{
return get_ValueAsInt(COLUMNNAME_SMTPPort);
}
/**
* Type AD_Reference_ID=541904
* Reference name: AD_MailBox_Type
*/
public static final int TYPE_AD_Reference_ID=541904;
/** SMTP = smtp */
public static final String TYPE_SMTP = "smtp";
/** MSGraph = msgraph */
public static final String TYPE_MSGraph = "msgraph";
@Override
public void setType (final java.lang.String Type)
{
set_Value (COLUMNNAME_Type, Type);
}
@Override
public java.lang.String getType()
{
return get_ValueAsString(COLUMNNAME_Type);
}
@Override
public void setUserName (final @Nullable java.lang.String UserName)
{
set_Value (COLUMNNAME_UserName, UserName);
}
@Override
public java.lang.String getUserName()
{
return get_ValueAsString(COLUMNNAME_UserName);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_MailBox.java
| 1
|
请完成以下Java代码
|
public class OrderUpdatesQuery {
private final String orderId;
public OrderUpdatesQuery(String orderId) {
this.orderId = orderId;
}
public String getOrderId() {
return orderId;
}
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
|
}
OrderUpdatesQuery that = (OrderUpdatesQuery) o;
return Objects.equals(orderId, that.orderId);
}
@Override
public int hashCode() {
return Objects.hash(orderId);
}
@Override
public String toString() {
return "OrderUpdatesQuery{" + "orderId='" + orderId + '\'' + '}';
}
}
|
repos\tutorials-master\patterns-modules\axon\src\main\java\com\baeldung\axon\coreapi\queries\OrderUpdatesQuery.java
| 1
|
请完成以下Java代码
|
public void onSuspension(CmmnActivityExecution execution) {
ensureTransitionAllowed(execution, AVAILABLE, SUSPENDED, "suspend");
performSuspension(execution);
}
public void onParentSuspension(CmmnActivityExecution execution) {
throw createIllegalStateTransitionException("parentSuspend", execution);
}
// resume ////////////////////////////////////////////////////////////////
public void onResume(CmmnActivityExecution execution) {
ensureTransitionAllowed(execution, SUSPENDED, AVAILABLE, "resume");
CmmnActivityExecution parent = execution.getParent();
if (parent != null) {
if (!parent.isActive()) {
String id = execution.getId();
throw LOG.resumeInactiveCaseException("resume", id);
}
}
resuming(execution);
}
public void onParentResume(CmmnActivityExecution execution) {
throw createIllegalStateTransitionException("parentResume", execution);
}
|
// re-activation ////////////////////////////////////////////////////////
public void onReactivation(CmmnActivityExecution execution) {
throw createIllegalStateTransitionException("reactivate", execution);
}
// sentry ///////////////////////////////////////////////////////////////
protected boolean isAtLeastOneExitCriterionSatisfied(CmmnActivityExecution execution) {
return false;
}
public void fireExitCriteria(CmmnActivityExecution execution) {
throw LOG.criteriaNotAllowedForEventListenerOrMilestonesException("exit", execution.getId());
}
// helper ////////////////////////////////////////////////////////////////
protected CaseIllegalStateTransitionException createIllegalStateTransitionException(String transition, CmmnActivityExecution execution) {
String id = execution.getId();
return LOG.illegalStateTransitionException(transition, id, getTypeName());
}
protected abstract String getTypeName();
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmmn\behavior\EventListenerOrMilestoneActivityBehavior.java
| 1
|
请完成以下Java代码
|
private final void assertNotBuilt()
{
Check.assume(!_built, "not already built");
}
private final void markAsBuild()
{
assertNotBuilt();
_built = true;
}
public OrderCheckupBuilder setC_Order(final I_C_Order order)
{
assertNotBuilt();
Check.assumeNotNull(order, "order not null");
this._order = order;
return this;
}
private final I_C_Order getC_Order()
{
Check.assumeNotNull(_order, "_order not null");
return _order;
}
public OrderCheckupBuilder addOrderLine(@NonNull final I_C_OrderLine orderLine)
{
assertNotBuilt();
Check.assume(getC_Order().getC_Order_ID() == orderLine.getC_Order_ID(), "order line shall be part of provided order");
_orderLines.add(orderLine);
return this;
}
private final List<I_C_OrderLine> getOrderLines()
{
return _orderLines;
}
public OrderCheckupBuilder setWarehouseId(@Nullable final WarehouseId warehouseId)
{
this._warehouseId = warehouseId;
return this;
}
private WarehouseId getWarehouseId()
{
return _warehouseId;
}
|
public OrderCheckupBuilder setPlantId(ResourceId plantId)
{
this._plantId = plantId;
return this;
}
private ResourceId getPlantId()
{
return _plantId;
}
public OrderCheckupBuilder setReponsibleUserId(UserId reponsibleUserId)
{
this._reponsibleUserId = reponsibleUserId;
return this;
}
private UserId getReponsibleUserId()
{
return _reponsibleUserId;
}
public OrderCheckupBuilder setDocumentType(String documentType)
{
this._documentType = documentType;
return this;
}
private String getDocumentType()
{
Check.assumeNotEmpty(_documentType, "documentType not empty");
return _documentType;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.fresh\de.metas.fresh.base\src\main\java\de\metas\fresh\ordercheckup\impl\OrderCheckupBuilder.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
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代码
|
public Date getTokenDate() {
return tokenDate;
}
@Override
public void setTokenDate(Date tokenDate) {
this.tokenDate = tokenDate;
}
@Override
public String getIpAddress() {
return ipAddress;
}
@Override
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
@Override
public String getUserAgent() {
return userAgent;
}
@Override
public void setUserAgent(String userAgent) {
this.userAgent = userAgent;
}
@Override
public String getUserId() {
return userId;
}
@Override
public void setUserId(String userId) {
this.userId = userId;
|
}
@Override
public String getTokenData() {
return tokenData;
}
@Override
public void setTokenData(String tokenData) {
this.tokenData = tokenData;
}
@Override
public Object getPersistentState() {
Map<String, Object> persistentState = new HashMap<>();
persistentState.put("tokenValue", tokenValue);
persistentState.put("tokenDate", tokenDate);
persistentState.put("ipAddress", ipAddress);
persistentState.put("userAgent", userAgent);
persistentState.put("userId", userId);
persistentState.put("tokenData", tokenData);
return persistentState;
}
// common methods //////////////////////////////////////////////////////////
@Override
public String toString() {
return "TokenEntity[tokenValue=" + tokenValue + ", userId=" + userId + "]";
}
}
|
repos\flowable-engine-main\modules\flowable-idm-engine\src\main\java\org\flowable\idm\engine\impl\persistence\entity\TokenEntityImpl.java
| 1
|
请完成以下Java代码
|
public void onChange(final POSOrder posOrder)
{
send(
POSWebsocketTopicNames.orders(posOrder.getPosTerminalId()),
JsonPOSOrderChangedWebSocketEvent.builder()
.posOrder(toJson(posOrder))
.build()
);
}
private JsonPOSOrder toJson(final POSOrder posOrder)
{
return JsonPOSOrder.from(posOrder, this::getCurrencySymbolById);
}
private String getCurrencySymbolById(final CurrencyId currencyId)
|
{
return currencyRepository.getById(currencyId).getSymbol().getDefaultValue();
}
private void send(final WebsocketTopicName destination, final Object event)
{
if (websocketSender == null)
{
// shall not happen because we shall not change data that trigger WS events in instances where WS is not available (like Swing).
logger.info("Skip sending event to WS `{}` because websocket infrastructure is not available: {}", destination, event);
return;
}
websocketSender.convertAndSend(destination, event);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.pos.rest-api\src\main\java\de\metas\pos\websocket\POSOrderWebsocketEventsDispatcher.java
| 1
|
请完成以下Java代码
|
public final class AttachmentEntryDataResource extends AbstractResource
{
private final byte[] source;
private final String filename;
private final String description;
@Builder
private AttachmentEntryDataResource(
@Nullable final byte[] source,
@NonNull final String filename,
@Nullable final String description)
{
this.source = source != null ? source : new byte[] {};
this.filename = filename;
this.description = description;
}
@Override
public String toString()
{
return MoreObjects.toStringHelper(this)
.omitNullValues()
.add("filename", filename)
.add("description", description)
.add("contentLength", source.length)
.toString();
}
@Override
public int hashCode()
{
return 1;
}
@Override
public boolean equals(final Object other)
{
if (other instanceof AttachmentEntryDataResource)
{
return Arrays.equals(source, ((AttachmentEntryDataResource)other).source);
}
else
{
return false;
}
}
|
@Override
@NonNull
public String getFilename()
{
return filename;
}
@Override
public String getDescription()
{
return description;
}
@Override
public long contentLength()
{
return source.length;
}
@Override
public InputStream getInputStream()
{
return new ByteArrayInputStream(source);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\attachments\AttachmentEntryDataResource.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class InventoryWFProcessStartParams
{
@NonNull InventoryId inventoryId;
private static final String PARAM_inventoryId = "inventoryId";
public Params toParams()
{
return Params.builder()
.value(PARAM_inventoryId, inventoryId.getRepoId())
.build();
}
public static InventoryWFProcessStartParams ofParams(final Params params)
{
try
{
return builder()
|
.inventoryId(params.getParameterAsIdNotNull(PARAM_inventoryId, InventoryId.class))
.build();
}
catch (Exception ex)
{
throw new AdempiereException("Invalid params: " + params, ex);
}
}
public static InventoryWFProcessStartParams of(@NonNull final InventoryJobReference jobRef)
{
return builder()
.inventoryId(jobRef.getInventoryId())
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.inventory.mobileui\src\main\java\de\metas\inventory\mobileui\launchers\InventoryWFProcessStartParams.java
| 2
|
请完成以下Java代码
|
public ActivitiEventType getType() {
return type;
}
public void setType(ActivitiEventType type) {
this.type = type;
}
public String getExecutionId() {
return executionId;
}
public void setExecutionId(String executionId) {
this.executionId = executionId;
}
public String getProcessDefinitionId() {
return processDefinitionId;
}
public void setProcessDefinitionId(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
}
public String getProcessInstanceId() {
return processInstanceId;
|
}
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
@Override
public String toString() {
return getClass() + " - " + type;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public String getActor() {
return actor;
}
public void setActor(String actor) {
this.actor = actor;
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\delegate\event\impl\ActivitiEventImpl.java
| 1
|
请完成以下Java代码
|
public boolean isNegateQtyInReport()
{
return negateQtyInReport;
}
@Override
public void setNegateQtyInReport(final boolean negateQtyInReport)
{
this.negateQtyInReport = negateQtyInReport;
}
@Override
public String getComponentType()
{
return componentType;
}
@Override
public void setComponentType(final String componentType)
{
this.componentType = componentType;
}
@Override
public String getVariantGroup()
{
return variantGroup;
}
@Override
public void setVariantGroup(final String variantGroup)
{
this.variantGroup = variantGroup;
}
@Override
public IHandlingUnitsInfo getHandlingUnitsInfo()
{
return handlingUnitsInfo;
}
|
@Override
public void setHandlingUnitsInfo(final IHandlingUnitsInfo handlingUnitsInfo)
{
this.handlingUnitsInfo = handlingUnitsInfo;
}
@Override
public void setHandlingUnitsInfoProjected(final IHandlingUnitsInfo handlingUnitsInfo)
{
handlingUnitsInfoProjected = handlingUnitsInfo;
}
@Override
public IHandlingUnitsInfo getHandlingUnitsInfoProjected()
{
return handlingUnitsInfoProjected;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java\de\metas\materialtracking\qualityBasedInvoicing\impl\QualityInspectionLine.java
| 1
|
请完成以下Java代码
|
public class TimerStartEventJobHandler extends TimerEventJobHandler {
private final static JobExecutorLogger LOG = ProcessEngineLogger.JOB_EXECUTOR_LOGGER;
public static final String TYPE = "timer-start-event";
public String getType() {
return TYPE;
}
public void execute(TimerJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) {
DeploymentCache deploymentCache = Context
.getProcessEngineConfiguration()
.getDeploymentCache();
String definitionKey = configuration.getTimerElementKey();
ProcessDefinition processDefinition = deploymentCache.findDeployedLatestProcessDefinitionByKeyAndTenantId(definitionKey, tenantId);
try {
startProcessInstance(commandContext, tenantId, processDefinition);
}
catch (RuntimeException e) {
|
throw e;
}
}
protected void startProcessInstance(CommandContext commandContext, String tenantId, ProcessDefinition processDefinition) {
if(!processDefinition.isSuspended()) {
RuntimeService runtimeService = commandContext.getProcessEngineConfiguration().getRuntimeService();
runtimeService.createProcessInstanceByKey(processDefinition.getKey()).processDefinitionTenantId(tenantId).execute();
} else {
LOG.ignoringSuspendedJob(processDefinition);
}
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\jobexecutor\TimerStartEventJobHandler.java
| 1
|
请完成以下Java代码
|
public boolean offer(E e) {
if (e == null) {
throw new NullPointerException("Queue doesn't allow nulls");
}
if (count == items.length) {
this.poll();
}
this.items[count] = e;
count++;
return true;
}
@Override
public E poll() {
if (count <= 0) {
return null;
}
E item = (E) items[0];
shiftLeft();
count--;
return item;
}
private void shiftLeft() {
int i = 1;
while (i < items.length) {
if (items[i] == null) {
break;
}
items[i - 1] = items[i];
i++;
}
}
@Override
public E peek() {
if (count <= 0) {
return null;
|
}
return (E) items[0];
}
@Override
public int size() {
return count;
}
@Override
public Iterator<E> iterator() {
List<E> list = new ArrayList<>(count);
for (int i = 0; i < count; i++) {
list.add((E) items[i]);
}
return list.iterator();
}
}
|
repos\tutorials-master\core-java-modules\core-java-collections-4\src\main\java\com\baeldung\collections\fixedsizequeues\FifoFixedSizeQueue.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Collection<String> getIncludeProcessVariablesNames() {
return includeProcessVariablesNames;
}
public void setIncludeProcessVariablesNames(Collection<String> includeProcessVariablesNames) {
this.includeProcessVariablesNames = includeProcessVariablesNames;
}
@JsonTypeInfo(use = Id.CLASS, defaultImpl = QueryVariable.class)
public List<QueryVariable> getVariables() {
return variables;
}
public void setVariables(List<QueryVariable> variables) {
this.variables = variables;
}
public String getCallbackId() {
return callbackId;
}
public void setCallbackId(String callbackId) {
this.callbackId = callbackId;
}
public String getCallbackType() {
return callbackType;
}
public void setCallbackType(String callbackType) {
this.callbackType = callbackType;
}
public String getParentCaseInstanceId() {
return parentCaseInstanceId;
}
public void setParentCaseInstanceId(String parentCaseInstanceId) {
this.parentCaseInstanceId = parentCaseInstanceId;
}
public Boolean getWithoutCallbackId() {
return withoutCallbackId;
}
public void setWithoutCallbackId(Boolean withoutCallbackId) {
this.withoutCallbackId = withoutCallbackId;
}
public String getTenantId() {
return tenantId;
}
|
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public String getTenantIdLike() {
return tenantIdLike;
}
public void setTenantIdLike(String tenantIdLike) {
this.tenantIdLike = tenantIdLike;
}
public String getTenantIdLikeIgnoreCase() {
return tenantIdLikeIgnoreCase;
}
public void setTenantIdLikeIgnoreCase(String tenantIdLikeIgnoreCase) {
this.tenantIdLikeIgnoreCase = tenantIdLikeIgnoreCase;
}
public Boolean getWithoutTenantId() {
return withoutTenantId;
}
public void setWithoutTenantId(Boolean withoutTenantId) {
this.withoutTenantId = withoutTenantId;
}
public String getRootScopeId() {
return rootScopeId;
}
public void setRootScopeId(String rootScopeId) {
this.rootScopeId = rootScopeId;
}
public String getParentScopeId() {
return parentScopeId;
}
public void setParentScopeId(String parentScopeId) {
this.parentScopeId = parentScopeId;
}
public Set<String> getCallbackIds() {
return callbackIds;
}
public void setCallbackIds(Set<String> callbackIds) {
this.callbackIds = callbackIds;
}
}
|
repos\flowable-engine-main\modules\flowable-rest\src\main\java\org\flowable\rest\service\api\history\HistoricProcessInstanceQueryRequest.java
| 2
|
请完成以下Java代码
|
public static void postOption(String optionStr, String url) throws Exception {
final MediaType TEXT = MediaType.parse("application/text; charset=utf-8");
OkHttpClient client = new OkHttpClient();
RequestBody body = RequestBody.create(TEXT, optionStr);
Request request = new Request.Builder()
.url(url)
.post(body)
.build();
Response response = client.newCall(request).execute();
if (response.isSuccessful()) {
System.out.println(response.body().string());
} else {
throw new IOException("Unexpected code " + response);
}
}
public static String generateOption(String titleStr, List<String> objects, List<String> dimensions,
List<List<Double>> allData, String xunit) {
Option option = new Option();
// "title"
Title title = new Title();
title.setText(titleStr);
// "tooltip"
Tooltip tooltip = new Tooltip("axis", new AxisPointer("shadow"));
// "legend"
Legend legend = new Legend(objects);
// "grid"
Grid grid = new Grid(100);
// "toolbox"
Toolbox toolbox = new Toolbox(false, new Feature(new SaveAsImage("png")));
// "xAxis"
XAxis xAxis = new XAxis("value", xunit);
// "yAxis"
YAxis yAxis = new YAxis("category", false, dimensions, new YAxisLabel(20));
// "series"
List<Serie> series = new ArrayList<>();
for (int i = 0; i < allData.size(); i++) {
Serie serie = new Serie();
serie.setName(objects.get(i));
serie.setType("bar");
serie.setLabel(new Label(new Normal(true, 2)));
|
serie.setData(allData.get(i));
series.add(serie);
}
// 开始设置option
option.setTitle(title);
option.setTooltip(tooltip);
option.setLegend(legend);
option.setGrid(grid);
option.setToolbox(toolbox);
option.setxAxis(xAxis);
option.setyAxis(yAxis);
option.setSeries(series);
String jsonString = null;
try {
jsonString = new ObjectMapper().writeValueAsString(option);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return jsonString;
}
}
|
repos\SpringBootBucket-master\springboot-echarts\src\main\java\com\xncoding\echarts\common\util\ExportPngUtil.java
| 1
|
请完成以下Java代码
|
public Mono<ResponseEntity<Void>> unregister(@PathVariable String id) {
LOGGER.debug("Unregister instance with ID '{}'", id);
return registry.deregister(InstanceId.of(id))
.map((v) -> ResponseEntity.noContent().<Void>build())
.defaultIfEmpty(ResponseEntity.notFound().build());
}
/**
* Retrieve all instance events as a JSON array. Returns all events for all registered
* instances. Useful for reconstructing application state or initializing the UI.
* @return flux of {@link InstanceEvent} objects
*/
@GetMapping(path = "/instances/events", produces = MediaType.APPLICATION_JSON_VALUE)
public Flux<InstanceEvent> events() {
return eventStore.findAll();
}
/**
* Stream all instance events as Server-Sent Events (SSE). Returns a continuous stream
* of instance events for real-time monitoring and UI updates.
* @return flux of {@link ServerSentEvent} containing {@link InstanceEvent}
*/
@GetMapping(path = "/instances/events", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
public Flux<ServerSentEvent<InstanceEvent>> eventStream() {
return Flux.from(eventStore).map((event) -> ServerSentEvent.builder(event).build()).mergeWith(ping());
}
/**
* Stream events for a specific instance as Server-Sent Events (SSE). Streams events
* for the instance identified by its ID. Each event is delivered as an SSE message.
* @param id the instance ID
* @return flux of {@link ServerSentEvent} containing {@link Instance}
*/
@GetMapping(path = "/instances/{id}", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
public Flux<ServerSentEvent<Instance>> instanceStream(@PathVariable String id) {
return Flux.from(eventStore)
.filter((event) -> event.getInstance().equals(InstanceId.of(id)))
.flatMap((event) -> registry.getInstance(event.getInstance()))
.map((event) -> ServerSentEvent.builder(event).build())
.mergeWith(ping());
}
/**
* Returns a periodic Server-Sent Event (SSE) comment-only ping every 10 seconds.
* <p>
* This method is used to keep SSE connections alive for all event stream endpoints in
|
* Spring Boot Admin. The ping event is sent as a comment (": ping") and does not
* contain any data payload. <br>
* <b>Why?</b> Many proxies, firewalls, and browsers may close idle HTTP connections.
* The ping event provides regular activity on the stream, ensuring the connection
* remains open even when no instance events are emitted. <br>
* <b>Technical details:</b>
* <ul>
* <li>Interval: 10 seconds</li>
* <li>Format: SSE comment-only event</li>
* <li>Applies to: All event stream endpoints (e.g., /instances/events,
* /instances/{id} with Accept: text/event-stream)</li>
* </ul>
* </p>
* @param <T> the type of event data (unused for ping)
* @return flux of ServerSentEvent representing periodic ping comments
*/
@SuppressWarnings("unchecked")
private static <T> Flux<ServerSentEvent<T>> ping() {
return (Flux<ServerSentEvent<T>>) (Flux) PING_FLUX;
}
}
|
repos\spring-boot-admin-master\spring-boot-admin-server\src\main\java\de\codecentric\boot\admin\server\web\InstancesController.java
| 1
|
请完成以下Java代码
|
final T getAttribute(MethodInvocation mi) {
Method method = mi.getMethod();
Object target = mi.getThis();
Class<?> targetClass = (target != null) ? target.getClass() : null;
return getAttribute(method, targetClass);
}
/**
* Returns an {@link ExpressionAttribute} for the method and the target class.
* @param method the method
* @param targetClass the target class
* @return the {@link ExpressionAttribute} to use
*/
final T getAttribute(Method method, @Nullable Class<?> targetClass) {
MethodClassKey cacheKey = new MethodClassKey(method, targetClass);
return this.cachedAttributes.computeIfAbsent(cacheKey, (k) -> resolveAttribute(method, targetClass));
}
/**
* Returns the {@link MethodSecurityExpressionHandler}.
* @return the {@link MethodSecurityExpressionHandler} to use
*/
MethodSecurityExpressionHandler getExpressionHandler() {
return this.expressionHandler;
}
void setExpressionHandler(MethodSecurityExpressionHandler expressionHandler) {
Assert.notNull(expressionHandler, "expressionHandler cannot be null");
this.expressionHandler = expressionHandler;
|
}
abstract void setTemplateDefaults(AnnotationTemplateExpressionDefaults adapter);
/**
* Subclasses should implement this method to provide the non-null
* {@link ExpressionAttribute} for the method and the target class.
* @param method the method
* @param targetClass the target class
* @return {@link ExpressionAttribute} or null if not found.
*/
abstract @Nullable T resolveAttribute(Method method, @Nullable Class<?> targetClass);
Class<?> targetClass(Method method, @Nullable Class<?> targetClass) {
return (targetClass != null) ? targetClass : method.getDeclaringClass();
}
}
|
repos\spring-security-main\core\src\main\java\org\springframework\security\authorization\method\AbstractExpressionAttributeRegistry.java
| 1
|
请完成以下Java代码
|
public void dispose()
{
final ProcessPanel panel = this.panel;
if (panel != null)
{
panel.dispose();
}
super.dispose();
if (windowNoCreatedHere != null)
{
Env.clearWinContext(windowNoCreatedHere);
}
}
@Override
public void setVisible(boolean visible)
{
super.setVisible(visible);
final ProcessPanel panel = this.panel;
if (panel != null)
{
panel.setVisible(visible);
}
}
@Override
public void enableWindowEvents(final long eventsToEnable)
{
enableEvents(eventsToEnable);
}
@Override
|
public Window asAWTWindow()
{
return this;
}
public boolean isDisposed()
{
final ProcessPanel panel = this.panel;
return panel == null || panel.isDisposed();
}
@Override
public void showCenterScreen()
{
validate();
pack();
AEnv.showCenterScreen(this);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\de\metas\process\ui\ProcessFrame.java
| 1
|
请完成以下Java代码
|
public class TikaAnalysis {
public static String detectDocTypeUsingDetector(InputStream stream) throws IOException {
Detector detector = new DefaultDetector();
Metadata metadata = new Metadata();
MediaType mediaType = detector.detect(stream, metadata);
return mediaType.toString();
}
public static String detectDocTypeUsingFacade(InputStream stream) throws IOException {
Tika tika = new Tika();
String mediaType = tika.detect(stream);
return mediaType;
}
public static String extractContentUsingParser(InputStream stream) throws IOException, TikaException, SAXException {
Parser parser = new AutoDetectParser();
ContentHandler handler = new BodyContentHandler();
Metadata metadata = new Metadata();
ParseContext context = new ParseContext();
parser.parse(stream, handler, metadata, context);
return handler.toString();
}
public static String extractContentUsingFacade(InputStream stream) throws IOException, TikaException {
Tika tika = new Tika();
String content = tika.parseToString(stream);
return content;
}
public static Metadata extractMetadatatUsingParser(InputStream stream) throws IOException, SAXException, TikaException {
Parser parser = new AutoDetectParser();
ContentHandler handler = new BodyContentHandler();
|
Metadata metadata = new Metadata();
ParseContext context = new ParseContext();
parser.parse(stream, handler, metadata, context);
return metadata;
}
public static Metadata extractMetadatatUsingFacade(InputStream stream) throws IOException, TikaException {
Tika tika = new Tika();
Metadata metadata = new Metadata();
tika.parse(stream, metadata);
return metadata;
}
}
|
repos\springboot-demo-master\tika\src\main\java\com\et\tika\convertor\TikaAnalysis.java
| 1
|
请完成以下Java代码
|
public String getBatchId() {
return null;
}
public String getActivityInstanceId() {
return activityInstanceId;
}
public String getErrorMessage() {
return errorMessage;
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public String getTypeName() {
if(value != null) {
return value.getType().getName();
}
else {
return null;
}
}
public String getName() {
return name;
}
public Object getValue() {
if(value != null) {
return value.getValue();
}
else {
return null;
}
}
public TypedValue getTypedValue() {
return value;
}
public ProcessEngineServices getProcessEngineServices() {
return Context.getProcessEngineConfiguration().getProcessEngine();
}
|
public ProcessEngine getProcessEngine() {
return Context.getProcessEngineConfiguration().getProcessEngine();
}
public static DelegateCaseVariableInstanceImpl fromVariableInstance(VariableInstance variableInstance) {
DelegateCaseVariableInstanceImpl delegateInstance = new DelegateCaseVariableInstanceImpl();
delegateInstance.variableId = variableInstance.getId();
delegateInstance.processDefinitionId = variableInstance.getProcessDefinitionId();
delegateInstance.processInstanceId = variableInstance.getProcessInstanceId();
delegateInstance.executionId = variableInstance.getExecutionId();
delegateInstance.caseExecutionId = variableInstance.getCaseExecutionId();
delegateInstance.caseInstanceId = variableInstance.getCaseInstanceId();
delegateInstance.taskId = variableInstance.getTaskId();
delegateInstance.activityInstanceId = variableInstance.getActivityInstanceId();
delegateInstance.tenantId = variableInstance.getTenantId();
delegateInstance.errorMessage = variableInstance.getErrorMessage();
delegateInstance.name = variableInstance.getName();
delegateInstance.value = variableInstance.getTypedValue();
return delegateInstance;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\variable\listener\DelegateCaseVariableInstanceImpl.java
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.