instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请完成以下Java代码
|
public void saveInventoryLineHURecords(final InventoryLine inventoryLine, final @NonNull InventoryId inventoryId)
{
inventoryRepository.saveInventoryLineHURecords(inventoryLine, inventoryId);
}
public Stream<InventoryReference> streamReferences(@NonNull final InventoryQuery query)
{
return inventoryRepository.streamReferences(query);
}
public Inventory updateById(@NonNull final InventoryId inventoryId, @NonNull final UnaryOperator<Inventory> updater)
{
return inventoryRepository.updateById(inventoryId, updater);
}
public void updateByQuery(@NonNull final InventoryQuery query, @NonNull final UnaryOperator<Inventory> updater)
{
inventoryRepository.updateByQuery(query, updater);
}
public DraftInventoryLinesCreateResponse createDraftLines(@NonNull final DraftInventoryLinesCreateRequest request)
|
{
return DraftInventoryLinesCreateCommand.builder()
.inventoryRepository(inventoryRepository)
.huForInventoryLineFactory(huForInventoryLineFactory)
.request(request)
.build()
.execute();
}
public void setQtyCountToQtyBookForInventory(@NonNull final InventoryId inventoryId)
{
inventoryRepository.setQtyCountToQtyBookForInventory(inventoryId);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\inventory\InventoryService.java
| 1
|
请完成以下Java代码
|
public abstract class Vehicle {
private String vehicleName;
private String vehicleModel;
private Long makeYear;
public Vehicle(String vehicleName) {
this.vehicleName = vehicleName;
}
public Vehicle(String vehicleName, String vehicleModel) {
this(vehicleName);
this.vehicleModel = vehicleModel;
}
public Vehicle(String vechicleName, String vehicleModel, Long makeYear) {
this(vechicleName, vehicleModel);
this.makeYear = makeYear;
}
public String getVehicleName() {
return vehicleName;
}
public void setVehicleName(String vehicleName) {
this.vehicleName = vehicleName;
}
public String getVehicleModel() {
return vehicleModel;
}
public void setVehicleModel(String vehicleModel) {
this.vehicleModel = vehicleModel;
}
|
public Long getMakeYear() {
return makeYear;
}
public void setMakeYear(Long makeYear) {
this.makeYear = makeYear;
}
protected abstract void start();
protected abstract void stop();
protected abstract void drive();
protected abstract void changeGear();
protected abstract void reverse();
}
|
repos\tutorials-master\core-java-modules\core-java-lang-oop-patterns-2\src\main\java\com\baeldung\interfacevsabstractclass\Vehicle.java
| 1
|
请完成以下Java代码
|
public OptimisticLockingResult failedOperation(DbOperation operation) {
if (operation instanceof DbEntityOperation) {
DbEntityOperation dbEntityOperation = (DbEntityOperation) operation;
DbEntity dbEntity = dbEntityOperation.getEntity();
boolean failedOperationEntityInList = false;
Iterator<LockedExternalTask> it = tasks.iterator();
while (it.hasNext()) {
LockedExternalTask resultTask = it.next();
if (resultTask.getId().equals(dbEntity.getId())) {
it.remove();
failedOperationEntityInList = true;
break;
}
}
// If the entity that failed with an OLE is not in the list,
// we rethrow the OLE to the caller.
if (!failedOperationEntityInList) {
return OptimisticLockingResult.THROW;
}
// If the entity that failed with an OLE has been removed
// from the list, we suppress the OLE.
return OptimisticLockingResult.IGNORE;
}
// If none of the conditions are satisfied, this might indicate a bug,
// so we throw the OLE.
return OptimisticLockingResult.THROW;
}
});
}
protected void validateInput() {
|
EnsureUtil.ensureNotNull("workerId", workerId);
EnsureUtil.ensureGreaterThanOrEqual("maxResults", maxResults, 0);
for (TopicFetchInstruction instruction : fetchInstructions.values()) {
EnsureUtil.ensureNotNull("topicName", instruction.getTopicName());
EnsureUtil.ensurePositive("lockTime", instruction.getLockDuration());
}
}
protected List<QueryOrderingProperty> orderingPropertiesWithPriority(boolean usePriority,
List<QueryOrderingProperty> queryOrderingProperties) {
List<QueryOrderingProperty> results = new ArrayList<>();
// Priority needs to be the first item in the list because it takes precedence over other sorting options
// Multi level ordering works by going through the list of ordering properties from first to last item
if (usePriority) {
results.add(new QueryOrderingProperty(PRIORITY, DESCENDING));
}
results.addAll(queryOrderingProperties);
return results;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmd\FetchExternalTasksCmd.java
| 1
|
请完成以下Java代码
|
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((count == null) ? 0 : count.hashCode());
result = prime * result + ((gender == null) ? 0 : gender.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((probability == null) ? 0 : probability.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;
NameGenderEntity other = (NameGenderEntity) obj;
if (count == null) {
if (other.count != null)
return false;
} else if (!count.equals(other.count))
return false;
if (gender == null) {
|
if (other.gender != null)
return false;
} else if (!gender.equals(other.gender))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (probability == null) {
if (other.probability != null)
return false;
} else if (!probability.equals(other.probability))
return false;
return true;
}
@Override
public String toString() {
return "NameGenderModel [count=" + count + ", gender=" + gender + ", name=" + name + ", probability=" + probability + "]";
}
}
|
repos\tutorials-master\spring-web-modules\spring-thymeleaf-attributes\accessing-session-attributes\src\main\java\com\baeldung\accesing_session_attributes\business\entities\NameGenderEntity.java
| 1
|
请完成以下Java代码
|
protected boolean isEligibleForScheduling(final Object model)
{
return Services.get(ICounterDocBL.class).isCreateCounterDocument(model);
};
@Override
protected Properties extractCtxFromItem(final Object item)
{
return InterfaceWrapperHelper.getCtx(item);
}
@Override
protected String extractTrxNameFromItem(final Object item)
{
return InterfaceWrapperHelper.getTrxName(item);
}
@Override
protected Object extractModelToEnqueueFromItem(final Collector collector, final Object item)
{
return TableRecordReference.of(item);
}
};
// services
private final transient IQueueDAO queueDAO = Services.get(IQueueDAO.class);
private final transient IDocumentBL docActionBL = Services.get(IDocumentBL.class);
|
private final transient ICounterDocBL counterDocumentBL = Services.get(ICounterDocBL.class);
@Override
public Result processWorkPackage(final I_C_Queue_WorkPackage workpackage, final String localTrxName)
{
final List<Object> models = queueDAO.retrieveAllItemsSkipMissing(workpackage, Object.class);
for (final Object model : models)
{
final IDocument document = docActionBL.getDocument(model);
final IDocument counterDocument = counterDocumentBL.createCounterDocument(document, false);
Loggables.addLog("Document {0}: created counter document {1}", document, counterDocument);
}
return Result.SUCCESS;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\document\async\spi\impl\CreateCounterDocPP.java
| 1
|
请完成以下Java代码
|
public ManufacturingJob withChangedReceiveLine(
@NonNull final FinishedGoodsReceiveLineId id,
@NonNull UnaryOperator<FinishedGoodsReceiveLine> mapper)
{
final ImmutableList<ManufacturingJobActivity> activitiesNew = CollectionUtils.map(activities, activity -> activity.withChangedReceiveLine(id, mapper));
return withActivities(activitiesNew);
}
public FinishedGoodsReceiveLine getFinishedGoodsReceiveLineById(@NonNull final FinishedGoodsReceiveLineId finishedGoodsReceiveLineId)
{
return activities.stream()
.map(ManufacturingJobActivity::getFinishedGoodsReceive)
.filter(Objects::nonNull)
.map(finishedGoodsReceive -> finishedGoodsReceive.getLineByIdOrNull(finishedGoodsReceiveLineId))
.filter(Objects::nonNull)
.findFirst()
.orElseThrow(() -> new AdempiereException("No finished goods receive line found for " + finishedGoodsReceiveLineId));
}
public ManufacturingJob withCurrentScaleDevice(@Nullable final DeviceId currentScaleDeviceId)
{
return !DeviceId.equals(this.currentScaleDeviceId, currentScaleDeviceId)
? toBuilder().currentScaleDeviceId(currentScaleDeviceId).build()
: this;
}
@NonNull
public LocalDate getDateStartScheduleAsLocalDate()
|
{
return dateStartSchedule.toLocalDate();
}
@NonNull
public ManufacturingJob withChangedRawMaterialIssue(@NonNull final UnaryOperator<RawMaterialsIssue> mapper)
{
final ImmutableList<ManufacturingJobActivity> updatedActivities = activities
.stream()
.map(activity -> activity.withChangedRawMaterialsIssue(mapper))
.collect(ImmutableList.toImmutableList());
return withActivities(updatedActivities);
}
public Stream<RawMaterialsIssueLine> streamRawMaterialsIssueLines()
{
return activities.stream()
.filter(ManufacturingJobActivity::isRawMaterialsIssue)
.map(ManufacturingJobActivity::getRawMaterialsIssue)
.filter(Objects::nonNull)
.flatMap(rawMaterialsIssue -> rawMaterialsIssue.getLines().stream());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing.rest-api\src\main\java\de\metas\manufacturing\job\model\ManufacturingJob.java
| 1
|
请完成以下Java代码
|
private LookupValuesPage getShipmentScheduleValues(final LookupDataSourceContext context)
{
return createNewDefaultParametersFiller().getShipmentScheduleValues(context);
}
private WEBUI_M_HU_Pick_ParametersFiller createNewDefaultParametersFiller()
{
final HURow row = getSingleHURow();
return WEBUI_M_HU_Pick_ParametersFiller.defaultFillerBuilder()
.huId(row.getHuId())
.salesOrderLineId(getSalesOrderLineId())
.build();
}
@ProcessParamLookupValuesProvider(//
parameterName = WEBUI_M_HU_Pick_ParametersFiller.PARAM_M_PickingSlot_ID, //
dependsOn = WEBUI_M_HU_Pick_ParametersFiller.PARAM_M_ShipmentSchedule_ID, //
numericKey = true, //
lookupSource = LookupSource.lookup)
private LookupValuesList getPickingSlotValues(final LookupDataSourceContext context)
{
final WEBUI_M_HU_Pick_ParametersFiller filler = WEBUI_M_HU_Pick_ParametersFiller
.pickingSlotFillerBuilder()
.shipmentScheduleId(shipmentScheduleId)
.build();
return filler.getPickingSlotValues(context);
}
@Nullable
private OrderLineId getSalesOrderLineId()
{
final IView view = getView();
if (view instanceof PPOrderLinesView)
{
final PPOrderLinesView ppOrderLinesView = PPOrderLinesView.cast(view);
return ppOrderLinesView.getSalesOrderLineId();
}
else
{
return null;
}
}
@Override
protected String doIt()
{
final HURow row = getSingleHURow();
pickHU(row);
|
// invalidate view in order to be refreshed
getView().invalidateAll();
return MSG_OK;
}
private void pickHU(@NonNull final HURow row)
{
final HuId huId = row.getHuId();
final PickRequest pickRequest = PickRequest.builder()
.shipmentScheduleId(shipmentScheduleId)
.pickFrom(PickFrom.ofHuId(huId))
.pickingSlotId(pickingSlotId)
.build();
final ProcessPickingRequest.ProcessPickingRequestBuilder pickingRequestBuilder = ProcessPickingRequest.builder()
.huIds(ImmutableSet.of(huId))
.shipmentScheduleId(shipmentScheduleId)
.isTakeWholeHU(isTakeWholeHU);
final IView view = getView();
if (view instanceof PPOrderLinesView)
{
final PPOrderLinesView ppOrderView = PPOrderLinesView.cast(view);
pickingRequestBuilder.ppOrderId(ppOrderView.getPpOrderId());
}
WEBUI_PP_Order_ProcessHelper.pickAndProcessSingleHU(pickRequest, pickingRequestBuilder.build());
}
@Override
protected void postProcess(final boolean success)
{
if (!success)
{
return;
}
invalidateView();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\process\WEBUI_M_HU_Pick.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Date getFromDate() {
return fromDate;
}
public Date getToDate() {
return toDate;
}
public String getTenantId() {
return tenantId;
}
public long getFromLogNumber() {
return fromLogNumber;
}
public long getToLogNumber() {
return toLogNumber;
}
|
@Override
public long executeCount(CommandContext commandContext) {
return taskServiceConfiguration.getHistoricTaskLogEntryEntityManager().findHistoricTaskLogEntriesCountByQueryCriteria(this);
}
@Override
public List<HistoricTaskLogEntry> executeList(CommandContext commandContext) {
return taskServiceConfiguration.getHistoricTaskLogEntryEntityManager().findHistoricTaskLogEntriesByQueryCriteria(this);
}
@Override
public HistoricTaskLogEntryQuery orderByLogNumber() {
orderBy(HistoricTaskLogEntryQueryProperty.LOG_NUMBER);
return this;
}
@Override
public HistoricTaskLogEntryQuery orderByTimeStamp() {
orderBy(HistoricTaskLogEntryQueryProperty.TIME_STAMP);
return this;
}
}
|
repos\flowable-engine-main\modules\flowable-task-service\src\main\java\org\flowable\task\service\impl\HistoricTaskLogEntryQueryImpl.java
| 2
|
请完成以下Java代码
|
public class DmnDecisionRuleResult {
protected List<Map<String, Object>> ruleResults = new ArrayList<>();
public DmnDecisionRuleResult(List<Map<String, Object>> ruleResults) {
this.ruleResults = ruleResults;
}
public List<Map<String, Object>> getRuleResults() {
return ruleResults;
}
public List<Object> getOutputValues(String outputName) {
List<Object> outputValues = new ArrayList<>();
for (Map<String, Object> ruleOutputValues : ruleResults) {
outputValues.add(ruleOutputValues.get(outputName));
}
return outputValues;
}
public Map<String, Object> getFirstRuleResult() {
if (ruleResults.size() > 0) {
return ruleResults.get(0);
|
} else {
return null;
}
}
public Map<String, Object> getSingleRuleResult() {
if (ruleResults.isEmpty()) {
return null;
} else if (ruleResults.size() > 1) {
throw new FlowableException("Decision has multiple results");
} else {
return getFirstRuleResult();
}
}
}
|
repos\flowable-engine-main\modules\flowable-dmn-api\src\main\java\org\flowable\dmn\api\DmnDecisionRuleResult.java
| 1
|
请完成以下Java代码
|
public class SaveCommentCmd implements Command<Void>, Serializable {
private static final long serialVersionUID = 1L;
protected CommentEntity comment;
public SaveCommentCmd(CommentEntity comment) {
this.comment = comment;
}
@Override
public Void execute(CommandContext commandContext) {
if (comment == null) {
throw new FlowableIllegalArgumentException("comment is null");
}
if (comment.getId() == null) {
throw new FlowableIllegalArgumentException("comment id is null");
|
}
CommentEntityManager commentEntityManager = CommandContextUtil.getCommentEntityManager(commandContext);
String eventMessage = comment.getFullMessage().replaceAll("\\s+", " ");
if (eventMessage.length() > 163) {
eventMessage = eventMessage.substring(0, 160) + "...";
}
comment.setMessage(eventMessage);
commentEntityManager.update(comment);
return null;
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\cmd\SaveCommentCmd.java
| 1
|
请完成以下Java代码
|
public class Demo07Message implements Serializable {
public static final String QUEUE = "QUEUE_DEMO_07"; // 正常队列
public static final String DEAD_QUEUE = "DEAD_QUEUE_DEMO_07"; // 死信队列
public static final String EXCHANGE = "EXCHANGE_DEMO_07";
public static final String ROUTING_KEY = "ROUTING_KEY_07"; // 正常路由键
public static final String DEAD_ROUTING_KEY = "DEAD_ROUTING_KEY_07"; // 死信路由键
/**
* 编号
*/
private Integer id;
public Demo07Message setId(Integer id) {
|
this.id = id;
return this;
}
public Integer getId() {
return id;
}
@Override
public String toString() {
return "Demo07Message{" +
"id=" + id +
'}';
}
}
|
repos\SpringBoot-Labs-master\lab-04-rabbitmq\lab-04-rabbitmq-consume-retry\src\main\java\cn\iocoder\springboot\lab04\rabbitmqdemo\message\Demo07Message.java
| 1
|
请完成以下Java代码
|
private WebuiLetter changeLetter(final WebuiLetter letter, final List<JSONDocumentChangedEvent> events)
{
final WebuiLetterBuilder letterBuilder = letter.toBuilder();
events.forEach(event -> changeLetter(letter, letterBuilder, event));
return letterBuilder.build();
}
private void changeLetter(final WebuiLetter letter, final WebuiLetter.WebuiLetterBuilder newLetterBuilder, final JSONDocumentChangedEvent event)
{
if (!event.isReplace())
{
throw new AdempiereException("Unsupported event")
.setParameter("event", event);
}
final String fieldName = event.getPath();
if (PATCH_FIELD_Message.equals(fieldName))
{
final String message = event.getValueAsString(null);
newLetterBuilder.content(message);
}
else if (PATCH_FIELD_TemplateId.equals(fieldName))
{
@SuppressWarnings("unchecked")
final LookupValue templateId = JSONLookupValue.integerLookupValueFromJsonMap((Map<String, Object>)event.getValue());
applyTemplate(letter, newLetterBuilder, templateId);
}
else
{
throw new AdempiereException("Unsupported event path")
.setParameter("event", event)
.setParameter("fieldName", fieldName)
.setParameter("availablePaths", PATCH_FIELD_ALL);
}
}
@GetMapping("/templates")
@Operation(summary = "Available Letter templates")
public JSONLookupValuesList getTemplates()
{
userSession.assertLoggedIn();
final BoilerPlateId defaultBoilerPlateId = userSession.getDefaultBoilerPlateId();
return MADBoilerPlate.streamAllReadable(userSession.getUserRolePermissions())
.map(adBoilerPlate -> JSONLookupValue.of(adBoilerPlate.getAD_BoilerPlate_ID(), adBoilerPlate.getName()))
|
.collect(JSONLookupValuesList.collect())
.setDefaultId(defaultBoilerPlateId == null ? null : String.valueOf(defaultBoilerPlateId.getRepoId()));
}
private void applyTemplate(final WebuiLetter letter, final WebuiLetterBuilder newLetterBuilder, final LookupValue templateLookupValue)
{
final Properties ctx = Env.getCtx();
final int textTemplateId = templateLookupValue.getIdAsInt();
final MADBoilerPlate boilerPlate = MADBoilerPlate.get(ctx, textTemplateId);
//
// Attributes
final BoilerPlateContext context = documentCollection.createBoilerPlateContext(letter.getContextDocumentPath());
//
// Content and subject
newLetterBuilder.textTemplateId(textTemplateId);
newLetterBuilder.content(boilerPlate.getTextSnippetParsed(context));
newLetterBuilder.subject(boilerPlate.getSubject());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\letter\LetterRestController.java
| 1
|
请完成以下Java代码
|
public class ItemDefinition extends NamedElement {
protected String typeRef;
protected UnaryTests allowedValues;
protected List<ItemDefinition> itemComponents = new ArrayList<>();
protected String typeLanguage;
protected boolean isCollection;
public String getTypeRef() {
return typeRef;
}
public void setTypeRef(String typeRef) {
this.typeRef = typeRef;
}
public UnaryTests getAllowedValues() {
return allowedValues;
}
public void setAllowedValues(UnaryTests allowedValues) {
this.allowedValues = allowedValues;
}
public List<ItemDefinition> getItemComponents() {
return itemComponents;
}
public void setItemComponents(List<ItemDefinition> itemComponents) {
this.itemComponents = itemComponents;
}
public void addItemComponent(ItemDefinition itemComponent) {
|
this.itemComponents.add(itemComponent);
}
public String getTypeLanguage() {
return typeLanguage;
}
public void setTypeLanguage(String typeLanguage) {
this.typeLanguage = typeLanguage;
}
public boolean isCollection() {
return isCollection;
}
public void setCollection(boolean collection) {
isCollection = collection;
}
}
|
repos\flowable-engine-main\modules\flowable-dmn-model\src\main\java\org\flowable\dmn\model\ItemDefinition.java
| 1
|
请完成以下Java代码
|
private List<Object> getNextRawDataRow()
{
try
{
final List<Object> row = new ArrayList<>();
for (int col = 1; col <= getColumnCount(); col++)
{
final Object o = m_resultSet.getObject(col);
row.add(o);
}
noDataAddedYet = false;
return row;
}
catch (final SQLException e)
{
throw DBException.wrapIfNeeded(e);
|
}
}
@Override
protected boolean hasNextRow()
{
try
{
return m_resultSet.next();
}
catch (SQLException e)
{
throw DBException.wrapIfNeeded(e);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\impexp\spreadsheet\excel\JdbcExcelExporter.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Map<String, Object> pageList(@RequestParam(required = false, defaultValue = "0") int start,
@RequestParam(required = false, defaultValue = "10") int length,
int jobGroup, int triggerStatus, String jobDesc, String executorHandler, String author) {
return xxlJobService.pageList(start, length, jobGroup, triggerStatus, jobDesc, executorHandler, author);
}
@RequestMapping("/add")
@ResponseBody
public ReturnT<String> add(XxlJobInfo jobInfo) {
return xxlJobService.add(jobInfo);
}
@RequestMapping("/update")
@ResponseBody
public ReturnT<String> update(XxlJobInfo jobInfo) {
return xxlJobService.update(jobInfo);
}
@RequestMapping("/remove")
@ResponseBody
public ReturnT<String> remove(int id) {
return xxlJobService.remove(id);
}
@RequestMapping("/stop")
@ResponseBody
public ReturnT<String> pause(int id) {
return xxlJobService.stop(id);
}
@RequestMapping("/start")
@ResponseBody
public ReturnT<String> start(int id) {
return xxlJobService.start(id);
}
@RequestMapping("/trigger")
@ResponseBody
public ReturnT<String> triggerJob(HttpServletRequest request, int id, String executorParam, String addressList) {
// login user
XxlJobUser loginUser = (XxlJobUser) request.getAttribute(LoginService.LOGIN_IDENTITY_KEY);
// trigger
return xxlJobService.trigger(loginUser, id, executorParam, addressList);
}
@RequestMapping("/nextTriggerTime")
@ResponseBody
public ReturnT<List<String>> nextTriggerTime(String scheduleType, String scheduleConf) {
|
XxlJobInfo paramXxlJobInfo = new XxlJobInfo();
paramXxlJobInfo.setScheduleType(scheduleType);
paramXxlJobInfo.setScheduleConf(scheduleConf);
List<String> result = new ArrayList<>();
try {
Date lastTime = new Date();
for (int i = 0; i < 5; i++) {
lastTime = JobScheduleHelper.generateNextValidTime(paramXxlJobInfo, lastTime);
if (lastTime != null) {
result.add(DateUtil.formatDateTime(lastTime));
} else {
break;
}
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
return new ReturnT<List<String>>(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) + e.getMessage());
}
return new ReturnT<List<String>>(result);
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-server-cloud\jeecg-visual\jeecg-cloud-xxljob\src\main\java\com\xxl\job\admin\controller\JobInfoController.java
| 2
|
请完成以下Java代码
|
public boolean isProcessing ()
{
Object oo = get_Value(COLUMNNAME_Processing);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Usable Life - Months.
@param UseLifeMonths
Months of the usable life of the asset
*/
public void setUseLifeMonths (int UseLifeMonths)
{
set_Value (COLUMNNAME_UseLifeMonths, Integer.valueOf(UseLifeMonths));
}
/** Get Usable Life - Months.
@return Months of the usable life of the asset
*/
public int getUseLifeMonths ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_UseLifeMonths);
if (ii == null)
return 0;
return ii.intValue();
}
|
/** Set Usable Life - Years.
@param UseLifeYears
Years of the usable life of the asset
*/
public void setUseLifeYears (int UseLifeYears)
{
set_Value (COLUMNNAME_UseLifeYears, Integer.valueOf(UseLifeYears));
}
/** Get Usable Life - Years.
@return Years of the usable life of the asset
*/
public int getUseLifeYears ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_UseLifeYears);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_A_Asset_Group_Acct.java
| 1
|
请完成以下Java代码
|
public ArrayList<Object> getData(boolean mandatory, boolean onlyValidated, boolean onlyActive, boolean temporary)
{
// create list
final Collection<MLocator> collection = getData();
final ArrayList<Object> list = new ArrayList<>(collection.size());
Iterator<MLocator> it = collection.iterator();
while (it.hasNext())
{
final MLocator loc = it.next();
if (!isValid(loc)) // only valid warehouses
{
continue;
}
final NamePair locatorKNP = new KeyNamePair(loc.getM_Locator_ID(), loc.toString());
list.add(locatorKNP);
}
/**
* Sort Data
* MLocator l = new MLocator (m_ctx, 0);
* if (!mandatory)
* list.add (l);
* Collections.sort (list, l);
**/
return list;
} // getArray
/**
* Refresh Values
*
* @return new size of lookup
*/
@Override
public int refresh()
{
log.debug("start");
m_loader = new Loader();
m_loader.start();
try
|
{
m_loader.join();
}
catch (InterruptedException ie)
{
}
log.info("#" + m_lookup.size());
return m_lookup.size();
} // refresh
@Override
public String getTableName()
{
return I_M_Locator.Table_Name;
}
/**
* Get underlying fully qualified Table.Column Name
*
* @return Table.ColumnName
*/
@Override
public String getColumnName()
{
return "M_Locator.M_Locator_ID";
} // getColumnName
@Override
public String getColumnNameNotFQ()
{
return I_M_Locator.COLUMNNAME_M_Locator_ID;
}
} // MLocatorLookup
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MLocatorLookup.java
| 1
|
请完成以下Java代码
|
public String getCaseInstanceId() {
return caseInstanceId;
}
public void setCaseInstanceId(String caseInstanceId) {
this.caseInstanceId = caseInstanceId;
}
public List<ProcessInstanceModificationInstructionDto> getStartInstructions() {
return startInstructions;
}
public void setStartInstructions(List<ProcessInstanceModificationInstructionDto> startInstructions) {
this.startInstructions = startInstructions;
}
public boolean isSkipCustomListeners() {
return skipCustomListeners;
}
|
public void setSkipCustomListeners(boolean skipCustomListeners) {
this.skipCustomListeners = skipCustomListeners;
}
public boolean isSkipIoMappings() {
return skipIoMappings;
}
public void setSkipIoMappings(boolean skipIoMappings) {
this.skipIoMappings = skipIoMappings;
}
public boolean isWithVariablesInReturn() {
return withVariablesInReturn;
}
public void setWithVariablesInReturn(boolean withVariablesInReturn) {
this.withVariablesInReturn = withVariablesInReturn;
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\runtime\StartProcessInstanceDto.java
| 1
|
请完成以下Java代码
|
private void assertNotBuilt()
{
Check.assume(!built.get(), "not already built");
}
private void markAsBuilt()
{
final boolean wasAlreadyBuilt = built.getAndSet(true);
Check.assume(!wasAlreadyBuilt, "not already built");
}
@Override
public IWorkPackageBuilder end()
{
return _parentBuilder;
}
/* package */void setC_Queue_WorkPackage(final I_C_Queue_WorkPackage workpackage)
{
assertNotBuilt();
_workpackage = workpackage;
}
private I_C_Queue_WorkPackage getC_Queue_WorkPackage()
{
Check.assumeNotNull(_workpackage, "workpackage not null");
return _workpackage;
}
@Override
public IWorkPackageParamsBuilder setParameter(final String parameterName, final Object parameterValue)
{
assertNotBuilt();
Check.assumeNotEmpty(parameterName, "parameterName not empty");
parameterName2valueMap.put(parameterName, parameterValue);
return this;
}
@Override
public IWorkPackageParamsBuilder setParameters(final Map<String, ?> parameters)
{
assertNotBuilt();
if (parameters == null || parameters.isEmpty())
{
return this;
}
for (final Map.Entry<String, ?> param : parameters.entrySet())
|
{
final String parameterName = param.getKey();
Check.assumeNotEmpty(parameterName, "parameterName not empty");
final Object parameterValue = param.getValue();
parameterName2valueMap.put(parameterName, parameterValue);
}
return this;
}
@Override
public IWorkPackageParamsBuilder setParameters(@Nullable final IParams parameters)
{
assertNotBuilt();
if (parameters == null)
{
return this;
}
final Collection<String> parameterNames = parameters.getParameterNames();
if(parameterNames.isEmpty())
{
return this;
}
for (final String parameterName : parameterNames)
{
Check.assumeNotEmpty(parameterName, "parameterName not empty");
final Object parameterValue = parameters.getParameterAsObject(parameterName);
parameterName2valueMap.put(parameterName, parameterValue);
}
return this;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.async\src\main\java\de\metas\async\api\impl\WorkPackageParamsBuilder.java
| 1
|
请完成以下Java代码
|
public Object getPersistentState() {
Map<String, Object> persistentState = new HashMap<>();
persistentState.put("name", name);
persistentState.put("description", description);
return persistentState;
}
@Override
public String getName() {
return name;
}
@Override
public void setName(String name) {
this.name = name;
}
@Override
public String getDescription() {
return description;
}
@Override
public void setDescription(String description) {
this.description = description;
}
@Override
public String getType() {
return type;
}
@Override
public void setType(String type) {
this.type = type;
}
@Override
public String getTaskId() {
return taskId;
}
@Override
public void setTaskId(String taskId) {
this.taskId = taskId;
}
@Override
public String getProcessInstanceId() {
return processInstanceId;
}
@Override
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
@Override
public String getUrl() {
return url;
}
@Override
public void setUrl(String url) {
this.url = url;
|
}
@Override
public String getContentId() {
return contentId;
}
@Override
public void setContentId(String contentId) {
this.contentId = contentId;
}
@Override
public ByteArrayEntity getContent() {
return content;
}
@Override
public void setContent(ByteArrayEntity content) {
this.content = content;
}
@Override
public void setUserId(String userId) {
this.userId = userId;
}
@Override
public String getUserId() {
return userId;
}
@Override
public Date getTime() {
return time;
}
@Override
public void setTime(Date time) {
this.time = time;
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\persistence\entity\AttachmentEntityImpl.java
| 1
|
请完成以下Java代码
|
public ParsedDeploymentBuilderFactory getExParsedDeploymentBuilderFactory() {
return parsedDeploymentBuilderFactory;
}
public void setParsedDeploymentBuilderFactory(ParsedDeploymentBuilderFactory parsedDeploymentBuilderFactory) {
this.parsedDeploymentBuilderFactory = parsedDeploymentBuilderFactory;
}
public EventDefinitionDeploymentHelper getEventDeploymentHelper() {
return eventDeploymentHelper;
}
public void setEventDeploymentHelper(EventDefinitionDeploymentHelper eventDeploymentHelper) {
this.eventDeploymentHelper = eventDeploymentHelper;
}
public ChannelDefinitionDeploymentHelper getChannelDeploymentHelper() {
return channelDeploymentHelper;
}
public void setChannelDeploymentHelper(ChannelDefinitionDeploymentHelper channelDeploymentHelper) {
this.channelDeploymentHelper = channelDeploymentHelper;
|
}
public CachingAndArtifactsManager getCachingAndArtifcatsManager() {
return cachingAndArtifactsManager;
}
public void setCachingAndArtifactsManager(CachingAndArtifactsManager manager) {
this.cachingAndArtifactsManager = manager;
}
public boolean isUsePrefixId() {
return usePrefixId;
}
public void setUsePrefixId(boolean usePrefixId) {
this.usePrefixId = usePrefixId;
}
}
|
repos\flowable-engine-main\modules\flowable-event-registry\src\main\java\org\flowable\eventregistry\impl\deployer\EventDefinitionDeployer.java
| 1
|
请完成以下Java代码
|
public class ESR_Import_LoadFromAttachmentEntry
extends JavaProcess
{
@Param(mandatory = true, parameterName = "AD_AttachmentEntry_ID")
private int p_AD_AttachmentEntry_ID;
@Param(mandatory = true, parameterName = I_C_Async_Batch.COLUMNNAME_Name)
private final String p_AsyncBatchName = ESR_ASYNC_BATCH_NAME;
@Param(mandatory = true, parameterName = I_C_Async_Batch.COLUMNNAME_Description)
private final String p_AsyncBatchDesc = ESR_ASYNC_BATCH_DESC;
private final IESRImportBL esrImportBL = Services.get(IESRImportBL.class);
@Override
@RunOutOfTrx
protected String doIt()
{
final AttachmentEntryId attachmentEntryId = AttachmentEntryId.ofRepoId(p_AD_AttachmentEntry_ID);
final I_ESR_Import esrImport = getRecord(I_ESR_Import.class);
|
final RunESRImportRequest runESRImportRequest = RunESRImportRequest.builder()
.esrImport(esrImport)
.attachmentEntryId(attachmentEntryId)
.asyncBatchDescription(p_AsyncBatchDesc)
.asyncBatchName(p_AsyncBatchName)
.loggable(this)
.build();
esrImportBL.scheduleESRImportFor(runESRImportRequest);
getResult().setRecordToRefreshAfterExecution(TableRecordReference.of(esrImport));
return MSG_OK;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.esr\src\main\java\de\metas\payment\esr\process\ESR_Import_LoadFromAttachmentEntry.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String showForm() {
return "user.jsp";
}
/**
* The method handles the form submits
* Handles HTTP POST and is CSRF protected. The client invoking this controller should provide a CSRF token.
* @param user The user details that has to be stored
* @return Returns a view name
*/
@POST
@Controller
@CsrfProtected
public String saveUser(@Valid @BeanParam User user) {
if (bindingResult.isFailed()) {
models.put("errors", bindingResult.getAllErrors());
return "user.jsp";
}
String id = UUID.randomUUID().toString();
user.setId(id);
users.add(user);
return "redirect:users/success";
}
/**
* Handles a redirect view
* @return The view name
|
*/
@GET
@Controller
@Path("success")
public String saveUserSuccess() {
return "success.jsp";
}
/**
* The REST API that returns all the user details in the JSON format
* @return The list of users that are saved. The List<User> is converted into Json Array.
* If no user is present a empty array is returned
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<User> getUsers() {
return users;
}
}
|
repos\tutorials-master\web-modules\jakarta-ee\src\main\java\com\baeldung\eclipse\krazo\UserController.java
| 2
|
请完成以下Java代码
|
public void setPastDueAmt (BigDecimal PastDueAmt)
{
set_Value (COLUMNNAME_PastDueAmt, PastDueAmt);
}
/** Get Past Due.
@return Past Due */
public BigDecimal getPastDueAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PastDueAmt);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Statement date.
@param StatementDate
|
Date of the statement
*/
public void setStatementDate (Timestamp StatementDate)
{
set_Value (COLUMNNAME_StatementDate, StatementDate);
}
/** Get Statement date.
@return Date of the statement
*/
public Timestamp getStatementDate ()
{
return (Timestamp)get_Value(COLUMNNAME_StatementDate);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_T_Aging.java
| 1
|
请完成以下Java代码
|
public void setPayAmt (BigDecimal PayAmt)
{
set_Value (COLUMNNAME_PayAmt, PayAmt);
}
/** Get Zahlungsbetrag.
@return Gezahlter Betrag
*/
@Override
public BigDecimal getPayAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PayAmt);
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 Process Now.
@param Processing Process Now */
@Override
public void setProcessing (boolean Processing)
|
{
set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
}
/** Get Process Now.
@return Process Now */
@Override
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 Transaction Code.
@param TransactionCode
The transaction code represents the search definition
*/
@Override
public void setTransactionCode (java.lang.String TransactionCode)
{
set_Value (COLUMNNAME_TransactionCode, TransactionCode);
}
/** Get Transaction Code.
@return The transaction code represents the search definition
*/
@Override
public java.lang.String getTransactionCode ()
{
return (java.lang.String)get_Value(COLUMNNAME_TransactionCode);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.base\src\main\java-gen\de\metas\banking\model\X_I_Datev_Payment.java
| 1
|
请完成以下Java代码
|
public static InvoiceCandidateHeaderAggregationId ofRepoId(final int repoId)
{
return new InvoiceCandidateHeaderAggregationId(repoId);
}
@Nullable
public static InvoiceCandidateHeaderAggregationId ofRepoIdOrNull(final int repoId)
{
return repoId > 0 ? ofRepoId(repoId) : null;
}
int repoId;
private InvoiceCandidateHeaderAggregationId(final int repoId)
{
|
this.repoId = Check.assumeGreaterThanZero(repoId, "C_Invoice_Candidate_HeaderAggregation_ID");
}
@Override
@JsonValue
public int getRepoId()
{
return repoId;
}
public static int toRepoId(@Nullable final InvoiceCandidateHeaderAggregationId id)
{
return id != null ? id.getRepoId() : -1;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\InvoiceCandidateHeaderAggregationId.java
| 1
|
请完成以下Java代码
|
public InvoiceCandRecomputeTagger setLockedBy(final ILock lockedBy)
{
this._lockedBy = lockedBy;
return this;
}
/* package */ILock getLockedBy()
{
return _lockedBy;
}
@Override
public InvoiceCandRecomputeTagger setTaggedWith(@Nullable final InvoiceCandRecomputeTag tag)
{
_taggedWith = tag;
return this;
}
@Override
public InvoiceCandRecomputeTagger setTaggedWithNoTag()
{
return setTaggedWith(InvoiceCandRecomputeTag.NULL);
}
@Override
public IInvoiceCandRecomputeTagger setTaggedWithAnyTag()
{
return setTaggedWith(null);
}
/* package */
@Nullable
InvoiceCandRecomputeTag getTaggedWith()
{
return _taggedWith;
}
@Override
public InvoiceCandRecomputeTagger setLimit(final int limit)
|
{
this._limit = limit;
return this;
}
/* package */int getLimit()
{
return _limit;
}
@Override
public void setOnlyInvoiceCandidateIds(@NonNull final InvoiceCandidateIdsSelection onlyInvoiceCandidateIds)
{
this.onlyInvoiceCandidateIds = onlyInvoiceCandidateIds;
}
@Override
@Nullable
public final InvoiceCandidateIdsSelection getOnlyInvoiceCandidateIds()
{
return onlyInvoiceCandidateIds;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\api\impl\InvoiceCandRecomputeTagger.java
| 1
|
请完成以下Java代码
|
public class RemoteServerJsch {
private static final Logger LOGGER = LoggerFactory.getLogger(RemoteServerJsch.class);
private static final String HOST = "HOST";
private static final String USER = "USERNAME";
private static final String PRIVATE_KEY = "PATH TO PRIVATE KEY";
private static final int PORT = 22;
public static JSch setUpJsch() throws JSchException {
JSch jsch = new JSch();
jsch.addIdentity(PRIVATE_KEY);
return jsch;
}
public static Session createSession(JSch jsch) throws JSchException {
Session session = jsch.getSession(USER, HOST, PORT);
session.setConfig("StrictHostKeyChecking", "no");
session.connect();
return session;
}
public static ChannelSftp createSftpChannel(Session session) throws JSchException {
|
ChannelSftp channelSftp = (ChannelSftp) session.openChannel("sftp");
channelSftp.connect();
return channelSftp;
}
public static void readFileLineByLine(ChannelSftp channelSftp, String filePath) throws SftpException, IOException {
InputStream stream = channelSftp.get(filePath);
try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(stream))) {
String line;
while ((line = bufferedReader.readLine()) != null) {
LOGGER.info(line);
}
}
}
public static void disconnect(ChannelSftp channelSftp, Session session) {
channelSftp.disconnect();
session.disconnect();
}
}
|
repos\tutorials-master\libraries-files\src\main\java\com\baeldung\readfileremotely\RemoteServerJsch.java
| 1
|
请完成以下Java代码
|
public Boolean getInitial() {
return initial;
}
public int getRevision() {
return revision;
}
public String getErrorMessage() {
return errorMessage;
}
public Map<String, Object> getValueInfo() {
return valueInfo;
}
public static HistoricVariableUpdateDto fromHistoricVariableUpdate(HistoricVariableUpdate historicVariableUpdate) {
HistoricVariableUpdateDto dto = new HistoricVariableUpdateDto();
fromHistoricVariableUpdate(dto, historicVariableUpdate);
return dto;
}
protected static void fromHistoricVariableUpdate(HistoricVariableUpdateDto dto,
HistoricVariableUpdate historicVariableUpdate) {
dto.revision = historicVariableUpdate.getRevision();
dto.variableName = historicVariableUpdate.getVariableName();
dto.variableInstanceId = historicVariableUpdate.getVariableInstanceId();
|
dto.initial = historicVariableUpdate.isInitial();
if (historicVariableUpdate.getErrorMessage() == null) {
try {
VariableValueDto variableValueDto = VariableValueDto.fromTypedValue(historicVariableUpdate.getTypedValue());
dto.value = variableValueDto.getValue();
dto.variableType = variableValueDto.getType();
dto.valueInfo = variableValueDto.getValueInfo();
} catch (RuntimeException e) {
dto.errorMessage = e.getMessage();
dto.variableType = VariableValueDto.toRestApiTypeName(historicVariableUpdate.getTypeName());
}
}
else {
dto.errorMessage = historicVariableUpdate.getErrorMessage();
dto.variableType = VariableValueDto.toRestApiTypeName(historicVariableUpdate.getTypeName());
}
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\history\HistoricVariableUpdateDto.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class ExternalWorkerJobFailCmd extends AbstractExternalWorkerJobCmd {
protected int retries;
protected Duration retryTimeout;
protected String errorMessage;
protected String errorDetails;
public ExternalWorkerJobFailCmd(String externalJobId, String workerId, int retries, Duration retryTimeout, String errorMessage, String errorDetails,
JobServiceConfiguration jobServiceConfiguration) {
super(externalJobId, workerId, jobServiceConfiguration);
this.retries = retries;
this.retryTimeout = retryTimeout;
this.errorMessage = errorMessage;
this.errorDetails = errorDetails;
}
@Override
protected void runJobLogic(ExternalWorkerJobEntity externalWorkerJob, CommandContext commandContext) {
externalWorkerJob.setExceptionMessage(errorMessage);
externalWorkerJob.setExceptionStacktrace(errorDetails);
int newRetries;
if (retries >= 0) {
|
newRetries = retries;
} else {
newRetries = externalWorkerJob.getRetries() - 1;
}
if (newRetries > 0) {
externalWorkerJob.setRetries(newRetries);
externalWorkerJob.setLockOwner(null);
if (retryTimeout == null) {
externalWorkerJob.setLockExpirationTime(null);
} else {
Instant lockExpirationTime = jobServiceConfiguration.getClock().getCurrentTime().toInstant().plusMillis(retryTimeout.toMillis());
externalWorkerJob.setLockExpirationTime(Date.from(lockExpirationTime));
}
} else {
jobServiceConfiguration.getJobService().moveJobToDeadLetterJob(externalWorkerJob);
}
}
}
|
repos\flowable-engine-main\modules\flowable-job-service\src\main\java\org\flowable\job\service\impl\cmd\ExternalWorkerJobFailCmd.java
| 2
|
请完成以下Java代码
|
public Object[] toArray() {
return getElements().toArray();
}
public <T1> T1[] toArray(T1[] a) {
return getElements().toArray(a);
}
public boolean add(T t) {
getDomElement().appendChild(t.getDomElement());
return true;
}
public boolean remove(Object o) {
ModelUtil.ensureInstanceOf(o, BpmnModelElementInstance.class);
return getDomElement().removeChild(((BpmnModelElementInstance) o).getDomElement());
}
public boolean containsAll(Collection<?> c) {
for (Object o : c) {
if (!contains(o)) {
return false;
}
}
return true;
}
public boolean addAll(Collection<? extends T> c) {
for (T element : c) {
add(element);
}
|
return true;
}
public boolean removeAll(Collection<?> c) {
boolean result = false;
for (Object o : c) {
result |= remove(o);
}
return result;
}
public boolean retainAll(Collection<?> c) {
throw new UnsupportedModelOperationException("retainAll()", "not implemented");
}
public void clear() {
DomElement domElement = getDomElement();
List<DomElement> childElements = domElement.getChildElements();
for (DomElement childElement : childElements) {
domElement.removeChild(childElement);
}
}
};
}
}
|
repos\camunda-bpm-platform-master\model-api\bpmn-model\src\main\java\org\camunda\bpm\model\bpmn\impl\instance\camunda\CamundaListImpl.java
| 1
|
请完成以下Java代码
|
public String getAuthor() {
return author;
}
/**
* Sets the {@link #author}.
*
* @param author
* the new {@link #author}
*/
public void setAuthor(String author) {
this.author = author;
}
/**
* Gets the {@link #tags}.
*
* @return the {@link #tags}
*/
public List<String> getTags() {
return tags;
}
/**
* Sets the {@link #tags}.
*
* @param tags
* the new {@link #tags}
*/
public void setTags(List<String> tags) {
this.tags = tags;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((author == null) ? 0 : author.hashCode());
result = prime * result + ((tags == null) ? 0 : tags.hashCode());
result = prime * result + ((title == null) ? 0 : title.hashCode());
return result;
}
|
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Post other = (Post) obj;
if (author == null) {
if (other.author != null)
return false;
} else if (!author.equals(other.author))
return false;
if (tags == null) {
if (other.tags != null)
return false;
} else if (!tags.equals(other.tags))
return false;
if (title == null) {
if (other.title != null)
return false;
} else if (!title.equals(other.title))
return false;
return true;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Post [title=" + title + ", author=" + author + ", tags=" + tags + "]";
}
}
|
repos\tutorials-master\persistence-modules\java-mongodb-3\src\main\java\com\baeldung\mongo\tagging\Post.java
| 1
|
请完成以下Java代码
|
default <T> T getRequiredAttribute(String name) {
T result = getAttribute(name);
if (result == null) {
throw new IllegalArgumentException("Required attribute '" + name + "' is missing.");
}
return result;
}
/**
* Return the session attribute value, or a default, fallback value.
* @param name the attribute name
* @param defaultValue a default value to return instead
* @param <T> the attribute type
* @return the attribute value
*/
@SuppressWarnings("unchecked")
default <T> T getAttributeOrDefault(String name, T defaultValue) {
T result = getAttribute(name);
return (result != null) ? result : defaultValue;
}
/**
* Gets the attribute names that have a value associated with it. Each value can be
* passed into {@link org.springframework.session.Session#getAttribute(String)} to
* obtain the attribute value.
* @return the attribute names that have a value associated with it.
* @see #getAttribute(String)
*/
Set<String> getAttributeNames();
/**
* Sets the attribute value for the provided attribute name. If the attributeValue is
* null, it has the same result as removing the attribute with
* {@link org.springframework.session.Session#removeAttribute(String)} .
* @param attributeName the attribute name to set
* @param attributeValue the value of the attribute to set. If null, the attribute
* will be removed.
*/
void setAttribute(String attributeName, Object attributeValue);
/**
* Removes the attribute with the provided attribute name.
* @param attributeName the name of the attribute to remove
*/
void removeAttribute(String attributeName);
/**
* Gets the time when this session was created.
* @return the time when this session was created.
*/
|
Instant getCreationTime();
/**
* Sets the last accessed time.
* @param lastAccessedTime the last accessed time
*/
void setLastAccessedTime(Instant lastAccessedTime);
/**
* Gets the last time this {@link Session} was accessed.
* @return the last time the client sent a request associated with the session
*/
Instant getLastAccessedTime();
/**
* Sets the maximum inactive interval between requests before this session will be
* invalidated. A negative time indicates that the session will never timeout.
* @param interval the amount of time that the {@link Session} should be kept alive
* between client requests.
*/
void setMaxInactiveInterval(Duration interval);
/**
* Gets the maximum inactive interval between requests before this session will be
* invalidated. A negative time indicates that the session will never timeout.
* @return the maximum inactive interval between requests before this session will be
* invalidated. A negative time indicates that the session will never timeout.
*/
Duration getMaxInactiveInterval();
/**
* Returns true if the session is expired.
* @return true if the session is expired, else false.
*/
boolean isExpired();
}
|
repos\spring-session-main\spring-session-core\src\main\java\org\springframework\session\Session.java
| 1
|
请完成以下Java代码
|
public void deleteAllSpecAttributeValues(final I_DIM_Dimension_Spec_Attribute specAttr)
{
Services.get(IQueryBL.class).createQueryBuilder(I_DIM_Dimension_Spec_AttributeValue.class, specAttr)
.addEqualsFilter(I_DIM_Dimension_Spec_AttributeValue.COLUMN_DIM_Dimension_Spec_Attribute_ID, specAttr.getDIM_Dimension_Spec_Attribute_ID())
.create()
.delete();
}
@Override
public void deleteAllAssociations(final I_DIM_Dimension_Spec spec)
{
Services.get(IQueryBL.class).createQueryBuilder(I_DIM_Dimension_Spec_Assignment.class, spec)
.addEqualsFilter(I_DIM_Dimension_Spec_Assignment.COLUMN_DIM_Dimension_Spec_ID, spec.getDIM_Dimension_Spec_ID())
.create()
.delete();
}
@Override
public void deleteAllSpecAttributes(final I_DIM_Dimension_Spec spec)
{
Services.get(IQueryBL.class).createQueryBuilder(I_DIM_Dimension_Spec_Attribute.class, spec)
.addEqualsFilter(I_DIM_Dimension_Spec_Attribute.COLUMN_DIM_Dimension_Spec_ID, spec.getDIM_Dimension_Spec_ID())
.create()
.delete();
}
@Override
public List<DimensionSpec> retrieveForColumn(final I_AD_Column column)
{
final IQuery<I_DIM_Dimension_Spec_Assignment> assignmentQuery = createDimAssignmentQueryBuilderFor(column)
.addOnlyActiveRecordsFilter()
.create();
return Services.get(IQueryBL.class).createQueryBuilder(I_DIM_Dimension_Spec.class, column)
.addInSubQueryFilter(I_DIM_Dimension_Spec.COLUMN_DIM_Dimension_Spec_ID, I_DIM_Dimension_Spec_Assignment.COLUMN_DIM_Dimension_Spec_ID, assignmentQuery)
.create()
.stream(I_DIM_Dimension_Spec.class)
.map(DimensionSpec::ofRecord)
.collect(ImmutableList.toImmutableList());
}
@Override
public DimensionSpec retrieveForInternalNameOrNull(final String internalName)
{
final I_DIM_Dimension_Spec record = Services.get(IQueryBL.class).createQueryBuilder(I_DIM_Dimension_Spec.class)
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_DIM_Dimension_Spec.COLUMN_InternalName, internalName)
|
.create()
.firstOnly(I_DIM_Dimension_Spec.class);
if(record == null)
{
return null;
}
return DimensionSpec.ofRecord(record);
}
@Override
public List<String> retrieveAttributeValueForGroup(final String dimensionSpectInternalName,
final String groupName,
final IContextAware ctxAware)
{
final KeyNamePair[] keyNamePairs = DB.getKeyNamePairs("SELECT M_AttributeValue_ID, ValueName "
+ "FROM " + DimensionConstants.VIEW_DIM_Dimension_Spec_Attribute_AllValue + " WHERE InternalName=? AND GroupName=?",
false,
dimensionSpectInternalName, groupName);
final List<String> result = new ArrayList<String>(keyNamePairs.length);
for (final KeyNamePair keyNamePair : keyNamePairs)
{
result.add(keyNamePair.getName());
}
return result;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.dimension\src\main\java\de\metas\dimension\impl\DimensionspecDAO.java
| 1
|
请完成以下Java代码
|
public void setBeanName(String name) {
this.beanName = name;
}
protected abstract @Nullable D addRegistration(String description, ServletContext servletContext);
protected void configure(D registration) {
registration.setAsyncSupported(this.asyncSupported);
if (!this.initParameters.isEmpty()) {
registration.setInitParameters(this.initParameters);
}
}
/**
* Deduces the name for this registration. Will return user specified name or fallback
* to the bean name. If the bean name is not available, convention based naming is
* used.
|
* @param value the object used for convention based names
* @return the deduced name
*/
protected final String getOrDeduceName(@Nullable Object value) {
if (this.name != null) {
return this.name;
}
if (this.beanName != null) {
return this.beanName;
}
if (value == null) {
return "null";
}
return Conventions.getVariableName(value);
}
}
|
repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\web\servlet\DynamicRegistrationBean.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void setQUANTITYQUAL(String value) {
this.quantityqual = value;
}
/**
* Gets the value of the quantity property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getQUANTITY() {
return quantity;
}
/**
* Sets the value of the quantity property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setQUANTITY(String value) {
this.quantity = 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 dmkdq1 property.
*
* @return
* possible object is
* {@link DMKDQ1 }
*
*/
public DMKDQ1 getDMKDQ1() {
return dmkdq1;
}
/**
* Sets the value of the dmkdq1 property.
*
* @param value
* allowed object is
* {@link DMKDQ1 }
*
*/
public void setDMKDQ1(DMKDQ1 value) {
this.dmkdq1 = value;
}
/**
* Gets the value of the dpldq1 property.
*
* @return
* possible object is
* {@link DPLDQ1 }
*
*/
|
public DPLDQ1 getDPLDQ1() {
return dpldq1;
}
/**
* Sets the value of the dpldq1 property.
*
* @param value
* allowed object is
* {@link DPLDQ1 }
*
*/
public void setDPLDQ1(DPLDQ1 value) {
this.dpldq1 = value;
}
/**
* Gets the value of the ddtdq1 property.
*
* @return
* possible object is
* {@link DDTDQ1 }
*
*/
public DDTDQ1 getDDTDQ1() {
return ddtdq1;
}
/**
* Sets the value of the ddtdq1 property.
*
* @param value
* allowed object is
* {@link DDTDQ1 }
*
*/
public void setDDTDQ1(DDTDQ1 value) {
this.ddtdq1 = value;
}
/**
* Gets the value of the dprdq1 property.
*
* @return
* possible object is
* {@link DPRDQ1 }
*
*/
public DPRDQ1 getDPRDQ1() {
return dprdq1;
}
/**
* Sets the value of the dprdq1 property.
*
* @param value
* allowed object is
* {@link DPRDQ1 }
*
*/
public void setDPRDQ1(DPRDQ1 value) {
this.dprdq1 = 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\DQUAN1.java
| 2
|
请完成以下Java代码
|
protected org.compiere.model.POInfo initPO(final Properties ctx)
{
return org.compiere.model.POInfo.getPOInfo(Table_Name);
}
@Override
public void setM_Attribute_ID (final int M_Attribute_ID)
{
if (M_Attribute_ID < 1)
set_Value (COLUMNNAME_M_Attribute_ID, null);
else
set_Value (COLUMNNAME_M_Attribute_ID, M_Attribute_ID);
}
@Override
public int getM_Attribute_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Attribute_ID);
}
@Override
public de.metas.inoutcandidate.model.I_M_IolCandHandler getM_IolCandHandler()
{
return get_ValueAsPO(COLUMNNAME_M_IolCandHandler_ID, de.metas.inoutcandidate.model.I_M_IolCandHandler.class);
}
@Override
public void setM_IolCandHandler(final de.metas.inoutcandidate.model.I_M_IolCandHandler M_IolCandHandler)
{
set_ValueFromPO(COLUMNNAME_M_IolCandHandler_ID, de.metas.inoutcandidate.model.I_M_IolCandHandler.class, M_IolCandHandler);
}
@Override
public void setM_IolCandHandler_ID (final int M_IolCandHandler_ID)
{
if (M_IolCandHandler_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_IolCandHandler_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_IolCandHandler_ID, M_IolCandHandler_ID);
}
@Override
public int getM_IolCandHandler_ID()
{
return get_ValueAsInt(COLUMNNAME_M_IolCandHandler_ID);
}
|
@Override
public void setM_ShipmentSchedule_AttributeConfig_ID (final int M_ShipmentSchedule_AttributeConfig_ID)
{
if (M_ShipmentSchedule_AttributeConfig_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_ShipmentSchedule_AttributeConfig_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_ShipmentSchedule_AttributeConfig_ID, M_ShipmentSchedule_AttributeConfig_ID);
}
@Override
public int getM_ShipmentSchedule_AttributeConfig_ID()
{
return get_ValueAsInt(COLUMNNAME_M_ShipmentSchedule_AttributeConfig_ID);
}
@Override
public void setOnlyIfInReferencedASI (final boolean OnlyIfInReferencedASI)
{
set_Value (COLUMNNAME_OnlyIfInReferencedASI, OnlyIfInReferencedASI);
}
@Override
public boolean isOnlyIfInReferencedASI()
{
return get_ValueAsBoolean(COLUMNNAME_OnlyIfInReferencedASI);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\de\metas\inoutcandidate\model\X_M_ShipmentSchedule_AttributeConfig.java
| 1
|
请完成以下Java代码
|
public static void main(String[] args) throws IOException, GitAPIException {
// prepare test-repository
try (Repository repository = Helper.openJGitRepository()) {
try (Git git = new Git(repository)) {
// remove the tag before creating it
git.tagDelete().setTags("tag_for_testing").call();
// set it on the current HEAD
Ref tag = git.tag().setName("tag_for_testing").call();
logger.debug("Created/moved tag " + tag + " to repository at " + repository.getDirectory());
// remove the tag again
git.tagDelete().setTags("tag_for_testing").call();
// read some other commit and set the tag on it
ObjectId id = repository.resolve("HEAD^");
try (RevWalk walk = new RevWalk(repository)) {
RevCommit commit = walk.parseCommit(id);
|
tag = git.tag().setObjectId(commit).setName("tag_for_testing").call();
logger.debug("Created/moved tag " + tag + " to repository at " + repository.getDirectory());
// remove the tag again
git.tagDelete().setTags("tag_for_testing").call();
// create an annotated tag
tag = git.tag().setName("tag_for_testing").setAnnotated(true).call();
logger.debug("Created/moved tag " + tag + " to repository at " + repository.getDirectory());
// remove the tag again
git.tagDelete().setTags("tag_for_testing").call();
walk.dispose();
}
}
}
}
}
|
repos\tutorials-master\jgit\src\main\java\com\baeldung\jgit\porcelain\CreateAndDeleteTag.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void deleteHistoricTaskLogEntriesForNonExistingCaseInstances() {
if (this.configuration.isEnableHistoricTaskLogging()) {
getHistoricTaskLogEntryEntityManager().deleteHistoricTaskLogEntriesForNonExistingCaseInstances();
}
}
@Override
public void deleteHistoricTaskInstances(HistoricTaskInstanceQueryImpl historicTaskInstanceQuery) {
getHistoricTaskInstanceEntityManager().deleteHistoricTaskInstances(historicTaskInstanceQuery);
}
@Override
public void bulkDeleteHistoricTaskInstances(Collection<String> taskIds) {
getHistoricTaskInstanceEntityManager().bulkDeleteHistoricTaskInstancesForIds(taskIds);
}
@Override
public void deleteHistoricTaskInstancesForNonExistingProcessInstances() {
getHistoricTaskInstanceEntityManager().deleteHistoricTaskInstancesForNonExistingProcessInstances();
}
@Override
public void deleteHistoricTaskInstancesForNonExistingCaseInstances() {
getHistoricTaskInstanceEntityManager().deleteHistoricTaskInstancesForNonExistingCaseInstances();
}
@Override
public NativeHistoricTaskLogEntryQuery createNativeHistoricTaskLogEntryQuery(CommandExecutor commandExecutor) {
return new NativeHistoricTaskLogEntryQueryImpl(commandExecutor, configuration);
}
protected HistoricTaskLogEntryEntityManager getHistoricTaskLogEntryEntityManager() {
|
return configuration.getHistoricTaskLogEntryEntityManager();
}
protected void createHistoricIdentityLink(String taskId, String type, String userId, AbstractEngineConfiguration engineConfiguration) {
HistoricIdentityLinkService historicIdentityLinkService = getIdentityLinkServiceConfiguration(engineConfiguration).getHistoricIdentityLinkService();
HistoricIdentityLinkEntity historicIdentityLinkEntity = historicIdentityLinkService.createHistoricIdentityLink();
historicIdentityLinkEntity.setTaskId(taskId);
historicIdentityLinkEntity.setType(type);
historicIdentityLinkEntity.setUserId(userId);
historicIdentityLinkEntity.setCreateTime(configuration.getClock().getCurrentTime());
historicIdentityLinkService.insertHistoricIdentityLink(historicIdentityLinkEntity, false);
}
public HistoricTaskInstanceEntityManager getHistoricTaskInstanceEntityManager() {
return configuration.getHistoricTaskInstanceEntityManager();
}
protected IdentityLinkServiceConfiguration getIdentityLinkServiceConfiguration(AbstractEngineConfiguration engineConfiguration) {
return (IdentityLinkServiceConfiguration) engineConfiguration.getServiceConfigurations().get(EngineConfigurationConstants.KEY_IDENTITY_LINK_SERVICE_CONFIG);
}
}
|
repos\flowable-engine-main\modules\flowable-task-service\src\main\java\org\flowable\task\service\impl\HistoricTaskServiceImpl.java
| 2
|
请完成以下Java代码
|
public static SqlParamsCollector notCollecting()
{
return NOT_COLLECTING;
}
private static final SqlParamsCollector NOT_COLLECTING = new SqlParamsCollector(null);
private final List<Object> params;
private final List<Object> paramsRO;
private SqlParamsCollector(final List<Object> params)
{
this.params = params;
paramsRO = params != null ? Collections.unmodifiableList(params) : null;
}
@Override
public String toString()
{
return MoreObjects.toStringHelper(this)
.addValue(paramsRO)
.toString();
}
public boolean isCollecting()
{
return params != null;
}
/**
* Directly append all sqlParams from the given {@code sqlQueryFilter}.
*
* @param sqlQueryFilter
*
*/
public void collectAll(@NonNull final ISqlQueryFilter sqlQueryFilter)
{
final List<Object> sqlParams = sqlQueryFilter.getSqlParams(Env.getCtx());
collectAll(sqlParams);
}
/**
* Directly append the given {@code sqlParams}. Please prefer using {@link #placeholder(Object)} instead.<br>
* "Package" scope because currently this method is needed only by {@link SqlDefaultDocumentFilterConverter}.
*
* Please avoid using it. It's used mainly to adapt with old code
*
* @param sqlParams
*/
public void collectAll(@Nullable final Collection<? extends Object> sqlParams)
{
if (sqlParams == null || sqlParams.isEmpty())
{
return;
}
if (params == null)
{
throw new IllegalStateException("Cannot append " + sqlParams + " to not collecting params");
}
params.addAll(sqlParams);
}
public void collect(@NonNull final SqlParamsCollector from)
{
collectAll(from.params);
}
|
/**
* Collects given SQL value and returns an SQL placeholder, i.e. "?"
*
* In case this is in non-collecting mode, the given SQL value will be converted to SQL code and it will be returned.
* The internal list won't be affected, because it does not exist.
*/
public String placeholder(@Nullable final Object sqlValue)
{
if (params == null)
{
return DB.TO_SQL(sqlValue);
}
else
{
params.add(sqlValue);
return "?";
}
}
/** @return readonly live list */
public List<Object> toList()
{
return paramsRO;
}
/** @return read/write live list */
public List<Object> toLiveList()
{
return params;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\document\filter\sql\SqlParamsCollector.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void clearRedis() {
redisTemplate.opsForValue().set(CacheConstant.GATEWAY_ROUTES, null);
}
/**
* 还原逻辑删除
* @param ids
*/
@Override
public void revertLogicDeleted(List<String> ids) {
this.baseMapper.revertLogicDeleted(ids);
resreshRouter(null);
}
/**
* 彻底删除
* @param ids
*/
@Override
public void deleteLogicDeleted(List<String> ids) {
this.baseMapper.deleteLogicDeleted(ids);
resreshRouter(ids.get(0));
}
/**
* 路由复制
* @param id
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public SysGatewayRoute copyRoute(String id) {
log.info("--gateway 路由复制--");
SysGatewayRoute targetRoute = new SysGatewayRoute();
try {
SysGatewayRoute sourceRoute = this.baseMapper.selectById(id);
//1.复制路由
BeanUtils.copyProperties(sourceRoute,targetRoute);
//1.1 获取当前日期
String formattedDate = dateFormat.format(new Date());
String copyRouteName = sourceRoute.getName() + "_copy_";
//1.2 判断数据库是否存在
Long count = this.baseMapper.selectCount(new LambdaQueryWrapper<SysGatewayRoute>().eq(SysGatewayRoute::getName, copyRouteName + formattedDate));
//1.3 新的路由名称
copyRouteName += count > 0?RandomUtil.randomNumbers(4):formattedDate;
|
targetRoute.setId(null);
targetRoute.setName(copyRouteName);
targetRoute.setCreateTime(new Date());
targetRoute.setStatus(0);
targetRoute.setDelFlag(CommonConstant.DEL_FLAG_0);
this.baseMapper.insert(targetRoute);
//2.刷新路由
resreshRouter(null);
} catch (Exception e) {
log.error("路由配置解析失败", e);
resreshRouter(null);
e.printStackTrace();
}
return targetRoute;
}
/**
* 查询删除列表
* @return
*/
@Override
public List<SysGatewayRoute> getDeletelist() {
return baseMapper.queryDeleteList();
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-module-system\jeecg-system-biz\src\main\java\org\jeecg\modules\system\service\impl\SysGatewayRouteServiceImpl.java
| 2
|
请完成以下Java代码
|
public int getA_Asset_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_A_Asset_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_AD_WF_Node getAD_WF_Node() throws RuntimeException
{
return (I_AD_WF_Node)MTable.get(getCtx(), I_AD_WF_Node.Table_Name)
.getPO(getAD_WF_Node_ID(), get_TrxName()); }
/** Set Node.
@param AD_WF_Node_ID
Workflow Node (activity), step or process
*/
public void setAD_WF_Node_ID (int AD_WF_Node_ID)
{
if (AD_WF_Node_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_WF_Node_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_WF_Node_ID, Integer.valueOf(AD_WF_Node_ID));
}
/** Get Node.
@return Workflow Node (activity), step or process
*/
public int getAD_WF_Node_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_WF_Node_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Workflow Node Asset.
@param PP_WF_Node_Asset_ID Workflow Node Asset */
public void setPP_WF_Node_Asset_ID (int PP_WF_Node_Asset_ID)
{
if (PP_WF_Node_Asset_ID < 1)
set_ValueNoCheck (COLUMNNAME_PP_WF_Node_Asset_ID, null);
else
set_ValueNoCheck (COLUMNNAME_PP_WF_Node_Asset_ID, Integer.valueOf(PP_WF_Node_Asset_ID));
}
/** Get Workflow Node Asset.
|
@return Workflow Node Asset */
public int getPP_WF_Node_Asset_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_PP_WF_Node_Asset_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Sequence.
@param SeqNo
Method of ordering records; lowest number comes first
*/
public void setSeqNo (int SeqNo)
{
set_ValueNoCheck (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo));
}
/** Get Sequence.
@return Method of ordering records; lowest number comes first
*/
public int getSeqNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_PP_WF_Node_Asset.java
| 1
|
请完成以下Java代码
|
public boolean isExclusive() {
return isExclusive;
}
public void setExclusive(boolean isExclusive) {
this.isExclusive = isExclusive;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.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;
|
AcquirableJobEntity other = (AcquirableJobEntity) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
@Override
public String toString() {
return this.getClass().getSimpleName()
+ "[id=" + id
+ ", revision=" + revision
+ ", lockOwner=" + lockOwner
+ ", lockExpirationTime=" + lockExpirationTime
+ ", duedate=" + duedate
+ ", rootProcessInstanceId=" + rootProcessInstanceId
+ ", processInstanceId=" + processInstanceId
+ ", isExclusive=" + isExclusive
+ "]";
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\AcquirableJobEntity.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Duration getLwcStep() {
return this.lwcStep;
}
public void setLwcStep(Duration lwcStep) {
this.lwcStep = lwcStep;
}
public boolean isLwcIgnorePublishStep() {
return this.lwcIgnorePublishStep;
}
public void setLwcIgnorePublishStep(boolean lwcIgnorePublishStep) {
this.lwcIgnorePublishStep = lwcIgnorePublishStep;
}
public Duration getConfigRefreshFrequency() {
return this.configRefreshFrequency;
}
public void setConfigRefreshFrequency(Duration configRefreshFrequency) {
this.configRefreshFrequency = configRefreshFrequency;
}
public Duration getConfigTimeToLive() {
return this.configTimeToLive;
}
|
public void setConfigTimeToLive(Duration configTimeToLive) {
this.configTimeToLive = configTimeToLive;
}
public String getConfigUri() {
return this.configUri;
}
public void setConfigUri(String configUri) {
this.configUri = configUri;
}
public String getEvalUri() {
return this.evalUri;
}
public void setEvalUri(String evalUri) {
this.evalUri = evalUri;
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-micrometer-metrics\src\main\java\org\springframework\boot\micrometer\metrics\autoconfigure\export\atlas\AtlasProperties.java
| 2
|
请完成以下Java代码
|
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
@Override
public Date getTime() {
return getStartTime();
}
@Override
public Long getWorkTimeInMillis() {
if (endTime == null || claimTime == null) {
return null;
}
return endTime.getTime() - claimTime.getTime();
}
@Override
public Map<String, Object> getTaskLocalVariables() {
Map<String, Object> variables = new HashMap<>();
if (queryVariables != null) {
for (HistoricVariableInstanceEntity variableInstance : queryVariables) {
if (variableInstance.getId() != null && variableInstance.getTaskId() != null) {
variables.put(variableInstance.getName(), variableInstance.getValue());
}
}
}
return variables;
}
@Override
public Map<String, Object> getProcessVariables() {
Map<String, Object> variables = new HashMap<>();
if (queryVariables != null) {
for (HistoricVariableInstanceEntity variableInstance : queryVariables) {
if (variableInstance.getId() != null && variableInstance.getTaskId() == null) {
variables.put(variableInstance.getName(), variableInstance.getValue());
}
}
}
return variables;
}
public List<HistoricVariableInstanceEntity> getQueryVariables() {
|
if (queryVariables == null && Context.getCommandContext() != null) {
queryVariables = new HistoricVariableInitializingList();
}
return queryVariables;
}
public void setQueryVariables(List<HistoricVariableInstanceEntity> queryVariables) {
this.queryVariables = queryVariables;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("HistoricTaskInstanceEntity[");
sb.append("id=").append(id);
sb.append(", name=").append(name);
sb.append("]");
return sb.toString();
}
}
|
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\persistence\entity\HistoricTaskInstanceEntity.java
| 1
|
请完成以下Java代码
|
public ModelElementInstance getModelElementInstance() {
synchronized(document) {
return (ModelElementInstance) element.getUserData(MODEL_ELEMENT_KEY);
}
}
public void setModelElementInstance(ModelElementInstance modelElementInstance) {
synchronized(document) {
element.setUserData(MODEL_ELEMENT_KEY, modelElementInstance, null);
}
}
public String registerNamespace(String namespaceUri) {
synchronized(document) {
String lookupPrefix = lookupPrefix(namespaceUri);
if (lookupPrefix == null) {
// check if a prefix is known
String prefix = XmlQName.KNOWN_PREFIXES.get(namespaceUri);
// check if prefix is not already used
if (prefix != null && getRootElement() != null &&
getRootElement().hasAttribute(XMLNS_ATTRIBUTE_NS_URI, prefix)) {
prefix = null;
}
if (prefix == null) {
// generate prefix
prefix = ((DomDocumentImpl) getDocument()).getUnusedGenericNsPrefix();
}
registerNamespace(prefix, namespaceUri);
return prefix;
}
else {
return lookupPrefix;
}
}
}
public void registerNamespace(String prefix, String namespaceUri) {
synchronized(document) {
element.setAttributeNS(XMLNS_ATTRIBUTE_NS_URI, XMLNS_ATTRIBUTE + ":" + prefix, namespaceUri);
|
}
}
public String lookupPrefix(String namespaceUri) {
synchronized(document) {
return element.lookupPrefix(namespaceUri);
}
}
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
DomElementImpl that = (DomElementImpl) o;
return element.equals(that.element);
}
public int hashCode() {
return element.hashCode();
}
}
|
repos\camunda-bpm-platform-master\model-api\xml-model\src\main\java\org\camunda\bpm\model\xml\impl\instance\DomElementImpl.java
| 1
|
请完成以下Java代码
|
public Codec<ISeq<SpringsteenRecord>, BitGene> codec() {
return codecs.ofSubSet(records);
}
public static void main(String[] args) {
double maxPricePerUniqueSong = 2.5;
SpringsteenProblem springsteen = new SpringsteenProblem(
ISeq.of(new SpringsteenRecord("SpringsteenRecord1", 25, ISeq.of("Song1", "Song2", "Song3", "Song4", "Song5", "Song6")), new SpringsteenRecord("SpringsteenRecord2", 15, ISeq.of("Song2", "Song3", "Song4", "Song5", "Song6", "Song7")),
new SpringsteenRecord("SpringsteenRecord3", 35, ISeq.of("Song5", "Song6", "Song7", "Song8", "Song9", "Song10")), new SpringsteenRecord("SpringsteenRecord4", 17, ISeq.of("Song9", "Song10", "Song12", "Song4", "Song13", "Song14")),
new SpringsteenRecord("SpringsteenRecord5", 29, ISeq.of("Song1", "Song2", "Song13", "Song14", "Song15", "Song16")), new SpringsteenRecord("SpringsteenRecord6", 5, ISeq.of("Song18", "Song20", "Song30", "Song40"))),
maxPricePerUniqueSong);
Engine<BitGene, Double> engine = Engine.builder(springsteen)
.build();
ISeq<SpringsteenRecord> result = springsteen.codec()
.decoder()
.apply(engine.stream()
.limit(10)
.collect(EvolutionResult.toBestGenotype()));
|
double cost = result.stream()
.mapToDouble(r -> r.price)
.sum();
int uniqueSongCount = result.stream()
.flatMap(r -> r.songs.stream())
.collect(Collectors.toSet())
.size();
double pricePerUniqueSong = cost / uniqueSongCount;
System.out.println("Overall cost: " + cost);
System.out.println("Unique songs: " + uniqueSongCount);
System.out.println("Cost per song: " + pricePerUniqueSong);
System.out.println("Records: " + result.map(r -> r.name)
.toString(", "));
}
}
|
repos\tutorials-master\algorithms-modules\algorithms-genetic\src\main\java\com\baeldung\algorithms\ga\jenetics\SpringsteenProblem.java
| 1
|
请完成以下Java代码
|
public static double ChisquareInverseCdf(double p, int df)
{
final double CHI_EPSILON = 0.000001; /* Accuracy of critchi approximation */
final double CHI_MAX = 99999.0; /* Maximum chi-square value */
double minchisq = 0.0;
double maxchisq = CHI_MAX;
double chisqval = 0.0;
if (p <= 0.0)
{
return CHI_MAX;
}
else if (p >= 1.0)
{
return 0.0;
}
chisqval = df / Math.sqrt(p); /* fair first value */
|
while ((maxchisq - minchisq) > CHI_EPSILON)
{
if (1 - ChisquareCdf(chisqval, df) < p)
{
maxchisq = chisqval;
}
else
{
minchisq = chisqval;
}
chisqval = (maxchisq + minchisq) * 0.5;
}
return chisqval;
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\classification\statistics\ContinuousDistributions.java
| 1
|
请完成以下Java代码
|
public Builder withConfiguration(String configuration) {
this.configuration = configuration;
return this;
}
/**
* Builder method for activityId parameter.
* @param activityId field to set
* @return builder
*/
public Builder withActivityId(String activityId) {
this.activityId = activityId;
return this;
}
/**
* Builder method for created parameter.
|
* @param created field to set
* @return builder
*/
public Builder withCreated(Date created) {
this.created = created;
return this;
}
/**
* Builder method of the builder.
* @return built class
*/
public StartMessageSubscriptionImpl build() {
return new StartMessageSubscriptionImpl(this);
}
}
}
|
repos\Activiti-develop\activiti-core\activiti-api-impl\activiti-api-process-model-impl\src\main\java\org\activiti\api\runtime\model\impl\StartMessageSubscriptionImpl.java
| 1
|
请完成以下Java代码
|
public void setPP_Order_ID (int PP_Order_ID)
{
if (PP_Order_ID < 1)
set_Value (COLUMNNAME_PP_Order_ID, null);
else
set_Value (COLUMNNAME_PP_Order_ID, Integer.valueOf(PP_Order_ID));
}
/** Get Produktionsauftrag.
@return Produktionsauftrag */
@Override
public int getPP_Order_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_PP_Order_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Menge.
@param Qty
Menge
*/
@Override
public void setQty (java.math.BigDecimal Qty)
|
{
set_Value (COLUMNNAME_Qty, Qty);
}
/** Get Menge.
@return Menge
*/
@Override
public java.math.BigDecimal getQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty);
if (bd == null)
return Env.ZERO;
return bd;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_PP_MRP_Alternative.java
| 1
|
请完成以下Java代码
|
private static WFActivityStatus computeStatusFromSteps(final @NonNull List<DistributionJobStep> steps)
{
return steps.isEmpty()
? WFActivityStatus.NOT_STARTED
: WFActivityStatus.computeStatusFromLines(steps, DistributionJobStep::getStatus);
}
public DDOrderLineId getDdOrderLineId() {return id.toDDOrderLineId();}
public DistributionJobLine withNewStep(final DistributionJobStep stepToAdd)
{
final ArrayList<DistributionJobStep> changedSteps = new ArrayList<>(this.steps);
boolean added = false;
boolean changed = false;
for (final DistributionJobStep step : steps)
{
if (DistributionJobStepId.equals(step.getId(), stepToAdd.getId()))
{
changedSteps.add(stepToAdd);
added = true;
if (!Objects.equals(step, stepToAdd))
{
changed = true;
}
}
else
{
changedSteps.add(step);
}
}
if (!added)
{
changedSteps.add(stepToAdd);
changed = true;
}
|
return changed
? toBuilder().steps(ImmutableList.copyOf(changedSteps)).build()
: this;
}
public DistributionJobLine withChangedSteps(@NonNull final UnaryOperator<DistributionJobStep> stepMapper)
{
final ImmutableList<DistributionJobStep> changedSteps = CollectionUtils.map(steps, stepMapper);
return changedSteps.equals(steps)
? this
: toBuilder().steps(changedSteps).build();
}
public DistributionJobLine removeStep(@NonNull final DistributionJobStepId stepId)
{
final ImmutableList<DistributionJobStep> updatedStepCollection = steps.stream()
.filter(step -> !step.getId().equals(stepId))
.collect(ImmutableList.toImmutableList());
return updatedStepCollection.equals(steps)
? this
: toBuilder().steps(updatedStepCollection).build();
}
@NonNull
public Optional<DistributionJobStep> getStepById(@NonNull final DistributionJobStepId stepId)
{
return getSteps().stream().filter(step -> step.getId().equals(stepId)).findFirst();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.distribution.rest-api\src\main\java\de\metas\distribution\mobileui\job\model\DistributionJobLine.java
| 1
|
请完成以下Java代码
|
public class EdgeConnectionNotificationInfo implements RuleOriginatedNotificationInfo {
private String eventType;
private TenantId tenantId;
private CustomerId customerId;
private EdgeId edgeId;
private String edgeName;
@Override
public Map<String, String> getTemplateData() {
return mapOf(
"eventType", eventType,
"edgeId", edgeId.toString(),
"edgeName", edgeName
);
}
|
@Override
public TenantId getAffectedTenantId() {
return tenantId;
}
@Override
public CustomerId getAffectedCustomerId() {
return customerId;
}
@Override
public EntityId getStateEntityId() {
return edgeId;
}
}
|
repos\thingsboard-master\common\data\src\main\java\org\thingsboard\server\common\data\notification\info\EdgeConnectionNotificationInfo.java
| 1
|
请完成以下Java代码
|
public PartyIdentification32 getTradgPty() {
return tradgPty;
}
/**
* Sets the value of the tradgPty property.
*
* @param value
* allowed object is
* {@link PartyIdentification32 }
*
*/
public void setTradgPty(PartyIdentification32 value) {
this.tradgPty = value;
}
/**
* Gets the value of the prtry property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
|
* This is why there is not a <CODE>set</CODE> method for the prtry property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPrtry().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ProprietaryParty2 }
*
*
*/
public List<ProprietaryParty2> getPrtry() {
if (prtry == null) {
prtry = new ArrayList<ProprietaryParty2>();
}
return this.prtry;
}
}
|
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\TransactionParty2.java
| 1
|
请完成以下Java代码
|
public String getMessageRef() {
return messageRef;
}
public void setMessageRef(String messageRef) {
this.messageRef = messageRef;
}
public String getMessageExpression() {
return messageExpression;
}
public void setMessageExpression(String messageExpression) {
this.messageExpression = messageExpression;
}
public String getCorrelationKey() {
return correlationKey;
}
public void setCorrelationKey(String correlationKey) {
|
this.correlationKey = correlationKey;
}
public MessageEventDefinition clone() {
MessageEventDefinition clone = new MessageEventDefinition();
clone.setValues(this);
return clone;
}
public void setValues(MessageEventDefinition otherDefinition) {
super.setValues(otherDefinition);
setMessageRef(otherDefinition.getMessageRef());
setMessageExpression(otherDefinition.getMessageExpression());
setFieldExtensions(otherDefinition.getFieldExtensions());
setCorrelationKey(otherDefinition.getCorrelationKey());
}
}
|
repos\Activiti-develop\activiti-core\activiti-bpmn-model\src\main\java\org\activiti\bpmn\model\MessageEventDefinition.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getChannelDefinitionId() {
return channelDefinitionId;
}
public void setChannelDefinitionId(String channelDefinitionId) {
this.channelDefinitionId = channelDefinitionId;
}
@ApiModelProperty(example = "myChannel")
public String getChannelDefinitionKey() {
return channelDefinitionKey;
}
public void setChannelDefinitionKey(String channelDefinitionKey) {
this.channelDefinitionKey = channelDefinitionKey;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
@ApiModelProperty(example = "tenant1")
public String getTenantId() {
|
return tenantId;
}
public ObjectNode getEventPayload() {
return eventPayload;
}
public void setEventPayload(ObjectNode eventPayload) {
this.eventPayload = eventPayload;
}
@JsonIgnore
public boolean isTenantSet() {
return tenantId != null && !StringUtils.isEmpty(tenantId);
}
}
|
repos\flowable-engine-main\modules\flowable-event-registry-rest\src\main\java\org\flowable\eventregistry\rest\service\api\runtime\EventInstanceCreateRequest.java
| 2
|
请完成以下Java代码
|
public int getC_Channel_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Channel_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Set Name.
|
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Channel.java
| 1
|
请完成以下Java代码
|
private IAllocationRequest createAllocationRequest(
@NonNull final PickingCandidate candidate,
@NonNull final Quantity qtyToRemove)
{
final IMutableHUContext huContext = huContextFactory.createMutableHUContextForProcessing();
return AllocationUtils.builder()
.setHUContext(huContext)
.setProduct(productId)
.setQuantity(qtyToRemove)
.setDateAsToday()
.setFromReferencedTableRecord(pickingCandidateRepository.toTableRecordReference(candidate)) // the m_hu_trx_Line coming out of this will reference the picking candidate
.setForceQtyAllocation(true)
.create();
}
private HUListAllocationSourceDestination createAllocationSourceAsHU()
|
{
final I_M_HU hu = load(huId, I_M_HU.class);
// we made sure that if the target HU is active, so the source HU also needs to be active. Otherwise, goods would just seem to vanish
if (!X_M_HU.HUSTATUS_Active.equals(hu.getHUStatus()))
{
throw new AdempiereException("not an active HU").setParameter("hu", hu);
}
final HUListAllocationSourceDestination source = HUListAllocationSourceDestination.of(hu);
source.setDestroyEmptyHUs(true);
return source;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\candidate\commands\RemoveQtyFromHUCommand.java
| 1
|
请完成以下Java代码
|
public List<String> getUstrd() {
if (ustrd == null) {
ustrd = new ArrayList<String>();
}
return this.ustrd;
}
/**
* Gets the value of the strd property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the strd property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getStrd().add(newItem);
|
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link StructuredRemittanceInformation7 }
*
*
*/
public List<StructuredRemittanceInformation7> getStrd() {
if (strd == null) {
strd = new ArrayList<StructuredRemittanceInformation7>();
}
return this.strd;
}
}
|
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\RemittanceInformation5.java
| 1
|
请完成以下Java代码
|
public void setESR_Import_ID (final int ESR_Import_ID)
{
if (ESR_Import_ID < 1)
set_ValueNoCheck (COLUMNNAME_ESR_Import_ID, null);
else
set_ValueNoCheck (COLUMNNAME_ESR_Import_ID, ESR_Import_ID);
}
@Override
public int getESR_Import_ID()
{
return get_ValueAsInt(COLUMNNAME_ESR_Import_ID);
}
@Override
public void setESR_Trx_Qty (final @Nullable BigDecimal ESR_Trx_Qty)
{
throw new IllegalArgumentException ("ESR_Trx_Qty is virtual column"); }
@Override
public BigDecimal getESR_Trx_Qty()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_ESR_Trx_Qty);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setHash (final @Nullable java.lang.String Hash)
{
set_Value (COLUMNNAME_Hash, Hash);
}
@Override
public java.lang.String getHash()
{
return get_ValueAsString(COLUMNNAME_Hash);
}
@Override
public void setIsArchiveFile (final boolean IsArchiveFile)
{
set_Value (COLUMNNAME_IsArchiveFile, IsArchiveFile);
}
@Override
public boolean isArchiveFile()
{
return get_ValueAsBoolean(COLUMNNAME_IsArchiveFile);
}
@Override
public void setIsReceipt (final boolean IsReceipt)
{
set_Value (COLUMNNAME_IsReceipt, IsReceipt);
}
|
@Override
public boolean isReceipt()
{
return get_ValueAsBoolean(COLUMNNAME_IsReceipt);
}
@Override
public void setIsReconciled (final boolean IsReconciled)
{
set_Value (COLUMNNAME_IsReconciled, IsReconciled);
}
@Override
public boolean isReconciled()
{
return get_ValueAsBoolean(COLUMNNAME_IsReconciled);
}
@Override
public void setIsValid (final boolean IsValid)
{
set_Value (COLUMNNAME_IsValid, IsValid);
}
@Override
public boolean isValid()
{
return get_ValueAsBoolean(COLUMNNAME_IsValid);
}
@Override
public void setProcessed (final boolean Processed)
{
set_Value (COLUMNNAME_Processed, Processed);
}
@Override
public boolean isProcessed()
{
return get_ValueAsBoolean(COLUMNNAME_Processed);
}
@Override
public void setProcessing (final boolean Processing)
{
throw new IllegalArgumentException ("Processing is virtual column"); }
@Override
public boolean isProcessing()
{
return get_ValueAsBoolean(COLUMNNAME_Processing);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.esr\src\main\java-gen\de\metas\payment\esr\model\X_ESR_Import.java
| 1
|
请完成以下Java代码
|
public org.compiere.model.I_M_CostRevaluation getM_CostRevaluation()
{
return get_ValueAsPO(COLUMNNAME_M_CostRevaluation_ID, org.compiere.model.I_M_CostRevaluation.class);
}
@Override
public void setM_CostRevaluation(final org.compiere.model.I_M_CostRevaluation M_CostRevaluation)
{
set_ValueFromPO(COLUMNNAME_M_CostRevaluation_ID, org.compiere.model.I_M_CostRevaluation.class, M_CostRevaluation);
}
@Override
public void setM_CostRevaluation_ID (final int M_CostRevaluation_ID)
{
if (M_CostRevaluation_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_CostRevaluation_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_CostRevaluation_ID, M_CostRevaluation_ID);
}
@Override
public int getM_CostRevaluation_ID()
{
return get_ValueAsInt(COLUMNNAME_M_CostRevaluation_ID);
}
@Override
public void setM_CostRevaluationLine_ID (final int M_CostRevaluationLine_ID)
{
if (M_CostRevaluationLine_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_CostRevaluationLine_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_CostRevaluationLine_ID, M_CostRevaluationLine_ID);
}
@Override
public int getM_CostRevaluationLine_ID()
{
return get_ValueAsInt(COLUMNNAME_M_CostRevaluationLine_ID);
}
@Override
public org.compiere.model.I_M_CostType getM_CostType()
{
return get_ValueAsPO(COLUMNNAME_M_CostType_ID, org.compiere.model.I_M_CostType.class);
}
@Override
public void setM_CostType(final org.compiere.model.I_M_CostType M_CostType)
{
set_ValueFromPO(COLUMNNAME_M_CostType_ID, org.compiere.model.I_M_CostType.class, M_CostType);
}
@Override
public void setM_CostType_ID (final int M_CostType_ID)
{
if (M_CostType_ID < 1)
set_Value (COLUMNNAME_M_CostType_ID, null);
else
set_Value (COLUMNNAME_M_CostType_ID, M_CostType_ID);
|
}
@Override
public int getM_CostType_ID()
{
return get_ValueAsInt(COLUMNNAME_M_CostType_ID);
}
@Override
public void setM_Product_ID (final int M_Product_ID)
{
if (M_Product_ID < 1)
set_Value (COLUMNNAME_M_Product_ID, null);
else
set_Value (COLUMNNAME_M_Product_ID, M_Product_ID);
}
@Override
public int getM_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_ID);
}
@Override
public void setNewCostPrice (final BigDecimal NewCostPrice)
{
set_Value (COLUMNNAME_NewCostPrice, NewCostPrice);
}
@Override
public BigDecimal getNewCostPrice()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_NewCostPrice);
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_M_CostRevaluationLine.java
| 1
|
请完成以下Java代码
|
public int getOverallNumberOfInvoicings()
{
return overallNumberOfInvoicings;
}
public static void setQualityAdjustmentActive(final boolean qualityAdjustmentOn)
{
HardCodedQualityBasedConfig.qualityAdjustmentsActive = qualityAdjustmentOn;
}
@Override
public I_M_Product getRegularPPOrderProduct()
{
final IContextAware ctxAware = getContext();
return productPA.retrieveProduct(ctxAware.getCtx(),
M_PRODUCT_REGULAR_PP_ORDER_VALUE,
|
true, // throwExIfProductNotFound
ctxAware.getTrxName());
}
/**
* @return the date that was set with {@link #setValidToDate(Timestamp)}, or falls back to "now plus 2 months". Never returns <code>null</code>.
*/
@Override
public Timestamp getValidToDate()
{
if (validToDate == null)
{
return TimeUtil.addMonths(SystemTime.asDate(), 2);
}
return validToDate;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java\de\metas\materialtracking\ch\lagerkonf\impl\HardCodedQualityBasedConfig.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private IssueId getIssueIdByExternalId(@Nullable final ExternalId externalId,
@NonNull final OrgId orgId)
{
if (externalId == null)
{
return null;
}
final Integer issueId = externalReferenceRepository.getReferencedRecordIdOrNullBy(
ExternalReferenceQuery.builder()
.orgId(orgId)
.externalSystem(externalId.getExternalSystem())
.externalReference(externalId.getId())
.externalReferenceType(ExternalServiceReferenceType.ISSUE_ID)
.build());
return IssueId.ofRepoIdOrNull(issueId);
}
@Nullable
private MilestoneId getMilestoneIdByExternalId(@NonNull final ExternalId externalId,
@NonNull final OrgId orgId)
{
final Integer milestoneId = externalReferenceRepository.getReferencedRecordIdOrNullBy(
ExternalReferenceQuery.builder()
.orgId(orgId)
.externalSystem(externalId.getExternalSystem())
.externalReference(externalId.getId())
.externalReferenceType(ExternalServiceReferenceType.MILESTONE_ID)
.build());
return MilestoneId.ofRepoIdOrNull(milestoneId);
}
private void createMissingRefListForLabels(@NonNull final ImmutableList<IssueLabel> issueLabels)
|
{
issueLabels.stream()
.filter(label -> adReferenceService.retrieveListItemOrNull(LABEL_AD_Reference_ID, label.getValue()) == null)
.map(this::buildRefList)
.forEach(adReferenceService::saveRefList);
}
private ADRefListItemCreateRequest buildRefList(@NonNull final IssueLabel issueLabel)
{
return ADRefListItemCreateRequest
.builder()
.name(TranslatableStrings.constant(issueLabel.getValue()))
.value(issueLabel.getValue())
.referenceId(ReferenceId.ofRepoId(LABEL_AD_Reference_ID))
.build();
}
private void extractAndPropagateAdempiereException(final CompletableFuture completableFuture)
{
try
{
completableFuture.get();
}
catch (final ExecutionException ex)
{
throw AdempiereException.wrapIfNeeded(ex.getCause());
}
catch (final InterruptedException ex1)
{
throw AdempiereException.wrapIfNeeded(ex1);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.serviceprovider\src\main\java\de\metas\serviceprovider\issue\importer\IssueImporterService.java
| 2
|
请完成以下Java代码
|
public class CreateUserTaskAfterContext {
protected UserTask userTask;
protected TaskEntity taskEntity;
protected DelegateExecution execution;
public CreateUserTaskAfterContext() {
}
public CreateUserTaskAfterContext(UserTask userTask, TaskEntity taskEntity, DelegateExecution execution) {
this.userTask = userTask;
this.taskEntity = taskEntity;
this.execution = execution;
}
public UserTask getUserTask() {
return userTask;
}
|
public void setUserTask(UserTask userTask) {
this.userTask = userTask;
}
public TaskEntity getTaskEntity() {
return taskEntity;
}
public void setTaskEntity(TaskEntity taskEntity) {
this.taskEntity = taskEntity;
}
public DelegateExecution getExecution() {
return execution;
}
public void setExecution(DelegateExecution execution) {
this.execution = execution;
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\interceptor\CreateUserTaskAfterContext.java
| 1
|
请完成以下Java代码
|
protected Date getLastDunningDateEffective(final List<I_C_Dunning_Candidate> candidates)
{
Date lastDunningDateEffective = null;
for (final I_C_Dunning_Candidate candidate : candidates)
{
// When we are calculating the effective date, we consider only candidates that have processed dunning docs
if (!candidate.isDunningDocProcessed())
{
continue;
}
final Date dunningDateEffective = candidate.getDunningDateEffective();
Check.assumeNotNull(dunningDateEffective, "DunningDateEffective shall be available for candidate with dunning docs processed: {}", candidate);
if (lastDunningDateEffective == null)
{
lastDunningDateEffective = dunningDateEffective;
}
else if (lastDunningDateEffective.before(dunningDateEffective))
{
lastDunningDateEffective = dunningDateEffective;
}
}
|
return lastDunningDateEffective;
}
/**
* Gets Days after last DunningDateEffective
*
* @param dunningDate
* @param candidates
* @return days after DunningDateEffective or {@link #DAYS_NotAvailable} if not available
*/
protected int getDaysAfterLastDunningEffective(final Date dunningDate, final List<I_C_Dunning_Candidate> candidates)
{
final Date lastDunningDate = getLastDunningDateEffective(candidates);
if (lastDunningDate == null)
{
return DAYS_NotAvailable;
}
final int daysAfterLast = TimeUtil.getDaysBetween(lastDunningDate, dunningDate);
return daysAfterLast;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.dunning\src\main\java\de\metas\dunning\api\impl\DefaultDunningCandidateProducer.java
| 1
|
请完成以下Java代码
|
public BigDecimal getActualAllocation()
{
if (getQty().compareTo(getMinQty()) > 0)
return getQty();
else
return getMinQty();
} // getActualAllocation
/**
* Adjust the Quantity maintaining UOM precision
* @param difference difference
* @return remaining difference (because under Min or rounding)
*/
public BigDecimal adjustQty (BigDecimal difference)
{
BigDecimal diff = difference.setScale(m_precision, BigDecimal.ROUND_HALF_UP);
BigDecimal qty = getQty();
BigDecimal max = getMinQty().subtract(qty);
BigDecimal remaining = Env.ZERO;
if (max.compareTo(diff) > 0) // diff+max are negative
{
remaining = diff.subtract(max);
setQty(qty.add(max));
}
|
else
setQty(qty.add(diff));
log.debug("Qty=" + qty + ", Min=" + getMinQty()
+ ", Max=" + max + ", Diff=" + diff + ", newQty=" + getQty()
+ ", Remaining=" + remaining);
return remaining;
} // adjustQty
/**
* String Representation
* @return info
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MDistributionRunDetail[")
.append (get_ID ())
.append (";M_DistributionListLine_ID=").append (getM_DistributionListLine_ID())
.append(";Qty=").append(getQty())
.append(";Ratio=").append(getRatio())
.append(";MinQty=").append(getMinQty())
.append ("]");
return sb.toString ();
} // toString
} // DistributionRunDetail
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MDistributionRunDetail.java
| 1
|
请完成以下Java代码
|
public void put(String s, Scriptable scriptable, Object o) {
}
@Override
public void put(int i, Scriptable scriptable, Object o) {
}
@Override
public void delete(String s) {
}
@Override
public void delete(int i) {
}
@Override
public Scriptable getPrototype() {
return null;
}
@Override
public void setPrototype(Scriptable scriptable) {
}
@Override
public Scriptable getParentScope() {
|
return null;
}
@Override
public void setParentScope(Scriptable scriptable) {
}
@Override
public Object[] getIds() {
return null;
}
@Override
public Object getDefaultValue(Class<?> aClass) {
return null;
}
@Override
public boolean hasInstance(Scriptable scriptable) {
return false;
}
}
|
repos\flowable-engine-main\modules\flowable-secure-javascript\src\main\java\org\flowable\scripting\secure\impl\SecureScriptScope.java
| 1
|
请完成以下Java代码
|
public String getName() {
return innerPlanItemInstance.getName();
}
@Override
public String getCaseInstanceId() {
return innerPlanItemInstance.getCaseInstanceId();
}
@Override
public String getCaseDefinitionId() {
return innerPlanItemInstance.getCaseDefinitionId();
}
@Override
public String getElementId() {
return innerPlanItemInstance.getElementId();
}
@Override
public String getPlanItemDefinitionId() {
return innerPlanItemInstance.getPlanItemDefinitionId();
}
@Override
public String getStageInstanceId() {
return innerPlanItemInstance.getStageInstanceId();
}
|
@Override
public String getState() {
return innerPlanItemInstance.getState();
}
@Override
public String toString() {
return "SignalEventListenerInstanceImpl{" +
"id='" + getId() + '\'' +
", name='" + getName() + '\'' +
", caseInstanceId='" + getCaseInstanceId() + '\'' +
", caseDefinitionId='" + getCaseDefinitionId() + '\'' +
", elementId='" + getElementId() + '\'' +
", planItemDefinitionId='" + getPlanItemDefinitionId() + '\'' +
", stageInstanceId='" + getStageInstanceId() + '\'' +
'}';
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\runtime\SignalEventListenerInstanceImpl.java
| 1
|
请完成以下Java代码
|
public long getMaxScriptExecutionTime() {
return maxScriptExecutionTime;
}
public void setMaxScriptExecutionTime(long maxScriptExecutionTime) {
this.maxScriptExecutionTime = maxScriptExecutionTime;
}
public long getMaxMemoryUsed() {
return maxMemoryUsed;
}
public void setMaxMemoryUsed(long maxMemoryUsed) {
this.maxMemoryUsed = maxMemoryUsed;
if (maxMemoryUsed > 0) {
try {
Class clazz = Class.forName("com.sun.management.ThreadMXBean");
if (clazz != null) {
this.threadMxBeanWrapper = new SecureScriptThreadMxBeanWrapper();
}
} catch (ClassNotFoundException cnfe) {
LOGGER.warn("com.sun.management.ThreadMXBean was not found on the classpath. " +
"This means that the limiting the memory usage for a script will NOT work.");
}
}
}
|
public int getMaxStackDepth() {
return maxStackDepth;
}
public void setMaxStackDepth(int maxStackDepth) {
this.maxStackDepth = maxStackDepth;
}
public boolean isEnableAccessToBeans() {
return enableAccessToBeans;
}
public void setEnableAccessToBeans(boolean enableAccessToBeans) {
this.enableAccessToBeans = enableAccessToBeans;
}
}
|
repos\flowable-engine-main\modules\flowable-secure-javascript\src\main\java\org\flowable\scripting\secure\impl\SecureScriptContextFactory.java
| 1
|
请完成以下Java代码
|
public void onPostingSign(final I_SAP_GLJournalLine glJournalLine)
{
updateAmtAcct(glJournalLine);
}
@CalloutMethod(columnNames = I_SAP_GLJournalLine.COLUMNNAME_C_ValidCombination_ID)
public void onC_ValidCombination_ID(final I_SAP_GLJournalLine glJournalLine)
{
glJournalService.updateTrxInfo(glJournalLine);
}
@CalloutMethod(columnNames = I_SAP_GLJournalLine.COLUMNNAME_Amount)
public void onAmount(final I_SAP_GLJournalLine glJournalLine)
{
updateAmtAcct(glJournalLine);
}
|
private void updateAmtAcct(final I_SAP_GLJournalLine glJournalLine)
{
final SAPGLJournalCurrencyConversionCtx conversionCtx = getConversionCtx(glJournalLine);
final Money amtAcct = glJournalService.getCurrencyConverter().convertToAcctCurrency(glJournalLine.getAmount(), conversionCtx);
glJournalLine.setAmtAcct(amtAcct.toBigDecimal());
}
private static SAPGLJournalCurrencyConversionCtx getConversionCtx(final I_SAP_GLJournalLine glJournalLine)
{
// NOTE: calling model getter because we expect to be fetched from webui Document
final I_SAP_GLJournal glJournal = glJournalLine.getSAP_GLJournal();
return SAPGLJournalLoaderAndSaver.extractConversionCtx(glJournal);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\gljournal_sap\callout\SAP_GLJournalLine.java
| 1
|
请完成以下Java代码
|
public String getPOReference()
{
return params.getParameterAsString(PARA_POReference);
}
@Override
public BigDecimal getCheck_NetAmtToInvoice()
{
return params.getParameterAsBigDecimal(PARA_Check_NetAmtToInvoice);
}
/**
* Always returns {@code false}.
*/
@Override
public boolean isAssumeOneInvoice()
{
return false;
}
|
@Override
public boolean isCompleteInvoices()
{
return params.getParameterAsBoolean(PARA_IsCompleteInvoices, true /*true for backwards-compatibility*/);
}
/**
* Always returns {@code false}.
*/
@Override
public boolean isStoreInvoicesInResult()
{
return false;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\api\impl\InvoicingParams.java
| 1
|
请完成以下Java代码
|
public void setEntityType (java.lang.String EntityType)
{
set_Value (COLUMNNAME_EntityType, EntityType);
}
/** Get Entitäts-Art.
@return Dictionary Entity Type; Determines ownership and synchronization
*/
@Override
public java.lang.String getEntityType ()
{
return (java.lang.String)get_Value(COLUMNNAME_EntityType);
}
/** Set 'Value' anzeigen.
@param IsValueDisplayed
Displays Value column with the Display column
*/
@Override
public void setIsValueDisplayed (boolean IsValueDisplayed)
{
set_Value (COLUMNNAME_IsValueDisplayed, Boolean.valueOf(IsValueDisplayed));
}
/** Get 'Value' anzeigen.
@return Displays Value column with the Display column
*/
@Override
public boolean isValueDisplayed ()
{
Object oo = get_Value(COLUMNNAME_IsValueDisplayed);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Sql ORDER BY.
@param OrderByClause
Fully qualified ORDER BY clause
*/
@Override
public void setOrderByClause (java.lang.String OrderByClause)
{
set_Value (COLUMNNAME_OrderByClause, OrderByClause);
}
/** Get Sql ORDER BY.
@return Fully qualified ORDER BY clause
*/
@Override
public java.lang.String getOrderByClause ()
{
return (java.lang.String)get_Value(COLUMNNAME_OrderByClause);
}
/** Set Inaktive Werte anzeigen.
@param ShowInactiveValues Inaktive Werte anzeigen */
@Override
|
public void setShowInactiveValues (boolean ShowInactiveValues)
{
set_Value (COLUMNNAME_ShowInactiveValues, Boolean.valueOf(ShowInactiveValues));
}
/** Get Inaktive Werte anzeigen.
@return Inaktive Werte anzeigen */
@Override
public boolean isShowInactiveValues ()
{
Object oo = get_Value(COLUMNNAME_ShowInactiveValues);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Sql WHERE.
@param WhereClause
Fully qualified SQL WHERE clause
*/
@Override
public void setWhereClause (java.lang.String WhereClause)
{
set_Value (COLUMNNAME_WhereClause, WhereClause);
}
/** Get Sql WHERE.
@return Fully qualified SQL WHERE clause
*/
@Override
public java.lang.String getWhereClause ()
{
return (java.lang.String)get_Value(COLUMNNAME_WhereClause);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Ref_Table.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Document document = (Document) o;
return Objects.equals(this._id, document._id) &&
Objects.equals(this.name, document.name) &&
Objects.equals(this.patientId, document.patientId) &&
Objects.equals(this.therapyId, document.therapyId) &&
Objects.equals(this.therapyTypeId, document.therapyTypeId) &&
Objects.equals(this.archived, document.archived) &&
Objects.equals(this.createdBy, document.createdBy) &&
Objects.equals(this.updatedBy, document.updatedBy) &&
Objects.equals(this.createdAt, document.createdAt) &&
Objects.equals(this.updatedAt, document.updatedAt);
}
@Override
public int hashCode() {
return Objects.hash(_id, name, patientId, therapyId, therapyTypeId, archived, createdBy, updatedBy, createdAt, updatedAt);
}
@Override
public String toString() {
|
StringBuilder sb = new StringBuilder();
sb.append("class Document {\n");
sb.append(" _id: ").append(toIndentedString(_id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" patientId: ").append(toIndentedString(patientId)).append("\n");
sb.append(" therapyId: ").append(toIndentedString(therapyId)).append("\n");
sb.append(" therapyTypeId: ").append(toIndentedString(therapyTypeId)).append("\n");
sb.append(" archived: ").append(toIndentedString(archived)).append("\n");
sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n");
sb.append(" updatedBy: ").append(toIndentedString(updatedBy)).append("\n");
sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n");
sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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(java.lang.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\alberta\alberta-document-api\src\main\java\io\swagger\client\model\Document.java
| 2
|
请完成以下Java代码
|
public Paragraph createWatermarkParagraph(String watermark) throws IOException {
PdfFont font = PdfFontFactory.createFont(StandardFonts.HELVETICA);
Text text = new Text(watermark);
text.setFont(font);
text.setFontSize(56);
text.setOpacity(0.5f);
return new Paragraph(text);
}
public void addWatermarkToPage(Document document, int pageIndex, Paragraph paragraph, float verticalOffset) {
PdfPage pdfPage = document.getPdfDocument()
.getPage(pageIndex);
PageSize pageSize = (PageSize) pdfPage.getPageSizeWithRotation();
float x = (pageSize.getLeft() + pageSize.getRight()) / 2;
float y = (pageSize.getTop() + pageSize.getBottom()) / 2;
float xOffset = 100f / 2;
float rotationInRadians = (float) (PI / 180 * 45f);
document.showTextAligned(paragraph, x - xOffset, y + verticalOffset, pageIndex, CENTER, TOP, rotationInRadians);
|
}
public void addWatermarkToExistingPage(Document document, int pageIndex, Paragraph paragraph, PdfExtGState graphicState, float verticalOffset) {
PdfDocument pdfDoc = document.getPdfDocument();
PdfPage pdfPage = pdfDoc.getPage(pageIndex);
PageSize pageSize = (PageSize) pdfPage.getPageSizeWithRotation();
float x = (pageSize.getLeft() + pageSize.getRight()) / 2;
float y = (pageSize.getTop() + pageSize.getBottom()) / 2;
PdfCanvas over = new PdfCanvas(pdfDoc.getPage(pageIndex));
over.saveState();
over.setExtGState(graphicState);
float xOffset = 100f / 2;
float rotationInRadians = (float) (PI / 180 * 45f);
document.showTextAligned(paragraph, x - xOffset, y + verticalOffset, pageIndex, CENTER, TOP, rotationInRadians);
document.flush();
over.restoreState();
over.release();
}
}
|
repos\tutorials-master\libraries-files\src\main\java\com\baeldung\iTextPDF\StoryTime.java
| 1
|
请完成以下Java代码
|
public Long getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(Long gmtCreate) {
this.gmtCreate = gmtCreate;
}
public String getResource() {
return resource;
}
public void setResource(String resource) {
this.resource = resource;
}
public Long getPassQps() {
return passQps;
}
public void setPassQps(Long passQps) {
this.passQps = passQps;
}
public Long getBlockQps() {
return blockQps;
}
public void setBlockQps(Long blockQps) {
this.blockQps = blockQps;
}
public Long getSuccessQps() {
return successQps;
}
|
public void setSuccessQps(Long successQps) {
this.successQps = successQps;
}
public Long getExceptionQps() {
return exceptionQps;
}
public void setExceptionQps(Long exceptionQps) {
this.exceptionQps = exceptionQps;
}
public Double getRt() {
return rt;
}
public void setRt(Double rt) {
this.rt = rt;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
@Override
public int compareTo(MetricVo o) {
return Long.compare(this.timestamp, o.timestamp);
}
}
|
repos\spring-boot-student-master\spring-boot-student-sentinel-dashboard\src\main\java\com\alibaba\csp\sentinel\dashboard\domain\vo\MetricVo.java
| 1
|
请完成以下Java代码
|
public void addError(String errorMessage, Element element) {
errors.add(new ProblemImpl(errorMessage, element));
}
public void addError(String errorMessage, Element element, String... elementIds) {
errors.add(new ProblemImpl(errorMessage, element, elementIds));
}
public void addError(BpmnParseException e) {
errors.add(new ProblemImpl(e));
}
public void addError(BpmnParseException e, String elementId) {
errors.add(new ProblemImpl(e, elementId));
}
public boolean hasErrors() {
return errors != null && !errors.isEmpty();
}
public void addWarning(SAXParseException e) {
warnings.add(new ProblemImpl(e));
}
public void addWarning(String errorMessage, Element element) {
warnings.add(new ProblemImpl(errorMessage, element));
}
public void addWarning(String errorMessage, Element element, String... elementIds) {
warnings.add(new ProblemImpl(errorMessage, element, elementIds));
}
|
public boolean hasWarnings() {
return warnings != null && !warnings.isEmpty();
}
public void logWarnings() {
StringBuilder builder = new StringBuilder();
for (Problem warning : warnings) {
builder.append("\n* ");
builder.append(warning.getMessage());
builder.append(" | resource " + name);
builder.append(warning.toString());
}
LOG.logParseWarnings(builder.toString());
}
public void throwExceptionForErrors() {
StringBuilder strb = new StringBuilder();
for (Problem error : errors) {
strb.append("\n* ");
strb.append(error.getMessage());
strb.append(" | resource " + name);
strb.append(error.toString());
}
throw LOG.exceptionDuringParsing(strb.toString(), name, errors, warnings);
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\util\xml\Parse.java
| 1
|
请完成以下Java代码
|
public void reset()
{
startDate = new Date();
hitCount.set(0);
hitInTrxCount.set(0);
missCount.set(0);
missInTrxCount.set(0);
}
@Override
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
|
请在Spring Boot框架中完成以下Java代码
|
public int hashCode()
{
return Objects.hash(outcomeReason, status);
}
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("class PostSaleAuthenticationProgram {\n");
sb.append(" outcomeReason: ").append(toIndentedString(outcomeReason)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).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\PostSaleAuthenticationProgram.java
| 2
|
请完成以下Java代码
|
public Optional<I_C_PaySelectionLine> retrievePaySelectionLineForPayment(
@NonNull final I_C_PaySelection paySelection,
@NonNull final PaymentId paymentId)
{
final I_C_PaySelectionLine paySelectionLine = queryPaySelectionLines(paySelection)
.addEqualsFilter(I_C_PaySelectionLine.COLUMNNAME_C_Payment_ID, paymentId)
.create()
.firstOnly(I_C_PaySelectionLine.class);
return Optional.ofNullable(paySelectionLine);
}
@Override
public List<I_C_PaySelectionLine> retrievePaySelectionLines(@NonNull final Collection<PaymentId> paymentIds)
{
if (paymentIds.isEmpty())
{
return ImmutableList.of();
}
return queryBL.createQueryBuilder(I_C_PaySelectionLine.class)
.addOnlyActiveRecordsFilter()
.addInArrayFilter(I_C_PaySelectionLine.COLUMNNAME_C_Payment_ID, paymentIds)
.orderBy(I_C_PaySelectionLine.COLUMNNAME_C_PaySelection_ID)
.orderBy(I_C_PaySelectionLine.COLUMNNAME_Line)
.create()
.list();
}
@Override
public IQuery<I_C_PaySelectionLine> queryActivePaySelectionLinesByInvoiceId(@NonNull final Set<InvoiceId> invoiceIds)
{
Check.assumeNotEmpty(invoiceIds, "invoiceIds is not empty");
return queryBL
.createQueryBuilder(I_C_PaySelectionLine.class)
.addInArrayFilter(I_C_PaySelectionLine.COLUMNNAME_C_Invoice_ID, invoiceIds)
|
.addOnlyActiveRecordsFilter()
.create();
}
@Override
public void updatePaySelectionTotalAmt(@NonNull final PaySelectionId paySelectionId)
{
final String sql = "UPDATE C_PaySelection ps "
+ "SET TotalAmt = (SELECT COALESCE(SUM(psl.PayAmt),0) "
+ "FROM C_PaySelectionLine psl "
+ "WHERE ps.C_PaySelection_ID=psl.C_PaySelection_ID AND psl.IsActive='Y') "
+ "WHERE C_PaySelection_ID=?";
DB.executeUpdateAndThrowExceptionOnFail(sql, new Object[] { paySelectionId }, ITrx.TRXNAME_ThreadInherited);
// note: no point in sending a cache-invalidation event just yet, because it wasn't committed
}
@Override
public I_C_PaySelectionLine getPaySelectionLinesById(@NonNull final PaySelectionLineId paySelectionLineId)
{
return load(paySelectionLineId, I_C_PaySelectionLine.class);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.base\src\main\java\de\metas\banking\payment\impl\PaySelectionDAO.java
| 1
|
请完成以下Java代码
|
public void send(@NonNull final UserNotificationRequest request)
{
try
{
newNotificationSender().sendNow(request);
}
catch (final Exception ex)
{
logger.warn("Failed sending notification: {}", request, ex);
}
}
@Override
public void addCtxProvider(final IRecordTextProvider ctxProvider)
{
ctxProviders.addCtxProvider(ctxProvider);
}
@Override
public void setDefaultCtxProvider(final IRecordTextProvider defaultCtxProvider)
{
ctxProviders.setDefaultCtxProvider(defaultCtxProvider);
|
}
@Override
public @NonNull UserNotificationsConfig getUserNotificationsConfig(final UserId adUserId)
{
return Services.get(IUserNotificationsConfigRepository.class).getByUserId(adUserId);
}
@Override
public RoleNotificationsConfig getRoleNotificationsConfig(final RoleId adRoleId)
{
return Services.get(IRoleNotificationsConfigRepository.class).getByRoleId(adRoleId);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\notification\impl\NotificationBL.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getPlanItemInstanceId() {
return planItemInstanceId;
}
public void setPlanItemInstanceId(String planItemInstanceId) {
this.planItemInstanceId = planItemInstanceId;
}
public String getPlanItemInstanceUrl() {
return planItemInstanceUrl;
}
public void setPlanItemInstanceUrl(String planItemInstanceUrl) {
this.planItemInstanceUrl = planItemInstanceUrl;
}
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 getScopeDefinitionId() {
return scopeDefinitionId;
}
public void setScopeDefinitionId(String scopeDefinitionId) {
this.scopeDefinitionId = scopeDefinitionId;
}
public String getScopeId() {
return scopeId;
}
public void setScopeId(String scopeId) {
this.scopeId = scopeId;
}
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 Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public String getConfiguration() {
return configuration;
}
public void setConfiguration(String configuration) {
this.configuration = configuration;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public String getTenantId() {
return tenantId;
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\runtime\caze\EventSubscriptionResponse.java
| 2
|
请完成以下Java代码
|
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(DecisionTask.class, CMMN_ELEMENT_DECISION_TASK)
.namespaceUri(CMMN11_NS)
.extendsType(Task.class)
.instanceProvider(new ModelTypeInstanceProvider<DecisionTask>() {
public DecisionTask newInstance(ModelTypeInstanceContext instanceContext) {
return new DecisionTaskImpl(instanceContext);
}
});
decisionRefAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_DECISION_REF)
.build();
/** Camunda extensions */
camundaResultVariableAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_RESULT_VARIABLE)
.namespace(CAMUNDA_NS)
.build();
camundaDecisionBindingAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_DECISION_BINDING)
.namespace(CAMUNDA_NS)
.build();
camundaDecisionVersionAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_DECISION_VERSION)
.namespace(CAMUNDA_NS)
.build();
|
camundaDecisionTenantIdAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_DECISION_TENANT_ID)
.namespace(CAMUNDA_NS)
.build();
camundaMapDecisionResultAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_MAP_DECISION_RESULT)
.namespace(CAMUNDA_NS)
.build();
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
parameterMappingCollection = sequenceBuilder.elementCollection(ParameterMapping.class)
.build();
decisionRefExpressionChild = sequenceBuilder.element(DecisionRefExpression.class)
.build();
typeBuilder.build();
}
}
|
repos\camunda-bpm-platform-master\model-api\cmmn-model\src\main\java\org\camunda\bpm\model\cmmn\impl\instance\DecisionTaskImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public B recoverer(MessageRecoverer recoverer) {
this.messageRecoverer = recoverer;
return _this();
}
protected void applyCommonSettings(AbstractRetryOperationsInterceptorFactoryBean factoryBean) {
if (this.messageRecoverer != null) {
factoryBean.setMessageRecoverer(this.messageRecoverer);
}
RetryPolicy retryPolicyToUse = (this.retryPolicy != null) ? this.retryPolicy : this.retryPolicyBuilder.build();
factoryBean.setRetryPolicy(retryPolicyToUse);
}
public abstract T build();
/**
* Builder for a stateful interceptor.
*/
public static final class StatefulRetryInterceptorBuilder
extends RetryInterceptorBuilder<StatefulRetryInterceptorBuilder, StatefulRetryOperationsInterceptor> {
private final StatefulRetryOperationsInterceptorFactoryBean factoryBean =
new StatefulRetryOperationsInterceptorFactoryBean();
private @Nullable MessageKeyGenerator messageKeyGenerator;
private @Nullable NewMessageIdentifier newMessageIdentifier;
StatefulRetryInterceptorBuilder() {
}
/**
* Stateful retry requires messages to be identifiable. The default is to use the message id header;
* use a custom implementation if the message id is not present or not reliable.
* @param messageKeyGenerator The key generator.
* @return this.
*/
public StatefulRetryInterceptorBuilder messageKeyGenerator(MessageKeyGenerator messageKeyGenerator) {
this.messageKeyGenerator = messageKeyGenerator;
return this;
}
/**
* Apply a custom new message identifier. The default is to use the redelivered header.
* @param newMessageIdentifier The new message identifier.
* @return this.
*/
|
public StatefulRetryInterceptorBuilder newMessageIdentifier(NewMessageIdentifier newMessageIdentifier) {
this.newMessageIdentifier = newMessageIdentifier;
return this;
}
@Override
public StatefulRetryOperationsInterceptor build() {
this.applyCommonSettings(this.factoryBean);
if (this.messageKeyGenerator != null) {
this.factoryBean.setMessageKeyGenerator(this.messageKeyGenerator);
}
if (this.newMessageIdentifier != null) {
this.factoryBean.setNewMessageIdentifier(this.newMessageIdentifier);
}
return this.factoryBean.getObject();
}
}
/**
* Builder for a stateless interceptor.
*/
public static final class StatelessRetryInterceptorBuilder
extends RetryInterceptorBuilder<StatelessRetryInterceptorBuilder, StatelessRetryOperationsInterceptor> {
private final StatelessRetryOperationsInterceptorFactoryBean factoryBean =
new StatelessRetryOperationsInterceptorFactoryBean();
StatelessRetryInterceptorBuilder() {
}
@Override
public StatelessRetryOperationsInterceptor build() {
this.applyCommonSettings(this.factoryBean);
return this.factoryBean.getObject();
}
}
}
|
repos\spring-amqp-main\spring-rabbit\src\main\java\org\springframework\amqp\rabbit\config\RetryInterceptorBuilder.java
| 2
|
请完成以下Java代码
|
public String getEntityType ()
{
return (String)get_Value(COLUMNNAME_EntityType);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Sql ORDER BY.
@param OrderByClause
Fully qualified ORDER BY clause
*/
public void setOrderByClause (String OrderByClause)
{
set_Value (COLUMNNAME_OrderByClause, OrderByClause);
}
/** Get Sql ORDER BY.
|
@return Fully qualified ORDER BY clause
*/
public String getOrderByClause ()
{
return (String)get_Value(COLUMNNAME_OrderByClause);
}
/** Set Sql WHERE.
@param WhereClause
Fully qualified SQL WHERE clause
*/
public void setWhereClause (String WhereClause)
{
set_Value (COLUMNNAME_WhereClause, WhereClause);
}
/** Get Sql WHERE.
@return Fully qualified SQL WHERE clause
*/
public String getWhereClause ()
{
return (String)get_Value(COLUMNNAME_WhereClause);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_ReportView.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Boolean sIsMember(String key, Object value) {
return redisTemplate.opsForSet().isMember(key, value);
}
@Override
public Long sSize(String key) {
return redisTemplate.opsForSet().size(key);
}
@Override
public Long sRemove(String key, Object... values) {
return redisTemplate.opsForSet().remove(key, values);
}
@Override
public List<Object> lRange(String key, long start, long end) {
return redisTemplate.opsForList().range(key, start, end);
}
@Override
public Long lSize(String key) {
return redisTemplate.opsForList().size(key);
}
@Override
public Object lIndex(String key, long index) {
return redisTemplate.opsForList().index(key, index);
}
@Override
public Long lPush(String key, Object value) {
return redisTemplate.opsForList().rightPush(key, value);
}
@Override
public Long lPush(String key, Object value, long time) {
Long index = redisTemplate.opsForList().rightPush(key, value);
expire(key, time);
return index;
}
|
@Override
public Long lPushAll(String key, Object... values) {
return redisTemplate.opsForList().rightPushAll(key, values);
}
@Override
public Long lPushAll(String key, Long time, Object... values) {
Long count = redisTemplate.opsForList().rightPushAll(key, values);
expire(key, time);
return count;
}
@Override
public Long lRemove(String key, long count, Object value) {
return redisTemplate.opsForList().remove(key, count, value);
}
}
|
repos\mall-master\mall-common\src\main\java\com\macro\mall\common\service\impl\RedisServiceImpl.java
| 2
|
请完成以下Java代码
|
public class C_DunningDoc_JasperWithInvoicePDFsStrategy implements ExecuteReportStrategy
{
private static final Logger logger = LogManager.getLogger(C_DunningDoc_JasperWithInvoicePDFsStrategy.class);
private final transient IArchiveBL archiveBL = Services.get(IArchiveBL.class);
private final transient int dunningDocJasperProcessId;
public C_DunningDoc_JasperWithInvoicePDFsStrategy(final int dunningDocJasperProcessId)
{
this.dunningDocJasperProcessId = dunningDocJasperProcessId;
}
@Override
public ExecuteReportResult executeReport(
@NonNull final ProcessInfo processInfo,
@NonNull final OutputType outputType)
{
final DunningDocId dunningDocId = DunningDocId.ofRepoId(processInfo.getRecord_ID());
final Resource dunningDocData = ExecuteReportStrategyUtil.executeJasperProcess(dunningDocJasperProcessId, processInfo, outputType);
final boolean isPDF = OutputType.PDF.equals(outputType);
if (!isPDF)
{
Loggables.withLogger(logger, Level.WARN).addLog("Concatenating additional PDF-Data is not supported with outputType={}; returning only the jasper data itself.", outputType);
return ExecuteReportResult.of(outputType, dunningDocData);
}
final DunningService dunningService = SpringContextHolder.instance.getBean(DunningService.class);
final List<I_C_Invoice> dunnedInvoices = dunningService.retrieveDunnedInvoices(dunningDocId);
|
final List<PdfDataProvider> additionalDataItemsToAttach = retrieveAdditionalDataItems(dunnedInvoices);
final Resource data = ExecuteReportStrategyUtil.concatenatePDF(dunningDocData, additionalDataItemsToAttach);
return ExecuteReportResult.of(outputType, data);
}
private List<PdfDataProvider> retrieveAdditionalDataItems(@NonNull final List<I_C_Invoice> dunnedInvoices)
{
final ImmutableList.Builder<PdfDataProvider> result = ImmutableList.builder();
for (final I_C_Invoice invoice : dunnedInvoices)
{
final TableRecordReference invoiceRef = TableRecordReference.of(invoice);
final Resource data = archiveBL.getLastArchiveBinaryData(invoiceRef).orElse(null);
if(data == null)
{
continue;
}
result.add(PdfDataProvider.forData(data));
}
return result.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.dunning\src\main\java\de\metas\dunning\process\C_DunningDoc_JasperWithInvoicePDFsStrategy.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
ServletRegistrationBean<JakartaWebServlet> h2Console() {
String path = this.properties.getPath();
String urlMapping = path + (path.endsWith("/") ? "*" : "/*");
ServletRegistrationBean<JakartaWebServlet> registration = new ServletRegistrationBean<>(new JakartaWebServlet(),
urlMapping);
configureH2ConsoleSettings(registration, this.properties.getSettings());
return registration;
}
@Bean
H2ConsoleLogger h2ConsoleLogger(ObjectProvider<DataSource> dataSources) {
return new H2ConsoleLogger(dataSources, this.properties.getPath());
}
private void configureH2ConsoleSettings(ServletRegistrationBean<JakartaWebServlet> registration,
Settings settings) {
if (settings.isTrace()) {
registration.addInitParameter("trace", "");
}
if (settings.isWebAllowOthers()) {
registration.addInitParameter("webAllowOthers", "");
}
if (settings.getWebAdminPassword() != null) {
registration.addInitParameter("webAdminPassword", settings.getWebAdminPassword());
}
}
static class H2ConsoleLogger {
H2ConsoleLogger(ObjectProvider<DataSource> dataSources, String path) {
if (logger.isInfoEnabled()) {
ClassLoader classLoader = getClass().getClassLoader();
withThreadContextClassLoader(classLoader, () -> log(getConnectionUrls(dataSources), path));
}
}
private void withThreadContextClassLoader(ClassLoader classLoader, Runnable action) {
ClassLoader previous = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(classLoader);
action.run();
}
finally {
Thread.currentThread().setContextClassLoader(previous);
}
|
}
private List<String> getConnectionUrls(ObjectProvider<DataSource> dataSources) {
return dataSources.orderedStream(ObjectProvider.UNFILTERED)
.map(this::getConnectionUrl)
.filter(Objects::nonNull)
.toList();
}
private @Nullable String getConnectionUrl(DataSource dataSource) {
try (Connection connection = dataSource.getConnection()) {
return "'" + connection.getMetaData().getURL() + "'";
}
catch (Exception ex) {
return null;
}
}
private void log(List<String> urls, String path) {
if (!urls.isEmpty()) {
logger.info(LogMessage.format("H2 console available at '%s'. %s available at %s", path,
(urls.size() > 1) ? "Databases" : "Database", String.join(", ", urls)));
}
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-h2console\src\main\java\org\springframework\boot\h2console\autoconfigure\H2ConsoleAutoConfiguration.java
| 2
|
请完成以下Java代码
|
private void push(JSONObject jo) throws JSONException {
if (this.top >= maxdepth) {
throw new JSONException("Nesting too deep.");
}
this.stack[this.top] = jo;
this.mode = jo == null ? 'a' : 'k';
this.top += 1;
}
/**
* Append either the value <code>true</code> or the value <code>false</code> .
*
* @param b
* A boolean.
* @return this
* @throws JSONException
*/
public JSONWriter value(boolean b) throws JSONException {
return this.append(b ? "true" : "false");
}
/**
* Append a double value.
*
* @param d
* A double.
* @return this
* @throws JSONException
* If the number is not finite.
*/
public JSONWriter value(double d) throws JSONException {
return this.value(Double.valueOf(d));
}
/**
* Append a long value.
*
* @param l
* A long.
|
* @return this
* @throws JSONException
*/
public JSONWriter value(long l) throws JSONException {
return this.append(Long.toString(l));
}
/**
* Append an object value.
*
* @param o
* The object to append. It can be null, or a Boolean, Number, String, JSONObject, or JSONArray, or an object with a toJSONString() method.
* @return this
* @throws JSONException
* If the value is out of sequence.
*/
public JSONWriter value(Object o) throws JSONException {
return this.append(JSONObject.valueToString(o));
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\util\json\JSONWriter.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private static List<String> retrieveStringList(final String sql,
final String trxName)
{
final List<String> result = new ArrayList<>();
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql, trxName);
rs = pstmt.executeQuery();
while (rs.next())
{
String s = rs.getString(1);
result.add(s);
}
}
catch (SQLException e)
{
throw new DBException(e, sql);
}
finally
{
DB.close(rs, pstmt);
}
return result;
}
private List<Integer> retrieveDynRecordIds(RuntimeContext sweepCtx,
String referingTable, String tableName, int recordId)
{
final String keyColName = getKeyColName(sweepCtx.ctx, referingTable);
if (keyColName == null)
{
logger.trace("Table " + referingTable
+ " has no regular key column; Returning emtpy list");
return Collections.emptyList();
}
final MTable table = MTable.get(sweepCtx.ctx, tableName);
if (table == null || table.getAD_Table_ID() <= 0)
{
logger.warn("Table " + tableName + " not found");
return Collections.emptyList();
}
final int adTableId = table.getAD_Table_ID();
final String refInfoStr = "[ FROM " + referingTable
+ " WHERE AD_Table_ID=" + tableName + " AND Record_ID"
+ recordId + "]";
try
{
final String wc = "AD_Table_ID=" + adTableId + " AND Record_ID="
+ recordId;
final int[] ids = new Query(sweepCtx.ctx, referingTable, wc,
sweepCtx.trxName).setClient_ID().setOrderBy(keyColName)
.getIDs();
if (ids.length == 0)
{
logger.trace("Retrieved NO RecordIDs for " + refInfoStr);
return Collections.emptyList();
}
logger.debug("Retrieved " + ids.length + " RecordIDs for "
+ refInfoStr);
final List<Integer> result = new ArrayList<>(ids.length);
for (final int id : ids)
{
result.add(id);
|
}
return result;
}
catch (DBException e)
{
logMsg(sweepCtx, "DBException while trying to retrieve Ids for "
+ refInfoStr + ". \nMsg=[" + e.getMessage() + "] \nSQL=["
+ e.getSQL() + "]");
logger.warn(e.getLocalizedMessage(), e);
throw e;
}
}
private int m_storage_recalculate(String trxName)
{
final String sql = "select m_storage_recalculate()";
return DB.getSQLValueEx(trxName, sql);
}
private static final class RuntimeContext
{
private Properties ctx;
private String trxName;
private int targetClientId = -1;
private JavaProcess process;
/**
* (TableName#RecordId) => {@link #DELETED} or {@link #REFERRING_RECORDS_ADDED}
*/
private final Map<String, String> records = new HashMap<>();
private Set<String> pathsVisited = new HashSet<>();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\adempiere\service\impl\SweepTableBL.java
| 2
|
请完成以下Java代码
|
public boolean isCompleted()
{
return completed;
}
public JSONLookupValuesList getFieldDropdownValues(final String fieldName, final String adLanguage)
{
return getQuickInputDocument()
.getFieldLookupValues(fieldName)
.transform(lookupValuesList -> JSONLookupValuesList.ofLookupValuesList(lookupValuesList, adLanguage));
}
public JSONLookupValuesPage getFieldTypeaheadValues(final String fieldName, final String query, final String adLanguage)
{
return getQuickInputDocument()
.getFieldLookupValuesForQuery(fieldName, query)
.transform(page -> JSONLookupValuesPage.of(page, adLanguage));
}
public boolean hasField(final String fieldName)
{
return getQuickInputDocument().hasField(fieldName);
}
//
//
// ------
//
//
//
public static final class Builder
{
private static final AtomicInteger nextQuickInputDocumentId = new AtomicInteger(1);
private DocumentPath _rootDocumentPath;
private QuickInputDescriptor _quickInputDescriptor;
private Builder()
{
super();
}
public QuickInput build()
{
return new QuickInput(this);
}
public Builder setRootDocumentPath(final DocumentPath rootDocumentPath)
{
_rootDocumentPath = Preconditions.checkNotNull(rootDocumentPath, "rootDocumentPath");
|
return this;
}
private DocumentPath getRootDocumentPath()
{
Check.assumeNotNull(_rootDocumentPath, "Parameter rootDocumentPath is not null");
return _rootDocumentPath;
}
public Builder setQuickInputDescriptor(final QuickInputDescriptor quickInputDescriptor)
{
_quickInputDescriptor = quickInputDescriptor;
return this;
}
private QuickInputDescriptor getQuickInputDescriptor()
{
Check.assumeNotNull(_quickInputDescriptor, "Parameter quickInputDescriptor is not null");
return _quickInputDescriptor;
}
private DetailId getTargetDetailId()
{
final DetailId targetDetailId = getQuickInputDescriptor().getDetailId();
Check.assumeNotNull(targetDetailId, "Parameter targetDetailId is not null");
return targetDetailId;
}
private Document buildQuickInputDocument()
{
return Document.builder(getQuickInputDescriptor().getEntityDescriptor())
.initializeAsNewDocument(nextQuickInputDocumentId::getAndIncrement, VERSION_DEFAULT);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\quickinput\QuickInput.java
| 1
|
请完成以下Java代码
|
protected EntityView toEntityView() {
EntityView entityView = new EntityView(new EntityViewId(getUuid()));
entityView.setCreatedTime(createdTime);
entityView.setVersion(version);
if (entityId != null) {
entityView.setEntityId(EntityIdFactory.getByTypeAndUuid(entityType.name(), entityId));
}
if (tenantId != null) {
entityView.setTenantId(TenantId.fromUUID(tenantId));
}
if (customerId != null) {
entityView.setCustomerId(new CustomerId(customerId));
}
entityView.setType(type);
entityView.setName(name);
|
try {
entityView.setKeys(JacksonUtil.fromString(keys, TelemetryEntityView.class));
} catch (IllegalArgumentException e) {
log.error("Unable to read entity view keys!", e);
}
entityView.setStartTimeMs(startTs);
entityView.setEndTimeMs(endTs);
entityView.setAdditionalInfo(additionalInfo);
if (externalId != null) {
entityView.setExternalId(new EntityViewId(externalId));
}
return entityView;
}
}
|
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\model\sql\AbstractEntityViewEntity.java
| 1
|
请完成以下Java代码
|
public Response createCustomer(Customer customer, @Context UriInfo uriInfo){
customer = customerService.save(customer);
long id = customer.getId();
URI createURi = uriInfo.getAbsolutePathBuilder().path(Long.toString(id)).build();
return Response.created(createURi).build();
}
// @PUT
// @Path("/{id}")
// public Response updateCustomer(@PathParam("id") long id, Customer customer){
// Customer inDB = customerService.findOne(id);
// if(inDB==null){
// throw new WebApplicationException(javax.ws.rs.core.Response.Status.NOT_FOUND);
// }
//
// inDB.setFirstName(customer.getFirstName());
// inDB.setLastName(customer.getLastName());
// customerService.update(inDB);
|
// return Response.noContent().build();
// }
// @DELETE
// @Path("/{id}")
// public Response deleteCustomer(@PathParam("id") long id) {
// Customer inDB = customerService.findOne(id);
// if(inDB==null){
// throw new WebApplicationException(javax.ws.rs.core.Response.Status.NOT_FOUND);
// }
// customerService.delete(inDB);
// return Response.ok().build();
// }
}
|
repos\SpringBoot-Projects-FullStack-master\Part-4 Spring Boot REST API\SpringJerseySimple\src\main\java\spring\jersey\resource\CustomerResource.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class Main {
@Autowired
static KafkaMessageConsumer kafkaMessageConsumer;
@Bean
public KafkaTemplate<String, String> kafkaTemplate() {
return new KafkaTemplate<>(producerFactory());
}
@Bean
public ProducerFactory<String, String> producerFactory() {
Map<String, Object> configProps = new HashMap<>();
configProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
configProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
configProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
return new DefaultKafkaProducerFactory<>(configProps);
}
@Bean
public KafkaConsumer<String, String> kafkaConsumer() {
Map<String, Object> configProps = new HashMap<>();
configProps.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
configProps.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
configProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
configProps.put(ConsumerConfig.GROUP_ID_CONFIG, "my-consumer-group");
return new KafkaConsumer<>(configProps);
|
}
public static void main(String[] args) {
ConfigurableApplicationContext context = SpringApplication.run(Main.class, args);
// Get the KafkaTemplate bean from the application context
KafkaTemplate<String, String> kafkaTemplate = context.getBean(KafkaTemplate.class);
// Send a message to the "my-topic" Kafka topic
String message = "Hello Baeldung!";
kafkaTemplate.send("my-topic", message);
// Close the application context
context.close();
}
}
|
repos\tutorials-master\spring-kafka-3\src\main\java\com\baeldung\spring\kafka\viewheaders\Main.java
| 2
|
请完成以下Java代码
|
public String getSummaryTranslated(final Properties ctx)
{
final IMsgBL msgBL = Services.get(IMsgBL.class);
final int countWorkpackages = getWorkpackageEnqueuedCount();
final int countUnprocessedWorkPackages = getWorkpackageQueueSizeBeforeEnqueueing();
return msgBL.getMsg(ctx, MSG_INVOICE_CANDIDATE_ENQUEUE, new Object[] { countWorkpackages, countUnprocessedWorkPackages });
}
@Override
public int getInvoiceCandidateEnqueuedCount()
{
return invoiceCandidateEnqueuedCount;
}
@Override
public int getWorkpackageEnqueuedCount()
{
return workpackageEnqueuedCount;
}
@Override
public int getWorkpackageQueueSizeBeforeEnqueueing()
|
{
return workpackageQueueSizeBeforeEnqueueing;
}
@Override
public BigDecimal getTotalNetAmtToInvoiceChecksum()
{
return totalNetAmtToInvoiceChecksum;
}
@Override
public ILock getLock()
{
return lock;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\api\impl\InvoiceCandidateEnqueueResult.java
| 1
|
请完成以下Java代码
|
protected String doIt() throws Exception
{
if (p_EXP_Format_ID <= 0)
throw new FillMandatoryException("EXP_Format_ID");
I_EXP_Format format = InterfaceWrapperHelper.create(new MEXPFormat(getCtx(), p_EXP_Format_ID, get_TrxName()), I_EXP_Format.class);
MTable table = (MTable)format.getAD_Table();
for (MColumn column : table.getColumns(true))
{
if (isColumnDefined(format, column))
continue;
I_EXP_FormatLine line = createFormatLine(format, column, -1, false);
addLog("Added "+format.getValue()+" - "+line.getValue());
}
return null;
}
private boolean isColumnDefined(I_EXP_Format format, I_AD_Column column)
{
final String whereClause = I_EXP_FormatLine.COLUMNNAME_EXP_Format_ID + "=?"
+ " AND " + I_EXP_FormatLine.COLUMNNAME_AD_Column_ID + "=?";
return new Query(getCtx(), I_EXP_FormatLine.Table_Name, whereClause, get_TrxName())
.setParameters(format.getEXP_Format_ID(), column.getAD_Column_ID())
.anyMatch();
}
private I_EXP_FormatLine createFormatLine(I_EXP_Format format, I_AD_Column col, int position, boolean force) throws Exception
{
final I_EXP_FormatLine formatLine = InterfaceWrapperHelper.create(getCtx(), I_EXP_FormatLine.class, get_TrxName());
formatLine.setAD_Org_ID(format.getAD_Org_ID());
formatLine.setEXP_Format_ID(format.getEXP_Format_ID());
formatLine.setAD_Column_ID(col.getAD_Column_ID());
formatLine.setValue(col.getColumnName());
formatLine.setName(col.getName());
formatLine.setDescription(col.getDescription());
formatLine.setHelp(col.getHelp());
formatLine.setIsMandatory(col.isMandatory());
if (!"D".equals(format.getEntityType()))
formatLine.setEntityType(format.getEntityType());
if (position > 0)
{
formatLine.setPosition(position);
}
|
else
{
final String whereClause = I_EXP_FormatLine.COLUMNNAME_EXP_Format_ID + "=?";
int newPosition = new Query(getCtx(), I_EXP_FormatLine.Table_Name, whereClause, get_TrxName())
.setParameters(format.getEXP_Format_ID())
.aggregate(I_EXP_FormatLine.COLUMNNAME_Position, Query.Aggregate.MAX, Integer.class);
newPosition += 10;
formatLine.setPosition(newPosition);
}
if (force || (col.isIdentifier() && !col.isKey()))
{
formatLine.setIsPartUniqueIndex(true);
formatLine.setIsActive(true);
}
else
{
formatLine.setIsActive(false);
}
if (DisplayType.isID(col.getAD_Reference_ID()))
{
formatLine.setType(X_EXP_FormatLine.TYPE_ReferencedEXPFormat);
}
else
{
formatLine.setType(X_EXP_FormatLine.TYPE_XMLElement);
}
InterfaceWrapperHelper.save(formatLine);
return formatLine;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\esb\process\EXPFormatUpdateFromTable.java
| 1
|
请完成以下Java代码
|
public static void removeSession(WebSocketSession session) {
// 从 SESSION_USER_MAP 中移除
String user = SESSION_USER_MAP.remove(session);
// 从 USER_SESSION_MAP 中移除
if (user != null && user.length() > 0) {
USER_SESSION_MAP.remove(user);
}
}
// ========== 消息相关 ==========
/**
* 广播发送消息给所有在线用户
*
* @param type 消息类型
* @param message 消息体
* @param <T> 消息类型
*/
public static <T extends Message> void broadcast(String type, T message) {
// 创建消息
TextMessage textMessage = buildTextMessage(type, message);
// 遍历 SESSION_USER_MAP ,进行逐个发送
for (WebSocketSession session : SESSION_USER_MAP.keySet()) {
sendTextMessage(session, textMessage);
}
}
/**
* 发送消息给单个用户的 Session
*
* @param session Session
* @param type 消息类型
* @param message 消息体
* @param <T> 消息类型
*/
public static <T extends Message> void send(WebSocketSession session, String type, T message) {
// 创建消息
TextMessage textMessage = buildTextMessage(type, message);
// 遍历给单个 Session ,进行逐个发送
sendTextMessage(session, textMessage);
}
/**
* 发送消息给指定用户
*
* @param user 指定用户
* @param type 消息类型
* @param message 消息体
* @param <T> 消息类型
* @return 发送是否成功你那个
*/
public static <T extends Message> boolean send(String user, String type, T message) {
// 获得用户对应的 Session
WebSocketSession session = USER_SESSION_MAP.get(user);
if (session == null) {
LOGGER.error("[send][user({}) 不存在对应的 session]", user);
return false;
}
// 发送消息
send(session, type, message);
return true;
|
}
/**
* 构建完整的消息
*
* @param type 消息类型
* @param message 消息体
* @param <T> 消息类型
* @return 消息
*/
private static <T extends Message> TextMessage buildTextMessage(String type, T message) {
JSONObject messageObject = new JSONObject();
messageObject.put("type", type);
messageObject.put("body", message);
return new TextMessage(messageObject.toString());
}
/**
* 真正发送消息
*
* @param session Session
* @param textMessage 消息
*/
private static void sendTextMessage(WebSocketSession session, TextMessage textMessage) {
if (session == null) {
LOGGER.error("[sendTextMessage][session 为 null]");
return;
}
try {
session.sendMessage(textMessage);
} catch (IOException e) {
LOGGER.error("[sendTextMessage][session({}) 发送消息{}) 发生异常",
session, textMessage, e);
}
}
}
|
repos\SpringBoot-Labs-master\lab-25\lab-websocket-25-02\src\main\java\cn\iocoder\springboot\lab25\springwebsocket\util\WebSocketUtil.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public List<HistoricTaskInstance> findHistoricTaskInstancesByNativeQuery(Map<String, Object> parameterMap) {
return getDbSqlSession().selectListWithRawParameter("selectHistoricTaskInstanceByNativeQuery", parameterMap);
}
@Override
public long findHistoricTaskInstanceCountByNativeQuery(Map<String, Object> parameterMap) {
return (Long) getDbSqlSession().selectOne("selectHistoricTaskInstanceCountByNativeQuery", parameterMap);
}
@Override
public void deleteHistoricTaskInstances(HistoricTaskInstanceQueryImpl historicTaskInstanceQuery) {
getDbSqlSession().delete("bulkDeleteHistoricTaskInstances", historicTaskInstanceQuery, HistoricTaskInstanceEntityImpl.class);
}
@Override
public void bulkDeleteHistoricTaskInstancesForIds(Collection<String> taskIds) {
getDbSqlSession().delete("bulkDeleteHistoricTaskInstancesForIds", createSafeInValuesList(taskIds), HistoricTaskInstanceEntityImpl.class);
}
@Override
public void deleteHistoricTaskInstancesForNonExistingProcessInstances() {
getDbSqlSession().delete("bulkDeleteHistoricTaskInstancesForNonExistingProcessInstances", null, HistoricTaskInstanceEntityImpl.class);
}
@Override
public void deleteHistoricTaskInstancesForNonExistingCaseInstances() {
getDbSqlSession().delete("bulkDeleteHistoricTaskInstancesForNonExistingCaseInstances", null, HistoricTaskInstanceEntityImpl.class);
}
|
@Override
protected IdGenerator getIdGenerator() {
return taskServiceConfiguration.getIdGenerator();
}
protected void setSafeInValueLists(HistoricTaskInstanceQueryImpl historicTaskInstanceQuery) {
if (historicTaskInstanceQuery.getCandidateGroups() != null) {
historicTaskInstanceQuery.setSafeCandidateGroups(createSafeInValuesList(historicTaskInstanceQuery.getCandidateGroups()));
}
if (historicTaskInstanceQuery.getInvolvedGroups() != null) {
historicTaskInstanceQuery.setSafeInvolvedGroups(createSafeInValuesList(historicTaskInstanceQuery.getInvolvedGroups()));
}
if (historicTaskInstanceQuery.getScopeIds() != null) {
historicTaskInstanceQuery.setSafeScopeIds(createSafeInValuesList(historicTaskInstanceQuery.getScopeIds()));
}
if (historicTaskInstanceQuery.getOrQueryObjects() != null && !historicTaskInstanceQuery.getOrQueryObjects().isEmpty()) {
for (HistoricTaskInstanceQueryImpl orHistoricTaskInstanceQuery : historicTaskInstanceQuery.getOrQueryObjects()) {
setSafeInValueLists(orHistoricTaskInstanceQuery);
}
}
}
}
|
repos\flowable-engine-main\modules\flowable-task-service\src\main\java\org\flowable\task\service\impl\persistence\entity\data\impl\MybatisHistoricTaskInstanceDataManager.java
| 2
|
请完成以下Java代码
|
public static BOMComponentType ofCodeOrName(@NonNull final String code) {return index.ofCodeOrName(code);}
public static Optional<BOMComponentType> optionalOfNullableCode(@Nullable final String code)
{
return index.optionalOfNullableCode(code);
}
private static final ReferenceListAwareEnums.ValuesIndex<BOMComponentType> index = ReferenceListAwareEnums.index(values());
public boolean isComponent()
{
return this == Component;
}
public boolean isPacking()
{
return this == Packing;
}
public boolean isComponentOrPacking()
{
return isComponent() || isPacking();
}
public boolean isCoProduct()
{
return this == CoProduct;
}
public boolean isByProduct()
{
return this == ByProduct;
}
public boolean isByOrCoProduct()
|
{
return isByProduct() || isCoProduct();
}
public boolean isVariant()
{
return this == Variant;
}
public boolean isPhantom()
{
return this == Phantom;
}
public boolean isTools()
{
return this == Tools;
}
//
public boolean isReceipt()
{
return isByOrCoProduct();
}
public boolean isIssue()
{
return !isReceipt();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\org\eevolution\api\BOMComponentType.java
| 1
|
请完成以下Java代码
|
public void setBusyTimer (int time)
{
m_glassPane.setBusyTimer (time);
} // setBusyTimer
/**
* Window Events
* @param e event
*/
@Override
protected void processWindowEvent(WindowEvent e)
{
super.processWindowEvent(e);
// System.out.println(">> Apps WE_" + e.getID() // + " Frames=" + getFrames().length
// + " " + e);
} // processWindowEvent
/**
* Get Application Panel
* @return application panel
*/
public APanel getAPanel()
{
return m_APanel;
} // getAPanel
/**
* Dispose
*/
@Override
public void dispose()
{
if (Env.hideWindow(this))
{
return;
}
log.debug("disposing: {}", this);
if (m_APanel != null)
{
m_APanel.dispose();
}
m_APanel = null;
this.removeAll();
super.dispose();
|
// System.gc();
} // dispose
/**
* Get Window No of Panel
* @return window no
*/
public int getWindowNo()
{
if (m_APanel != null)
{
return m_APanel.getWindowNo();
}
return 0;
} // getWindowNo
/**
* String Representation
* @return Name
*/
@Override
public String toString()
{
return getName() + "_" + getWindowNo();
} // toString
// metas: begin
public GridWindow getGridWindow()
{
if (m_APanel == null)
{
return null;
}
return m_APanel.getGridWorkbench().getMWindowById(getAdWindowId());
}
// metas: end
} // AWindow
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\apps\AWindow.java
| 1
|
请完成以下Java代码
|
public String logout(HttpServletRequest request) throws Exception {
request.logout();
return "redirect:/";
}
@GetMapping(path = "/customers")
public String customers(Principal principal, Model model) {
addCustomers();
Iterable<Customer> customers = customerDAO.findAll();
model.addAttribute("customers", customers);
model.addAttribute("username", principal.getName());
return "customers";
}
// add customers for demonstration
public void addCustomers() {
Customer customer1 = new Customer();
|
customer1.setAddress("1111 foo blvd");
customer1.setName("Foo Industries");
customer1.setServiceRendered("Important services");
customerDAO.save(customer1);
Customer customer2 = new Customer();
customer2.setAddress("2222 bar street");
customer2.setName("Bar LLP");
customer2.setServiceRendered("Important services");
customerDAO.save(customer2);
Customer customer3 = new Customer();
customer3.setAddress("33 main street");
customer3.setName("Big LLC");
customer3.setServiceRendered("Important services");
customerDAO.save(customer3);
}
}
|
repos\tutorials-master\spring-boot-modules\spring-boot-keycloak-adapters\src\main\java\com\baeldung\keycloak\WebController.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
registerBeanDefinitions(importingClassMetadata, registry, null);
}
private AnnotationRepositoryConfigurationSource getConfigurationSource(BeanDefinitionRegistry registry,
@Nullable BeanNameGenerator importBeanNameGenerator) {
AnnotationMetadata metadata = AnnotationMetadata.introspect(getConfiguration());
return new AutoConfiguredAnnotationRepositoryConfigurationSource(metadata, getAnnotation(), this.resourceLoader,
this.environment, registry, importBeanNameGenerator) {
};
}
protected Streamable<String> getBasePackages() {
return Streamable.of(AutoConfigurationPackages.get(this.beanFactory));
}
/**
* The Spring Data annotation used to enable the particular repository support.
* @return the annotation class
*/
protected abstract Class<? extends Annotation> getAnnotation();
/**
* The configuration class that will be used by Spring Boot as a template.
* @return the configuration class
*/
protected abstract Class<?> getConfiguration();
/**
* The {@link RepositoryConfigurationExtension} for the particular repository support.
* @return the repository configuration extension
*/
protected abstract RepositoryConfigurationExtension getRepositoryConfigurationExtension();
/**
* The {@link BootstrapMode} for the particular repository support. Defaults to
* {@link BootstrapMode#DEFAULT}.
* @return the bootstrap mode
*/
protected BootstrapMode getBootstrapMode() {
return BootstrapMode.DEFAULT;
}
@Override
public void setResourceLoader(ResourceLoader resourceLoader) {
this.resourceLoader = resourceLoader;
}
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
this.beanFactory = beanFactory;
}
|
@Override
public void setEnvironment(Environment environment) {
this.environment = environment;
}
/**
* An auto-configured {@link AnnotationRepositoryConfigurationSource}.
*/
private class AutoConfiguredAnnotationRepositoryConfigurationSource
extends AnnotationRepositoryConfigurationSource {
AutoConfiguredAnnotationRepositoryConfigurationSource(AnnotationMetadata metadata,
Class<? extends Annotation> annotation, ResourceLoader resourceLoader, Environment environment,
BeanDefinitionRegistry registry, @Nullable BeanNameGenerator generator) {
super(metadata, annotation, resourceLoader, environment, registry, generator);
}
@Override
public Streamable<String> getBasePackages() {
return AbstractRepositoryConfigurationSourceSupport.this.getBasePackages();
}
@Override
public BootstrapMode getBootstrapMode() {
return AbstractRepositoryConfigurationSourceSupport.this.getBootstrapMode();
}
}
}
|
repos\spring-boot-4.0.1\core\spring-boot-autoconfigure\src\main\java\org\springframework\boot\autoconfigure\data\AbstractRepositoryConfigurationSourceSupport.java
| 2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.