instruction string | input string | output string | source_file string | priority int64 |
|---|---|---|---|---|
请完成以下Java代码 | public VPanelFormFieldBuilder setSameLine(boolean sameLine)
{
this.sameLine = sameLine;
return this;
}
private boolean isMandatory()
{
return mandatory;
}
/**
* Default: {@link #DEFAULT_Mandatory}
*
* @param mandatory true if this field shall be marked as mandatory
*/
public VPanelFormFieldBuilder setMandatory(boolean mandatory)
{
this.mandatory = mandatory;
return this;
}
private boolean isAutocomplete()
{
if (autocomplete != null)
{
return autocomplete;
}
// if Search, always auto-complete
if (DisplayType.Search == displayType)
{
return true;
}
return false;
}
public VPanelFormFieldBuilder setAutocomplete(boolean autocomplete)
{
this.autocomplete = autocomplete;
return this;
}
private int getAD_Column_ID()
{
// not set is allowed
return AD_Column_ID;
}
/**
* @param AD_Column_ID Column for lookups.
*/
public VPanelFormFieldBuilder setAD_Column_ID(int AD_Column_ID)
{ | this.AD_Column_ID = AD_Column_ID;
return this;
}
public VPanelFormFieldBuilder setAD_Column_ID(final String tableName, final String columnName)
{
return setAD_Column_ID(Services.get(IADTableDAO.class).retrieveColumn(tableName, columnName).getAD_Column_ID());
}
private EventListener getEditorListener()
{
// null allowed
return editorListener;
}
/**
* @param listener VetoableChangeListener that gets called if the field is changed.
*/
public VPanelFormFieldBuilder setEditorListener(EventListener listener)
{
this.editorListener = listener;
return this;
}
public VPanelFormFieldBuilder setBindEditorToModel(boolean bindEditorToModel)
{
this.bindEditorToModel = bindEditorToModel;
return this;
}
public VPanelFormFieldBuilder setReadOnly(boolean readOnly)
{
this.readOnly = readOnly;
return this;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\org\compiere\grid\VPanelFormFieldBuilder.java | 1 |
请完成以下Java代码 | protected void prepare()
{
for (ProcessInfoParameter para : getParametersAsArray())
{
final String name = para.getParameterName();
if (para.getParameter() == null)
;
else if (X_T_BoilerPlate_Spool.COLUMNNAME_MsgText.equals(name))
{
p_MsgText = para.getParameter().toString();
}
else if ("AD_PrintFormat_ID".equals(name))
{
p_AD_PrintFormat_ID = para.getParameterAsInt();
}
}
//
if (p_MsgText == null && MADBoilerPlate.Table_Name.equals(getTableName()) && getRecord_ID() > 0)
{
final MADBoilerPlate bp = new MADBoilerPlate(getCtx(), getRecord_ID(), get_TrxName());
p_MsgText = bp.getTextSnippetParsed(null);
}
}
@Override
protected String doIt() throws Exception
{
createRecord(p_MsgText);
//
// Set Custom PrintFormat if needed
if (p_AD_PrintFormat_ID > 0)
{
final MPrintFormat pf = MPrintFormat.get(getCtx(), p_AD_PrintFormat_ID, false);
getResult().setPrintFormat(pf);
}
//
// Jasper Report
else if (isJasperReport())
{
startJasper();
}
return "OK"; | }
private void createRecord(String text)
{
MADBoilerPlate.createSpoolRecord(getCtx(), getAD_Client_ID(), getPinstanceId(), text, get_TrxName());
}
private boolean isJasperReport()
{
final String whereClause = I_AD_Process.COLUMNNAME_AD_Process_ID + "=?"
+ " AND " + I_AD_Process.COLUMNNAME_JasperReport + " IS NOT NULL";
return new Query(getCtx(), I_AD_Process.Table_Name, whereClause, get_TrxName())
.setParameters(getProcessInfo().getAdProcessId())
.anyMatch();
}
private void startJasper()
{
ProcessInfo.builder()
.setCtx(getCtx())
.setProcessCalledFrom(getProcessInfo().getProcessCalledFrom())
.setAD_Client_ID(getAD_Client_ID())
.setAD_User_ID(getAD_User_ID())
.setPInstanceId(getPinstanceId())
.setAD_Process_ID(0)
.setTableName(I_T_BoilerPlate_Spool.Table_Name)
//
.buildAndPrepareExecution()
.onErrorThrowException()
.executeSync();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\letters\report\AD_BoilerPlate_Report.java | 1 |
请完成以下Java代码 | public String getDbType()
{
return dbType;
}
@Override
public String getDbHostname()
{
return dbHostname;
}
@Override
public String getDbPort()
{
return dbPort;
}
@Override
public String getDbName()
{
return dbName;
}
@Override
public String getDbUser()
{
return dbUser;
}
@Override
public String getDbPassword()
{
return dbPassword;
}
@Override
public IScriptsRegistry getScriptsRegistry()
{
return scriptsRegistry;
}
@Override
public Connection getConnection()
{
//
// First time => driver initialization
if (conn == null)
{
final ISQLDatabaseDriver dbDriver = SQLDatabaseDriverFactory.get().getSQLDatabaseDriver(dbType); | if (dbDriver == null)
{
throw new IllegalStateException("No driver found for database type: " + dbType);
}
}
try
{
if (conn != null && !conn.isClosed())
{
return conn;
}
final ISQLDatabaseDriver dbDriver = SQLDatabaseDriverFactory.get().getSQLDatabaseDriver(dbType);
conn = dbDriver.getConnection(dbHostname, dbPort, dbName, dbUser, dbPassword);
conn.setAutoCommit(true);
}
catch (final SQLException e)
{
throw new RuntimeException("Failed to get a JDBC connection. Please check your config for : " + this, e);
}
return conn;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.migration\de.metas.migration.base\src\main\java\de\metas\migration\impl\SQLDatabase.java | 1 |
请完成以下Spring Boot application配置 | #\u89E3\u51B3\u4E2D\u6587\u4E71\u7801\u95EE\u9898
server.tomcat.uri-encoding=UTF-8
spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
spring.http.encoding.force=true
spring.messages.encoding=UTF-8
spring.profiles.active=prod
#server.context-path=/helloboot
#server.port=8081
#logging.file=/home/sang/workspace/l | og.log
#logging.level.org.springframework.web=debug
book.author=\u7F57\u8D2F\u4E2D
book.name=\u4E09\u56FD\u6F14\u4E49
book.pinyin=sanguoyanyi | repos\JavaEETest-master\Test19-SpringBoot2\src\main\resources\application.properties | 2 |
请完成以下Java代码 | public static Integer graterThanZeroOrNull(@Nullable final Integer value)
{
return Optional.ofNullable(value)
.filter(v1 -> v1 > 0)
.orElse(null);
}
public static boolean isZeroOrNull(@Nullable final BigDecimal value)
{
if (value == null)
{
return true;
}
else return value.compareTo(BigDecimal.ZERO) == 0;
}
@NonNull
public static String toStringWithCustomDecimalSeparator(@NonNull final BigDecimal value, final char separator)
{
final DecimalFormatSymbols symbols = new DecimalFormatSymbols();
symbols.setDecimalSeparator(separator);
final int scale = value.scale();
final String format;
if (scale > 0)
{
final StringBuilder formatBuilder = new StringBuilder("0.");
IntStream.range(0, scale)
.forEach(ignored -> formatBuilder.append("0"));
format = formatBuilder.toString();
}
else
{
format = "0";
}
final DecimalFormat formatter = new DecimalFormat(format, symbols);
return formatter.format(value);
}
@Nullable
public static BigDecimal zeroToNull(@Nullable final BigDecimal value)
{
return value != null && value.signum() != 0 ? value : null;
}
public static boolean equalsByCompareTo(@Nullable final BigDecimal value1, @Nullable final BigDecimal value2)
{
//noinspection NumberEquality
return (value1 == value2) || (value1 != null && value1.compareTo(value2) == 0);
}
@SafeVarargs
public static int firstNonZero(final Supplier<Integer>... suppliers)
{
if (suppliers == null || suppliers.length == 0)
{ | return 0;
}
for (final Supplier<Integer> supplier : suppliers)
{
if (supplier == null)
{
continue;
}
final Integer value = supplier.get();
if (value != null && value != 0)
{
return value;
}
}
return 0;
}
@NonNull
public static BigDecimal roundTo5Cent(@NonNull final BigDecimal initialValue)
{
final BigDecimal multiplyBy20 = initialValue.multiply(TWENTY);
final BigDecimal intPart = multiplyBy20.setScale(0, RoundingMode.HALF_UP);
return intPart.divide(TWENTY);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\de\metas\util\NumberUtils.java | 1 |
请完成以下Java代码 | public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getUseStatus() {
return useStatus;
}
public void setUseStatus(Integer useStatus) {
this.useStatus = useStatus;
}
public Date getUseTime() {
return useTime;
}
public void setUseTime(Date useTime) {
this.useTime = useTime;
}
public Long getOrderId() {
return orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
public String getOrderSn() {
return orderSn;
}
public void setOrderSn(String orderSn) {
this.orderSn = orderSn;
}
@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(", couponId=").append(couponId);
sb.append(", memberId=").append(memberId);
sb.append(", couponCode=").append(couponCode);
sb.append(", memberNickname=").append(memberNickname);
sb.append(", getType=").append(getType);
sb.append(", createTime=").append(createTime);
sb.append(", useStatus=").append(useStatus);
sb.append(", useTime=").append(useTime);
sb.append(", orderId=").append(orderId);
sb.append(", orderSn=").append(orderSn);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\SmsCouponHistory.java | 1 |
请完成以下Java代码 | protected boolean canSerializeValue(Object value) {
if (value instanceof Spin<?>) {
Spin<?> wrapper = (Spin<?>) value;
return wrapper.getDataFormatName().equals(serializationDataFormat);
}
return false;
}
protected byte[] serializeToByteArray(Object deserializedObject) throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
OutputStreamWriter outWriter = new OutputStreamWriter(out, Context.getProcessEngineConfiguration().getDefaultCharset());
BufferedWriter bufferedWriter = new BufferedWriter(outWriter);
try {
Spin<?> wrapper = (Spin<?>) deserializedObject;
wrapper.writeToWriter(bufferedWriter);
return out.toByteArray();
}
finally {
IoUtil.closeSilently(out);
IoUtil.closeSilently(outWriter);
IoUtil.closeSilently(bufferedWriter);
}
}
protected Object deserializeFromByteArray(byte[] object, ValueFields valueFields) throws Exception { | ByteArrayInputStream bais = new ByteArrayInputStream(object);
InputStreamReader inReader = new InputStreamReader(bais, Context.getProcessEngineConfiguration().getDefaultCharset());
BufferedReader bufferedReader = new BufferedReader(inReader);
try {
Object wrapper = dataFormat.getReader().readInput(bufferedReader);
return dataFormat.createWrapperInstance(wrapper);
}
finally{
IoUtil.closeSilently(bais);
IoUtil.closeSilently(inReader);
IoUtil.closeSilently(bufferedReader);
}
}
protected boolean isSerializationTextBased() {
return true;
}
} | repos\camunda-bpm-platform-master\engine-plugins\spin-plugin\src\main\java\org\camunda\spin\plugin\impl\SpinValueSerializer.java | 1 |
请完成以下Java代码 | public IHUStorageDAO getHUStorageDAO()
{
return storageDAO;
}
@Override
@NonNull
public List<IHUProductStorage> getHUProductStorages(@NonNull final List<I_M_HU> hus, final ProductId productId)
{
return hus.stream()
.map(this::getStorage)
.map(huStorage -> huStorage.getProductStorageOrNull(productId))
.filter(Objects::nonNull)
.collect(ImmutableList.toImmutableList());
}
@Override
public Stream<IHUProductStorage> streamHUProductStorages(@NonNull final List<I_M_HU> hus)
{
return hus.stream()
.map(this::getStorage)
.flatMap(IHUStorage::streamProductStorages);
}
@Override
public boolean isSingleProductWithQtyEqualsTo(@NonNull final I_M_HU hu, @NonNull final ProductId productId, @NonNull final Quantity qty)
{
return getStorage(hu).isSingleProductWithQtyEqualsTo(productId, qty);
}
@Override
public boolean isSingleProductStorageMatching(@NonNull final I_M_HU hu, @NonNull final ProductId productId)
{
return getStorage(hu).isSingleProductStorageMatching(productId);
}
@NonNull
public IHUProductStorage getSingleHUProductStorage(@NonNull final I_M_HU hu)
{
return getStorage(hu).getSingleHUProductStorage();
}
@Override
public List<IHUProductStorage> getProductStorages(@NonNull final I_M_HU hu)
{
return getStorage(hu).getProductStorages();
} | @Override
public IHUProductStorage getProductStorage(@NonNull final I_M_HU hu, @NonNull ProductId productId)
{
return getStorage(hu).getProductStorage(productId);
}
@Override
public @NonNull ImmutableMap<HuId, Set<ProductId>> getHUProductIds(@NonNull final List<I_M_HU> hus)
{
final Map<HuId, Set<ProductId>> huId2ProductIds = new HashMap<>();
streamHUProductStorages(hus)
.forEach(productStorage -> {
final Set<ProductId> productIds = new HashSet<>();
productIds.add(productStorage.getProductId());
huId2ProductIds.merge(productStorage.getHuId(), productIds, (oldValues, newValues) -> {
oldValues.addAll(newValues);
return oldValues;
});
});
return ImmutableMap.copyOf(huId2ProductIds);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\storage\impl\DefaultHUStorageFactory.java | 1 |
请完成以下Java代码 | public Course getCourse() {
return course;
}
public void setCourse(Course course) {
this.course = course;
}
public LocalDateTime getRegisteredAt() {
return registeredAt;
}
public void setRegisteredAt(LocalDateTime registeredAt) {
this.registeredAt = registeredAt;
}
public int getGrade() {
return grade;
}
public void setGrade(int grade) {
this.grade = grade;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
} | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
CourseRegistration other = (CourseRegistration) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
} | repos\tutorials-master\persistence-modules\spring-jpa\src\main\java\com\baeldung\manytomany\model\CourseRegistration.java | 1 |
请完成以下Java代码 | public abstract class TbAbstractSubCtx {
@Getter
protected final Lock wsLock = new ReentrantLock(true);
protected final String serviceId;
protected final SubscriptionServiceStatistics stats;
private final WebSocketService wsService;
protected final TbLocalSubscriptionService localSubscriptionService;
protected final WebSocketSessionRef sessionRef;
protected final int cmdId;
protected volatile boolean stopped;
@Getter
protected long createdTime;
public TbAbstractSubCtx(String serviceId, WebSocketService wsService,
TbLocalSubscriptionService localSubscriptionService,
SubscriptionServiceStatistics stats,
WebSocketSessionRef sessionRef, int cmdId) {
this.createdTime = System.currentTimeMillis();
this.serviceId = serviceId;
this.wsService = wsService;
this.localSubscriptionService = localSubscriptionService;
this.stats = stats;
this.sessionRef = sessionRef;
this.cmdId = cmdId;
}
public abstract boolean isDynamic();
public void stop() {
stopped = true;
}
public String getSessionId() {
return sessionRef.getSessionId();
}
public TenantId getTenantId() {
return sessionRef.getSecurityCtx().getTenantId();
} | public CustomerId getCustomerId() {
return sessionRef.getSecurityCtx().getCustomerId();
}
public UserId getUserId() {
return sessionRef.getSecurityCtx().getId();
}
public EntityId getOwnerId() {
var customerId = getCustomerId();
return customerId != null && !customerId.isNullUid() ? customerId : getTenantId();
}
public void sendWsMsg(CmdUpdate update) {
wsLock.lock();
try {
wsService.sendUpdate(sessionRef.getSessionId(), update);
} finally {
wsLock.unlock();
}
}
} | repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\subscription\TbAbstractSubCtx.java | 1 |
请完成以下Java代码 | public class MultiInstanceParser extends BaseChildElementParser {
private final List<ElementParser<MultiInstanceLoopCharacteristics>> multiInstanceElementParsers;
public MultiInstanceParser() {
this(
asList(
new LoopCardinalityParser(),
new MultiInstanceDataInputParser(),
new MultiInstanceInputDataItemParser(),
new MultiInstanceCompletionConditionParser(),
new LoopDataOutputRefParser(),
new MultiInstanceOutputDataItemParser(),
new MultiInstanceAttributesParser()
)
);
}
public MultiInstanceParser(List<ElementParser<MultiInstanceLoopCharacteristics>> multiInstanceElementParsers) {
this.multiInstanceElementParsers = multiInstanceElementParsers;
}
public String getElementName() {
return ELEMENT_MULTIINSTANCE;
}
public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception {
if (!(parentElement instanceof Activity)) {
return;
}
MultiInstanceLoopCharacteristics multiInstanceDef = new MultiInstanceLoopCharacteristics();
BpmnXMLUtil.addXMLLocation(multiInstanceDef, xtr);
parseMultiInstanceProperties(xtr, multiInstanceDef);
((Activity) parentElement).setLoopCharacteristics(multiInstanceDef);
}
private void parseMultiInstanceProperties(XMLStreamReader xtr, MultiInstanceLoopCharacteristics multiInstanceDef) {
boolean readyWithMultiInstance = false; | try {
do {
ElementParser<MultiInstanceLoopCharacteristics> matchingParser = multiInstanceElementParsers
.stream()
.filter(elementParser -> elementParser.canParseCurrentElement(xtr))
.findFirst()
.orElse(null);
if (matchingParser != null) {
matchingParser.setInformation(xtr, multiInstanceDef);
}
if (xtr.isEndElement() && getElementName().equalsIgnoreCase(xtr.getLocalName())) {
readyWithMultiInstance = true;
}
if (xtr.hasNext()) {
xtr.next();
}
} while (!readyWithMultiInstance && xtr.hasNext());
} catch (Exception e) {
LOGGER.warn("Error parsing multi instance definition", e);
}
}
} | repos\Activiti-develop\activiti-core\activiti-bpmn-converter\src\main\java\org\activiti\bpmn\converter\child\multi\instance\MultiInstanceParser.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class OldAndNewValues<T>
{
@Nullable T oldValue;
@Nullable T newValue;
public static <T> OldAndNewValues<T> ofOldAndNewValues(
@Nullable final T oldValue,
@Nullable final T newValue)
{
if (oldValue == null && newValue == null)
{
return nullValues();
}
return OldAndNewValues.<T>builder().oldValue(oldValue).newValue(newValue).build();
}
private static final OldAndNewValues<Object> NULL_VALUES = builder().build();
public static <T> OldAndNewValues<T> nullValues()
{
//noinspection unchecked
return (OldAndNewValues<T>)NULL_VALUES;
}
public boolean isValueChanged()
{
return !Objects.equals(oldValue, newValue);
}
public <NT> OldAndNewValues<NT> mapNonNulls(@NonNull final Function<T, NT> mapper)
{
final OldAndNewValues<NT> result = ofOldAndNewValues(
oldValue != null ? mapper.apply(oldValue) : null,
newValue != null ? mapper.apply(newValue) : null
); | if (this.equals(result))
{
//noinspection unchecked
return (OldAndNewValues<NT>)this;
}
return result;
}
public <NT> OldAndNewValues<NT> map(@NonNull final Function<T, NT> mapper)
{
final OldAndNewValues<NT> result = ofOldAndNewValues(
mapper.apply(oldValue),
mapper.apply(newValue)
);
if (this.equals(result))
{
//noinspection unchecked
return (OldAndNewValues<NT>)this;
}
return result;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\org\adempiere\util\lang\OldAndNewValues.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public @Nullable String getProjectId() {
return this.projectId;
}
public void setProjectId(@Nullable String projectId) {
this.projectId = projectId;
}
public String getResourceType() {
return this.resourceType;
}
public void setResourceType(String resourceType) {
this.resourceType = resourceType;
}
public @Nullable Map<String, String> getResourceLabels() {
return this.resourceLabels;
}
public void setResourceLabels(@Nullable Map<String, String> resourceLabels) {
this.resourceLabels = resourceLabels;
}
public boolean isUseSemanticMetricTypes() { | return this.useSemanticMetricTypes;
}
public void setUseSemanticMetricTypes(boolean useSemanticMetricTypes) {
this.useSemanticMetricTypes = useSemanticMetricTypes;
}
public String getMetricTypePrefix() {
return this.metricTypePrefix;
}
public void setMetricTypePrefix(String metricTypePrefix) {
this.metricTypePrefix = metricTypePrefix;
}
public boolean isAutoCreateMetricDescriptors() {
return this.autoCreateMetricDescriptors;
}
public void setAutoCreateMetricDescriptors(boolean autoCreateMetricDescriptors) {
this.autoCreateMetricDescriptors = autoCreateMetricDescriptors;
}
} | repos\spring-boot-4.0.1\module\spring-boot-micrometer-metrics\src\main\java\org\springframework\boot\micrometer\metrics\autoconfigure\export\stackdriver\StackdriverProperties.java | 2 |
请完成以下Java代码 | public boolean hasPermission(Object target, Object permission) {
return permissionEvaluator.hasPermission(authentication, target, permission);
}
@Override
public boolean hasPermission(Object targetId, String targetType, Object permission) {
return permissionEvaluator.hasPermission(authentication, (Serializable) targetId, targetType, permission);
}
public void setPermissionEvaluator(PermissionEvaluator permissionEvaluator) {
this.permissionEvaluator = permissionEvaluator;
}
private static String getRoleWithDefaultPrefix(String defaultRolePrefix, String role) {
if (role == null) {
return role;
}
if ((defaultRolePrefix == null) || (defaultRolePrefix.length() == 0)) {
return role;
}
if (role.startsWith(defaultRolePrefix)) {
return role;
}
return defaultRolePrefix + role;
}
@Override
public Object getFilterObject() {
return this.filterObject;
} | @Override
public Object getReturnObject() {
return this.returnObject;
}
@Override
public Object getThis() {
return this;
}
@Override
public void setFilterObject(Object obj) {
this.filterObject = obj;
}
@Override
public void setReturnObject(Object obj) {
this.returnObject = obj;
}
} | repos\tutorials-master\spring-security-modules\spring-security-web-boot-1\src\main\java\com\baeldung\roles\custom\security\MySecurityExpressionRoot.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public String getIndoorPic() {
return indoorPic;
}
public void setIndoorPic(String indoorPic) {
this.indoorPic = indoorPic;
}
public String getMerchantShortname() {
return merchantShortname;
}
public void setMerchantShortname(String merchantShortname) {
this.merchantShortname = merchantShortname;
}
public String getServicePhone() {
return servicePhone;
}
public void setServicePhone(String servicePhone) {
this.servicePhone = servicePhone;
}
public String getProductDesc() {
return productDesc;
}
public void setProductDesc(String productDesc) {
this.productDesc = productDesc;
}
public String getRate() {
return rate;
}
public void setRate(String rate) {
this.rate = rate;
}
public String getContactPhone() {
return contactPhone; | }
public void setContactPhone(String contactPhone) {
this.contactPhone = contactPhone;
}
@Override
public String toString() {
return "RpMicroSubmitRecord{" +
"businessCode='" + businessCode + '\'' +
", subMchId='" + subMchId + '\'' +
", idCardCopy='" + idCardCopy + '\'' +
", idCardNational='" + idCardNational + '\'' +
", idCardName='" + idCardName + '\'' +
", idCardNumber='" + idCardNumber + '\'' +
", idCardValidTime='" + idCardValidTime + '\'' +
", accountBank='" + accountBank + '\'' +
", bankAddressCode='" + bankAddressCode + '\'' +
", accountNumber='" + accountNumber + '\'' +
", storeName='" + storeName + '\'' +
", storeAddressCode='" + storeAddressCode + '\'' +
", storeStreet='" + storeStreet + '\'' +
", storeEntrancePic='" + storeEntrancePic + '\'' +
", indoorPic='" + indoorPic + '\'' +
", merchantShortname='" + merchantShortname + '\'' +
", servicePhone='" + servicePhone + '\'' +
", productDesc='" + productDesc + '\'' +
", rate='" + rate + '\'' +
", contactPhone='" + contactPhone + '\'' +
", idCardValidTimeBegin='" + idCardValidTimeBegin + '\'' +
", idCardValidTimeEnd='" + idCardValidTimeEnd + '\'' +
'}';
}
} | repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\trade\entity\RpMicroSubmitRecord.java | 2 |
请完成以下Java代码 | public void destroy() throws Exception {
if (processEngine != null) {
processEngine.close();
}
}
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
public ProcessEngine getObject() throws Exception {
configureExpressionManager();
configureExternallyManagedTransactions();
if (processEngineConfiguration.getBeans() == null) {
processEngineConfiguration.setBeans(new SpringBeanFactoryProxyMap(applicationContext));
}
this.processEngine = processEngineConfiguration.buildProcessEngine();
return this.processEngine;
}
protected void configureExpressionManager() {
if (processEngineConfiguration.getExpressionManager() == null && applicationContext != null) {
SpringExpressionManager expressionManager = new SpringExpressionManager(
applicationContext,
processEngineConfiguration.getBeans()
);
List<CustomFunctionProvider> customFunctionProviders =
processEngineConfiguration.getCustomFunctionProviders();
List<ELResolver> customELResolvers = processEngineConfiguration.getCustomELResolvers();
if (customFunctionProviders != null) {
expressionManager.setCustomFunctionProviders(customFunctionProviders);
}
if (customELResolvers != null) {
expressionManager.setCustomELResolvers(customELResolvers);
}
processEngineConfiguration.setExpressionManager(expressionManager); | }
}
protected void configureExternallyManagedTransactions() {
if (processEngineConfiguration instanceof SpringProcessEngineConfiguration) {
// remark: any config can be injected, so we cannot have SpringConfiguration as member
SpringProcessEngineConfiguration engineConfiguration =
(SpringProcessEngineConfiguration) processEngineConfiguration;
if (engineConfiguration.getTransactionManager() != null) {
processEngineConfiguration.setTransactionsExternallyManaged(true);
}
}
}
public Class<ProcessEngine> getObjectType() {
return ProcessEngine.class;
}
public boolean isSingleton() {
return true;
}
public ProcessEngineConfigurationImpl getProcessEngineConfiguration() {
return processEngineConfiguration;
}
public void setProcessEngineConfiguration(ProcessEngineConfigurationImpl processEngineConfiguration) {
this.processEngineConfiguration = processEngineConfiguration;
}
} | repos\Activiti-develop\activiti-core\activiti-spring\src\main\java\org\activiti\spring\ProcessEngineFactoryBean.java | 1 |
请在Spring Boot框架中完成以下Java代码 | private static class ProcessCaptionOverrideMapper implements ProcessCaptionMapper
{
@NonNull ITranslatableString captionOverride;
public ProcessCaptionOverrideMapper(@NonNull final ITranslatableString captionOverride)
{
this.captionOverride = captionOverride;
}
public ProcessCaptionOverrideMapper(@NonNull final String captionOverride)
{
this.captionOverride = TranslatableStrings.anyLanguage(captionOverride);
}
@Override
public ITranslatableString computeCaption(final ITranslatableString originalProcessCaption)
{
return captionOverride;
}
}
public ProcessPreconditionsResolution withCaptionMapper(@Nullable final ProcessCaptionMapper captionMapper)
{
return toBuilder().captionMapper(captionMapper).build();
}
/**
* Override default SortNo used with ordering related processes
*/
public ProcessPreconditionsResolution withSortNo(final int sortNo)
{
return !this.sortNo.isPresent() || this.sortNo.getAsInt() != sortNo
? toBuilder().sortNo(OptionalInt.of(sortNo)).build()
: this;
}
public @NonNull OptionalInt getSortNo() {return this.sortNo;} | public ProcessPreconditionsResolution and(final Supplier<ProcessPreconditionsResolution> resolutionSupplier)
{
if (isRejected())
{
return this;
}
return resolutionSupplier.get();
}
public void throwExceptionIfRejected()
{
if (isRejected())
{
throw new AdempiereException(getRejectReason());
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\process\ProcessPreconditionsResolution.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public void setSettFee(BigDecimal settFee) {
this.settFee = settFee;
}
/**
* 结算打款金额
*
* @return
*/
public BigDecimal getRemitAmount() {
return remitAmount;
}
/**
* 结算打款金额
*
* @param remitAmount
*/
public void setRemitAmount(BigDecimal remitAmount) {
this.remitAmount = remitAmount;
}
/** 结算状态(参考枚举:SettRecordStatusEnum) **/
public String getSettStatus() {
return settStatus;
}
/** 结算状态(参考枚举:SettRecordStatusEnum) **/
public void setSettStatus(String settStatus) {
this.settStatus = settStatus;
}
/**
* 打款发送时间
*
* @return
*/
public Date getRemitRequestTime() {
return remitRequestTime;
}
/**
* 打款发送时间
*
* @param remitRequestTime
*/
public void setRemitRequestTime(Date remitRequestTime) {
this.remitRequestTime = remitRequestTime;
}
/**
* 打款确认时间
*
* @return
*/
public Date getRemitConfirmTime() {
return remitConfirmTime;
}
/**
* 打款确认时间
*
* @param remitConfirmTime
*/
public void setRemitConfirmTime(Date remitConfirmTime) {
this.remitConfirmTime = remitConfirmTime;
} | /**
* 打款备注
*
* @return
*/
public String getRemitRemark() {
return remitRemark;
}
/**
* 打款备注
*
* @param remitRemark
*/
public void setRemitRemark(String remitRemark) {
this.remitRemark = remitRemark == null ? null : remitRemark.trim();
}
/**
* 操作员登录名
*
* @return
*/
public String getOperatorLoginname() {
return operatorLoginname;
}
/**
* 操作员登录名
*
* @param operatorLoginname
*/
public void setOperatorLoginname(String operatorLoginname) {
this.operatorLoginname = operatorLoginname == null ? null : operatorLoginname.trim();
}
/**
* 操作员姓名
*
* @return
*/
public String getOperatorRealname() {
return operatorRealname;
}
/**
* 操作员姓名
*
* @param operatorRealname
*/
public void setOperatorRealname(String operatorRealname) {
this.operatorRealname = operatorRealname == null ? null : operatorRealname.trim();
}
public String getSettStatusDesc() {
return SettRecordStatusEnum.getEnum(this.getSettStatus()).getDesc();
}
public String getCreateTimeDesc() {
return DateUtils.formatDate(this.getCreateTime(), "yyyy-MM-dd HH:mm:ss");
}
} | repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\account\entity\RpSettRecord.java | 2 |
请完成以下Java代码 | private void lock1(User a, User b) {
// 使用原生的HashCode方法,防止hashCode方法被重写导致的一些问题,
// 如果能确保use对象中的id是唯一且不会重复,可以直接使用userId
int aHashCode = System.identityHashCode(a);
int bHashCode = System.identityHashCode(b);
if (aHashCode > bHashCode) {
synchronized (a) {
sleep(1000);
synchronized (b) {
sleep(1000);
System.out.println(Thread.currentThread().getName() + " 死锁示例");
}
}
} else if (aHashCode < bHashCode) {
synchronized (b) {
sleep(1000);
synchronized (a) {
sleep(1000);
System.out.println(Thread.currentThread().getName() + " 死锁示例");
}
}
} else {
// 引入一个外部锁,解决hash冲突的方法
synchronized (lock) {
synchronized (a) {
sleep(1000);
synchronized (b) {
sleep(1000);
System.out.println(Thread.currentThread().getName() + " 死锁示例");
}
}
}
}
}
Random random = new Random();
/**
* 使用tryLock尝试拿锁
*
* @param a a
* @param b b
*/
private void lock2(User a, User b) { | while (true) {
try {
if (a.getLock().tryLock()) {
try {
if (b.getLock().tryLock()) {
System.out.println(Thread.currentThread().getName() + " 死锁示例");
break;
}
} finally {
b.getLock().unlock();
}
}
} finally {
a.getLock().unlock();
}
// 拿锁失败以后,休眠随机数,以避免活锁
sleep(random.nextInt());
}
}
private void deadlock(User a, User b) {
synchronized (a) {
sleep(1000);
synchronized (b) {
sleep(1000);
System.out.println(Thread.currentThread().getName() + " 死锁示例");
}
}
}
public static void sleep(int probe) {
try {
Thread.sleep(probe);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} | repos\spring-boot-student-master\spring-boot-student-concurrent\src\main\java\com\xiaolyuh\LockTest.java | 1 |
请完成以下Java代码 | public void setAD_Role_ID (int AD_Role_ID)
{
if (AD_Role_ID < 0)
set_ValueNoCheck (COLUMNNAME_AD_Role_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_Role_ID, Integer.valueOf(AD_Role_ID));
}
/** Get Rolle.
@return Responsibility Role
*/
@Override
public int getAD_Role_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Role_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set AD_Workflow_Access.
@param AD_Workflow_Access_ID AD_Workflow_Access */
@Override
public void setAD_Workflow_Access_ID (int AD_Workflow_Access_ID)
{
if (AD_Workflow_Access_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_Workflow_Access_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_Workflow_Access_ID, Integer.valueOf(AD_Workflow_Access_ID));
}
/** Get AD_Workflow_Access.
@return AD_Workflow_Access */
@Override
public int getAD_Workflow_Access_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Workflow_Access_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public org.compiere.model.I_AD_Workflow getAD_Workflow() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_AD_Workflow_ID, org.compiere.model.I_AD_Workflow.class);
}
@Override
public void setAD_Workflow(org.compiere.model.I_AD_Workflow AD_Workflow)
{
set_ValueFromPO(COLUMNNAME_AD_Workflow_ID, org.compiere.model.I_AD_Workflow.class, AD_Workflow);
}
/** Set Workflow.
@param AD_Workflow_ID
Workflow or combination of tasks
*/
@Override
public void setAD_Workflow_ID (int AD_Workflow_ID)
{
if (AD_Workflow_ID < 1) | set_ValueNoCheck (COLUMNNAME_AD_Workflow_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_Workflow_ID, Integer.valueOf(AD_Workflow_ID));
}
/** Get Workflow.
@return Workflow or combination of tasks
*/
@Override
public int getAD_Workflow_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Workflow_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Lesen und Schreiben.
@param IsReadWrite
Field is read / write
*/
@Override
public void setIsReadWrite (boolean IsReadWrite)
{
set_Value (COLUMNNAME_IsReadWrite, Boolean.valueOf(IsReadWrite));
}
/** Get Lesen und Schreiben.
@return Field is read / write
*/
@Override
public boolean isReadWrite ()
{
Object oo = get_Value(COLUMNNAME_IsReadWrite);
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_AD_Workflow_Access.java | 1 |
请完成以下Java代码 | public void setQtyToOrder (BigDecimal QtyToOrder)
{
set_Value (COLUMNNAME_QtyToOrder, QtyToOrder);
}
/** Get Quantity to Order.
@return Quantity to Order */
public BigDecimal getQtyToOrder ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyToOrder);
if (bd == null)
return Env.ZERO;
return bd;
}
/** ReplenishmentCreate AD_Reference_ID=329 */
public static final int REPLENISHMENTCREATE_AD_Reference_ID=329;
/** Purchase Order = POO */
public static final String REPLENISHMENTCREATE_PurchaseOrder = "POO";
/** Requisition = POR */
public static final String REPLENISHMENTCREATE_Requisition = "POR";
/** Inventory Move = MMM */
public static final String REPLENISHMENTCREATE_InventoryMove = "MMM";
/** Distribution Order = DOO */
public static final String REPLENISHMENTCREATE_DistributionOrder = "DOO";
/** Set Create.
@param ReplenishmentCreate
Create from Replenishment
*/
public void setReplenishmentCreate (String ReplenishmentCreate)
{
set_Value (COLUMNNAME_ReplenishmentCreate, ReplenishmentCreate);
}
/** Get Create.
@return Create from Replenishment
*/
public String getReplenishmentCreate ()
{
return (String)get_Value(COLUMNNAME_ReplenishmentCreate);
} | /** ReplenishType AD_Reference_ID=164 */
public static final int REPLENISHTYPE_AD_Reference_ID=164;
/** Maintain Maximum Level = 2 */
public static final String REPLENISHTYPE_MaintainMaximumLevel = "2";
/** Manual = 0 */
public static final String REPLENISHTYPE_Manual = "0";
/** Reorder below Minimum Level = 1 */
public static final String REPLENISHTYPE_ReorderBelowMinimumLevel = "1";
/** Custom = 9 */
public static final String REPLENISHTYPE_Custom = "9";
/** Set Replenish Type.
@param ReplenishType
Method for re-ordering a product
*/
public void setReplenishType (String ReplenishType)
{
set_Value (COLUMNNAME_ReplenishType, ReplenishType);
}
/** Get Replenish Type.
@return Method for re-ordering a product
*/
public String getReplenishType ()
{
return (String)get_Value(COLUMNNAME_ReplenishType);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_T_Replenish.java | 1 |
请完成以下Java代码 | public SignalRestService getSignalRestService(@PathParam("name") String engineName) {
return super.getSignalRestService(engineName);
}
@Override
@Path("/{name}" + ConditionRestService.PATH)
public ConditionRestService getConditionRestService(@PathParam("name") String engineName) {
return super.getConditionRestService(engineName);
}
@Path("/{name}" + OptimizeRestService.PATH)
public OptimizeRestService getOptimizeRestService(@PathParam("name") String engineName) {
return super.getOptimizeRestService(engineName);
}
@Path("/{name}" + VersionRestService.PATH)
public VersionRestService getVersionRestService(@PathParam("name") String engineName) {
return super.getVersionRestService(engineName);
}
@Path("/{name}" + SchemaLogRestService.PATH)
public SchemaLogRestService getSchemaLogRestService(@PathParam("name") String engineName) {
return super.getSchemaLogRestService(engineName);
}
@Override
@Path("/{name}" + EventSubscriptionRestService.PATH)
public EventSubscriptionRestService getEventSubscriptionRestService(@PathParam("name") String engineName) {
return super.getEventSubscriptionRestService(engineName);
}
@Override
@Path("/{name}" + TelemetryRestService.PATH)
public TelemetryRestService getTelemetryRestService(@PathParam("name") String engineName) {
return super.getTelemetryRestService(engineName);
}
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<ProcessEngineDto> getProcessEngineNames() { | ProcessEngineProvider provider = getProcessEngineProvider();
Set<String> engineNames = provider.getProcessEngineNames();
List<ProcessEngineDto> results = new ArrayList<ProcessEngineDto>();
for (String engineName : engineNames) {
ProcessEngineDto dto = new ProcessEngineDto();
dto.setName(engineName);
results.add(dto);
}
return results;
}
@Override
protected URI getRelativeEngineUri(String engineName) {
return UriBuilder.fromResource(NamedProcessEngineRestServiceImpl.class).path("{name}").build(engineName);
}
} | repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\impl\NamedProcessEngineRestServiceImpl.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class WidgetsBundleImportService extends BaseEntityImportService<WidgetsBundleId, WidgetsBundle, WidgetsBundleExportData> {
private final WidgetsBundleService widgetsBundleService;
private final WidgetTypeService widgetTypeService;
@Override
protected void setOwner(TenantId tenantId, WidgetsBundle widgetsBundle, IdProvider idProvider) {
widgetsBundle.setTenantId(tenantId);
}
@Override
protected WidgetsBundle prepare(EntitiesImportCtx ctx, WidgetsBundle widgetsBundle, WidgetsBundle old, WidgetsBundleExportData exportData, IdProvider idProvider) {
return widgetsBundle;
}
@Override
protected WidgetsBundle saveOrUpdate(EntitiesImportCtx ctx, WidgetsBundle widgetsBundle, WidgetsBundleExportData exportData, IdProvider idProvider, CompareResult compareResult) {
if (CollectionsUtil.isNotEmpty(exportData.getWidgets())) {
exportData.getWidgets().forEach(widgetTypeNode -> {
String bundleAlias = widgetTypeNode.remove("bundleAlias").asText();
String alias = widgetTypeNode.remove("alias").asText();
String fqn = String.format("%s.%s", bundleAlias, alias);
exportData.addFqn(fqn);
WidgetTypeDetails widgetType = JacksonUtil.treeToValue(widgetTypeNode, WidgetTypeDetails.class);
widgetType.setTenantId(ctx.getTenantId());
widgetType.setFqn(fqn);
var existingWidgetType = widgetTypeService.findWidgetTypeByTenantIdAndFqn(ctx.getTenantId(), fqn);
if (existingWidgetType == null) {
widgetType.setId(null); | } else {
widgetType.setId(existingWidgetType.getId());
widgetType.setCreatedTime(existingWidgetType.getCreatedTime());
}
widgetTypeService.saveWidgetType(widgetType);
});
}
WidgetsBundle savedWidgetsBundle = widgetsBundleService.saveWidgetsBundle(widgetsBundle);
widgetTypeService.updateWidgetsBundleWidgetFqns(ctx.getTenantId(), savedWidgetsBundle.getId(), exportData.getFqns());
return savedWidgetsBundle;
}
@Override
protected CompareResult compare(EntitiesImportCtx ctx, WidgetsBundleExportData exportData, WidgetsBundle prepared, WidgetsBundle existing) {
return new CompareResult(true);
}
@Override
protected WidgetsBundle deepCopy(WidgetsBundle widgetsBundle) {
return new WidgetsBundle(widgetsBundle);
}
@Override
public EntityType getEntityType() {
return EntityType.WIDGETS_BUNDLE;
}
} | repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\sync\ie\importing\impl\WidgetsBundleImportService.java | 2 |
请完成以下Java代码 | public class BetweenQueryFilter<T> implements IQueryFilter<T>, ISqlQueryFilter
{
private final CompositeQueryFilter<T> filter;
public BetweenQueryFilter(final String tableName, final String columnName, final Object valueFrom, final Object valueTo)
{
this(tableName, columnName, valueFrom, valueTo, NullQueryFilterModifier.instance);
}
public BetweenQueryFilter(final String tableName, final String columnName, final Object valueFrom, final Object valueTo, IQueryFilterModifier modifier)
{
filter = CompositeQueryFilter.newInstance(tableName);
filter.setJoinAnd();
filter.addCompareFilter(columnName, Operator.GREATER_OR_EQUAL, valueFrom, modifier);
filter.addCompareFilter(columnName, Operator.LESS_OR_EQUAL, valueTo, modifier);
}
public BetweenQueryFilter(final ModelColumn<T, ?> column, final Object valueFrom, final Object valueTo)
{
this(column, valueFrom, valueTo, NullQueryFilterModifier.instance);
}
public BetweenQueryFilter(final ModelColumn<T, ?> column, final Object valueFrom, final Object valueTo, IQueryFilterModifier modifier)
{
super();
filter = CompositeQueryFilter.newInstance(column.getModelClass());
filter.setJoinAnd();
filter.addCompareFilter(column, Operator.GREATER_OR_EQUAL, valueFrom, modifier);
filter.addCompareFilter(column, Operator.LESS_OR_EQUAL, valueTo, modifier);
}
@Override
public String toString()
{
return filter.toString();
} | @Override
public String getSql()
{
return filter.getSql();
}
@Override
public List<Object> getSqlParams(Properties ctx)
{
return filter.getSqlParams(ctx);
}
@Override
public boolean accept(final T model)
{
return filter.accept(model);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\dao\impl\BetweenQueryFilter.java | 1 |
请完成以下Java代码 | static PackingInfo extractPackingInfo(@NonNull final I_M_ShipmentSchedule record)
{
final BigDecimal qtyCUsPerTU = record.getQtyItemCapacity();
if (qtyCUsPerTU == null || qtyCUsPerTU.signum() <= 0)
{
return PackingInfo.NONE;
}
else
{
return PackingInfo.builder()
.qtyCUsPerTU(qtyCUsPerTU)
.description(record.getPackDescription())
.build();
}
}
private LookupValue extractCatchUOM(@NonNull final I_M_ShipmentSchedule record)
{
final UomId catchUomId = UomId.ofRepoIdOrNull(record.getCatch_UOM_ID());
return catchUomId != null
? catchUOMsLookup.findById(catchUomId)
: null;
}
private LookupValue toLookupValue(@NonNull final AttributeSetInstanceId asiId)
{
return asiId.isRegular()
? asiLookup.findById(asiId)
: IntegerLookupValue.of(asiId.getRepoId(), "");
}
private ZonedDateTime extractPreparationTime(@NonNull final I_M_ShipmentSchedule record)
{
return shipmentScheduleBL.getPreparationDate(record);
}
private Quantity extractQtyCUToDeliver(@NonNull final I_M_ShipmentSchedule record)
{
return shipmentScheduleBL.getQtyToDeliver(record);
} | private BigDecimal extractQtyToDeliverCatchOverride(@NonNull final I_M_ShipmentSchedule record)
{
return shipmentScheduleBL
.getCatchQtyOverride(record)
.map(qty -> qty.toBigDecimal())
.orElse(null);
}
private int extractSalesOrderLineNo(final I_M_ShipmentSchedule record)
{
final OrderAndLineId salesOrderAndLineId = extractSalesOrderAndLineId(record);
if (salesOrderAndLineId == null)
{
return 0;
}
final I_C_OrderLine salesOrderLine = salesOrderLines.get(salesOrderAndLineId);
if (salesOrderLine == null)
{
return 0;
}
return salesOrderLine.getLine();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\shipment_candidates_editor\ShipmentCandidateRowsLoader.java | 1 |
请完成以下Java代码 | public void setSearchSubtree(boolean searchSubtree) {
this.searchControls
.setSearchScope(searchSubtree ? SearchControls.SUBTREE_SCOPE : SearchControls.ONELEVEL_SCOPE);
}
/**
* The time to wait before the search fails; the default is zero, meaning forever.
* @param searchTimeLimit the time limit for the search (in milliseconds).
*/
public void setSearchTimeLimit(int searchTimeLimit) {
this.searchControls.setTimeLimit(searchTimeLimit);
}
/**
* Specifies the attributes that will be returned as part of the search.
* <p>
* null indicates that all attributes will be returned. An empty array indicates no
* attributes are returned.
* @param attrs An array of attribute names identifying the attributes that will be
* returned. Can be null. | */
public void setReturningAttributes(String[] attrs) {
this.searchControls.setReturningAttributes(attrs);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName()).append(" [");
sb.append("searchFilter=").append(this.searchFilter).append("; ");
sb.append("searchBase=").append(this.searchBase).append("; ");
sb.append("scope=")
.append((this.searchControls.getSearchScope() != SearchControls.SUBTREE_SCOPE) ? "single-level" : "subtree")
.append("; ");
sb.append("searchTimeLimit=").append(this.searchControls.getTimeLimit()).append("; ");
sb.append("derefLinkFlag=").append(this.searchControls.getDerefLinkFlag()).append(" ]");
return sb.toString();
}
} | repos\spring-security-main\ldap\src\main\java\org\springframework\security\ldap\search\FilterBasedLdapUserSearch.java | 1 |
请完成以下Java代码 | private static final String removeLeftZeros(final String value)
{
final int size = value.length();
int counter;
for (counter = 0; counter < size; counter++)
{
if (value.charAt(counter) != '0')
{
break;
}
}
if (counter == size)
{
return value;
}
else
{
return value.substring(counter, size);
}
}
private static int computeCheckDigit(
@NonNull final String bankAccount,
@NonNull final String org,
@NonNull final String bPartner,
@NonNull final String invoice) | {
final StringBuilder sb = new StringBuilder();
sb.append(bankAccount);
sb.append(org);
sb.append(bPartner);
sb.append(invoice);
try
{
final IESRImportBL esrImportBL = Services.get(IESRImportBL.class);
final int checkDigit = esrImportBL.calculateESRCheckDigit(sb.toString());
return checkDigit;
}
catch (final Exception e)
{
throw AdempiereException.wrapIfNeeded(e)
.appendParametersToMessage()
.setParameter("bankAccount", bankAccount)
.setParameter("org", org)
.setParameter("bPartner", bPartner)
.setParameter("invoice", invoice);
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.payment.esr\src\main\java\de\metas\payment\esr\api\InvoiceReferenceNos.java | 1 |
请完成以下Java代码 | public static void apply(GridWindowVO vo)
{
for (MUserDefWin uw : get(vo.getCtx(), vo.getAdWindowId()))
{
// vo.Name = uw.getName();
// vo.Description = uw.getDescription();
// vo.Help = uw .getHelp();
vo.setReadWrite(!uw.isReadOnly());
}
}
/**
* Apply customizations to given GridTabVO
* @return true if tab is displayed, false if tab is hidden
*/
public static boolean apply(GridTabVO vo)
{
boolean isDisplayed = true;
for (MUserDefWin uw : get(vo.getCtx(), vo.getAdWindowId()))
{
MUserDefTab ut = uw.getTab(vo.getAD_Tab_ID());
if (ut != null)
{
ut.apply(vo);
isDisplayed = ut.isDisplayed();
}
}
return isDisplayed;
}
/**
* Apply customizations to given GridFieldVO
*/
public static void apply(GridFieldVO vo)
{
for (MUserDefWin uw : get(vo.getCtx(), vo.getAdWindowId()))
{
MUserDefTab ut = uw.getTab(vo.AD_Tab_ID);
if (ut == null)
{
continue;
}
MUserDefField uf = ut.getField(vo.getAD_Field_ID());
if (uf != null)
{
uf.apply(vo);
}
}
}
@SuppressWarnings("unused")
public MUserDefWin(Properties ctx, int AD_UserDef_Win_ID, String trxName)
{
super(ctx, AD_UserDef_Win_ID, trxName);
}
@SuppressWarnings("unused")
public MUserDefWin(Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
}
/**
* @return tab customizations for this window
*/
private MUserDefTab[] getTabs()
{
if (m_tabs != null)
{
return m_tabs;
}
final String whereClause = MUserDefTab.COLUMNNAME_AD_UserDef_Win_ID+"=?"; | final List<MUserDefTab> list = new Query(getCtx(), MUserDefTab.Table_Name, whereClause, get_TrxName())
.setParameters(get_ID())
.setOnlyActiveRecords(true)
.setOrderBy(MUserDefTab.COLUMNNAME_AD_Tab_ID)
.list(MUserDefTab.class);
//
m_tabs = list.toArray(new MUserDefTab[0]);
return m_tabs;
}
private MUserDefTab[] m_tabs = null;
/**
* @return tab customization of given AD_Tab_ID or null if not found
*/
public MUserDefTab getTab(int AD_Tab_ID)
{
if (AD_Tab_ID <= 0)
{
return null;
}
for (MUserDefTab tab : getTabs())
{
if (AD_Tab_ID == tab.getAD_Tab_ID())
{
return tab;
}
}
return null;
}
@Override
public String toString()
{
return getClass().getName()+"[ID="+get_ID()
+", AD_Org_ID="+getAD_Org_ID()
+", AD_Role_ID="+getAD_Role_ID()
+", AD_User_ID="+getAD_User_ID()
+", AD_Window_ID="+getAD_Window_ID()
+", Name="+getName()
+"]";
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\compiere\model\MUserDefWin.java | 1 |
请完成以下Java代码 | public Class<? extends BaseElement> getBpmnElementType() {
return ScriptTask.class;
}
@Override
protected String getXMLElementName() {
return ELEMENT_TASK_SCRIPT;
}
@Override
protected BaseElement convertXMLToElement(XMLStreamReader xtr, BpmnModel model) throws Exception {
ScriptTask scriptTask = new ScriptTask();
BpmnXMLUtil.addXMLLocation(scriptTask, xtr);
scriptTask.setScriptFormat(xtr.getAttributeValue(null, ATTRIBUTE_TASK_SCRIPT_FORMAT));
scriptTask.setResultVariable(
xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SCRIPT_RESULTVARIABLE)
);
if (StringUtils.isEmpty(scriptTask.getResultVariable())) {
scriptTask.setResultVariable(
xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SERVICE_RESULTVARIABLE)
);
}
String autoStoreVariables = xtr.getAttributeValue(
ACTIVITI_EXTENSIONS_NAMESPACE,
ATTRIBUTE_TASK_SCRIPT_AUTO_STORE_VARIABLE
);
if (StringUtils.isNotEmpty(autoStoreVariables)) {
scriptTask.setAutoStoreVariables(Boolean.valueOf(autoStoreVariables));
}
parseChildElements(getXMLElementName(), scriptTask, childParserMap, model, xtr);
return scriptTask;
}
@Override
protected void writeAdditionalAttributes(BaseElement element, BpmnModel model, XMLStreamWriter xtw)
throws Exception {
ScriptTask scriptTask = (ScriptTask) element;
writeDefaultAttribute(ATTRIBUTE_TASK_SCRIPT_FORMAT, scriptTask.getScriptFormat(), xtw);
writeQualifiedAttribute(ATTRIBUTE_TASK_SCRIPT_RESULTVARIABLE, scriptTask.getResultVariable(), xtw); | writeQualifiedAttribute(
ATTRIBUTE_TASK_SCRIPT_AUTO_STORE_VARIABLE,
String.valueOf(scriptTask.isAutoStoreVariables()),
xtw
);
}
@Override
protected void writeAdditionalChildElements(BaseElement element, BpmnModel model, XMLStreamWriter xtw)
throws Exception {
ScriptTask scriptTask = (ScriptTask) element;
if (StringUtils.isNotEmpty(scriptTask.getScript())) {
xtw.writeStartElement(ATTRIBUTE_TASK_SCRIPT_TEXT);
xtw.writeCData(scriptTask.getScript());
xtw.writeEndElement();
}
}
} | repos\Activiti-develop\activiti-core\activiti-bpmn-converter\src\main\java\org\activiti\bpmn\converter\ScriptTaskXMLConverter.java | 1 |
请完成以下Java代码 | private UserView loginUser(String password, User user) {
var encodedPassword = user.getEncodedPassword();
if (!passwordService.matchesRowPasswordWithEncodedPassword(password, encodedPassword)) {
throw new InvalidRequestException("Password", "invalid");
}
return createAuthenticationResponse(user);
}
private UserView createAuthenticationResponse(User user) {
var token = tokenProvider.getToken(user.getId());
return UserView.fromUserAndToken(user, token);
}
private Mono<UserView> registerNewUser(UserRegistrationRequest request) {
var rowPassword = request.getPassword(); | var encodedPassword = passwordService.encodePassword(rowPassword);
var id = UUID.randomUUID().toString();
var user = request.toUser(encodedPassword, id);
return userRepository
.save(user)
.map(this::createAuthenticationResponse);
}
private InvalidRequestException usernameAlreadyInUseException() {
return new InvalidRequestException("Username", "already in use");
}
private InvalidRequestException emailAlreadyInUseException() {
return new InvalidRequestException("Email", "already in use");
}
} | repos\realworld-spring-webflux-master\src\main\java\com\realworld\springmongo\user\CredentialsService.java | 1 |
请完成以下Java代码 | private Optional<ch.qos.logback.classic.Logger> getLogger() {
return Optional.ofNullable(this.logger);
}
private Context resolveContext() {
return this.context != null
? this.context
: Optional.ofNullable(LoggerFactory.getILoggerFactory())
.filter(Context.class::isInstance)
.map(Context.class::cast)
.orElse(null);
}
private String resolveName() {
return this.name != null && !this.name.trim().isEmpty() ? this.name : DEFAULT_NAME;
}
private StringAppenderWrapper resolveStringAppenderWrapper() {
return this.useSynchronization
? StringBufferAppenderWrapper.create()
: StringBuilderAppenderWrapper.create();
}
public StringAppender build() {
StringAppender stringAppender =
new StringAppender(resolveStringAppenderWrapper());
stringAppender.setContext(resolveContext());
stringAppender.setName(resolveName());
getDelegate().ifPresent(delegate -> {
Appender appender = this.replace ? stringAppender
: CompositeAppender.compose(delegate.getAppender(), stringAppender);
delegate.setAppender(appender);
});
getLogger().ifPresent(logger -> logger.addAppender(stringAppender));
return stringAppender;
}
public StringAppender buildAndStart() {
StringAppender stringAppender = build();
stringAppender.start();
return stringAppender; | }
}
private final StringAppenderWrapper stringAppenderWrapper;
protected StringAppender(StringAppenderWrapper stringAppenderWrapper) {
if (stringAppenderWrapper == null) {
throw new IllegalArgumentException("StringAppenderWrapper must not be null");
}
this.stringAppenderWrapper = stringAppenderWrapper;
}
public String getLogOutput() {
return getStringAppenderWrapper().toString();
}
protected StringAppenderWrapper getStringAppenderWrapper() {
return this.stringAppenderWrapper;
}
@Override
protected void append(ILoggingEvent loggingEvent) {
Optional.ofNullable(loggingEvent)
.map(event -> preProcessLogMessage(toString(event)))
.filter(this::isValidLogMessage)
.ifPresent(getStringAppenderWrapper()::append);
}
protected boolean isValidLogMessage(String message) {
return message != null && !message.isEmpty();
}
protected String preProcessLogMessage(String message) {
return message != null ? message.trim() : null;
}
protected String toString(ILoggingEvent loggingEvent) {
return loggingEvent != null ? loggingEvent.getFormattedMessage() : null;
}
} | repos\spring-boot-data-geode-main\spring-geode-project\spring-geode-starters\spring-geode-starter-logging\src\main\java\org\springframework\geode\logging\slf4j\logback\StringAppender.java | 1 |
请完成以下Java代码 | public static boolean isValid(Pageable layout)
{
return true;
}
public static boolean isLicensed()
{
return true;
}
/**
* Converts given image to PDF.
*
* @param image
* @return PDF file as bytes array.
*/
public static byte[] toPDFBytes(final BufferedImage image)
{
try
{
//
// PDF Image
final ByteArrayOutputStream imageBytes = new ByteArrayOutputStream();
ImageIO.write(image, "PNG", imageBytes);
final Image pdfImage = Image.getInstance(imageBytes.toByteArray());
//
// PDF page size: image size + margins | final com.itextpdf.text.Rectangle pageSize = new com.itextpdf.text.Rectangle(0, 0,
(int)(pdfImage.getWidth() + 100),
(int)(pdfImage.getHeight() + 100));
// PDF document
final com.itextpdf.text.Document document = new com.itextpdf.text.Document(pageSize, 50, 50, 50, 50);
//
// Add image to document
final ByteArrayOutputStream pdfBytes = new ByteArrayOutputStream();
final PdfWriter writer = PdfWriter.getInstance(document, pdfBytes);
writer.open();
document.open();
document.add(pdfImage);
document.close();
writer.close();
return pdfBytes.toByteArray();
}
catch (final Exception e)
{
throw new AdempiereException("Failed converting the image to PDF", e);
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\adempiere\pdf\Document.java | 1 |
请完成以下Java代码 | public class ThirdLoginModel implements Serializable {
private static final long serialVersionUID = 4098628709290780891L;
/**
* 第三方登录 来源
*/
private String source;
/**
* 第三方登录 uuid
*/
private String uuid;
/**
* 第三方登录 username
*/
private String username;
/**
* 第三方登录 头像
*/
private String avatar;
/**
* 账号 后缀第三方登录 防止账号重复
*/
private String suffix;
/**
* 操作码 防止被攻击
*/
private String operateCode;
public ThirdLoginModel(){
} | /**
* 构造器
* @param source
* @param uuid
* @param username
* @param avatar
*/
public ThirdLoginModel(String source,String uuid,String username,String avatar){
this.source = source;
this.uuid = uuid;
this.username = username;
this.avatar = avatar;
}
/**
* 获取登录账号名
* @return
*/
public String getUserLoginAccount(){
if(suffix==null){
return this.uuid;
}
return this.uuid + this.suffix;
}
} | repos\JeecgBoot-main\jeecg-boot\jeecg-module-system\jeecg-system-biz\src\main\java\org\jeecg\modules\system\model\ThirdLoginModel.java | 1 |
请完成以下Java代码 | public void setProjInvoiceRule (final java.lang.String ProjInvoiceRule)
{
set_Value (COLUMNNAME_ProjInvoiceRule, ProjInvoiceRule);
}
@Override
public java.lang.String getProjInvoiceRule()
{
return get_ValueAsString(COLUMNNAME_ProjInvoiceRule);
}
@Override
public void setQty (final @Nullable 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\org\compiere\model\X_C_ProjectTask.java | 1 |
请完成以下Java代码 | public int getNatureFrequency(String nature)
{
try
{
Nature pos = Nature.create(nature);
return getNatureFrequency(pos);
}
catch (IllegalArgumentException e)
{
return 0;
}
}
/**
* 获取词性的词频
*
* @param nature 词性
* @return 词频
*/
public int getNatureFrequency(final Nature nature)
{
int i = 0;
for (Nature pos : this.nature)
{
if (nature == pos)
{
return frequency[i];
}
++i;
}
return 0;
}
/**
* 是否有某个词性
*
* @param nature
* @return
*/
public boolean hasNature(Nature nature)
{
return getNatureFrequency(nature) > 0;
}
/**
* 是否有以某个前缀开头的词性
*
* @param prefix 词性前缀,比如u会查询是否有ude, uzhe等等
* @return
*/
public boolean hasNatureStartsWith(String prefix)
{
for (Nature n : nature)
{
if (n.startsWith(prefix)) return true;
}
return false;
}
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder();
for (int i = 0; i < nature.length; ++i)
{
sb.append(nature[i]).append(' ').append(frequency[i]).append(' ');
}
return sb.toString();
}
public void save(DataOutputStream out) throws IOException
{ | out.writeInt(totalFrequency);
out.writeInt(nature.length);
for (int i = 0; i < nature.length; ++i)
{
out.writeInt(nature[i].ordinal());
out.writeInt(frequency[i]);
}
}
}
/**
* 获取词语的ID
*
* @param a 词语
* @return ID, 如果不存在, 则返回-1
*/
public static int getWordID(String a)
{
return CoreDictionary.trie.exactMatchSearch(a);
}
/**
* 热更新核心词典<br>
* 集群环境(或其他IOAdapter)需要自行删除缓存文件
*
* @return 是否成功
*/
public static boolean reload()
{
String path = CoreDictionary.path;
IOUtil.deleteFile(path + Predefine.BIN_EXT);
return load(path);
}
} | repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\dictionary\CoreDictionary.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public HTRSD1 getHTRSD1() {
return htrsd1;
}
/**
* Sets the value of the htrsd1 property.
*
* @param value
* allowed object is
* {@link HTRSD1 }
*
*/
public void setHTRSD1(HTRSD1 value) {
this.htrsd1 = value;
}
/**
* Gets the value of the htrsc1 property.
*
* @return
* possible object is
* {@link HTRSC1 }
*
*/
public HTRSC1 getHTRSC1() {
return htrsc1;
}
/**
* Sets the value of the htrsc1 property.
*
* @param value
* allowed object is
* {@link HTRSC1 }
*
*/
public void setHTRSC1(HTRSC1 value) {
this.htrsc1 = value;
}
/**
* Gets the value of the detail property.
*
* <p> | * This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the detail property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getDETAIL().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link DETAILXbest }
*
*
*/
public List<DETAILXbest> getDETAIL() {
if (detail == null) {
detail = new ArrayList<DETAILXbest>();
}
return this.detail;
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_stepcom_orders\de\metas\edi\esb\jaxb\stepcom\orders\HEADERXbest.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public String getReferenceDescription() {
return getReferenceDescription(this.resource, this.location);
}
/**
* Create a new {@link ConfigDataResourceNotFoundException} instance with a location.
* @param location the location to set
* @return a new {@link ConfigDataResourceNotFoundException} instance
*/
ConfigDataResourceNotFoundException withLocation(ConfigDataLocation location) {
return new ConfigDataResourceNotFoundException(this.resource, location, getCause());
}
private static String getMessage(ConfigDataResource resource, @Nullable ConfigDataLocation location) {
return String.format("Config data %s cannot be found", getReferenceDescription(resource, location));
}
private static String getReferenceDescription(ConfigDataResource resource, @Nullable ConfigDataLocation location) {
String description = String.format("resource '%s'", resource);
if (location != null) {
description += String.format(" via location '%s'", location);
}
return description;
}
/**
* Throw a {@link ConfigDataNotFoundException} if the specified {@link Path} does not
* exist.
* @param resource the config data resource
* @param pathToCheck the path to check
*/
public static void throwIfDoesNotExist(ConfigDataResource resource, Path pathToCheck) {
throwIfNot(resource, Files.exists(pathToCheck)); | }
/**
* Throw a {@link ConfigDataNotFoundException} if the specified {@link File} does not
* exist.
* @param resource the config data resource
* @param fileToCheck the file to check
*/
public static void throwIfDoesNotExist(ConfigDataResource resource, File fileToCheck) {
throwIfNot(resource, fileToCheck.exists());
}
/**
* Throw a {@link ConfigDataNotFoundException} if the specified {@link Resource} does
* not exist.
* @param resource the config data resource
* @param resourceToCheck the resource to check
*/
public static void throwIfDoesNotExist(ConfigDataResource resource, Resource resourceToCheck) {
throwIfNot(resource, resourceToCheck.exists());
}
private static void throwIfNot(ConfigDataResource resource, boolean check) {
if (!check) {
throw new ConfigDataResourceNotFoundException(resource);
}
}
} | repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\context\config\ConfigDataResourceNotFoundException.java | 2 |
请完成以下Spring Boot application配置 | server:
port: 8080
servlet:
context-path: /demo
spring:
redis:
host: localhost
# 连接超时时间(记得添加单位,Duration)
timeout: 10000ms
# Redis默认情况下有16个分片,这里配置具体使用的分片
# database: 0
lettuce:
pool:
# 连接池最大连接数(使用负值表示没有限制) 默认 8
max-active: 8
# 连接池最大阻塞等待时间(使用负 | 值表示没有限制) 默认 -1
max-wait: -1ms
# 连接池中的最大空闲连接 默认 8
max-idle: 8
# 连接池中的最小空闲连接 默认 0
min-idle: 0 | repos\spring-boot-demo-master\demo-ratelimit-redis\src\main\resources\application.yml | 2 |
请完成以下Java代码 | public static void logFieldDetails() {
JavaClass solarSystemClass = heap.getJavaClassByName("com.baeldung.netbeanprofiler.galaxy.SolarSystem");
if (solarSystemClass == null) {
LOGGER.error("Class not found");
return;
}
List<Field> fields = solarSystemClass.getFields();
for (Field field : fields) {
LOGGER.info("Field: " + field.getName());
LOGGER.info("Type: " + field.getType().getName());
}
}
public static void analyzeGCRoots() {
LOGGER.info("Analyzing GC Roots:");
Collection<GCRoot> gcRoots = heap.getGCRoots();
if (gcRoots == null) {
LOGGER.error("No GC Roots found");
return;
}
LOGGER.info("Total GC Roots: " + gcRoots.size());
int threadObj = 0, jniGlobal = 0, jniLocal = 0, javaFrame = 0, other = 0;
for (GCRoot gcRoot : gcRoots) {
Instance instance = gcRoot.getInstance();
String kind = gcRoot.getKind();
switch (kind) {
case THREAD_OBJECT:
threadObj++;
break;
case JNI_GLOBAL:
jniGlobal++;
break;
case JNI_LOCAL:
jniLocal++;
break;
case JAVA_FRAME:
javaFrame++; | break;
default:
other++;
}
if (threadObj + jniGlobal + jniLocal + javaFrame + other <= 10) {
LOGGER.info(" GC Root: " + instance.getJavaClass().getName());
LOGGER.info(" Kind: " + kind);
LOGGER.info(" Size: " + instance.getSize() + " bytes");
}
}
LOGGER.info("\nGC Root Summary:");
LOGGER.info(" Thread Objects: " + threadObj);
LOGGER.info(" JNI Global References: " + jniGlobal);
LOGGER.info(" JNI Local References: " + jniLocal);
LOGGER.info(" Java Frames: " + javaFrame);
LOGGER.info(" Other: " + other);
}
public static void analyzeClassHistogram() {
LOGGER.info("\nClass Histogram (Top 10 by instance count):");
List<JavaClass> unmodifiableClasses = heap.getAllClasses();
if (unmodifiableClasses == null) {
LOGGER.error("No classes found");
return;
}
List<JavaClass> classes = new ArrayList<>(unmodifiableClasses);
classes.sort((c1, c2) -> Long.compare(c2.getInstancesCount(), c1.getInstancesCount()));
for (int i = 0; i < Math.min(10, classes.size()); i++) {
JavaClass javaClass = classes.get(i);
LOGGER.info(" " + javaClass.getName());
LOGGER.info(" Instances: " + javaClass.getInstancesCount());
LOGGER.info(" Total size: " + javaClass.getAllInstancesSize() + " bytes");
}
}
} | repos\tutorials-master\core-java-modules\core-java-perf-2\src\main\java\com\baeldung\netbeanprofiler\SolApp.java | 1 |
请完成以下Java代码 | public boolean isRequiredMailAddres ()
{
Object oo = get_Value(COLUMNNAME_IsRequiredMailAddres);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/**
* MarketingPlatformGatewayId AD_Reference_ID=540858
* Reference name: MarketingPlatformGatewayId
*/
public static final int MARKETINGPLATFORMGATEWAYID_AD_Reference_ID=540858;
/** CleverReach = CleverReach */
public static final String MARKETINGPLATFORMGATEWAYID_CleverReach = "CleverReach";
/** Set Marketing Platform GatewayId.
@param MarketingPlatformGatewayId Marketing Platform GatewayId */
@Override
public void setMarketingPlatformGatewayId (java.lang.String MarketingPlatformGatewayId)
{
set_Value (COLUMNNAME_MarketingPlatformGatewayId, MarketingPlatformGatewayId);
}
/** Get Marketing Platform GatewayId.
@return Marketing Platform GatewayId */
@Override
public java.lang.String getMarketingPlatformGatewayId ()
{
return (java.lang.String)get_Value(COLUMNNAME_MarketingPlatformGatewayId);
}
/** Set MKTG_Platform.
@param MKTG_Platform_ID MKTG_Platform */
@Override
public void setMKTG_Platform_ID (int MKTG_Platform_ID) | {
if (MKTG_Platform_ID < 1)
set_ValueNoCheck (COLUMNNAME_MKTG_Platform_ID, null);
else
set_ValueNoCheck (COLUMNNAME_MKTG_Platform_ID, Integer.valueOf(MKTG_Platform_ID));
}
/** Get MKTG_Platform.
@return MKTG_Platform */
@Override
public int getMKTG_Platform_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_MKTG_Platform_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
@Override
public void setName (java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
@Override
public java.lang.String getName ()
{
return (java.lang.String)get_Value(COLUMNNAME_Name);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.marketing\base\src\main\java-gen\de\metas\marketing\base\model\X_MKTG_Platform.java | 1 |
请完成以下Java代码 | public void setAD_User_ID (int AD_User_ID)
{
if (AD_User_ID < 1)
set_Value (COLUMNNAME_AD_User_ID, null);
else
set_Value (COLUMNNAME_AD_User_ID, Integer.valueOf(AD_User_ID));
}
/** Get User/Contact.
@return User within the system - Internal or Business Partner Contact
*/
public int getAD_User_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Org Assignment.
@param C_OrgAssignment_ID
Assigment to (transaction) Organization
*/
public void setC_OrgAssignment_ID (int C_OrgAssignment_ID)
{
if (C_OrgAssignment_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_OrgAssignment_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_OrgAssignment_ID, Integer.valueOf(C_OrgAssignment_ID));
}
/** Get Org Assignment.
@return Assigment to (transaction) Organization
*/
public int getC_OrgAssignment_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_OrgAssignment_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
} | /** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Set Valid from.
@param ValidFrom
Valid from including this date (first day)
*/
public void setValidFrom (Timestamp ValidFrom)
{
set_Value (COLUMNNAME_ValidFrom, ValidFrom);
}
/** Get Valid from.
@return Valid from including this date (first day)
*/
public Timestamp getValidFrom ()
{
return (Timestamp)get_Value(COLUMNNAME_ValidFrom);
}
/** Set Valid to.
@param ValidTo
Valid to including this date (last day)
*/
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);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_OrgAssignment.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public String getMetaInfo() {
return metaInfo;
}
public void setMetaInfo(String metaInfo) {
this.metaInfo = metaInfo;
this.metaInfoChanged = true;
}
@ApiModelProperty(example = "7")
public String getDeploymentId() {
return deploymentId;
}
public void setDeploymentId(String deploymentId) {
this.deploymentId = deploymentId;
this.deploymentChanged = true;
}
public void setTenantId(String tenantId) {
tenantChanged = true;
this.tenantId = tenantId;
}
@ApiModelProperty(example = "null")
public String getTenantId() {
return tenantId;
}
@JsonIgnore
public boolean isCategoryChanged() {
return categoryChanged;
}
@JsonIgnore
public boolean isKeyChanged() {
return keyChanged;
}
@JsonIgnore
public boolean isMetaInfoChanged() {
return metaInfoChanged;
} | @JsonIgnore
public boolean isNameChanged() {
return nameChanged;
}
@JsonIgnore
public boolean isVersionChanged() {
return versionChanged;
}
@JsonIgnore
public boolean isDeploymentChanged() {
return deploymentChanged;
}
@JsonIgnore
public boolean isTenantIdChanged() {
return tenantChanged;
}
} | repos\flowable-engine-main\modules\flowable-rest\src\main\java\org\flowable\rest\service\api\repository\ModelRequest.java | 2 |
请完成以下Java代码 | public final class PlainStringLoggable implements ILoggable
{
private final List<String> messages = new ArrayList<>();
PlainStringLoggable()
{
}
@Override
public ILoggable addLog(String msg, Object... msgParameters)
{
final String formattedMessage = StringUtils.formatMessage(msg, msgParameters);
messages.add(formattedMessage);
return this;
}
public boolean isEmpty() | {
return messages.isEmpty();
}
public ImmutableList<String> getSingleMessages()
{
return ImmutableList.copyOf(messages);
}
public String getConcatenatedMessages()
{
return Joiner.on("\n").join(messages);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\de\metas\util\PlainStringLoggable.java | 1 |
请完成以下Java代码 | public void notify(DmnDecisionEvaluationEvent evaluationEvent) {
HistoryEvent historyEvent = createHistoryEvent(evaluationEvent);
if(historyEvent != null) {
Context.getProcessEngineConfiguration()
.getHistoryEventHandler()
.handleEvent(historyEvent);
}
}
protected HistoryEvent createHistoryEvent(DmnDecisionEvaluationEvent evaluationEvent) {
if (historyLevel == null) {
historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel();
}
DmnDecision decisionTable = evaluationEvent.getDecisionResult().getDecision();
if(isDeployedDecisionTable(decisionTable) && historyLevel.isHistoryEventProduced(HistoryEventTypes.DMN_DECISION_EVALUATE, decisionTable)) {
CoreExecutionContext<? extends CoreExecution> executionContext = Context.getCoreExecutionContext();
if (executionContext != null) {
CoreExecution coreExecution = executionContext.getExecution();
if (coreExecution instanceof ExecutionEntity) {
ExecutionEntity execution = (ExecutionEntity) coreExecution;
return eventProducer.createDecisionEvaluatedEvt(execution, evaluationEvent);
}
else if (coreExecution instanceof CaseExecutionEntity) {
CaseExecutionEntity caseExecution = (CaseExecutionEntity) coreExecution; | return eventProducer.createDecisionEvaluatedEvt(caseExecution, evaluationEvent);
}
}
return eventProducer.createDecisionEvaluatedEvt(evaluationEvent);
} else {
return null;
}
}
protected boolean isDeployedDecisionTable(DmnDecision decision) {
if(decision instanceof DecisionDefinition) {
return ((DecisionDefinition) decision).getId() != null;
} else {
return false;
}
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\history\parser\HistoryDecisionEvaluationListener.java | 1 |
请完成以下Java代码 | protected void definitionAddedToDeploymentCache(DeploymentEntity deployment, DefinitionEntity definition, Properties properties) {
// do nothing
}
/**
* per default we increment the latest definition version by one - but you
* might want to hook in some own logic here, e.g. to align definition
* versions with deployment / build versions.
*/
protected int getNextVersion(DeploymentEntity deployment, DefinitionEntity newDefinition, DefinitionEntity latestDefinition) {
int result = 1;
if (latestDefinition != null) {
int latestVersion = latestDefinition.getVersion();
result = latestVersion + 1;
}
return result;
}
/**
* create an id for the definition. The default is to ask the {@link IdGenerator}
* and add the definition key and version if that does not exceed 64 characters.
* You might want to hook in your own implementation here.
*/
protected String generateDefinitionId(DeploymentEntity deployment, DefinitionEntity newDefinition, DefinitionEntity latestDefinition) {
String nextId = idGenerator.getNextId();
String definitionKey = newDefinition.getKey();
int definitionVersion = newDefinition.getVersion(); | String definitionId = definitionKey
+ ":" + definitionVersion
+ ":" + nextId;
// ACT-115: maximum id length is 64 characters
if (definitionId.length() > 64) {
definitionId = nextId;
}
return definitionId;
}
protected ProcessEngineConfigurationImpl getProcessEngineConfiguration() {
return Context.getProcessEngineConfiguration();
}
protected CommandContext getCommandContext() {
return Context.getCommandContext();
}
protected DeploymentCache getDeploymentCache() {
return getProcessEngineConfiguration().getDeploymentCache();
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\AbstractDefinitionDeployer.java | 1 |
请完成以下Java代码 | public class DATEV_CreateExportLines extends JavaProcess implements IProcessPrecondition
{
private final DATEVExportLinesRepository datevExportLinesRepo = SpringContextHolder.instance.getBean(DATEVExportLinesRepository.class);
private final ISysConfigBL sysConfigBL = Services.get(ISysConfigBL.class);
private static final String SYS_CONFIG_ONE_LINE_PER_INVOICETAX = "DATEVExportLines_OneLinePerInvoiceTax";
@Override
public ProcessPreconditionsResolution checkPreconditionsApplicable(final IProcessPreconditionsContext context)
{
if (context.isNoSelection())
{
return ProcessPreconditionsResolution.rejectBecauseNoSelection();
}
else if (!context.isSingleSelection())
{
return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection();
}
return ProcessPreconditionsResolution.accept(); | }
@Override
protected String doIt() throws Exception
{
final int countCreated = datevExportLinesRepo.createLines(
DATEVExportCreateLinesRequest.builder()
.datevExportId(DATEVExportId.ofRepoId(getRecord_ID()))
.now(SystemTime.asInstant())
.userId(getUserId())
.isOneLinePerInvoiceTax(isOneLinePerInvoiceTax())
.build());
return "@Created@ #" + countCreated;
}
private boolean isOneLinePerInvoiceTax()
{
return sysConfigBL.getBooleanValue(SYS_CONFIG_ONE_LINE_PER_INVOICETAX, false);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.datev\src\main\java\de\metas\datev\process\DATEV_CreateExportLines.java | 1 |
请完成以下Java代码 | public Builder modifiers(int modifiers) {
this.modifiers = modifiers;
return this;
}
/**
* Sets the return type.
* @param returnType the return type
* @return this for method chaining
*/
public Builder returning(String returnType) {
this.returnType = returnType;
return this;
}
/**
* Sets the parameters.
* @param parameters the parameters
* @return this for method chaining
*/ | public Builder parameters(Parameter... parameters) {
this.parameters = Arrays.asList(parameters);
return this;
}
/**
* Sets the body.
* @param code the code for the body
* @return the method for the body
*/
public GroovyMethodDeclaration body(CodeBlock code) {
return new GroovyMethodDeclaration(this, code);
}
}
} | repos\initializr-main\initializr-generator\src\main\java\io\spring\initializr\generator\language\groovy\GroovyMethodDeclaration.java | 1 |
请完成以下Java代码 | private void updateNotInAnyWarehouseFlag()
{
notInAnyWarehouse = onlyInWarehouseIds.isEmpty();
}
public void addOnlyInLocatorRepoId(final int locatorId)
{
Check.assumeGreaterThanZero(locatorId, "locatorId");
onlyInLocatorIds.add(locatorId);
}
public void addOnlyInLocatorId(@NonNull final LocatorId locatorId)
{
onlyInLocatorIds.add(locatorId.getRepoId());
}
public void addOnlyInLocatorRepoIds(final Collection<Integer> locatorIds)
{
if (locatorIds != null && !locatorIds.isEmpty())
{
locatorIds.forEach(this::addOnlyInLocatorRepoId);
} | }
public void addOnlyInLocatorIds(final Collection<LocatorId> locatorIds)
{
if (locatorIds != null && !locatorIds.isEmpty())
{
locatorIds.forEach(this::addOnlyInLocatorId);
}
}
public void setExcludeAfterPickingLocator(final boolean excludeAfterPickingLocator)
{
this.excludeAfterPickingLocator = excludeAfterPickingLocator;
}
public void setIncludeAfterPickingLocator(final boolean includeAfterPickingLocator)
{
this.includeAfterPickingLocator = includeAfterPickingLocator;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\impl\HUQueryBuilder_Locator.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class ServerTransportConfig {
public static final int DEFAULT_PORT = 18730;
public static final int DEFAULT_IDLE_SECONDS = 600;
private Integer port;
private Integer idleSeconds;
public ServerTransportConfig() {
this(DEFAULT_PORT, DEFAULT_IDLE_SECONDS);
}
public ServerTransportConfig(Integer port, Integer idleSeconds) {
this.port = port;
this.idleSeconds = idleSeconds;
}
public Integer getPort() {
return port;
}
public ServerTransportConfig setPort(Integer port) {
this.port = port;
return this;
}
public Integer getIdleSeconds() {
return idleSeconds; | }
public ServerTransportConfig setIdleSeconds(Integer idleSeconds) {
this.idleSeconds = idleSeconds;
return this;
}
@Override
public String toString() {
return "ServerTransportConfig{" +
"port=" + port +
", idleSeconds=" + idleSeconds +
'}';
}
} | repos\spring-boot-student-master\spring-boot-student-sentinel-dashboard\src\main\java\com\alibaba\csp\sentinel\dashboard\domain\cluster\config\ServerTransportConfig.java | 2 |
请完成以下Spring Boot application配置 | # In tests we have to disable the embedded ldap as it has issues when booting multiple contexts
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.ldap.embedded.EmbeddedLd | apAutoConfiguration
flowable.process-definition-location-prefix=classpath*:/none/ | repos\flowable-engine-main\modules\flowable-spring-boot\flowable-spring-boot-samples\flowable-spring-boot-sample-ldap\src\main\resources\application-test.properties | 2 |
请完成以下Java代码 | public void setMSV3_BestellSupportId (int MSV3_BestellSupportId)
{
set_Value (COLUMNNAME_MSV3_BestellSupportId, Integer.valueOf(MSV3_BestellSupportId));
}
/** Get BestellSupportId.
@return BestellSupportId */
@Override
public int getMSV3_BestellSupportId ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_MSV3_BestellSupportId);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set MSV3_Bestellung.
@param MSV3_Bestellung_ID MSV3_Bestellung */
@Override
public void setMSV3_Bestellung_ID (int MSV3_Bestellung_ID)
{
if (MSV3_Bestellung_ID < 1)
set_ValueNoCheck (COLUMNNAME_MSV3_Bestellung_ID, null);
else
set_ValueNoCheck (COLUMNNAME_MSV3_Bestellung_ID, Integer.valueOf(MSV3_Bestellung_ID));
}
/** Get MSV3_Bestellung.
@return MSV3_Bestellung */
@Override
public int getMSV3_Bestellung_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_MSV3_Bestellung_ID);
if (ii == null)
return 0;
return ii.intValue(); | }
/** Set Id.
@param MSV3_Id Id */
@Override
public void setMSV3_Id (java.lang.String MSV3_Id)
{
set_Value (COLUMNNAME_MSV3_Id, MSV3_Id);
}
/** Get Id.
@return Id */
@Override
public java.lang.String getMSV3_Id ()
{
return (java.lang.String)get_Value(COLUMNNAME_MSV3_Id);
}
} | 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_Bestellung.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public final class PathPatternMessageMatcherBuilderFactoryBean
implements FactoryBean<PathPatternMessageMatcher.Builder> {
private PathPatternParser parser;
/**
* Create {@link PathPatternMessageMatcher}s using
* {@link PathPatternParser#defaultInstance}
*/
public PathPatternMessageMatcherBuilderFactoryBean() {
}
/**
* Create {@link PathPatternMessageMatcher}s using the given {@link PathPatternParser}
* @param parser the {@link PathPatternParser} to use
*/ | public PathPatternMessageMatcherBuilderFactoryBean(PathPatternParser parser) {
this.parser = parser;
}
@Override
public PathPatternMessageMatcher.Builder getObject() throws Exception {
if (this.parser == null) {
return PathPatternMessageMatcher.withDefaults();
}
return PathPatternMessageMatcher.withPathPatternParser(this.parser);
}
@Override
public Class<?> getObjectType() {
return PathPatternMessageMatcher.Builder.class;
}
} | repos\spring-security-main\config\src\main\java\org\springframework\security\config\web\messaging\PathPatternMessageMatcherBuilderFactoryBean.java | 2 |
请完成以下Java代码 | public String getColumnNameNotFQ()
{
return I_C_ValidCombination.COLUMNNAME_C_ValidCombination_ID;
} // getColumnName
/**
* Return data as sorted Array. Used in Web Interface
*
* @param mandatory mandatory
* @param onlyValidated only valid
* @param onlyActive only active
* @param temporary force load for temporary display
* @return ArrayList with KeyNamePair
*/
@Override
public ArrayList<Object> getData(boolean mandatory, boolean onlyValidated, boolean onlyActive, boolean temporary)
{
ArrayList<Object> list = new ArrayList<>();
if (!mandatory)
list.add(KeyNamePair.EMPTY);
//
ArrayList<Object> params = new ArrayList<>();
String whereClause = "AD_Client_ID=?";
params.add(Env.getAD_Client_ID(m_ctx));
List<MAccount> accounts = new Query(m_ctx, MAccount.Table_Name, whereClause, ITrx.TRXNAME_None)
.setParameters(params)
.setOrderBy(MAccount.COLUMNNAME_Combination)
.setOnlyActiveRecords(onlyActive) | .list(MAccount.class);
for (final I_C_ValidCombination account : accounts)
{
list.add(new KeyNamePair(account.getC_ValidCombination_ID(), account.getCombination() + " - " + account.getDescription()));
}
// Sort & return
return list;
} // getData
public int getC_ValidCombination_ID()
{
return C_ValidCombination_ID;
}
} // MAccountLookup | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MAccountLookup.java | 1 |
请完成以下Java代码 | public class DebugRequestInterceptor implements ConnectorRequestInterceptor {
protected Object response;
protected boolean proceed;
private ConnectorRequest<?> request;
private Object target;
public DebugRequestInterceptor() {
this(true);
}
public DebugRequestInterceptor(boolean proceed) {
this.proceed = proceed;
}
public DebugRequestInterceptor(Object response) {
this.response = response;
this.proceed = false;
}
public Object handleInvocation(ConnectorInvocation invocation) throws Exception {
request = invocation.getRequest();
target = invocation.getTarget();
if (proceed) {
return invocation.proceed();
} else {
return response;
}
} | public void setProceed(boolean proceed) {
this.proceed = proceed;
}
public boolean isProceed() {
return proceed;
}
public void setResponse(Object response) {
this.response = response;
}
@SuppressWarnings("unchecked")
public <T> T getResponse() {
return (T) response;
}
@SuppressWarnings("unchecked")
public <T extends ConnectorRequest<?>> T getRequest() {
return (T) request;
}
@SuppressWarnings("unchecked")
public <T> T getTarget() {
return (T) target;
}
} | repos\camunda-bpm-platform-master\connect\core\src\main\java\org\camunda\connect\impl\DebugRequestInterceptor.java | 1 |
请完成以下Java代码 | public void addNamespace(String prefix, String uri) {
namespaceMap.put(prefix, uri);
}
public boolean containsNamespacePrefix(String prefix) {
return namespaceMap.containsKey(prefix);
}
public String getNamespace(String prefix) {
return namespaceMap.get(prefix);
}
public Map<String, String> getNamespaces() {
return namespaceMap;
}
public Map<String, List<ExtensionAttribute>> getDefinitionsAttributes() {
return definitionsAttributes;
}
public String getDefinitionsAttributeValue(String namespace, String name) {
List<ExtensionAttribute> attributes = getDefinitionsAttributes().get(name);
if (attributes != null && !attributes.isEmpty()) {
for (ExtensionAttribute attribute : attributes) {
if (namespace.equals(attribute.getNamespace())) {
return attribute.getValue();
}
}
}
return null;
}
public void addDefinitionsAttribute(ExtensionAttribute attribute) { | if (attribute != null && StringUtils.isNotEmpty(attribute.getName())) {
List<ExtensionAttribute> attributeList = null;
if (!this.definitionsAttributes.containsKey(attribute.getName())) {
attributeList = new ArrayList<>();
this.definitionsAttributes.put(attribute.getName(), attributeList);
}
this.definitionsAttributes.get(attribute.getName()).add(attribute);
}
}
public void setDefinitionsAttributes(Map<String, List<ExtensionAttribute>> attributes) {
this.definitionsAttributes = attributes;
}
} | repos\flowable-engine-main\modules\flowable-cmmn-model\src\main\java\org\flowable\cmmn\model\CmmnModel.java | 1 |
请完成以下Java代码 | public void addLabelGraphicInfoByDiagramId(String diagramId, String key, GraphicInfo graphicInfo) {
labelLocationByDiagramIdMap.computeIfAbsent(diagramId, k -> new LinkedHashMap<>());
labelLocationByDiagramIdMap.get(diagramId).put(key, graphicInfo);
labelLocationMap.put(key, graphicInfo);
}
public void removeLabelGraphicInfo(String key) {
flowLocationMap.remove(key);
}
public Map<String, Map<String, List<GraphicInfo>>> getDecisionServiceDividerLocationByDiagramIdMap() {
return decisionServiceDividerLocationByDiagramIdMap;
}
public Map<String, List<GraphicInfo>> getDecisionServiceDividerLocationMapByDiagramId(String diagramId) {
return decisionServiceDividerLocationByDiagramIdMap.get(diagramId);
}
public Map<String, List<GraphicInfo>> getDecisionServiceDividerLocationMap() {
return decisionServiceDividerLocationMap;
}
public List<GraphicInfo> getDecisionServiceDividerGraphicInfo(String key) {
return decisionServiceDividerLocationMap.get(key);
}
public void addDecisionServiceDividerGraphicInfoList(String key, List<GraphicInfo> graphicInfoList) {
decisionServiceDividerLocationMap.put(key, graphicInfoList);
}
public void addDecisionServiceDividerGraphicInfoListByDiagramId(String diagramId, String key, List<GraphicInfo> graphicInfoList) {
decisionServiceDividerLocationByDiagramIdMap.computeIfAbsent(diagramId, k -> new LinkedHashMap<>());
decisionServiceDividerLocationByDiagramIdMap.get(diagramId).put(key, graphicInfoList);
decisionServiceDividerLocationMap.put(key, graphicInfoList);
}
public String getExporter() {
return exporter;
} | public void setExporter(String exporter) {
this.exporter = exporter;
}
public String getExporterVersion() {
return exporterVersion;
}
public void setExporterVersion(String exporterVersion) {
this.exporterVersion = exporterVersion;
}
public Map<String, String> getNamespaces() {
return namespaceMap;
}
public void addNamespace(String prefix, String uri) {
namespaceMap.put(prefix, uri);
}
} | repos\flowable-engine-main\modules\flowable-dmn-model\src\main\java\org\flowable\dmn\model\DmnDefinition.java | 1 |
请完成以下Java代码 | public List<FormDefinition> execute(CommandContext commandContext) {
CaseDefinition caseDefinition = CaseDefinitionUtil.getCaseDefinition(caseDefinitionId);
if (caseDefinition == null) {
throw new FlowableObjectNotFoundException("Cannot find case definition for id: " + caseDefinitionId, CaseDefinition.class);
}
Case caseModel = CaseDefinitionUtil.getCase(caseDefinitionId);
if (caseModel == null) {
throw new FlowableObjectNotFoundException("Cannot find case definition for id: " + caseDefinitionId, Case.class);
}
formRepositoryService = CommandContextUtil.getFormEngineConfiguration(commandContext).getFormRepositoryService();
if (formRepositoryService == null) {
throw new FlowableException("Form repository service is not available");
}
List<FormDefinition> formDefinitions = getFormDefinitionsFromModel(caseModel, caseDefinition);
return formDefinitions;
}
protected List<FormDefinition> getFormDefinitionsFromModel(Case caseModel, CaseDefinition caseDefinition) {
Set<String> formKeys = new HashSet<>();
List<FormDefinition> formDefinitions = new ArrayList<>();
// for all user tasks
List<HumanTask> humanTasks = caseModel.getPlanModel().findPlanItemDefinitionsOfType(HumanTask.class, true);
for (HumanTask humanTask : humanTasks) {
if (StringUtils.isNotEmpty(humanTask.getFormKey())) {
formKeys.add(humanTask.getFormKey());
}
}
for (String formKey : formKeys) {
addFormDefinitionToCollection(formDefinitions, formKey, caseDefinition);
}
return formDefinitions;
} | protected void addFormDefinitionToCollection(List<FormDefinition> formDefinitions, String formKey, CaseDefinition caseDefinition) {
FormDefinitionQuery formDefinitionQuery = formRepositoryService.createFormDefinitionQuery().formDefinitionKey(formKey);
CmmnDeployment deployment = CommandContextUtil.getCmmnDeploymentEntityManager().findById(caseDefinition.getDeploymentId());
if (deployment.getParentDeploymentId() != null) {
List<FormDeployment> formDeployments = formRepositoryService.createDeploymentQuery().parentDeploymentId(deployment.getParentDeploymentId()).list();
if (formDeployments != null && formDeployments.size() > 0) {
formDefinitionQuery.deploymentId(formDeployments.get(0).getId());
} else {
formDefinitionQuery.latestVersion();
}
} else {
formDefinitionQuery.latestVersion();
}
FormDefinition formDefinition = formDefinitionQuery.singleResult();
if (formDefinition != null) {
formDefinitions.add(formDefinition);
}
}
} | repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\cmd\GetFormDefinitionsForCaseDefinitionCmd.java | 1 |
请完成以下Java代码 | public void onCompleted() {
logger.info("Finished getBidirectionalCommodityPriceLists");
finishLatch.countDown();
}
@Override
public void onError(Throwable t) {
logger.error("getBidirectionalCommodityPriceLists Failed:" + Status.fromThrowable(t));
finishLatch.countDown();
}
};
StreamObserver<Commodity> requestObserver = nonBlockingStub.bidirectionalListOfPrices(responseObserver);
try {
for (int i = 1; i <= 2; i++) {
Commodity request = Commodity.newBuilder()
.setCommodityName("Commodity" + i)
.setAccessToken(i + "23validToken")
.build();
logger.info("REQUEST - commodity:" + request.getCommodityName());
requestObserver.onNext(request);
Thread.sleep(200);
if (finishLatch.getCount() == 0) {
return;
}
}
} catch (RuntimeException e) {
requestObserver.onError(e);
throw e;
}
requestObserver.onCompleted();
if (!finishLatch.await(1, TimeUnit.MINUTES)) {
logger.info("getBidirectionalCommodityPriceLists can not finish within 1 minute");
}
}
public static void main(String[] args) throws InterruptedException, InvalidProtocolBufferException {
String target = "localhost:8980"; | if (args.length > 0) {
target = args[0];
}
ManagedChannel channel = ManagedChannelBuilder.forTarget(target)
.usePlaintext()
.build();
try {
CommodityClient client = new CommodityClient(channel);
client.getBidirectionalCommodityPriceLists();
} finally {
channel.shutdownNow()
.awaitTermination(5, TimeUnit.SECONDS);
}
}
} | repos\tutorials-master\grpc\src\main\java\com\baeldung\grpc\errorhandling\CommodityClient.java | 1 |
请完成以下Java代码 | public void setEMail_From (final @Nullable java.lang.String EMail_From)
{
set_ValueNoCheck (COLUMNNAME_EMail_From, EMail_From);
}
@Override
public java.lang.String getEMail_From()
{
return get_ValueAsString(COLUMNNAME_EMail_From);
}
@Override
public void setEMail_To (final @Nullable java.lang.String EMail_To)
{
set_ValueNoCheck (COLUMNNAME_EMail_To, EMail_To);
}
@Override
public java.lang.String getEMail_To()
{
return get_ValueAsString(COLUMNNAME_EMail_To);
}
@Override
public void setPrinterName (final @Nullable java.lang.String PrinterName)
{
set_ValueNoCheck (COLUMNNAME_PrinterName, PrinterName);
}
@Override
public java.lang.String getPrinterName()
{
return get_ValueAsString(COLUMNNAME_PrinterName);
}
@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);
}
/** | * Status AD_Reference_ID=542015
* Reference name: OutboundLogLineStatus
*/
public static final int STATUS_AD_Reference_ID=542015;
/** Print_Success = Print_Success */
public static final String STATUS_Print_Success = "Print_Success";
/** Print_Failure = Print_Failure */
public static final String STATUS_Print_Failure = "Print_Failure";
/** Email_Success = Email_Success */
public static final String STATUS_Email_Success = "Email_Success";
/** Email_Failure = Email_Failure */
public static final String STATUS_Email_Failure = "Email_Failure";
@Override
public void setStatus (final @Nullable java.lang.String Status)
{
set_ValueNoCheck (COLUMNNAME_Status, Status);
}
@Override
public java.lang.String getStatus()
{
return get_ValueAsString(COLUMNNAME_Status);
}
@Override
public void setStoreURI (final @Nullable java.lang.String StoreURI)
{
set_Value (COLUMNNAME_StoreURI, StoreURI);
}
@Override
public java.lang.String getStoreURI()
{
return get_ValueAsString(COLUMNNAME_StoreURI);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.document.archive\de.metas.document.archive.base\src\main\java-gen\de\metas\document\archive\model\X_C_Doc_Outbound_Log_Line.java | 1 |
请完成以下Java代码 | public String getPropertyName() {
return propertyName;
}
public void setPropertyName(String propertyName) {
this.propertyName = propertyName;
}
public Object getOrgValue() {
return orgValue;
}
public void setOrgValue(Object orgValue) {
this.orgValue = orgValue;
}
public Object getNewValue() {
return newValue;
}
public void setNewValue(Object newValue) {
this.newValue = newValue;
}
public String getNewValueString() {
return valueAsString(newValue);
} | public String getOrgValueString() {
return valueAsString(orgValue);
}
protected String valueAsString(Object value) {
if(value == null) {
return null;
} else if(value instanceof Date){
return String.valueOf(((Date)value).getTime());
} else {
return value.toString();
}
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\PropertyChange.java | 1 |
请完成以下Java代码 | public static DeserializationException byteArrayToDeserializationException(LogAccessor logger, Header header) {
if (header != null && !(header instanceof DeserializationExceptionHeader)) {
throw new IllegalStateException("Foreign deserialization exception header ignored; possible attack?");
}
try {
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(header.value())) {
boolean first = true;
@Override
protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
if (this.first) {
this.first = false;
Assert.state(desc.getName().equals(DeserializationException.class.getName()), | "Header does not contain a DeserializationException");
}
return super.resolveClass(desc);
}
};
return (DeserializationException) ois.readObject();
}
catch (IOException | ClassNotFoundException | ClassCastException e) {
logger.error(e, "Failed to deserialize a deserialization exception");
return null;
}
}
} | repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\support\serializer\SerializationUtils.java | 1 |
请完成以下Java代码 | public String getCreateUserId() {
return createUserId;
}
public void setCreateUserId(String createUserId) {
this.createUserId = createUserId;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
@Override
public Date getExecutionStartTime() {
return executionStartTime;
}
public void setExecutionStartTime(final Date executionStartTime) {
this.executionStartTime = executionStartTime;
}
@Override | public Object getPersistentState() {
Map<String, Object> persistentState = new HashMap<String, Object>();
persistentState.put("endTime", endTime);
persistentState.put("executionStartTime", executionStartTime);
return persistentState;
}
public void delete() {
HistoricIncidentManager historicIncidentManager = Context.getCommandContext().getHistoricIncidentManager();
historicIncidentManager.deleteHistoricIncidentsByJobDefinitionId(seedJobDefinitionId);
historicIncidentManager.deleteHistoricIncidentsByJobDefinitionId(monitorJobDefinitionId);
historicIncidentManager.deleteHistoricIncidentsByJobDefinitionId(batchJobDefinitionId);
HistoricJobLogManager historicJobLogManager = Context.getCommandContext().getHistoricJobLogManager();
historicJobLogManager.deleteHistoricJobLogsByJobDefinitionId(seedJobDefinitionId);
historicJobLogManager.deleteHistoricJobLogsByJobDefinitionId(monitorJobDefinitionId);
historicJobLogManager.deleteHistoricJobLogsByJobDefinitionId(batchJobDefinitionId);
Context.getCommandContext().getHistoricBatchManager().delete(this);
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\batch\history\HistoricBatchEntity.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public DmnEngineConfigurationBuilder elProvider(ElProvider elProvider) {
this.elProvider = elProvider;
return this;
}
public DmnEngineConfigurationBuilder feelCustomFunctionProviders(List<FeelCustomFunctionProvider> feelCustomFunctionProviders) {
this.feelCustomFunctionProviders = feelCustomFunctionProviders;
return this;
}
/**
* Modify the given DMN engine configuration and return it.
*/
public DefaultDmnEngineConfiguration build() {
List<DmnDecisionEvaluationListener> decisionEvaluationListeners = createCustomPostDecisionEvaluationListeners();
dmnEngineConfiguration.setCustomPostDecisionEvaluationListeners(decisionEvaluationListeners);
// override the decision table handler
DmnTransformer dmnTransformer = dmnEngineConfiguration.getTransformer();
dmnTransformer.getElementTransformHandlerRegistry().addHandler(Definitions.class, new DecisionRequirementsDefinitionTransformHandler());
dmnTransformer.getElementTransformHandlerRegistry().addHandler(Decision.class, new DecisionDefinitionHandler());
// do not override the script engine resolver if set
if (dmnEngineConfiguration.getScriptEngineResolver() == null) {
ensureNotNull("scriptEngineResolver", scriptEngineResolver);
dmnEngineConfiguration.setScriptEngineResolver(scriptEngineResolver);
}
// do not override the el provider if set
if (dmnEngineConfiguration.getElProvider() == null) {
ensureNotNull("elProvider", elProvider);
dmnEngineConfiguration.setElProvider(elProvider);
}
if (dmnEngineConfiguration.getFeelCustomFunctionProviders() == null) {
dmnEngineConfiguration.setFeelCustomFunctionProviders(feelCustomFunctionProviders);
}
return dmnEngineConfiguration; | }
protected List<DmnDecisionEvaluationListener> createCustomPostDecisionEvaluationListeners() {
ensureNotNull("dmnHistoryEventProducer", dmnHistoryEventProducer);
// note that the history level may be null - see CAM-5165
HistoryDecisionEvaluationListener historyDecisionEvaluationListener = new HistoryDecisionEvaluationListener(dmnHistoryEventProducer);
List<DmnDecisionEvaluationListener> customPostDecisionEvaluationListeners = dmnEngineConfiguration
.getCustomPostDecisionEvaluationListeners();
customPostDecisionEvaluationListeners.add(new MetricsDecisionEvaluationListener());
customPostDecisionEvaluationListeners.add(historyDecisionEvaluationListener);
return customPostDecisionEvaluationListeners;
}
public DmnEngineConfigurationBuilder enableFeelLegacyBehavior(boolean dmnFeelEnableLegacyBehavior) {
dmnEngineConfiguration
.enableFeelLegacyBehavior(dmnFeelEnableLegacyBehavior);
return this;
}
public DmnEngineConfigurationBuilder returnBlankTableOutputAsNull(boolean dmnReturnBlankTableOutputAsNull) {
dmnEngineConfiguration.setReturnBlankTableOutputAsNull(dmnReturnBlankTableOutputAsNull);
return this;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\dmn\configuration\DmnEngineConfigurationBuilder.java | 2 |
请完成以下Java代码 | public void setIsSelfService (boolean IsSelfService)
{
set_Value (COLUMNNAME_IsSelfService, Boolean.valueOf(IsSelfService));
}
/** Get Self-Service.
@return This is a Self-Service entry or this entry can be changed via Self-Service
*/
public boolean isSelfService ()
{
Object oo = get_Value(COLUMNNAME_IsSelfService);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
public I_R_Category getR_Category() throws RuntimeException
{
return (I_R_Category)MTable.get(getCtx(), I_R_Category.Table_Name)
.getPO(getR_Category_ID(), get_TrxName()); }
/** Set Category.
@param R_Category_ID
Request Category | */
public void setR_Category_ID (int R_Category_ID)
{
if (R_Category_ID < 1)
set_ValueNoCheck (COLUMNNAME_R_Category_ID, null);
else
set_ValueNoCheck (COLUMNNAME_R_Category_ID, Integer.valueOf(R_Category_ID));
}
/** Get Category.
@return Request Category
*/
public int getR_Category_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_R_Category_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_R_CategoryUpdates.java | 1 |
请完成以下Java代码 | public class SAP_GLJournal_CopyDocument extends JavaProcess implements IProcessPrecondition
{
private final static AdMessageKey DOCUMENT_MUST_BE_COMPLETED_MSG = AdMessageKey.of("gljournal_sap.Document_has_to_be_Completed");
private final SAPGLJournalService glJournalService = SpringContextHolder.instance.getBean(SAPGLJournalService.class);
@Param(mandatory = true, parameterName = "DateDoc")
private Instant dateDoc;
@Param(mandatory = true, parameterName = "NegateAmounts")
private boolean negateAmounts;
@Override
public ProcessPreconditionsResolution checkPreconditionsApplicable(final @NonNull IProcessPreconditionsContext context)
{
if (!context.isSingleSelection())
{
return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection().toInternal();
}
final SAPGLJournalId glJournalId = SAPGLJournalId.ofRepoId(context.getSingleSelectedRecordId());
final DocStatus docStatus = glJournalService.getDocStatus(glJournalId);
if (!docStatus.isCompleted())
{
return ProcessPreconditionsResolution.reject(msgBL.getTranslatableMsgText(DOCUMENT_MUST_BE_COMPLETED_MSG));
}
return ProcessPreconditionsResolution.accept();
} | @Override
protected String doIt()
{
final SAPGLJournal createdJournal = glJournalService.copy(SAPGLJournalCopyRequest.builder()
.sourceJournalId(SAPGLJournalId.ofRepoId(getRecord_ID()))
.dateDoc(dateDoc)
.negateAmounts(negateAmounts)
.build());
getResult().setRecordToOpen(TableRecordReference.of(I_SAP_GLJournal.Table_Name, createdJournal.getId()),
getProcessInfo().getAD_Window_ID(),
ProcessExecutionResult.RecordsToOpen.OpenTarget.SingleDocument);
return MSG_OK;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\gljournal_sap\process\SAP_GLJournal_CopyDocument.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class MyReactiveCloudFoundryConfiguration {
@Bean
public HttpHandler httpHandler(ApplicationContext applicationContext, WebFluxProperties properties) {
HttpHandler httpHandler = WebHttpHandlerBuilder.applicationContext(applicationContext).build();
return new CloudFoundryHttpHandler(properties.getBasePath(), httpHandler);
}
private static final class CloudFoundryHttpHandler implements HttpHandler {
private final HttpHandler delegate;
private final ContextPathCompositeHandler contextPathDelegate;
private CloudFoundryHttpHandler(String basePath, HttpHandler delegate) {
this.delegate = delegate;
this.contextPathDelegate = new ContextPathCompositeHandler(Map.of(basePath, delegate));
} | @Override
public Mono<Void> handle(ServerHttpRequest request, ServerHttpResponse response) {
// Remove underlying context path first (e.g. Servlet container)
String path = request.getPath().pathWithinApplication().value();
if (path.startsWith("/cloudfoundryapplication")) {
return this.delegate.handle(request, response);
}
else {
return this.contextPathDelegate.handle(request, response);
}
}
}
} | repos\spring-boot-4.0.1\documentation\spring-boot-docs\src\main\java\org\springframework\boot\docs\actuator\cloudfoundry\customcontextpath\MyReactiveCloudFoundryConfiguration.java | 2 |
请完成以下Spring Boot application配置 | # Spring boot application
spring.application.name=dubbo-registry-nacos-provider-sample
# Base packages to scan Dubbo Component: @org.apache.dubbo.config.annotation.Service
dubbo.scan.base-packages=org.apache.dubbo.spring.boot.sample.provider.service
# Dubbo Application
## The default value of dubbo.application.name is ${spring.application.name}
## dubbo.application.name=${spring.application.name}
nacos.server-address = 127.0.0.1
nacos.port = 8848
nacos.username=nacos
nacos.password=nacos
# Dubbo Protocol
dubbo.protocol.name=dubbo
| ## Random port
dubbo.protocol.port=-1
## Dubbo Registry
dubbo.registry.address=nacos://${nacos.server-address}:${nacos.port}/?username=${nacos.username}&password=${nacos.password}
## DemoService version
demo.service.version=1.0.0 | repos\dubbo-spring-boot-project-master\dubbo-spring-boot-samples\registry-samples\nacos-samples\provider-sample\src\main\resources\application.properties | 2 |
请完成以下Java代码 | protected TaskEntity updateTaskComment(String taskId, CommandContext commandContext, CommentEntity comment) {
TaskEntity task = commandContext.getTaskManager().findTaskById(taskId);
ensureNotNull("No task exists with taskId: " + taskId, "task", task);
checkTaskWork(task, commandContext);
updateComment(commandContext, comment);
return task;
}
protected void updateProcessInstanceComment(String processInstanceId,
CommandContext commandContext,
CommentEntity comment) {
checkUpdateProcessInstanceById(processInstanceId, commandContext);
updateComment(commandContext, comment);
}
protected CommentEntity getComment(CommandContext commandContext) {
if (taskId != null) {
return commandContext.getCommentManager().findCommentByTaskIdAndCommentId(taskId, commentId);
}
return commandContext.getCommentManager().findCommentByProcessInstanceIdAndCommentId(processInstanceId, commentId);
}
protected PropertyChange getPropertyChange(String oldMessage) {
return new PropertyChange("comment", oldMessage, message);
}
protected void checkTaskWork(TaskEntity task, CommandContext commandContext) {
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkTaskWork(task);
}
}
protected void checkUpdateProcessInstanceById(String processInstanceId, CommandContext commandContext) {
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) { | checker.checkUpdateProcessInstanceById(processInstanceId);
}
}
private void updateComment(CommandContext commandContext, CommentEntity comment) {
String eventMessage = comment.toEventMessage(message);
String userId = commandContext.getAuthenticatedUserId();
comment.setMessage(eventMessage);
comment.setFullMessage(message);
comment.setTime(ClockUtil.getCurrentTime());
comment.setAction(UserOperationLogEntry.OPERATION_TYPE_UPDATE_COMMENT);
comment.setUserId(userId);
commandContext.getDbEntityManager().update(CommentEntity.class, "updateComment", comment);
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmd\UpdateCommentCmd.java | 1 |
请完成以下Java代码 | public int getCompletionQuantity() {
return completionQuantityAttribute.getValue(this);
}
public void setCompletionQuantity(int completionQuantity) {
completionQuantityAttribute.setValue(this, completionQuantity);
}
public SequenceFlow getDefault() {
return defaultAttribute.getReferenceTargetElement(this);
}
public void setDefault(SequenceFlow defaultFlow) {
defaultAttribute.setReferenceTargetElement(this, defaultFlow);
}
public IoSpecification getIoSpecification() {
return ioSpecificationChild.getChild(this);
}
public void setIoSpecification(IoSpecification ioSpecification) {
ioSpecificationChild.setChild(this, ioSpecification);
} | public Collection<Property> getProperties() {
return propertyCollection.get(this);
}
public Collection<DataInputAssociation> getDataInputAssociations() {
return dataInputAssociationCollection.get(this);
}
public Collection<DataOutputAssociation> getDataOutputAssociations() {
return dataOutputAssociationCollection.get(this);
}
public Collection<ResourceRole> getResourceRoles() {
return resourceRoleCollection.get(this);
}
public LoopCharacteristics getLoopCharacteristics() {
return loopCharacteristicsChild.getChild(this);
}
public void setLoopCharacteristics(LoopCharacteristics loopCharacteristics) {
loopCharacteristicsChild.setChild(this, loopCharacteristics);
}
} | repos\camunda-bpm-platform-master\model-api\bpmn-model\src\main\java\org\camunda\bpm\model\bpmn\impl\instance\ActivityImpl.java | 1 |
请完成以下Java代码 | protected MigrationInstructionValidationReportImpl validateInstruction(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, List<MigrationInstructionValidator> migrationInstructionValidators) {
MigrationInstructionValidationReportImpl validationReport = new MigrationInstructionValidationReportImpl(instruction.toMigrationInstruction());
for (MigrationInstructionValidator migrationInstructionValidator : migrationInstructionValidators) {
migrationInstructionValidator.validate(instruction, instructions, validationReport);
}
return validationReport;
}
protected ValidatingMigrationInstructions wrapMigrationInstructions(MigrationPlan migrationPlan, ProcessDefinitionImpl sourceProcessDefinition, ProcessDefinitionImpl targetProcessDefinition, MigrationPlanValidationReportImpl planReport) {
ValidatingMigrationInstructions validatingMigrationInstructions = new ValidatingMigrationInstructions();
for (MigrationInstruction migrationInstruction : migrationPlan.getInstructions()) {
MigrationInstructionValidationReportImpl instructionReport = new MigrationInstructionValidationReportImpl(migrationInstruction);
String sourceActivityId = migrationInstruction.getSourceActivityId();
String targetActivityId = migrationInstruction.getTargetActivityId();
if (sourceActivityId != null && targetActivityId != null) {
ActivityImpl sourceActivity = sourceProcessDefinition.findActivity(sourceActivityId);
ActivityImpl targetActivity = targetProcessDefinition.findActivity(migrationInstruction.getTargetActivityId());
if (sourceActivity != null && targetActivity != null) {
validatingMigrationInstructions.addInstruction(new ValidatingMigrationInstructionImpl(sourceActivity, targetActivity, migrationInstruction.isUpdateEventTrigger()));
}
else {
if (sourceActivity == null) {
instructionReport.addFailure("Source activity '" + sourceActivityId + "' does not exist");
}
if (targetActivity == null) {
instructionReport.addFailure("Target activity '" + targetActivityId + "' does not exist");
}
}
} | else {
if (sourceActivityId == null) {
instructionReport.addFailure("Source activity id is null");
}
if (targetActivityId == null) {
instructionReport.addFailure("Target activity id is null");
}
}
if (instructionReport.hasFailures()) {
planReport.addInstructionReport(instructionReport);
}
}
return validatingMigrationInstructions;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmd\CreateMigrationPlanCmd.java | 1 |
请完成以下Java代码 | public void setParameterName(String parameterName) {
Assert.hasLength(parameterName, "parameterName can't be null");
this.parameterName = parameterName;
}
/**
* Sets the header name
* @param headerName The header name
*/
public void setHeaderName(String headerName) {
Assert.hasLength(headerName, "headerName can't be null");
this.headerName = headerName;
}
/**
* Sets the cookie path
* @param cookiePath The cookie path
*/
public void setCookiePath(String cookiePath) {
this.cookiePath = cookiePath;
}
private CsrfToken createCsrfToken() { | return createCsrfToken(createNewToken());
}
private CsrfToken createCsrfToken(String tokenValue) {
return new DefaultCsrfToken(this.headerName, this.parameterName, tokenValue);
}
private String createNewToken() {
return UUID.randomUUID().toString();
}
private String getRequestContext(ServerHttpRequest request) {
String contextPath = request.getPath().contextPath().value();
return StringUtils.hasLength(contextPath) ? contextPath : "/";
}
} | repos\spring-security-main\web\src\main\java\org\springframework\security\web\server\csrf\CookieServerCsrfTokenRepository.java | 1 |
请完成以下Java代码 | public void setAuthor(Author author) {
this.author = author;
}
@PreRemove
private void bookRemove() {
deleted = true;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (getClass() != obj.getClass()) {
return false;
} | return id != null && id.equals(((Book) obj).id);
}
@Override
public int hashCode() {
return 2021;
}
@Override
public String toString() {
return "Book{" + "id=" + id + ", title=" + title + ", isbn=" + isbn + '}';
}
} | repos\Hibernate-SpringBoot-master\HibernateSpringBootSoftDeletes\src\main\java\com\bookstore\entity\Book.java | 1 |
请完成以下Java代码 | public FilterQuery filterId(String filterId) {
ensureNotNull("filterId", filterId);
this.filterId = filterId;
return this;
}
public FilterQuery filterResourceType(String resourceType) {
ensureNotNull("resourceType", resourceType);
this.resourceType = resourceType;
return this;
}
public FilterQuery filterName(String name) {
ensureNotNull("name", name);
this.name = name;
return this;
}
public FilterQuery filterNameLike(String nameLike) {
ensureNotNull("nameLike", nameLike);
this.nameLike = nameLike;
return this;
}
public FilterQuery filterOwner(String owner) {
ensureNotNull("owner", owner);
this.owner = owner;
return this;
} | public FilterQuery orderByFilterId() {
return orderBy(FilterQueryProperty.FILTER_ID);
}
public FilterQuery orderByFilterResourceType() {
return orderBy(FilterQueryProperty.RESOURCE_TYPE);
}
public FilterQuery orderByFilterName() {
return orderBy(FilterQueryProperty.NAME);
}
public FilterQuery orderByFilterOwner() {
return orderBy(FilterQueryProperty.OWNER);
}
public List<Filter> executeList(CommandContext commandContext, Page page) {
return commandContext
.getFilterManager()
.findFiltersByQueryCriteria(this);
}
public long executeCount(CommandContext commandContext) {
return commandContext
.getFilterManager()
.findFilterCountByQueryCriteria(this);
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\filter\FilterQueryImpl.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class ListLineItemExtensionType {
@XmlElement(name = "ListLineItemExtension", namespace = "http://erpel.at/schemas/1p0/documents/extensions/edifact")
protected at.erpel.schemas._1p0.documents.extensions.edifact.ListLineItemExtensionType listLineItemExtension;
@XmlElement(name = "ErpelListLineItemExtension")
protected CustomType erpelListLineItemExtension;
/**
* Gets the value of the listLineItemExtension property.
*
* @return
* possible object is
* {@link at.erpel.schemas._1p0.documents.extensions.edifact.ListLineItemExtensionType }
*
*/
public at.erpel.schemas._1p0.documents.extensions.edifact.ListLineItemExtensionType getListLineItemExtension() {
return listLineItemExtension;
}
/**
* Sets the value of the listLineItemExtension property.
*
* @param value
* allowed object is
* {@link at.erpel.schemas._1p0.documents.extensions.edifact.ListLineItemExtensionType }
*
*/
public void setListLineItemExtension(at.erpel.schemas._1p0.documents.extensions.edifact.ListLineItemExtensionType value) {
this.listLineItemExtension = value; | }
/**
* Gets the value of the erpelListLineItemExtension property.
*
* @return
* possible object is
* {@link CustomType }
*
*/
public CustomType getErpelListLineItemExtension() {
return erpelListLineItemExtension;
}
/**
* Sets the value of the erpelListLineItemExtension property.
*
* @param value
* allowed object is
* {@link CustomType }
*
*/
public void setErpelListLineItemExtension(CustomType value) {
this.erpelListLineItemExtension = value;
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\ext\ListLineItemExtensionType.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class ReceiptRestController
{
private static final Logger log = LogManager.getLogger(ReceiptRestController.class);
private final ITrxManager trxManager = Services.get(ITrxManager.class);
private final ReceiptService receiptService;
private final CustomerReturnRestService customerReturnRestService;
public ReceiptRestController(final ReceiptService receiptService, final CustomerReturnRestService customerReturnRestService)
{
this.receiptService = receiptService;
this.customerReturnRestService = customerReturnRestService;
}
@PostMapping
public ResponseEntity createReceipts(@RequestBody final JsonCreateReceiptsRequest jsonCreateReceiptsRequest)
{
try
{
final JsonCreateReceiptsResponse receiptsResponse = trxManager.callInNewTrx(() -> createReceipts_0(jsonCreateReceiptsRequest));
return ResponseEntity.ok(receiptsResponse);
}
catch (final Exception ex)
{
log.error(ex.getMessage(), ex);
final String adLanguage = Env.getADLanguageOrBaseLanguage();
return ResponseEntity.unprocessableEntity()
.body(JsonErrors.ofThrowable(ex, adLanguage));
}
}
private JsonCreateReceiptsResponse createReceipts_0(@NonNull final JsonCreateReceiptsRequest jsonCreateReceiptsRequest)
{
final List<InOutId> createdReceiptIds = jsonCreateReceiptsRequest.getJsonCreateReceiptInfoList().isEmpty()
? ImmutableList.of()
: receiptService.updateReceiptCandidatesAndGenerateReceipts(jsonCreateReceiptsRequest); | final List<InOutId> createdReturnIds = jsonCreateReceiptsRequest.getJsonCreateCustomerReturnInfoList().isEmpty()
? ImmutableList.of()
: customerReturnRestService.handleReturns(jsonCreateReceiptsRequest.getJsonCreateCustomerReturnInfoList());
return toJsonCreateReceiptsResponse(createdReceiptIds, createdReturnIds);
}
@NonNull
private JsonCreateReceiptsResponse toJsonCreateReceiptsResponse(@NonNull final List<InOutId> receiptIds, @NonNull final List<InOutId> returnIds)
{
final List<JsonMetasfreshId> jsonReceiptIds = receiptIds
.stream()
.map(InOutId::getRepoId)
.map(JsonMetasfreshId::of)
.collect(ImmutableList.toImmutableList());
final List<JsonMetasfreshId> jsonReturnIds = returnIds
.stream()
.map(InOutId::getRepoId)
.map(JsonMetasfreshId::of)
.collect(ImmutableList.toImmutableList());
return JsonCreateReceiptsResponse.builder()
.createdReceiptIdList(jsonReceiptIds)
.createdReturnIdList(jsonReturnIds)
.build();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business.rest-api-impl\src\main\java\de\metas\rest_api\receipt\ReceiptRestController.java | 2 |
请完成以下Spring Boot application配置 | web3j.client-address=http://localhost:8545
lottery.contract.owner-address=0x9b418710ce8438e5fe585b519e8d709e1ea77aca
lottery.contract.gas-price=1
lottery.contract.gas-limit= | 2000000
lottery.contract.address=0x1c0fe20304e76882fe7ce7bb3e2e63dc92ce64de | repos\springboot-demo-master\Blockchain\src\main\resources\application.properties | 2 |
请在Spring Boot框架中完成以下Java代码 | public class GreetingRepository
{
private final IQueryBL queryBL = Services.get(IQueryBL.class);
private final CCache<Integer, GreetingsMap> cache = CCache.<Integer, GreetingsMap>builder()
.tableName(I_C_Greeting.Table_Name)
.build();
public Greeting getById(@NonNull final GreetingId id)
{
return getGreetingsMap().getById(id);
}
private GreetingsMap getGreetingsMap()
{
return cache.getOrLoad(0, this::retrieveGreetingsMap);
}
private GreetingsMap retrieveGreetingsMap()
{
final ImmutableList<Greeting> list = queryBL
.createQueryBuilder(I_C_Greeting.class)
// We need also inactive greetings. If we have to render an address, but the AD_User's greeting was dectivated,
// then we still need the greeting in order to render that address
//.addOnlyActiveRecordsFilter()
.create()
.stream(I_C_Greeting.class)
.map(GreetingRepository::fromRecord)
.collect(ImmutableList.toImmutableList());
return new GreetingsMap(list);
}
private static Greeting fromRecord(@NonNull final I_C_Greeting record)
{
final IModelTranslationMap trlsMap = InterfaceWrapperHelper.getModelTranslationMap(record);
return Greeting.builder()
.id(GreetingId.ofRepoId(record.getC_Greeting_ID()))
.name(record.getName())
.greeting(trlsMap.getColumnTrl(I_C_Greeting.COLUMNNAME_Greeting, record.getGreeting()))
.standardType(GreetingStandardType.ofNullableCode(record.getGreetingStandardType()))
.active(record.isActive()) | .build();
}
public Greeting createGreeting(@NonNull final CreateGreetingRequest request)
{
final I_C_Greeting record = InterfaceWrapperHelper.newInstance(I_C_Greeting.class);
record.setName(request.getName());
record.setGreeting(request.getGreeting());
record.setGreetingStandardType(GreetingStandardType.toCode(request.getStandardType()));
record.setAD_Org_ID(request.getOrgId().getRepoId());
InterfaceWrapperHelper.saveRecord(record);
return fromRecord(record);
}
public Optional<Greeting> getComposite(
@Nullable final GreetingId greetingId1,
@Nullable final GreetingId greetingId2)
{
return getGreetingsMap().getComposite(greetingId1, greetingId2);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\greeting\GreetingRepository.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public void setStreamMessageConverter(@Nullable StreamMessageConverter streamMessageConverter) {
this.streamMessageConverter = streamMessageConverter;
}
/**
* Set the {@link ProducerCustomizer} instances to use.
* @param producerCustomizer the producer customizer
*/
public void setProducerCustomizer(@Nullable ProducerCustomizer producerCustomizer) {
this.producerCustomizer = producerCustomizer;
}
/**
* Configure the specified {@link RabbitStreamTemplate}. The template can be further
* tuned and default settings can be overridden. | * @param template the {@link RabbitStreamTemplate} instance to configure
*/
public void configure(RabbitStreamTemplate template) {
if (this.messageConverter != null) {
template.setMessageConverter(this.messageConverter);
}
if (this.streamMessageConverter != null) {
template.setStreamConverter(this.streamMessageConverter);
}
if (this.producerCustomizer != null) {
template.setProducerCustomizer(this.producerCustomizer);
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-amqp\src\main\java\org\springframework\boot\amqp\autoconfigure\RabbitStreamTemplateConfigurer.java | 2 |
请完成以下Java代码 | public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
@Override
public Date getExecutionStartTime() {
return executionStartTime;
}
public void setExecutionStartTime(final Date executionStartTime) {
this.executionStartTime = executionStartTime;
}
@Override
public Object getPersistentState() {
Map<String, Object> persistentState = new HashMap<String, Object>();
persistentState.put("endTime", endTime);
persistentState.put("executionStartTime", executionStartTime);
return persistentState;
} | public void delete() {
HistoricIncidentManager historicIncidentManager = Context.getCommandContext().getHistoricIncidentManager();
historicIncidentManager.deleteHistoricIncidentsByJobDefinitionId(seedJobDefinitionId);
historicIncidentManager.deleteHistoricIncidentsByJobDefinitionId(monitorJobDefinitionId);
historicIncidentManager.deleteHistoricIncidentsByJobDefinitionId(batchJobDefinitionId);
HistoricJobLogManager historicJobLogManager = Context.getCommandContext().getHistoricJobLogManager();
historicJobLogManager.deleteHistoricJobLogsByJobDefinitionId(seedJobDefinitionId);
historicJobLogManager.deleteHistoricJobLogsByJobDefinitionId(monitorJobDefinitionId);
historicJobLogManager.deleteHistoricJobLogsByJobDefinitionId(batchJobDefinitionId);
Context.getCommandContext().getHistoricBatchManager().delete(this);
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\batch\history\HistoricBatchEntity.java | 1 |
请完成以下Java代码 | protected void deleteAttachments(Map<String, Object> parameters) {
getDbEntityManager().deletePreserveOrder(ByteArrayEntity.class, "deleteAttachmentByteArraysByIds", parameters);
getDbEntityManager().deletePreserveOrder(AttachmentEntity.class, "deleteAttachmentByIds", parameters);
}
public Attachment findAttachmentByTaskIdAndAttachmentId(String taskId, String attachmentId) {
checkHistoryEnabled();
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("taskId", taskId);
parameters.put("id", attachmentId);
return (AttachmentEntity) getDbEntityManager().selectOne("selectAttachmentByTaskIdAndAttachmentId", parameters);
} | public DbOperation deleteAttachmentsByRemovalTime(Date removalTime, int minuteFrom, int minuteTo, int batchSize) {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("removalTime", removalTime);
if (minuteTo - minuteFrom + 1 < 60) {
parameters.put("minuteFrom", minuteFrom);
parameters.put("minuteTo", minuteTo);
}
parameters.put("batchSize", batchSize);
return getDbEntityManager()
.deletePreserveOrder(AttachmentEntity.class, "deleteAttachmentsByRemovalTime",
new ListQueryParameterObject(parameters, 0, batchSize));
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\AttachmentManager.java | 1 |
请完成以下Spring Boot application配置 | spring.datasource.url=jdbc:h2:~/test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.driver-class-name=org.h2.Driver
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.properties.hibernate.format_sq | l=true
spring.batch.jdbc.initialize-schema=always
spring.sql.init.mode=always
spring.batch.jdbc.table-prefix=BATCH_ | repos\tutorials-master\spring-batch-2\src\main\resources\application-restart.properties | 2 |
请完成以下Java代码 | private Map<String, Object> resolveExecutionExpressions(
MappingExecutionContext mappingExecutionContext,
Map<String, Object> availableVariables,
Map<String, Object> outboundVariables
) {
if (availableVariables != null && !availableVariables.isEmpty()) {
return expressionResolver.resolveExpressionsMap(
new CompositeVariableExpressionEvaluator(
new SimpleMapExpressionEvaluator(availableVariables),
new VariableScopeExpressionEvaluator(mappingExecutionContext.getExecution())
),
outboundVariables
);
}
return expressionResolver.resolveExpressionsMap( | new VariableScopeExpressionEvaluator(mappingExecutionContext.getExecution()),
outboundVariables
);
}
private boolean isTargetProcessVariableDefined(
Extension extensions,
DelegateExecution execution,
String variableName
) {
return (
extensions.getPropertyByName(variableName) != null ||
(execution != null && execution.getVariable(variableName) != null)
);
}
} | repos\Activiti-develop\activiti-core\activiti-api-impl\activiti-api-process-runtime-impl\src\main\java\org\activiti\runtime\api\impl\ExtensionsVariablesMappingProvider.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class ApplicationConfiguration implements WebMvcConfigurer {
@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
configurer.enable();
}
@Bean
public ResourceBundleMessageSource resourceBundleMessageSource() {
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setBasename("messages");
return messageSource;
}
// switch orders to server views from html over views directory
@Bean
public InternalResourceViewResolver jspViewResolver() {
InternalResourceViewResolver bean = new InternalResourceViewResolver();
bean.setPrefix("/WEB-INF/views/");
bean.setSuffix(".jsp");
bean.setOrder(1); | return bean;
}
@Bean
public InternalResourceViewResolver htmlViewResolver() {
InternalResourceViewResolver bean = new InternalResourceViewResolver();
bean.setPrefix("/WEB-INF/html/");
bean.setSuffix(".html");
bean.setOrder(2);
return bean;
}
@Bean
public MultipartResolver multipartResolver() {
return new StandardServletMultipartResolver();
}
} | repos\tutorials-master\spring-web-modules\spring-mvc-forms-jsp\src\main\java\com\baeldung\springmvcforms\configuration\ApplicationConfiguration.java | 2 |
请完成以下Java代码 | public java.lang.String getDescription()
{
return get_ValueAsString(COLUMNNAME_Description);
}
@Override
public void setDocument_Currency_ID (final int Document_Currency_ID)
{
if (Document_Currency_ID < 1)
set_Value (COLUMNNAME_Document_Currency_ID, null);
else
set_Value (COLUMNNAME_Document_Currency_ID, Document_Currency_ID);
}
@Override
public int getDocument_Currency_ID()
{
return get_ValueAsInt(COLUMNNAME_Document_Currency_ID);
}
@Override
public void setFact_Acct_UserChange_ID (final int Fact_Acct_UserChange_ID)
{
if (Fact_Acct_UserChange_ID < 1)
set_ValueNoCheck (COLUMNNAME_Fact_Acct_UserChange_ID, null);
else
set_ValueNoCheck (COLUMNNAME_Fact_Acct_UserChange_ID, Fact_Acct_UserChange_ID);
}
@Override
public int getFact_Acct_UserChange_ID()
{
return get_ValueAsInt(COLUMNNAME_Fact_Acct_UserChange_ID);
}
@Override
public void setLocal_Currency_ID (final int Local_Currency_ID)
{
if (Local_Currency_ID < 1)
set_Value (COLUMNNAME_Local_Currency_ID, null);
else
set_Value (COLUMNNAME_Local_Currency_ID, Local_Currency_ID);
}
@Override
public int getLocal_Currency_ID()
{
return get_ValueAsInt(COLUMNNAME_Local_Currency_ID);
}
@Override
public void setMatchKey (final @Nullable java.lang.String MatchKey)
{
set_Value (COLUMNNAME_MatchKey, MatchKey);
}
@Override
public java.lang.String getMatchKey()
{
return get_ValueAsString(COLUMNNAME_MatchKey);
}
@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);
} | /**
* PostingSign AD_Reference_ID=541699
* Reference name: PostingSign
*/
public static final int POSTINGSIGN_AD_Reference_ID=541699;
/** DR = D */
public static final String POSTINGSIGN_DR = "D";
/** CR = C */
public static final String POSTINGSIGN_CR = "C";
@Override
public void setPostingSign (final java.lang.String PostingSign)
{
set_Value (COLUMNNAME_PostingSign, PostingSign);
}
@Override
public java.lang.String getPostingSign()
{
return get_ValueAsString(COLUMNNAME_PostingSign);
}
@Override
public void setUserElementString1 (final @Nullable java.lang.String UserElementString1)
{
set_Value (COLUMNNAME_UserElementString1, UserElementString1);
}
@Override
public java.lang.String getUserElementString1()
{
return get_ValueAsString(COLUMNNAME_UserElementString1);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java-gen\de\metas\acct\model\X_Fact_Acct_UserChange.java | 1 |
请完成以下Java代码 | public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getParentActivityInstanceId() {
return parentActivityInstanceId;
}
public void setParentActivityInstanceId(String parentActivityInstanceId) {
this.parentActivityInstanceId = parentActivityInstanceId;
}
public String getProcessInstanceId() {
return processInstanceId;
}
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
public String getProcessDefinitionId() {
return processDefinitionId;
} | public void setProcessDefinitionId(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
}
@Override
public String toString() {
return this.getClass().getSimpleName()
+ "[id=" + id
+ ", parentActivityInstanceId=" + parentActivityInstanceId
+ ", processInstanceId=" + processInstanceId
+ ", processDefinitionId=" + processDefinitionId
+ "]";
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\ProcessElementInstanceImpl.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public int hashCode() {
return Objects.hash(gender, title, name, address, postalCode, city);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class PatientBillingAddress {\n");
sb.append(" gender: ").append(toIndentedString(gender)).append("\n");
sb.append(" title: ").append(toIndentedString(title)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" address: ").append(toIndentedString(address)).append("\n");
sb.append(" postalCode: ").append(toIndentedString(postalCode)).append("\n");
sb.append(" city: ").append(toIndentedString(city)).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\PatientBillingAddress.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public String getPassword(String name) {
try {
SimpleCredentialName credentialName = new SimpleCredentialName(name);
return credentialOperations.getByName(credentialName, PasswordCredential.class)
.getValue()
.getPassword();
} catch (Exception e) {
return null;
}
}
public CredentialPermission addCredentialPermission(String name) {
SimpleCredentialName credentialName = new SimpleCredentialName(name);
try {
Permission permission = Permission.builder()
.app(UUID.randomUUID()
.toString())
.operations(Operation.READ, Operation.WRITE)
.user("u101") | .build();
CredentialPermission credentialPermission = permissionOperations.addPermissions(credentialName, permission);
return credentialPermission;
} catch (Exception e) {
return null;
}
}
public CredentialPermission getCredentialPermission(String name) {
try {
return permissionOperations.getPermissions(name);
} catch (Exception e) {
return null;
}
}
} | repos\tutorials-master\spring-credhub\src\main\java\com\baeldung\service\CredentialService.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class ProcessExtensionRepositoryImpl implements ProcessExtensionRepository {
private final DeploymentResourceLoader<ProcessExtensionModel> processExtensionLoader;
private final ProcessExtensionResourceReader processExtensionReader;
private final RepositoryService repositoryService;
public ProcessExtensionRepositoryImpl(
DeploymentResourceLoader<ProcessExtensionModel> processExtensionLoader,
ProcessExtensionResourceReader processExtensionReader,
RepositoryService repositoryService
) {
this.processExtensionLoader = processExtensionLoader;
this.processExtensionReader = processExtensionReader;
this.repositoryService = repositoryService;
}
@Override
public Optional<Extension> getExtensionsForId(@NonNull String processDefinitionId) {
return Optional.of(processDefinitionId)
.map(repositoryService::getProcessDefinition)
.map(this::getExtensionsFor);
}
private Extension getExtensionsFor(ProcessDefinition processDefinition) {
Map<String, Extension> processExtensionModelMap = getProcessExtensionsForDeploymentId(
processDefinition.getDeploymentId() | );
return processExtensionModelMap.get(processDefinition.getKey());
}
private Map<String, Extension> getProcessExtensionsForDeploymentId(String deploymentId) {
List<ProcessExtensionModel> processExtensionModels = processExtensionLoader.loadResourcesForDeployment(
deploymentId,
processExtensionReader
);
return processExtensionModels
.stream()
.flatMap(it -> it.getAllExtensions().entrySet().stream())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}
} | repos\Activiti-develop\activiti-core\activiti-spring-process-extensions\src\main\java\org\activiti\spring\process\ProcessExtensionRepositoryImpl.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public Amount getShippingCost()
{
return shippingCost;
}
public void setShippingCost(Amount shippingCost)
{
this.shippingCost = shippingCost;
}
public DeliveryCost shippingIntermediationFee(Amount shippingIntermediationFee)
{
this.shippingIntermediationFee = shippingIntermediationFee;
return this;
}
/**
* Get shippingIntermediationFee
*
* @return shippingIntermediationFee
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Amount getShippingIntermediationFee()
{
return shippingIntermediationFee;
}
public void setShippingIntermediationFee(Amount shippingIntermediationFee)
{
this.shippingIntermediationFee = shippingIntermediationFee;
}
@Override
public boolean equals(Object o)
{
if (this == o)
{
return true;
}
if (o == null || getClass() != o.getClass())
{
return false;
}
DeliveryCost deliveryCost = (DeliveryCost)o;
return Objects.equals(this.importCharges, deliveryCost.importCharges) &&
Objects.equals(this.shippingCost, deliveryCost.shippingCost) &&
Objects.equals(this.shippingIntermediationFee, deliveryCost.shippingIntermediationFee);
}
@Override
public int hashCode()
{
return Objects.hash(importCharges, shippingCost, shippingIntermediationFee); | }
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("class DeliveryCost {\n");
sb.append(" importCharges: ").append(toIndentedString(importCharges)).append("\n");
sb.append(" shippingCost: ").append(toIndentedString(shippingCost)).append("\n");
sb.append(" shippingIntermediationFee: ").append(toIndentedString(shippingIntermediationFee)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o)
{
if (o == null)
{
return "null";
}
return o.toString().replace("\n", "\n ");
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\de-metas-camel-ebay\ebay-api-client\src\main\java\de\metas\camel\externalsystems\ebay\api\model\DeliveryCost.java | 2 |
请在Spring Boot框架中完成以下Java代码 | private Golfer updateScore(@NonNull Function<Integer, Integer> scoreFunction, @NonNull Golfer player) {
player.setScore(scoreFunction.apply(player.getScore()));
this.golferService.update(player);
return player;
}
private int calculateFinalScore(@Nullable Integer scoreRelativeToPar) {
int finalScore = scoreRelativeToPar != null ? scoreRelativeToPar : 0;
int parForCourse = getGolfTournament()
.map(GolfTournament::getGolfCourse)
.map(GolfCourse::getParForCourse)
.orElse(GolfCourse.STANDARD_PAR_FOR_COURSE);
return parForCourse + finalScore;
}
private int calculateRunningScore(@Nullable Integer currentScore) {
int runningScore = currentScore != null ? currentScore : 0;
int scoreDelta = this.random.nextInt(SCORE_DELTA_BOUND); | scoreDelta *= this.random.nextBoolean() ? -1 : 1;
return runningScore + scoreDelta;
}
private void finish(@NonNull GolfTournament golfTournament) {
for (GolfTournament.Pairing pairing : golfTournament) {
if (pairing.signScorecard()) {
updateScore(this::calculateFinalScore, pairing.getPlayerOne());
updateScore(this::calculateFinalScore, pairing.getPlayerTwo());
}
}
}
}
// end::class[] | repos\spring-boot-data-geode-main\spring-geode-samples\caching\inline-async\src\main\java\example\app\caching\inline\async\client\service\PgaTourService.java | 2 |
请完成以下Java代码 | public java.lang.String getM_HU_PackagingCode_Text()
{
return get_ValueAsString(COLUMNNAME_M_HU_PackagingCode_Text);
}
@Override
public org.compiere.model.I_M_InOut getM_InOut()
{
return get_ValueAsPO(COLUMNNAME_M_InOut_ID, org.compiere.model.I_M_InOut.class);
}
@Override
public void setM_InOut(final org.compiere.model.I_M_InOut M_InOut)
{
set_ValueFromPO(COLUMNNAME_M_InOut_ID, org.compiere.model.I_M_InOut.class, M_InOut);
}
@Override
public void setM_InOut_ID (final int M_InOut_ID)
{
throw new IllegalArgumentException ("M_InOut_ID is virtual column"); } | @Override
public int getM_InOut_ID()
{
return get_ValueAsInt(COLUMNNAME_M_InOut_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.edi\src\main\java-gen\de\metas\esb\edi\model\X_EDI_Desadv_Pack.java | 1 |
请完成以下Java代码 | public class StoppingExecution {
private static final Logger LOG = LoggerFactory.getLogger(StoppingExecution.class);
public static void main(String[] args) {
StoppingExecution.testUsingLoop();
StoppingExecution.testUsingTimer();
StoppingExecution.testUsingFuture();
StoppingExecution.testScheduledExecutor();
StoppingExecution.testSteppedProcess();
}
public static void testUsingLoop() {
LOG.info("using loop started");
long start = System.currentTimeMillis();
long end = start + 30 * 1000; // 30 seconds
while (System.currentTimeMillis() < end) {
LOG.info("running task");
new FixedTimeTask(7 * 1000).run(); // 7 seconds
}
LOG.info("using loop ended");
}
public static void testUsingTimer() {
LOG.info("using timer started");
Thread thread = new Thread(new LongRunningTask());
thread.start();
Timer timer = new Timer();
TimeOutTask timeOutTask = new TimeOutTask(thread, timer);
LOG.info("scheduling timeout in 3 seconds");
timer.schedule(timeOutTask, 3000);
LOG.info("using timer ended");
}
public static void testUsingFuture() {
LOG.info("using future started");
ExecutorService executor = Executors.newSingleThreadExecutor();
Future future = executor.submit(new LongRunningTask());
try { | LOG.info("future get with 7 seconds timeout");
future.get(7, TimeUnit.SECONDS);
} catch (TimeoutException e) {
LOG.info("future timeout");
future.cancel(true);
} catch (Exception e) {
LOG.info("future exception", e);
} finally {
executor.shutdownNow();
}
LOG.info("using future ended");
}
public static void testScheduledExecutor() {
LOG.info("using future schedule executor started");
ScheduledExecutorService executor = Executors.newScheduledThreadPool(2);
Future future = executor.submit(new LongRunningTask());
Runnable cancelTask = () -> future.cancel(true);
LOG.info("cancel task in 3 seconds");
executor.schedule(cancelTask, 3000, TimeUnit.MILLISECONDS);
executor.shutdown();
LOG.info("using future schedule executor ended");
}
public static void testSteppedProcess() {
List<Step> steps = Stream.of(new Step(1), new Step(2), new Step(3), new Step(4)).collect(Collectors.toList());
LOG.info("stepped process started");
Thread thread = new Thread(new SteppedTask(steps));
thread.start();
Timer timer = new Timer();
TimeOutTask timeOutTask = new TimeOutTask(thread, timer);
timer.schedule(timeOutTask, 10000);
}
} | repos\tutorials-master\core-java-modules\core-java-concurrency-basic-2\src\main\java\com\baeldung\concurrent\stopexecution\StoppingExecution.java | 1 |
请完成以下Java代码 | public void setProcessInstance(ExecutionEntity processInstance) {
this.processInstance = processInstance;
this.processInstanceId = processInstance.getId();
}
public ProcessDefinitionEntity getProcessDef() {
if ((processDef == null) && (processDefId != null)) {
this.processDef = Context
.getCommandContext()
.getProcessDefinitionEntityManager()
.findProcessDefinitionById(processDefId);
}
return processDef;
}
public void setProcessDef(ProcessDefinitionEntity processDef) {
this.processDef = processDef;
this.processDefId = processDef.getId();
}
@Override
public String getProcessDefinitionId() {
return this.processDefId;
}
@Override
public String getScopeId() {
return null;
}
@Override
public String getSubScopeId() {
return null;
}
@Override
public String getScopeType() {
return null;
} | @Override
public String getScopeDefinitionId() {
return null;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("IdentityLinkEntity[id=").append(id);
sb.append(", type=").append(type);
if (userId != null) {
sb.append(", userId=").append(userId);
}
if (groupId != null) {
sb.append(", groupId=").append(groupId);
}
if (taskId != null) {
sb.append(", taskId=").append(taskId);
}
if (processInstanceId != null) {
sb.append(", processInstanceId=").append(processInstanceId);
}
if (processDefId != null) {
sb.append(", processDefId=").append(processDefId);
}
sb.append("]");
return sb.toString();
}
} | repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\persistence\entity\IdentityLinkEntity.java | 1 |
请完成以下Java代码 | private Properties getActualContext()
{
//
// IMPORTANT: this method will be called very often, so please make sure it's FAST!
//
//
// If there is currently a temporary context active, return it first
final Properties temporaryCtx = temporaryCtxHolder.get();
if (temporaryCtx != null)
{
logger.trace("Returning temporary context: {}", temporaryCtx);
return temporaryCtx;
}
//
// Get the context from current session
final UserSession userSession = UserSession.getCurrentOrNull();
if (userSession != null)
{
final Properties userSessionCtx = userSession.getCtx();
logger.trace("Returning user session context: {}", userSessionCtx);
return userSessionCtx;
}
//
// If there was no current session it means we are running on server side, so return the server context
logger.trace("Returning server context: {}", serverCtx);
return serverCtx;
}
@Override
public IAutoCloseable switchContext(@NonNull final Properties ctx)
{
// If we were asked to set the context proxy (the one which we are returning everytime),
// then it's better to do nothing because this could end in a StackOverflowException.
if (ctx == ctxProxy)
{
logger.trace("Not switching context because the given temporary context it's actually our context proxy: {}", ctx);
return NullAutoCloseable.instance;
}
final Properties previousTempCtx = temporaryCtxHolder.get();
temporaryCtxHolder.set(ctx);
logger.trace("Switched to temporary context. \n New temporary context: {} \n Previous temporary context: {}", ctx, previousTempCtx);
return new IAutoCloseable() | {
private boolean closed = false;
@Override
public void close()
{
if (closed)
{
return;
}
if (previousTempCtx != null)
{
temporaryCtxHolder.set(previousTempCtx);
}
else
{
temporaryCtxHolder.remove();
}
closed = true;
logger.trace("Switched back from temporary context");
}
};
}
@Override
public void reset()
{
temporaryCtxHolder.remove();
serverCtx.clear();
logger.debug("Reset done");
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\session\WebRestApiContextProvider.java | 1 |
请完成以下Java代码 | protected Stream<HUEditorRow> streamSelectedRows()
{
final DocumentIdsSelection selectedRowIds = getSelectedRowIds();
return getView().streamByIds(selectedRowIds);
}
protected final Stream<HuId> streamSelectedHUIds(@NonNull final Select select)
{
return streamSelectedHUIds(HUEditorRowFilter.select(select));
}
protected final Stream<HuId> streamSelectedHUIds(@NonNull final HUEditorRowFilter filter)
{
return streamSelectedRows(filter)
.map(HUEditorRow::getHuId)
.filter(Objects::nonNull);
}
/**
* Gets <b>all</b> selected {@link HUEditorRow}s and loads the top level-HUs from those.
* I.e. this method does not rely on {@link HUEditorRow#isTopLevel()}, but checks the underlying HU.
*/
protected final Stream<I_M_HU> streamSelectedHUs(@NonNull final Select select)
{
return streamSelectedHUs(HUEditorRowFilter.select(select)); | }
protected final Stream<I_M_HU> streamSelectedHUs(@NonNull final HUEditorRowFilter filter)
{
final Stream<HuId> huIds = streamSelectedHUIds(filter);
return StreamUtils
.dice(huIds, 100)
.flatMap(huIdsChunk -> handlingUnitsRepo.getByIds(huIdsChunk).stream());
}
protected final void addHUIdsAndInvalidateView(Collection<HuId> huIds)
{
if (huIds.isEmpty())
{
return;
}
getView().addHUIdsAndInvalidate(huIds);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\HUEditorProcessTemplate.java | 1 |
请完成以下Java代码 | public class SecuredAnnotationSecurityMetadataSource extends AbstractFallbackMethodSecurityMetadataSource {
private AnnotationMetadataExtractor annotationExtractor;
private @Nullable Class<? extends Annotation> annotationType;
public SecuredAnnotationSecurityMetadataSource() {
this(new SecuredAnnotationMetadataExtractor());
}
public SecuredAnnotationSecurityMetadataSource(AnnotationMetadataExtractor annotationMetadataExtractor) {
Assert.notNull(annotationMetadataExtractor, "annotationMetadataExtractor cannot be null");
this.annotationExtractor = annotationMetadataExtractor;
this.annotationType = (Class<? extends Annotation>) GenericTypeResolver
.resolveTypeArgument(this.annotationExtractor.getClass(), AnnotationMetadataExtractor.class);
Assert.notNull(this.annotationType, () -> this.annotationExtractor.getClass().getName()
+ " must supply a generic parameter for AnnotationMetadataExtractor");
}
@Override
protected Collection<ConfigAttribute> findAttributes(Class<?> clazz) {
return processAnnotation(AnnotationUtils.findAnnotation(clazz, this.annotationType));
}
@Override
protected Collection<ConfigAttribute> findAttributes(Method method, Class<?> targetClass) {
return processAnnotation(AnnotationUtils.findAnnotation(method, this.annotationType));
}
@Override
public @Nullable Collection<ConfigAttribute> getAllConfigAttributes() {
return null; | }
private @Nullable Collection<ConfigAttribute> processAnnotation(@Nullable Annotation annotation) {
return (annotation != null) ? this.annotationExtractor.extractAttributes(annotation) : null;
}
static class SecuredAnnotationMetadataExtractor implements AnnotationMetadataExtractor<Secured> {
@Override
public Collection<ConfigAttribute> extractAttributes(Secured secured) {
String[] attributeTokens = secured.value();
List<ConfigAttribute> attributes = new ArrayList<>(attributeTokens.length);
for (String token : attributeTokens) {
attributes.add(new SecurityConfig(token));
}
return attributes;
}
}
} | repos\spring-security-main\access\src\main\java\org\springframework\security\access\annotation\SecuredAnnotationSecurityMetadataSource.java | 1 |
请完成以下Java代码 | public final class LoggingHelper
{
public static void log(final Logger logger, final Level level, final String msg, final Throwable t)
{
if (logger == null)
{
System.err.println(msg);
if (t != null)
{
t.printStackTrace(System.err);
}
}
else if (level == Level.ERROR)
{
logger.error(msg, t);
}
else if (level == Level.WARN)
{
logger.warn(msg, t);
}
else if (level == Level.INFO)
{
logger.info(msg, t);
}
else if (level == Level.DEBUG)
{
logger.debug(msg, t);
}
else
{
logger.trace(msg, t);
}
}
public static void log(final Logger logger, final Level level, final String msg, final Object... msgParameters)
{
if (logger == null) | {
System.err.println(msg + " -- " + (msgParameters == null ? "" : Arrays.asList(msgParameters)));
}
else if (level == Level.ERROR)
{
logger.error(msg, msgParameters);
}
else if (level == Level.WARN)
{
logger.warn(msg, msgParameters);
}
else if (level == Level.INFO)
{
logger.info(msg, msgParameters);
}
else if (level == Level.DEBUG)
{
logger.debug(msg, msgParameters);
}
else
{
logger.trace(msg, msgParameters);
}
}
private LoggingHelper()
{
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\org\adempiere\util\logging\LoggingHelper.java | 1 |
请完成以下Java代码 | public abstract class BaseVersionedEntity<D extends BaseData & HasVersion> extends BaseSqlEntity<D> implements HasVersion {
@Getter @Setter
@Version
@Column(name = ModelConstants.VERSION_PROPERTY)
protected Long version;
public BaseVersionedEntity() {
super();
}
public BaseVersionedEntity(D domain) {
super(domain);
this.version = domain.getVersion();
} | public BaseVersionedEntity(BaseVersionedEntity<?> entity) {
super(entity);
this.version = entity.version;
}
@Override
public String toString() {
return "BaseVersionedEntity{" +
"id=" + id +
", createdTime=" + createdTime +
", version=" + version +
'}';
}
} | repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\model\BaseVersionedEntity.java | 1 |
请完成以下Java代码 | public String getSubject ()
{
return (String)get_Value(COLUMNNAME_Subject);
}
/** Set Mail Message.
@param W_MailMsg_ID
Web Store Mail Message Template
*/
public void setW_MailMsg_ID (int W_MailMsg_ID)
{
if (W_MailMsg_ID < 1)
set_ValueNoCheck (COLUMNNAME_W_MailMsg_ID, null);
else
set_ValueNoCheck (COLUMNNAME_W_MailMsg_ID, Integer.valueOf(W_MailMsg_ID));
}
/** Get Mail Message.
@return Web Store Mail Message Template
*/
public int getW_MailMsg_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_W_MailMsg_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_W_Store getW_Store() throws RuntimeException
{
return (I_W_Store)MTable.get(getCtx(), I_W_Store.Table_Name)
.getPO(getW_Store_ID(), get_TrxName()); }
/** Set Web Store.
@param W_Store_ID
A Web Store of the Client
*/
public void setW_Store_ID (int W_Store_ID) | {
if (W_Store_ID < 1)
set_Value (COLUMNNAME_W_Store_ID, null);
else
set_Value (COLUMNNAME_W_Store_ID, Integer.valueOf(W_Store_ID));
}
/** Get Web Store.
@return A Web Store of the Client
*/
public int getW_Store_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_W_Store_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_W_MailMsg.java | 1 |
请完成以下Java代码 | public Optional<WarehouseId> getWarehouseDest(final IContext context)
{
final I_M_AttributeSetInstance asi = context.getM_AttributeSetInstance();
if (asi == null || asi.getM_AttributeSetInstance_ID() <= 0)
{
return Optional.empty();
}
final IAttributeDAO attributeDAO = Services.get(IAttributeDAO.class);
final IAttributeSetInstanceBL asiBL = Services.get(IAttributeSetInstanceBL.class);
final AttributeId qualityInspectionCycleAttributeId = attributeDAO.retrieveActiveAttributeIdByValueOrNull(IHUMaterialTrackingBL.ATTRIBUTENAME_QualityInspectionCycle);
if(qualityInspectionCycleAttributeId == null)
{
return Optional.empty();
}
final AttributeSetInstanceId asiId = AttributeSetInstanceId.ofRepoId(asi.getM_AttributeSetInstance_ID());
final I_M_AttributeInstance qualityInspectionCycleAttributeInstance = asiBL.getAttributeInstance(asiId, qualityInspectionCycleAttributeId);
if (qualityInspectionCycleAttributeInstance == null)
{
return Optional.empty(); | }
final String qualityInspectionCycleValue = qualityInspectionCycleAttributeInstance.getValue();
if (Check.isEmpty(qualityInspectionCycleValue, true))
{
return Optional.empty();
}
final String sysconfigName = SYSCONFIG_QualityInspectionWarehouseDest_Prefix
+ "." + context.getM_Warehouse_ID()
+ "." + qualityInspectionCycleValue;
final int warehouseDestId = Services.get(ISysConfigBL.class).getIntValue(sysconfigName, -1, context.getAD_Client_ID(), context.getAD_Org_ID());
return WarehouseId.optionalOfRepoId(warehouseDestId);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\materialtracking\impl\QualityInspectionWarehouseDestProvider.java | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.