instruction string | input string | output string | source_file string | priority int64 |
|---|---|---|---|---|
请完成以下Java代码 | public final class InternalName
{
@Nullable public static InternalName ofNullableString(@Nullable final String str)
{
return Check.isEmpty(str, true) ? null : ofString(str);
}
@JsonCreator
public static InternalName ofString(@NonNull final String str)
{
final String strNorm = normalizeString(str);
if (str.isEmpty())
{
throw new AdempiereException("Invalid internal name: " + str);
}
return new InternalName(strNorm);
}
/**
* This is mostly for cypress and also to be in line with the html specification (https://www.w3.org/TR/html50/dom.html#the-id-attribute).
*
* There are some processes (actions) which have space in their #ID.
* On the frontend side: that internalName field is used to create the JSON.
* On the backend side: the process value is used to create the internalName.
*
* The simple solution is to replace spaces with underscores.
*/
@NonNull private static String normalizeString(@NonNull final String str)
{
return str.trim()
.replace(" ", "_");
}
private final String stringValue; | private InternalName(@NonNull final String stringValue)
{
this.stringValue = stringValue;
}
/**
* @deprecated please use {@link #getAsString()}
*/
@Override
@Deprecated
public String toString()
{
return getAsString();
}
@JsonValue
public String getAsString()
{
return stringValue;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\process\descriptor\InternalName.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public Date getTimeStamp() {
return timeStamp;
}
public void setTimeStamp(Date timeStamp) {
this.timeStamp = timeStamp;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public String getExecutionId() {
return executionId;
}
public void setExecutionId(String executionId) {
this.executionId = executionId;
}
public String getProcessInstanceId() {
return processInstanceId;
}
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
public String getProcessDefinitionId() {
return processDefinitionId;
}
public void setProcessDefinitionId(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
}
public String getScopeId() {
return scopeId;
}
public void setScopeId(String scopeId) { | this.scopeId = scopeId;
}
public String getScopeDefinitionId() {
return scopeDefinitionId;
}
public void setScopeDefinitionId(String scopeDefinitionId) {
this.scopeDefinitionId = scopeDefinitionId;
}
public String getSubScopeId() {
return subScopeId;
}
public void setSubScopeId(String subScopeId) {
this.subScopeId = subScopeId;
}
public String getScopeType() {
return scopeType;
}
public void setScopeType(String scopeType) {
this.scopeType = scopeType;
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
} | repos\flowable-engine-main\modules\flowable-rest\src\main\java\org\flowable\rest\service\api\history\HistoricTaskLogEntryResponse.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public void cleanCache() {
initPDFCachePool(CacheService.DEFAULT_PDF_CAPACITY);
initIMGCachePool(CacheService.DEFAULT_IMG_CAPACITY);
initPdfImagesCachePool(CacheService.DEFAULT_PDFIMG_CAPACITY);
initMediaConvertCachePool(CacheService.DEFAULT_MEDIACONVERT_CAPACITY);
}
@Override
public void addQueueTask(String url) {
blockingQueue.add(url);
}
@Override
public String takeQueueTask() throws InterruptedException {
return blockingQueue.take();
}
@Override
public void initPDFCachePool(Integer capacity) {
pdfCache = new ConcurrentLinkedHashMap.Builder<String, String>()
.maximumWeightedCapacity(capacity).weigher(Weighers.singleton())
.build();
}
@Override
public void initIMGCachePool(Integer capacity) {
imgCache = new ConcurrentLinkedHashMap.Builder<String, List<String>>()
.maximumWeightedCapacity(capacity).weigher(Weighers.singleton()) | .build();
}
@Override
public void initPdfImagesCachePool(Integer capacity) {
pdfImagesCache = new ConcurrentLinkedHashMap.Builder<String, Integer>()
.maximumWeightedCapacity(capacity).weigher(Weighers.singleton())
.build();
}
@Override
public void initMediaConvertCachePool(Integer capacity) {
mediaConvertCache = new ConcurrentLinkedHashMap.Builder<String, String>()
.maximumWeightedCapacity(capacity).weigher(Weighers.singleton())
.build();
}
} | repos\kkFileView-master\server\src\main\java\cn\keking\service\cache\impl\CacheServiceJDKImpl.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public int getSUMUP_CardReader_ID()
{
return get_ValueAsInt(COLUMNNAME_SUMUP_CardReader_ID);
}
@Override
public void setSUMUP_Config_ID (final int SUMUP_Config_ID)
{
if (SUMUP_Config_ID < 1)
set_ValueNoCheck (COLUMNNAME_SUMUP_Config_ID, null);
else
set_ValueNoCheck (COLUMNNAME_SUMUP_Config_ID, SUMUP_Config_ID);
}
@Override
public int getSUMUP_Config_ID()
{ | return get_ValueAsInt(COLUMNNAME_SUMUP_Config_ID);
}
@Override
public void setSUMUP_merchant_code (final java.lang.String SUMUP_merchant_code)
{
set_Value (COLUMNNAME_SUMUP_merchant_code, SUMUP_merchant_code);
}
@Override
public java.lang.String getSUMUP_merchant_code()
{
return get_ValueAsString(COLUMNNAME_SUMUP_merchant_code);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.payment.sumup\src\main\java-gen\de\metas\payment\sumup\repository\model\X_SUMUP_Config.java | 2 |
请完成以下Java代码 | public class CaseValidatorImpl implements CaseValidator {
protected List<ValidatorSet> validatorSets = new ArrayList<>();
@Override
public List<ValidationEntry> validate(CmmnModel model) {
List<ValidationEntry> allEntries = new ArrayList<>();
for (ValidatorSet validatorSet : validatorSets) {
CaseValidationContextImpl validationContext = new CaseValidationContextImpl(validatorSet);
for (Validator validator : validatorSet.getValidators()) {
validator.validate(model, validationContext);
} | allEntries.addAll(validationContext.getEntries());
}
return allEntries;
}
@Override
public List<ValidatorSet> getValidatorSets() {
return validatorSets;
}
public void addValidatorSet(ValidatorSet validatorSet) {
this.validatorSets.add(validatorSet);
}
} | repos\flowable-engine-main\modules\flowable-case-validation\src\main\java\org\flowable\cmmn\validation\CaseValidatorImpl.java | 1 |
请完成以下Java代码 | public int getAD_User_SortPref_Line_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_SortPref_Line_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Spaltenname.
@param ColumnName
Name der Spalte in der Datenbank
*/
@Override
public void setColumnName (java.lang.String ColumnName)
{
set_Value (COLUMNNAME_ColumnName, ColumnName);
}
/** Get Spaltenname.
@return Name der Spalte in der Datenbank
*/
@Override
public java.lang.String getColumnName ()
{
return (java.lang.String)get_Value(COLUMNNAME_ColumnName);
}
/** Set Aufsteigender.
@param IsAscending Aufsteigender */
@Override
public void setIsAscending (boolean IsAscending)
{
set_Value (COLUMNNAME_IsAscending, Boolean.valueOf(IsAscending));
}
/** Get Aufsteigender.
@return Aufsteigender */
@Override
public boolean isAscending ()
{
Object oo = get_Value(COLUMNNAME_IsAscending);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue(); | return "Y".equals(oo);
}
return false;
}
/** 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\org\compiere\model\X_AD_User_SortPref_Line.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class UserController {
@ApiIgnore
@GetMapping("hello")
public @ResponseBody String hello() {
return "hello";
}
@ApiOperation(value = "获取用户信息", notes = "根据用户id获取用户信息")
@ApiImplicitParam(name = "id", value = "用户id", required = true, dataType = "Long", paramType = "path")
@GetMapping("/{id}")
public @ResponseBody User getUserById(@PathVariable(value = "id") Long id) {
User user = new User();
user.setId(id);
user.setName("mrbird");
user.setAge(25);
return user;
}
@ApiOperation(value = "获取用户列表", notes = "获取用户列表")
@GetMapping("/list")
public @ResponseBody List<User> getUserList() {
List<User> list = new ArrayList<>();
User user1 = new User();
user1.setId(1l);
user1.setName("mrbird");
user1.setAge(25);
list.add(user1);
User user2 = new User();
user2.setId(2l);
user2.setName("scott");
user2.setAge(29);
list.add(user2); | return list;
}
@ApiOperation(value = "新增用户", notes = "根据用户实体创建用户")
@ApiImplicitParam(name = "user", value = "用户实体", required = true, dataType = "User")
@PostMapping("/add")
public @ResponseBody Map<String, Object> addUser(@RequestBody User user) {
Map<String, Object> map = new HashMap<>();
map.put("result", "success");
return map;
}
@ApiOperation(value = "删除用户", notes = "根据用户id删除用户")
@ApiImplicitParam(name = "id", value = "用户id", required = true, dataType = "Long", paramType = "path")
@DeleteMapping("/{id}")
public @ResponseBody Map<String, Object> deleteUser(@PathVariable(value = "id") Long id) {
Map<String, Object> map = new HashMap<>();
map.put("result", "success");
return map;
}
@ApiOperation(value = "更新用户", notes = "根据用户id更新用户")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "用户id", required = true, dataType = "Long", paramType = "path"),
@ApiImplicitParam(name = "user", value = "用户实体", required = true, dataType = "User") })
@PutMapping("/{id}")
public @ResponseBody Map<String, Object> updateUser(@PathVariable(value = "id") Long id, @RequestBody User user) {
Map<String, Object> map = new HashMap<>();
map.put("result", "success");
return map;
}
} | repos\SpringAll-master\20.Spring-Boot-Swagger2\src\main\java\com\example\demo\controller\UserController.java | 2 |
请完成以下Java代码 | private String convertLessThanOneThousand (int number)
{
int unit = 0;
int tens = 0;
String soFar;
// Sotto 20
if (number % 100 < 20)
{
soFar = numNames[number % 100];
number /= 100;
}
else
{
unit = number % 10;
soFar = numNames[unit];
number /= 10;
//
tens = number % 10;
// Uno e Otto iniziano con una vocale, quindi elido la finale dalle decine es. TRENTAUNO->TRENTUNO
if (unit == 1 || unit == 8)
soFar = tensNames[tens].substring(0, tensNames[tens].length()-1) + soFar;
else
soFar = tensNames[tens] + soFar;
number /= 10;
}
if (number == 0)
return soFar;
// Sopra 200
if (number > 1)
return numNames[number] + "CENTO" + soFar;
// Tra 100 e 199
else
return "CENTO" + soFar;
} // convertLessThanOneThousand
/**
* Convert
* @param number
* @return amt
*/
private String convert (int number)
{
/* special case */
if (number == 0)
return "ZERO";
String prefix = "";
if (number < 0)
{
number = -number;
prefix = "MENO ";
}
String soFar = "";
int place = 0;
do
{
long n = number % 1000;
if (n != 0)
{
String s = convertLessThanOneThousand ((int)n);
if (n == 1) | soFar = majorNames[place] + soFar;
else
soFar = s + majorNamesPlural[place] + soFar;
}
place++;
number /= 1000;
}
while (number > 0);
return (prefix + soFar).trim ();
} // convert
/**************************************************************************
* Get Amount in Words
* @param amount numeric amount (352.80 or 352,80)
* @return amount in words (TRECENTOCINQUANTADUE/80)
* @throws Exception
*/
public String getAmtInWords (String amount) throws Exception
{
if (amount == null)
return amount;
//
StringBuffer sb = new StringBuffer ();
int pos = amount.lastIndexOf (',');
int pos2 = amount.lastIndexOf ('.');
if (pos2 > pos)
pos = pos2;
String oldamt = amount;
amount = amount.replaceAll( "\\.","");
int newpos = amount.lastIndexOf (',');
int amt = Integer.parseInt (amount.substring (0, newpos));
sb.append (convert (amt));
for (int i = 0; i < oldamt.length (); i++)
{
if (pos == i) // we are done
{
String cents = oldamt.substring (i + 1);
sb.append ("/").append (cents);
break;
}
}
return sb.toString ();
} // getAmtInWords
public static void main(String[] args) throws Exception {
AmtInWords_IT aiw = new AmtInWords_IT();
System.out.println(aiw.getAmtInWords("0,00"));
System.out.println(aiw.getAmtInWords("1000,00"));
System.out.println(aiw.getAmtInWords("14000,99"));
System.out.println(aiw.getAmtInWords("28000000,99"));
System.out.println(aiw.getAmtInWords("301000000,00"));
System.out.println(aiw.getAmtInWords("200000,99"));
System.out.println(aiw.getAmtInWords("-1234567890,99"));
System.out.println(aiw.getAmtInWords("2147483647,99"));
}
} // AmtInWords_IT | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\util\AmtInWords_IT.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void moveToNewOrg(@NonNull final OrgChangeRequest request)
{
OrgChangeCommand.builder()
.bpCompositeRepo(bpCompositeRepo)
.orgMappingRepo(orgMappingRepo)
.orgChangeRepo(orgChangeRepo)
.orgChangeHistoryRepo(orgChangeHistoryRepo)
.groupTemplateRepo(groupTemplateRepo)
.request(request)
.build()
.execute();
}
public OrgChangeBPartnerComposite getByIdAndOrgChangeDate(final BPartnerId partnerId, final Instant orgChangeDate)
{
return orgChangeRepo.getByIdAndOrgChangeDate(partnerId, orgChangeDate); | }
public boolean hasAnyMembershipProduct(final OrgId orgId)
{
return orgChangeRepo.hasAnyMembershipProduct(orgId);
}
public boolean isGroupCategoryContainsProductsInTargetOrg(@NonNull final GroupCategoryId groupCategoryId,
@NonNull final OrgId targetOrgId)
{
final Optional<I_M_Product> productOfGroupCategory = productDAO.getProductOfGroupCategory(groupCategoryId, targetOrgId);
return productOfGroupCategory.isPresent();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\bpartner\service\OrgChangeService.java | 2 |
请完成以下Java代码 | public class Pair<T1, T2> implements Comparable, Cloneable, Serializable
{
public T1 first;
public T2 second;
public Pair(T1 first, T2 second)
{
this.first = first;
this.second = second;
}
public void setFirst(T1 first)
{
this.first = first;
}
@Override
public Pair<T1, T2> clone()
{
return new Pair<T1, T2>(first, second);
}
@Override
public boolean equals(Object o)
{
if (!(o instanceof Pair))
return false;
Pair pair = (Pair) o;
if (pair.second == null)
if (second == null)
return pair.first.equals(first);
else
return false;
if (second == null)
return false;
return pair.first.equals(first) && pair.second.equals(second);
}
@Override
public int hashCode() | {
int firstHash = 0;
int secondHash = 0;
if (first != null)
firstHash = first.hashCode();
if (second != null)
secondHash = second.hashCode();
return firstHash + secondHash;
}
@Override
public int compareTo(Object o)
{
if (equals(o))
return 0;
return hashCode() - o.hashCode();
}
} | repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\dependency\perceptron\accessories\Pair.java | 1 |
请完成以下Java代码 | public class ReplicationIssueSolverBL implements IReplicationIssueSolverBL
{
@Override
public IReplicationIssueSolverParams createParams(final Map<String, Object> params)
{
return new ReplicationIssueSolverParams(Params.ofMap(params));
}
@Override
public IReplicationTrxLinesProcessorResult solveReplicationIssues(
final I_EXP_ReplicationTrx rplTrx,
final Class<? extends IReplicationIssueAware> issueAwareType,
final IReplicationIssueSolver<? extends IReplicationIssueAware> issueSolver,
final IReplicationIssueSolverParams params
)
{
final Properties ctx = InterfaceWrapperHelper.getCtx(rplTrx); | final String tableName = InterfaceWrapperHelper.getTableName(issueAwareType);
final Iterator<I_EXP_ReplicationTrxLine> trxLines = Services.get(IReplicationTrxDAO.class)
.retrieveReplicationTrxLines(rplTrx, tableName, X_EXP_ReplicationTrxLine.REPLICATIONTRXSTATUS_NichtVollstaendigImportiert);
final ITrxItemProcessorExecutorService executorService = Services.get(ITrxItemProcessorExecutorService.class);
final ITrxItemProcessorContext processorCtx = executorService.createProcessorContext(ctx, ITrx.TRX_None);
final ReplicationTrxLinesProcessor processor = new ReplicationTrxLinesProcessor();
processor.setParams(params);
processor.setReplicationIssueSolver(issueSolver);
final ITrxItemProcessorExecutor<I_EXP_ReplicationTrxLine, IReplicationTrxLinesProcessorResult> executor = executorService.createExecutor(processorCtx, processor);
final IReplicationTrxLinesProcessorResult result = executor.execute(trxLines);
return result;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\server\rpl\trx\api\impl\ReplicationIssueSolverBL.java | 1 |
请完成以下Java代码 | private IAutoCloseable createContextAndSwitchIfToken(@Nullable final UserAuthToken token)
{
if (token == null)
{
return IAutoCloseable.NOP;
}
else
{
final Properties ctx = createContext(token);
return Env.switchContext(ctx);
}
}
private Properties createContext(final UserAuthToken token)
{
final IUserRolePermissions permissions = userRolePermissionsDAO.getUserRolePermissions(UserRolePermissionsKey.builder()
.userId(token.getUserId())
.roleId(token.getRoleId())
.clientId(token.getClientId())
.date(SystemTime.asDayTimestamp())
.build());
final UserInfo userInfo = getUserInfo(token.getUserId());
final Properties ctx = Env.newTemporaryCtx();
Env.setContext(ctx, Env.CTXNAME_AD_Client_ID, permissions.getClientId().getRepoId());
Env.setContext(ctx, Env.CTXNAME_AD_Org_ID, OrgId.toRepoId(token.getOrgId()));
Env.setContext(ctx, Env.CTXNAME_AD_User_ID, UserId.toRepoId(permissions.getUserId()));
Env.setContext(ctx, Env.CTXNAME_AD_Role_ID, RoleId.toRepoId(permissions.getRoleId()));
Env.setContext(ctx, Env.CTXNAME_AD_Language, userInfo.getAdLanguage());
return ctx;
}
public UserAuthToken getOrCreateNewToken(@NonNull final CreateUserAuthTokenRequest request)
{
return userAuthTokenRepo.getOrCreateNew(request);
} | private UserInfo getUserInfo(@NonNull final UserId userId)
{
return userInfoById.getOrLoad(userId, this::retrieveUserInfo);
}
private UserInfo retrieveUserInfo(@NonNull final UserId userId)
{
final I_AD_User user = userDAO.getById(userId);
return UserInfo.builder()
.userId(userId)
.adLanguage(StringUtils.trimBlankToOptional(user.getAD_Language()).orElseGet(Language::getBaseAD_Language))
.build();
}
//
//
//
@Value
@Builder
private static class UserInfo
{
@NonNull UserId userId;
@NonNull String adLanguage;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.util.web\src\main\java\de\metas\util\web\security\UserAuthTokenService.java | 1 |
请完成以下Java代码 | public ProcessingType getProcessing() {
return processing;
}
/**
* Sets the value of the processing property.
*
* @param value
* allowed object is
* {@link ProcessingType }
*
*/
public void setProcessing(ProcessingType value) {
this.processing = value;
}
/**
* Gets the value of the payload property.
*
* @return
* possible object is
* {@link PayloadType }
*
*/
public PayloadType getPayload() {
return payload;
}
/**
* Sets the value of the payload property.
*
* @param value
* allowed object is
* {@link PayloadType }
*
*/
public void setPayload(PayloadType value) {
this.payload = value;
}
/**
* Gets the value of the signature property.
*
* @return
* possible object is
* {@link SignatureType }
*
*/
public SignatureType getSignature() {
return signature;
}
/**
* Sets the value of the signature property.
*
* @param value
* allowed object is
* {@link SignatureType }
*
*/
public void setSignature(SignatureType value) {
this.signature = value;
}
/**
* Gets the value of the language property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLanguage() {
return language;
}
/**
* Sets the value of the language property.
*
* @param value | * allowed object is
* {@link String }
*
*/
public void setLanguage(String value) {
this.language = value;
}
/**
* Gets the value of the modus property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getModus() {
if (modus == null) {
return "production";
} else {
return modus;
}
}
/**
* Sets the value of the modus property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setModus(String value) {
this.modus = value;
}
/**
* Gets the value of the validationStatus property.
*
* @return
* possible object is
* {@link Long }
*
*/
public Long getValidationStatus() {
return validationStatus;
}
/**
* Sets the value of the validationStatus property.
*
* @param value
* allowed object is
* {@link Long }
*
*/
public void setValidationStatus(Long value) {
this.validationStatus = value;
}
} | repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_440_request\src\main\java-xjc\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_440\request\RequestType.java | 1 |
请完成以下Java代码 | protected void writeUserOperationLog(CommandContext commandContext,
ProcessDefinition processDefinition,
int numInstances,
boolean async,
String annotation) {
List<PropertyChange> propertyChanges = new ArrayList<PropertyChange>();
propertyChanges.add(new PropertyChange("nrOfInstances",
null,
numInstances));
propertyChanges.add(new PropertyChange("async", null, async));
commandContext.getOperationLogManager()
.logProcessInstanceOperation(UserOperationLogEntry.OPERATION_TYPE_MODIFY_PROCESS_INSTANCE,
null, | processDefinition.getId(),
processDefinition.getKey(),
propertyChanges,
annotation);
}
protected ProcessDefinitionEntity getProcessDefinition(CommandContext commandContext, String processDefinitionId) {
return commandContext
.getProcessEngineConfiguration()
.getDeploymentCache()
.findDeployedProcessDefinitionById(processDefinitionId);
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmd\AbstractModificationCmd.java | 1 |
请完成以下Java代码 | public void setBlz(BigInteger blz) {
this.blz = blz;
}
public String getAuftragsreferenzNr() {
return auftragsreferenzNr;
}
public void setAuftragsreferenzNr(String auftragsreferenzNr) {
this.auftragsreferenzNr = auftragsreferenzNr;
}
public String getBezugsrefernznr() {
return bezugsrefernznr;
}
public void setBezugsrefernznr(String bezugsrefernznr) {
this.bezugsrefernznr = bezugsrefernznr;
}
public BigInteger getAuszugsNr() {
return auszugsNr;
}
public void setAuszugsNr(BigInteger auszugsNr) {
this.auszugsNr = auszugsNr;
}
public Saldo getAnfangsSaldo() {
return anfangsSaldo;
}
public void setAnfangsSaldo(Saldo anfangsSaldo) {
this.anfangsSaldo = anfangsSaldo;
}
public Saldo getSchlussSaldo() {
return schlussSaldo;
}
public void setSchlussSaldo(Saldo schlussSaldo) {
this.schlussSaldo = schlussSaldo;
}
public Saldo getAktuellValutenSaldo() {
return aktuellValutenSaldo; | }
public void setAktuellValutenSaldo(Saldo aktuellValutenSaldo) {
this.aktuellValutenSaldo = aktuellValutenSaldo;
}
public Saldo getZukunftValutenSaldo() {
return zukunftValutenSaldo;
}
public void setZukunftValutenSaldo(Saldo zukunftValutenSaldo) {
this.zukunftValutenSaldo = zukunftValutenSaldo;
}
public List<BankstatementLine> getLines() {
return lines;
}
public void setLines(List<BankstatementLine> lines) {
this.lines = lines;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.base\src\main\java\de\schaeffer\compiere\mt940\Bankstatement.java | 1 |
请完成以下Java代码 | class GenericRelatedDocumentsCountSupplier implements RelatedDocumentsCountSupplier
{
private static final Logger logger = LogManager.getLogger(GenericRelatedDocumentsCountSupplier.class);
private final DynamicReferencesCache dynamicReferencesCache;
private final GenericTargetWindowInfo targetWindow;
private final String targetTableName;
private final GenericTargetColumnInfo targetColumn;
private final String sourceTableName;
private final String sqlCount;
GenericRelatedDocumentsCountSupplier(
@NonNull final DynamicReferencesCache dynamicReferencesCache,
@NonNull final GenericTargetWindowInfo targetWindow,
@NonNull final GenericTargetColumnInfo targetColumn,
@NonNull final MQuery query,
@NonNull final String sourceTableName)
{
this.dynamicReferencesCache = dynamicReferencesCache;
this.targetWindow = targetWindow;
this.targetTableName = query.getTableName();
this.targetColumn = targetColumn;
this.sourceTableName = sourceTableName;
this.sqlCount = buildCountSQL(query, targetWindow, sourceTableName);
}
private static String buildCountSQL(
@NonNull final MQuery query,
@NonNull final GenericTargetWindowInfo targetWindow,
@NonNull final String sourceTableName)
{
String sqlCount = "SELECT COUNT(1) FROM " + query.getTableName() + " WHERE " + query.getWhereClause(false);
SOTrx soTrx = targetWindow.getSoTrx();
if (soTrx != null && targetWindow.isTargetHasIsSOTrxColumn())
{
//
// For RMA, Material Receipt window should be loaded for
// IsSOTrx=true and Shipment for IsSOTrx=false
// TODO: fetch the additional SQL from window's first tab where clause
final AdWindowId AD_Window_ID = targetWindow.getTargetWindowId();
if (I_M_RMA.Table_Name.equals(sourceTableName) && (AD_Window_ID.getRepoId() == 169 || AD_Window_ID.getRepoId() == 184))
{
soTrx = soTrx.invert();
} | // TODO: handle the case when IsSOTrx is a virtual column
sqlCount += " AND IsSOTrx=" + DB.TO_BOOLEAN(soTrx.toBoolean());
}
return sqlCount;
}
@Override
public int getRecordsCount(final RelatedDocumentsPermissions permissions)
{
if (targetColumn.isDynamic()
&& dynamicReferencesCache.hasReferences(targetTableName, sourceTableName).isFalse())
{
return 0;
}
try
{
final String sqlCountWithPermissions = permissions.addAccessSQL(sqlCount, targetTableName);
return DB.getSQLValueEx(ITrx.TRXNAME_None, sqlCountWithPermissions);
}
catch (final Exception ex)
{
logger.warn("Failed counting records in {} for {} using SQL: {}", sourceTableName, targetWindow, sqlCount, ex);
return 0;
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\document\references\related_documents\generic\GenericRelatedDocumentsCountSupplier.java | 1 |
请完成以下Java代码 | public class DeleteProcessInstancesJobHandler extends AbstractBatchJobHandler<DeleteProcessInstanceBatchConfiguration> {
public static final BatchJobDeclaration JOB_DECLARATION = new BatchJobDeclaration(Batch.TYPE_PROCESS_INSTANCE_DELETION);
@Override
public String getType() {
return Batch.TYPE_PROCESS_INSTANCE_DELETION;
}
protected DeleteProcessInstanceBatchConfigurationJsonConverter getJsonConverterInstance() {
return DeleteProcessInstanceBatchConfigurationJsonConverter.INSTANCE;
}
@Override
public JobDeclaration<BatchJobContext, MessageEntity> getJobDeclaration() {
return JOB_DECLARATION;
}
@Override
protected DeleteProcessInstanceBatchConfiguration createJobConfiguration(DeleteProcessInstanceBatchConfiguration configuration, List<String> processIdsForJob) {
return new DeleteProcessInstanceBatchConfiguration(
processIdsForJob,
null,
configuration.getDeleteReason(),
configuration.isSkipCustomListeners(),
configuration.isSkipSubprocesses(),
configuration.isFailIfNotExists(),
configuration.isSkipIoMappings()
);
}
@Override
public void executeHandler(DeleteProcessInstanceBatchConfiguration batchConfiguration,
ExecutionEntity execution,
CommandContext commandContext,
String tenantId) {
commandContext.executeWithOperationLogPrevented(
new DeleteProcessInstancesCmd(
batchConfiguration.getIds(),
batchConfiguration.getDeleteReason(),
batchConfiguration.isSkipCustomListeners(),
true, | batchConfiguration.isSkipSubprocesses(),
batchConfiguration.isFailIfNotExists(),
batchConfiguration.isSkipIoMappings()
));
}
@Override
protected void createJobEntities(BatchEntity batch, DeleteProcessInstanceBatchConfiguration configuration, String deploymentId, List<String> processIds,
int invocationsPerBatchJob) {
// handle legacy batch entities (no up-front deployment mapping has been done)
if (deploymentId == null && (configuration.getIdMappings() == null || configuration.getIdMappings().isEmpty())) {
// create deployment mappings for the ids to process
BatchElementConfiguration elementConfiguration = new BatchElementConfiguration();
ProcessInstanceQueryImpl query = new ProcessInstanceQueryImpl();
query.processInstanceIds(new HashSet<>(configuration.getIds()));
elementConfiguration.addDeploymentMappings(query.listDeploymentIdMappings(), configuration.getIds());
// create jobs by deployment id
elementConfiguration.getMappings().forEach(mapping -> super.createJobEntities(batch, configuration, mapping.getDeploymentId(),
mapping.getIds(processIds), invocationsPerBatchJob));
} else {
super.createJobEntities(batch, configuration, deploymentId, processIds, invocationsPerBatchJob);
}
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\batch\deletion\DeleteProcessInstancesJobHandler.java | 1 |
请完成以下Java代码 | 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 setIsDefault (final boolean IsDefault)
{
set_Value (COLUMNNAME_IsDefault, IsDefault);
}
@Override
public boolean isDefault() | {
return get_ValueAsBoolean(COLUMNNAME_IsDefault);
}
@Override
public void setDefaultLocation (final @Nullable java.lang.String DefaultLocation)
{
set_Value (COLUMNNAME_DefaultLocation, DefaultLocation);
}
@Override
public java.lang.String getDefaultLocation()
{
return get_ValueAsString(COLUMNNAME_DefaultLocation);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Incoterms.java | 1 |
请完成以下Java代码 | public java.lang.String getDescription()
{
return get_ValueAsString(COLUMNNAME_Description);
}
@Override
public void setName (final java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
@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 setIsDefault (final boolean IsDefault)
{
set_Value (COLUMNNAME_IsDefault, IsDefault);
}
@Override
public boolean isDefault()
{
return get_ValueAsBoolean(COLUMNNAME_IsDefault);
}
@Override
public void setDefaultLocation (final @Nullable java.lang.String DefaultLocation)
{
set_Value (COLUMNNAME_DefaultLocation, DefaultLocation);
}
@Override
public java.lang.String getDefaultLocation()
{
return get_ValueAsString(COLUMNNAME_DefaultLocation);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Incoterms.java | 1 |
请完成以下Java代码 | public LookupValuesList retrieveFieldValue(
@NonNull final ResultSet rs,
final boolean isDisplayColumnAvailable_NOTUSED,
final String adLanguage_NOTUSED,
@Nullable final LookupDescriptor lookupDescriptor) throws SQLException
{
// FIXME: atm we are avoiding NPE by returning EMPTY.
if (lookupDescriptor == null)
{
return LookupValuesList.EMPTY;
}
final LabelsLookup lookup = LabelsLookup.cast(lookupDescriptor);
final List<Object> ids = retrieveIds(rs);
return lookup.retrieveExistingValuesByIds(ids);
}
private List<Object> retrieveIds(final ResultSet rs) throws SQLException
{
final Array sqlArray = rs.getArray(sqlValuesColumn);
if (sqlArray != null)
{
return Stream.of((Object[])sqlArray.getArray())
.filter(Objects::nonNull)
.collect(ImmutableList.toImmutableList());
}
else
{
return ImmutableList.of();
}
}
} | @Builder
@Value
private static class ColorDocumentFieldValueLoader implements DocumentFieldValueLoader
{
@NonNull String sqlColumnName;
@Override
@Nullable
public Object retrieveFieldValue(
@NonNull final ResultSet rs,
final boolean isDisplayColumnAvailable_NOTUSED,
final String adLanguage_NOTUSED,
final LookupDescriptor lookupDescriptor_NOTUSED) throws SQLException
{
final ColorId adColorId = ColorId.ofRepoIdOrNull(rs.getInt(sqlColumnName));
if (adColorId == null)
{
return null;
}
final IColorRepository colorRepository = Services.get(IColorRepository.class);
final MFColor color = colorRepository.getColorById(adColorId);
if (color == null)
{
return null;
}
final Color awtColor = color.toFlatColor().getFlatColor();
return ColorValue.ofRGB(awtColor.getRed(), awtColor.getGreen(), awtColor.getBlue());
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\descriptor\sql\DocumentFieldValueLoaders.java | 1 |
请完成以下Java代码 | public boolean isProcessDefinitionWithoutTenantId() {
return isProcessDefinitionWithoutTenantId;
}
public boolean isLeafProcessInstances() {
return isLeafProcessInstances;
}
public String[] getTenantIds() {
return tenantIds;
}
@Override
public ProcessInstanceQuery or() {
if (this != queries.get(0)) {
throw new ProcessEngineException("Invalid query usage: cannot set or() within 'or' query");
}
ProcessInstanceQueryImpl orQuery = new ProcessInstanceQueryImpl(); | orQuery.isOrQueryActive = true;
orQuery.queries = queries;
queries.add(orQuery);
return orQuery;
}
@Override
public ProcessInstanceQuery endOr() {
if (!queries.isEmpty() && this != queries.get(queries.size()-1)) {
throw new ProcessEngineException("Invalid query usage: cannot set endOr() before or()");
}
return queries.get(0);
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\ProcessInstanceQueryImpl.java | 1 |
请完成以下Java代码 | public void init(TbContext ctx, TbNodeConfiguration configuration) throws TbNodeException {
config = TbNodeUtils.convert(configuration, TbMsgToEmailNodeConfiguration.class);
dynamicMailBodyType = DYNAMIC.equals(config.getMailBodyType());
}
@Override
public void onMsg(TbContext ctx, TbMsg msg) {
TbEmail email = convert(msg);
TbMsg emailMsg = buildEmailMsg(ctx, msg, email);
ctx.tellNext(emailMsg, TbNodeConnectionType.SUCCESS);
}
private TbMsg buildEmailMsg(TbContext ctx, TbMsg msg, TbEmail email) {
String emailJson = JacksonUtil.toString(email);
return ctx.transformMsg(msg, TbMsgType.SEND_EMAIL, msg.getOriginator(), msg.getMetaData().copy(), emailJson);
}
private TbEmail convert(TbMsg msg) {
TbEmail.TbEmailBuilder builder = TbEmail.builder();
builder.from(fromTemplate(config.getFromTemplate(), msg));
builder.to(fromTemplate(config.getToTemplate(), msg));
builder.cc(fromTemplate(config.getCcTemplate(), msg));
builder.bcc(fromTemplate(config.getBccTemplate(), msg)); | String htmlStr = dynamicMailBodyType ?
fromTemplate(config.getIsHtmlTemplate(), msg) : config.getMailBodyType();
builder.html(Boolean.parseBoolean(htmlStr));
builder.subject(fromTemplate(config.getSubjectTemplate(), msg));
builder.body(fromTemplate(config.getBodyTemplate(), msg));
String imagesStr = msg.getMetaData().getValue(IMAGES);
if (!StringUtils.isEmpty(imagesStr)) {
Map<String, String> imgMap = JacksonUtil.fromString(imagesStr, new TypeReference<HashMap<String, String>>() {});
builder.images(imgMap);
}
return builder.build();
}
private String fromTemplate(String template, TbMsg msg) {
return StringUtils.isNotEmpty(template) ? TbNodeUtils.processPattern(template, msg) : null;
}
} | repos\thingsboard-master\rule-engine\rule-engine-components\src\main\java\org\thingsboard\rule\engine\mail\TbMsgToEmailNode.java | 1 |
请完成以下Java代码 | public class TinylogExamples {
public static void main(String[] args) {
/* Static text */
Logger.info("Hello World!");
/* Placeholders */
Logger.info("Hello {}!", "Alice");
Logger.info("π = {0.00}", Math.PI);
/* Lazy Logging */
Logger.debug("Expensive computation: {}", () -> compute()); // Visible in log files but not on the console
/* Exceptions */
int a = 42;
int b = 0; | try {
int i = a / b;
} catch (Exception ex) {
Logger.error(ex, "Cannot divide {} by {}", a, b);
}
try {
int i = a / b;
} catch (Exception ex) {
Logger.error(ex);
}
}
private static int compute() {
return 42; // In real applications, we would perform an expensive computation here
}
} | repos\tutorials-master\logging-modules\tinylog2\src\main\java\com\baeldung\tinylog\TinylogExamples.java | 1 |
请完成以下Java代码 | public int getPP_Order_ID()
{
return get_ValueAsInt(COLUMNNAME_PP_Order_ID);
}
@Override
public void setQty (final BigDecimal Qty)
{
set_ValueNoCheck (COLUMNNAME_Qty, Qty);
}
@Override
public BigDecimal getQty()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public de.metas.handlingunits.model.I_M_HU getVHU()
{
return get_ValueAsPO(COLUMNNAME_VHU_ID, de.metas.handlingunits.model.I_M_HU.class);
}
@Override
public void setVHU(final de.metas.handlingunits.model.I_M_HU VHU)
{
set_ValueFromPO(COLUMNNAME_VHU_ID, de.metas.handlingunits.model.I_M_HU.class, VHU);
}
@Override
public void setVHU_ID (final int VHU_ID)
{
if (VHU_ID < 1)
set_ValueNoCheck (COLUMNNAME_VHU_ID, null);
else
set_ValueNoCheck (COLUMNNAME_VHU_ID, VHU_ID);
}
@Override
public int getVHU_ID()
{
return get_ValueAsInt(COLUMNNAME_VHU_ID);
}
@Override
public de.metas.handlingunits.model.I_M_HU getVHU_Source()
{
return get_ValueAsPO(COLUMNNAME_VHU_Source_ID, de.metas.handlingunits.model.I_M_HU.class);
}
@Override
public void setVHU_Source(final de.metas.handlingunits.model.I_M_HU VHU_Source) | {
set_ValueFromPO(COLUMNNAME_VHU_Source_ID, de.metas.handlingunits.model.I_M_HU.class, VHU_Source);
}
@Override
public void setVHU_Source_ID (final int VHU_Source_ID)
{
if (VHU_Source_ID < 1)
set_Value (COLUMNNAME_VHU_Source_ID, null);
else
set_Value (COLUMNNAME_VHU_Source_ID, VHU_Source_ID);
}
@Override
public int getVHU_Source_ID()
{
return get_ValueAsInt(COLUMNNAME_VHU_Source_ID);
}
/**
* VHUStatus AD_Reference_ID=540478
* Reference name: HUStatus
*/
public static final int VHUSTATUS_AD_Reference_ID=540478;
/** Planning = P */
public static final String VHUSTATUS_Planning = "P";
/** Active = A */
public static final String VHUSTATUS_Active = "A";
/** Destroyed = D */
public static final String VHUSTATUS_Destroyed = "D";
/** Picked = S */
public static final String VHUSTATUS_Picked = "S";
/** Shipped = E */
public static final String VHUSTATUS_Shipped = "E";
/** Issued = I */
public static final String VHUSTATUS_Issued = "I";
@Override
public void setVHUStatus (final java.lang.String VHUStatus)
{
set_ValueNoCheck (COLUMNNAME_VHUStatus, VHUStatus);
}
@Override
public java.lang.String getVHUStatus()
{
return get_ValueAsString(COLUMNNAME_VHUStatus);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java-gen\de\metas\handlingunits\model\X_M_HU_Trace.java | 1 |
请完成以下Java代码 | public void add(Object o)
{
if( current == elements.length )
grow();
try
{
elements[current] = o;
current++;
}
catch(java.lang.ArrayStoreException ase)
{
}
}
public void add(int location,Object o)
{
try
{
elements[location] = o;
}
catch(java.lang.ArrayStoreException ase)
{
}
}
public void remove(int location)
{
elements[location] = null;
}
public int location(Object o) throws NoSuchObjectException
{
int loc = -1;
for ( int x = 0; x < elements.length; x++ )
{
if((elements[x] != null && elements[x] == o )|| | (elements[x] != null && elements[x].equals(o)))
{
loc = x;
break;
}
}
if( loc == -1 )
throw new NoSuchObjectException();
return(loc);
}
public Object get(int location)
{
return elements[location];
}
public java.util.Enumeration elements()
{
return this;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\tools\src\main\java-legacy\org\apache\ecs\storage\Array.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void save(@NonNull final CommissionSettlementShare settlementShare)
{
final I_C_Commission_Share commissionShareRecord = load(settlementShare.getSalesCommissionShareId(), I_C_Commission_Share.class);
commissionShareRecord.setPointsSum_ToSettle(settlementShare.getPointsToSettleSum().toBigDecimal());
commissionShareRecord.setPointsSum_Settled(settlementShare.getSettledPointsSum().toBigDecimal());
saveRecord(commissionShareRecord);
final OrgId orgId = OrgId.ofRepoId(commissionShareRecord.getAD_Org_ID());
final ImmutableList<I_C_Commission_Fact> factRecords = retrieveFactRecords(commissionShareRecord);
createNewFactRecords(
settlementShare.getFacts(),
settlementShare.getSalesCommissionShareId().getRepoId(),
orgId,
factRecords);
}
private ImmutableList<I_C_Commission_Fact> retrieveFactRecords(@NonNull final I_C_Commission_Share shareRecord)
{
final ImmutableList<I_C_Commission_Fact> factRecords = queryBL.createQueryBuilder(I_C_Commission_Fact.class)
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_C_Commission_Fact.COLUMN_C_Commission_Share_ID, shareRecord.getC_Commission_Share_ID())
.addInArrayFilter(I_C_Commission_Fact.COLUMN_Commission_Fact_State, CommissionSettlementState.allRecordCodes())
.orderBy(I_C_Commission_Fact.COLUMN_CommissionFactTimestamp)
.create()
.listImmutable(I_C_Commission_Fact.class);
return factRecords;
} | private void createNewFactRecords(
@NonNull final ImmutableList<CommissionSettlementFact> facts,
final int commissionShareRecordId,
@NonNull final OrgId orgId,
@NonNull final ImmutableList<I_C_Commission_Fact> preexistingFactRecords)
{
final ImmutableMap<ArrayKey, I_C_Commission_Fact> idAndTypeAndTimestampToFactRecord = Maps.uniqueIndex(
preexistingFactRecords,
r -> ArrayKey.of(r.getC_Commission_Share_ID(), r.getCommission_Fact_State(), r.getCommissionFactTimestamp()));
for (final CommissionSettlementFact fact : facts)
{
final I_C_Commission_Fact factRecordOrNull = idAndTypeAndTimestampToFactRecord.get(
ArrayKey.of(commissionShareRecordId, fact.getState().toString(), TimeUtil.serializeInstant(fact.getTimestamp())));
if (factRecordOrNull != null)
{
continue;
}
final I_C_Commission_Fact factRecord = newInstance(I_C_Commission_Fact.class);
factRecord.setAD_Org_ID(orgId.getRepoId());
factRecord.setC_Commission_Share_ID(commissionShareRecordId);
factRecord.setC_Invoice_Candidate_Commission_ID(fact.getSettlementInvoiceCandidateId().getRepoId());
factRecord.setCommissionPoints(fact.getPoints().toBigDecimal());
factRecord.setCommission_Fact_State(fact.getState().toString());
factRecord.setCommissionFactTimestamp(TimeUtil.serializeInstant(fact.getTimestamp()));
saveRecord(factRecord);
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\commission\commissioninstance\services\repos\CommissionSettlementShareRepository.java | 2 |
请完成以下Java代码 | public String getMeta_RobotsTag ()
{
return (String)get_Value(COLUMNNAME_Meta_RobotsTag);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Notice.
@param Notice
Contains last write notice
*/
public void setNotice (String Notice)
{
set_Value (COLUMNNAME_Notice, Notice);
}
/** Get Notice.
@return Contains last write notice
*/
public String getNotice ()
{
return (String)get_Value(COLUMNNAME_Notice);
}
/** Set Priority.
@param Priority
Indicates if this request is of a high, medium or low priority.
*/
public void setPriority (int Priority)
{
set_Value (COLUMNNAME_Priority, Integer.valueOf(Priority));
}
/** Get Priority.
@return Indicates if this request is of a high, medium or low priority.
*/
public int getPriority ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Priority);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Relative URL.
@param RelativeURL
Contains the relative URL for the container
*/
public void setRelativeURL (String RelativeURL)
{
set_Value (COLUMNNAME_RelativeURL, RelativeURL);
}
/** Get Relative URL.
@return Contains the relative URL for the container
*/
public String getRelativeURL ()
{ | return (String)get_Value(COLUMNNAME_RelativeURL);
}
/** Set StructureXML.
@param StructureXML
Autogenerated Containerdefinition as XML Code
*/
public void setStructureXML (String StructureXML)
{
set_Value (COLUMNNAME_StructureXML, StructureXML);
}
/** Get StructureXML.
@return Autogenerated Containerdefinition as XML Code
*/
public String getStructureXML ()
{
return (String)get_Value(COLUMNNAME_StructureXML);
}
/** Set Title.
@param Title
Name this entity is referred to as
*/
public void setTitle (String Title)
{
set_Value (COLUMNNAME_Title, Title);
}
/** Get Title.
@return Name this entity is referred to as
*/
public String getTitle ()
{
return (String)get_Value(COLUMNNAME_Title);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_CM_Container.java | 1 |
请完成以下Java代码 | public String getBOMType ()
{
return (String)get_Value(COLUMNNAME_BOMType);
}
/** 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 Line No.
@param Line
Unique line for this document
*/
public void setLine (int Line)
{
set_Value (COLUMNNAME_Line, Integer.valueOf(Line));
}
/** Get Line No.
@return Unique line for this document
*/
public int getLine ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Line);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set BOM Line.
@param M_Product_BOM_ID BOM Line */
public void setM_Product_BOM_ID (int M_Product_BOM_ID)
{
if (M_Product_BOM_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Product_BOM_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Product_BOM_ID, Integer.valueOf(M_Product_BOM_ID));
}
/** Get BOM Line.
@return BOM Line */
public int getM_Product_BOM_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_BOM_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_M_Product getM_ProductBOM() throws RuntimeException
{
return (I_M_Product)MTable.get(getCtx(), I_M_Product.Table_Name)
.getPO(getM_ProductBOM_ID(), get_TrxName()); }
/** Set BOM Product.
@param M_ProductBOM_ID
Bill of Material Component Product
*/
public void setM_ProductBOM_ID (int M_ProductBOM_ID)
{
if (M_ProductBOM_ID < 1)
set_Value (COLUMNNAME_M_ProductBOM_ID, null);
else
set_Value (COLUMNNAME_M_ProductBOM_ID, Integer.valueOf(M_ProductBOM_ID));
}
/** Get BOM Product.
@return Bill of Material Component Product
*/
public int getM_ProductBOM_ID ()
{ | Integer ii = (Integer)get_Value(COLUMNNAME_M_ProductBOM_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), String.valueOf(getM_ProductBOM_ID()));
}
public I_M_Product getM_Product() throws RuntimeException
{
return (I_M_Product)MTable.get(getCtx(), I_M_Product.Table_Name)
.getPO(getM_Product_ID(), get_TrxName()); }
/** Set Product.
@param M_Product_ID
Product, Service, Item
*/
public void setM_Product_ID (int M_Product_ID)
{
if (M_Product_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Product_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID));
}
/** Get Product.
@return Product, Service, Item
*/
public int getM_Product_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
if (ii == null)
return 0;
return ii.intValue();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Product_BOM.java | 1 |
请完成以下Java代码 | public void setPaymentTermValue (java.lang.String PaymentTermValue)
{
set_Value (COLUMNNAME_PaymentTermValue, PaymentTermValue);
}
/** Get Zahlungskonditions-Schlüssel.
@return Suchschlüssel für die Zahlungskondition
*/
@Override
public java.lang.String getPaymentTermValue ()
{
return (java.lang.String)get_Value(COLUMNNAME_PaymentTermValue);
}
/** Set Preisgrundlage.
@param PriceBase Preisgrundlage */
@Override
public void setPriceBase (java.lang.String PriceBase)
{
set_Value (COLUMNNAME_PriceBase, PriceBase);
}
/** Get Preisgrundlage.
@return Preisgrundlage */
@Override
public java.lang.String getPriceBase ()
{
return (java.lang.String)get_Value(COLUMNNAME_PriceBase);
}
/** Set Festpreis.
@param PriceStdFixed
Festpreis, ohne ggf. zusätzliche Rabatte
*/
@Override
public void setPriceStdFixed (java.math.BigDecimal PriceStdFixed)
{
set_Value (COLUMNNAME_PriceStdFixed, PriceStdFixed);
}
/** Get Festpreis.
@return Festpreis, ohne ggf. zusätzliche Rabatte
*/
@Override
public java.math.BigDecimal getPriceStdFixed ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PriceStdFixed);
if (bd == null)
return BigDecimal.ZERO;
return bd;
}
/** Set Preisaufschlag.
@param PricingSystemSurchargeAmt
Aufschlag auf den Preis, der aus dem Preissystem resultieren würde
*/
@Override
public void setPricingSystemSurchargeAmt (java.math.BigDecimal PricingSystemSurchargeAmt)
{
set_Value (COLUMNNAME_PricingSystemSurchargeAmt, PricingSystemSurchargeAmt); | }
/** Get Preisaufschlag.
@return Aufschlag auf den Preis, der aus dem Preissystem resultieren würde
*/
@Override
public java.math.BigDecimal getPricingSystemSurchargeAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PricingSystemSurchargeAmt);
if (bd == null)
return BigDecimal.ZERO;
return bd;
}
/** 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 Produktschlüssel.
@param ProductValue
Schlüssel des Produktes
*/
@Override
public void setProductValue (java.lang.String ProductValue)
{
set_Value (COLUMNNAME_ProductValue, ProductValue);
}
/** Get Produktschlüssel.
@return Schlüssel des Produktes
*/
@Override
public java.lang.String getProductValue ()
{
return (java.lang.String)get_Value(COLUMNNAME_ProductValue);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_I_DiscountSchema.java | 1 |
请完成以下Java代码 | public void example6_asserttion() {
// Original way without assertions
Connection conn = getConnection();
if(conn == null) {
throw new RuntimeException("Connection is null");
}
// Using assert keyword
assert getConnection() != null : "Connection is null";
}
private boolean checkSomeCondition() {
return new Random().nextBoolean();
}
private boolean callRemoteApi() {
return new Random().nextBoolean();
}
private Connection getConnection() {
return null;
} | private static interface Animal {
}
private static class Dog implements Animal {
}
private static class Cat implements Animal {
}
private static class Parrot implements Animal {
}
} | repos\tutorials-master\core-java-modules\core-java-lang-operators-2\src\main\java\com\baeldung\colonexamples\ColonExamples.java | 1 |
请完成以下Java代码 | public class HMMNERecognizer extends HMMTrainer implements NERecognizer
{
NERTagSet tagSet;
public HMMNERecognizer(HiddenMarkovModel model)
{
super(model);
tagSet = new NERTagSet();
tagSet.nerLabels.add("nr");
tagSet.nerLabels.add("ns");
tagSet.nerLabels.add("nt");
}
public HMMNERecognizer()
{
this(new FirstOrderHiddenMarkovModel());
}
@Override
protected List<String[]> convertToSequence(Sentence sentence)
{
List<String[]> collector = Utility.convertSentenceToNER(sentence, tagSet);
for (String[] pair : collector)
{
pair[1] = pair[2];
}
return collector;
}
@Override
protected TagSet getTagSet()
{
return tagSet;
}
@Override
public String[] recognize(String[] wordArray, String[] posArray)
{
int[] obsArray = new int[wordArray.length];
for (int i = 0; i < obsArray.length; i++) | {
obsArray[i] = vocabulary.idOf(wordArray[i]);
}
int[] tagArray = new int[obsArray.length];
model.predict(obsArray, tagArray);
String[] tags = new String[obsArray.length];
for (int i = 0; i < tagArray.length; i++)
{
tags[i] = tagSet.stringOf(tagArray[i]);
}
return tags;
}
@Override
public NERTagSet getNERTagSet()
{
return tagSet;
}
} | repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\model\hmm\HMMNERecognizer.java | 1 |
请完成以下Java代码 | public boolean isQueryForProcessTasksOnly() {
ProcessEngineConfigurationImpl engineConfiguration = Context.getProcessEngineConfiguration();
return !engineConfiguration.isCmmnEnabled() && !engineConfiguration.isStandaloneTasksEnabled();
}
@Override
public TaskQuery or() {
if (this != queries.get(0)) {
throw new ProcessEngineException("Invalid query usage: cannot set or() within 'or' query");
}
TaskQueryImpl orQuery = new TaskQueryImpl();
orQuery.isOrQueryActive = true;
orQuery.queries = queries;
queries.add(orQuery);
return orQuery;
}
@Override
public TaskQuery endOr() {
if (!queries.isEmpty() && this != queries.get(queries.size()-1)) {
throw new ProcessEngineException("Invalid query usage: cannot set endOr() before or()");
}
return queries.get(0);
}
@Override
public TaskQuery matchVariableNamesIgnoreCase() { | this.variableNamesIgnoreCase = true;
for (TaskQueryVariableValue variable : this.variables) {
variable.setVariableNameIgnoreCase(true);
}
return this;
}
@Override
public TaskQuery matchVariableValuesIgnoreCase() {
this.variableValuesIgnoreCase = true;
for (TaskQueryVariableValue variable : this.variables) {
variable.setVariableValueIgnoreCase(true);
}
return this;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\TaskQueryImpl.java | 1 |
请完成以下Java代码 | public void setSalesgroup (final @Nullable java.lang.String Salesgroup)
{
set_Value (COLUMNNAME_Salesgroup, Salesgroup);
}
@Override
public java.lang.String getSalesgroup()
{
return get_ValueAsString(COLUMNNAME_Salesgroup);
}
@Override
public void setShelfLifeMinDays (final int ShelfLifeMinDays)
{
set_Value (COLUMNNAME_ShelfLifeMinDays, ShelfLifeMinDays);
}
@Override
public int getShelfLifeMinDays()
{
return get_ValueAsInt(COLUMNNAME_ShelfLifeMinDays);
}
@Override
public void setShipperName (final @Nullable java.lang.String ShipperName)
{
set_Value (COLUMNNAME_ShipperName, ShipperName);
}
@Override
public java.lang.String getShipperName()
{
return get_ValueAsString(COLUMNNAME_ShipperName);
}
@Override
public void setShipperRouteCodeName (final @Nullable java.lang.String ShipperRouteCodeName)
{
set_Value (COLUMNNAME_ShipperRouteCodeName, ShipperRouteCodeName);
}
@Override
public java.lang.String getShipperRouteCodeName()
{
return get_ValueAsString(COLUMNNAME_ShipperRouteCodeName);
}
@Override
public void setShortDescription (final @Nullable java.lang.String ShortDescription)
{
set_Value (COLUMNNAME_ShortDescription, ShortDescription);
}
@Override
public java.lang.String getShortDescription()
{
return get_ValueAsString(COLUMNNAME_ShortDescription);
}
@Override
public void setSwiftCode (final @Nullable java.lang.String SwiftCode)
{
set_Value (COLUMNNAME_SwiftCode, SwiftCode);
}
@Override
public java.lang.String getSwiftCode()
{
return get_ValueAsString(COLUMNNAME_SwiftCode);
}
@Override
public void setTaxID (final @Nullable java.lang.String TaxID)
{
set_Value (COLUMNNAME_TaxID, TaxID);
}
@Override | public java.lang.String getTaxID()
{
return get_ValueAsString(COLUMNNAME_TaxID);
}
@Override
public void setTitle (final @Nullable java.lang.String Title)
{
set_Value (COLUMNNAME_Title, Title);
}
@Override
public java.lang.String getTitle()
{
return get_ValueAsString(COLUMNNAME_Title);
}
@Override
public void setURL (final @Nullable java.lang.String URL)
{
set_Value (COLUMNNAME_URL, URL);
}
@Override
public java.lang.String getURL()
{
return get_ValueAsString(COLUMNNAME_URL);
}
@Override
public void setURL3 (final @Nullable java.lang.String URL3)
{
set_Value (COLUMNNAME_URL3, URL3);
}
@Override
public java.lang.String getURL3()
{
return get_ValueAsString(COLUMNNAME_URL3);
}
@Override
public void setVendorCategory (final @Nullable java.lang.String VendorCategory)
{
set_Value (COLUMNNAME_VendorCategory, VendorCategory);
}
@Override
public java.lang.String getVendorCategory()
{
return get_ValueAsString(COLUMNNAME_VendorCategory);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_I_BPartner.java | 1 |
请完成以下Java代码 | public void setIsReconciled (boolean IsReconciled)
{
set_Value (COLUMNNAME_IsReconciled, Boolean.valueOf(IsReconciled));
}
@Override
public boolean isReconciled()
{
return get_ValueAsBoolean(COLUMNNAME_IsReconciled);
}
@Override
public void setMatchStatement (java.lang.String MatchStatement)
{
set_Value (COLUMNNAME_MatchStatement, MatchStatement);
}
@Override
public java.lang.String getMatchStatement()
{
return (java.lang.String)get_Value(COLUMNNAME_MatchStatement);
}
@Override
public void setName (java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return (java.lang.String)get_Value(COLUMNNAME_Name);
}
@Override
public void setPosted (boolean Posted)
{
set_Value (COLUMNNAME_Posted, Boolean.valueOf(Posted));
}
@Override
public boolean isPosted()
{
return get_ValueAsBoolean(COLUMNNAME_Posted);
}
@Override
public void setProcessed (boolean Processed)
{
set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
}
@Override
public boolean isProcessed()
{
return get_ValueAsBoolean(COLUMNNAME_Processed);
}
@Override
public void setProcessing (boolean Processing)
{
set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
}
@Override
public boolean isProcessing() | {
return get_ValueAsBoolean(COLUMNNAME_Processing);
}
@Override
public void setStatementDate (java.sql.Timestamp StatementDate)
{
set_Value (COLUMNNAME_StatementDate, StatementDate);
}
@Override
public java.sql.Timestamp getStatementDate()
{
return get_ValueAsTimestamp(COLUMNNAME_StatementDate);
}
@Override
public void setStatementDifference (java.math.BigDecimal StatementDifference)
{
set_Value (COLUMNNAME_StatementDifference, StatementDifference);
}
@Override
public java.math.BigDecimal getStatementDifference()
{
BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_StatementDifference);
return bd != null ? bd : BigDecimal.ZERO;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_BankStatement.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class Student {
@Id
@GeneratedValue
private Long id;
private String name;
private String passportNumber;
public Student() {
super();
}
public Student(Long id, String name, String passportNumber) {
super();
this.id = id;
this.name = name;
this.passportNumber = passportNumber;
}
public Student(String name, String passportNumber) {
super();
this.name = name;
this.passportNumber = passportNumber;
}
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 getPassportNumber() {
return passportNumber;
}
public void setPassportNumber(String passportNumber) {
this.passportNumber = passportNumber;
}
@Override
public String toString() {
return String.format("Student [id=%s, name=%s, passportNumber=%s]", id, name, passportNumber);
}
} | repos\Spring-Boot-Advanced-Projects-main\spring-boot jpa-with-hibernate-and-h2\src\main\java\com\alanbinu\springboot\jpa\hibernate\h2\example\student\Student.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public boolean equals(Object o)
{
if (this == o)
{
return true;
}
if (o == null || getClass() != o.getClass())
{
return false;
}
PickupStep pickupStep = (PickupStep)o;
return Objects.equals(this.merchantLocationKey, pickupStep.merchantLocationKey);
}
@Override
public int hashCode()
{
return Objects.hash(merchantLocationKey);
}
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("class PickupStep {\n");
sb.append(" merchantLocationKey: ").append(toIndentedString(merchantLocationKey)).append("\n");
sb.append("}"); | return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o)
{
if (o == null)
{
return "null";
}
return o.toString().replace("\n", "\n ");
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\de-metas-camel-ebay\ebay-api-client\src\main\java\de\metas\camel\externalsystems\ebay\api\model\PickupStep.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public BatchPartQuery withoutTenantId() {
this.withoutTenantId = true;
return this;
}
@Override
public BatchPartQuery completed() {
this.completed = true;
return this;
}
@Override
public BatchPartQuery orderByBatchId() {
return orderBy(BatchPartQueryProperty.BATCH_ID);
}
@Override
public BatchPartQuery orderByCreateTime() {
return orderBy(BatchPartQueryProperty.CREATE_TIME);
}
public String getId() {
return id;
}
public String getType() {
return type;
}
public String getBatchId() {
return batchId;
}
public String getSearchKey() {
return searchKey;
}
public String getSearchKey2() {
return searchKey2;
}
public String getBatchType() {
return batchType;
}
public String getBatchSearchKey() {
return batchSearchKey;
} | public String getBatchSearchKey2() {
return batchSearchKey2;
}
public String getStatus() {
return status;
}
public String getScopeId() {
return scopeId;
}
public String getSubScopeId() {
return subScopeId;
}
public String getScopeType() {
return scopeType;
}
public String getTenantId() {
return tenantId;
}
public String getTenantIdLike() {
return tenantIdLike;
}
public boolean isWithoutTenantId() {
return withoutTenantId;
}
public boolean isCompleted() {
return completed;
}
} | repos\flowable-engine-main\modules\flowable-batch-service\src\main\java\org\flowable\batch\service\impl\BatchPartQueryImpl.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public TaskExecutor toLowerCaseChannelThreadPool() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(1);
executor.setMaxPoolSize(5);
executor.setThreadNamePrefix("tto-lower-case-channel-thread-pool");
executor.initialize();
return executor;
}
@Bean("countWordsChannelThreadPool")
public TaskExecutor countWordsChannelThreadPool() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(1);
executor.setMaxPoolSize(5);
executor.setThreadNamePrefix("count-words-channel-thread-pool"); | executor.initialize();
return executor;
}
@Bean("returnResponseChannelThreadPool")
public TaskExecutor returnResponseChannelThreadPool() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(1);
executor.setMaxPoolSize(5);
executor.setThreadNamePrefix("return-response-channel-thread-pool");
executor.initialize();
return executor;
}
} | repos\tutorials-master\patterns-modules\design-patterns-architectural\src\main\java\com\baeldung\seda\springintegration\TaskExecutorConfiguration.java | 2 |
请完成以下Java代码 | private static JsonHUQRCodeProductInfoV1 toJson(@NonNull final HUQRCodeProductInfo product)
{
return JsonHUQRCodeProductInfoV1.builder()
.id(product.getId())
.code(product.getCode())
.name(product.getName())
.build();
}
private static HUQRCodeProductInfo fromJson(@Nullable final JsonHUQRCodeProductInfoV1 json)
{
if (json == null)
{
return null;
}
return HUQRCodeProductInfo.builder()
.id(json.getId())
.code(json.getCode())
.name(json.getName())
.build();
}
private static JsonHUQRCodeAttributeV1 toJson(@NonNull final HUQRCodeAttribute attribute)
{
return JsonHUQRCodeAttributeV1.builder()
.code(attribute.getCode())
.displayName(attribute.getDisplayName())
.value(attribute.getValue())
// NOTE: in order to make the generated JSON shorter,
// we will set valueRendered only if it's different from value.
.valueRendered( | !Objects.equals(attribute.getValue(), attribute.getValueRendered())
? attribute.getValueRendered()
: null)
.build();
}
private static HUQRCodeAttribute fromJson(@NonNull final JsonHUQRCodeAttributeV1 json)
{
return HUQRCodeAttribute.builder()
.code(json.getCode())
.displayName(json.getDisplayName())
.value(json.getValue())
.valueRendered(json.getValueRendered())
.build();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\qrcodes\model\json\v1\JsonConverterV1.java | 1 |
请完成以下Java代码 | public class ClearingSystemMemberIdentification2 {
@XmlElement(name = "ClrSysId")
protected ClearingSystemIdentification2Choice clrSysId;
@XmlElement(name = "MmbId", required = true)
protected String mmbId;
/**
* Gets the value of the clrSysId property.
*
* @return
* possible object is
* {@link ClearingSystemIdentification2Choice }
*
*/
public ClearingSystemIdentification2Choice getClrSysId() {
return clrSysId;
}
/**
* Sets the value of the clrSysId property.
*
* @param value
* allowed object is
* {@link ClearingSystemIdentification2Choice }
*
*/
public void setClrSysId(ClearingSystemIdentification2Choice value) {
this.clrSysId = value;
}
/**
* Gets the value of the mmbId property.
* | * @return
* possible object is
* {@link String }
*
*/
public String getMmbId() {
return mmbId;
}
/**
* Sets the value of the mmbId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMmbId(String value) {
this.mmbId = value;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_02\ClearingSystemMemberIdentification2.java | 1 |
请完成以下Java代码 | public boolean isDateValue()
{
return false;
}
@Override
public boolean isEmpty()
{
return true;
}
@Override
public Object getEmptyValue()
{
return null;
}
@Override
public String getPropagationType()
{
return NullHUAttributePropagator.instance.getPropagationType();
}
@Override
public IAttributeAggregationStrategy retrieveAggregationStrategy()
{
return NullAggregationStrategy.instance;
}
@Override
public IAttributeSplitterStrategy retrieveSplitterStrategy()
{
return NullSplitterStrategy.instance;
}
@Override
public IHUAttributeTransferStrategy retrieveTransferStrategy()
{
return SkipHUAttributeTransferStrategy.instance;
}
@Override
public boolean isUseInASI()
{
return false;
}
@Override
public boolean isDefinedByTemplate()
{
return false;
}
@Override
public void addAttributeValueListener(final IAttributeValueListener listener)
{
// nothing
}
@Override
public List<ValueNamePair> getAvailableValues()
{
throw new InvalidAttributeValueException("method not supported for " + this);
}
@Override
public IAttributeValuesProvider getAttributeValuesProvider()
{
throw new InvalidAttributeValueException("method not supported for " + this);
}
@Override
public I_C_UOM getC_UOM()
{
return null;
}
@Override
public IAttributeValueCallout getAttributeValueCallout()
{
return NullAttributeValueCallout.instance;
}
@Override
public IAttributeValueGenerator getAttributeValueGeneratorOrNull()
{
return null;
}
@Override
public void removeAttributeValueListener(final IAttributeValueListener listener)
{ | // nothing
}
@Override
public boolean isReadonlyUI()
{
return true;
}
@Override
public boolean isDisplayedUI()
{
return false;
}
@Override
public boolean isMandatory()
{
return false;
}
@Override
public int getDisplaySeqNo()
{
return 0;
}
@Override
public NamePair getNullAttributeValue()
{
return null;
}
/**
* @return true; we consider Null attributes as always generated
*/
@Override
public boolean isNew()
{
return true;
}
@Override
public boolean isOnlyIfInProductAttributeSet()
{
return false;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\attribute\impl\NullAttributeValue.java | 1 |
请完成以下Java代码 | protected boolean beforeSave (boolean newRecord)
{
// One Reference
if (getM_Product_ID() == 0
&& getM_InOut_ID() == 0
&& getM_InOutLine_ID() == 0)
{
throw new AdempiereException("@NotFound@ @M_Product_ID@ | @M_InOut_ID@ | @M_InOutLine_ID@");
}
// No Product if Line entered
if (getM_InOutLine_ID() != 0 && getM_Product_ID() != 0)
setM_Product_ID(0);
return true;
} // beforeSave
/**
* Allocate Costs.
* Done at Invoice Line Level
* @return error message or ""
*/
public String allocateCosts()
{
MInvoiceLine il = new MInvoiceLine (getCtx(), getC_InvoiceLine_ID(), get_TrxName());
return il.allocateLandedCosts();
} // allocateCosts
/** | * String Representation
* @return info
*/
@Override
public String toString ()
{
StringBuffer sb = new StringBuffer ("MLandedCost[");
sb.append (get_ID ())
.append (",CostDistribution=").append (getLandedCostDistribution())
.append(",M_CostElement_ID=").append(getM_CostElement_ID());
if (getM_InOut_ID() != 0)
sb.append (",M_InOut_ID=").append (getM_InOut_ID());
if (getM_InOutLine_ID() != 0)
sb.append (",M_InOutLine_ID=").append (getM_InOutLine_ID());
if (getM_Product_ID() != 0)
sb.append (",M_Product_ID=").append (getM_Product_ID());
sb.append ("]");
return sb.toString ();
} // toString
} // MLandedCost | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\MLandedCost.java | 1 |
请完成以下Java代码 | public void setCaseDefinitionId(String caseDefinitionId) {
this.caseDefinitionId = caseDefinitionId;
}
@CamundaQueryParam("caseInstanceId")
public void setCaseInstanceId(String caseInstanceId) {
this.caseInstanceId = caseInstanceId;
}
@CamundaQueryParam("caseExecutionId")
public void setCaseExecutionId(String caseExecutionId) {
this.caseExecutionId = caseExecutionId;
}
@CamundaQueryParam("taskId")
public void setTaskId(String taskId) {
this.taskId = taskId;
}
@CamundaQueryParam("jobId")
public void setJobId(String jobId) {
this.jobId = jobId;
}
@CamundaQueryParam("jobDefinitionId")
public void setJobDefinitionId(String jobDefinitionId) {
this.jobDefinitionId = jobDefinitionId;
}
@CamundaQueryParam("batchId")
public void setBatchId(String batchId) {
this.batchId = batchId;
}
@CamundaQueryParam("userId")
public void setUserId(String userId) {
this.userId = userId;
}
@CamundaQueryParam("operationId")
public void setOperationId(String operationId) {
this.operationId = operationId;
}
@CamundaQueryParam("externalTaskId")
public void setExternalTaskId(String externalTaskId) {
this.externalTaskId = externalTaskId;
}
@CamundaQueryParam("operationType")
public void setOperationType(String operationType) {
this.operationType = operationType;
}
@CamundaQueryParam("entityType")
public void setEntityType(String entityType) {
this.entityType = entityType;
}
@CamundaQueryParam(value = "entityTypeIn", converter = StringArrayConverter.class)
public void setEntityTypeIn(String[] entityTypes) {
this.entityTypes = entityTypes; | }
@CamundaQueryParam("category")
public void setcategory(String category) {
this.category = category;
}
@CamundaQueryParam(value = "categoryIn", converter = StringArrayConverter.class)
public void setCategoryIn(String[] categories) {
this.categories = categories;
}
@CamundaQueryParam("property")
public void setProperty(String property) {
this.property = property;
}
@CamundaQueryParam(value = "afterTimestamp", converter = DateConverter.class)
public void setAfterTimestamp(Date after) {
this.afterTimestamp = after;
}
@CamundaQueryParam(value = "beforeTimestamp", converter = DateConverter.class)
public void setBeforeTimestamp(Date before) {
this.beforeTimestamp = before;
}
} | repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\history\UserOperationLogQueryDto.java | 1 |
请完成以下Java代码 | final class UserNotificationDetailMessageFormat extends EventMessageFormatTemplate
{
public static UserNotificationDetailMessageFormat newInstance()
{
return new UserNotificationDetailMessageFormat();
}
private static final Logger logger = LogManager.getLogger(UserNotificationDetailMessageFormat.class);
private UserNotificationDetailMessageFormat()
{
super();
}
@Override
protected String formatTableRecordReference(@NonNull final ITableRecordReference recordRef)
{
// Retrieve the record
final Object record;
try
{
final IContextAware context = PlainContextAware.createUsingOutOfTransaction();
record = recordRef.getModel(context);
}
catch (final Exception e) | {
logger.info("Failed retrieving record for " + recordRef, e);
return "<" + recordRef.getRecord_ID() + ">";
}
if (record == null)
{
logger.info("Failed retrieving record for " + recordRef);
return "<" + recordRef.getRecord_ID() + ">";
}
final String documentNo = Services.get(IDocumentBL.class).getDocumentNo(record);
return documentNo;
}
@Override
protected String formatText(final String text)
{
return text == null ? "" : text;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\notification\UserNotificationDetailMessageFormat.java | 1 |
请完成以下Spring Boot application配置 | ## 数据源配置
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/springbootdb?useUnicode=true&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
## Mybatis 配置
mybatis.typeAliasesPackage=org.spring.springboot.domain
mybatis.mapperLocations=classpath:mapper/*.xml
## Freemarker 配置
## 文件配置路径
spring.freemarker.template-loader-path=classpath:/web/
spring.freemarker.cache=false
spring.freemarker.charset=UTF-8
spring.freemarker.check-template-loca | tion=true
spring.freemarker.content-type=text/html
spring.freemarker.expose-request-attributes=true
spring.freemarker.expose-session-attributes=true
spring.freemarker.request-context-attribute=request
spring.freemarker.suffix=.ftl | repos\springboot-learning-example-master\springboot-freemarker\src\main\resources\application.properties | 2 |
请在Spring Boot框架中完成以下Java代码 | public static class SecuritySecureConfig {
private final String adminContextPath;
public SecuritySecureConfig(AdminServerProperties adminServerProperties) {
this.adminContextPath = adminServerProperties.getContextPath();
}
@Bean
protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
successHandler.setTargetUrlParameter("redirectTo");
successHandler.setDefaultTargetUrl(this.adminContextPath + "/");
http.authorizeHttpRequests((authorizeRequests) -> authorizeRequests
.requestMatchers(PathPatternRequestMatcher.withDefaults().matcher(this.adminContextPath + "/assets/**"))
.permitAll()
.requestMatchers(PathPatternRequestMatcher.withDefaults().matcher(this.adminContextPath + "/login"))
.permitAll() | .anyRequest()
.authenticated())
.formLogin((formLogin) -> formLogin.loginPage(this.adminContextPath + "/login")
.successHandler(successHandler))
.logout((logout) -> logout.logoutUrl(this.adminContextPath + "/logout"))
.httpBasic(Customizer.withDefaults())
.csrf((csrf) -> csrf.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
.ignoringRequestMatchers(
PathPatternRequestMatcher.withDefaults()
.matcher(POST, this.adminContextPath + "/instances"),
PathPatternRequestMatcher.withDefaults()
.matcher(DELETE, this.adminContextPath + "/instances/*"),
PathPatternRequestMatcher.withDefaults().matcher(this.adminContextPath + "/actuator/**")));
return http.build();
}
}
} | repos\spring-boot-admin-master\spring-boot-admin-samples\spring-boot-admin-sample-consul\src\main\java\de\codecentric\boot\admin\sample\SpringBootAdminConsulApplication.java | 2 |
请完成以下Java代码 | public void onEvent(EventSource eventSource, String id, String type, String data) {
log.info("on event data: {}", data);
if (data.equals("[DONE]")) {
log.info("OpenAI服务器发送结束标志!,traceId[{}]", traceId);
/**
* 1、完成token计算
* 2、完成数据存储
* 3、返回json格式,用于页面渲染
*/
sseEmitter.send(SseEmitter.event()
.id("[DONE]")
.data("[DONE]")
.reconnectTime(3000));
return;
}
JSONObject jsonObject = JSONUtil.parseObj(data);
JSONArray choicesJsonArray = jsonObject.getJSONArray("choices");
String content = null;
if (choicesJsonArray.isEmpty()) {
content = "";
} else {
JSONObject choiceJson = choicesJsonArray.getJSONObject(0);
JSONObject deltaJson = choiceJson.getJSONObject("delta");
String text = deltaJson.getStr("content");
if (text != null) {
content = text;
answer.add(content);
sseEmitter.send(SseEmitter.event()
.data(content)
.reconnectTime(2000));
}
}
} | @Override
public void onClosed(EventSource eventSource) {
log.info("OpenAI服务器关闭连接!,traceId[{}]", traceId);
log.info("complete answer: {}", StrUtil.join("", answer));
sseEmitter.complete();
}
@SneakyThrows
@Override
public void onFailure(EventSource eventSource, Throwable t, Response response) {
// TODO 处理前端中断
log.error("OpenAI服务器连接异常!response:[{}],traceId[{}] 当前内容:{}", response, traceId, StrUtil.join("", answer), t);
eventSource.cancel();
sseEmitter.completeWithError(t);
}
} | repos\spring-boot-quick-master\quick-sse\src\main\java\com\quick\event\ChatGPTEventListener.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class BookstoreService {
private final AuthorRepository authorRepository;
public BookstoreService(AuthorRepository authorRepository) {
this.authorRepository = authorRepository;
}
public void newAuthor() throws IOException {
Author mt = new Author();
mt.setName("Martin Ticher");
mt.setAge(43);
mt.setGenre("Horror");
mt.setAvatar(BlobProxy.generateProxy(
Files.readAllBytes(new File("avatars/mt_avatar.png").toPath())));
mt.setBiography(ClobProxy.generateProxy(
Files.readString(new File("biography/mt_bio.txt").toPath())));
authorRepository.save(mt);
}
public void fetchAuthor() throws SQLException, IOException {
Author author = authorRepository.findByName("Martin Ticher");
System.out.println("Author bio: " | + readBiography(author.getBiography()));
System.out.println("Author avatar: "
+ Arrays.toString(readAvatar(author.getAvatar())));
}
private byte[] readAvatar(Blob avatar) throws SQLException, IOException {
try ( InputStream is = avatar.getBinaryStream()) {
return is.readAllBytes();
}
}
private String readBiography(Clob bio) throws SQLException, IOException {
StringBuilder sb = new StringBuilder();
try ( Reader reader = bio.getCharacterStream()) {
char[] buffer = new char[2048];
for (int i = reader.read(buffer); i > 0; i = reader.read(buffer)) {
sb.append(buffer, 0, i);
}
}
return sb.toString();
}
} | repos\Hibernate-SpringBoot-master\HibernateSpringBootMappingLobToClobAndBlob\src\main\java\com\bookstore\service\BookstoreService.java | 2 |
请完成以下Java代码 | public String toString()
{
return "TrxCallableWrappers[" + callable + "]";
}
@Override
public T call() throws Exception
{
return callable.call();
}
};
}
public static <T> TrxCallableWithTrxName<T> wrapAsTrxCallableWithTrxNameIfNeeded(final TrxCallable<T> callable)
{
if (callable == null)
{
return null;
}
if (callable instanceof TrxCallableWithTrxName)
{
final TrxCallableWithTrxName<T> callableWithTrxName = (TrxCallableWithTrxName<T>)callable;
return callableWithTrxName;
}
return new TrxCallableWithTrxName<T>()
{
@Override
public String toString()
{
return "TrxCallableWithTrxName-wrapper[" + callable + "]";
} | @Override
public T call(final String localTrxName) throws Exception
{
return callable.call();
}
@Override
public T call() throws Exception
{
throw new IllegalStateException("This method shall not be called");
}
@Override
public boolean doCatch(final Throwable e) throws Throwable
{
return callable.doCatch(e);
}
@Override
public void doFinally()
{
callable.doFinally();
}
};
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\trx\api\impl\TrxCallableWrappers.java | 1 |
请完成以下Java代码 | public HistoricActivityStatisticsQuery includeIncidents() {
includeIncidents = true;
return this;
}
@Override
public HistoricActivityStatisticsQuery startedAfter(Date date) {
startedAfter = date;
return this;
}
@Override
public HistoricActivityStatisticsQuery startedBefore(Date date) {
startedBefore = date;
return this;
}
@Override
public HistoricActivityStatisticsQuery finishedAfter(Date date) {
finishedAfter = date;
return this;
}
@Override
public HistoricActivityStatisticsQuery finishedBefore(Date date) {
finishedBefore = date;
return this;
}
@Override
public HistoricActivityStatisticsQuery processInstanceIdIn(String... processInstanceIds) {
ensureNotNull("processInstanceIds", (Object[]) processInstanceIds);
this.processInstanceIds = processInstanceIds;
return this;
}
public HistoricActivityStatisticsQuery orderByActivityId() {
return orderBy(HistoricActivityStatisticsQueryProperty.ACTIVITY_ID_);
}
public long executeCount(CommandContext commandContext) {
checkQueryOk();
return
commandContext
.getHistoricStatisticsManager()
.getHistoricStatisticsCountGroupedByActivity(this);
}
public List<HistoricActivityStatistics> executeList(CommandContext commandContext, Page page) {
checkQueryOk(); | return
commandContext
.getHistoricStatisticsManager()
.getHistoricStatisticsGroupedByActivity(this, page);
}
protected void checkQueryOk() {
super.checkQueryOk();
ensureNotNull("No valid process definition id supplied", "processDefinitionId", processDefinitionId);
}
// getters /////////////////////////////////////////////////
public String getProcessDefinitionId() {
return processDefinitionId;
}
public boolean isIncludeFinished() {
return includeFinished;
}
public boolean isIncludeCanceled() {
return includeCanceled;
}
public boolean isIncludeCompleteScope() {
return includeCompleteScope;
}
public String[] getProcessInstanceIds() {
return processInstanceIds;
}
public boolean isIncludeIncidents() {
return includeIncidents;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\HistoricActivityStatisticsQueryImpl.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public Map<String, HistoryJobHandler> getHistoryJobHandlers() {
return historyJobHandlers;
}
public JobServiceConfiguration setHistoryJobHandlers(Map<String, HistoryJobHandler> historyJobHandlers) {
this.historyJobHandlers = historyJobHandlers;
return this;
}
public JobServiceConfiguration addHistoryJobHandler(String type, HistoryJobHandler historyJobHandler) {
if (this.historyJobHandlers == null) {
this.historyJobHandlers = new HashMap<>();
}
this.historyJobHandlers.put(type, historyJobHandler);
return this;
}
public int getAsyncExecutorNumberOfRetries() {
return asyncExecutorNumberOfRetries;
}
public JobServiceConfiguration setAsyncExecutorNumberOfRetries(int asyncExecutorNumberOfRetries) {
this.asyncExecutorNumberOfRetries = asyncExecutorNumberOfRetries;
return this;
}
public int getAsyncExecutorResetExpiredJobsMaxTimeout() {
return asyncExecutorResetExpiredJobsMaxTimeout;
}
public JobServiceConfiguration setAsyncExecutorResetExpiredJobsMaxTimeout(int asyncExecutorResetExpiredJobsMaxTimeout) {
this.asyncExecutorResetExpiredJobsMaxTimeout = asyncExecutorResetExpiredJobsMaxTimeout;
return this;
}
@Override
public ObjectMapper getObjectMapper() {
return objectMapper;
}
@Override
public JobServiceConfiguration setObjectMapper(ObjectMapper objectMapper) {
this.objectMapper = objectMapper;
return this;
}
public List<JobProcessor> getJobProcessors() {
return jobProcessors;
} | public JobServiceConfiguration setJobProcessors(List<JobProcessor> jobProcessors) {
this.jobProcessors = Collections.unmodifiableList(jobProcessors);
return this;
}
public List<HistoryJobProcessor> getHistoryJobProcessors() {
return historyJobProcessors;
}
public JobServiceConfiguration setHistoryJobProcessors(List<HistoryJobProcessor> historyJobProcessors) {
this.historyJobProcessors = Collections.unmodifiableList(historyJobProcessors);
return this;
}
public void setJobParentStateResolver(InternalJobParentStateResolver jobParentStateResolver) {
this.jobParentStateResolver = jobParentStateResolver;
}
public InternalJobParentStateResolver getJobParentStateResolver() {
return jobParentStateResolver;
}
public List<String> getEnabledJobCategories() {
return enabledJobCategories;
}
public void setEnabledJobCategories(List<String> enabledJobCategories) {
this.enabledJobCategories = enabledJobCategories;
}
public void addEnabledJobCategory(String jobCategory) {
if (enabledJobCategories == null) {
enabledJobCategories = new ArrayList<>();
}
enabledJobCategories.add(jobCategory);
}
} | repos\flowable-engine-main\modules\flowable-job-service\src\main\java\org\flowable\job\service\JobServiceConfiguration.java | 2 |
请完成以下Java代码 | public final class MCity extends X_C_City
{
/**
*
*/
private static final long serialVersionUID = -5438111614429419874L;
public MCity (Properties ctx, int C_City_ID, String trxName)
{
super (ctx, C_City_ID, trxName);
if (C_City_ID == 0)
{
}
} // MCity
public MCity (Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
} // MCity | @Override
protected boolean beforeSave(final boolean newRecord)
{
if(getC_Region_ID() > 0 && getC_Country_ID() <= 0)
{
setC_Country_ID(getC_Region().getC_Country_ID());
}
if(getC_Country_ID() <= 0)
{
throw new FillMandatoryException(I_C_City.COLUMNNAME_C_Country_ID);
}
return true;
}
} // MCity | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MCity.java | 1 |
请完成以下Java代码 | public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException {
writer.writeAttribute(namespaceURI, localName, value);
}
@Override
public void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException {
writer.writeNamespace(prefix, namespaceURI);
}
@Override
public void writeDefaultNamespace(String namespaceURI) throws XMLStreamException {
writer.writeDefaultNamespace(namespaceURI);
}
@Override
public void writeComment(String data) throws XMLStreamException {
writer.writeComment(data);
}
@Override
public void writeProcessingInstruction(String target) throws XMLStreamException {
writer.writeProcessingInstruction(target);
}
@Override
public void writeProcessingInstruction(String target, String data) throws XMLStreamException {
writer.writeProcessingInstruction(target, data);
}
@Override
public void writeCData(String data) throws XMLStreamException {
writer.writeCData(data);
}
@Override
public void writeDTD(String dtd) throws XMLStreamException {
writer.writeDTD(dtd);
}
@Override
public void writeEntityRef(String name) throws XMLStreamException {
writer.writeEntityRef(name);
}
@Override
public void writeStartDocument() throws XMLStreamException {
writer.writeStartDocument();
}
@Override
public void writeStartDocument(String version) throws XMLStreamException {
writer.writeStartDocument(version);
}
@Override
public void writeStartDocument(String encoding, String version) throws XMLStreamException {
writer.writeStartDocument(encoding, version);
}
@Override
public void writeCharacters(String text) throws XMLStreamException {
writer.writeCharacters(text);
}
@Override
public void writeCharacters(char[] text, int start, int len) throws XMLStreamException {
writer.writeCharacters(text, start, len);
} | @Override
public String getPrefix(String uri) throws XMLStreamException {
return writer.getPrefix(uri);
}
@Override
public void setPrefix(String prefix, String uri) throws XMLStreamException {
writer.setPrefix(prefix, uri);
}
@Override
public void setDefaultNamespace(String uri) throws XMLStreamException {
writer.setDefaultNamespace(uri);
}
@Override
public void setNamespaceContext(NamespaceContext context) throws XMLStreamException {
writer.setNamespaceContext(context);
}
@Override
public NamespaceContext getNamespaceContext() {
return writer.getNamespaceContext();
}
@Override
public Object getProperty(String name) throws IllegalArgumentException {
return writer.getProperty(name);
}
} | repos\flowable-engine-main\modules\flowable-bpmn-converter\src\main\java\org\flowable\bpmn\converter\DelegatingXMLStreamWriter.java | 1 |
请完成以下Java代码 | public class ELContextBuilder {
private static final Logger logger = LoggerFactory.getLogger(ELContextBuilder.class);
private List<ELResolver> resolvers;
private Map<String, Object> variables;
public ELContextBuilder withResolvers(ELResolver... resolvers) {
this.resolvers = List.of(resolvers);
return this;
}
public ELContextBuilder withVariables(Map<String, Object> variables) {
this.variables = variables;
return this;
}
public ELContext build() {
CompositeELResolver elResolver = createCompositeResolver();
return new ActivitiElContext(elResolver);
}
public ELContext buildWithCustomFunctions(List<CustomFunctionProvider> customFunctionProviders) {
CompositeELResolver elResolver = createCompositeResolver();
ActivitiElContext elContext = new ActivitiElContext(elResolver);
try {
addDateFunctions(elContext);
addListFunctions(elContext);
if (customFunctionProviders != null) {
customFunctionProviders.forEach(provider -> {
try {
provider.addCustomFunctions(elContext);
} catch (Exception e) {
logger.error("Error setting up EL custom functions", e);
}
});
}
} catch (NoSuchMethodException e) { | logger.error("Error setting up EL custom functions", e);
}
return elContext;
}
private void addResolvers(CompositeELResolver compositeResolver) {
Stream.ofNullable(resolvers).flatMap(Collection::stream).forEach(compositeResolver::add);
}
private CompositeELResolver createCompositeResolver() {
CompositeELResolver elResolver = new CompositeELResolver();
elResolver.add(
new ReadOnlyMapELResolver((Objects.nonNull(variables) ? new HashMap<>(variables) : Collections.emptyMap()))
);
addResolvers(elResolver);
return elResolver;
}
} | repos\Activiti-develop\activiti-core-common\activiti-expression-language\src\main\java\org\activiti\core\el\ELContextBuilder.java | 1 |
请完成以下Java代码 | public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public PersonalDetails getPersonalDetails() {
return personalDetails;
}
public void setPersonalDetails(PersonalDetails personalDetails) {
this.personalDetails = personalDetails;
}
}
static class PersonalDetails {
String emailAddress;
String phone; | public String getEmailAddress() {
return emailAddress;
}
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
}
} | repos\tutorials-master\core-java-modules\core-java-14\src\main\java\com\baeldung\java14\npe\HelpfulNullPointerException.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public String prefix() {
return "management.stackdriver.metrics.export";
}
@Override
public String projectId() {
return obtain(StackdriverProperties::getProjectId, StackdriverConfig.super::projectId);
}
@Override
public String resourceType() {
return obtain(StackdriverProperties::getResourceType, StackdriverConfig.super::resourceType);
}
@Override
public Map<String, String> resourceLabels() {
return obtain(StackdriverProperties::getResourceLabels, StackdriverConfig.super::resourceLabels);
}
@Override
public boolean useSemanticMetricTypes() { | return obtain(StackdriverProperties::isUseSemanticMetricTypes, StackdriverConfig.super::useSemanticMetricTypes);
}
@Override
public String metricTypePrefix() {
return obtain(StackdriverProperties::getMetricTypePrefix, StackdriverConfig.super::metricTypePrefix);
}
@Override
public boolean autoCreateMetricDescriptors() {
return obtain(StackdriverProperties::isAutoCreateMetricDescriptors,
StackdriverConfig.super::autoCreateMetricDescriptors);
}
} | repos\spring-boot-4.0.1\module\spring-boot-micrometer-metrics\src\main\java\org\springframework\boot\micrometer\metrics\autoconfigure\export\stackdriver\StackdriverPropertiesConfigAdapter.java | 2 |
请完成以下Java代码 | public Long getStudentId() {
return studentId;
}
public void setStudentId(Long studentId) {
this.studentId = studentId;
}
public Long getCourseId() {
return courseId;
}
public void setCourseId(Long courseId) {
this.courseId = courseId;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((courseId == null) ? 0 : courseId.hashCode());
result = prime * result + ((studentId == null) ? 0 : studentId.hashCode());
return result;
} | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
CourseRatingKey other = (CourseRatingKey) obj;
if (courseId == null) {
if (other.courseId != null)
return false;
} else if (!courseId.equals(other.courseId))
return false;
if (studentId == null) {
if (other.studentId != null)
return false;
} else if (!studentId.equals(other.studentId))
return false;
return true;
}
} | repos\tutorials-master\persistence-modules\spring-jpa\src\main\java\com\baeldung\manytomany\model\CourseRatingKey.java | 1 |
请完成以下Java代码 | public Date getTime() {
return getCreateTime();
}
// common methods //////////////////////////////////////////////////////////
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("HistoricVariableInstanceEntity[");
sb.append("id=").append(id);
sb.append(", name=").append(name);
sb.append(", revision=").append(revision);
sb.append(", type=").append(variableType != null ? variableType.getTypeName() : "null");
if (longValue != null) {
sb.append(", longValue=").append(longValue);
}
if (doubleValue != null) {
sb.append(", doubleValue=").append(doubleValue);
}
if (textValue != null) {
sb.append(", textValue=").append(StringUtils.abbreviate(textValue, 40));
}
if (textValue2 != null) {
sb.append(", textValue2=").append(StringUtils.abbreviate(textValue2, 40));
}
if (byteArrayRef.getId() != null) {
sb.append(", byteArrayValueId=").append(byteArrayRef.getId()); | }
sb.append("]");
return sb.toString();
}
// non-supported (v6)
@Override
public String getScopeId() {
return null;
}
@Override
public String getSubScopeId() {
return null;
}
@Override
public String getScopeType() {
return null;
}
} | repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\persistence\entity\HistoricVariableInstanceEntity.java | 1 |
请完成以下Java代码 | public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getAdminId() {
return adminId;
}
public void setAdminId(Long adminId) {
this.adminId = adminId;
}
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId; | }
@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(", adminId=").append(adminId);
sb.append(", roleId=").append(roleId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\UmsAdminRoleRelation.java | 1 |
请完成以下Java代码 | private WindowId getWindowId(final String tableName)
{
final AdWindowId adWindowId = RecordWindowFinder.findAdWindowId(tableName).get();
return WindowId.of(adWindowId);
}
private static class RemindersQueue
{
private final SortedSet<PurchaseCandidateReminder> reminders = new TreeSet<>(Comparator.comparing(PurchaseCandidateReminder::getNotificationTime));
public List<PurchaseCandidateReminder> toList()
{
return ImmutableList.copyOf(reminders);
}
public boolean add(@NonNull final PurchaseCandidateReminder reminder)
{
return reminders.add(reminder);
}
public void setReminders(final Collection<PurchaseCandidateReminder> reminders)
{
this.reminders.clear();
this.reminders.addAll(reminders);
}
public List<PurchaseCandidateReminder> removeAllUntil(final ZonedDateTime maxNotificationTime)
{
final List<PurchaseCandidateReminder> result = new ArrayList<>();
for (final Iterator<PurchaseCandidateReminder> it = reminders.iterator(); it.hasNext();)
{
final PurchaseCandidateReminder reminder = it.next();
final ZonedDateTime notificationTime = reminder.getNotificationTime();
if (notificationTime.compareTo(maxNotificationTime) <= 0)
{
it.remove();
result.add(reminder);
}
}
return result;
}
public ZonedDateTime getMinNotificationTime()
{
if (reminders.isEmpty())
{
return null;
}
return reminders.first().getNotificationTime(); | }
}
@lombok.Value
@lombok.Builder
private static class NextDispatch
{
public static NextDispatch schedule(final Runnable task, final ZonedDateTime date, final TaskScheduler taskScheduler)
{
final ScheduledFuture<?> scheduledFuture = taskScheduler.schedule(task, TimeUtil.asDate(date));
return builder()
.task(task)
.scheduledFuture(scheduledFuture)
.notificationTime(date)
.build();
}
Runnable task;
ScheduledFuture<?> scheduledFuture;
ZonedDateTime notificationTime;
public void cancel()
{
final boolean canceled = scheduledFuture.cancel(false);
logger.trace("Cancel requested for {} (result was: {})", this, canceled);
}
public NextDispatch rescheduleIfAfter(final ZonedDateTime date, final TaskScheduler taskScheduler)
{
if (!notificationTime.isAfter(date) && !scheduledFuture.isDone())
{
logger.trace("Skip rescheduling {} because it's not after {}", date);
return this;
}
cancel();
final ScheduledFuture<?> nextScheduledFuture = taskScheduler.schedule(task, TimeUtil.asTimestamp(date));
NextDispatch nextDispatch = NextDispatch.builder()
.task(task)
.scheduledFuture(nextScheduledFuture)
.notificationTime(date)
.build();
logger.trace("Rescheduled {} to {}", this, nextDispatch);
return nextDispatch;
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\purchasecandidate\reminder\PurchaseCandidateReminderScheduler.java | 1 |
请完成以下Java代码 | public static WorkpackageSkipRequestException createWithTimeoutAndThrowable(
final String message,
final int skipTimeoutMillis,
final Throwable cause)
{
return new WorkpackageSkipRequestException(message,
skipTimeoutMillis,
cause);
}
public static WorkpackageSkipRequestException createWithTimeout(
final String message,
final int skipTimeoutMillis)
{
return new WorkpackageSkipRequestException(message,
skipTimeoutMillis,
null);
}
/**
* A random int between 0 and 5000 is added to the {@link Async_Constants#DEFAULT_RETRY_TIMEOUT_MILLIS} timeout. Use this if you want workpackages that are postponed at the same time to be
* retried at different times.
*/
public static WorkpackageSkipRequestException createWithRandomTimeout(final String message)
{
return new WorkpackageSkipRequestException(message,
Async_Constants.DEFAULT_RETRY_TIMEOUT_MILLIS + RANDOM.nextInt(5001),
null);
}
private WorkpackageSkipRequestException(final String message, final int skipTimeoutMillis, final Throwable cause)
{
super(message, cause);
this.skipTimeoutMillis = skipTimeoutMillis;
}
@Override
public String getSkipReason()
{ | return getLocalizedMessage();
}
@Override
public boolean isSkip()
{
return true;
}
@Override
public int getSkipTimeoutMillis()
{
return skipTimeoutMillis;
}
@Override
public Exception getException()
{
return this;
}
/**
* No need to fill the log if this exception is thrown.
*/
protected boolean isLoggedInTrxManager()
{
return false;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.async\src\main\java\de\metas\async\exceptions\WorkpackageSkipRequestException.java | 1 |
请完成以下Java代码 | public int retrieveNextLineNo(@NonNull final PPOrderId orderId)
{
Integer maxLine = queryBL
.createQueryBuilder(I_PP_Order_BOMLine.class)
.addEqualsFilter(I_PP_Order_BOMLine.COLUMNNAME_PP_Order_ID, orderId)
.create()
.aggregate(I_PP_Order_BOMLine.COLUMNNAME_Line, Aggregate.MAX, Integer.class);
if (maxLine == null)
{
maxLine = 0;
}
final int nextLine = maxLine + 10;
return nextLine;
}
@Override
public void save(@NonNull final I_PP_Order_BOM orderBOM)
{
saveRecord(orderBOM);
}
@Override
public void save(@NonNull final I_PP_Order_BOMLine orderBOMLine)
{
saveRecord(orderBOMLine);
}
@Override | public void deleteByOrderId(@NonNull final PPOrderId orderId)
{
final I_PP_Order_BOM orderBOM = getByOrderIdOrNull(orderId);
if (orderBOM != null)
{
InterfaceWrapperHelper.delete(orderBOM);
}
}
@Override
public void markBOMLinesAsProcessed(@NonNull final PPOrderId orderId)
{
for (final I_PP_Order_BOMLine orderBOMLine : retrieveOrderBOMLines(orderId))
{
orderBOMLine.setProcessed(true);
save(orderBOMLine);
}
}
@Override
public void markBOMLinesAsNotProcessed(@NonNull final PPOrderId orderId)
{
for (final I_PP_Order_BOMLine orderBOMLine : retrieveOrderBOMLines(orderId))
{
orderBOMLine.setProcessed(false);
save(orderBOMLine);
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.material\planning\src\main\java\de\metas\material\planning\pporder\impl\PPOrderBOMDAO.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class MessageDefinition {
protected String id;
protected ItemDefinition itemDefinition;
public MessageDefinition(String id) {
this.id = id;
}
public MessageInstance createInstance() {
return new MessageInstance(this, this.itemDefinition.createInstance());
}
public ItemDefinition getItemDefinition() { | return this.itemDefinition;
}
public StructureDefinition getStructureDefinition() {
return this.itemDefinition.getStructureDefinition();
}
public void setItemDefinition(ItemDefinition itemDefinition) {
this.itemDefinition = itemDefinition;
}
public String getId() {
return this.id;
}
} | repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\bpmn\webservice\MessageDefinition.java | 2 |
请完成以下Java代码 | public MFColor setLineColor(final Color color)
{
if (!isLine() || color == null)
{
return this;
}
return toBuilder().lineColor(color).build();
}
public MFColor setLineBackColor(final Color color)
{
if (!isLine() || color == null)
{
return this;
}
return toBuilder().lineBackColor(color).build();
}
public MFColor setLineWidth(final float width)
{
if (!isLine())
{
return this;
}
return toBuilder().lineWidth(width).build();
}
public MFColor setLineDistance(final int distance)
{
if (!isLine())
{
return this;
}
return toBuilder().lineDistance(distance).build();
}
public MFColor toFlatColor()
{
switch (getType())
{
case FLAT:
return this;
case GRADIENT:
return ofFlatColor(getGradientUpperColor());
case LINES: | return ofFlatColor(getLineBackColor());
case TEXTURE:
return ofFlatColor(getTextureTaintColor());
default:
throw new IllegalStateException("Type not supported: " + getType());
}
}
public String toHexString()
{
final Color awtColor = toFlatColor().getFlatColor();
return toHexString(awtColor.getRed(), awtColor.getGreen(), awtColor.getBlue());
}
public static String toHexString(final int red, final int green, final int blue)
{
Check.assume(red >= 0 && red <= 255, "Invalid red value: {}", red);
Check.assume(green >= 0 && green <= 255, "Invalid green value: {}", green);
Check.assume(blue >= 0 && blue <= 255, "Invalid blue value: {}", blue);
return String.format("#%02x%02x%02x", red, green, blue);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\util\MFColor.java | 1 |
请完成以下Java代码 | public class RequestInterceptorHandler implements HttpRequestInterceptor {
protected static final EngineClientLogger LOG = ExternalTaskClientLogger.ENGINE_CLIENT_LOGGER;
protected List<ClientRequestInterceptor> interceptors;
public RequestInterceptorHandler(List<ClientRequestInterceptor> interceptors) {
this.interceptors = interceptors;
}
@Override
public void process(HttpRequest httpRequest, EntityDetails details, HttpContext context) throws HttpException, IOException {
ClientRequestContextImpl interceptedRequest = new ClientRequestContextImpl();
interceptors.forEach((ClientRequestInterceptor requestInterceptor) -> {
try { | requestInterceptor.intercept(interceptedRequest);
}
catch (Throwable e) {
LOG.requestInterceptorException(e);
}
});
Map<String, String> newHeaders = interceptedRequest.getHeaders();
newHeaders.forEach((headerName, headerValue) -> httpRequest.addHeader(new BasicHeader(headerName, headerValue)));
}
public List<ClientRequestInterceptor> getInterceptors() {
return interceptors;
}
} | repos\camunda-bpm-platform-master\clients\java\client\src\main\java\org\camunda\bpm\client\interceptor\impl\RequestInterceptorHandler.java | 1 |
请完成以下Java代码 | char getCharacter() {
return (char) this.character;
}
Location getLocation() {
return new Location(this.reader.getLineNumber(), this.columnNumber);
}
boolean isSameLastLineCommentPrefix() {
return this.lastLineCommentPrefixCharacter == this.character;
}
boolean isCommentPrefixCharacter() {
return this.character == '#' || this.character == '!';
}
boolean isHyphenCharacter() {
return this.character == '-';
}
}
/**
* A single document within the properties file.
*/ | static class Document {
private final Map<String, OriginTrackedValue> values = new LinkedHashMap<>();
void put(String key, OriginTrackedValue value) {
if (!key.isEmpty()) {
this.values.put(key, value);
}
}
boolean isEmpty() {
return this.values.isEmpty();
}
Map<String, OriginTrackedValue> asMap() {
return this.values;
}
}
} | repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\env\OriginTrackedPropertiesLoader.java | 1 |
请完成以下Java代码 | public java.lang.String getUIStyle()
{
return get_ValueAsString(COLUMNNAME_UIStyle);
}
/**
* ViewEditMode AD_Reference_ID=541263
* Reference name: ViewEditMode
*/
public static final int VIEWEDITMODE_AD_Reference_ID=541263;
/** Never = N */
public static final String VIEWEDITMODE_Never = "N";
/** OnDemand = D */
public static final String VIEWEDITMODE_OnDemand = "D";
/** Always = Y */
public static final String VIEWEDITMODE_Always = "Y";
@Override
public void setViewEditMode (final @Nullable java.lang.String ViewEditMode)
{
set_Value (COLUMNNAME_ViewEditMode, ViewEditMode);
}
@Override
public java.lang.String getViewEditMode()
{
return get_ValueAsString(COLUMNNAME_ViewEditMode);
}
/**
* WidgetSize AD_Reference_ID=540724
* Reference name: WidgetSize_WEBUI
*/ | public static final int WIDGETSIZE_AD_Reference_ID=540724;
/** Small = S */
public static final String WIDGETSIZE_Small = "S";
/** Medium = M */
public static final String WIDGETSIZE_Medium = "M";
/** Large = L */
public static final String WIDGETSIZE_Large = "L";
/** ExtraLarge = XL */
public static final String WIDGETSIZE_ExtraLarge = "XL";
/** XXL = XXL */
public static final String WIDGETSIZE_XXL = "XXL";
@Override
public void setWidgetSize (final @Nullable java.lang.String WidgetSize)
{
set_Value (COLUMNNAME_WidgetSize, WidgetSize);
}
@Override
public java.lang.String getWidgetSize()
{
return get_ValueAsString(COLUMNNAME_WidgetSize);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_UI_Element.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public String getDOCUMENTID() {
return documentid;
}
/**
* Sets the value of the documentid property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDOCUMENTID(String value) {
this.documentid = value;
}
/**
* Gets the value of the controlqual property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCONTROLQUAL() {
return controlqual;
}
/**
* Sets the value of the controlqual property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCONTROLQUAL(String value) {
this.controlqual = value;
}
/**
* Gets the value of the controlvalue property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCONTROLVALUE() {
return controlvalue;
}
/**
* Sets the value of the controlvalue property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCONTROLVALUE(String value) {
this.controlvalue = value;
}
/**
* Gets the value of the measurementunit property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMEASUREMENTUNIT() {
return measurementunit;
}
/**
* Sets the value of the measurementunit property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMEASUREMENTUNIT(String value) {
this.measurementunit = value;
}
/**
* Gets the value of the tamou1 property.
*
* @return
* possible object is
* {@link TAMOU1 }
* | */
public TAMOU1 getTAMOU1() {
return tamou1;
}
/**
* Sets the value of the tamou1 property.
*
* @param value
* allowed object is
* {@link TAMOU1 }
*
*/
public void setTAMOU1(TAMOU1 value) {
this.tamou1 = value;
}
/**
* Gets the value of the ttaxi1 property.
*
* @return
* possible object is
* {@link TTAXI1 }
*
*/
public TTAXI1 getTTAXI1() {
return ttaxi1;
}
/**
* Sets the value of the ttaxi1 property.
*
* @param value
* allowed object is
* {@link TTAXI1 }
*
*/
public void setTTAXI1(TTAXI1 value) {
this.ttaxi1 = value;
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_stepcom_desadv\de\metas\edi\esb\jaxb\stepcom\desadv\TRAILR.java | 2 |
请完成以下Java代码 | public class MultimapIteration {
private static final Logger LOGGER = LoggerFactory.getLogger(MultimapIteration.class);
static void iterateUsingEntries(Multimap<String, String> multiMap) {
multiMap.entries()
.forEach(entry -> LOGGER.info("{} => {}", entry.getKey(), entry.getValue()));
}
static void iterateUsingAsMap(Multimap<String, String> multiMap) {
multiMap.asMap()
.entrySet()
.forEach(entry -> LOGGER.info("{} => {}", entry.getKey(), entry.getValue()));
}
static void iterateUsingKeySet(Multimap<String, String> multiMap) {
multiMap.keySet()
.forEach(LOGGER::info);
}
static void iterateUsingKeys(Multimap<String, String> multiMap) {
multiMap.keys() | .forEach(LOGGER::info);
}
static void iterateUsingValues(Multimap<String, String> multiMap) {
multiMap.values()
.forEach(LOGGER::info);
}
public static void main(String[] args) {
Multimap<String, String> multiMap = ArrayListMultimap.create();
multiMap.putAll("key1", List.of("value1", "value11", "value111"));
multiMap.putAll("key2", List.of("value2", "value22", "value222"));
multiMap.putAll("key3", List.of("value3", "value33", "value333"));
iterateUsingEntries(multiMap);
iterateUsingAsMap(multiMap);
iterateUsingKeys(multiMap);
iterateUsingKeySet(multiMap);
iterateUsingValues(multiMap);
}
} | repos\tutorials-master\guava-modules\guava-collections-map\src\main\java\com\baeldung\guava\multimap\MultimapIteration.java | 1 |
请完成以下Java代码 | public Pet getPet(Integer id) {
for (Pet pet : getPets()) {
if (!pet.isNew()) {
Integer compId = pet.getId();
if (Objects.equals(compId, id)) {
return pet;
}
}
}
return null;
}
/**
* Return the Pet with the given name, or null if none found for this Owner.
* @param name to test
* @param ignoreNew whether to ignore new pets (pets that are not saved yet)
* @return the Pet with the given name, or null if no such Pet exists for this Owner
*/
public Pet getPet(String name, boolean ignoreNew) {
for (Pet pet : getPets()) {
String compName = pet.getName();
if (compName != null && compName.equalsIgnoreCase(name)) {
if (!ignoreNew || !pet.isNew()) {
return pet;
}
}
}
return null;
}
@Override
public String toString() {
return new ToStringCreator(this).append("id", this.getId())
.append("new", this.isNew())
.append("lastName", this.getLastName())
.append("firstName", this.getFirstName())
.append("address", this.address)
.append("city", this.city) | .append("telephone", this.telephone)
.toString();
}
/**
* Adds the given {@link Visit} to the {@link Pet} with the given identifier.
* @param petId the identifier of the {@link Pet}, must not be {@literal null}.
* @param visit the visit to add, must not be {@literal null}.
*/
public void addVisit(Integer petId, Visit visit) {
Assert.notNull(petId, "Pet identifier must not be null!");
Assert.notNull(visit, "Visit must not be null!");
Pet pet = getPet(petId);
Assert.notNull(pet, "Invalid Pet identifier!");
pet.addVisit(visit);
}
} | repos\spring-petclinic-main\src\main\java\org\springframework\samples\petclinic\owner\Owner.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class SupplyRequiredDecreasedHandler implements MaterialEventHandler<SupplyRequiredDecreasedEvent>
{
private static final Logger log = LogManager.getLogger(SupplyRequiredDecreasedHandler.class);
@NonNull private final List<SupplyRequiredAdvisor> supplyRequiredAdvisors;
@NonNull private final SupplyRequiredHandlerHelper helper;
@Override
public Collection<Class<? extends SupplyRequiredDecreasedEvent>> getHandledEventType()
{
return ImmutableList.of(SupplyRequiredDecreasedEvent.class);
}
@Override
public void handleEvent(@NonNull final SupplyRequiredDecreasedEvent event)
{
final SupplyRequiredDescriptor descriptor = event.getSupplyRequiredDescriptor();
final MaterialPlanningContext context = helper.createContextOrNull(descriptor);
final MaterialDescriptor materialDescriptor = descriptor.getMaterialDescriptor();
Quantity remainingQtyToHandle = Quantitys.of(materialDescriptor.getQuantity(), ProductId.ofRepoId(materialDescriptor.getProductId()));
Loggables.withLogger(log, Level.DEBUG).addLog("Trying to decrease supply of {} by {}.", descriptor.getOrderId(), remainingQtyToHandle); | if (context != null)
{
for (final SupplyRequiredAdvisor advisor : supplyRequiredAdvisors)
{
if (remainingQtyToHandle.signum() > 0)
{
remainingQtyToHandle = advisor.handleQuantityDecrease(event, remainingQtyToHandle);
}
}
}
if (remainingQtyToHandle.signum() > 0)
{
Loggables.withLogger(log, Level.WARN).addLog("Could not decrease the qty for event {}. Qty left: {}", event, remainingQtyToHandle);
SupplyRequiredDecreasedNotificationProducer.newInstance().sendNotification(context, descriptor, remainingQtyToHandle);
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.material\planning\src\main\java\de\metas\material\planning\event\SupplyRequiredDecreasedHandler.java | 2 |
请完成以下Java代码 | protected void channelRead0(ChannelHandlerContext ctx, FullHttpRequest msg) throws Exception {
String uri = msg.uri();
HttpMethod httpMethod = msg.method();
HttpHeaders headers = msg.headers();
if (HttpMethod.GET == httpMethod) {
String[] uriComponents = uri.split("[?]");
String endpoint = uriComponents[0];
String[] queryParams = uriComponents[1].split("&");
if ("/calculate".equalsIgnoreCase(endpoint)) {
String[] firstQueryParam = queryParams[0].split("="); | String[] secondQueryParam = queryParams[1].split("=");
Integer a = Integer.valueOf(firstQueryParam[1]);
Integer b = Integer.valueOf(secondQueryParam[1]);
String operator = headers.get("operator");
Operation operation = new Operation(a, b, operator);
ctx.fireChannelRead(operation);
}
} else {
throw new UnsupportedOperationException("HTTP method not supported");
}
}
} | repos\tutorials-master\libraries-server-2\src\main\java\com\baeldung\netty\HttpMessageHandler.java | 1 |
请完成以下Java代码 | public void clear() {
internal = new Object[0];
}
@Override
public int indexOf(Object object) {
for (int i = 0; i < internal.length; i++) {
if (object.equals(internal[i])) {
return i;
}
}
return -1;
}
@Override
public int lastIndexOf(Object object) {
for (int i = internal.length - 1; i >= 0; i--) {
if (object.equals(internal[i])) {
return i;
}
}
return -1;
}
@SuppressWarnings("unchecked")
@Override
public List<E> subList(int fromIndex, int toIndex) {
Object[] temp = new Object[toIndex - fromIndex];
System.arraycopy(internal, fromIndex, temp, 0, temp.length);
return (List<E>) Arrays.asList(temp);
}
@Override
public Object[] toArray() {
return Arrays.copyOf(internal, internal.length);
}
@SuppressWarnings("unchecked")
@Override
public <T> T[] toArray(T[] array) {
if (array.length < internal.length) {
return (T[]) Arrays.copyOf(internal, internal.length, array.getClass());
}
System.arraycopy(internal, 0, array, 0, internal.length);
if (array.length > internal.length) {
array[internal.length] = null;
}
return array;
}
@Override
public Iterator<E> iterator() {
return new CustomIterator();
} | @Override
public ListIterator<E> listIterator() {
return null;
}
@Override
public ListIterator<E> listIterator(int index) {
// ignored for brevity
return null;
}
private class CustomIterator implements Iterator<E> {
int index;
@Override
public boolean hasNext() {
return index != internal.length;
}
@SuppressWarnings("unchecked")
@Override
public E next() {
E element = (E) CustomList.this.internal[index];
index++;
return element;
}
}
} | repos\tutorials-master\core-java-modules\core-java-collections-list-7\src\main\java\com\baeldung\list\CustomList.java | 1 |
请完成以下Java代码 | public @Nullable Authentication getAuthenticationResult() {
return this.authenticationResult;
}
/**
* Set the {@link Authentication} result that was observed
* @param authenticationResult the observed {@link Authentication} result
*/
public void setAuthenticationResult(Authentication authenticationResult) {
this.authenticationResult = authenticationResult;
}
/**
* Get the {@link AuthenticationManager} class that processed the authentication
* @return the observed {@link AuthenticationManager} class | */
public @Nullable Class<?> getAuthenticationManagerClass() {
return this.authenticationManager;
}
/**
* Set the {@link AuthenticationManager} class that processed the authentication
* @param authenticationManagerClass the observed {@link AuthenticationManager} class
*/
public void setAuthenticationManagerClass(Class<?> authenticationManagerClass) {
Assert.notNull(authenticationManagerClass, "authenticationManagerClass class cannot be null");
this.authenticationManager = authenticationManagerClass;
}
} | repos\spring-security-main\core\src\main\java\org\springframework\security\authentication\AuthenticationObservationContext.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class PickingJobScheduleId implements RepoIdAware
{
private static final String TABLE_NAME = "M_Picking_Job_Schedule"; // cannot access I_M_Picking_Job_Schedule.Table_Name from here
int repoId;
private PickingJobScheduleId(final int repoId)
{
this.repoId = Check.assumeGreaterThanZero(repoId, "M_Picking_Job_Schedule_ID");
}
@Override
@JsonValue
public int getRepoId() {return repoId;}
@JsonCreator
public static PickingJobScheduleId ofRepoId(final int repoId) {return new PickingJobScheduleId(repoId);} | public static PickingJobScheduleId ofRepoIdOrNull(final int repoId) {return repoId > 0 ? new PickingJobScheduleId(repoId) : null;}
public static int toRepoId(final PickingJobScheduleId id) {return id != null ? id.getRepoId() : -1;}
public static boolean equals(@Nullable final PickingJobScheduleId id1, @Nullable final PickingJobScheduleId id2) {return Objects.equals(id1, id2);}
public TableRecordReference toTableRecordReference()
{
return TableRecordReference.of(TABLE_NAME, repoId);
}
public static TableRecordReferenceSet toTableRecordReferenceSet(@NonNull final Set<PickingJobScheduleId> ids)
{
return TableRecordReferenceSet.of(TABLE_NAME, ids);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\picking\api\PickingJobScheduleId.java | 2 |
请完成以下Java代码 | private void closeZipFileSystem(FileSystem zipFileSystem) {
try {
zipFileSystem.close();
}
catch (Exception ex) {
// Ignore
}
}
@Override
public boolean isOpen() {
return !this.closed;
}
@Override
public boolean isReadOnly() {
return true;
}
@Override
public String getSeparator() {
return "/!";
}
@Override
public Iterable<Path> getRootDirectories() {
assertNotClosed();
return Collections.emptySet();
}
@Override
public Iterable<FileStore> getFileStores() {
assertNotClosed();
return Collections.emptySet();
}
@Override
public Set<String> supportedFileAttributeViews() {
assertNotClosed();
return SUPPORTED_FILE_ATTRIBUTE_VIEWS;
}
@Override
public Path getPath(String first, String... more) {
assertNotClosed();
if (more.length != 0) {
throw new IllegalArgumentException("Nested paths must contain a single element");
}
return new NestedPath(this, first);
}
@Override
public PathMatcher getPathMatcher(String syntaxAndPattern) {
throw new UnsupportedOperationException("Nested paths do not support path matchers");
}
@Override
public UserPrincipalLookupService getUserPrincipalLookupService() {
throw new UnsupportedOperationException("Nested paths do not have a user principal lookup service");
}
@Override
public WatchService newWatchService() throws IOException {
throw new UnsupportedOperationException("Nested paths do not support the WatchService");
} | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
NestedFileSystem other = (NestedFileSystem) obj;
return this.jarPath.equals(other.jarPath);
}
@Override
public int hashCode() {
return this.jarPath.hashCode();
}
@Override
public String toString() {
return this.jarPath.toAbsolutePath().toString();
}
private void assertNotClosed() {
if (this.closed) {
throw new ClosedFileSystemException();
}
}
} | repos\spring-boot-4.0.1\loader\spring-boot-loader\src\main\java\org\springframework\boot\loader\nio\file\NestedFileSystem.java | 1 |
请完成以下Java代码 | public void setLogoutHandler(LogoutHandler logoutHandler) {
Assert.notNull(logoutHandler, "logoutHandler cannot be null");
this.logoutHandler = logoutHandler;
}
private void performLogout(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) {
OidcLogoutAuthenticationToken oidcLogoutAuthentication = (OidcLogoutAuthenticationToken) authentication;
// Check for active user session
if (oidcLogoutAuthentication.isPrincipalAuthenticated()) {
this.securityContextLogoutHandler.logout(request, response,
(Authentication) oidcLogoutAuthentication.getPrincipal());
}
}
private void sendLogoutRedirect(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws IOException {
OidcLogoutAuthenticationToken oidcLogoutAuthentication = (OidcLogoutAuthenticationToken) authentication;
String redirectUri = "/"; | if (oidcLogoutAuthentication.isAuthenticated()
&& StringUtils.hasText(oidcLogoutAuthentication.getPostLogoutRedirectUri())) {
// Use the `post_logout_redirect_uri` parameter
UriComponentsBuilder uriBuilder = UriComponentsBuilder
.fromUriString(oidcLogoutAuthentication.getPostLogoutRedirectUri());
if (StringUtils.hasText(oidcLogoutAuthentication.getState())) {
uriBuilder.queryParam(OAuth2ParameterNames.STATE,
UriUtils.encode(oidcLogoutAuthentication.getState(), StandardCharsets.UTF_8));
}
// build(true) -> Components are explicitly encoded
redirectUri = uriBuilder.build(true).toUriString();
}
this.redirectStrategy.sendRedirect(request, response, redirectUri);
}
} | repos\spring-security-main\oauth2\oauth2-authorization-server\src\main\java\org\springframework\security\oauth2\server\authorization\oidc\web\authentication\OidcLogoutAuthenticationSuccessHandler.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void download(List<MenuDto> menuDtos, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (MenuDto menuDTO : menuDtos) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("菜单标题", menuDTO.getTitle());
map.put("菜单类型", menuDTO.getType() == null ? "目录" : menuDTO.getType() == 1 ? "菜单" : "按钮");
map.put("权限标识", menuDTO.getPermission());
map.put("外链菜单", menuDTO.getIFrame() ? YES_STR : NO_STR);
map.put("菜单可见", menuDTO.getHidden() ? NO_STR : YES_STR);
map.put("是否缓存", menuDTO.getCache() ? YES_STR : NO_STR);
map.put("创建日期", menuDTO.getCreateTime());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
private void updateSubCnt(Long menuId){
if(menuId != null){
int count = menuRepository.countByPid(menuId);
menuRepository.updateSubCntById(count, menuId);
}
}
/**
* 清理缓存
* @param id 菜单ID
*/
public void delCaches(Long id){
List<User> users = userRepository.findByMenuId(id);
redisUtils.del(CacheKey.MENU_ID + id);
redisUtils.delByKeys(CacheKey.MENU_USER, users.stream().map(User::getId).collect(Collectors.toSet()));
// 清除 Role 缓存
List<Role> roles = roleService.findInMenuId(new ArrayList<Long>(){{
add(id);
}});
redisUtils.delByKeys(CacheKey.ROLE_ID, roles.stream().map(Role::getId).collect(Collectors.toSet()));
} | /**
* 构建前端路由
* @param menuDTO /
* @param menuVo /
* @return /
*/
private static MenuVo getMenuVo(MenuDto menuDTO, MenuVo menuVo) {
MenuVo menuVo1 = new MenuVo();
menuVo1.setMeta(menuVo.getMeta());
// 非外链
if(!menuDTO.getIFrame()){
menuVo1.setPath("index");
menuVo1.setName(menuVo.getName());
menuVo1.setComponent(menuVo.getComponent());
} else {
menuVo1.setPath(menuDTO.getPath());
}
return menuVo1;
}
} | repos\eladmin-master\eladmin-system\src\main\java\me\zhengjie\modules\system\service\impl\MenuServiceImpl.java | 2 |
请完成以下Java代码 | public class CaseFileItemDefinitionImpl extends CmmnElementImpl implements CaseFileItemDefinition {
protected static Attribute<String> nameAttribute;
protected static Attribute<String> definitionTypeAttribute;
// structureRef should be a QName, but it is not clear
// what kind of element the attribute value should reference,
// that's why we use a simple String
protected static Attribute<String> structureAttribute;
// TODO: The Import does not have an id attribute!
// protected static AttributeReference<Import> importRefAttribute;
protected static ChildElementCollection<Property> propertyCollection;
public CaseFileItemDefinitionImpl(ModelTypeInstanceContext instanceContext) {
super(instanceContext);
}
public String getName() {
return nameAttribute.getValue(this);
}
public void setName(String name) {
nameAttribute.setValue(this, name);
}
public String getDefinitionType() {
return definitionTypeAttribute.getValue(this);
}
public void setDefinitionType(String definitionType) {
definitionTypeAttribute.setValue(this, definitionType);
}
public String getStructure() {
return structureAttribute.getValue(this);
}
public void setStructure(String structureRef) {
structureAttribute.setValue(this, structureRef);
}
// public Import getImport() {
// return importRefAttribute.getReferenceTargetElement(this);
// }
//
// public void setImport(Import importRef) {
// importRefAttribute.setReferenceTargetElement(this, importRef);
// }
public Collection<Property> getProperties() {
return propertyCollection.get(this);
} | public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(CaseFileItemDefinition.class, CMMN_ELEMENT_CASE_FILE_ITEM_DEFINITION)
.namespaceUri(CMMN11_NS)
.extendsType(CmmnElement.class)
.instanceProvider(new ModelTypeInstanceProvider<CaseFileItemDefinition>() {
public CaseFileItemDefinition newInstance(ModelTypeInstanceContext instanceContext) {
return new CaseFileItemDefinitionImpl(instanceContext);
}
});
nameAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_NAME)
.build();
definitionTypeAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_DEFINITION_TYPE)
.defaultValue("http://www.omg.org/spec/CMMN/DefinitionType/Unspecified")
.build();
structureAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_STRUCTURE_REF)
.build();
// TODO: The Import does not have an id attribute!
// importRefAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_IMPORT_REF)
// .qNameAttributeReference(Import.class)
// .build();
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
propertyCollection = sequenceBuilder.elementCollection(Property.class)
.build();
typeBuilder.build();
}
} | repos\camunda-bpm-platform-master\model-api\cmmn-model\src\main\java\org\camunda\bpm\model\cmmn\impl\instance\CaseFileItemDefinitionImpl.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public String getAccessFile() {
return this.accessFile;
}
public void setAccessFile(String accessFile) {
this.accessFile = accessFile;
}
public String getBindAddress() {
return this.bindAddress;
}
public void setBindAddress(String bindAddress) {
this.bindAddress = bindAddress;
}
public String getHostnameForClients() {
return this.hostnameForClients;
}
public void setHostnameForClients(String hostnameForClients) {
this.hostnameForClients = hostnameForClients;
}
public String getPasswordFile() {
return this.passwordFile;
}
public void setPasswordFile(String passwordFile) {
this.passwordFile = passwordFile; | }
public int getPort() {
return this.port;
}
public void setPort(int port) {
this.port = port;
}
public boolean isStart() {
return this.start;
}
public void setStart(boolean start) {
this.start = start;
}
public int getUpdateRate() {
return this.updateRate;
}
public void setUpdateRate(int updateRate) {
this.updateRate = updateRate;
}
} | repos\spring-boot-data-geode-main\spring-geode-project\spring-geode-autoconfigure\src\main\java\org\springframework\geode\boot\autoconfigure\configuration\support\ManagerProperties.java | 2 |
请完成以下Java代码 | public java.sql.Timestamp getLastSyncOfRemoteToLocal ()
{
return (java.sql.Timestamp)get_Value(COLUMNNAME_LastSyncOfRemoteToLocal);
}
/** Set Letzter Synchronisierungsstatus.
@param LastSyncStatus Letzter Synchronisierungsstatus */
@Override
public void setLastSyncStatus (java.lang.String LastSyncStatus)
{
set_Value (COLUMNNAME_LastSyncStatus, LastSyncStatus);
}
/** Get Letzter Synchronisierungsstatus.
@return Letzter Synchronisierungsstatus */
@Override
public java.lang.String getLastSyncStatus ()
{
return (java.lang.String)get_Value(COLUMNNAME_LastSyncStatus);
}
/** Set MKTG_ContactPerson.
@param MKTG_ContactPerson_ID MKTG_ContactPerson */
@Override
public void setMKTG_ContactPerson_ID (int MKTG_ContactPerson_ID)
{
if (MKTG_ContactPerson_ID < 1)
set_ValueNoCheck (COLUMNNAME_MKTG_ContactPerson_ID, null);
else
set_ValueNoCheck (COLUMNNAME_MKTG_ContactPerson_ID, Integer.valueOf(MKTG_ContactPerson_ID));
}
/** Get MKTG_ContactPerson.
@return MKTG_ContactPerson */
@Override
public int getMKTG_ContactPerson_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_MKTG_ContactPerson_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public de.metas.marketing.base.model.I_MKTG_Platform getMKTG_Platform() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_MKTG_Platform_ID, de.metas.marketing.base.model.I_MKTG_Platform.class);
}
@Override
public void setMKTG_Platform(de.metas.marketing.base.model.I_MKTG_Platform MKTG_Platform)
{
set_ValueFromPO(COLUMNNAME_MKTG_Platform_ID, de.metas.marketing.base.model.I_MKTG_Platform.class, MKTG_Platform);
}
/** Set MKTG_Platform.
@param MKTG_Platform_ID MKTG_Platform */
@Override
public void setMKTG_Platform_ID (int MKTG_Platform_ID)
{
if (MKTG_Platform_ID < 1)
set_Value (COLUMNNAME_MKTG_Platform_ID, null);
else
set_Value (COLUMNNAME_MKTG_Platform_ID, Integer.valueOf(MKTG_Platform_ID));
}
/** Get MKTG_Platform.
@return MKTG_Platform */
@Override | public int getMKTG_Platform_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_MKTG_Platform_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
@Override
public void setName (java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
@Override
public java.lang.String getName ()
{
return (java.lang.String)get_Value(COLUMNNAME_Name);
}
/** Set Externe Datensatz-ID.
@param RemoteRecordId Externe Datensatz-ID */
@Override
public void setRemoteRecordId (java.lang.String RemoteRecordId)
{
set_Value (COLUMNNAME_RemoteRecordId, RemoteRecordId);
}
/** Get Externe Datensatz-ID.
@return Externe Datensatz-ID */
@Override
public java.lang.String getRemoteRecordId ()
{
return (java.lang.String)get_Value(COLUMNNAME_RemoteRecordId);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.marketing\base\src\main\java-gen\de\metas\marketing\base\model\X_MKTG_ContactPerson.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class User extends AbstractEntity
{
@ManyToOne(fetch = FetchType.EAGER)
@NonNull
private BPartner bpartner;
@NonNull
private String email;
private String password;
private String language;
@Nullable
private String passwordResetKey;
@Nullable
private Long deleted_id;
public User()
{
super();
}
@Override
protected void toString(final MoreObjects.ToStringHelper toStringHelper)
{
toStringHelper
.add("email", email)
.add("language", language)
// WARNING: never ever output the password
;
}
public Long getBpartnerId()
{
return getBpartner().getId();
}
public BPartner getBpartner()
{
return bpartner;
}
public void setBpartner(final BPartner bpartner)
{
this.bpartner = bpartner;
}
public String getEmail()
{
return email;
}
public void setEmail(final String email)
{
this.email = email;
} | public void setLanguage(final String language)
{
this.language = language;
}
public String getLanguage()
{
return language;
}
public LanguageKey getLanguageKeyOrDefault()
{
final LanguageKey languageKey = LanguageKey.ofNullableString(getLanguage());
return languageKey != null ? languageKey : LanguageKey.getDefault();
}
public String getPassword()
{
return password;
}
public void setPassword(final String password)
{
this.password = password;
}
@Nullable
public String getPasswordResetKey()
{
return passwordResetKey;
}
public void setPasswordResetKey(@Nullable final String passwordResetKey)
{
this.passwordResetKey = passwordResetKey;
}
public void markDeleted()
{
setDeleted(true);
deleted_id = getId(); // FRESH-176: set the delete_id to current ID just to avoid the unique constraint
}
public void markNotDeleted()
{
setDeleted(false);
deleted_id = null; // FRESH-176: set the delete_id to NULL just to make sure the the unique index is enforced
}
@Nullable
@VisibleForTesting
public Long getDeleted_id()
{
return deleted_id;
}
} | repos\metasfresh-new_dawn_uat\misc\services\procurement-webui\procurement-webui-backend\src\main\java\de\metas\procurement\webui\model\User.java | 2 |
请完成以下Java代码 | private final void executeQuery(final IFacet<?> triggeringFacet)
{
final boolean alreadyRunning = queryRunning.getAndSet(true);
if (alreadyRunning)
{
// do nothing if query is already running
return;
}
try
{
//
// Get current active facets and filter the data source
final IFacetsPool<ModelType> facetsPool = getFacetsPool();
final Set<IFacet<ModelType>> facets = facetsPool.getActiveFacets();
final IFacetFilterable<ModelType> facetFilterable = getFacetFilterable();
facetFilterable.filter(facets);
//
// After filtering the datasource, we need to update all facet categories which are eager to refresh.
facetCollectors.collect()
.setSource(facetFilterable)
// Don't update facets from the same category as our triggering facets
.excludeFacetCategory(triggeringFacet.getFacetCategory())
// Update only those facet groups on which we also "eager refreshing"
.setOnlyEagerRefreshCategories()
.collectAndUpdate(facetsPool);
}
finally
{
queryRunning.set(false);
} | }
/**
* Collect all facets from registered {@link IFacetCollector}s and then set them to {@link IFacetsPool}.
*
* If this executor has already a query which is running ({@link #isQueryRunning()}), this method will do nothing.
*/
public void collectFacetsAndResetPool()
{
// Do nothing if we have query which is currently running,
// because it most of the cases this happends because some business logic
// was triggered when the underlying facet filterable was changed due to our current running query
// and which triggered this method.
// If we would not prevent this, we could run in endless recursive calls.
if (isQueryRunning())
{
return;
}
//
// Before collecting ALL facets from this data source, make sure the database source is reset to it's inital state.
final IFacetFilterable<ModelType> facetFilterable = getFacetFilterable();
facetFilterable.reset();
//
// Collect the facets from facet filterable's current selection
// and set them to facets pool
facetCollectors.collect()
.setSource(facetFilterable)
.collectAndSet(getFacetsPool());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\facet\impl\FacetExecutor.java | 1 |
请完成以下Java代码 | public CaseInstanceQuery orderByCaseInstanceId() {
orderBy(CaseInstanceQueryProperty.CASE_INSTANCE_ID);
return this;
}
public CaseInstanceQuery orderByCaseDefinitionKey() {
orderBy(new QueryOrderingProperty(QueryOrderingProperty.RELATION_CASE_DEFINITION,
CaseInstanceQueryProperty.CASE_DEFINITION_KEY));
return this;
}
public CaseInstanceQuery orderByCaseDefinitionId() {
orderBy(CaseInstanceQueryProperty.CASE_DEFINITION_ID);
return this;
}
public CaseInstanceQuery orderByTenantId() {
orderBy(CaseInstanceQueryProperty.TENANT_ID);
return this;
}
//results /////////////////////////////////////////////////////////////////
public long executeCount(CommandContext commandContext) {
checkQueryOk();
ensureVariablesInitialized();
return commandContext
.getCaseExecutionManager()
.findCaseInstanceCountByQueryCriteria(this);
}
public List<CaseInstance> executeList(CommandContext commandContext, Page page) {
checkQueryOk();
ensureVariablesInitialized();
return commandContext
.getCaseExecutionManager()
.findCaseInstanceByQueryCriteria(this, page);
}
//getters /////////////////////////////////////////////////////////////////
public String getCaseInstanceId() {
return caseExecutionId;
}
public String getCaseExecutionId() {
return caseExecutionId;
}
public String getActivityId() {
return null;
} | public String getBusinessKey() {
return businessKey;
}
public String getCaseDefinitionId() {
return caseDefinitionId;
}
public String getCaseDefinitionKey() {
return caseDefinitionKey;
}
public String getDeploymentId() {
return deploymentId;
}
public CaseExecutionState getState() {
return state;
}
public boolean isCaseInstancesOnly() {
return true;
}
public String getSuperProcessInstanceId() {
return superProcessInstanceId;
}
public String getSubProcessInstanceId() {
return subProcessInstanceId;
}
public String getSuperCaseInstanceId() {
return superCaseInstanceId;
}
public String getSubCaseInstanceId() {
return subCaseInstanceId;
}
public Boolean isRequired() {
return required;
}
public Boolean isRepeatable() {
return repeatable;
}
public Boolean isRepetition() {
return repetition;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmmn\entity\runtime\CaseInstanceQueryImpl.java | 1 |
请完成以下Java代码 | public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(ConversationNode.class, BPMN_ELEMENT_CONVERSATION_NODE)
.namespaceUri(BPMN20_NS)
.extendsType(BaseElement.class)
.abstractType();
nameAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_NAME)
.build();
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
participantRefCollection = sequenceBuilder.elementCollection(ParticipantRef.class)
.qNameElementReferenceCollection(Participant.class)
.build();
messageFlowRefCollection = sequenceBuilder.elementCollection(MessageFlowRef.class)
.qNameElementReferenceCollection(MessageFlow.class)
.build();
correlationKeyCollection = sequenceBuilder.elementCollection(CorrelationKey.class)
.build();
typeBuilder.build();
}
public ConversationNodeImpl(ModelTypeInstanceContext instanceContext) {
super(instanceContext);
} | public String getName() {
return nameAttribute.getValue(this);
}
public void setName(String name) {
nameAttribute.setValue(this, name);
}
public Collection<Participant> getParticipants() {
return participantRefCollection.getReferenceTargetElements(this);
}
public Collection<MessageFlow> getMessageFlows() {
return messageFlowRefCollection.getReferenceTargetElements(this);
}
public Collection<CorrelationKey> getCorrelationKeys() {
return correlationKeyCollection.get(this);
}
} | repos\camunda-bpm-platform-master\model-api\bpmn-model\src\main\java\org\camunda\bpm\model\bpmn\impl\instance\ConversationNodeImpl.java | 1 |
请完成以下Java代码 | public void setJoinTable(String joinTable)
{
if (joinTable == null || joinTable.length() == 0)
return;
m_joinTable = joinTable;
if (m_joinAlias.equals(joinTable))
m_joinAlias = "";
} // setJoinTable
/**
* Get Join Table Name
* @return Join Table Name
*/
public String getJoinTable()
{
return m_joinTable;
} // getJoinTable
/*************************************************************************/
/**
* This Join is a condition of the first Join.
* e.g. tb.AD_User_ID(+)=? or tb.AD_User_ID(+)='123'
* @param first
* @return true if condition
*/
public boolean isConditionOf (Join first)
{
if (m_mainTable == null // did not find Table from "Alias" | && (first.getJoinTable().equals(m_joinTable) // same join table
|| first.getMainAlias().equals(m_joinTable))) // same main table
return true;
return false;
} // isConditionOf
/**
* String representation
* @return info
*/
@Override
public String toString()
{
StringBuffer sb = new StringBuffer ("Join[");
sb.append(m_joinClause)
.append(" - Main=").append(m_mainTable).append("/").append(m_mainAlias)
.append(", Join=").append(m_joinTable).append("/").append(m_joinAlias)
.append(", Left=").append(m_left)
.append(", Condition=").append(m_condition)
.append("]");
return sb.toString();
} // toString
} // Join | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\dbPort\Join.java | 1 |
请在Spring Boot框架中完成以下Java代码 | default List<String> tagList(String source) {
if (source == null) {
return null;
}
return Arrays.stream(source.split(",")).toList();
}
default String tagList(List<Tag> source) {
if (source == null || source.isEmpty()) {
return null;
}
return source.stream().map(Tag::name).collect(Collectors.joining(","));
}
default List<ArticleTagJdbcEntity> tagIds(List<Tag> source) {
return source.stream().map(t -> new ArticleTagJdbcEntity(t.id())).toList();
}
default List<Tag> tags(ArticleJdbcEntity source) {
var tagIds = source.tagIds();
if (tagIds != null) {
var tagList = source.tagList();
if (tagList != null) {
var tagNames = tagList.split(","); | if (tagNames.length == tagIds.size()) {
List<Tag> tags = new ArrayList<>();
for (var i = 0; i < tagIds.size(); i++) {
var tag = new Tag(tagIds.get(i).tagId(), tagNames[i]);
tags.add(tag);
}
return tags;
}
}
}
return List.of();
}
}
} | repos\realworld-backend-spring-master\service\src\main\java\com\github\al\realworld\infrastructure\db\jdbc\ArticleJdbcRepositoryAdapter.java | 2 |
请完成以下Java代码 | public static DecisionEvaluationBuilder evaluateDecisionTableByKey(CommandExecutor commandExecutor, String decisionDefinitionKey) {
DecisionTableEvaluationBuilderImpl builder = new DecisionTableEvaluationBuilderImpl(commandExecutor);
builder.decisionDefinitionKey = decisionDefinitionKey;
return builder;
}
public static DecisionEvaluationBuilder evaluateDecisionTableById(CommandExecutor commandExecutor, String decisionDefinitionId) {
DecisionTableEvaluationBuilderImpl builder = new DecisionTableEvaluationBuilderImpl(commandExecutor);
builder.decisionDefinitionId = decisionDefinitionId;
return builder;
}
// getters ////////////////////////////////////
public String getDecisionDefinitionKey() {
return decisionDefinitionKey;
}
public String getDecisionDefinitionId() {
return decisionDefinitionId;
} | public Integer getVersion() {
return version;
}
public Map<String, Object> getVariables() {
return variables;
}
public String getDecisionDefinitionTenantId() {
return decisionDefinitionTenantId;
}
public boolean isTenantIdSet() {
return isTenantIdSet;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\dmn\DecisionTableEvaluationBuilderImpl.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public Map<String, ServiceLevelObjectiveBoundary[]> getSlo() {
return this.slo;
}
public Map<String, String> getMinimumExpectedValue() {
return this.minimumExpectedValue;
}
public Map<String, String> getMaximumExpectedValue() {
return this.maximumExpectedValue;
}
public Map<String, Duration> getExpiry() {
return this.expiry;
}
public Map<String, Integer> getBufferLength() {
return this.bufferLength;
}
} | public static class Observations {
/**
* Meters that should be ignored when recoding observations.
*/
private Set<IgnoredMeters> ignoredMeters = new LinkedHashSet<>();
public Set<IgnoredMeters> getIgnoredMeters() {
return this.ignoredMeters;
}
public void setIgnoredMeters(Set<IgnoredMeters> ignoredMeters) {
this.ignoredMeters = ignoredMeters;
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-micrometer-metrics\src\main\java\org\springframework\boot\micrometer\metrics\autoconfigure\MetricsProperties.java | 2 |
请完成以下Java代码 | public String getTableName()
{
return tableName;
}
@Override
public Date getStartDate()
{
return startDate;
}
@Override
public long getHitCount()
{
return hitCount.longValue();
}
@Override
public void incrementHitCount()
{
hitCount.incrementAndGet();
}
@Override
public long getHitInTrxCount()
{
return hitInTrxCount.longValue();
}
@Override
public void incrementHitInTrxCount()
{
hitInTrxCount.incrementAndGet();
}
@Override
public long getMissCount()
{
return missCount.longValue();
}
@Override
public void incrementMissCount()
{
missCount.incrementAndGet();
}
@Override
public long getMissInTrxCount()
{ | return missInTrxCount.longValue();
}
@Override
public void incrementMissInTrxCount()
{
missInTrxCount.incrementAndGet();
}
@Override
public boolean isCacheEnabled()
{
if (cacheConfig != null)
{
return cacheConfig.isEnabled();
}
// if no caching config is provided, it means we are dealing with an overall statistics
// so we consider caching as Enabled
return true;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\cache\model\impl\TableCacheStatistics.java | 1 |
请完成以下Java代码 | public void setProcessing (boolean Processing)
{
set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
}
/** Get Process Now.
@return Process Now */
public boolean isProcessing ()
{
Object oo = get_Value(COLUMNNAME_Processing);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Training.
@param S_Training_ID
Repeated Training
*/ | public void setS_Training_ID (int S_Training_ID)
{
if (S_Training_ID < 1)
set_ValueNoCheck (COLUMNNAME_S_Training_ID, null);
else
set_ValueNoCheck (COLUMNNAME_S_Training_ID, Integer.valueOf(S_Training_ID));
}
/** Get Training.
@return Repeated Training
*/
public int getS_Training_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_S_Training_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_S_Training.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class FileConvertQueueTask {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final FilePreviewFactory previewFactory;
private final CacheService cacheService;
private final FileHandlerService fileHandlerService;
public FileConvertQueueTask(FilePreviewFactory previewFactory, CacheService cacheService, FileHandlerService fileHandlerService) {
this.previewFactory = previewFactory;
this.cacheService = cacheService;
this.fileHandlerService = fileHandlerService;
}
@PostConstruct
public void startTask() {
new Thread(new ConvertTask(previewFactory, cacheService, fileHandlerService))
.start();
logger.info("队列处理文件转换任务启动完成 ");
}
static class ConvertTask implements Runnable {
private final Logger logger = LoggerFactory.getLogger(ConvertTask.class);
private final FilePreviewFactory previewFactory;
private final CacheService cacheService;
private final FileHandlerService fileHandlerService;
public ConvertTask(FilePreviewFactory previewFactory,
CacheService cacheService,
FileHandlerService fileHandlerService) {
this.previewFactory = previewFactory;
this.cacheService = cacheService;
this.fileHandlerService = fileHandlerService;
}
@Override
public void run() {
while (true) {
String url = null;
try {
url = cacheService.takeQueueTask();
if (url != null) { | FileAttribute fileAttribute = fileHandlerService.getFileAttribute(url, null);
FileType fileType = fileAttribute.getType();
logger.info("正在处理预览转换任务,url:{},预览类型:{}", url, fileType);
if (isNeedConvert(fileType)) {
FilePreview filePreview = previewFactory.get(fileAttribute);
filePreview.filePreviewHandle(url, new ExtendedModelMap(), fileAttribute);
} else {
logger.info("预览类型无需处理,url:{},预览类型:{}", url, fileType);
}
}
} catch (Exception e) {
try {
TimeUnit.SECONDS.sleep(10);
} catch (Exception ex) {
Thread.currentThread().interrupt();
logger.error("Failed to sleep after exception", ex);
}
logger.info("处理预览转换任务异常,url:{}", url, e);
}
}
}
public boolean isNeedConvert(FileType fileType) {
return fileType.equals(FileType.COMPRESS) || fileType.equals(FileType.OFFICE) || fileType.equals(FileType.CAD);
}
}
} | repos\kkFileView-master\server\src\main\java\cn\keking\service\FileConvertQueueTask.java | 2 |
请完成以下Java代码 | public void setStatus (String Status)
{
set_ValueNoCheck (COLUMNNAME_Status, Status);
}
/** Get Status.
@return Status of the currently running check
*/
public String getStatus ()
{
return (String)get_Value(COLUMNNAME_Status);
}
/** Set URL. | @param URL
Full URL address - e.g. http://www.adempiere.org
*/
public void setURL (String URL)
{
set_Value (COLUMNNAME_URL, URL);
}
/** Get URL.
@return Full URL address - e.g. http://www.adempiere.org
*/
public String getURL ()
{
return (String)get_Value(COLUMNNAME_URL);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\adempiere\ad\migration\model\X_AD_MigrationScript.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class GooglePage extends Base {
@Autowired
private SearchComponent searchComponent;
@Autowired
private SearchResult searchResult;
@Value("${application.url}")
private String url;
//launch website
public void goToGooglePage(){
this.driver.get(url);
}
public SearchComponent getSearchComponent() { | return searchComponent;
}
public SearchResult getSearchResult() {
return searchResult;
}
@Override
public boolean isAt() {
return this.searchComponent.isAt();
}
public void close(){
this.driver.quit();
}
} | repos\springboot-demo-master\Selenium\src\main\java\com\et\selenium\page\google\GooglePage.java | 2 |
请完成以下Java代码 | public class MemberDepartedEvent extends MembershipEvent<MemberDepartedEvent> {
private boolean crashed = false;
/**
* Constructs a new instance of {@link MemberDepartedEvent} initialized with the given {@link DistributionManager}.
*
* @param distributionManager {@link DistributionManager} used as the {@link #getSource() source} of this event;
* must not be {@literal null}.
* @throws IllegalArgumentException if {@link DistributionManager} is {@literal null}.
* @see org.apache.geode.distributed.internal.DistributionManager
*/
public MemberDepartedEvent(DistributionManager distributionManager) {
super(distributionManager);
}
/**
* Determines whether the peer member crashed when it departed from the {@link DistributedSystem} (cluster).
*
* @return a boolean value indicating whether the peer member crashed when it departed
* from the {@link DistributedSystem} (cluster).
*/
public boolean isCrashed() {
return this.crashed;
}
/** | * Builder method used to configure the {@link #isCrashed()} property indicating whether the peer member crashed
* when it departed from the {@link DistributedSystem}.
*
* @param crashed boolean value indicating whether the peer member crashed.
* @return this {@link MemberDepartedEvent}.
* @see #isCrashed()
*/
public MemberDepartedEvent crashed(boolean crashed) {
this.crashed = crashed;
return this;
}
/**
* @inheritDoc
*/
@Override
public final Type getType() {
return Type.MEMBER_DEPARTED;
}
} | repos\spring-boot-data-geode-main\spring-geode-project\apache-geode-extensions\src\main\java\org\springframework\geode\distributed\event\support\MemberDepartedEvent.java | 1 |
请完成以下Java代码 | public org.compiere.model.I_AD_Val_Rule getAD_Val_Rule() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_AD_Val_Rule_ID, org.compiere.model.I_AD_Val_Rule.class);
}
@Override
public void setAD_Val_Rule(org.compiere.model.I_AD_Val_Rule AD_Val_Rule)
{
set_ValueFromPO(COLUMNNAME_AD_Val_Rule_ID, org.compiere.model.I_AD_Val_Rule.class, AD_Val_Rule);
}
/** Set Dynamische Validierung.
@param AD_Val_Rule_ID
Regel für die dynamische Validierung
*/
@Override
public void setAD_Val_Rule_ID (int AD_Val_Rule_ID)
{
if (AD_Val_Rule_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_Val_Rule_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_Val_Rule_ID, Integer.valueOf(AD_Val_Rule_ID));
}
/** Get Dynamische Validierung.
@return Regel für die dynamische Validierung
*/
@Override
public int getAD_Val_Rule_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Val_Rule_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Technical note. | @param TechnicalNote
A note that is not indended for the user documentation, but for developers, customizers etc
*/
@Override
public void setTechnicalNote (java.lang.String TechnicalNote)
{
set_Value (COLUMNNAME_TechnicalNote, TechnicalNote);
}
/** Get Technical note.
@return A note that is not indended for the user documentation, but for developers, customizers etc
*/
@Override
public java.lang.String getTechnicalNote ()
{
return (java.lang.String)get_Value(COLUMNNAME_TechnicalNote);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Val_Rule_Dep.java | 1 |
请完成以下Java代码 | public static TaxCorrectionType ofCode(@NonNull final String code)
{
final TaxCorrectionType type = ofCodeOrNull(code);
if (type == null)
{
throw new AdempiereException("No " + TaxCorrectionType.class + " found for code: " + code);
}
return type;
}
public static TaxCorrectionType ofCodeOrNull(@NonNull final String code)
{
return typesByCode.get(code);
}
private static final ImmutableMap<String, TaxCorrectionType> typesByCode = Maps.uniqueIndex(Arrays.asList(values()), TaxCorrectionType::getCode); | public boolean isNone()
{
return this == NONE;
}
public boolean isDiscount()
{
return this == DISCOUNT_ONLY || this == WRITEOFF_AND_DISCOUNT;
}
public boolean isWriteOff()
{
return this == WRITEOFF_ONLY || this == WRITEOFF_AND_DISCOUNT;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\acct\api\TaxCorrectionType.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class ExternalSystemParentConfig
{
ExternalSystemParentConfigId id;
ExternalSystemType type;
String name;
boolean active;
OrgId orgId;
IExternalSystemChildConfig childConfig;
Boolean writeAudit;
@Getter(AccessLevel.NONE)
String auditFileFolder;
@Builder(toBuilder = true)
public ExternalSystemParentConfig(
@NonNull final ExternalSystemParentConfigId id,
@NonNull final ExternalSystemType type,
@NonNull final String name,
@NonNull final Boolean active,
@NonNull final OrgId orgId,
@NonNull final IExternalSystemChildConfig childConfig,
@NonNull final Boolean writeAudit,
@Nullable final String auditFileFolder)
{
if (!type.equals(childConfig.getId().getType()))
{
throw new AdempiereException("Child and parent ExternalSystemType don't match!")
.appendParametersToMessage()
.setParameter("childConfig", childConfig)
.setParameter("parentType", type);
}
this.id = id;
this.type = type; | this.name = name;
this.orgId = orgId;
this.childConfig = childConfig;
this.active = active;
this.writeAudit = writeAudit;
this.auditFileFolder = writeAudit
? Check.assumeNotNull(auditFileFolder, "If writeAudit==true, then auditFileFolder is set")
: null;
}
public ITableRecordReference getTableRecordReference()
{
return TableRecordReference.of(I_ExternalSystem_Config.Table_Name, this.id);
}
@Nullable
public String getAuditEndpointIfEnabled()
{
if (writeAudit)
{
return auditFileFolder;
}
return null;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java\de\metas\externalsystem\ExternalSystemParentConfig.java | 2 |
请完成以下Java代码 | public class Customer {
private String id, firstname, lastname;
/**
* Creates a new {@link Customer} with the given firstname and lastname.
*
* @param firstname must not be {@literal null} or empty.
* @param lastname must not be {@literal null} or empty.
*/
public Customer(String firstname, String lastname) {
Assert.hasText(firstname, "Firstname must not be null or empty!");
Assert.hasText(lastname, "Lastname must not be null or empty!");
this.firstname = firstname;
this.lastname = lastname;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getLastname() {
return lastname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
@Override
public String toString() {
return "Customer{" + "id='" + id + '\'' + ", firstname='" + firstname + '\'' + ", lastname='" + lastname + '\'' | + '}';
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
var customer = (Customer) o;
if (id != null ? !id.equals(customer.id) : customer.id != null)
return false;
if (firstname != null ? !firstname.equals(customer.firstname) : customer.firstname != null)
return false;
return lastname != null ? lastname.equals(customer.lastname) : customer.lastname == null;
}
@Override
public int hashCode() {
var result = id != null ? id.hashCode() : 0;
result = 31 * result + (firstname != null ? firstname.hashCode() : 0);
result = 31 * result + (lastname != null ? lastname.hashCode() : 0);
return result;
}
} | repos\spring-data-examples-main\mongodb\querydsl\src\main\java\example\springdata\mongodb\Customer.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class Foo implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "ID")
private Long id;
@Column(name = "NAME")
private String name;
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@OrderBy("index,name ASC")
List<Bar> bars;
public Foo() {
super();
}
public Foo(final String name) {
super();
this.name = name;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Foo other = (Foo) obj;
if (name == null) {
if (other.name != null) {
return false;
}
} else if (!name.equals(other.name)) {
return false; | }
return true;
}
public List<Bar> getBars() {
return bars;
}
public Long getId() {
return id;
}
public String getName() {
return name;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
public void setBars(List<Bar> bars) {
this.bars = bars;
}
public void setId(final Long id) {
this.id = id;
}
public void setName(final String name) {
this.name = name;
}
@Override
public String toString() {
final StringBuilder builder = new StringBuilder();
builder.append("Foo [name=")
.append(name)
.append("]");
return builder.toString();
}
} | repos\tutorials-master\persistence-modules\spring-hibernate-6\src\main\java\com\baeldung\hibernate\cache\model\Foo.java | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.