instruction string | input string | output string | source_file string | priority int64 |
|---|---|---|---|---|
请完成以下Java代码 | public boolean isReadonlyUI()
{
return true;
}
/**
* @return {@code true}.
*/
@Override
public boolean isDisplayedUI()
{
return true;
}
@Override
public boolean isMandatory()
{
return false;
}
@Override
public boolean isOnlyIfInProductAttributeSet()
{
return false;
}
/**
* @return our attribute instance's {@code M_Attribute_ID}.
*/
@Override
public int getDisplaySeqNo()
{
return attributeInstance.getM_Attribute_ID(); | }
/**
* @return {@code true}
*/
@Override
public boolean isUseInASI()
{
return true;
}
/**
* @return {@code false}, since no HU-PI attribute is involved.
*/
@Override
public boolean isDefinedByTemplate()
{
return false;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\attribute\storage\AIAttributeValue.java | 1 |
请完成以下Java代码 | private static DoubleArrayTrie<Integer> loadDictionary(String trainingFile, String dictionaryFile) throws IOException
{
FrequencyMap dictionaryMap = new FrequencyMap();
if (dictionaryFile == null)
{
out.printf("从训练文件%s中统计词库...\n", trainingFile);
loadWordFromFile(trainingFile, dictionaryMap, true);
}
else
{
out.printf("从外部词典%s中加载词库...\n", trainingFile);
loadWordFromFile(dictionaryFile, dictionaryMap, false);
}
DoubleArrayTrie<Integer> dat = new DoubleArrayTrie<Integer>();
dat.build(dictionaryMap);
out.printf("加载完毕,词库总词数:%d,总词频:%d\n", dictionaryMap.size(), dictionaryMap.totalFrequency);
return dat;
}
public Result train(String trainingFile, String modelFile) throws IOException
{
return train(trainingFile, trainingFile, modelFile);
}
public Result train(String trainingFile, String developFile, String modelFile) throws IOException
{
return train(trainingFile, developFile, modelFile, 0.1, 50, Runtime.getRuntime().availableProcessors());
}
private static void loadWordFromFile(String path, FrequencyMap storage, boolean segmented) throws IOException
{
BufferedReader br = IOUtility.newBufferedReader(path);
String line;
while ((line = br.readLine()) != null) | {
if (segmented)
{
for (String word : IOUtility.readLineToArray(line))
{
storage.add(word);
}
}
else
{
line = line.trim();
if (line.length() != 0)
{
storage.add(line);
}
}
}
br.close();
}
} | repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\model\perceptron\PerceptronTrainer.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class DistributionJobCreateCommand
{
private final ITrxManager trxManager;
private final DDOrderService ddOrderService;
private final DDOrderMoveScheduleService ddOrderMoveScheduleService;
private final DistributionJobLoaderSupportingServices loadingSupportServices;
private final DistributionJobHUReservationService distributionJobHUReservationService;
@NonNull private final DDOrderId ddOrderId;
@NonNull private final UserId responsibleId;
@Builder
private DistributionJobCreateCommand(
final @NonNull ITrxManager trxManager,
final @NonNull DDOrderService ddOrderService,
final @NonNull DDOrderMoveScheduleService ddOrderMoveScheduleService,
final @NonNull DistributionJobLoaderSupportingServices loadingSupportServices,
final @NonNull DistributionJobHUReservationService distributionJobHUReservationService,
//
final @NonNull DDOrderId ddOrderId,
final @NonNull UserId responsibleId)
{
this.trxManager = trxManager;
this.ddOrderService = ddOrderService;
this.ddOrderMoveScheduleService = ddOrderMoveScheduleService;
this.loadingSupportServices = loadingSupportServices;
this.distributionJobHUReservationService = distributionJobHUReservationService;
//
this.ddOrderId = ddOrderId;
this.responsibleId = responsibleId;
}
public DistributionJob execute()
{
return trxManager.callInThreadInheritedTrx(this::executeInTrx);
} | public DistributionJob executeInTrx()
{
final MobileUIDistributionConfig config = loadingSupportServices.getConfig();
final I_DD_Order ddOrder = ddOrderService.getById(ddOrderId);
ddOrderService.assignToResponsible(ddOrder, responsibleId);
if (!config.isAllowPickingAnyHU())
{
final DDOrderMovePlan plan = ddOrderMoveScheduleService.createPlan(DDOrderMovePlanCreateRequest.builder()
.ddOrder(ddOrder)
.failIfNotFullAllocated(true)
.build());
ddOrderMoveScheduleService.savePlan(plan);
}
final DistributionJob job = new DistributionJobLoader(loadingSupportServices)
.loadByRecord(ddOrder);
distributionJobHUReservationService.reservePickFromHUs(job);
return job;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.distribution.rest-api\src\main\java\de\metas\distribution\mobileui\job\service\commands\create_job\DistributionJobCreateCommand.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public Integer getHistoryTimeToLive() {
return historyTimeToLive;
}
public void setHistoryTimeToLive(Integer historyTimeToLive) {
this.historyTimeToLive = historyTimeToLive;
}
@Override
public String getVersionTag() {
return versionTag;
}
public void setVersionTag(String versionTag) {
this.versionTag = versionTag;
}
@Override
public String toString() { | return "DecisionDefinitionEntity{" +
"id='" + id + '\'' +
", name='" + name + '\'' +
", category='" + category + '\'' +
", key='" + key + '\'' +
", version=" + version +
", versionTag=" + versionTag +
", decisionRequirementsDefinitionId='" + decisionRequirementsDefinitionId + '\'' +
", decisionRequirementsDefinitionKey='" + decisionRequirementsDefinitionKey + '\'' +
", deploymentId='" + deploymentId + '\'' +
", tenantId='" + tenantId + '\'' +
", historyTimeToLive=" + historyTimeToLive +
'}';
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\dmn\entity\repository\DecisionDefinitionEntity.java | 2 |
请完成以下Java代码 | public String getLanguage() {
return languageAttribute.getValue(this);
}
public void setLanguage(String language) {
languageAttribute.setValue(this, language);
}
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Expression.class, CMMN_ELEMENT_EXPRESSION)
.namespaceUri(CMMN11_NS)
.extendsType(CmmnElement.class)
.instanceProvider(new ModelTypeInstanceProvider<Expression>() {
public Expression newInstance(ModelTypeInstanceContext instanceContext) {
return new ExpressionImpl(instanceContext); | }
});
languageAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_LANGUAGE)
.defaultValue("http://www.w3.org/1999/XPath")
.build();
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
bodyChild = sequenceBuilder.element(Body.class)
.build();
typeBuilder.build();
}
} | repos\camunda-bpm-platform-master\model-api\cmmn-model\src\main\java\org\camunda\bpm\model\cmmn\impl\instance\ExpressionImpl.java | 1 |
请完成以下Java代码 | private static void arrayListSortByValue() {
List<Employee> employeeById = new ArrayList<>(map.values());
Collections.sort(employeeById);
System.out.println(employeeById);
}
private static void arrayListSortByKey() {
List<String> employeeByKey = new ArrayList<>(map.keySet());
Collections.sort(employeeByKey);
System.out.println(employeeByKey);
}
private static void initialize() {
Employee employee1 = new Employee(1L, "Mher"); | map.put(employee1.getName(), employee1);
Employee employee2 = new Employee(22L, "Annie");
map.put(employee2.getName(), employee2);
Employee employee3 = new Employee(8L, "John");
map.put(employee3.getName(), employee3);
Employee employee4 = new Employee(2L, "George");
map.put(employee4.getName(), employee4);
}
private static void addDuplicates() {
Employee employee5 = new Employee(1L, "Mher");
map.put(employee5.getName(), employee5);
Employee employee6 = new Employee(22L, "Annie");
map.put(employee6.getName(), employee6);
}
} | repos\tutorials-master\core-java-modules\core-java-collections-maps\src\main\java\com\baeldung\map\sort\SortHashMap.java | 1 |
请完成以下Java代码 | private static ImmutableMap<String, String> toMap(final Headers headers)
{
if (headers == null)
{
return ImmutableMap.of();
}
final ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
for (final String header : headers)
{
final String value = headers.header(header);
final String headerNorm = CoalesceUtil.coalesce(header, "");
final String valueNorm = CoalesceUtil.coalesce(value, "");
builder.put(headerNorm, valueNorm);
}
return builder.build();
}
private static String toJsonString(final Object obj) | {
if (obj == null)
{
return "";
}
try
{
return new Json().serialize(obj);
}
catch (final Exception ex)
{
return obj.toString();
}
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.payment.paypal\src\main\java\de\metas\payment\paypal\logs\PayPalCreateLogRequest.java | 1 |
请完成以下Java代码 | private int tagForProcessing(final String newProcessingTag, final QueryLimit limit)
{
return queryBL.createQueryBuilder(I_AD_BusinessRule_Event.class)
.addEqualsFilter(I_AD_BusinessRule_Event.COLUMNNAME_Processed, false)
.addEqualsFilter(I_AD_BusinessRule_Event.COLUMNNAME_ProcessingTag, null)
.setLimit(limit)
.create()
.updateDirectly()
.addSetColumnValue(I_AD_BusinessRule_Event.COLUMNNAME_ProcessingTag, newProcessingTag)
.execute();
}
private void releaseTag(final String processingTag)
{
queryBL.createQueryBuilder(I_AD_BusinessRule_Event.class)
.addEqualsFilter(I_AD_BusinessRule_Event.COLUMNNAME_ProcessingTag, processingTag)
.create()
.updateDirectly()
.addSetColumnValue(I_AD_BusinessRule_Event.COLUMNNAME_ProcessingTag, null)
.execute();
} | private static BusinessRuleEvent fromRecord(final I_AD_BusinessRule_Event record)
{
return BusinessRuleEvent.builder()
.id(BusinessRuleEventId.ofRepoId(record.getAD_BusinessRule_Event_ID()))
.sourceRecordRef(TableRecordReference.of(record.getSource_Table_ID(), record.getSource_Record_ID()))
.triggeringUserId(UserId.ofRepoId(record.getTriggering_User_ID()))
.businessRuleAndTriggerId(BusinessRuleAndTriggerId.ofRepoIds(record.getAD_BusinessRule_ID(), record.getAD_BusinessRule_Trigger_ID()))
.processed(record.isProcessed())
.errorId(AdIssueId.ofRepoIdOrNull(record.getAD_Issue_ID()))
.clientAndOrgId(ClientAndOrgId.ofClientAndOrg(record.getAD_Client_ID(), record.getAD_Org_ID()))
.build();
}
private static void updateRecord(final I_AD_BusinessRule_Event record, final BusinessRuleEvent from)
{
record.setProcessed(from.isProcessed());
record.setAD_Issue_ID(AdIssueId.toRepoId(from.getErrorId()));
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\business_rule\event\BusinessRuleEventRepository.java | 1 |
请完成以下Java代码 | public <T> Class<T> getBeanClassByNodeName(String nodeName)
{
@SuppressWarnings("unchecked")
final Class<T> beanClass = (Class<T>)beanClassesByNodeName.get(nodeName);
return beanClass;
}
@Override
public <T> IXMLHandler<T> getHandlerByNodeName(String nodeName)
{
final Class<T> beanClass = getBeanClassByNodeName(nodeName);
return getHandler(beanClass);
}
@Override | public <T> IXMLHandler<T> getHandler(Class<T> clazz)
{
final Class<?> converterClass = handlerByBeanClass.get(clazz);
try
{
@SuppressWarnings("unchecked")
IXMLHandler<T> converter = (IXMLHandler<T>)converterClass.newInstance();
return converter;
}
catch (Exception e)
{
throw new AdempiereException(e);
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\migration\xml\impl\XMLHandlerFactory.java | 1 |
请完成以下Java代码 | protected TaskEntity getTask(CommandContext commandContext) {
if (taskId != null) {
return commandContext.getTaskManager().findTaskById(taskId);
} else {
return null;
}
}
protected boolean isHistoryRemovalTimeStrategyStart() {
return HISTORY_REMOVAL_TIME_STRATEGY_START.equals(getHistoryRemovalTimeStrategy());
}
protected String getHistoryRemovalTimeStrategy() {
return Context.getProcessEngineConfiguration()
.getHistoryRemovalTimeStrategy();
}
protected HistoricProcessInstanceEventEntity getHistoricRootProcessInstance(String rootProcessInstanceId) {
return Context.getCommandContext()
.getDbEntityManager() | .selectById(HistoricProcessInstanceEventEntity.class, rootProcessInstanceId);
}
protected void provideRemovalTime(CommentEntity comment) {
String rootProcessInstanceId = comment.getRootProcessInstanceId();
if (rootProcessInstanceId != null) {
HistoricProcessInstanceEventEntity historicRootProcessInstance = getHistoricRootProcessInstance(rootProcessInstanceId);
if (historicRootProcessInstance != null) {
Date removalTime = historicRootProcessInstance.getRemovalTime();
comment.setRemovalTime(removalTime);
}
}
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmd\AddCommentCmd.java | 1 |
请完成以下Java代码 | Map<String, Object> serialize(Route route) {
HashMap<String, Object> r = new HashMap<>();
r.put("route_id", route.getId());
r.put("uri", route.getUri().toString());
r.put("order", route.getOrder());
r.put("predicate", route.getPredicate().toString());
if (!CollectionUtils.isEmpty(route.getMetadata())) {
r.put("metadata", route.getMetadata());
}
ArrayList<String> filters = new ArrayList<>();
for (int i = 0; i < route.getFilters().size(); i++) {
GatewayFilter gatewayFilter = route.getFilters().get(i);
filters.add(gatewayFilter.toString());
}
r.put("filters", filters); | return r;
}
@GetMapping("/routes/{id}")
public Mono<ResponseEntity<Map<String, Object>>> route(@PathVariable String id) {
// @formatter:off
return this.routeLocator.getRoutes()
.filter(route -> route.getId().equals(id))
.singleOrEmpty()
.map(this::serialize)
.map(ResponseEntity::ok)
.switchIfEmpty(Mono.just(ResponseEntity.notFound().build()));
// @formatter:on
}
} | repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webflux\src\main\java\org\springframework\cloud\gateway\actuate\GatewayControllerEndpoint.java | 1 |
请完成以下Java代码 | public String getInsuredId() {
return insuredId;
}
/**
* Sets the value of the insuredId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setInsuredId(String value) {
this.insuredId = value;
}
/**
* Gets the value of the caseId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCaseId() {
return caseId;
}
/**
* Sets the value of the caseId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCaseId(String value) {
this.caseId = value;
}
/**
* Gets the value of the caseDate property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getCaseDate() {
return caseDate;
}
/**
* Sets the value of the caseDate property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
* | */
public void setCaseDate(XMLGregorianCalendar value) {
this.caseDate = value;
}
/**
* Gets the value of the contractNumber property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getContractNumber() {
return contractNumber;
}
/**
* Sets the value of the contractNumber property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setContractNumber(String value) {
this.contractNumber = value;
}
} | repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_440_request\src\main\java-xjc\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_440\request\KvgLawType.java | 1 |
请完成以下Java代码 | public void onParameterChanged(final String parameterName)
{
if (PARAM_WeightGross.equals(parameterName))
{
updateWeightNetParameter();
}
else if (PARAM_WeightTare.equals(parameterName))
{
updateWeightNetParameter();
}
else if (PARAM_WeightTareAdjust.equals(parameterName))
{
updateWeightNetParameter();
}
}
private void updateWeightNetParameter()
{
final PlainWeightable weightable = getParametersAsWeightable();
Weightables.updateWeightNet(weightable);
weightNet = weightable.getWeightNet();
}
@VisibleForTesting
PlainWeightable getParametersAsWeightable()
{
final IWeightable huAttributes = getHUAttributesAsWeightable().get();
return PlainWeightable.builder()
.uom(huAttributes.getWeightNetUOM())
.weightGross(weightGross)
.weightNet(weightNet)
.weightTare(weightTare)
.weightTareAdjust(weightTareAdjust)
.build();
}
@ProcessParamDevicesProvider(parameterName = PARAM_WeightGross)
public DeviceDescriptorsList getWeightGrossDevices()
{
final IWeightable weightable = getHUAttributesAsWeightable().get();
final AttributeCode weightGrossAttribute = weightable.getWeightGrossAttribute();
final WarehouseId huWarehouseId = getHUWarehouseId(); | return HUEditorRowAttributesHelper.getDeviceDescriptors(weightGrossAttribute, huWarehouseId);
}
@Override
protected String doIt()
{
final HuId huId = getSelectedHUId();
final PlainWeightable targetWeight = getParametersAsWeightable();
WeightHUCommand.builder()
.huQtyService(huQtyService)
//
.huId(huId)
.targetWeight(targetWeight)
.build()
//
.execute();
return MSG_OK;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\picking\husToPick\process\WEBUI_HUsToPick_Weight.java | 1 |
请完成以下Java代码 | public void setA_Depreciation_Table_Detail_ID (int A_Depreciation_Table_Detail_ID)
{
if (A_Depreciation_Table_Detail_ID < 1)
set_ValueNoCheck (COLUMNNAME_A_Depreciation_Table_Detail_ID, null);
else
set_ValueNoCheck (COLUMNNAME_A_Depreciation_Table_Detail_ID, Integer.valueOf(A_Depreciation_Table_Detail_ID));
}
/** Get A_Depreciation_Table_Detail_ID.
@return A_Depreciation_Table_Detail_ID */
public int getA_Depreciation_Table_Detail_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_A_Depreciation_Table_Detail_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), String.valueOf(getA_Depreciation_Table_Detail_ID()));
}
/** Set Period/Yearly.
@param A_Period Period/Yearly */
public void setA_Period (int A_Period)
{
set_Value (COLUMNNAME_A_Period, Integer.valueOf(A_Period));
}
/** Get Period/Yearly.
@return Period/Yearly */
public int getA_Period ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_A_Period);
if (ii == null)
return 0;
return ii.intValue();
}
/** A_Table_Rate_Type AD_Reference_ID=53255 */
public static final int A_TABLE_RATE_TYPE_AD_Reference_ID=53255;
/** Amount = AM */
public static final String A_TABLE_RATE_TYPE_Amount = "AM";
/** Rate = RT */
public static final String A_TABLE_RATE_TYPE_Rate = "RT";
/** Set Type.
@param A_Table_Rate_Type Type */
public void setA_Table_Rate_Type (String A_Table_Rate_Type) | {
set_ValueNoCheck (COLUMNNAME_A_Table_Rate_Type, A_Table_Rate_Type);
}
/** Get Type.
@return Type */
public String getA_Table_Rate_Type ()
{
return (String)get_Value(COLUMNNAME_A_Table_Rate_Type);
}
/** Set Processed.
@param Processed
The document has been processed
*/
public void setProcessed (boolean Processed)
{
set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
}
/** Get Processed.
@return The document has been processed
*/
public boolean isProcessed ()
{
Object oo = get_Value(COLUMNNAME_Processed);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_A_Depreciation_Table_Detail.java | 1 |
请完成以下Java代码 | protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_CM_AccessListBPGroup[")
.append(get_ID()).append("]");
return sb.toString();
}
public I_C_BP_Group getC_BP_Group() throws RuntimeException
{
return (I_C_BP_Group)MTable.get(getCtx(), I_C_BP_Group.Table_Name)
.getPO(getC_BP_Group_ID(), get_TrxName()); }
/** Set Business Partner Group.
@param C_BP_Group_ID
Business Partner Group
*/
public void setC_BP_Group_ID (int C_BP_Group_ID)
{
if (C_BP_Group_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_BP_Group_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_BP_Group_ID, Integer.valueOf(C_BP_Group_ID));
}
/** Get Business Partner Group.
@return Business Partner Group
*/
public int getC_BP_Group_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_BP_Group_ID); | if (ii == null)
return 0;
return ii.intValue();
}
public I_CM_AccessProfile getCM_AccessProfile() throws RuntimeException
{
return (I_CM_AccessProfile)MTable.get(getCtx(), I_CM_AccessProfile.Table_Name)
.getPO(getCM_AccessProfile_ID(), get_TrxName()); }
/** Set Web Access Profile.
@param CM_AccessProfile_ID
Web Access Profile
*/
public void setCM_AccessProfile_ID (int CM_AccessProfile_ID)
{
if (CM_AccessProfile_ID < 1)
set_ValueNoCheck (COLUMNNAME_CM_AccessProfile_ID, null);
else
set_ValueNoCheck (COLUMNNAME_CM_AccessProfile_ID, Integer.valueOf(CM_AccessProfile_ID));
}
/** Get Web Access Profile.
@return Web Access Profile
*/
public int getCM_AccessProfile_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_CM_AccessProfile_ID);
if (ii == null)
return 0;
return ii.intValue();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_CM_AccessListBPGroup.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class PmsPermissionDaoImpl extends PermissionBaseDaoImpl<PmsPermission> implements PmsPermissionDao {
/**
* 根据实体ID集字符串获取对象列表.
*
* @param idStr
* @return
*/
public List<PmsPermission> findByIds(String idStr) {
List<String> ids = Arrays.asList(idStr.split(","));
return this.getSessionTemplate().selectList(getStatement("findByIds"), ids);
}
/**
* 检查权限名称是否已存在
*
* @param trim
* @return
*/
public PmsPermission getByPermissionName(String permissionName) {
return this.getSessionTemplate().selectOne(getStatement("getByPermissionName"), permissionName);
}
/**
* 检查权限是否已存在
*
* @param permission
* @return
*/ | public PmsPermission getByPermission(String permission) {
return this.getSessionTemplate().selectOne(getStatement("getByPermission"), permission);
}
/**
* 检查权限名称是否已存在(其他id)
*
* @param permissionName
* @param id
* @return
*/
public PmsPermission getByPermissionNameNotEqId(String permissionName, Long id) {
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("permissionName", permissionName);
paramMap.put("id", id);
return this.getSessionTemplate().selectOne(getStatement("getByPermissionNameNotEqId"), paramMap);
}
/**
* 获取叶子菜单下所有的功能权限
*
* @param valueOf
* @return
*/
public List<PmsPermission> listAllByMenuId(Long menuId) {
Map<String, Object> param = new HashMap<String, Object>();
param.put("menuId", menuId);
return this.getSessionTemplate().selectList(getStatement("listAllByMenuId"), param);
}
} | repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\permission\dao\impl\PmsPermissionDaoImpl.java | 2 |
请完成以下Java代码 | public <V, ET extends IExpression<V>> ET compile(final String expressionStr, final Class<ET> expressionType)
{
final IExpressionCompiler<V, ET> compiler = getCompiler(expressionType);
return compiler.compile(ExpressionContext.EMPTY, expressionStr);
}
@Override
public <V, ET extends IExpression<V>> ET compileOrDefault(final String expressionStr, final ET defaultExpr, final Class<ET> expressionType)
{
if (Check.isEmpty(expressionStr, true))
{
return defaultExpr;
}
try
{ | return compile(expressionStr, expressionType);
}
catch (final Exception e)
{
logger.warn(e.getLocalizedMessage(), e);
return defaultExpr;
}
}
@Override
public <V, ET extends IExpression<V>> ET compile(final String expressionStr, final Class<ET> expressionType, final ExpressionContext context)
{
final IExpressionCompiler<V, ET> compiler = getCompiler(expressionType);
return compiler.compile(context, expressionStr);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\expression\api\impl\ExpressionFactory.java | 1 |
请完成以下Java代码 | public class ScpClientUtil {
private final String ip;
private final int port;
private final String username;
private final String password;
static private final Map<String,ScpClientUtil> instance = Maps.newHashMap();
static synchronized public ScpClientUtil getInstance(String ip, int port, String username, String password) {
instance.computeIfAbsent(ip, i -> new ScpClientUtil(i, port, username, password));
return instance.get(ip);
}
public ScpClientUtil(String ip, int port, String username, String password) {
this.ip = ip;
this.port = port;
this.username = username;
this.password = password;
}
public void getFile(String remoteFile, String localTargetDirectory) {
Connection conn = new Connection(ip, port);
try {
conn.connect();
boolean isAuthenticated = conn.authenticateWithPassword(username, password);
if (!isAuthenticated) {
System.err.println("authentication failed");
}
SCPClient client = new SCPClient(conn);
client.get(remoteFile, localTargetDirectory);
} catch (IOException ex) {
Logger.getLogger(SCPClient.class.getName()).log(Level.SEVERE, null, ex);
}finally{
conn.close();
}
}
public void putFile(String localFile, String remoteTargetDirectory) {
putFile(localFile, null, remoteTargetDirectory); | }
public void putFile(String localFile, String remoteFileName, String remoteTargetDirectory) {
putFile(localFile, remoteFileName, remoteTargetDirectory,null);
}
public void putFile(String localFile, String remoteFileName, String remoteTargetDirectory, String mode) {
Connection conn = new Connection(ip, port);
try {
conn.connect();
boolean isAuthenticated = conn.authenticateWithPassword(username, password);
if (!isAuthenticated) {
System.err.println("authentication failed");
}
SCPClient client = new SCPClient(conn);
if (StringUtils.isBlank(mode)) {
mode = "0600";
}
if (remoteFileName == null) {
client.put(localFile, remoteTargetDirectory);
} else {
client.put(localFile, remoteFileName, remoteTargetDirectory, mode);
}
} catch (IOException ex) {
Logger.getLogger(ScpClientUtil.class.getName()).log(Level.SEVERE, null, ex);
}finally{
conn.close();
}
}
} | repos\eladmin-master\eladmin-system\src\main\java\me\zhengjie\modules\maint\util\ScpClientUtil.java | 1 |
请完成以下Java代码 | public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getSourceVariableName() {
return sourceVariableName;
}
public void setSourceVariableName(String sourceVariableName) {
this.sourceVariableName = sourceVariableName;
}
public Expression getSourceExpression() {
return sourceExpression;
}
public void setSourceExpression(Expression sourceExpression) {
this.sourceExpression = sourceExpression;
}
public String getDestinationVariableName() {
return destinationVariableName; | }
public void setDestinationVariableName(String destinationVariableName) {
this.destinationVariableName = destinationVariableName;
}
public Expression getDestinationExpression() {
return destinationExpression;
}
public void setDestinationExpression(Expression destinationExpression) {
this.destinationExpression = destinationExpression;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
public Expression getLinkExpression() {
return linkExpression;
}
public void setLinkExpression(Expression linkExpression) {
this.linkExpression = linkExpression;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\variable\VariableDeclaration.java | 1 |
请完成以下Java代码 | public final ProcessPreconditionsResolution checkPreconditionsApplicable()
{
final boolean anyHuMatches = retrieveSelectedAndEligibleHUEditorRows()
.anyMatch(huRow -> huRow.isTopLevel());
if (anyHuMatches)
{
return ProcessPreconditionsResolution.accept();
}
final ITranslatableString reason = Services.get(IMsgBL.class).getTranslatableMsgText(MSG_WEBUI_SELECT_ACTIVE_UNSELECTED_HU);
return ProcessPreconditionsResolution.reject(reason);
}
@Override
protected String doIt() throws Exception
{
retrieveSelectedAndEligibleHUEditorRows().forEach(this::createSourceHU);
return MSG_OK;
}
private void createSourceHU(final HUEditorRow row)
{
Check.assume(row.isTopLevel(), "Only top level rows are allowed"); // shall not happen
final HuId topLevelHUId = row.getHuId();
sourceHuService.addSourceHuMarker(topLevelHUId);
topLevelHUIdsProcessed.add(topLevelHUId);
} | @Override
protected void postProcess(boolean success)
{
if (!success)
{
return;
}
// PP_Order
invalidateParentView();
// HU Editor
getView().removeHUIdsAndInvalidate(topLevelHUIdsProcessed);
// invalidateView();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\pporder\process\WEBUI_PP_Order_HUEditor_Create_M_Source_HUs.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public TokenStore tokenStore() {
return new JdbcTokenStore( dataSource );
}
@Override
public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
security.tokenKeyAccess("permitAll()")
.checkTokenAccess("permitAll()")
.allowFormAuthenticationForClients();
}
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients.jdbc(dataSource);
} | @Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
//开启密码授权类型
endpoints.authenticationManager(authenticationManager);
//配置token存储方式
endpoints.tokenStore(tokenStore);
//自定义登录或者鉴权失败时的返回信息
endpoints.exceptionTranslator(webResponseExceptionTranslator);
//要使用refresh_token的话,需要额外配置userDetailsService
endpoints.userDetailsService( userDetailsService );
}
} | repos\SpringBootLearning-master (1)\springboot-security-oauth2\src\main\java\com\gf\config\AuthorizationServerConfiguration.java | 2 |
请完成以下Java代码 | public void setValidTo (Timestamp ValidTo)
{
set_Value (COLUMNNAME_ValidTo, ValidTo);
}
/** Get Valid to.
@return Valid to including this date (last day)
*/
public Timestamp getValidTo ()
{
return (Timestamp)get_Value(COLUMNNAME_ValidTo);
}
/** Set Search Key.
@param Value | Search key for the record in the format required - must be unique
*/
public void setValue (String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
/** Get Search Key.
@return Search key for the record in the format required - must be unique
*/
public String getValue ()
{
return (String)get_Value(COLUMNNAME_Value);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_HR_Contract.java | 1 |
请完成以下Java代码 | protected org.compiere.model.POInfo initPO(final Properties ctx)
{
return org.compiere.model.POInfo.getPOInfo(Table_Name);
}
@Override
public void setC_BPartner_Location_ID (final int C_BPartner_Location_ID)
{
if (C_BPartner_Location_ID < 1)
set_Value (COLUMNNAME_C_BPartner_Location_ID, null);
else
set_Value (COLUMNNAME_C_BPartner_Location_ID, C_BPartner_Location_ID);
}
@Override
public int getC_BPartner_Location_ID()
{
return get_ValueAsInt(COLUMNNAME_C_BPartner_Location_ID);
}
@Override
public void setEDI_cctop_000_v_ID (final int EDI_cctop_000_v_ID)
{
if (EDI_cctop_000_v_ID < 1)
set_ValueNoCheck (COLUMNNAME_EDI_cctop_000_v_ID, null);
else
set_ValueNoCheck (COLUMNNAME_EDI_cctop_000_v_ID, EDI_cctop_000_v_ID); | }
@Override
public int getEDI_cctop_000_v_ID()
{
return get_ValueAsInt(COLUMNNAME_EDI_cctop_000_v_ID);
}
@Override
public void setEdiInvoicRecipientGLN (final @Nullable java.lang.String EdiInvoicRecipientGLN)
{
set_ValueNoCheck (COLUMNNAME_EdiInvoicRecipientGLN, EdiInvoicRecipientGLN);
}
@Override
public java.lang.String getEdiInvoicRecipientGLN()
{
return get_ValueAsString(COLUMNNAME_EdiInvoicRecipientGLN);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.edi\src\main\java-gen\de\metas\esb\edi\model\X_EDI_cctop_000_v.java | 1 |
请完成以下Java代码 | public IReturnsInOutProducer addPackingMaterial(final I_M_HU_PackingMaterial packingMaterial, final int qty)
{
packingMaterialInoutLinesBuilder.addSource(packingMaterial, qty);
return this;
}
private Set<HUToReturn> getHUsToReturn()
{
Check.assumeNotEmpty(_husToReturn, "husToReturn is not empty");
return _husToReturn;
}
public List<I_M_HU> getHUsReturned()
{
return _husToReturn.stream()
.map(HUToReturn::getHu)
.collect(Collectors.toList());
}
public void addHUToReturn(@NonNull final I_M_HU hu, @NonNull final InOutLineId originalShipmentLineId)
{ | _husToReturn.add(new HUToReturn(hu, originalShipmentLineId));
}
@Value
private static class HUToReturn
{
@NonNull I_M_HU hu;
@NonNull InOutLineId originalShipmentLineId;
private int getM_HU_ID()
{
return hu.getM_HU_ID();
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\inout\returns\customer\CustomerReturnsInOutProducer.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class UserDO {
/**
* 用户编号
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY, // strategy 设置使用数据库主键自增策略;
generator = "JDBC") // generator 设置插入完成后,查询最后生成的 ID 填充到该属性中。
private Integer id;
/**
* 账号
*/
private String username;
public Integer getId() {
return id;
}
public UserDO setId(Integer id) {
this.id = id;
return this;
}
public String getUsername() {
return username;
} | public UserDO setUsername(String username) {
this.username = username;
return this;
}
@Override
public String toString() {
return "UserDO{" +
"id=" + id +
", username='" + username + '\'' +
'}';
}
} | repos\SpringBoot-Labs-master\lab-17\lab-17-dynamic-datasource-springdatajpa\src\main\java\cn\iocoder\springboot\lab17\dynamicdatasource\dataobject\UserDO.java | 2 |
请完成以下Java代码 | public class RemoveDuplicateFromString {
String removeDuplicatesUsingCharArray(String str) {
char[] chars = str.toCharArray();
StringBuilder sb = new StringBuilder();
int repeatedCtr;
for (int i = 0; i < chars.length; i++) {
repeatedCtr = 0;
for (int j = i + 1; j < chars.length; j++) {
if (chars[i] == chars[j]) {
repeatedCtr++;
}
}
if (repeatedCtr == 0) {
sb.append(chars[i]);
}
}
return sb.toString();
}
String removeDuplicatesUsinglinkedHashSet(String str) {
StringBuilder sb = new StringBuilder();
Set<Character> linkedHashSet = new LinkedHashSet<>();
for (int i = 0; i < str.length(); i++) {
linkedHashSet.add(str.charAt(i));
}
for (Character c : linkedHashSet) {
sb.append(c);
}
return sb.toString();
}
String removeDuplicatesUsingSorting(String str) {
StringBuilder sb = new StringBuilder();
if(!str.isEmpty()) {
char[] chars = str.toCharArray();
Arrays.sort(chars);
sb.append(chars[0]);
for (int i = 1; i < chars.length; i++) {
if (chars[i] != chars[i - 1]) {
sb.append(chars[i]);
}
}
}
return sb.toString(); | }
String removeDuplicatesUsingHashSet(String str) {
StringBuilder sb = new StringBuilder();
Set<Character> hashSet = new HashSet<>();
for (int i = 0; i < str.length(); i++) {
hashSet.add(str.charAt(i));
}
for (Character c : hashSet) {
sb.append(c);
}
return sb.toString();
}
String removeDuplicatesUsingIndexOf(String str) {
StringBuilder sb = new StringBuilder();
int idx;
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
idx = str.indexOf(c, i + 1);
if (idx == -1) {
sb.append(c);
}
}
return sb.toString();
}
String removeDuplicatesUsingDistinct(String str) {
StringBuilder sb = new StringBuilder();
str.chars().distinct().forEach(c -> sb.append((char) c));
return sb.toString();
}
} | repos\tutorials-master\core-java-modules\core-java-string-algorithms-4\src\main\java\com\baeldung\removeduplicates\RemoveDuplicateFromString.java | 1 |
请完成以下Java代码 | public HistoricProcessInstanceQuery activeActivityIdIn(String... ids) {
ensureNotNull(BadUserRequestException.class, "activity ids", (Object[]) ids);
ensureNotContainsNull(BadUserRequestException.class, "activity ids", Arrays.asList(ids));
this.activeActivityIds = ids;
return this;
}
@Override
public HistoricProcessInstanceQuery activityIdIn(String... ids) {
ensureNotNull(BadUserRequestException.class, "activity ids", (Object[]) ids);
ensureNotContainsNull(BadUserRequestException.class, "activity ids", Arrays.asList(ids));
this.activityIds = ids;
return this;
}
@Override
public HistoricProcessInstanceQuery active() {
if(!isOrQueryActive) {
ensureEmpty(BadUserRequestException.class, "Already querying for historic process instance with another state", state);
}
state.add(HistoricProcessInstance.STATE_ACTIVE);
return this;
}
@Override
public HistoricProcessInstanceQuery suspended() {
if(!isOrQueryActive) {
ensureEmpty(BadUserRequestException.class, "Already querying for historic process instance with another state", state);
}
state.add(HistoricProcessInstance.STATE_SUSPENDED);
return this;
}
@Override
public HistoricProcessInstanceQuery completed() {
if(!isOrQueryActive) {
ensureEmpty(BadUserRequestException.class, "Already querying for historic process instance with another state", state);
}
state.add(HistoricProcessInstance.STATE_COMPLETED);
return this;
}
@Override
public HistoricProcessInstanceQuery externallyTerminated() {
if(!isOrQueryActive) {
ensureEmpty(BadUserRequestException.class, "Already querying for historic process instance with another state", state);
}
state.add(HistoricProcessInstance.STATE_EXTERNALLY_TERMINATED); | return this;
}
@Override
public HistoricProcessInstanceQuery internallyTerminated() {
if(!isOrQueryActive) {
ensureEmpty(BadUserRequestException.class, "Already querying for historic process instance with another state", state);
}
state.add(HistoricProcessInstance.STATE_INTERNALLY_TERMINATED);
return this;
}
@Override
public HistoricProcessInstanceQuery or() {
if (this != queries.get(0)) {
throw new ProcessEngineException("Invalid query usage: cannot set or() within 'or' query");
}
HistoricProcessInstanceQueryImpl orQuery = new HistoricProcessInstanceQueryImpl();
orQuery.isOrQueryActive = true;
orQuery.queries = queries;
queries.add(orQuery);
return orQuery;
}
@Override
public HistoricProcessInstanceQuery endOr() {
if (!queries.isEmpty() && this != queries.get(queries.size()-1)) {
throw new ProcessEngineException("Invalid query usage: cannot set endOr() before or()");
}
return queries.get(0);
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\HistoricProcessInstanceQueryImpl.java | 1 |
请完成以下Java代码 | public int getCCM_Bundle_Result_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_CCM_Bundle_Result_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** CCM_Success AD_Reference_ID=319 */
public static final int CCM_SUCCESS_AD_Reference_ID=319;
/** Yes = Y */
public static final String CCM_SUCCESS_Yes = "Y";
/** No = N */
public static final String CCM_SUCCESS_No = "N";
/** Set Is Success.
@param CCM_Success Is Success */
public void setCCM_Success (String CCM_Success)
{
set_Value (COLUMNNAME_CCM_Success, CCM_Success);
}
/** Get Is Success.
@return Is Success */
public String getCCM_Success ()
{
return (String)get_Value(COLUMNNAME_CCM_Success);
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name); | }
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Search Key.
@param Value
Search key for the record in the format required - must be unique
*/
public void setValue (String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
/** Get Search Key.
@return Search key for the record in the format required - must be unique
*/
public String getValue ()
{
return (String)get_Value(COLUMNNAME_Value);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\de\metas\callcenter\model\X_CCM_Bundle_Result.java | 1 |
请完成以下Java代码 | public static long factorial(int number) {
long result = 1;
for(int i=number;i>0;i--) {
result *= i;
}
return result;
}
@Loggable
@Cacheable(lifetime = 2, unit = TimeUnit.SECONDS)
public static String cacheExchangeRates() {
String result = null;
try {
URL exchangeRateUrl = new URI("https://api.exchangeratesapi.io/latest").toURL();
URLConnection con = exchangeRateUrl.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
result = in.readLine();
} catch (IOException | URISyntaxException e) {
e.printStackTrace();
}
return result;
}
@LogExceptions
public static void divideByZero() {
int x = 1/0;
}
@RetryOnFailure(attempts = 2, types = { NumberFormatException.class}) | @Quietly
public static void divideByZeroQuietly() {
int x = 1/0;
}
@UnitedThrow(IllegalStateException.class)
public static void processFile() throws IOException, InterruptedException {
BufferedReader reader = new BufferedReader(new FileReader("baeldung.txt"));
reader.readLine();
Thread thread = new Thread();
thread.wait(2000);
}
} | repos\tutorials-master\libraries-6\src\main\java\com\baeldung\jcabi\JcabiAspectJ.java | 1 |
请完成以下Java代码 | class Voucher {
private Money value;
private String store;
Voucher(int amount, String currencyCode, String store) {
this.value = new Money(amount, currencyCode);
this.store = store;
}
@Override
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof Voucher))
return false;
Voucher other = (Voucher) o;
boolean valueEquals = (this.value == null && other.value == null)
|| (this.value != null && this.value.equals(other.value));
boolean storeEquals = (this.store == null && other.store == null)
|| (this.store != null && this.store.equals(other.store)); | return valueEquals && storeEquals;
}
@Override
public int hashCode() {
int result = 17;
if (this.value != null) {
result = 31 * result + value.hashCode();
}
if (this.store != null) {
result = 31 * result + store.hashCode();
}
return result;
}
} | repos\tutorials-master\core-java-modules\core-java-lang-oop-methods\src\main\java\com\baeldung\equalshashcode\Voucher.java | 1 |
请完成以下Java代码 | public void setAttentionCount(Integer attentionCount) {
this.attentionCount = attentionCount;
}
public Integer getReadCount() {
return readCount;
}
public void setReadCount(Integer readCount) {
this.readCount = readCount;
}
public String getAwardName() {
return awardName;
}
public void setAwardName(String awardName) {
this.awardName = awardName;
}
public String getAttendType() {
return attendType;
}
public void setAttendType(String attendType) {
this.attendType = attendType;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" ["); | sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", categoryId=").append(categoryId);
sb.append(", name=").append(name);
sb.append(", createTime=").append(createTime);
sb.append(", startTime=").append(startTime);
sb.append(", endTime=").append(endTime);
sb.append(", attendCount=").append(attendCount);
sb.append(", attentionCount=").append(attentionCount);
sb.append(", readCount=").append(readCount);
sb.append(", awardName=").append(awardName);
sb.append(", attendType=").append(attendType);
sb.append(", content=").append(content);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\CmsTopic.java | 1 |
请完成以下Java代码 | public org.compiere.model.I_C_Activity getParent_Activity() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_Parent_Activity_ID, org.compiere.model.I_C_Activity.class);
}
@Override
public void setParent_Activity(org.compiere.model.I_C_Activity Parent_Activity)
{
set_ValueFromPO(COLUMNNAME_Parent_Activity_ID, org.compiere.model.I_C_Activity.class, Parent_Activity);
}
/** Set Hauptkostenstelle.
@param Parent_Activity_ID Hauptkostenstelle */
@Override
public void setParent_Activity_ID (int Parent_Activity_ID)
{
if (Parent_Activity_ID < 1)
set_Value (COLUMNNAME_Parent_Activity_ID, null);
else
set_Value (COLUMNNAME_Parent_Activity_ID, Integer.valueOf(Parent_Activity_ID));
}
/** Get Hauptkostenstelle.
@return Hauptkostenstelle */
@Override
public int getParent_Activity_ID ()
{ | Integer ii = (Integer)get_Value(COLUMNNAME_Parent_Activity_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Suchschlüssel.
@param Value
Search key for the record in the format required - must be unique
*/
@Override
public void setValue (java.lang.String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
/** Get Suchschlüssel.
@return Search key for the record in the format required - must be unique
*/
@Override
public java.lang.String getValue ()
{
return (java.lang.String)get_Value(COLUMNNAME_Value);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Activity.java | 1 |
请完成以下Java代码 | public class CorrelationData extends org.springframework.amqp.rabbit.support.CorrelationData {
/**
* 消息体
*/
private volatile Object message;
/**
* 交换机名称
*/
private String exchange;
/**
* 路由key
*/
private String routingKey;
/**
* 重试次数
*/
private int retryCount = 0;
public CorrelationData() {
super();
}
public CorrelationData(String id) {
super(id);
}
public CorrelationData(String id, Object data) {
this(id);
this.message = data;
}
public Object getMessage() {
return message;
}
public void setMessage(Object message) {
this.message = message;
}
public int getRetryCount() {
return retryCount; | }
public void setRetryCount(int retryCount) {
this.retryCount = retryCount;
}
public String getExchange() {
return exchange;
}
public void setExchange(String exchange) {
this.exchange = exchange;
}
public String getRoutingKey() {
return routingKey;
}
public void setRoutingKey(String routingKey) {
this.routingKey = routingKey;
}
} | repos\spring-boot-student-master\spring-boot-student-rabbitmq\src\main\java\com\xiaolyuh\mq\CorrelationData.java | 1 |
请在Spring Boot框架中完成以下Java代码 | private static GLNLocation toGLNLocation(
@NonNull final I_C_BPartner_Location record,
@Nullable final String glnLookupLabel)
{
final String gln = Check.assumeNotNull(record.getGLN(), "we can be sure that this point that the GLN is not null");
return GLNLocation.builder()
.orgId(OrgId.ofRepoIdOrAny(record.getAD_Org_ID()))
.glnWithLabel(GlnWithLabel.ofGLN(GLN.ofString(gln), glnLookupLabel))
.bpLocationId(BPartnerLocationId.ofRepoId(record.getC_BPartner_ID(), record.getC_BPartner_Location_ID()))
.build();
}
@Value
@Builder
private static class GLNLocations
{
@NonNull
GLN gln;
@NonNull
@Singular
ImmutableList<GLNLocation> locations;
/**
* @param onlyOrgIds {@code null} or empty means "no restriction".
*/
@NonNull
Stream<BPartnerLocationId> streamBPartnerLocationIds(
@Nullable final Set<OrgId> onlyOrgIds,
@Nullable final String glnLookupLabel)
{
return locations.stream()
.filter(location -> location.isMatching(onlyOrgIds, glnLookupLabel))
.map(GLNLocation::getBpLocationId);
}
} | @Value
@Builder
private static class GLNLocation
{
@NonNull
GlnWithLabel glnWithLabel;
@NonNull
OrgId orgId;
@NonNull
BPartnerLocationId bpLocationId;
boolean isMatching(@Nullable final Set<OrgId> onlyOrgIds,
@Nullable final String glnLookupLabel)
{
return isMatchingLookupLabel(glnLookupLabel) && isMatchingOrgId(onlyOrgIds);
}
private boolean isMatchingLookupLabel(@Nullable final String glnLookupLabel)
{
if (Check.isBlank(glnLookupLabel))
{
return true;
}
return glnLookupLabel.equals(glnWithLabel.getLabel());
}
private boolean isMatchingOrgId(@Nullable final Set<OrgId> onlyOrgIds)
{
if (onlyOrgIds == null || onlyOrgIds.isEmpty())
{
return true;
}
return onlyOrgIds.contains(orgId);
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\bpartner\service\impl\GLNLoadingCache.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public StandardServletMultipartResolver multipartResolver() {
StandardServletMultipartResolver multipartResolver = new StandardServletMultipartResolver();
multipartResolver.setResolveLazily(this.multipartProperties.isResolveLazily());
return multipartResolver;
}
/**
* 华东机房
*/
@Bean
public com.qiniu.storage.Configuration qiniuConfig() {
return new com.qiniu.storage.Configuration(Zone.zone0());
}
/**
* 构建一个七牛上传工具实例
*/
@Bean
public UploadManager uploadManager() {
return new UploadManager(qiniuConfig());
} | /**
* 认证信息实例
*/
@Bean
public Auth auth() {
return Auth.create(accessKey, secretKey);
}
/**
* 构建七牛空间管理实例
*/
@Bean
public BucketManager bucketManager() {
return new BucketManager(auth(), qiniuConfig());
}
} | repos\spring-boot-demo-master\demo-upload\src\main\java\com\xkcoding\upload\config\UploadConfig.java | 2 |
请完成以下Java代码 | public String getPassword() {
return password;
}
public int getActive() {
return active;
}
public String getRoles() {
return roles;
}
public String getPermissions() {
return permissions;
} | public List<String> getRoleList(){
if(this.roles.length() > 0){
return Arrays.asList(this.roles.split(","));
}
return new ArrayList<>();
}
public List<String> getPermissionList(){
if(this.permissions.length() > 0){
return Arrays.asList(this.permissions.split(","));
}
return new ArrayList<>();
}
} | repos\SpringBoot-Projects-FullStack-master\Part-6 Spring Boot Security\11.SpringSecurityJwt\src\main\java\spring\security\model\User.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public Result<List<SysPermissionDataRule>> queryPermissionRule(SysPermissionDataRule sysPermissionDataRule) {
Result<List<SysPermissionDataRule>> result = new Result<>();
try {
List<SysPermissionDataRule> permRuleList = sysPermissionDataRuleService.queryPermissionRule(sysPermissionDataRule);
result.setResult(permRuleList);
} catch (Exception e) {
log.error(e.getMessage(), e);
result.error500("操作失败");
}
return result;
}
/**
* 部门权限表
* @param departId
* @return
*/
@RequestMapping(value = "/queryDepartPermission", method = RequestMethod.GET)
public Result<List<String>> queryDepartPermission(@RequestParam(name = "departId", required = true) String departId) {
Result<List<String>> result = new Result<>();
try {
List<SysDepartPermission> list = sysDepartPermissionService.list(new QueryWrapper<SysDepartPermission>().lambda().eq(SysDepartPermission::getDepartId, departId));
result.setResult(list.stream().map(sysDepartPermission -> String.valueOf(sysDepartPermission.getPermissionId())).collect(Collectors.toList()));
result.setSuccess(true);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return result;
}
/**
* 保存部门授权
*
* @return
*/ | @RequestMapping(value = "/saveDepartPermission", method = RequestMethod.POST)
@RequiresPermissions("system:permission:saveDepart")
public Result<String> saveDepartPermission(@RequestBody JSONObject json) {
long start = System.currentTimeMillis();
Result<String> result = new Result<>();
try {
String departId = json.getString("departId");
String permissionIds = json.getString("permissionIds");
String lastPermissionIds = json.getString("lastpermissionIds");
this.sysDepartPermissionService.saveDepartPermission(departId, permissionIds, lastPermissionIds);
result.success("保存成功!");
log.info("======部门授权成功=====耗时:" + (System.currentTimeMillis() - start) + "毫秒");
} catch (Exception e) {
result.error500("授权失败!");
log.error(e.getMessage(), e);
}
return result;
}
} | repos\JeecgBoot-main\jeecg-boot\jeecg-module-system\jeecg-system-biz\src\main\java\org\jeecg\modules\system\controller\SysPermissionController.java | 2 |
请完成以下Java代码 | public void setC_CompensationGroup_Schema(final de.metas.order.model.I_C_CompensationGroup_Schema C_CompensationGroup_Schema)
{
set_ValueFromPO(COLUMNNAME_C_CompensationGroup_Schema_ID, de.metas.order.model.I_C_CompensationGroup_Schema.class, C_CompensationGroup_Schema);
}
@Override
public void setC_CompensationGroup_Schema_ID (final int C_CompensationGroup_Schema_ID)
{
if (C_CompensationGroup_Schema_ID < 1)
set_Value (COLUMNNAME_C_CompensationGroup_Schema_ID, null);
else
set_Value (COLUMNNAME_C_CompensationGroup_Schema_ID, C_CompensationGroup_Schema_ID);
}
@Override
public int getC_CompensationGroup_Schema_ID()
{
return get_ValueAsInt(COLUMNNAME_C_CompensationGroup_Schema_ID);
}
@Override
public void setM_Product_Exclude_FlatrateConditions_ID (final int M_Product_Exclude_FlatrateConditions_ID)
{
if (M_Product_Exclude_FlatrateConditions_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Product_Exclude_FlatrateConditions_ID, null); | else
set_ValueNoCheck (COLUMNNAME_M_Product_Exclude_FlatrateConditions_ID, M_Product_Exclude_FlatrateConditions_ID);
}
@Override
public int getM_Product_Exclude_FlatrateConditions_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_Exclude_FlatrateConditions_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);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Product_Exclude_FlatrateConditions.java | 1 |
请完成以下Java代码 | public JsonOLCandCreateRequest withBPartnersSyncAdvise(@Nullable final SyncAdvise syncAdvise)
{
if (syncAdvise == null)
{
return this;
}
final JsonOLCandCreateRequestBuilder builder = toBuilder();
if (org != null && org.getBpartner() != null)
{
builder.org(org.toBuilder()
.bpartner(org.getBpartner().toBuilder().syncAdvise(syncAdvise).build())
.build());
}
if (billBPartner != null)
{
builder.billBPartner(billBPartner.toBuilder().syncAdvise(syncAdvise).build());
}
if (bpartner != null)
{
builder.bpartner(bpartner.toBuilder().syncAdvise(syncAdvise).build());
}
if (dropShipBPartner != null)
{
builder.dropShipBPartner(dropShipBPartner.toBuilder().syncAdvise(syncAdvise).build());
}
if (handOverBPartner != null)
{
builder.handOverBPartner(handOverBPartner.toBuilder().syncAdvise(syncAdvise).build());
}
return builder.build();
}
public JsonOLCandCreateRequest withProductsSyncAdvise(@Nullable final SyncAdvise syncAdvise)
{
if (syncAdvise == null)
{
return this;
} | return toBuilder()
.product(getProduct().toBuilder().syncAdvise(syncAdvise).build())
.build();
}
public enum OrderDocType
{
@ApiEnum("Specifies if the order will be a standard one. A standard order will be created if no DocTYpe is specified.")
SalesOrder("SalesOrder"),
@ApiEnum("Specifies if the order will be prepaid")
PrepayOrder("PrepayOrder");
@Getter
private final String code;
OrderDocType(final String code)
{
this.code = code;
}
}
} | repos\metasfresh-new_dawn_uat\misc\de-metas-common\de-metas-common-ordercandidates\src\main\java\de\metas\common\ordercandidates\v1\request\JsonOLCandCreateRequest.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
} | public List<Employee> getEmployees() {
return employees;
}
public void setEmployees(List<Employee> employees) {
this.employees = employees;
}
@Override
public String toString() {
return "Department [id=" + id + ", name=" + name + "]";
}
} | repos\sample-spring-microservices-new-master\organization-service\src\main\java\pl\piomin\services\organization\model\Department.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class AppRunner implements CommandLineRunner {
private static final Logger logger = LoggerFactory.getLogger(AppRunner.class);
private final BookRepository bookRepository;
public AppRunner(BookRepository bookRepository) {
this.bookRepository = bookRepository;
}
@Override
public void run(String... args) throws Exception {
logger.info(".... Fetching books");
logger.info("isbn-1234 -->" + bookRepository.getByIsbn("isbn-1234"));
logger.info("isbn-4567 -->" + bookRepository.getByIsbn("isbn-4567"));
logger.info("以上两个查询一定从数据库查询,再根据cacheenable中的条件确定是否缓存");
logger.info("isbn-1234 -->" + bookRepository.getByIsbn("isbn-1234"));
logger.info("isbn-4567 -->" + bookRepository.getByIsbn("isbn-4567"));
logger.info("获取缓存中的数据,有的不需要查数据库");
Book book = new Book("isbn-4567", "更新过的book","");
bookRepository.update(book);
logger.info("isbn-1234 -->" + bookRepository.getByIsbn("isbn-1234"));
logger.info("isbn-4567 -->" + bookRepository.getByIsbn("isbn-4567")); | try {
bookRepository.clear();
} catch (Exception e) {
e.printStackTrace();
}
logger.info("isbn-1234 -->" + bookRepository.getByIsbn("isbn-1234"));
logger.info("isbn-4567 -->" + bookRepository.getByIsbn("isbn-4567"));
}
} | repos\spring-boot-quick-master\quick-cache\src\main\java\com\quick\cache\AppRunner.java | 2 |
请完成以下Java代码 | public void setIsAscending (final boolean IsAscending)
{
set_Value (COLUMNNAME_IsAscending, IsAscending);
}
@Override
public boolean isAscending()
{
return get_ValueAsBoolean(COLUMNNAME_IsAscending);
}
@Override
public void setMobileUI_UserProfile_DD_ID (final int MobileUI_UserProfile_DD_ID)
{
if (MobileUI_UserProfile_DD_ID < 1)
set_ValueNoCheck (COLUMNNAME_MobileUI_UserProfile_DD_ID, null);
else
set_ValueNoCheck (COLUMNNAME_MobileUI_UserProfile_DD_ID, MobileUI_UserProfile_DD_ID);
}
@Override
public int getMobileUI_UserProfile_DD_ID()
{
return get_ValueAsInt(COLUMNNAME_MobileUI_UserProfile_DD_ID);
}
@Override
public void setMobileUI_UserProfile_DD_Sort_ID (final int MobileUI_UserProfile_DD_Sort_ID)
{
if (MobileUI_UserProfile_DD_Sort_ID < 1)
set_ValueNoCheck (COLUMNNAME_MobileUI_UserProfile_DD_Sort_ID, null); | else
set_ValueNoCheck (COLUMNNAME_MobileUI_UserProfile_DD_Sort_ID, MobileUI_UserProfile_DD_Sort_ID);
}
@Override
public int getMobileUI_UserProfile_DD_Sort_ID()
{
return get_ValueAsInt(COLUMNNAME_MobileUI_UserProfile_DD_Sort_ID);
}
@Override
public void setSeqNo (final int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, SeqNo);
}
@Override
public int getSeqNo()
{
return get_ValueAsInt(COLUMNNAME_SeqNo);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_MobileUI_UserProfile_DD_Sort.java | 1 |
请完成以下Java代码 | private JFreeChart createLineChart() {
// create the chart...
JFreeChart chart = ChartFactory.createLineChart3D(
m_goal.getMeasure().getName(), // chart title
m_X_AxisLabel, // domain axis label
m_Y_AxisLabel, // range axis label
linearDataset, // data
PlotOrientation.VERTICAL, // orientation
false, // include legend
true, // tooltips?
true // URLs?
);
setupCategoryChart(chart);
return chart;
}
/**
*
* @return MGoal
*/
public MGoal getMGoal() {
return m_goal;
}
/**
*
* @param mgoal
*/
public void setMGoal(MGoal mgoal) {
m_goal = mgoal;
}
/**
*
* @return X axis label
*/
public String getXAxisLabel() {
return m_X_AxisLabel;
}
/**
*
* @param axisLabel
*/
public void setXAxisLabel(String axisLabel) {
m_X_AxisLabel = axisLabel;
}
/**
*
* @return Y axis label
*/ | public String getYAxisLabel() {
return m_Y_AxisLabel;
}
/**
*
* @param axisLabel
*/
public void setYAxisLabel(String axisLabel) {
m_Y_AxisLabel = axisLabel;
}
/**
*
* @return graph column list
*/
public ArrayList<GraphColumn> loadData() {
// Calculated
MMeasure measure = getMGoal().getMeasure();
if (measure == null)
{
log.warn("No Measure for " + getMGoal());
return null;
}
ArrayList<GraphColumn>list = measure.getGraphColumnList(getMGoal());
pieDataset = new DefaultPieDataset();
dataset = new DefaultCategoryDataset();
for (int i = 0; i < list.size(); i++){
String series = m_X_AxisLabel;
if (list.get(i).getDate() != null) {
Calendar cal = Calendar.getInstance();
cal.setTime(list.get(i).getDate());
series = Integer.toString(cal.get(Calendar.YEAR));
}
dataset.addValue(list.get(i).getValue(), series,
list.get(i).getLabel());
linearDataset.addValue(list.get(i).getValue(), m_X_AxisLabel,
list.get(i).getLabel());
pieDataset.setValue(list.get(i).getLabel(), list.get(i).getValue());
}
return list;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\adempiere\apps\graph\GraphBuilder.java | 1 |
请完成以下Java代码 | public void delete(String id) {
EntityImpl entity = findById(id);
delete(entity);
}
@Override
public void delete(EntityImpl entity) {
delete(entity, true);
}
@Override
public void delete(EntityImpl entity, boolean fireDeleteEvent) {
getDataManager().delete(entity);
if (fireDeleteEvent && getEventDispatcher().isEnabled()) {
getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_DELETED, entity)
);
}
}
protected abstract DataManager<EntityImpl> getDataManager();
/* Execution related entity count methods */
protected boolean isExecutionRelatedEntityCountEnabledGlobally() {
return processEngineConfiguration.getPerformanceSettings().isEnableExecutionRelationshipCounts();
}
protected boolean isExecutionRelatedEntityCountEnabled(ExecutionEntity executionEntity) { | if (executionEntity instanceof CountingExecutionEntity) {
return isExecutionRelatedEntityCountEnabled((CountingExecutionEntity) executionEntity);
}
return false;
}
protected boolean isExecutionRelatedEntityCountEnabled(CountingExecutionEntity executionEntity) {
/*
* There are two flags here: a global flag and a flag on the execution entity.
* The global flag can be switched on and off between different reboots,
* however the flag on the executionEntity refers to the state at that particular moment.
*
* Global flag / ExecutionEntity flag : result
*
* T / T : T (all true, regular mode with flags enabled)
* T / F : F (global is true, but execution was of a time when it was disabled, thus treating it as disabled)
* F / T : F (execution was of time when counting was done. But this is overruled by the global flag and thus the queries will be done)
* F / F : F (all disabled)
*
* From this table it is clear that only when both are true, the result should be true,
* which is the regular AND rule for booleans.
*/
return isExecutionRelatedEntityCountEnabledGlobally() && executionEntity.isCountEnabled();
}
} | repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\persistence\entity\AbstractEntityManager.java | 1 |
请完成以下Java代码 | public String toString()
{
return MoreObjects.toStringHelper(this)
.omitNullValues()
.add("elements", elements.isEmpty() ? null : elements)
.toString();
}
public List<DocumentLayoutElementDescriptor> getElements()
{
return elements;
}
public static final class Builder
{
private final List<DocumentLayoutElementDescriptor> elements = new ArrayList<>(); | private Builder()
{
}
public QuickInputLayoutDescriptor build()
{
return new QuickInputLayoutDescriptor(elements);
}
public Builder element(@NonNull final DocumentLayoutElementDescriptor.Builder elementBuilder)
{
elements.add(elementBuilder.build());
return this;
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\quickinput\QuickInputLayoutDescriptor.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public DataSourceProperties firstDataSourceProperties() {
return new DataSourceProperties();
}
@Primary
@Bean(name = "configFlywayBooksSchema")
public FlywayBookProperties firstFlywayProperties() {
return new FlywayBookProperties();
}
@Primary
@Bean(name = "dataSourceBooksSchema")
@ConfigurationProperties("app.datasource.ds1")
public HikariDataSource firstDataSource(@Qualifier("configBooksSchema") DataSourceProperties properties) {
return properties.initializeDataSourceBuilder().type(HikariDataSource.class)
.build();
}
@Primary
@FlywayDataSource
@Bean(initMethod = "migrate")
public Flyway firstFlyway(@Qualifier("configFlywayBooksSchema") FlywayBookProperties properties,
@Qualifier("dataSourceBooksSchema") HikariDataSource dataSource) {
return Flyway.configure()
.dataSource(dataSource)
.schemas(properties.getSchema())
.locations(properties.getLocation())
.load();
}
// second schema, authors
@Bean(name = "configAuthorsSchema")
@ConfigurationProperties("app.datasource.ds2")
public DataSourceProperties secondDataSourceProperties() {
return new DataSourceProperties();
}
@Bean(name = "configFlywayAuthorsSchema")
public FlywayAuthorProperties secondFlywayProperties() {
return new FlywayAuthorProperties();
} | @Bean(name = "dataSourceAuthorsSchema")
@ConfigurationProperties("app.datasource.ds2")
public HikariDataSource secondDataSource(@Qualifier("configAuthorsSchema") DataSourceProperties properties) {
return properties.initializeDataSourceBuilder().type(HikariDataSource.class)
.build();
}
@FlywayDataSource
@Bean(name = "flywayAuthorsSchema", initMethod = "migrate")
public Flyway secondFlyway(@Qualifier("configFlywayAuthorsSchema") FlywayAuthorProperties properties,
@Qualifier("dataSourceAuthorsSchema") HikariDataSource dataSource) {
return Flyway.configure()
.dataSource(dataSource)
.schemas(properties.getSchema())
.locations(properties.getLocation())
.load();
}
} | repos\Hibernate-SpringBoot-master\HibernateSpringBootFlywayPostgreSqlTwoSchemas\src\main\java\com\bookstore\config\ConfigureDataSources.java | 2 |
请完成以下Java代码 | public void onMsg(TbContext ctx, TbMsg msg) throws ExecutionException, InterruptedException, TbNodeException {
var metaDataCopy = msg.getMetaData().copy();
String msgData = msg.getData();
boolean msgChanged = false;
JsonNode dataNode = JacksonUtil.toJsonNode(msgData);
if (dataNode.isObject()) {
switch (copyFrom) {
case METADATA:
ObjectNode msgDataNode = (ObjectNode) dataNode;
Map<String, String> metaDataMap = metaDataCopy.getData();
for (Map.Entry<String, String> entry : metaDataMap.entrySet()) {
String mdKey = entry.getKey();
String mdValue = entry.getValue();
if (matches(mdKey)) {
msgChanged = true;
msgDataNode.put(mdKey, mdValue);
}
}
msgData = JacksonUtil.toString(msgDataNode);
break;
case DATA:
Iterator<Map.Entry<String, JsonNode>> iteratorNode = dataNode.fields();
while (iteratorNode.hasNext()) {
Map.Entry<String, JsonNode> entry = iteratorNode.next();
String msgKey = entry.getKey();
JsonNode msgValue = entry.getValue();
if (matches(msgKey)) {
msgChanged = true;
String value = msgValue.isTextual() ?
msgValue.asText() : JacksonUtil.toString(msgValue);
metaDataCopy.putValue(msgKey, value);
}
}
break;
default: | log.debug("Unexpected CopyFrom value: {}. Allowed values: {}", copyFrom, TbMsgSource.values());
}
}
ctx.tellSuccess(msgChanged ? msg.transform()
.metaData(metaDataCopy)
.data(msgData)
.build() : msg);
}
@Override
protected String getNewKeyForUpgradeFromVersionZero() {
return "copyFrom";
}
@Override
protected String getKeyToUpgradeFromVersionOne() {
return FROM_METADATA_PROPERTY;
}
boolean matches(String key) {
return compiledKeyPatterns.stream().anyMatch(pattern -> pattern.matcher(key).matches());
}
} | repos\thingsboard-master\rule-engine\rule-engine-components\src\main\java\org\thingsboard\rule\engine\transform\TbCopyKeysNode.java | 1 |
请完成以下Java代码 | public QueueStats findByTenantIdAndNameAndServiceId(TenantId tenantId, String queueName, String serviceId) {
log.trace("Executing findByTenantIdAndNameAndServiceId, tenantId: [{}], queueName: [{}], serviceId: [{}]", tenantId, queueName, serviceId);
validateId(tenantId, id -> INCORRECT_TENANT_ID + id);
return queueStatsDao.findByTenantIdQueueNameAndServiceId(tenantId, queueName, serviceId);
}
@Override
public PageData<QueueStats> findByTenantId(TenantId tenantId, PageLink pageLink) {
log.trace("Executing findByTenantId, tenantId: [{}]", tenantId);
Validator.validatePageLink(pageLink);
return queueStatsDao.findAllByTenantId(tenantId, pageLink);
}
@Override
public void deleteByTenantId(TenantId tenantId) {
log.trace("Executing deleteByTenantId, tenantId [{}]", tenantId);
validateId(tenantId, id -> INCORRECT_TENANT_ID + id);
queueStatsDao.deleteByTenantId(tenantId);
}
@Override | public void deleteEntity(TenantId tenantId, EntityId id, boolean force) {
queueStatsDao.removeById(tenantId, id.getId());
eventPublisher.publishEvent(DeleteEntityEvent.builder().tenantId(tenantId).entityId(id).build());
}
@Override
public Optional<HasId<?>> findEntity(TenantId tenantId, EntityId entityId) {
return Optional.ofNullable(findQueueStatsById(tenantId, new QueueStatsId(entityId.getId())));
}
@Override
public FluentFuture<Optional<HasId<?>>> findEntityAsync(TenantId tenantId, EntityId entityId) {
return FluentFuture.from(queueStatsDao.findByIdAsync(tenantId, entityId.getId()))
.transform(Optional::ofNullable, directExecutor());
}
@Override
public EntityType getEntityType() {
return EntityType.QUEUE_STATS;
}
} | repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\queue\BaseQueueStatsService.java | 1 |
请完成以下Java代码 | public String getAdmin() {
return admin;
}
public void setAdmin(String admin) {
this.admin = admin;
}
public String getConcurrency() {
return concurrency;
}
public void setConcurrency(String concurrency) {
this.concurrency = concurrency;
}
public String getExecutor() {
return executor; | }
public void setExecutor(String executor) {
this.executor = executor;
}
public String getAckMode() {
return ackMode;
}
public void setAckMode(String ackMode) {
this.ackMode = ackMode;
}
} | repos\flowable-engine-main\modules\flowable-event-registry-model\src\main\java\org\flowable\eventregistry\model\RabbitInboundChannelModel.java | 1 |
请完成以下Java代码 | public void initialize(ModelValidationEngine engine, MClient client)
{
adClientId = client == null ? -1 : client.getAD_Client_ID();
engine.addModelChange(tableName, this);
}
@Override
public int getAD_Client_ID()
{
return adClientId;
}
@Override
public String login(int AD_Org_ID, int AD_Role_ID, int AD_User_ID)
{
return null;
} | @Override
public String modelChange(PO po, int type) throws Exception
{
if (type == TYPE_BEFORE_NEW || type == TYPE_BEFORE_CHANGE)
{
final T item = InterfaceWrapperHelper.create(po, itemClass);
validator.validate(item);
}
return null;
}
@Override
public String docValidate(PO po, int timing)
{
return null;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\appdict\validation\model\validator\ApplicationDictionaryGenericModelValidator.java | 1 |
请完成以下Java代码 | public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getVertifyMan() {
return vertifyMan;
}
public void setVertifyMan(String vertifyMan) {
this.vertifyMan = vertifyMan;
}
public Integer getStatus() {
return status;
} | public void setStatus(Integer status) {
this.status = status;
}
public String getDetail() {
return detail;
}
public void setDetail(String detail) {
this.detail = detail;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", productId=").append(productId);
sb.append(", createTime=").append(createTime);
sb.append(", vertifyMan=").append(vertifyMan);
sb.append(", status=").append(status);
sb.append(", detail=").append(detail);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\PmsProductVertifyRecord.java | 1 |
请完成以下Java代码 | 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代码 | private static final class SpringApplicationContextAsServiceImplProvider implements IServiceImplProvider
{
private final ApplicationContext applicationContext;
private SpringApplicationContextAsServiceImplProvider(final ApplicationContext applicationContext)
{
this.applicationContext = applicationContext;
}
@Override
public String toString()
{
return MoreObjects.toStringHelper(this).addValue(applicationContext).toString();
}
@Override
public <T extends IService> T provideServiceImpl(@NonNull final Class<T> serviceClazz)
{
try
{
return applicationContext.getBean(serviceClazz);
}
catch (final NoUniqueBeanDefinitionException e)
{
// not ok; we have > 1 matching beans defined in the spring context. So far that always indicated some sort of mistake, so let's escalate.
throw e; | }
catch (final NoSuchBeanDefinitionException e)
{
// ok; the bean is not in the spring context, so let's just return null
return null;
}
catch (final IllegalStateException e)
{
if (Adempiere.isUnitTestMode())
{
// added for @SpringBootTests starting up with a 'Marked for closing' Context, mostly due to DirtiesContext.ClassMode.BEFORE_CLASS
return null;
}
throw e;
}
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\StartupListener.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public @Nullable String getEndpoint() {
return this.endpoint;
}
public void setEndpoint(@Nullable String endpoint) {
this.endpoint = endpoint;
}
public Duration getTimeout() {
return this.timeout;
}
public void setTimeout(Duration timeout) {
this.timeout = timeout;
}
public Duration getConnectTimeout() {
return this.connectTimeout;
}
public void setConnectTimeout(Duration connectTimeout) {
this.connectTimeout = connectTimeout;
}
public Transport getTransport() {
return this.transport;
}
public void setTransport(Transport transport) {
this.transport = transport;
}
public Compression getCompression() {
return this.compression;
}
public void setCompression(Compression compression) { | this.compression = compression;
}
public Map<String, String> getHeaders() {
return this.headers;
}
public void setHeaders(Map<String, String> headers) {
this.headers = headers;
}
public enum Compression {
/**
* Gzip compression.
*/
GZIP,
/**
* No compression.
*/
NONE
}
} | repos\spring-boot-4.0.1\module\spring-boot-micrometer-tracing-opentelemetry\src\main\java\org\springframework\boot\micrometer\tracing\opentelemetry\autoconfigure\otlp\OtlpTracingProperties.java | 2 |
请完成以下Java代码 | public int getC_UOM_ID()
{
return get_ValueAsInt(COLUMNNAME_C_UOM_ID);
}
@Override
public void setIsAllowSeparateInvoicing (final boolean IsAllowSeparateInvoicing)
{
set_Value (COLUMNNAME_IsAllowSeparateInvoicing, IsAllowSeparateInvoicing);
}
@Override
public boolean isAllowSeparateInvoicing()
{
return get_ValueAsBoolean(COLUMNNAME_IsAllowSeparateInvoicing);
}
@Override
public void setIsHideWhenPrinting (final boolean IsHideWhenPrinting)
{
set_Value (COLUMNNAME_IsHideWhenPrinting, IsHideWhenPrinting);
}
@Override
public boolean isHideWhenPrinting()
{
return get_ValueAsBoolean(COLUMNNAME_IsHideWhenPrinting);
}
@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 setQty (final BigDecimal Qty)
{
set_Value (COLUMNNAME_Qty, Qty);
}
@Override
public BigDecimal getQty()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setSeqNo (final int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, SeqNo);
}
@Override
public int getSeqNo()
{
return get_ValueAsInt(COLUMNNAME_SeqNo);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\de\metas\order\model\X_C_CompensationGroup_Schema_TemplateLine.java | 1 |
请完成以下Java代码 | public class MProjectIssue extends X_C_ProjectIssue
{
private static final long serialVersionUID = 4714411434615096132L;
public MProjectIssue(final Properties ctx, final int C_ProjectIssue_ID, final String trxName)
{
super(ctx, C_ProjectIssue_ID, trxName);
if (is_new())
{
// setC_Project_ID (0);
// setLine (0);
// setM_Locator_ID (0);
// setM_Product_ID (0);
// setMovementDate (new Timestamp(System.currentTimeMillis()));
setMovementQty(BigDecimal.ZERO);
setPosted(false);
setProcessed(false);
}
} // MProjectIssue
public MProjectIssue(final Properties ctx, final ResultSet rs, final String trxName)
{
super(ctx, rs, trxName);
}
public MProjectIssue(final I_C_Project project)
{
this(InterfaceWrapperHelper.getCtx(project),
0,
InterfaceWrapperHelper.getTrxName(project));
setClientOrg(project.getAD_Client_ID(), project.getAD_Org_ID());
setC_Project_ID(project.getC_Project_ID()); // Parent
setLine(getNextLine());
//
// setM_Locator_ID (0);
// setM_Product_ID (0);
//
setMovementDate(SystemTime.asTimestamp());
setMovementQty(BigDecimal.ZERO);
setPosted(false);
setProcessed(false);
} // MProjectIssue
/**
* Get the next Line No
*
* @return next line no
*/
private int getNextLine()
{
return DB.getSQLValue(get_TrxName(),
"SELECT COALESCE(MAX(Line),0)+10 FROM C_ProjectIssue WHERE C_Project_ID=?", getC_Project_ID());
} // getLineFromProject
/**
* Set Mandatory Values
*/
public void setMandatory(final int M_Locator_ID, final int M_Product_ID, final BigDecimal MovementQty)
{
setM_Locator_ID(M_Locator_ID);
setM_Product_ID(M_Product_ID);
setMovementQty(MovementQty);
} // setMandatory
public void process()
{
saveEx(); | if (getM_Product_ID() <= 0)
{
throw new FillMandatoryException(COLUMNNAME_M_Product_ID);
}
final IProductBL productBL = Services.get(IProductBL.class);
if (productBL.isStocked(ProductId.ofRepoIdOrNull(getM_Product_ID())))
{
// ** Create Material Transactions **
final MTransaction mTrx = new MTransaction(getCtx(),
getAD_Org_ID(),
MTransaction.MOVEMENTTYPE_WorkOrderPlus,
getM_Locator_ID(),
getM_Product_ID(),
getM_AttributeSetInstance_ID(),
getMovementQty().negate(),
getMovementDate(),
get_TrxName());
mTrx.setC_ProjectIssue_ID(getC_ProjectIssue_ID());
InterfaceWrapperHelper.save(mTrx);
final IWarehouseDAO warehouseDAO = Services.get(IWarehouseDAO.class);
final IStorageBL storageBL = Services.get(IStorageBL.class);
final I_M_Locator loc = warehouseDAO.getLocatorByRepoId(getM_Locator_ID());
storageBL.add(getCtx(), loc.getM_Warehouse_ID(), getM_Locator_ID(),
getM_Product_ID(), getM_AttributeSetInstance_ID(), getM_AttributeSetInstance_ID(),
getMovementQty().negate(), null, null, get_TrxName());
}
setProcessed(true);
saveEx();
}
} // MProjectIssue | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\MProjectIssue.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public CrossOriginOpenerPolicyConfig policy(
CrossOriginOpenerPolicyHeaderWriter.CrossOriginOpenerPolicy openerPolicy) {
this.writer.setPolicy(openerPolicy);
return this;
}
}
public final class CrossOriginEmbedderPolicyConfig {
private CrossOriginEmbedderPolicyHeaderWriter writer;
public CrossOriginEmbedderPolicyConfig() {
}
/**
* Sets the policy to be used in the {@code Cross-Origin-Embedder-Policy} header
* @param embedderPolicy a {@code Cross-Origin-Embedder-Policy}
* @return the {@link CrossOriginEmbedderPolicyConfig} for additional
* configuration
* @throws IllegalArgumentException if embedderPolicy is null
*/
public CrossOriginEmbedderPolicyConfig policy(
CrossOriginEmbedderPolicyHeaderWriter.CrossOriginEmbedderPolicy embedderPolicy) {
this.writer.setPolicy(embedderPolicy);
return this;
}
} | public final class CrossOriginResourcePolicyConfig {
private CrossOriginResourcePolicyHeaderWriter writer;
public CrossOriginResourcePolicyConfig() {
}
/**
* Sets the policy to be used in the {@code Cross-Origin-Resource-Policy} header
* @param resourcePolicy a {@code Cross-Origin-Resource-Policy}
* @return the {@link CrossOriginResourcePolicyConfig} for additional
* configuration
* @throws IllegalArgumentException if resourcePolicy is null
*/
public CrossOriginResourcePolicyConfig policy(
CrossOriginResourcePolicyHeaderWriter.CrossOriginResourcePolicy resourcePolicy) {
this.writer.setPolicy(resourcePolicy);
return this;
}
}
} | repos\spring-security-main\config\src\main\java\org\springframework\security\config\annotation\web\configurers\HeadersConfigurer.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public @Nullable String getGroup() {
return this.group;
}
public void setGroup(@Nullable String group) {
this.group = group;
}
public String getTechnologyType() {
return this.technologyType;
}
public void setTechnologyType(String technologyType) {
this.technologyType = technologyType;
}
}
public static class V2 {
/**
* Default dimensions that are added to all metrics in the form of key-value
* pairs. These are overwritten by Micrometer tags if they use the same key.
*/
private @Nullable Map<String, String> defaultDimensions;
/**
* Whether to enable Dynatrace metadata export.
*/
private boolean enrichWithDynatraceMetadata = true;
/**
* Prefix string that is added to all exported metrics.
*/
private @Nullable String metricKeyPrefix;
/**
* Whether to fall back to the built-in micrometer instruments for Timer and
* DistributionSummary.
*/
private boolean useDynatraceSummaryInstruments = true;
/**
* Whether to export meter metadata (unit and description) to the Dynatrace
* backend.
*/
private boolean exportMeterMetadata = true;
public @Nullable Map<String, String> getDefaultDimensions() {
return this.defaultDimensions;
}
public void setDefaultDimensions(@Nullable Map<String, String> defaultDimensions) {
this.defaultDimensions = defaultDimensions;
}
public boolean isEnrichWithDynatraceMetadata() {
return this.enrichWithDynatraceMetadata; | }
public void setEnrichWithDynatraceMetadata(Boolean enrichWithDynatraceMetadata) {
this.enrichWithDynatraceMetadata = enrichWithDynatraceMetadata;
}
public @Nullable String getMetricKeyPrefix() {
return this.metricKeyPrefix;
}
public void setMetricKeyPrefix(@Nullable String metricKeyPrefix) {
this.metricKeyPrefix = metricKeyPrefix;
}
public boolean isUseDynatraceSummaryInstruments() {
return this.useDynatraceSummaryInstruments;
}
public void setUseDynatraceSummaryInstruments(boolean useDynatraceSummaryInstruments) {
this.useDynatraceSummaryInstruments = useDynatraceSummaryInstruments;
}
public boolean isExportMeterMetadata() {
return this.exportMeterMetadata;
}
public void setExportMeterMetadata(boolean exportMeterMetadata) {
this.exportMeterMetadata = exportMeterMetadata;
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-micrometer-metrics\src\main\java\org\springframework\boot\micrometer\metrics\autoconfigure\export\dynatrace\DynatraceProperties.java | 2 |
请在Spring Boot框架中完成以下Java代码 | private ImmutableSetMultimap<QRCodeConfigurationId, AttributeId> getAttributeIds(@NonNull final Collection<I_QRCode_Configuration> qrCodeConfigurationList)
{
final ImmutableSet<QRCodeConfigurationId> codeConfigurationIds = qrCodeConfigurationList.stream()
.map(I_QRCode_Configuration::getQRCode_Configuration_ID)
.map(QRCodeConfigurationId::ofRepoId)
.collect(ImmutableSet.toImmutableSet());
return queryBL.createQueryBuilder(I_QRCode_Attribute_Config.class)
.addOnlyActiveRecordsFilter()
.addInArrayFilter(I_QRCode_Attribute_Config.COLUMNNAME_QRCode_Configuration_ID, codeConfigurationIds)
.create()
.stream()
.collect(ImmutableSetMultimap.toImmutableSetMultimap(attributeConfig -> QRCodeConfigurationId.ofRepoId(attributeConfig.getQRCode_Configuration_ID()),
attributeConfig -> AttributeId.ofRepoId(attributeConfig.getAD_Attribute_ID())));
}
@NonNull
private static ImmutableList<QRCodeConfiguration> toQRCodeConfiguration(
@NonNull final ImmutableList<I_QRCode_Configuration> qrCodeConfigurations,
@NonNull final ImmutableSetMultimap<QRCodeConfigurationId, AttributeId> configurationId2Attributes)
{
return qrCodeConfigurations.stream()
.map(qrCodeConfiguration -> QRCodeConfiguration.builder()
.id(QRCodeConfigurationId.ofRepoId(qrCodeConfiguration.getQRCode_Configuration_ID()))
.name(qrCodeConfiguration.getName())
.isOneQrCodeForAggregatedHUs(qrCodeConfiguration.isOneQRCodeForAggregatedHUs())
.isOneQrCodeForMatchingAttributes(qrCodeConfiguration.isOneQRCodeForMatchingAttributes())
.groupByAttributeIds(configurationId2Attributes.get(QRCodeConfigurationId.ofRepoId(qrCodeConfiguration.getQRCode_Configuration_ID())))
.build())
.collect(ImmutableList.toImmutableList());
}
@Value
private static class QRCodeConfigurationMap
{
@NonNull
ImmutableMap<QRCodeConfigurationId, QRCodeConfiguration> id2Configuration;
@NonNull
public static QRCodeConfigurationMap ofList(@NonNull final ImmutableList<QRCodeConfiguration> configList)
{
final ImmutableMap<QRCodeConfigurationId, QRCodeConfiguration> id2Configuration = configList.stream()
.collect(ImmutableMap.toImmutableMap(QRCodeConfiguration::getId, Function.identity()));
return new QRCodeConfigurationMap(id2Configuration); | }
@NonNull
public Optional<QRCodeConfiguration> getById(@NonNull final QRCodeConfigurationId id)
{
return Optional.ofNullable(id2Configuration.get(id));
}
@NonNull
public ImmutableMap<QRCodeConfigurationId, QRCodeConfiguration> getByIds(@NonNull final Collection<QRCodeConfigurationId> ids)
{
return ImmutableSet.copyOf(ids)
.stream()
.collect(ImmutableMap.toImmutableMap(Function.identity(), id2Configuration::get));
}
public boolean isEmpty()
{
return id2Configuration.isEmpty();
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\qrcodes\service\QRCodeConfigurationRepository.java | 2 |
请完成以下Java代码 | protected FlowElement convertJsonToElement(
JsonNode elementNode,
JsonNode modelNode,
Map<String, JsonNode> shapeMap
) {
CallActivity callActivity = new CallActivity();
if (StringUtils.isNotEmpty(getPropertyValueAsString(PROPERTY_CALLACTIVITY_CALLEDELEMENT, elementNode))) {
callActivity.setCalledElement(getPropertyValueAsString(PROPERTY_CALLACTIVITY_CALLEDELEMENT, elementNode));
}
callActivity
.getInParameters()
.addAll(convertToIOParameters(PROPERTY_CALLACTIVITY_IN, "inParameters", elementNode));
callActivity
.getOutParameters()
.addAll(convertToIOParameters(PROPERTY_CALLACTIVITY_OUT, "outParameters", elementNode));
return callActivity;
}
private List<IOParameter> convertToIOParameters(String propertyName, String valueName, JsonNode elementNode) {
List<IOParameter> ioParameters = new ArrayList<IOParameter>();
JsonNode parametersNode = getProperty(propertyName, elementNode);
if (parametersNode != null) {
parametersNode = BpmnJsonConverterUtil.validateIfNodeIsTextual(parametersNode);
JsonNode itemsArrayNode = parametersNode.get(valueName);
if (itemsArrayNode != null) {
for (JsonNode itemNode : itemsArrayNode) {
JsonNode sourceNode = itemNode.get(PROPERTY_IOPARAMETER_SOURCE);
JsonNode sourceExpressionNode = itemNode.get(PROPERTY_IOPARAMETER_SOURCE_EXPRESSION); | if (
(sourceNode != null && StringUtils.isNotEmpty(sourceNode.asText())) ||
(sourceExpressionNode != null && StringUtils.isNotEmpty(sourceExpressionNode.asText()))
) {
IOParameter parameter = new IOParameter();
if (StringUtils.isNotEmpty(getValueAsString(PROPERTY_IOPARAMETER_SOURCE, itemNode))) {
parameter.setSource(getValueAsString(PROPERTY_IOPARAMETER_SOURCE, itemNode));
} else if (
StringUtils.isNotEmpty(getValueAsString(PROPERTY_IOPARAMETER_SOURCE_EXPRESSION, itemNode))
) {
parameter.setSourceExpression(
getValueAsString(PROPERTY_IOPARAMETER_SOURCE_EXPRESSION, itemNode)
);
}
if (StringUtils.isNotEmpty(getValueAsString(PROPERTY_IOPARAMETER_TARGET, itemNode))) {
parameter.setTarget(getValueAsString(PROPERTY_IOPARAMETER_TARGET, itemNode));
}
ioParameters.add(parameter);
}
}
}
}
return ioParameters;
}
} | repos\Activiti-develop\activiti-core\activiti-json-converter\src\main\java\org\activiti\editor\language\json\converter\CallActivityJsonConverter.java | 1 |
请完成以下Java代码 | public class CorrelationPropertyImpl extends RootElementImpl implements CorrelationProperty {
protected static Attribute<String> nameAttribute;
protected static AttributeReference<ItemDefinition> typeAttribute;
protected static ChildElementCollection<CorrelationPropertyRetrievalExpression> correlationPropertyRetrievalExpressionCollection;
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder;
typeBuilder = modelBuilder.defineType(CorrelationProperty.class, BPMN_ELEMENT_CORRELATION_PROPERTY)
.namespaceUri(BPMN20_NS)
.extendsType(RootElement.class)
.instanceProvider(new ModelTypeInstanceProvider<CorrelationProperty>() {
public CorrelationProperty newInstance(ModelTypeInstanceContext instanceContext) {
return new CorrelationPropertyImpl(instanceContext);
}
});
nameAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_NAME)
.build();
typeAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_TYPE)
.qNameAttributeReference(ItemDefinition.class)
.build();
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
correlationPropertyRetrievalExpressionCollection = sequenceBuilder
.elementCollection(CorrelationPropertyRetrievalExpression.class)
.required()
.build();
typeBuilder.build();
}
public CorrelationPropertyImpl(ModelTypeInstanceContext context) {
super(context); | }
public String getName() {
return nameAttribute.getValue(this);
}
public void setName(String name) {
nameAttribute.setValue(this, name);
}
public ItemDefinition getType() {
return typeAttribute.getReferenceTargetElement(this);
}
public void setType(ItemDefinition type) {
typeAttribute.setReferenceTargetElement(this, type);
}
public Collection<CorrelationPropertyRetrievalExpression> getCorrelationPropertyRetrievalExpressions() {
return correlationPropertyRetrievalExpressionCollection.get(this);
}
} | repos\camunda-bpm-platform-master\model-api\bpmn-model\src\main\java\org\camunda\bpm\model\bpmn\impl\instance\CorrelationPropertyImpl.java | 1 |
请完成以下Java代码 | public String getProblem() {
return problem;
}
public void setProblem(String problem) {
this.problem = problem;
}
public String getDefaultDescription() {
return defaultDescription;
}
public void setDefaultDescription(String defaultDescription) {
this.defaultDescription = defaultDescription;
}
public String getItemId() {
return itemId;
}
public void setItemId(String itemId) {
this.itemId = itemId;
}
public String getItemName() {
return itemName;
}
public void setItemName(String itemName) {
this.itemName = itemName;
}
@Override
public String toString() {
StringBuilder strb = new StringBuilder();
strb.append("[Validation set: '").append(validatorSetName).append("' | Problem: '").append(problem).append("'] : ");
strb.append(defaultDescription);
strb.append(" - [Extra info : ");
boolean extraInfoAlreadyPresent = false;
if (caseDefinitionId != null) { | strb.append("caseDefinitionId = ").append(caseDefinitionId);
extraInfoAlreadyPresent = true;
}
if (caseDefinitionName != null) {
if (extraInfoAlreadyPresent) {
strb.append(" | ");
}
strb.append("caseDefinitionName = ").append(caseDefinitionName).append(" | ");
extraInfoAlreadyPresent = true;
}
if (itemId != null) {
if (extraInfoAlreadyPresent) {
strb.append(" | ");
}
strb.append("id = ").append(itemId).append(" | ");
extraInfoAlreadyPresent = true;
}
if (itemName != null) {
if (extraInfoAlreadyPresent) {
strb.append(" | ");
}
strb.append("name = ").append(itemName).append(" | ");
extraInfoAlreadyPresent = true;
}
strb.append("]");
if (xmlLineNumber > 0 && xmlColumnNumber > 0) {
strb.append(" ( line: ").append(xmlLineNumber).append(", column: ").append(xmlColumnNumber).append(")");
}
return strb.toString();
}
} | repos\flowable-engine-main\modules\flowable-case-validation\src\main\java\org\flowable\cmmn\validation\validator\ValidationEntry.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class DLXCustomAmqpConfiguration {
public static final String DLX_EXCHANGE_MESSAGES = QUEUE_MESSAGES + ".dlx";
@Bean
Queue messagesQueue() {
return QueueBuilder.durable(QUEUE_MESSAGES)
.withArgument("x-dead-letter-exchange", DLX_EXCHANGE_MESSAGES)
.build();
}
@Bean
FanoutExchange deadLetterExchange() {
return new FanoutExchange(DLX_EXCHANGE_MESSAGES);
}
@Bean
Queue deadLetterQueue() {
return QueueBuilder.durable(QUEUE_MESSAGES_DLQ).build();
} | @Bean
Binding deadLetterBinding() {
return BindingBuilder.bind(deadLetterQueue()).to(deadLetterExchange());
}
@Bean
DirectExchange messagesExchange() {
return new DirectExchange(EXCHANGE_MESSAGES);
}
@Bean
Binding bindingMessages() {
return BindingBuilder.bind(messagesQueue()).to(messagesExchange()).with(QUEUE_MESSAGES);
}
} | repos\tutorials-master\messaging-modules\spring-amqp\src\main\java\com\baeldung\springamqp\errorhandling\configuration\DLXCustomAmqpConfiguration.java | 2 |
请完成以下Java代码 | private <T> Mono<T> extractBody(ServerWebExchange exchange, ClientResponse clientResponse, Class<T> inClass) {
// if inClass is byte[] then just return body, otherwise check if
// decoding required
if (byte[].class.isAssignableFrom(inClass)) {
return clientResponse.bodyToMono(inClass);
}
List<String> encodingHeaders = exchange.getResponse().getHeaders().getOrEmpty(HttpHeaders.CONTENT_ENCODING);
for (String encoding : encodingHeaders) {
MessageBodyDecoder decoder = messageBodyDecoders.get(encoding);
if (decoder != null) {
return clientResponse.bodyToMono(byte[].class)
.publishOn(Schedulers.parallel())
.map(decoder::decode)
.map(bytes -> exchange.getResponse().bufferFactory().wrap(bytes))
.map(buffer -> prepareClientResponse(Mono.just(buffer), exchange.getResponse().getHeaders()))
.flatMap(response -> response.bodyToMono(inClass));
}
}
return clientResponse.bodyToMono(inClass);
}
private Mono<DataBuffer> writeBody(ServerHttpResponse httpResponse, CachedBodyOutputMessage message,
Class<?> outClass) {
Mono<DataBuffer> response = DataBufferUtils.join(message.getBody()); | if (byte[].class.isAssignableFrom(outClass)) {
return response;
}
List<String> encodingHeaders = httpResponse.getHeaders().getOrEmpty(HttpHeaders.CONTENT_ENCODING);
for (String encoding : encodingHeaders) {
MessageBodyEncoder encoder = messageBodyEncoders.get(encoding);
if (encoder != null) {
DataBufferFactory dataBufferFactory = httpResponse.bufferFactory();
response = response.publishOn(Schedulers.parallel()).map(buffer -> {
byte[] encodedResponse = encoder.encode(buffer);
DataBufferUtils.release(buffer);
return encodedResponse;
}).map(dataBufferFactory::wrap);
break;
}
}
return response;
}
}
} | repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webflux\src\main\java\org\springframework\cloud\gateway\filter\factory\rewrite\ModifyResponseBodyGatewayFilterFactory.java | 1 |
请完成以下Java代码 | public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPrice() {
return price; | }
public void setPrice(double price) {
this.price = price;
}
public boolean isDeleted() {
return deleted;
}
public void setDeleted(boolean deleted) {
this.deleted = deleted;
}
} | repos\tutorials-master\persistence-modules\spring-data-jpa-crud\src\main\java\com\baeldung\softdelete\Product.java | 1 |
请完成以下Java代码 | public String getProcessDefinitionKey() {
return processDefinitionKey;
}
public void setProcessDefinitionKey(String processDefinitionKey) {
this.processDefinitionKey = processDefinitionKey;
}
public int getSuspensionState() {
return suspensionState;
}
public void setSuspensionState(int state) {
this.suspensionState = state;
}
public Long getOverridingJobPriority() {
return jobPriority;
}
public void setJobPriority(Long jobPriority) {
this.jobPriority = jobPriority;
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
} | public String getDeploymentId() {
return deploymentId;
}
public void setDeploymentId(String deploymentId) {
this.deploymentId = deploymentId;
}
@Override
public Set<String> getReferencedEntityIds() {
Set<String> referencedEntityIds = new HashSet<>();
return referencedEntityIds;
}
@Override
public Map<String, Class> getReferencedEntitiesIdAndClass() {
Map<String, Class> referenceIdAndClass = new HashMap<>();
return referenceIdAndClass;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\JobDefinitionEntity.java | 1 |
请完成以下Java代码 | private void deleteAllScopeJobs(ExecutionEntity scopeExecution, TimerJobEntityManager timerJobEntityManager) {
Collection<TimerJobEntity> timerJobsForExecution = timerJobEntityManager.findJobsByExecutionId(
scopeExecution.getId()
);
for (TimerJobEntity job : timerJobsForExecution) {
timerJobEntityManager.delete(job);
}
JobEntityManager jobEntityManager = commandContext.getJobEntityManager();
Collection<JobEntity> jobsForExecution = jobEntityManager.findJobsByExecutionId(scopeExecution.getId());
for (JobEntity job : jobsForExecution) {
jobEntityManager.delete(job);
}
SuspendedJobEntityManager suspendedJobEntityManager = commandContext.getSuspendedJobEntityManager();
Collection<SuspendedJobEntity> suspendedJobsForExecution = suspendedJobEntityManager.findJobsByExecutionId(
scopeExecution.getId()
);
for (SuspendedJobEntity job : suspendedJobsForExecution) {
suspendedJobEntityManager.delete(job);
}
DeadLetterJobEntityManager deadLetterJobEntityManager = commandContext.getDeadLetterJobEntityManager();
Collection<DeadLetterJobEntity> deadLetterJobsForExecution = deadLetterJobEntityManager.findJobsByExecutionId(
scopeExecution.getId()
);
for (DeadLetterJobEntity job : deadLetterJobsForExecution) {
deadLetterJobEntityManager.delete(job);
}
}
private void deleteAllScopeTasks(ExecutionEntity scopeExecution, TaskEntityManager taskEntityManager) {
Collection<TaskEntity> tasksForExecution = taskEntityManager.findTasksByExecutionId(scopeExecution.getId());
for (TaskEntity taskEntity : tasksForExecution) {
taskEntityManager.deleteTask(taskEntity, execution.getDeleteReason(), false, false); | }
}
private ExecutionEntityManager deleteAllChildExecutions(
ExecutionEntityManager executionEntityManager,
ExecutionEntity scopeExecution
) {
// Delete all child executions
Collection<ExecutionEntity> childExecutions = executionEntityManager.findChildExecutionsByParentExecutionId(
scopeExecution.getId()
);
for (ExecutionEntity childExecution : childExecutions) {
executionEntityManager.deleteExecutionAndRelatedData(childExecution, execution.getDeleteReason());
}
return executionEntityManager;
}
} | repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\agenda\DestroyScopeOperation.java | 1 |
请在Spring Boot框架中完成以下Java代码 | private ProductionDetail createProductionDetailForPPOrderLineCandidate(
@NonNull final PPOrderLineCandidate ppOrderLineCandidate,
@NonNull final PPOrderCandidate ppOrderCandidate)
{
final PPOrderLineData ppOrderLineData = ppOrderLineCandidate.getPpOrderLineData();
return ProductionDetail.builder()
.advised(Flag.FALSE)
.pickDirectlyIfFeasible(Flag.FALSE_DONT_UPDATE)
.plantId(ppOrderCandidate.getPpOrderData().getPlantId())
.workstationId(ppOrderCandidate.getPpOrderData().getWorkstationId())
.qty(ppOrderLineData.getQtyOpenNegateIfReceipt())
.productPlanningId(ppOrderCandidate.getPpOrderData().getProductPlanningId())
.productBomLineId(ppOrderLineData.getProductBomLineId())
.description(ppOrderLineData.getDescription())
.ppOrderRef(PPOrderRef.ofPPOrderLineCandidateId(PPOrderCandidateId.toRepoId(ppOrderCandidate.getPpOrderCandidateId()), ppOrderLineCandidate.getPpOrderLineCandidateId()))
.build();
} | @NonNull
private MaterialDescriptor createMaterialDescriptorForPPOrderLineCandidate(
@NonNull final PPOrderLineCandidate ppOrderLineCandidate,
@NonNull final PPOrderCandidate ppOrderCandidate)
{
final PPOrderData ppOrderData = ppOrderCandidate.getPpOrderData();
return MaterialDescriptor.builder()
.date(ppOrderLineCandidate.getPpOrderLineData().getIssueOrReceiveDate())
.productDescriptor(ppOrderLineCandidate.getPpOrderLineData().getProductDescriptor())
.quantity(ppOrderLineCandidate.getPpOrderLineData().getQtyOpenNegateIfReceipt())
.warehouseId(ppOrderData.getWarehouseId())
.build();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.material\dispo-service\src\main\java\de\metas\material\dispo\service\event\handler\ppordercandidate\PPOrderCandidateEventHandler.java | 2 |
请完成以下Java代码 | public int getDataEntry_SubTab_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_DataEntry_SubTab_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public de.metas.dataentry.model.I_DataEntry_Tab getDataEntry_Tab() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_DataEntry_Tab_ID, de.metas.dataentry.model.I_DataEntry_Tab.class);
}
@Override
public void setDataEntry_Tab(de.metas.dataentry.model.I_DataEntry_Tab DataEntry_Tab)
{
set_ValueFromPO(COLUMNNAME_DataEntry_Tab_ID, de.metas.dataentry.model.I_DataEntry_Tab.class, DataEntry_Tab);
}
/** Set Eingaberegister.
@param DataEntry_Tab_ID Eingaberegister */
@Override
public void setDataEntry_Tab_ID (int DataEntry_Tab_ID)
{
if (DataEntry_Tab_ID < 1)
set_ValueNoCheck (COLUMNNAME_DataEntry_Tab_ID, null);
else
set_ValueNoCheck (COLUMNNAME_DataEntry_Tab_ID, Integer.valueOf(DataEntry_Tab_ID));
}
/** Get Eingaberegister.
@return Eingaberegister */
@Override
public int getDataEntry_Tab_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_DataEntry_Tab_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Beschreibung.
@param Description Beschreibung */
@Override
public void setDescription (java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Beschreibung.
@return Beschreibung */
@Override
public java.lang.String getDescription ()
{
return (java.lang.String)get_Value(COLUMNNAME_Description); | }
/** Set Name.
@param Name Name */
@Override
public void setName (java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Name */
@Override
public java.lang.String getName ()
{
return (java.lang.String)get_Value(COLUMNNAME_Name);
}
/** Set Reihenfolge.
@param SeqNo
Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst
*/
@Override
public void setSeqNo (int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo));
}
/** Get Reihenfolge.
@return Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst
*/
@Override
public int getSeqNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Registername.
@param TabName Registername */
@Override
public void setTabName (java.lang.String TabName)
{
set_Value (COLUMNNAME_TabName, TabName);
}
/** Get Registername.
@return Registername */
@Override
public java.lang.String getTabName ()
{
return (java.lang.String)get_Value(COLUMNNAME_TabName);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\de\metas\dataentry\model\X_DataEntry_SubTab.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class PatientNoteMapping {
@SerializedName("_id")
private UUID _id = null;
@SerializedName("updatedAt")
private String updatedAt = null;
public PatientNoteMapping _id(UUID _id) {
this._id = _id;
return this;
}
/**
* Alberta-Id der Patientennotiz
* @return _id
**/
@Schema(example = "85186471-634d-43a1-bb33-c4d0bccc0c60", required = true, description = "Alberta-Id der Patientennotiz")
public UUID getId() {
return _id;
}
public void setId(UUID _id) {
this._id = _id;
}
public PatientNoteMapping updatedAt(String updatedAt) {
this.updatedAt = updatedAt;
return this;
}
/**
* Der Zeitstempel der letzten Änderung
* @return updatedAt
**/
@Schema(example = "2019-11-28T08:37:39.637Z", description = "Der Zeitstempel der letzten Änderung")
public String getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false; | }
PatientNoteMapping patientNoteMapping = (PatientNoteMapping) o;
return Objects.equals(this._id, patientNoteMapping._id) &&
Objects.equals(this.updatedAt, patientNoteMapping.updatedAt);
}
@Override
public int hashCode() {
return Objects.hash(_id, updatedAt);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class PatientNoteMapping {\n");
sb.append(" _id: ").append(toIndentedString(_id)).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-patient-api\src\main\java\io\swagger\client\model\PatientNoteMapping.java | 2 |
请完成以下Java代码 | public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
} | public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public String getWeight() {
return weight;
}
public void setWeight(String weight) {
this.weight = weight;
}
} | repos\tutorials-master\spring-web-modules\spring-thymeleaf-4\src\main\java\com\baeldung\thymeleaf\expression\Dino.java | 1 |
请完成以下Java代码 | public PrintWriter getLogWriter() throws ResourceException {
return logwriter;
}
public void setLogWriter(PrintWriter out) throws ResourceException {
logwriter = out;
}
public ResourceAdapter getResourceAdapter() {
return ra;
}
public void setResourceAdapter(ResourceAdapter ra) {
this.ra = ra;
}
@Override | public int hashCode() {
return 31;
}
@Override
public boolean equals(Object other) {
if (other == null)
return false;
if (other == this)
return true;
if (!(other instanceof JcaExecutorServiceManagedConnectionFactory))
return false;
return true;
}
} | repos\camunda-bpm-platform-master\javaee\jobexecutor-ra\src\main\java\org\camunda\bpm\container\impl\threading\ra\outbound\JcaExecutorServiceManagedConnectionFactory.java | 1 |
请完成以下Java代码 | public class CompositeOrderFastInputHandler implements IOrderFastInputHandler
{
private final CopyOnWriteArrayList<IOrderFastInputHandler> handlers = new CopyOnWriteArrayList<>();
/**
* This is the default handler. This composite handler give precedence to all other handlers that are explicitly added.
*/
private final IOrderFastInputHandler defaultHandler;
/**
* @param defaultHandler this handler will be invoked last
*/
public CompositeOrderFastInputHandler(@NonNull final IOrderFastInputHandler defaultHandler)
{
this.defaultHandler = defaultHandler;
}
public void addHandler(@NonNull final IOrderFastInputHandler handler)
{
if (handler.equals(defaultHandler))
{
return;
}
handlers.addIfAbsent(handler);
}
@Override
public void clearFields(final GridTab gridTab)
{
for (final IOrderFastInputHandler handler : handlers)
{
handler.clearFields(gridTab);
}
defaultHandler.clearFields(gridTab);
}
@Override
public boolean requestFocus(final GridTab gridTab)
{
for (final IOrderFastInputHandler handler : handlers)
{
final boolean requested = handler.requestFocus(gridTab); | if (requested)
{
return true;
}
}
return defaultHandler.requestFocus(gridTab);
}
@Override
public IGridTabRowBuilder createLineBuilderFromHeader(final Object model)
{
final CompositeGridTabRowBuilder builders = new CompositeGridTabRowBuilder();
for (final IOrderFastInputHandler handler : handlers)
{
final IGridTabRowBuilder builder = handler.createLineBuilderFromHeader(model);
builders.addGridTabRowBuilder(builder);
}
builders.addGridTabRowBuilder(defaultHandler.createLineBuilderFromHeader(model));
return builders;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\adempiere\callout\CompositeOrderFastInputHandler.java | 1 |
请完成以下Java代码 | public int execute()
{
if (executeDirectly)
{
return query.updateDirectly(this);
}
else
{
return query.update(this);
}
}
@Override
public ICompositeQueryUpdaterExecutor<T> setExecuteDirectly(final boolean executeDirectly)
{
this.executeDirectly = executeDirectly;
return this;
}
@Override
public ICompositeQueryUpdaterExecutor<T> addQueryUpdater(final @NonNull IQueryUpdater<T> updater)
{
super.addQueryUpdater(updater);
return this;
}
@Override | public ICompositeQueryUpdaterExecutor<T> addSetColumnValue(final String columnName, @Nullable final Object value)
{
super.addSetColumnValue(columnName, value);
return this;
}
@Override
public ICompositeQueryUpdaterExecutor<T> addSetColumnFromColumn(final String columnName, final ModelColumnNameValue<T> fromColumnName)
{
super.addSetColumnFromColumn(columnName, fromColumnName);
return this;
}
@Override
public ICompositeQueryUpdaterExecutor<T> addAddValueToColumn(final String columnName, final BigDecimal valueToAdd)
{
super.addAddValueToColumn(columnName, valueToAdd);
return this;
}
@Override
public ICompositeQueryUpdaterExecutor<T> addAddValueToColumn(final String columnName, final BigDecimal valueToAdd, final IQueryFilter<T> onlyWhenFilter)
{
super.addAddValueToColumn(columnName, valueToAdd, onlyWhenFilter);
return this;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\dao\impl\CompositeQueryUpdaterExecutor.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class Address
{
@NonNull String companyName1;
@Nullable String companyName2;
@Nullable String companyDepartment;
@Nullable String street1;
@Nullable String street2;
@Nullable String houseNo;
@NonNull CountryCode country;
@NonNull String zipCode;
@NonNull String city;
//
// External partner
// (partner location id was removed in f429b78d5b0102037ba119347cc3de723756df17)
/**
* Only used for logging in {@link de.metas.shipper.gateway.commons.async.DeliveryOrderWorkpackageProcessor#printLabel} and nothing more.
*/
@SuppressWarnings("JavadocReference")
int bpartnerId;
@Builder
@Jacksonized
private Address(
@NonNull final String companyName1,
@Nullable final String companyName2,
@Nullable final String companyDepartment,
@Nullable final String street1,
@Nullable final String street2,
@Nullable final String houseNo,
@NonNull final CountryCode country, | @NonNull final String zipCode,
@NonNull final String city,
//
final int bpartnerId)
{
Check.assumeNotEmpty(companyName1, "companyName1 is not empty");
Check.assumeNotEmpty(street1, "street1 is not empty");
Check.assumeNotNull(country, "Parameter country is not null");
Check.assumeNotEmpty(zipCode, "zipCode is not empty");
Check.assumeNotEmpty(city, "city is not empty");
this.companyName1 = companyName1;
this.companyName2 = companyName2;
this.companyDepartment = companyDepartment;
this.street1 = street1;
this.street2 = street2;
this.houseNo = houseNo;
this.country = country;
this.zipCode = zipCode;
this.city = city;
this.bpartnerId = bpartnerId;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.spi\src\main\java\de\metas\shipper\gateway\spi\model\Address.java | 2 |
请完成以下Java代码 | public void setTaxID (final @Nullable java.lang.String TaxID)
{
set_Value (COLUMNNAME_TaxID, TaxID);
}
@Override
public java.lang.String getTaxID()
{
return get_ValueAsString(COLUMNNAME_TaxID);
}
@Override
public org.compiere.model.I_C_Country getTo_Country()
{
return get_ValueAsPO(COLUMNNAME_To_Country_ID, org.compiere.model.I_C_Country.class);
}
@Override
public void setTo_Country(final org.compiere.model.I_C_Country To_Country)
{
set_ValueFromPO(COLUMNNAME_To_Country_ID, org.compiere.model.I_C_Country.class, To_Country);
}
@Override
public void setTo_Country_ID (final int To_Country_ID)
{
if (To_Country_ID < 1)
set_Value (COLUMNNAME_To_Country_ID, null);
else
set_Value (COLUMNNAME_To_Country_ID, To_Country_ID);
}
@Override
public int getTo_Country_ID()
{
return get_ValueAsInt(COLUMNNAME_To_Country_ID);
}
@Override
public void setValidFrom (final java.sql.Timestamp ValidFrom)
{
set_Value (COLUMNNAME_ValidFrom, ValidFrom);
}
@Override
public java.sql.Timestamp getValidFrom()
{
return get_ValueAsTimestamp(COLUMNNAME_ValidFrom);
}
@Override | public void setValidTo (final @Nullable java.sql.Timestamp ValidTo)
{
set_Value (COLUMNNAME_ValidTo, ValidTo);
}
@Override
public java.sql.Timestamp getValidTo()
{
return get_ValueAsTimestamp(COLUMNNAME_ValidTo);
}
@Override
public void setVATaxID (final java.lang.String VATaxID)
{
set_Value (COLUMNNAME_VATaxID, VATaxID);
}
@Override
public java.lang.String getVATaxID()
{
return get_ValueAsString(COLUMNNAME_VATaxID);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Fiscal_Representation.java | 1 |
请完成以下Java代码 | public boolean isInternal()
{
final ProcessPreconditionsResolution preconditionsResolution = getPreconditionsResolution();
return preconditionsResolution.isInternal();
}
public String getDisabledReason(final String adLanguage)
{
return getPreconditionsResolution().getRejectReason().translate(adLanguage);
}
public Map<String, Object> getDebugProperties()
{
final ImmutableMap.Builder<String, Object> debugProperties = ImmutableMap.builder();
if (debugProcessClassname != null)
{
debugProperties.put("debug-classname", debugProcessClassname);
}
return debugProperties.build();
}
public boolean isDisplayedOn(@NonNull final DisplayPlace displayPlace)
{
return getDisplayPlaces().contains(displayPlace);
} | @Value
private static class ValueAndDuration<T>
{
public static <T> ValueAndDuration<T> fromSupplier(final Supplier<T> supplier)
{
final Stopwatch stopwatch = Stopwatch.createStarted();
final T value = supplier.get();
final Duration duration = Duration.ofNanos(stopwatch.stop().elapsed(TimeUnit.NANOSECONDS));
return new ValueAndDuration<>(value, duration);
}
T value;
Duration duration;
private ValueAndDuration(final T value, final Duration duration)
{
this.value = value;
this.duration = duration;
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\process\descriptor\WebuiRelatedProcessDescriptor.java | 1 |
请完成以下Java代码 | public boolean supportsParameter(MethodParameter parameter) {
return (parameter.getParameterAnnotation(Argument.class) != null ||
parameter.getParameterType() == ArgumentValue.class);
}
@Override
public @Nullable Object resolveArgument(MethodParameter parameter, DataFetchingEnvironment environment) throws Exception {
String name = getArgumentName(parameter);
ResolvableType targetType = ResolvableType.forMethodParameter(parameter);
return doBind(environment, name, targetType);
}
/**
* Perform the binding with the configured {@link #getArgumentBinder() binder}.
* @param environment for access to the arguments
* @param name the name of an argument, or {@code null} to use the full map
* @param targetType the type of Object to create
* @since 1.3.0
*/
protected @Nullable Object doBind(
DataFetchingEnvironment environment, String name, ResolvableType targetType) throws BindException {
return this.argumentBinder.bind(environment, name, targetType);
}
static String getArgumentName(MethodParameter parameter) {
Argument argument = parameter.getParameterAnnotation(Argument.class);
if (argument != null) { | if (StringUtils.hasText(argument.name())) {
return argument.name();
}
}
else if (parameter.getParameterType() != ArgumentValue.class) {
throw new IllegalStateException(
"Expected either @Argument or a method parameter of type ArgumentValue");
}
String parameterName = parameter.getParameterName();
if (parameterName != null) {
return parameterName;
}
throw new IllegalArgumentException(
"Name for argument of type [" + parameter.getNestedParameterType().getName() +
"] not specified, and parameter name information not found in class file either.");
}
} | repos\spring-graphql-main\spring-graphql\src\main\java\org\springframework\graphql\data\method\annotation\support\ArgumentMethodArgumentResolver.java | 1 |
请完成以下Java代码 | public String getTenantChannel() {
return tenantChannel;
}
public void setTenantChannel(String tenantChannel) {
this.tenantChannel = tenantChannel;
}
public int getNumberOfIndividuals() {
return numberOfIndividuals;
}
public void setNumberOfIndividuals(int numberOfIndividuals) {
this.numberOfIndividuals = numberOfIndividuals;
}
public int getNumberOfPacks() {
return numberOfPacks;
}
public void setNumberOfPacks(int numberOfPacks) {
this.numberOfPacks = numberOfPacks;
}
public int getItemsPerPack() { | return itemsPerPack;
}
public void setItemsPerPack(int itemsPerPack) {
this.itemsPerPack = itemsPerPack;
}
public String getClientUuid() {
return clientUuid;
}
public void setClientUuid(String clientUuid) {
this.clientUuid = clientUuid;
}
} | repos\tutorials-master\spring-boot-modules\spring-boot-validation\src\main\java\com\baeldung\customstatefulvalidation\model\PurchaseOrderItem.java | 1 |
请完成以下Java代码 | protected boolean isAsync(ActivityImpl activity) {
return activity.isAsyncBefore() || activity.isAsyncAfter();
}
protected void parseActivity(Element element, ActivityImpl activity) {
if (isMultiInstance(activity)) {
// in case of multi-instance, the extension elements is set according to the async attributes
// the extension for multi-instance body is set on the element of the activity
ActivityImpl miBody = activity.getParentFlowScopeActivity();
if (isAsync(miBody)) {
setFailedJobRetryTimeCycleValue(element, miBody);
}
// the extension for inner activity is set on the multiInstanceLoopCharacteristics element
if (isAsync(activity)) {
Element multiInstanceLoopCharacteristics = element.element(MULTI_INSTANCE_LOOP_CHARACTERISTICS);
setFailedJobRetryTimeCycleValue(multiInstanceLoopCharacteristics, activity);
}
} else if (isAsync(activity)) {
setFailedJobRetryTimeCycleValue(element, activity);
}
}
protected void setFailedJobRetryTimeCycleValue(Element element, ActivityImpl activity) {
String failedJobRetryTimeCycleConfiguration = null;
Element extensionElements = element.element(EXTENSION_ELEMENTS);
if (extensionElements != null) {
Element failedJobRetryTimeCycleElement = extensionElements.elementNS(FOX_ENGINE_NS, FAILED_JOB_RETRY_TIME_CYCLE); | if (failedJobRetryTimeCycleElement == null) {
// try to get it from the activiti namespace
failedJobRetryTimeCycleElement = extensionElements.elementNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, FAILED_JOB_RETRY_TIME_CYCLE);
}
if (failedJobRetryTimeCycleElement != null) {
failedJobRetryTimeCycleConfiguration = failedJobRetryTimeCycleElement.getText();
}
}
if (failedJobRetryTimeCycleConfiguration == null || failedJobRetryTimeCycleConfiguration.isEmpty()) {
failedJobRetryTimeCycleConfiguration = Context.getProcessEngineConfiguration().getFailedJobRetryTimeCycle();
}
if (failedJobRetryTimeCycleConfiguration != null) {
FailedJobRetryConfiguration configuration = ParseUtil.parseRetryIntervals(failedJobRetryTimeCycleConfiguration);
activity.getProperties().set(FAILED_JOB_CONFIGURATION, configuration);
}
}
protected boolean isMultiInstance(ActivityImpl activity) {
// #isMultiInstance() don't work since the property is not set yet
ActivityImpl parent = activity.getParentFlowScopeActivity();
return parent != null && parent.getActivityBehavior() instanceof MultiInstanceActivityBehavior;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\bpmn\parser\DefaultFailedJobParseListener.java | 1 |
请完成以下Java代码 | public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
/**
* @return the start index of this page (ie the index of the first element in the page)
*/
public long getFirstResult() {
return firstResult;
}
public void setFirstResult(long firstResult) {
this.firstResult = firstResult;
}
public void setRows(List<Map<String, Object>> rowData) {
this.rowData = rowData;
}
/**
* @return the actual table content.
*/
public List<Map<String, Object>> getRows() {
return rowData;
}
public void setTotal(long total) {
this.total = total;
} | /**
* @return the total rowcount of the table from which this page is only a subset.
*/
public long getTotal() {
return total;
}
/**
* @return the actual number of rows in this page.
*/
public long getSize() {
return rowData.size();
}
} | repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\management\TablePage.java | 1 |
请完成以下Java代码 | public class DifferentSourceSplitting {
private static final List<Integer> arrayListOfNumbers = new ArrayList<>();
private static final List<Integer> linkedListOfNumbers = new LinkedList<>();
static {
IntStream.rangeClosed(1, 1_000_000).forEach(i -> {
arrayListOfNumbers.add(i);
linkedListOfNumbers.add(i);
});
}
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public static void differentSourceArrayListSequential() {
arrayListOfNumbers.stream().reduce(0, Integer::sum);
}
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS) | public static void differentSourceArrayListParallel() {
arrayListOfNumbers.parallelStream().reduce(0, Integer::sum);
}
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public static void differentSourceLinkedListSequential() {
linkedListOfNumbers.stream().reduce(0, Integer::sum);
}
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public static void differentSourceLinkedListParallel() {
linkedListOfNumbers.parallelStream().reduce(0, Integer::sum);
}
} | repos\tutorials-master\core-java-modules\core-java-streams-7\src\main\java\com\baeldung\streams\parallel\DifferentSourceSplitting.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class OrderProduct {
@EmbeddedId
@JsonIgnore
private OrderProductPK pk;
@Column(nullable = false) private Integer quantity;
public OrderProduct() {
super();
}
public OrderProduct(Order order, Product product, Integer quantity) {
pk = new OrderProductPK();
pk.setOrder(order);
pk.setProduct(product);
this.quantity = quantity;
}
@Transient
public Product getProduct() {
return this.pk.getProduct();
}
@Transient
public Double getTotalPrice() {
return getProduct().getPrice() * getQuantity();
}
public OrderProductPK getPk() {
return pk;
}
public void setPk(OrderProductPK pk) {
this.pk = pk;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((pk == null) ? 0 : pk.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;
}
OrderProduct other = (OrderProduct) obj;
if (pk == null) {
if (other.pk != null) {
return false;
}
} else if (!pk.equals(other.pk)) {
return false;
}
return true;
}
} | repos\tutorials-master\spring-boot-modules\spring-boot-angular\src\main\java\com\baeldung\ecommerce\model\OrderProduct.java | 2 |
请完成以下Java代码 | private void addSQLWhere(StringBuffer sql, int index, String value)
{
if (!(value.isEmpty() || value.equals("%")) && index < filterByColumns.size())
{
// Angelo Dabala' (genied) nectosoft: [2893220] avoid to append string parameters directly because of special chars like quote(s)
sql.append(" AND UPPER(").append(filterByColumns.get(index).getColumnSql()).append(") LIKE ?");
}
} // addSQLWhere
/**
* Get SQL WHERE parameter
*
* @param f field
* @return sql part
*/
private static String getSQLText(CTextField f)
{
String s = f.getText().toUpperCase();
if (!s.contains("%"))
{
if (!s.endsWith("%"))
{
s += "%";
}
if (!s.startsWith("%"))
{
s = "%" + s;
}
}
return s;
} // getSQLText
/**
* Set Parameters for Query.
* (as defined in getSQLWhere)
*
* @param pstmt statement
* @param forCount for counting records
*/
@Override | protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException
{
int index = 1;
if (!textField1.getText().isEmpty())
pstmt.setString(index++, getSQLText(textField1));
if (!textField2.getText().isEmpty())
pstmt.setString(index++, getSQLText(textField2));
if (!textField3.getText().isEmpty())
pstmt.setString(index++, getSQLText(textField3));
if (!textField4.getText().isEmpty())
pstmt.setString(index++, getSQLText(textField4));
} // setParameters
//
//
//
@Value
@Builder
private static class FilterByColumn
{
@NotNull String columnName;
@NotNull String columnSql;
}
} // InfoGeneral | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\apps\search\InfoGeneral.java | 1 |
请完成以下Java代码 | public BigDecimal getAmt()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Amt);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setC_Currency_ID (final int C_Currency_ID)
{
if (C_Currency_ID < 1)
set_Value (COLUMNNAME_C_Currency_ID, null);
else
set_Value (COLUMNNAME_C_Currency_ID, C_Currency_ID);
}
@Override
public int getC_Currency_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Currency_ID);
}
@Override
public void setDescription (final @Nullable String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
@Override
public String getDescription()
{
return get_ValueAsString(COLUMNNAME_Description);
}
@Override
public void setRecord_ID (final int Record_ID)
{
if (Record_ID < 0)
set_ValueNoCheck (COLUMNNAME_Record_ID, null);
else
set_ValueNoCheck (COLUMNNAME_Record_ID, Record_ID);
}
@Override
public int getRecord_ID()
{
return get_ValueAsInt(COLUMNNAME_Record_ID);
}
@Override
public void setSEPA_Export_ID (final int SEPA_Export_ID)
{
if (SEPA_Export_ID < 1)
set_ValueNoCheck (COLUMNNAME_SEPA_Export_ID, null);
else
set_ValueNoCheck (COLUMNNAME_SEPA_Export_ID, SEPA_Export_ID);
}
@Override
public int getSEPA_Export_ID()
{
return get_ValueAsInt(COLUMNNAME_SEPA_Export_ID);
}
@Override
public void setSEPA_Export_Line_ID (final int SEPA_Export_Line_ID)
{
if (SEPA_Export_Line_ID < 1)
set_ValueNoCheck (COLUMNNAME_SEPA_Export_Line_ID, null);
else
set_ValueNoCheck (COLUMNNAME_SEPA_Export_Line_ID, SEPA_Export_Line_ID);
} | @Override
public int getSEPA_Export_Line_ID()
{
return get_ValueAsInt(COLUMNNAME_SEPA_Export_Line_ID);
}
@Override
public void setSEPA_Export_Line_Ref_ID (final int SEPA_Export_Line_Ref_ID)
{
if (SEPA_Export_Line_Ref_ID < 1)
set_ValueNoCheck (COLUMNNAME_SEPA_Export_Line_Ref_ID, null);
else
set_ValueNoCheck (COLUMNNAME_SEPA_Export_Line_Ref_ID, SEPA_Export_Line_Ref_ID);
}
@Override
public int getSEPA_Export_Line_Ref_ID()
{
return get_ValueAsInt(COLUMNNAME_SEPA_Export_Line_Ref_ID);
}
@Override
public void setStructuredRemittanceInfo (final @Nullable String StructuredRemittanceInfo)
{
set_Value (COLUMNNAME_StructuredRemittanceInfo, StructuredRemittanceInfo);
}
@Override
public String getStructuredRemittanceInfo()
{
return get_ValueAsString(COLUMNNAME_StructuredRemittanceInfo);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.payment.sepa\base\src\main\java-gen\de\metas\payment\sepa\model\X_SEPA_Export_Line_Ref.java | 1 |
请完成以下Java代码 | private static AdempiereException appendHowtoDisableMessage(
@NonNull final Exception e,
@NonNull final Pointcut pointcut)
{
final String parameterName = "HowtoDisableModelInterceptor";
final AdempiereException ae = AdempiereException.wrapIfNeeded(e);
if (!ae.hasParameter(parameterName))
{
final String howtoDisableMsg = AnnotatedModelInterceptorDisabler.createHowtoDisableMessage(pointcut);
ae.setParameter(parameterName, howtoDisableMsg);
}
return ae;
}
private void executeNow0(
@NonNull final Object model,
@NonNull final Pointcut pointcut,
final int timing) throws IllegalAccessException, InvocationTargetException
{
final Method method = pointcut.getMethod();
// Make sure the method is accessible
if (!method.isAccessible())
{
method.setAccessible(true);
} | final Stopwatch stopwatch = Stopwatch.createStarted();
if (pointcut.isMethodRequiresTiming())
{
final Object timingParam = pointcut.convertToMethodTimingParameterType(timing);
method.invoke(annotatedObject, model, timingParam);
}
else
{
method.invoke(annotatedObject, model);
}
logger.trace("Executed in {}: {} (timing={}) on {}", stopwatch, pointcut, timing, model);
}
/**
* @return true if timing is change (before, after)
*/
private static boolean isTimingChange(final int timing)
{
return ModelValidator.TYPE_BEFORE_CHANGE == timing
|| ModelValidator.TYPE_AFTER_CHANGE == timing
|| ModelValidator.TYPE_AFTER_CHANGE_REPLICATION == timing;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\modelvalidator\AnnotatedModelInterceptor.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class SyntaxIdentifierType {
@XmlElement(required = true)
protected String id;
@XmlElement(required = true)
protected String versionNum;
protected String serviceCodeListDirVersion;
protected String codedCharacterEncoding;
protected String releaseNum;
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
/**
* Gets the value of the versionNum property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVersionNum() {
return versionNum;
}
/**
* Sets the value of the versionNum property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVersionNum(String value) {
this.versionNum = value;
}
/**
* Gets the value of the serviceCodeListDirVersion property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getServiceCodeListDirVersion() {
return serviceCodeListDirVersion;
}
/**
* Sets the value of the serviceCodeListDirVersion property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setServiceCodeListDirVersion(String value) {
this.serviceCodeListDirVersion = value;
}
/**
* Gets the value of the codedCharacterEncoding property.
*
* @return | * possible object is
* {@link String }
*
*/
public String getCodedCharacterEncoding() {
return codedCharacterEncoding;
}
/**
* Sets the value of the codedCharacterEncoding property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCodedCharacterEncoding(String value) {
this.codedCharacterEncoding = value;
}
/**
* Gets the value of the releaseNum property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getReleaseNum() {
return releaseNum;
}
/**
* Sets the value of the releaseNum property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setReleaseNum(String value) {
this.releaseNum = value;
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\messaging\header\SyntaxIdentifierType.java | 2 |
请完成以下Java代码 | public Collection<String> getCc() {
return cc;
}
public void setCc(Collection<String> cc) {
this.cc = cc;
}
public Collection<String> getBcc() {
return bcc;
}
public void setBcc(Collection<String> bcc) {
this.bcc = bcc;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getPlainContent() {
return plainContent;
}
public void setPlainContent(String plainContent) {
this.plainContent = plainContent;
}
public String getHtmlContent() {
return htmlContent;
}
public void setHtmlContent(String htmlContent) {
this.htmlContent = htmlContent;
}
public Charset getCharset() {
return charset;
}
public void setCharset(Charset charset) {
this.charset = charset;
}
public Collection<DataSource> getAttachments() {
return attachments;
} | public void setAttachments(Collection<DataSource> attachments) {
this.attachments = attachments;
}
public void addAttachment(DataSource attachment) {
if (attachments == null) {
attachments = new ArrayList<>();
}
attachments.add(attachment);
}
public Map<String, String> getHeaders() {
return headers;
}
public void setHeaders(Map<String, String> headers) {
this.headers = headers;
}
public void addHeader(String name, String value) {
if (headers == null) {
headers = new LinkedHashMap<>();
}
headers.put(name, value);
}
} | repos\flowable-engine-main\modules\flowable-mail\src\main\java\org\flowable\mail\common\api\MailMessage.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class BookstoreService {
private final AuthorRepository authorRepository;
private final BookRepository bookRepository;
public BookstoreService(AuthorRepository authorRepository, BookRepository bookRepository) {
this.authorRepository = authorRepository;
this.bookRepository = bookRepository;
}
// first query/request
public Author fetchAuthor(long id) {
return authorRepository.findById(id).orElseThrow();
}
// second query/request
@Transactional(readOnly = true)
public List<Book> fetchBooksOfAuthorBad(Author a) {
Author author = fetchAuthor(a.getId());
List<Book> books = author.getBooks();
Hibernate.initialize(books);
// books.size();
return books;
}
// second query/request
public List<Book> fetchBooksOfAuthorGood(Author a) {
// Explicit JPQL
// return bookRepository.fetchByAuthor(a);
// Query Builder
return bookRepository.findByAuthor(a);
}
// first query/request | public Book fetchBook(long id) {
return bookRepository.findById(id).orElseThrow();
}
// second query/request
@Transactional(readOnly = true)
public Author fetchAuthorOfBookBad(Book b) {
Book book = fetchBook(b.getId());
Author author = book.getAuthor();
Hibernate.initialize(author);
return author;
}
// second query/request
public Author fetchAuthorOfBookGood(Book b) {
// Explicit JPQL
// return authorRepository.fetchByBooks(b);
// Query Builder
return authorRepository.findByBooks(b);
}
} | repos\Hibernate-SpringBoot-master\HibernateSpringBootParentChildSeparateQueries\src\main\java\com\bookstore\service\BookstoreService.java | 2 |
请完成以下Java代码 | public class TaxiRide {
private Boolean isNightSurcharge;
private Long distanceInMile;
public TaxiRide() {
}
public TaxiRide(Boolean isNightSurcharge, Long distanceInMile) {
this.isNightSurcharge = isNightSurcharge;
this.distanceInMile = distanceInMile;
}
public Boolean getIsNightSurcharge() { | return isNightSurcharge;
}
public void setIsNightSurcharge(Boolean isNightSurcharge) {
this.isNightSurcharge = isNightSurcharge;
}
public Long getDistanceInMile() {
return distanceInMile;
}
public void setDistanceInMile(Long distanceInMile) {
this.distanceInMile = distanceInMile;
}
} | repos\tutorials-master\spring-boot-modules\spring-boot-runtime\src\main\java\com\baeldung\web\log\data\TaxiRide.java | 1 |
请完成以下Java代码 | public static MoveToAvailablePlanItemDefinitionMapping createMoveToAvailablePlanItemDefinitionMappingFor(String planItemDefinitionId) {
return new MoveToAvailablePlanItemDefinitionMapping(planItemDefinitionId);
}
public static MoveToAvailablePlanItemDefinitionMapping createMoveToAvailablePlanItemDefinitionMappingFor(String planItemDefinitionId, String condition) {
return new MoveToAvailablePlanItemDefinitionMapping(planItemDefinitionId, condition);
}
public static MoveToAvailablePlanItemDefinitionMapping createMoveToAvailablePlanItemDefinitionMappingFor(
String planItemDefinitionId, Map<String, Object> withLocalVariables) {
return new MoveToAvailablePlanItemDefinitionMapping(planItemDefinitionId, withLocalVariables);
}
public static WaitingForRepetitionPlanItemDefinitionMapping createWaitingForRepetitionPlanItemDefinitionMappingFor(String planItemDefinitionId) { | return new WaitingForRepetitionPlanItemDefinitionMapping(planItemDefinitionId);
}
public static WaitingForRepetitionPlanItemDefinitionMapping createWaitingForRepetitionPlanItemDefinitionMappingFor(String planItemDefinitionId, String condition) {
return new WaitingForRepetitionPlanItemDefinitionMapping(planItemDefinitionId, condition);
}
public static RemoveWaitingForRepetitionPlanItemDefinitionMapping createRemoveWaitingForRepetitionPlanItemDefinitionMappingFor(String planItemDefinitionId) {
return new RemoveWaitingForRepetitionPlanItemDefinitionMapping(planItemDefinitionId);
}
public static RemoveWaitingForRepetitionPlanItemDefinitionMapping createRemoveWaitingForRepetitionPlanItemDefinitionMappingFor(String planItemDefinitionId, String condition) {
return new RemoveWaitingForRepetitionPlanItemDefinitionMapping(planItemDefinitionId, condition);
}
} | repos\flowable-engine-main\modules\flowable-cmmn-api\src\main\java\org\flowable\cmmn\api\migration\PlanItemDefinitionMappingBuilder.java | 1 |
请完成以下Java代码 | public Mono<Void> deleteComment(String commentId, String slug, User user) {
return articleRepository.findBySlugOrFail(slug)
.flatMap(article -> article.getCommentById(commentId)
.map(comment -> deleteComment(article, comment, user))
.orElse(Mono.empty())
);
}
public Mono<MultipleCommentsView> getComments(String slug, Optional<User> user) {
return articleRepository.findBySlug(slug)
.zipWhen(article -> userRepository.findById(article.getAuthorId()))
.map(tuple -> {
var article = tuple.getT1();
var author = tuple.getT2();
return getComments(user, article, author);
});
}
private Mono<Void> deleteComment(Article article, Comment comment, User user) {
if (!comment.isAuthor(user)) {
return Mono.error(new InvalidRequestException("Comment", "only author can delete comment"));
}
article.deleteComment(comment);
return articleRepository.save(article).then();
}
private Mono<CommentView> addComment(CreateCommentRequest request, User currentUser, Article article) {
var comment = request.toComment(UUID.randomUUID().toString(), currentUser.getId()); | article.addComment(comment);
var profileView = CommentView.toCommentView(comment, ProfileView.toOwnProfile(currentUser));
return articleRepository.save(article).thenReturn(profileView);
}
private MultipleCommentsView getComments(Optional<User> user, Article article, User author) {
var comments = article.getComments();
var authorProfile = user
.map(viewer -> toProfileViewForViewer(author, viewer))
.orElse(toUnfollowedProfileView(author));
var commentViews = comments.stream()
.map(comment -> CommentView.toCommentView(comment, authorProfile))
.toList();
return MultipleCommentsView.of(commentViews);
}
} | repos\realworld-spring-webflux-master\src\main\java\com\realworld\springmongo\article\CommentService.java | 1 |
请完成以下Java代码 | public void setPlannedPrice (final BigDecimal PlannedPrice)
{
set_Value (COLUMNNAME_PlannedPrice, PlannedPrice);
}
@Override
public BigDecimal getPlannedPrice()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PlannedPrice);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setPlannedQty (final BigDecimal PlannedQty)
{
set_Value (COLUMNNAME_PlannedQty, PlannedQty);
}
@Override
public BigDecimal getPlannedQty() | {
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PlannedQty);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setProcessed (final boolean Processed)
{
set_Value (COLUMNNAME_Processed, Processed);
}
@Override
public boolean isProcessed()
{
return get_ValueAsBoolean(COLUMNNAME_Processed);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_ProjectLine.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class ObservationProperties {
private final Http http = new Http();
/**
* Common key-values that are applied to every observation.
*/
private Map<String, String> keyValues = new LinkedHashMap<>();
/**
* Whether observations starting with the specified name should be enabled. The
* longest match wins, the key 'all' can also be used to configure all observations.
*/
private Map<String, Boolean> enable = new LinkedHashMap<>();
public Map<String, Boolean> getEnable() {
return this.enable;
}
public void setEnable(Map<String, Boolean> enable) {
this.enable = enable;
}
public Http getHttp() {
return this.http;
}
public Map<String, String> getKeyValues() {
return this.keyValues;
}
public void setKeyValues(Map<String, String> keyValues) {
this.keyValues = keyValues;
}
public static class Http {
private final Client client = new Client();
private final Server server = new Server();
public Client getClient() {
return this.client;
}
public Server getServer() {
return this.server;
}
public static class Client {
private final ClientRequests requests = new ClientRequests();
public ClientRequests getRequests() {
return this.requests;
}
public static class ClientRequests {
/**
* Name of the observation for client requests.
*/
private String name = "http.client.requests";
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
} | }
public static class Server {
private final ServerRequests requests = new ServerRequests();
public ServerRequests getRequests() {
return this.requests;
}
public static class ServerRequests {
/**
* Name of the observation for server requests.
*/
private String name = "http.server.requests";
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
}
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-micrometer-observation\src\main\java\org\springframework\boot\micrometer\observation\autoconfigure\ObservationProperties.java | 2 |
请完成以下Java代码 | public int getMSV3_Menge ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_MSV3_Menge);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Tourabweichung.
@param MSV3_Tourabweichung Tourabweichung */
@Override
public void setMSV3_Tourabweichung (boolean MSV3_Tourabweichung)
{
set_Value (COLUMNNAME_MSV3_Tourabweichung, Boolean.valueOf(MSV3_Tourabweichung));
}
/** Get Tourabweichung.
@return Tourabweichung */
@Override
public boolean isMSV3_Tourabweichung ()
{
Object oo = get_Value(COLUMNNAME_MSV3_Tourabweichung);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/**
* MSV3_Typ AD_Reference_ID=540823
* Reference name: MSV3_BestellungRueckmeldungTyp
*/
public static final int MSV3_TYP_AD_Reference_ID=540823;
/** Normal = Normal */
public static final String MSV3_TYP_Normal = "Normal"; | /** Verbund = Verbund */
public static final String MSV3_TYP_Verbund = "Verbund";
/** Nachlieferung = Nachlieferung */
public static final String MSV3_TYP_Nachlieferung = "Nachlieferung";
/** Dispo = Dispo */
public static final String MSV3_TYP_Dispo = "Dispo";
/** KeineLieferungAberNormalMoeglich = KeineLieferungAberNormalMoeglich */
public static final String MSV3_TYP_KeineLieferungAberNormalMoeglich = "KeineLieferungAberNormalMoeglich";
/** KeineLieferungAberVerbundMoeglich = KeineLieferungAberVerbundMoeglich */
public static final String MSV3_TYP_KeineLieferungAberVerbundMoeglich = "KeineLieferungAberVerbundMoeglich";
/** KeineLieferungAberNachlieferungMoeglich = KeineLieferungAberNachlieferungMoeglich */
public static final String MSV3_TYP_KeineLieferungAberNachlieferungMoeglich = "KeineLieferungAberNachlieferungMoeglich";
/** KeineLieferungAberDispoMoeglich = KeineLieferungAberDispoMoeglich */
public static final String MSV3_TYP_KeineLieferungAberDispoMoeglich = "KeineLieferungAberDispoMoeglich";
/** NichtLieferbar = NichtLieferbar */
public static final String MSV3_TYP_NichtLieferbar = "NichtLieferbar";
/** Set Typ.
@param MSV3_Typ Typ */
@Override
public void setMSV3_Typ (java.lang.String MSV3_Typ)
{
set_Value (COLUMNNAME_MSV3_Typ, MSV3_Typ);
}
/** Get Typ.
@return Typ */
@Override
public java.lang.String getMSV3_Typ ()
{
return (java.lang.String)get_Value(COLUMNNAME_MSV3_Typ);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.vendor.gateway.msv3\src\main\java-gen\de\metas\vertical\pharma\vendor\gateway\msv3\model\X_MSV3_BestellungAnteil.java | 1 |
请完成以下Java代码 | public de.metas.vertical.pharma.securpharm.model.I_M_Securpharm_Productdata_Result getM_Securpharm_Productdata_Result()
{
return get_ValueAsPO(COLUMNNAME_M_Securpharm_Productdata_Result_ID, de.metas.vertical.pharma.securpharm.model.I_M_Securpharm_Productdata_Result.class);
}
@Override
public void setM_Securpharm_Productdata_Result(de.metas.vertical.pharma.securpharm.model.I_M_Securpharm_Productdata_Result M_Securpharm_Productdata_Result)
{
set_ValueFromPO(COLUMNNAME_M_Securpharm_Productdata_Result_ID, de.metas.vertical.pharma.securpharm.model.I_M_Securpharm_Productdata_Result.class, M_Securpharm_Productdata_Result);
}
/** Set Securpharm Produktdaten Ergebnise.
@param M_Securpharm_Productdata_Result_ID Securpharm Produktdaten Ergebnise */
@Override
public void setM_Securpharm_Productdata_Result_ID (int M_Securpharm_Productdata_Result_ID)
{
if (M_Securpharm_Productdata_Result_ID < 1)
set_Value (COLUMNNAME_M_Securpharm_Productdata_Result_ID, null);
else
set_Value (COLUMNNAME_M_Securpharm_Productdata_Result_ID, Integer.valueOf(M_Securpharm_Productdata_Result_ID));
}
/** Get Securpharm Produktdaten Ergebnise.
@return Securpharm Produktdaten Ergebnise */
@Override
public int getM_Securpharm_Productdata_Result_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Securpharm_Productdata_Result_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set TransaktionsID Server. | @param TransactionIDServer TransaktionsID Server */
@Override
public void setTransactionIDServer (java.lang.String TransactionIDServer)
{
set_Value (COLUMNNAME_TransactionIDServer, TransactionIDServer);
}
/** Get TransaktionsID Server.
@return TransaktionsID Server */
@Override
public java.lang.String getTransactionIDServer ()
{
return (java.lang.String)get_Value(COLUMNNAME_TransactionIDServer);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.securpharm\src\main\java-gen\de\metas\vertical\pharma\securpharm\model\X_M_Securpharm_Action_Result.java | 1 |
请完成以下Java代码 | public int getBill_User_ID()
{
return delegate.getBill_User_ID();
}
@Override
public void setBill_User_ID(final int Bill_User_ID)
{
delegate.setBill_User_ID(Bill_User_ID);
}
@Override
public void setRenderedAddressAndCapturedLocation(final @NonNull RenderedAddressAndCapturedLocation from)
{
IDocumentBillLocationAdapter.super.setRenderedAddressAndCapturedLocation(from);
}
@Override
public void setRenderedAddress(final @NonNull RenderedAddressAndCapturedLocation from)
{
IDocumentBillLocationAdapter.super.setRenderedAddress(from);
}
public void setFrom(@NonNull final I_C_Invoice_Candidate from)
{
setFrom(new BillLocationAdapter(from).toDocumentLocation());
} | public void setFrom(@NonNull final I_C_Order order)
{
setFrom(OrderDocumentLocationAdapterFactory.billLocationAdapter(order).toDocumentLocation());
}
@Override
public I_C_Invoice_Candidate getWrappedRecord()
{
return delegate;
}
@Override
public Optional<DocumentLocation> toPlainDocumentLocation(final IDocumentLocationBL documentLocationBL)
{
return documentLocationBL.toPlainDocumentLocation(this);
}
@Override
public BillLocationAdapter toOldValues()
{
InterfaceWrapperHelper.assertNotOldValues(delegate);
return new BillLocationAdapter(InterfaceWrapperHelper.createOld(delegate, I_C_Invoice_Candidate.class));
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\location\adapter\BillLocationAdapter.java | 1 |
请完成以下Java代码 | public void windowClosing(WindowEvent e) {
m_isCancel = true;
}
});
} // jbInit
/**
* Action Listener
* @param e evant
*/
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == bShowDay)
m_days = 1;
else if (e.getSource() == bShowWeek)
m_days = 7;
else if (e.getSource() == bShowMonth)
m_days = 31;
else if (e.getSource() == bShowYear)
m_days = 365;
else
m_days = 0; // all
dispose();
} // actionPerformed | /**
* Get selected number of days
* @return days or -1 for all
*/
public int getCurrentDays()
{
return m_days;
} // getCurrentDays
/**
* @return true if user has canceled this form
*/
public boolean isCancel() {
return m_isCancel;
}
} // VOnlyCurrentDays | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\grid\VOnlyCurrentDays.java | 1 |
请完成以下Java代码 | public void setIsSOTrx (final boolean IsSOTrx)
{
set_Value (COLUMNNAME_IsSOTrx, IsSOTrx);
}
@Override
public boolean isSOTrx()
{
return get_ValueAsBoolean(COLUMNNAME_IsSOTrx);
}
@Override
public void setName (final java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
@Override
public void setNegative_Amt_C_DocType_ID (final int Negative_Amt_C_DocType_ID)
{
if (Negative_Amt_C_DocType_ID < 1)
set_Value (COLUMNNAME_Negative_Amt_C_DocType_ID, null);
else
set_Value (COLUMNNAME_Negative_Amt_C_DocType_ID, Negative_Amt_C_DocType_ID);
} | @Override
public int getNegative_Amt_C_DocType_ID()
{
return get_ValueAsInt(COLUMNNAME_Negative_Amt_C_DocType_ID);
}
@Override
public void setPositive_Amt_C_DocType_ID (final int Positive_Amt_C_DocType_ID)
{
if (Positive_Amt_C_DocType_ID < 1)
set_Value (COLUMNNAME_Positive_Amt_C_DocType_ID, null);
else
set_Value (COLUMNNAME_Positive_Amt_C_DocType_ID, Positive_Amt_C_DocType_ID);
}
@Override
public int getPositive_Amt_C_DocType_ID()
{
return get_ValueAsInt(COLUMNNAME_Positive_Amt_C_DocType_ID);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_DocType_Invoicing_Pool.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public String getUPCCU() {
return upccu;
}
/**
* Sets the value of the upccu property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUPCCU(String value) {
this.upccu = value;
}
/**
* Gets the value of the upctu property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUPCTU() {
return upctu;
}
/**
* Sets the value of the upctu property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUPCTU(String value) {
this.upctu = value;
}
/**
* Gets the value of the isDeliveryClosed property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIsDeliveryClosed() {
return isDeliveryClosed;
}
/**
* Sets the value of the isDeliveryClosed property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIsDeliveryClosed(String value) {
this.isDeliveryClosed = value;
}
/**
* Gets the value of the gtincu property.
*
* @return | * possible object is
* {@link String }
*
*/
public String getGTINCU() {
return gtincu;
}
/**
* Sets the value of the gtincu property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setGTINCU(String value) {
this.gtincu = value;
}
/**
* Gets the value of the gtintu property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getGTINTU() {
return gtintu;
}
/**
* Sets the value of the gtintu property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setGTINTU(String value) {
this.gtintu = value;
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_metasfreshinhousev2\de\metas\edi\esb\jaxb\metasfreshinhousev2\EXPMInOutDesadvLineVType.java | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.