instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请完成以下Java代码
|
public void setIPA_SSCC18 (final java.lang.String IPA_SSCC18)
{
set_Value (COLUMNNAME_IPA_SSCC18, IPA_SSCC18);
}
@Override
public java.lang.String getIPA_SSCC18()
{
return get_ValueAsString(COLUMNNAME_IPA_SSCC18);
}
@Override
public void setIsManual_IPA_SSCC18 (final boolean IsManual_IPA_SSCC18)
{
set_Value (COLUMNNAME_IsManual_IPA_SSCC18, IsManual_IPA_SSCC18);
}
@Override
public boolean isManual_IPA_SSCC18()
{
return get_ValueAsBoolean(COLUMNNAME_IsManual_IPA_SSCC18);
}
@Override
public void setM_HU_ID (final int M_HU_ID)
{
if (M_HU_ID < 1)
set_Value (COLUMNNAME_M_HU_ID, null);
else
set_Value (COLUMNNAME_M_HU_ID, M_HU_ID);
}
@Override
public int getM_HU_ID()
{
return get_ValueAsInt(COLUMNNAME_M_HU_ID);
}
@Override
public void setM_HU_PackagingCode_ID (final int M_HU_PackagingCode_ID)
{
if (M_HU_PackagingCode_ID < 1)
set_Value (COLUMNNAME_M_HU_PackagingCode_ID, null);
else
set_Value (COLUMNNAME_M_HU_PackagingCode_ID, M_HU_PackagingCode_ID);
}
@Override
public int getM_HU_PackagingCode_ID()
{
return get_ValueAsInt(COLUMNNAME_M_HU_PackagingCode_ID);
}
@Override
public void setM_HU_PackagingCode_Text (final @Nullable java.lang.String M_HU_PackagingCode_Text)
{
throw new IllegalArgumentException ("M_HU_PackagingCode_Text is virtual column"); }
@Override
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 boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof MyPair)) {
return false;
}
MyPair other = (MyPair) obj;
if (first == null) {
if (other.first != null) {
return false;
}
} else if (!first.equals(other.first)) {
return false;
}
if (second == null) {
if (other.second != null) {
return false;
}
} else if (!second.equals(other.second)) {
return false;
}
return true;
}
|
public String getFirst() {
return first;
}
public void setFirst(String first) {
this.first = first;
}
public String getSecond() {
return second;
}
public void setSecond(String second) {
this.second = second;
}
}
|
repos\tutorials-master\jackson-modules\jackson-conversions\src\main\java\com\baeldung\jackson\map\MyPair.java
| 1
|
请完成以下Java代码
|
public class UserBO {
/** 用户编号 **/
private Integer id;
/** 用户名 **/
private String username;
/** 密码 **/
private String password;
public Integer getId() {
return id;
}
public UserBO setId(Integer id) {
this.id = id;
return this;
}
public String getUsername() {
return username;
}
|
public UserBO setUsername(String username) {
this.username = username;
return this;
}
public String getPassword() {
return password;
}
public UserBO setPassword(String password) {
this.password = password;
return this;
}
}
|
repos\SpringBoot-Labs-master\lab-55\lab-55-mapstruct-demo\src\main\java\cn\iocoder\springboot\lab55\mapstructdemo\bo\UserBO.java
| 1
|
请完成以下Java代码
|
protected Object generateKey(Collection<? extends Cache> caches, String key, Method method, Object[] args,
Object target, Object result) {
// 获取注解上的key属性值
Class<?> targetClass = getTargetClass(target);
if (org.springframework.util.StringUtils.hasText(key)) {
EvaluationContext evaluationContext = evaluator.createEvaluationContext(caches, method, args, target,
targetClass, result, null);
AnnotatedElementKey methodCacheKey = new AnnotatedElementKey(method, targetClass);
return evaluator.key(key, methodCacheKey, evaluationContext);
}
return this.keyGenerator.generate(target, method, args);
}
/**
* 获取类信息
*
* @param target
* @return
*/
private Class<?> getTargetClass(Object target) {
Class<?> targetClass = AopProxyUtils.ultimateTargetClass(target);
if (targetClass == null && target != null) {
targetClass = target.getClass();
}
return targetClass;
}
/**
* 通过cache名称获取cache列表
*
* @param annotatedCacheNames
* @return
*/
public Collection<? extends Cache> getCache(Set<String> annotatedCacheNames) {
Collection<String> cacheNames = generateValue(annotatedCacheNames);
if (cacheNames == null) {
return Collections.emptyList();
} else {
Collection<Cache> result = new ArrayList<Cache>();
for (String cacheName : cacheNames) {
|
Cache cache = this.cacheManager.getCache(cacheName);
if (cache == null) {
throw new IllegalArgumentException("Cannot find cache named '" + cacheName + "' for ");
}
result.add(cache);
}
return result;
}
}
private String getInvocationCacheKey(String cacheKey) {
return cacheKey + INVOCATION_CACHE_KEY_SUFFIX;
}
/**
* 获取注解上的value属性值(cacheNames)
*
* @param annotatedCacheNames
* @return
*/
private Collection<String> generateValue(Set<String> annotatedCacheNames) {
Collection<String> cacheNames = new HashSet<>();
for (final String cacheName : annotatedCacheNames) {
String[] cacheParams = cacheName.split(SEPARATOR);
// 截取名称获取真实的value值
String realCacheName = cacheParams[0];
cacheNames.add(realCacheName);
}
return cacheNames;
}
}
|
repos\spring-boot-student-master\spring-boot-student-cache-redis\src\main\java\com\xiaolyuh\redis\cache\CacheSupportImpl.java
| 1
|
请完成以下Java代码
|
public void setAD_WF_Node_ID (final int AD_WF_Node_ID)
{
if (AD_WF_Node_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_WF_Node_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_WF_Node_ID, AD_WF_Node_ID);
}
@Override
public int getAD_WF_Node_ID()
{
return get_ValueAsInt(COLUMNNAME_AD_WF_Node_ID);
}
@Override
public void setAD_WF_NodeNext_ID (final int AD_WF_NodeNext_ID)
{
if (AD_WF_NodeNext_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_WF_NodeNext_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_WF_NodeNext_ID, AD_WF_NodeNext_ID);
}
@Override
public int getAD_WF_NodeNext_ID()
{
return get_ValueAsInt(COLUMNNAME_AD_WF_NodeNext_ID);
}
@Override
public void setDescription (final java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
@Override
public java.lang.String getDescription()
{
return get_ValueAsString(COLUMNNAME_Description);
}
/**
* EntityType AD_Reference_ID=389
* Reference name: _EntityTypeNew
*/
public static final int ENTITYTYPE_AD_Reference_ID=389;
@Override
public void setEntityType (final java.lang.String EntityType)
{
set_Value (COLUMNNAME_EntityType, EntityType);
}
@Override
public java.lang.String getEntityType()
{
return get_ValueAsString(COLUMNNAME_EntityType);
}
@Override
public void setIsStdUserWorkflow (final boolean IsStdUserWorkflow)
{
set_Value (COLUMNNAME_IsStdUserWorkflow, IsStdUserWorkflow);
}
|
@Override
public boolean isStdUserWorkflow()
{
return get_ValueAsBoolean(COLUMNNAME_IsStdUserWorkflow);
}
@Override
public void setSeqNo (final int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, SeqNo);
}
@Override
public int getSeqNo()
{
return get_ValueAsInt(COLUMNNAME_SeqNo);
}
@Override
public void setTransitionCode (final java.lang.String TransitionCode)
{
set_Value (COLUMNNAME_TransitionCode, TransitionCode);
}
@Override
public java.lang.String getTransitionCode()
{
return get_ValueAsString(COLUMNNAME_TransitionCode);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_WF_NodeNext.java
| 1
|
请完成以下Java代码
|
public void send(@NonNull final InOutChangedEvent event)
{
sendEventObj(TOPIC_InOut, event);
}
public void send(@NonNull final InvoiceChangedEvent event)
{
sendEventObj(TOPIC_Invoice, event);
}
private void sendEventObj(final Topic topic, final Object eventObj)
{
final Event event = toEvent(eventObj);
Services.get(ITrxManager.class)
.getCurrentTrxListenerManagerOrAutoCommit()
.newEventListener(TrxEventTiming.AFTER_COMMIT)
.invokeMethodJustOnce(true)
.registerHandlingMethod(trx -> sendEventNow(topic, event));
}
private void sendEventNow(final Topic topic, final Event event)
{
final IEventBus eventBus = Services.get(IEventBusFactory.class).getEventBus(topic);
eventBus.enqueueEvent(event);
}
private static Event toEvent(final Object event)
{
final SimpleObjectSerializer objectSerializer = SimpleObjectSerializer.get();
return Event.builder()
.putProperty(EVENT_PROPERTY_Content, objectSerializer.serialize(event))
|
.shallBeLogged()
.build();
}
public static InOutChangedEvent extractInOutChangedEvent(@NonNull final Event event)
{
return extractEvent(event, InOutChangedEvent.class);
}
public static InvoiceChangedEvent extractInvoiceChangedEvent(@NonNull final Event event)
{
return extractEvent(event, InvoiceChangedEvent.class);
}
public static <T> T extractEvent(@NonNull final Event event, @NonNull final Class<T> eventType)
{
final String json = event.getPropertyAsString(EVENT_PROPERTY_Content);
final SimpleObjectSerializer objectSerializer = SimpleObjectSerializer.get();
return objectSerializer.deserialize(json, eventType);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\bpartner\product\stats\BPartnerProductStatsEventSender.java
| 1
|
请完成以下Java代码
|
public void setCamundaDecisionRefBinding(String camundaDecisionRefBinding) {
camundaDecisionRefBindingAttribute.setValue(this, camundaDecisionRefBinding);
}
public String getCamundaDecisionRefVersion() {
return camundaDecisionRefVersionAttribute.getValue(this);
}
public void setCamundaDecisionRefVersion(String camundaDecisionRefVersion) {
camundaDecisionRefVersionAttribute.setValue(this, camundaDecisionRefVersion);
}
public String getCamundaDecisionRefVersionTag() {
return camundaDecisionRefVersionTagAttribute.getValue(this);
}
public void setCamundaDecisionRefVersionTag(String camundaDecisionRefVersionTag) {
camundaDecisionRefVersionTagAttribute.setValue(this, camundaDecisionRefVersionTag);
}
@Override
public String getCamundaMapDecisionResult() {
return camundaMapDecisionResultAttribute.getValue(this);
}
@Override
public void setCamundaMapDecisionResult(String camundaMapDecisionResult) {
|
camundaMapDecisionResultAttribute.setValue(this, camundaMapDecisionResult);
}
public String getCamundaDecisionRefTenantId() {
return camundaDecisionRefTenantIdAttribute.getValue(this);
}
public void setCamundaDecisionRefTenantId(String tenantId) {
camundaDecisionRefTenantIdAttribute.setValue(this, tenantId);
}
@Override
public String getCamundaTaskPriority() {
return camundaTaskPriorityAttribute.getValue(this);
}
@Override
public void setCamundaTaskPriority(String taskPriority) {
camundaTaskPriorityAttribute.setValue(this, taskPriority);
}
}
|
repos\camunda-bpm-platform-master\model-api\bpmn-model\src\main\java\org\camunda\bpm\model\bpmn\impl\instance\BusinessRuleTaskImpl.java
| 1
|
请完成以下Java代码
|
public String buildKey(final ModelType model)
{
return buildAggregationKey(model)
.getAggregationKeyString();
}
@Override
public AggregationKey buildAggregationKey(final ModelType model)
{
if (aggregationKeyBuilders.isEmpty())
{
throw new AdempiereException("No aggregation key builders added");
}
final List<String> keyParts = new ArrayList<>();
final Set<AggregationId> aggregationIds = new HashSet<>();
for (final IAggregationKeyBuilder<ModelType> aggregationKeyBuilder : aggregationKeyBuilders)
{
final AggregationKey keyPart = aggregationKeyBuilder.buildAggregationKey(model);
keyParts.add(keyPart.getAggregationKeyString());
aggregationIds.add(keyPart.getAggregationId());
}
final AggregationId aggregationId = CollectionUtils.singleElementOrDefault(aggregationIds, null);
|
return new AggregationKey(Util.mkKey(keyParts.toArray()), aggregationId);
}
@Override
public boolean isSame(final ModelType model1, final ModelType model2)
{
if (model1 == model2)
{
return true;
}
final String key1 = buildKey(model1);
final String key2 = buildKey(model2);
return Objects.equals(key1, key2);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.aggregation\src\main\java\de\metas\aggregation\api\CompositeAggregationKeyBuilder.java
| 1
|
请完成以下Java代码
|
public Builder setProcessClassname(final String processClassname)
{
this.processClassname = StringUtils.trimBlankToNull(processClassname);
processClass = loadProcessClass(this.processClassname);
return this;
}
private String getProcessClassname()
{
return processClassname;
}
@Nullable private Class<?> getProcessClassOrNull()
{
return processClass.orElse(null);
}
private static Optional<Class<?>> loadProcessClass(@Nullable final String classname)
{
if (classname == null || Check.isBlank(classname))
{
return Optional.empty();
}
final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
try
{
final Class<?> processClass = classLoader.loadClass(classname);
return Optional.of(processClass);
}
catch (final ClassNotFoundException e)
{
logger.warn("Cannot load process class: {}", classname, e);
return Optional.empty();
}
}
@Nullable private Class<? extends IProcessDefaultParametersProvider> getProcessDefaultParametersProvider()
{
final Class<?> processClass = getProcessClassOrNull();
if (processClass == null || !IProcessDefaultParametersProvider.class.isAssignableFrom(processClass))
{
return null;
}
try
{
return processClass.asSubclass(IProcessDefaultParametersProvider.class);
}
catch (final Exception e)
{
logger.warn(e.getLocalizedMessage(), e);
return null;
}
|
}
public Builder setParametersDescriptor(final DocumentEntityDescriptor parametersDescriptor)
{
this.parametersDescriptor = parametersDescriptor;
return this;
}
private DocumentEntityDescriptor getParametersDescriptor()
{
return parametersDescriptor;
}
public Builder setLayout(final ProcessLayout layout)
{
this.layout = layout;
return this;
}
private ProcessLayout getLayout()
{
Check.assumeNotNull(layout, "Parameter layout is not null");
return layout;
}
public Builder setStartProcessDirectly(final boolean startProcessDirectly)
{
this.startProcessDirectly = startProcessDirectly;
return this;
}
private boolean isStartProcessDirectly()
{
if (startProcessDirectly != null)
{
return startProcessDirectly;
}
else
{
return computeIsStartProcessDirectly();
}
}
private boolean computeIsStartProcessDirectly()
{
return (getParametersDescriptor() == null || getParametersDescriptor().getFields().isEmpty())
&& TranslatableStrings.isEmpty(getLayout().getDescription());
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\process\descriptor\ProcessDescriptor.java
| 1
|
请完成以下Java代码
|
public Tagger createTagger()
{
if (featureIndex_ == null)
{
return null;
}
TaggerImpl tagger = new TaggerImpl(TaggerImpl.Mode.TEST);
tagger.open(featureIndex_, nbest_, vlevel_);
return tagger;
}
public boolean open(String arg)
{
return open(arg.split(" ", -1));
}
private static class Option
{
@Argument(description = "set FILE for model file", alias = "m", required = true)
String model;
@Argument(description = "output n-best results", alias = "n")
Integer nbest = 0;
@Argument(description = "set INT for verbose level", alias = "v")
Integer verbose = 0;
@Argument(description = "set cost factor", alias = "c")
Double cost_factor = 1.0;
}
public boolean open(String[] args)
{
Option cmd = new Option();
try
{
Args.parse(cmd, args);
}
catch (IllegalArgumentException e)
{
System.err.println("invalid arguments");
return false;
}
String model = cmd.model;
int nbest = cmd.nbest;
int vlevel = cmd.verbose;
double costFactor = cmd.cost_factor;
return open(model, nbest, vlevel, costFactor);
}
public boolean open(InputStream stream, int nbest, int vlevel, double costFactor)
{
featureIndex_ = new DecoderFeatureIndex();
nbest_ = nbest;
vlevel_ = vlevel;
if (costFactor > 0)
{
featureIndex_.setCostFactor_(costFactor);
}
return featureIndex_.open(stream);
}
public boolean open(String model, int nbest, int vlevel, double costFactor)
{
try
{
InputStream stream = IOUtil.newInputStream(model);
return open(stream, nbest, vlevel, costFactor);
}
catch (Exception e)
{
return false;
}
|
}
public String getTemplate()
{
if (featureIndex_ != null)
{
return featureIndex_.getTemplate();
}
else
{
return null;
}
}
public int getNbest_()
{
return nbest_;
}
public void setNbest_(int nbest_)
{
this.nbest_ = nbest_;
}
public int getVlevel_()
{
return vlevel_;
}
public void setVlevel_(int vlevel_)
{
this.vlevel_ = vlevel_;
}
public DecoderFeatureIndex getFeatureIndex_()
{
return featureIndex_;
}
public void setFeatureIndex_(DecoderFeatureIndex featureIndex_)
{
this.featureIndex_ = featureIndex_;
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\model\crf\crfpp\ModelImpl.java
| 1
|
请完成以下Java代码
|
public String getMobNb() {
return mobNb;
}
/**
* Sets the value of the mobNb property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMobNb(String value) {
this.mobNb = value;
}
/**
* Gets the value of the faxNb property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFaxNb() {
return faxNb;
}
/**
* Sets the value of the faxNb property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFaxNb(String value) {
this.faxNb = value;
}
/**
* Gets the value of the emailAdr property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEmailAdr() {
return emailAdr;
}
/**
* Sets the value of the emailAdr property.
*
* @param value
* allowed object is
|
* {@link String }
*
*/
public void setEmailAdr(String value) {
this.emailAdr = value;
}
/**
* Gets the value of the othr property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOthr() {
return othr;
}
/**
* Sets the value of the othr property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOthr(String value) {
this.othr = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_02\ContactDetails2.java
| 1
|
请完成以下Java代码
|
private static ImmutableListMultimap<Class, MaterialEventHandler> createEventHandlerMapping(
@NonNull final Optional<Collection<MaterialEventHandler>> handlers)
{
final ImmutableListMultimap.Builder<Class, MaterialEventHandler> builder = ImmutableListMultimap.builder();
for (final MaterialEventHandler handler : handlers.orElse(ImmutableList.of()))
{
@SuppressWarnings("unchecked")
final Collection<Class<? extends MaterialEventHandler>> handeledEventTypes = handler.getHandledEventType();
for (final Class<? extends MaterialEventHandler> handeledEventType : handeledEventTypes)
{
builder.put(handeledEventType, handler);
}
}
return builder.build();
}
public final void onEvent(@NonNull final MaterialEvent event)
{
final ImmutableList<MaterialEventHandler> handlersForEventClass = eventType2Handler.get(event.getClass());
|
for (final MaterialEventHandler handler : handlersForEventClass)
{
try (final MDCCloseable ignored = MDC.putCloseable("MaterialEventHandlerClass", handler.getClass().getName()))
{
@SuppressWarnings("unchecked")
final InvokeHandlerAndLogRequest request = InvokeHandlerAndLogRequest.builder()
.handlerClass(handler.getClass())
.invokaction(() -> handler.handleEvent(event))
.build();
eventLogUserService.invokeHandlerAndLog(request);
}
}
if (!handlersForEventClass.isEmpty())
{
materialEventObserver.reportEventProcessed(event);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.material\event\src\main\java\de\metas\material\event\MaterialEventHandlerRegistry.java
| 1
|
请完成以下Spring Boot application配置
|
# Spring boot application
spring.application.name=dubbo-zookeeper-service-introspection-provider-sample
# Zookeeper Server Configuration
zookeeper.server.host = 127.0.0.1
zookeeper.server.port = 2181
# Dubbo Spring Boot Externalization Configuration
## "composite" is a new metadata type introduced since 2.7.8
dubbo.application.metadata-type=composite
## Base packages to scan Dubbo Component: @org.apache.dubbo.config.annotation.Service
dubbo.scan.base-packages=org.apache.dubbo.spring.boot.sample.provider.service
## The default value of dubbo.application.name is ${spring.application.name}
## dubbo.application.name=${spring.application.name}
## Dubbo Protocol
dubbo.protocol.name=dubbo
## Random port
dubbo.protocol.port=-1
## Dubbo Regis
|
try
dubbo.registry.address=zookeeper://${zookeeper.server.host}:${zookeeper.server.port}?registry-type=service
## "dubbo.registry.use-as-*" property will be auto-detected since 2.7.8
# dubbo.registry.use-as-config-center=true
# dubbo.registry.use-as-metadata-center=true
## DemoService version
demo.service.version=1.0.0
|
repos\dubbo-spring-boot-project-master\dubbo-spring-boot-samples\service-introspection-samples\zookeeper-samples\provider-sample\src\main\resources\application.properties
| 2
|
请完成以下Java代码
|
public Word2VecTrainer setNumIterations(int iterations)
{
Preconditions.checkArgument(iterations > 0, "Value must be positive");
this.iterations = iterations;
return this;
}
/**
* 执行训练
*
* @param trainFileName 输入语料文件
* @param modelFileName 输出模型路径
* @return 词向量模型
*/
public WordVectorModel train(String trainFileName, String modelFileName)
{
Config settings = new Config();
settings.setInputFile(trainFileName);
settings.setLayer1Size(layerSize);
settings.setUseContinuousBagOfWords(type == NeuralNetworkType.CBOW);
settings.setUseHierarchicalSoftmax(useHierarchicalSoftmax);
settings.setNegative(negativeSamples);
settings.setNumThreads(numThreads);
settings.setAlpha(initialLearningRate == null ? type.getDefaultInitialLearningRate() : initialLearningRate);
settings.setSample(downSampleRate);
settings.setWindow(windowSize);
settings.setIter(iterations);
settings.setMinCount(minFrequency);
settings.setOutputFile(modelFileName);
Word2VecTraining model = new Word2VecTraining(settings);
final long timeStart = System.currentTimeMillis();
// if (callback == null)
// {
// callback = new TrainingCallback()
// {
// public void corpusLoading(float percent)
// {
// System.out.printf("\r加载训练语料:%.2f%%", percent);
// }
//
// public void corpusLoaded(int vocWords, int trainWords, int totalWords)
// {
// System.out.println();
// System.out.printf("词表大小:%d\n", vocWords);
// System.out.printf("训练词数:%d\n", trainWords);
// System.out.printf("语料词数:%d\n", totalWords);
// }
//
// public void training(float alpha, float progress)
// {
|
// System.out.printf("\r学习率:%.6f 进度:%.2f%%", alpha, progress);
// long timeNow = System.currentTimeMillis();
// long costTime = timeNow - timeStart + 1;
// progress /= 100;
// String etd = Utility.humanTime((long) (costTime / progress * (1.f - progress)));
// if (etd.length() > 0) System.out.printf(" 剩余时间:%s", etd);
// System.out.flush();
// }
// };
// }
settings.setCallback(callback);
try
{
model.trainModel();
System.out.println();
System.out.printf("训练结束,一共耗时:%s\n", Utility.humanTime(System.currentTimeMillis() - timeStart));
return new WordVectorModel(modelFileName);
}
catch (IOException e)
{
Predefine.logger.warning("训练过程中发生IO异常\n" + TextUtility.exceptionToString(e));
}
return null;
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\mining\word2vec\Word2VecTrainer.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void setPostal(String value) {
this.postal = value;
}
/**
* Gets the value of the value property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setValue(String value) {
this.value = value;
}
/**
* Gets the value of the vaTaxID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVATaxID() {
return vaTaxID;
}
/**
* Sets the value of the vaTaxID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVATaxID(String value) {
this.vaTaxID = value;
}
/**
* Gets the value of the referenceNo property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getReferenceNo() {
return referenceNo;
}
/**
* Sets the value of the referenceNo property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setReferenceNo(String value) {
this.referenceNo = value;
}
/**
|
* Gets the value of the setupPlaceNo property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSetupPlaceNo() {
return setupPlaceNo;
}
/**
* Sets the value of the setupPlaceNo property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSetupPlaceNo(String value) {
this.setupPlaceNo = value;
}
/**
* Gets the value of the siteName property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSiteName() {
return siteName;
}
/**
* Sets the value of the siteName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSiteName(String value) {
this.siteName = value;
}
/**
* Gets the value of the contact property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getContact() {
return contact;
}
/**
* Sets the value of the contact property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setContact(String value) {
this.contact = value;
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_metasfreshinhousev1\de\metas\edi\esb\jaxb\metasfreshinhousev1\EDICctop119VType.java
| 2
|
请完成以下Java代码
|
public void run()
{
if( url == null )
{
// restore the original cursor
html.setCursor( cursor );
// PENDING(prinz) remove this hack when
// automatic validation is activated.
Container parent = html.getParent();
parent.repaint();
}
else
{
Document doc = html.getDocument();
try {
|
html.setPage( url );
}
catch( IOException ioe )
{
html.setDocument( doc );
}
finally
{
// schedule the cursor to revert after
// the paint has happended.
url = null;
SwingUtilities.invokeLater( this );
}
}
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\org\adempiere\apps\graph\HtmlDashboard.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getBindAddress() {
return this.bindAddress;
}
public void setBindAddress(String bindAddress) {
this.bindAddress = bindAddress;
}
public String getHostnameForClients() {
return this.hostnameForClients;
}
public void setHostnameForClients(String hostnameForClients) {
this.hostnameForClients = hostnameForClients;
}
public long getLoadPollInterval() {
return this.loadPollInterval;
}
public void setLoadPollInterval(long loadPollInterval) {
this.loadPollInterval = loadPollInterval;
}
public int getMaxConnections() {
return this.maxConnections;
}
public void setMaxConnections(int maxConnections) {
this.maxConnections = maxConnections;
}
public int getMaxMessageCount() {
return this.maxMessageCount;
}
public void setMaxMessageCount(int maxMessageCount) {
this.maxMessageCount = maxMessageCount;
}
public int getMaxThreads() {
return this.maxThreads;
}
public void setMaxThreads(int maxThreads) {
this.maxThreads = maxThreads;
}
public int getMaxTimeBetweenPings() {
return this.maxTimeBetweenPings;
}
public void setMaxTimeBetweenPings(int maxTimeBetweenPings) {
this.maxTimeBetweenPings = maxTimeBetweenPings;
}
public int getMessageTimeToLive() {
return this.messageTimeToLive;
}
public void setMessageTimeToLive(int messageTimeToLive) {
this.messageTimeToLive = messageTimeToLive;
}
|
public int getPort() {
return this.port;
}
public void setPort(int port) {
this.port = port;
}
public int getSocketBufferSize() {
return this.socketBufferSize;
}
public void setSocketBufferSize(int socketBufferSize) {
this.socketBufferSize = socketBufferSize;
}
public int getSubscriptionCapacity() {
return this.subscriptionCapacity;
}
public void setSubscriptionCapacity(int subscriptionCapacity) {
this.subscriptionCapacity = subscriptionCapacity;
}
public String getSubscriptionDiskStoreName() {
return this.subscriptionDiskStoreName;
}
public void setSubscriptionDiskStoreName(String subscriptionDiskStoreName) {
this.subscriptionDiskStoreName = subscriptionDiskStoreName;
}
public SubscriptionEvictionPolicy getSubscriptionEvictionPolicy() {
return this.subscriptionEvictionPolicy;
}
public void setSubscriptionEvictionPolicy(SubscriptionEvictionPolicy subscriptionEvictionPolicy) {
this.subscriptionEvictionPolicy = subscriptionEvictionPolicy;
}
public boolean isTcpNoDelay() {
return this.tcpNoDelay;
}
public void setTcpNoDelay(boolean tcpNoDelay) {
this.tcpNoDelay = tcpNoDelay;
}
}
|
repos\spring-boot-data-geode-main\spring-geode-project\spring-geode-autoconfigure\src\main\java\org\springframework\geode\boot\autoconfigure\configuration\support\CacheServerProperties.java
| 2
|
请完成以下Java代码
|
public boolean isDepreciated ()
{
Object oo = get_Value(COLUMNNAME_IsDepreciated);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set PostingType.
@param PostingType
The type of posted amount for the transaction
*/
public void setPostingType (String PostingType)
{
set_Value (COLUMNNAME_PostingType, PostingType);
}
/** Get PostingType.
@return The type of posted amount for the transaction
*/
public String getPostingType ()
{
return (String)get_Value(COLUMNNAME_PostingType);
|
}
/** Set Processed.
@param Processed
The document has been processed
*/
public void setProcessed (boolean Processed)
{
set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
}
/** Get Processed.
@return The document has been processed
*/
public boolean isProcessed ()
{
Object oo = get_Value(COLUMNNAME_Processed);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_A_Depreciation_Exp.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public ClientMailTemplates getClientMailTemplatesById(final ClientId clientId)
{
return emailTemplatesCache.getOrLoad(clientId, this::retrieveClientMailTemplatesById);
}
private ClientMailTemplates retrieveClientMailTemplatesById(final ClientId clientId)
{
final I_AD_Client record = getById(clientId);
return toClientMailTemplates(record);
}
private static ClientMailTemplates toClientMailTemplates(@NonNull final I_AD_Client record)
{
return ClientMailTemplates.builder()
.passwordResetMailTemplateId(MailTemplateId.optionalOfRepoId(record.getPasswordReset_MailText_ID()))
.build();
|
}
@Override
public boolean isMultilingualDocumentsEnabled(@NonNull final ClientId adClientId)
{
final I_AD_Client client = getById(adClientId);
return client.isMultiLingualDocument();
}
@Override
public String getClientNameById(@NonNull final ClientId clientId)
{
return getById(clientId).getName();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\service\impl\ClientDAO.java
| 2
|
请完成以下Java代码
|
protected void adjustConfiguration(TimerJobConfiguration configuration, String configPart) {
if (configPart.startsWith(JOB_HANDLER_CONFIG_TASK_LISTENER_PREFIX)) {
configuration.setTimerElementSecondaryKey(configPart.substring(JOB_HANDLER_CONFIG_TASK_LISTENER_PREFIX.length()));
} else {
configuration.followUpJobCreated = JOB_HANDLER_CONFIG_PROPERTY_FOLLOW_UP_JOB_CREATED.equals(configPart);
}
}
public static class TimerJobConfiguration implements JobHandlerConfiguration {
protected String timerElementKey;
protected String timerElementSecondaryKey;
protected boolean followUpJobCreated;
public String getTimerElementKey() {
return timerElementKey;
}
public void setTimerElementKey(String timerElementKey) {
this.timerElementKey = timerElementKey;
}
public boolean isFollowUpJobCreated() {
return followUpJobCreated;
}
public void setFollowUpJobCreated(boolean followUpJobCreated) {
this.followUpJobCreated = followUpJobCreated;
}
public String getTimerElementSecondaryKey() {
return timerElementSecondaryKey;
}
public void setTimerElementSecondaryKey(String timerElementSecondaryKey) {
this.timerElementSecondaryKey = timerElementSecondaryKey;
}
@Override
public String toCanonicalString() {
String canonicalString = timerElementKey;
|
if (timerElementSecondaryKey != null) {
canonicalString += JOB_HANDLER_CONFIG_PROPERTY_DELIMITER + JOB_HANDLER_CONFIG_TASK_LISTENER_PREFIX + timerElementSecondaryKey;
}
if (followUpJobCreated) {
canonicalString += JOB_HANDLER_CONFIG_PROPERTY_DELIMITER + JOB_HANDLER_CONFIG_PROPERTY_FOLLOW_UP_JOB_CREATED;
}
return canonicalString;
}
}
public void onDelete(TimerJobConfiguration configuration, JobEntity jobEntity) {
// do nothing
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\jobexecutor\TimerEventJobHandler.java
| 1
|
请完成以下Java代码
|
public String getAncestorActivityInstanceId() {
return ancestorActivityInstanceId;
}
public void setAncestorActivityInstanceId(String ancestorActivityInstanceId) {
this.ancestorActivityInstanceId = ancestorActivityInstanceId;
}
public boolean isCancelCurrentActiveActivityInstances() {
return cancelCurrentActiveActivityInstances;
}
public void setCancelCurrentActiveActivityInstances(boolean cancelCurrentActiveActivityInstances) {
this.cancelCurrentActiveActivityInstances = cancelCurrentActiveActivityInstances;
}
public abstract void applyTo(ProcessInstanceModificationBuilder builder, ProcessEngine engine, ObjectMapper mapper);
public abstract void applyTo(InstantiationBuilder<?> builder, ProcessEngine engine, ObjectMapper mapper);
protected String buildErrorMessage(String message) {
return "For instruction type '" + type + "': " + message;
}
protected void applyVariables(ActivityInstantiationBuilder<?> builder,
|
ProcessEngine engine, ObjectMapper mapper) {
if (variables != null) {
for (Map.Entry<String, TriggerVariableValueDto> variableValue : variables.entrySet()) {
TriggerVariableValueDto value = variableValue.getValue();
if (value.isLocal()) {
builder.setVariableLocal(variableValue.getKey(), value.toTypedValue(engine, mapper));
}
else {
builder.setVariable(variableValue.getKey(), value.toTypedValue(engine, mapper));
}
}
}
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\runtime\modification\ProcessInstanceModificationInstructionDto.java
| 1
|
请完成以下Java代码
|
public BigDecimal getTaxAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TaxAmt);
if (bd == null)
return Env.ZERO;
return bd;
}
public I_C_ElementValue getUser1() throws RuntimeException
{
return (I_C_ElementValue)MTable.get(getCtx(), I_C_ElementValue.Table_Name)
.getPO(getUser1_ID(), get_TrxName()); }
/** Set User List 1.
@param User1_ID
User defined list element #1
*/
public void setUser1_ID (int User1_ID)
{
if (User1_ID < 1)
set_Value (COLUMNNAME_User1_ID, null);
else
set_Value (COLUMNNAME_User1_ID, Integer.valueOf(User1_ID));
}
/** Get User List 1.
@return User defined list element #1
*/
public int getUser1_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_User1_ID);
if (ii == null)
return 0;
return ii.intValue();
}
|
public I_C_ElementValue getUser2() throws RuntimeException
{
return (I_C_ElementValue)MTable.get(getCtx(), I_C_ElementValue.Table_Name)
.getPO(getUser2_ID(), get_TrxName()); }
/** Set User List 2.
@param User2_ID
User defined list element #2
*/
public void setUser2_ID (int User2_ID)
{
if (User2_ID < 1)
set_Value (COLUMNNAME_User2_ID, null);
else
set_Value (COLUMNNAME_User2_ID, Integer.valueOf(User2_ID));
}
/** Get User List 2.
@return User defined list element #2
*/
public int getUser2_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_User2_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_C_InvoiceBatchLine.java
| 1
|
请完成以下Java代码
|
public String getZsr() {
return zsr;
}
/**
* Sets the value of the zsr property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setZsr(String value) {
this.zsr = value;
}
/**
* Gets the value of the specialty property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSpecialty() {
return specialty;
}
/**
* Sets the value of the specialty property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSpecialty(String value) {
this.specialty = value;
}
/**
* Gets the value of the uidNumber property.
*
* @return
* possible object is
|
* {@link String }
*
*/
public String getUidNumber() {
return uidNumber;
}
/**
* Sets the value of the uidNumber property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUidNumber(String value) {
this.uidNumber = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_440_request\src\main\java-xjc\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_440\request\BillerAddressType.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
String replace(String className) {
return this.replacements.getOrDefault(className, className);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
return this.replacements.equals(((AutoConfigurationReplacements) obj).replacements);
}
@Override
public int hashCode() {
return this.replacements.hashCode();
}
/**
* Loads the relocations from the classpath. Relocations are stored in files named
* {@code META-INF/spring/full-qualified-annotation-name.replacements} on the
* classpath. The file is loaded using {@link Properties#load(java.io.InputStream)}
* with each entry containing an auto-configuration class name as the key and the
* replacement class name as the value.
* @param annotation annotation to load
* @param classLoader class loader to use for loading
* @return list of names of annotated classes
*/
static AutoConfigurationReplacements load(Class<?> annotation, @Nullable ClassLoader classLoader) {
Assert.notNull(annotation, "'annotation' must not be null");
ClassLoader classLoaderToUse = decideClassloader(classLoader);
String location = String.format(LOCATION, annotation.getName());
Enumeration<URL> urls = findUrlsInClasspath(classLoaderToUse, location);
Map<String, String> replacements = new HashMap<>();
while (urls.hasMoreElements()) {
URL url = urls.nextElement();
replacements.putAll(readReplacements(url));
}
|
return new AutoConfigurationReplacements(replacements);
}
private static ClassLoader decideClassloader(@Nullable ClassLoader classLoader) {
if (classLoader == null) {
return ImportCandidates.class.getClassLoader();
}
return classLoader;
}
private static Enumeration<URL> findUrlsInClasspath(ClassLoader classLoader, String location) {
try {
return classLoader.getResources(location);
}
catch (IOException ex) {
throw new IllegalArgumentException("Failed to load configurations from location [" + location + "]", ex);
}
}
@SuppressWarnings({ "unchecked", "rawtypes" })
private static Map<String, String> readReplacements(URL url) {
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(new UrlResource(url).getInputStream(), StandardCharsets.UTF_8))) {
Properties properties = new Properties();
properties.load(reader);
return (Map) properties;
}
catch (IOException ex) {
throw new IllegalArgumentException("Unable to load replacements from location [" + url + "]", ex);
}
}
}
|
repos\spring-boot-4.0.1\core\spring-boot-autoconfigure\src\main\java\org\springframework\boot\autoconfigure\AutoConfigurationReplacements.java
| 2
|
请完成以下Java代码
|
public void addMoveToFlowElement(String activityId, FlowElement originalFlowElement) {
moveToFlowElementMap.put(activityId, new FlowElementMoveEntry(originalFlowElement, originalFlowElement));
}
public FlowElementMoveEntry getMoveToFlowElement(String activityId) {
return moveToFlowElementMap.get(activityId);
}
public List<FlowElementMoveEntry> getMoveToFlowElements() {
return new ArrayList<>(moveToFlowElementMap.values());
}
public void addCurrentActivityToNewElement(String curentActivityId, FlowElement originalFlowElement, FlowElement newFlowElement) {
currentActivityToNewElementMap.put(curentActivityId, new FlowElementMoveEntry(originalFlowElement, newFlowElement));
}
public FlowElementMoveEntry getCurrentActivityToNewElement(String curentActivityId) {
return currentActivityToNewElementMap.get(curentActivityId);
}
public List<String> getNewExecutionIds() {
return newExecutionIds;
}
public boolean hasNewExecutionId(String executionId) {
return newExecutionIds.contains(executionId);
}
public void setNewExecutionIds(List<String> newExecutionIds) {
this.newExecutionIds = newExecutionIds;
}
public void addNewExecutionId(String executionId) {
this.newExecutionIds.add(executionId);
}
public ExecutionEntity getCreatedEventSubProcess(String processDefinitionId) {
return createdEventSubProcesses.get(processDefinitionId);
}
|
public void addCreatedEventSubProcess(String processDefinitionId, ExecutionEntity executionEntity) {
createdEventSubProcesses.put(processDefinitionId, executionEntity);
}
public Map<String, Map<String, Object>> getFlowElementLocalVariableMap() {
return flowElementLocalVariableMap;
}
public void setFlowElementLocalVariableMap(Map<String, Map<String, Object>> flowElementLocalVariableMap) {
this.flowElementLocalVariableMap = flowElementLocalVariableMap;
}
public void addLocalVariableMap(String activityId, Map<String, Object> localVariables) {
this.flowElementLocalVariableMap.put(activityId, localVariables);
}
public static class FlowElementMoveEntry {
protected FlowElement originalFlowElement;
protected FlowElement newFlowElement;
public FlowElementMoveEntry(FlowElement originalFlowElement, FlowElement newFlowElement) {
this.originalFlowElement = originalFlowElement;
this.newFlowElement = newFlowElement;
}
public FlowElement getOriginalFlowElement() {
return originalFlowElement;
}
public FlowElement getNewFlowElement() {
return newFlowElement;
}
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\dynamic\MoveExecutionEntityContainer.java
| 1
|
请完成以下Java代码
|
protected org.compiere.model.POInfo initPO(final Properties ctx)
{
return org.compiere.model.POInfo.getPOInfo(Table_Name);
}
@Override
public void setAD_Table_ID (final int AD_Table_ID)
{
if (AD_Table_ID < 1)
set_Value (COLUMNNAME_AD_Table_ID, null);
else
set_Value (COLUMNNAME_AD_Table_ID, AD_Table_ID);
}
@Override
public int getAD_Table_ID()
{
return get_ValueAsInt(COLUMNNAME_AD_Table_ID);
}
@Override
public void setData_Export_Audit_ID (final int Data_Export_Audit_ID)
{
if (Data_Export_Audit_ID < 1)
set_ValueNoCheck (COLUMNNAME_Data_Export_Audit_ID, null);
else
set_ValueNoCheck (COLUMNNAME_Data_Export_Audit_ID, Data_Export_Audit_ID);
}
@Override
public int getData_Export_Audit_ID()
{
return get_ValueAsInt(COLUMNNAME_Data_Export_Audit_ID);
}
@Override
public org.compiere.model.I_Data_Export_Audit getData_Export_Audit_Parent()
{
return get_ValueAsPO(COLUMNNAME_Data_Export_Audit_Parent_ID, org.compiere.model.I_Data_Export_Audit.class);
}
@Override
public void setData_Export_Audit_Parent(final org.compiere.model.I_Data_Export_Audit Data_Export_Audit_Parent)
{
set_ValueFromPO(COLUMNNAME_Data_Export_Audit_Parent_ID, org.compiere.model.I_Data_Export_Audit.class, Data_Export_Audit_Parent);
}
|
@Override
public void setData_Export_Audit_Parent_ID (final int Data_Export_Audit_Parent_ID)
{
if (Data_Export_Audit_Parent_ID < 1)
set_Value (COLUMNNAME_Data_Export_Audit_Parent_ID, null);
else
set_Value (COLUMNNAME_Data_Export_Audit_Parent_ID, Data_Export_Audit_Parent_ID);
}
@Override
public int getData_Export_Audit_Parent_ID()
{
return get_ValueAsInt(COLUMNNAME_Data_Export_Audit_Parent_ID);
}
@Override
public void setRecord_ID (final int Record_ID)
{
if (Record_ID < 0)
set_Value (COLUMNNAME_Record_ID, null);
else
set_Value (COLUMNNAME_Record_ID, Record_ID);
}
@Override
public int getRecord_ID()
{
return get_ValueAsInt(COLUMNNAME_Record_ID);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_Data_Export_Audit.java
| 1
|
请完成以下Java代码
|
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public String getAddress() {
return address;
|
}
public void setAddress(String address) {
this.address = address;
}
@Override
public String toString() {
return "Person{" +
"id=" + id +
", name='" + name + '\'' +
", age=" + age +
", address='" + address + '\'' +
'}';
}
}
|
repos\spring-boot-student-master\spring-boot-student-mybatis-redis\src\main\java\com\xiaolyuh\domain\model\Person.java
| 1
|
请完成以下Java代码
|
public class MessageIconType extends IconType {
@Override
public String getFillValue() {
return "#585858";
}
@Override
public String getStrokeValue() {
return "none";
}
@Override
public String getStrokeWidth() {
return "1";
}
@Override
public String getDValue() {
return " m0 1.5 l0 13 l17 0 l0 -13 z M1.5 3 L6 7.5 L1.5 12 z M3.5 3 L13.5 3 L8.5 8 z m12 0 l0 9 l-4.5 -4.5 z M7 8.5 L8.5 10 L10 8.5 L14.5 13 L2.5 13 z";
}
public void drawIcon(
final int imageX,
final int imageY,
final int iconPadding,
final ProcessDiagramSVGGraphics2D svgGenerator
) {
Element gTag = svgGenerator.getDOMFactory().createElementNS(null, SVGGraphics2D.SVG_G_TAG);
gTag.setAttributeNS(null, "transform", "translate(" + (imageX - 1) + "," + (imageY - 2) + ")");
Element pathTag = svgGenerator.getDOMFactory().createElementNS(null, SVGGraphics2D.SVG_PATH_TAG);
pathTag.setAttributeNS(null, "d", this.getDValue());
pathTag.setAttributeNS(null, "fill", this.getFillValue());
|
pathTag.setAttributeNS(null, "stroke", this.getStrokeValue());
pathTag.setAttributeNS(null, "stroke-widthh", this.getStrokeWidth());
gTag.appendChild(pathTag);
svgGenerator.getExtendDOMGroupManager().addElement(gTag);
}
@Override
public String getAnchorValue() {
return null;
}
@Override
public String getStyleValue() {
return null;
}
@Override
public Integer getWidth() {
return 17;
}
@Override
public Integer getHeight() {
return 13;
}
}
|
repos\Activiti-develop\activiti-core\activiti-image-generator\src\main\java\org\activiti\image\impl\icon\MessageIconType.java
| 1
|
请完成以下Java代码
|
public void createMovementsIfNeeded(final I_DD_Order ddOrder)
{
if (ddOrderService.isCreateMovementOnComplete())
{
ddOrderService.generateDirectMovements(ddOrder);
}
}
private List<DDOrderLineId> retrieveLineToQuarantineWarehouseIds(final I_DD_Order ddOrder)
{
return ddOrderService.retrieveLines(ddOrder)
.stream()
.filter(this::isQuarantineWarehouseLine)
.map(line -> DDOrderLineId.ofRepoId(line.getDD_OrderLine_ID()))
.collect(ImmutableList.toImmutableList());
}
private boolean isQuarantineWarehouseLine(final I_DD_OrderLine ddOrderLine)
|
{
final I_M_Warehouse warehouse = warehouseDAO.getWarehouseByLocatorRepoId(ddOrderLine.getM_LocatorTo_ID());
return warehouse != null && warehouse.isQuarantineWarehouse();
}
@DocValidate(timings = {
ModelValidator.TIMING_BEFORE_REVERSEACCRUAL,
ModelValidator.TIMING_BEFORE_REVERSECORRECT,
ModelValidator.TIMING_BEFORE_VOID })
public void removeDDOrderCandidateAllocations(@NonNull final I_DD_Order ddOrder)
{
final DDOrderId ddOrderId = DDOrderId.ofRepoId(ddOrder.getDD_Order_ID());
ddOrderCandidateService.deleteAndUpdateCandidatesByDDOrderId(ddOrderId);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\distribution\ddorder\interceptor\DD_Order.java
| 1
|
请完成以下Java代码
|
protected String doIt()
{
final LUTUResult.TUsList tus = extractTUs();
inventoryService.moveToGarbage(
HUInternalUseInventoryCreateRequest.builder()
.hus(tus.toHURecords())
.movementDate(Env.getZonedDateTime(getCtx()))
.internalUseInventoryDocTypeId(p_internalUseInventoryDocTypeId)
.description(p_description)
.completeInventory(true)
.moveEmptiesToEmptiesWarehouse(true)
.sendNotifications(true)
.build());
return MSG_OK;
}
private LUTUResult.TUsList extractTUs()
|
{
if (p_qtyTU_Int <= 0)
{
throw new FillMandatoryException("QtyTU");
}
final QtyTU qtyTU = QtyTU.ofInt(p_qtyTU_Int);
final I_M_HU topLevelHU = handlingUnitsBL.getById(HuId.ofRepoId(getRecord_ID()));
final LUTUResult.TUsList tus = HUTransformService.newInstance()
.husToNewTUs(HUTransformService.HUsToNewTUsRequest.forSourceHuAndQty(topLevelHU, qtyTU.toInt()));
if (tus.getQtyTU().toInt() != qtyTU.toInt())
{
throw new AdempiereException(WEBUI_HU_Constants.MSG_NotEnoughTUsFound, qtyTU.toInt(), tus.getQtyTU());
}
return tus;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\process\WEBUI_M_HU_MoveToGarbage_Partial.java
| 1
|
请完成以下Java代码
|
class FavoriteItem
{
private final FavoritesGroup group;
private final CButton button;
private final MTreeNode node;
public FavoriteItem(final FavoritesGroup group, final MTreeNode node)
{
super();
Check.assumeNotNull(group, "group not null");
this.group = group;
Check.assumeNotNull(node, "node not null");
this.node = node;
final String label = node.getName().trim();
final String iconName = node.getIconName();
final Icon icon = Images.getImageIcon2(iconName);
button = new CButton(label);
button.setOpaque(false);
button.setHorizontalAlignment(SwingConstants.LEFT);
button.setMargin(new Insets(0, 0, 0, 0));
button.setIcon(icon);
button.setRequestFocusEnabled(false);
button.setToolTipText(node.getDescription());
button.setActionCommand(String.valueOf(node.getNode_ID()));
button.setName("menuShortcut." + node.getInternalName()); // me16
}
public JComponent getComponent()
{
return button;
}
public void addMouseListener(final MouseListener l)
{
|
button.addMouseListener(l);
}
public void addActionListener(final ActionListener l)
{
button.addActionListener(l);
}
public FavoritesGroup getGroup()
{
return group;
}
public MTreeNode getNode()
{
return node;
}
public int getNode_ID()
{
return node.getNode_ID();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\grid\tree\FavoriteItem.java
| 1
|
请完成以下Java代码
|
public class DBRes_hr extends ListResourceBundle
{
/** Data */
static final Object[][] contents = new String[][]{
{ "CConnectionDialog", "Server veza" },
{ "Name", "Naziv" },
{ "AppsHost", "Host aplikacije" },
{ "AppsPort", "Port aplikacije" },
{ "TestApps", "Testiranje servera" },
{ "DBHost", "Host baze" },
{ "DBPort", "Port baze" },
{ "DBName", "Naziv baze" },
{ "DBUidPwd", "Korisnik / lozinka" },
{ "ViaFirewall", "via Firewall" },
{ "FWHost", "Firewall Host" },
{ "FWPort", "Firewall Port" },
{ "TestConnection", "Tesiranje baze" },
{ "Type", "Tip baze" },
{ "BequeathConnection", "Bequeath Connection" },
{ "Overwrite", "Prebrisati" },
{ "ConnectionProfile", "Connection" },
|
{ "LAN", "LAN" },
{ "TerminalServer", "Terminal Server" },
{ "VPN", "VPN" },
{ "WAN", "WAN" },
{ "ConnectionError", "Gre�ka u vezi" },
{ "ServerNotActive", "Server nije aktivan" }
};
/**
* Get Contsnts
* @return contents
*/
public Object[][] getContents()
{
return contents;
} // getContent
} // Res
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\db\connectiondialog\i18n\DBRes_hr.java
| 1
|
请完成以下Java代码
|
public String getPath() {
return this.field.getPath();
}
@Override
public List<Object> getParsedPath() {
return this.field.getParsedPath();
}
@Override
public @Nullable <T> T getValue() {
return this.field.getValue();
}
@Override
public List<ResponseError> getErrors() {
return this.field.getErrors();
}
@Override
public @Nullable <D> D toEntity(Class<D> entityType) {
return toEntity(ResolvableType.forType(entityType));
}
@Override
public @Nullable <D> D toEntity(ParameterizedTypeReference<D> entityType) {
return toEntity(ResolvableType.forType(entityType));
}
@Override
public <D> List<D> toEntityList(Class<D> elementType) {
List<D> list = toEntity(ResolvableType.forClassWithGenerics(List.class, elementType));
return (list != null) ? list : Collections.emptyList();
|
}
@Override
public <D> List<D> toEntityList(ParameterizedTypeReference<D> elementType) {
List<D> list = toEntity(ResolvableType.forClassWithGenerics(List.class, ResolvableType.forType(elementType)));
return (list != null) ? list : Collections.emptyList();
}
@SuppressWarnings("unchecked")
private @Nullable <T> T toEntity(ResolvableType targetType) {
if (getValue() == null) {
if (this.response.isValid() && getErrors().isEmpty()) {
return null;
}
throw new FieldAccessException(this.response.getRequest(), this.response, this);
}
DataBufferFactory bufferFactory = DefaultDataBufferFactory.sharedInstance;
MimeType mimeType = MimeTypeUtils.APPLICATION_JSON;
Map<String, Object> hints = Collections.emptyMap();
try {
DataBuffer buffer = ((Encoder<T>) this.response.getEncoder()).encodeValue(
(T) getValue(), bufferFactory, ResolvableType.forInstance(getValue()), mimeType, hints);
return ((Decoder<T>) this.response.getDecoder()).decode(buffer, targetType, mimeType, hints);
}
catch (Throwable ex) {
throw new GraphQlClientException("Cannot read field '" + this.field.getPath() + "'", ex, this.response.getRequest());
}
}
}
|
repos\spring-graphql-main\spring-graphql\src\main\java\org\springframework\graphql\client\DefaultClientResponseField.java
| 1
|
请完成以下Java代码
|
public int getMobile_Application_Action_Access_ID()
{
return get_ValueAsInt(COLUMNNAME_Mobile_Application_Action_Access_ID);
}
@Override
public void setMobile_Application_Action_ID (final int Mobile_Application_Action_ID)
{
if (Mobile_Application_Action_ID < 1)
set_Value (COLUMNNAME_Mobile_Application_Action_ID, null);
else
set_Value (COLUMNNAME_Mobile_Application_Action_ID, Mobile_Application_Action_ID);
}
@Override
public int getMobile_Application_Action_ID()
{
return get_ValueAsInt(COLUMNNAME_Mobile_Application_Action_ID);
|
}
@Override
public void setMobile_Application_ID (final int Mobile_Application_ID)
{
if (Mobile_Application_ID < 1)
set_Value (COLUMNNAME_Mobile_Application_ID, null);
else
set_Value (COLUMNNAME_Mobile_Application_ID, Mobile_Application_ID);
}
@Override
public int getMobile_Application_ID()
{
return get_ValueAsInt(COLUMNNAME_Mobile_Application_ID);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_Mobile_Application_Action_Access.java
| 1
|
请完成以下Java代码
|
public void disableSessionValidation() {
if (log.isDebugEnabled()) {
log.debug("Stopping Quartz session validation job...");
}
Scheduler scheduler;
try {
scheduler = getScheduler();
if (scheduler == null) {
if (log.isWarnEnabled()) {
log.warn("getScheduler() method returned a null Quartz scheduler, which is unexpected. Please " +
"check your configuration and/or implementation. Returning quietly since there is no " +
"validation job to remove (scheduler does not exist).");
}
return;
}
} catch (SchedulerException e) {
if (log.isWarnEnabled()) {
log.warn("Unable to acquire Quartz Scheduler. Ignoring and returning (already stopped?)", e);
}
return;
}
try {
scheduler.unscheduleJob(new TriggerKey("SessionValidationJob", "DEFAULT"));
if (log.isDebugEnabled()) {
log.debug("Quartz session validation job stopped successfully.");
}
} catch (SchedulerException e) {
if (log.isDebugEnabled()) {
log.debug("Could not cleanly remove SessionValidationJob from Quartz scheduler. Ignoring and " +
"stopping.", e);
}
}
|
this.enabled = false;
if (this.schedulerImplicitlyCreated) {
try {
scheduler.shutdown();
} catch (SchedulerException e) {
if (log.isWarnEnabled()) {
log.warn("Unable to cleanly shutdown implicitly created Quartz Scheduler instance.", e);
}
} finally {
setScheduler(null);
this.schedulerImplicitlyCreated = false;
}
}
}
}
|
repos\springBoot-master\springboot-shiro2\src\main\java\cn\abel\rest\shiro\ext\QuartzSessionValidationScheduler.java
| 1
|
请完成以下Java代码
|
public void setHostKey (final @Nullable java.lang.String HostKey)
{
set_ValueNoCheck (COLUMNNAME_HostKey, HostKey);
}
@Override
public java.lang.String getHostKey()
{
return get_ValueAsString(COLUMNNAME_HostKey);
}
@Override
public void setIPP_URL (final @Nullable java.lang.String IPP_URL)
{
set_Value (COLUMNNAME_IPP_URL, IPP_URL);
}
@Override
public java.lang.String getIPP_URL()
{
return get_ValueAsString(COLUMNNAME_IPP_URL);
}
@Override
public void setName (final java.lang.String Name)
{
set_ValueNoCheck (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
|
/**
* OutputType AD_Reference_ID=540632
* Reference name: OutputType
*/
public static final int OUTPUTTYPE_AD_Reference_ID=540632;
/** Attach = Attach */
public static final String OUTPUTTYPE_Attach = "Attach";
/** Store = Store */
public static final String OUTPUTTYPE_Store = "Store";
/** Queue = Queue */
public static final String OUTPUTTYPE_Queue = "Queue";
/** Frontend = Frontend */
public static final String OUTPUTTYPE_Frontend = "Frontend";
@Override
public void setOutputType (final java.lang.String OutputType)
{
set_Value (COLUMNNAME_OutputType, OutputType);
}
@Override
public java.lang.String getOutputType()
{
return get_ValueAsString(COLUMNNAME_OutputType);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.printing\de.metas.printing.base\src\main\java-gen\de\metas\printing\model\X_AD_PrinterHW.java
| 1
|
请完成以下Java代码
|
public static HalVariableValue generateProcessInstanceVariableValue(VariableInstance variableInstance, String processInstanceId) {
return fromVariableInstance(variableInstance)
.link(REL_SELF, ProcessInstanceRestService.PATH, processInstanceId, "variables");
}
public static HalVariableValue generateCaseExecutionVariableValue(VariableInstance variableInstance, String caseExecutionId) {
return fromVariableInstance(variableInstance)
.link(REL_SELF, CaseExecutionRestService.PATH, caseExecutionId, "localVariables");
}
public static HalVariableValue generateCaseInstanceVariableValue(VariableInstance variableInstance, String caseInstanceId) {
return fromVariableInstance(variableInstance)
.link(REL_SELF, CaseInstanceRestService.PATH, caseInstanceId, "variables");
}
private HalVariableValue link(HalRelation relation, String resourcePath, String resourceId, String variablesPath) {
if (resourcePath.startsWith("/")) {
// trim leading / because otherwise it will be encode as %2F (see CAM-3091)
resourcePath = resourcePath.substring(1);
}
this.linker.createLink(relation, resourcePath, resourceId, variablesPath, this.name);
return this;
}
public static HalVariableValue fromVariableInstance(VariableInstance variableInstance) {
HalVariableValue dto = new HalVariableValue();
VariableValueDto variableValueDto = VariableValueDto.fromTypedValue(variableInstance.getTypedValue());
dto.name = variableInstance.getName();
dto.value = variableValueDto.getValue();
dto.type = variableValueDto.getType();
dto.valueInfo = variableValueDto.getValueInfo();
|
return dto;
}
public String getName() {
return name;
}
public Object getValue() {
return value;
}
public String getType() {
return type;
}
public Map<String, Object> getValueInfo() {
return valueInfo;
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\hal\HalVariableValue.java
| 1
|
请完成以下Java代码
|
public void handleInOutChangedEvent(@NonNull final InOutChangedEvent event)
{
final BPartnerId bpartnerId = event.getBpartnerId();
final Set<ProductId> productIds = event.getProductIds();
if (event.isReversal())
{
statsRepo.recomputeStatistics(RecomputeStatisticsRequest.builder()
.bpartnerId(bpartnerId)
.productIds(productIds)
.recomputeInOutStatistics(true)
.build());
}
else
{
final ZonedDateTime movementDate = TimeUtil.asZonedDateTime(event.getMovementDate());
final boolean isShipment = event.getSoTrx().isSales();
final ImmutableMap<ProductId, BPartnerProductStats> statsByProductId = statsRepo.getByPartnerAndProducts(bpartnerId, productIds);
for (final ProductId productId : productIds)
{
BPartnerProductStats stats = statsByProductId.get(productId);
if (stats == null)
{
stats = BPartnerProductStats.newInstance(bpartnerId, productId);
}
if (isShipment)
{
stats.updateLastShipmentDate(movementDate);
}
else
{
stats.updateLastReceiptDate(movementDate);
}
statsRepo.save(stats);
}
}
}
public void handleInvoiceChangedEvent(@NonNull final InvoiceChangedEvent event)
{
// NOTE: only sales invoices are supported atm
if (!event.getSoTrx().isSales())
{
return;
}
final BPartnerId bpartnerId = event.getBpartnerId();
final Set<ProductId> productIds = event.getProductIds();
if (event.isReversal())
{
statsRepo.recomputeStatistics(RecomputeStatisticsRequest.builder()
.bpartnerId(bpartnerId)
.productIds(productIds)
.recomputeInvoiceStatistics(true)
.build());
}
|
else
{
final ImmutableMap<ProductId, BPartnerProductStats> statsByProductId = statsRepo.getByPartnerAndProducts(bpartnerId, productIds);
for (final ProductId productId : productIds)
{
BPartnerProductStats stats = statsByProductId.get(productId);
if (stats == null)
{
stats = BPartnerProductStats.newInstance(bpartnerId, productId);
}
final BPartnerProductStats.LastInvoiceInfo lastSalesInvoice = extractLastSalesInvoiceInfo(event, productId);
stats.updateLastSalesInvoiceInfo(lastSalesInvoice);
statsRepo.save(stats);
}
}
}
private static BPartnerProductStats.LastInvoiceInfo extractLastSalesInvoiceInfo(final InvoiceChangedEvent event, final ProductId productId)
{
return BPartnerProductStats.LastInvoiceInfo.builder()
.invoiceId(event.getInvoiceId())
.invoiceDate(event.getInvoiceDate())
.price(event.getProductPrice(productId))
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\bpartner\product\stats\BPartnerProductStatsEventHandler.java
| 1
|
请完成以下Java代码
|
public void setHelp (String Help)
{
set_Value (COLUMNNAME_Help, Help);
}
/** Get Comment/Help.
@return Comment or Hint
*/
public String getHelp ()
{
return (String)get_Value(COLUMNNAME_Help);
}
/** Set Server Process.
@param IsServerProcess
Run this Process on Server only
*/
public void setIsServerProcess (boolean IsServerProcess)
{
set_Value (COLUMNNAME_IsServerProcess, Boolean.valueOf(IsServerProcess));
}
/** Get Server Process.
@return Run this Process on Server only
*/
public boolean isServerProcess ()
{
Object oo = get_Value(COLUMNNAME_IsServerProcess);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
|
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set OS Command.
@param OS_Command
Operating System Command
*/
public void setOS_Command (String OS_Command)
{
set_Value (COLUMNNAME_OS_Command, OS_Command);
}
/** Get OS Command.
@return Operating System Command
*/
public String getOS_Command ()
{
return (String)get_Value(COLUMNNAME_OS_Command);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Task.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private static class CampaignPricePageKey
{
@NonNull
ProductId productId;
@NonNull
YearMonth month;
}
@Value
private static class CampaignPricePage
{
public static CampaignPricePage of(final List<CampaignPrice> prices)
{
if (prices.isEmpty())
{
return EMPTY;
}
else
{
return new CampaignPricePage(prices);
}
}
private static final CampaignPricePage EMPTY = new CampaignPricePage();
private final ImmutableListMultimap<BPartnerId, CampaignPrice> bpartnerPrices;
private final ImmutableListMultimap<BPGroupId, CampaignPrice> bpGroupPrices;
private final ImmutableListMultimap<PricingSystemId, CampaignPrice> pricingSystemPrices;
private CampaignPricePage(final List<CampaignPrice> prices)
{
bpartnerPrices = prices.stream()
.filter(price -> price.getBpartnerId() != null)
.sorted(Comparator.comparing(CampaignPrice::getValidFrom))
.collect(GuavaCollectors.toImmutableListMultimap(CampaignPrice::getBpartnerId));
bpGroupPrices = prices.stream()
.filter(price -> price.getBpGroupId() != null)
.sorted(Comparator.comparing(CampaignPrice::getValidFrom))
.collect(GuavaCollectors.toImmutableListMultimap(CampaignPrice::getBpGroupId));
pricingSystemPrices = prices.stream()
.filter(price -> price.getPricingSystemId() != null)
.sorted(Comparator.comparing(CampaignPrice::getValidFrom))
.collect(GuavaCollectors.toImmutableListMultimap(CampaignPrice::getPricingSystemId));
}
private CampaignPricePage()
{
bpartnerPrices = ImmutableListMultimap.of();
bpGroupPrices = ImmutableListMultimap.of();
pricingSystemPrices = ImmutableListMultimap.of();
}
|
public Optional<CampaignPrice> findPrice(@NonNull final CampaignPriceQuery query)
{
Optional<CampaignPrice> result = findPrice(bpartnerPrices.get(query.getBpartnerId()), query);
if (result.isPresent())
{
return result;
}
result = findPrice(bpGroupPrices.get(query.getBpGroupId()), query);
if (result.isPresent()) {
return result;
}
return findPrice(pricingSystemPrices.get(query.getPricingSystemId()), query);
}
private static Optional<CampaignPrice> findPrice(@NonNull final Collection<CampaignPrice> prices, @NonNull final CampaignPriceQuery query)
{
return prices.stream()
.filter(query::isMatching)
.findFirst();
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\pricing\rules\campaign_price\CampaignPriceRepository.java
| 2
|
请完成以下Java代码
|
public static ApiResponse ofException(final Throwable throwable, final String adLanguage)
{
return ApiResponse.builder()
.statusCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)
.contentType(MediaType.APPLICATION_JSON)
.body(JsonErrors.ofThrowable(throwable, adLanguage))
.build();
}
public boolean hasStatus2xx()
{
return getStatusCode() / 100 == HttpStatus.OK.series().value();
}
public boolean isJson()
{
return contentType != null && contentType.includes(MediaType.APPLICATION_JSON);
}
public String getBodyAsString()
{
if (body == null)
{
return null;
}
else if (isJson())
{
try
{
return JsonObjectMapperHolder.sharedJsonObjectMapper().writeValueAsString(body);
}
catch (JsonProcessingException e)
{
throw AdempiereException.wrapIfNeeded(e);
}
|
}
else if (body instanceof String)
{
return (String)body;
}
else if (body instanceof byte[])
{
return new String((byte[])body, charset);
}
else
{
return body.toString();
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.util.web\src\main\java\de\metas\util\web\audit\dto\ApiResponse.java
| 1
|
请完成以下Java代码
|
public void addCaseDefinition(CaseDefinitionEntity caseDefinitionEntity) {
definitions.add(caseDefinitionEntity);
}
public List<CaseDefinitionEntity> getAllCaseDefinitions() {
return definitions;
}
public void addCaseDefinition(CaseDefinitionEntity caseDefinitionEntity, EngineResource resourceEntity, CmmnModel cmmnModel) {
definitions.add(caseDefinitionEntity);
mapDefinitionsToResources.put(caseDefinitionEntity, resourceEntity);
mapDefinitionsToCmmnModel.put(caseDefinitionEntity, cmmnModel);
}
public EngineResource getResourceForCaseDefinition(CaseDefinitionEntity caseDefinition) {
return mapDefinitionsToResources.get(caseDefinition);
}
public CmmnModel getCmmnModelForCaseDefinition(CaseDefinitionEntity caseDefinition) {
return mapDefinitionsToCmmnModel.get(caseDefinition);
}
public Case getCmmnCaseForCaseDefinition(CaseDefinitionEntity caseDefinition) {
|
CmmnModel model = getCmmnModelForCaseDefinition(caseDefinition);
return (model == null ? null : model.getCaseById(caseDefinition.getKey()));
}
public void merge(CmmnParseResult cmmnParseResult) {
if (deployment == null) {
throw new FlowableException("Cannot merge from a parse result without a deployment entity");
}
if (cmmnParseResult.getDeployment() != null && !deployment.equals(cmmnParseResult.getDeployment())) {
throw new FlowableException("Cannot merge parse results with different deployment entities");
}
for (CaseDefinitionEntity caseDefinitionEntity : cmmnParseResult.getAllCaseDefinitions()) {
addCaseDefinition(caseDefinitionEntity,
cmmnParseResult.getResourceForCaseDefinition(caseDefinitionEntity),
cmmnParseResult.getCmmnModelForCaseDefinition(caseDefinitionEntity));
}
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\parser\CmmnParseResult.java
| 1
|
请完成以下Java代码
|
public class ValidationType {
@XmlElement(name = "validation_result", namespace = "http://www.forum-datenaustausch.ch/invoice")
protected List<ValidationResultType> validationResult;
@XmlAttribute(name = "originator", required = true)
protected String originator;
@XmlAttribute(name = "remark", required = true)
protected String remark;
@XmlAttribute(name = "status", required = true)
@XmlSchemaType(name = "unsignedShort")
protected int status;
/**
* Gets the value of the validationResult 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 validationResult property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getValidationResult().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ValidationResultType }
*
*
*/
public List<ValidationResultType> getValidationResult() {
if (validationResult == null) {
validationResult = new ArrayList<ValidationResultType>();
}
return this.validationResult;
}
/**
* Gets the value of the originator property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOriginator() {
return originator;
}
/**
* Sets the value of the originator property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOriginator(String value) {
this.originator = value;
}
/**
* Gets the value of the remark property.
*
* @return
* possible object is
|
* {@link String }
*
*/
public String getRemark() {
return remark;
}
/**
* Sets the value of the remark property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRemark(String value) {
this.remark = value;
}
/**
* Gets the value of the status property.
*
*/
public int getStatus() {
return status;
}
/**
* Sets the value of the status property.
*
*/
public void setStatus(int value) {
this.status = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_440_request\src\main\java-xjc\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_440\request\ValidationType.java
| 1
|
请完成以下Java代码
|
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Other SQL Clause.
@param OtherClause
Other SQL Clause
*/
public void setOtherClause (String OtherClause)
{
set_Value (COLUMNNAME_OtherClause, OtherClause);
}
/** Get Other SQL Clause.
@return Other SQL Clause
*/
public String getOtherClause ()
{
return (String)get_Value(COLUMNNAME_OtherClause);
}
/** Set Record ID.
@param Record_ID
Direct internal record ID
*/
public void setRecord_ID (int Record_ID)
{
if (Record_ID < 0)
set_ValueNoCheck (COLUMNNAME_Record_ID, null);
else
|
set_ValueNoCheck (COLUMNNAME_Record_ID, Integer.valueOf(Record_ID));
}
/** Get Record ID.
@return Direct internal record ID
*/
public int getRecord_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Record_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Sql WHERE.
@param WhereClause
Fully qualified SQL WHERE clause
*/
public void setWhereClause (String WhereClause)
{
set_Value (COLUMNNAME_WhereClause, WhereClause);
}
/** Get Sql WHERE.
@return Fully qualified SQL WHERE clause
*/
public String getWhereClause ()
{
return (String)get_Value(COLUMNNAME_WhereClause);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_CM_ContainerTTable.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class modelAPI extends WebMvcConfigurationSupport {
@Bean
public Docket postsApi() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("com.urunov.controller"))
.paths(regex("/api/v1.*"))
.build()
.apiInfo(metaData());
}
private ApiInfo metaData() {
return new ApiInfoBuilder()
.title("Ecommerce Platform: Shopping Mall")
.description("\"Spring Boot REST API for Employee")
|
.version("1.0.0")
.license("Apache License Version 2.0")
.licenseUrl("https://www.apache.org/licenses/LICENSE-2.0\"")
.contact(new Contact("Urunov Hamdamboy", "https://github.com/urunov/", "myindexu@gamil.com"))
.build();
}
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}
|
repos\SpringBoot-Projects-FullStack-master\Part-9.SpringBoot-React-Projects\Project-5.Spring-ReactJS-Ecommerce-Shopping\fullstack\backend\model\src\main\java\com\urunov\configureAPI\modelAPI.java
| 2
|
请完成以下Java代码
|
private String listChildRecords()
{
final StringBuilder info = new StringBuilder();
String sql = "SELECT AD_Table_ID, TableName "
+ "FROM AD_Table t "
+ "WHERE AccessLevel='3' AND IsView='N'"
+ " AND EXISTS (SELECT * FROM AD_Column c "
+ "WHERE t.AD_Table_ID=c.AD_Table_ID"
+ " AND c.IsParent='Y'"
+ " AND c.ColumnName IN (SELECT ColumnName FROM AD_Column cc "
+ "WHERE cc.IsKey='Y' AND cc.AD_Table_ID=?))";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, getAD_Table_ID());
rs = pstmt.executeQuery();
while (rs.next())
{
String TableName = rs.getString(2);
if (info.length() != 0)
{
info.append(", ");
}
info.append(TableName);
}
}
catch (Exception e)
|
{
log.error(sql, e);
}
finally
{
DB.close(rs, pstmt);
}
return info.toString();
}
@Override
protected boolean beforeSave(boolean newRecord)
{
if (getAD_Org_ID() != 0)
{
setAD_Org_ID(0);
}
return true;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MClientShare.java
| 1
|
请完成以下Java代码
|
public void setPercentFrom (java.math.BigDecimal PercentFrom)
{
set_Value (COLUMNNAME_PercentFrom, PercentFrom);
}
/** Get % ab.
@return % ab */
@Override
public java.math.BigDecimal getPercentFrom ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_PercentFrom);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Betrag pro Einheit.
|
@param Processing_Fee_Amt_Per_UOM Betrag pro Einheit */
@Override
public void setProcessing_Fee_Amt_Per_UOM (java.math.BigDecimal Processing_Fee_Amt_Per_UOM)
{
set_Value (COLUMNNAME_Processing_Fee_Amt_Per_UOM, Processing_Fee_Amt_Per_UOM);
}
/** Get Betrag pro Einheit.
@return Betrag pro Einheit */
@Override
public java.math.BigDecimal getProcessing_Fee_Amt_Per_UOM ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Processing_Fee_Amt_Per_UOM);
if (bd == null)
return Env.ZERO;
return bd;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java-gen\de\metas\materialtracking\ch\lagerkonf\model\X_M_QualityInsp_LagerKonf_ProcessingFee.java
| 1
|
请完成以下Java代码
|
public class CsvUtils {
public static List<List<String>> parseCsv(String content, Character delimiter) throws Exception {
CSVFormat csvFormat = delimiter.equals(',') ? CSVFormat.DEFAULT : CSVFormat.DEFAULT.withDelimiter(delimiter);
List<CSVRecord> records;
try (CharSequenceReader reader = new CharSequenceReader(content)) {
records = csvFormat.parse(reader).getRecords();
}
return records.stream()
.map(record -> Stream.iterate(0, i -> i < record.size(), i -> i + 1)
.map(record::get)
.collect(Collectors.toList()))
.collect(Collectors.toList());
}
|
@SneakyThrows
public static byte[] generateCsv(List<List<String>> rows) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try (OutputStreamWriter writer = new OutputStreamWriter(out, StandardCharsets.UTF_8);
CSVPrinter csvPrinter = new CSVPrinter(writer, CSVFormat.DEFAULT)) {
for (List<String> row : rows) {
csvPrinter.printRecord(row);
}
csvPrinter.flush();
}
return out.toByteArray();
}
}
|
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\utils\CsvUtils.java
| 1
|
请完成以下Java代码
|
public Builder image(String image) {
this.image = image;
return this;
}
public Builder imageTag(String imageTag) {
this.imageTag = imageTag;
return this;
}
public Builder imageWebsite(String imageWebsite) {
this.imageWebsite = imageWebsite;
return this;
}
public Builder environment(String key, String value) {
this.environment.put(key, value);
return this;
}
public Builder environment(Map<String, String> environment) {
this.environment.putAll(environment);
return this;
}
public Builder ports(Collection<Integer> ports) {
this.ports.addAll(ports);
return this;
}
public Builder ports(int... ports) {
return ports(Arrays.stream(ports).boxed().toList());
}
public Builder command(String command) {
|
this.command = command;
return this;
}
public Builder label(String key, String value) {
this.labels.put(key, value);
return this;
}
public Builder labels(Map<String, String> label) {
this.labels.putAll(label);
return this;
}
/**
* Builds the {@link ComposeService} instance.
* @return the built instance
*/
public ComposeService build() {
return new ComposeService(this);
}
}
}
|
repos\initializr-main\initializr-generator\src\main\java\io\spring\initializr\generator\container\docker\compose\ComposeService.java
| 1
|
请完成以下Java代码
|
public void setPhone (String Phone)
{
throw new IllegalArgumentException ("Phone is virtual column"); }
/** Get Phone.
@return Identifies a telephone number
*/
public String getPhone ()
{
return (String)get_Value(COLUMNNAME_Phone);
}
public I_R_Group getR_Group() throws RuntimeException
{
return (I_R_Group)MTable.get(getCtx(), I_R_Group.Table_Name)
.getPO(getR_Group_ID(), get_TrxName()); }
/** Set Group.
@param R_Group_ID
Request Group
*/
public void setR_Group_ID (int R_Group_ID)
{
if (R_Group_ID < 1)
set_ValueNoCheck (COLUMNNAME_R_Group_ID, null);
else
set_ValueNoCheck (COLUMNNAME_R_Group_ID, Integer.valueOf(R_Group_ID));
}
/** Get Group.
@return Request Group
*/
public int getR_Group_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_R_Group_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_R_Request getR_Request() throws RuntimeException
{
return (I_R_Request)MTable.get(getCtx(), I_R_Request.Table_Name)
.getPO(getR_Request_ID(), get_TrxName()); }
/** Set Request.
@param R_Request_ID
Request from a Business Partner or Prospect
*/
public void setR_Request_ID (int R_Request_ID)
{
if (R_Request_ID < 1)
set_Value (COLUMNNAME_R_Request_ID, null);
else
set_Value (COLUMNNAME_R_Request_ID, Integer.valueOf(R_Request_ID));
}
/** Get Request.
@return Request from a Business Partner or Prospect
*/
public int getR_Request_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_R_Request_ID);
if (ii == null)
|
return 0;
return ii.intValue();
}
public I_R_Status getR_Status() throws RuntimeException
{
return (I_R_Status)MTable.get(getCtx(), I_R_Status.Table_Name)
.getPO(getR_Status_ID(), get_TrxName()); }
/** Set Status.
@param R_Status_ID
Request Status
*/
public void setR_Status_ID (int R_Status_ID)
{
throw new IllegalArgumentException ("R_Status_ID is virtual column"); }
/** Get Status.
@return Request Status
*/
public int getR_Status_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_R_Status_ID);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\de\metas\callcenter\model\X_R_Group_Prospect.java
| 1
|
请完成以下Java代码
|
public AdWindowId getAdWindowId(
@NonNull final String tableName,
@NonNull final SOTrx soTrx,
@NonNull final AdWindowId defaultValue)
{
final I_AD_Table adTableRecord = adTableDAO.retrieveTable(tableName);
switch (soTrx)
{
case SALES:
return CoalesceUtil.coalesce(AdWindowId.ofRepoIdOrNull(adTableRecord.getAD_Window_ID()), defaultValue);
case PURCHASE:
return CoalesceUtil.coalesce(AdWindowId.ofRepoIdOrNull(adTableRecord.getPO_Window_ID()), defaultValue);
default:
throw new AdempiereException("Param 'soTrx' has an unspupported value; soTrx=" + soTrx);
}
}
@Override
public ImmutableSet<AdWindowId> retrieveAllAdWindowIdsByTableId(final AdTableId adTableId)
|
{
final List<AdWindowId> adWindowIds = queryBL.createQueryBuilder(I_AD_Tab.class)
.addEqualsFilter(I_AD_Tab.COLUMNNAME_AD_Table_ID, adTableId)
.create()
.listDistinct(I_AD_Tab.COLUMNNAME_AD_Window_ID, AdWindowId.class);
return ImmutableSet.copyOf(adWindowIds);
}
@Override
public ImmutableSet<AdWindowId> retrieveAllActiveAdWindowIds()
{
return queryBL.createQueryBuilder(I_AD_Window.class)
.addOnlyActiveRecordsFilter()
.orderBy(I_AD_Window.COLUMNNAME_AD_Window_ID)
.create()
.idsAsSet(AdWindowId::ofRepoId);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\window\api\impl\ADWindowDAO.java
| 1
|
请完成以下Java代码
|
public long getCreatedTime() {
return super.getCreatedTime();
}
@Schema(description = "JSON object with Tenant Id.", accessMode = Schema.AccessMode.READ_ONLY)
public TenantId getTenantId() {
return tenantId;
}
public void setTenantId(TenantId tenantId) {
this.tenantId = tenantId;
}
@Schema(description = "JSON object with Customer Id. Use 'assignAssetToCustomer' to change the Customer Id.", accessMode = Schema.AccessMode.READ_ONLY)
public CustomerId getCustomerId() {
return customerId;
}
public void setCustomerId(CustomerId customerId) {
this.customerId = customerId;
}
@JsonIgnore
public EntityId getOwnerId() {
return customerId != null && !customerId.isNullUid() ? customerId : tenantId;
}
@Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "Unique Asset Name in scope of Tenant", example = "Empire State Building")
@Override
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Schema(description = "Asset type", example = "Building")
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Schema(description = "Label that may be used in widgets", example = "NY Building")
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
|
@Schema(description = "JSON object with Asset Profile Id.")
public AssetProfileId getAssetProfileId() {
return assetProfileId;
}
public void setAssetProfileId(AssetProfileId assetProfileId) {
this.assetProfileId = assetProfileId;
}
@Schema(description = "Additional parameters of the asset",implementation = com.fasterxml.jackson.databind.JsonNode.class)
@Override
public JsonNode getAdditionalInfo() {
return super.getAdditionalInfo();
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Asset [tenantId=");
builder.append(tenantId);
builder.append(", customerId=");
builder.append(customerId);
builder.append(", name=");
builder.append(name);
builder.append(", type=");
builder.append(type);
builder.append(", label=");
builder.append(label);
builder.append(", assetProfileId=");
builder.append(assetProfileId);
builder.append(", additionalInfo=");
builder.append(getAdditionalInfo());
builder.append(", createdTime=");
builder.append(createdTime);
builder.append(", id=");
builder.append(id);
builder.append("]");
return builder.toString();
}
}
|
repos\thingsboard-master\common\data\src\main\java\org\thingsboard\server\common\data\asset\Asset.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class ShipmentScheduleCreatedHandler implements MaterialEventHandler<ShipmentScheduleCreatedEvent>
{
private final CandidateChangeService candidateChangeHandler;
private final CandidateRepositoryRetrieval candidateRepository;
public ShipmentScheduleCreatedHandler(
@NonNull final CandidateChangeService candidateChangeHandler,
@NonNull final CandidateRepositoryRetrieval candidateRepository)
{
this.candidateChangeHandler = candidateChangeHandler;
this.candidateRepository = candidateRepository;
}
@Override
public Collection<Class<? extends ShipmentScheduleCreatedEvent>> getHandledEventType()
{
return ImmutableList.of(ShipmentScheduleCreatedEvent.class);
}
/**
* Checks for an existing candidate that might have been left over after a shipment schedule deletion, and creates/updates the dispo.
*/
@Override
public void handleEvent(@NonNull final ShipmentScheduleCreatedEvent event)
{
final DemandDetailsQuery demandDetailsQuery = DemandDetailsQuery.forDocumentLine(event.getDocumentLineDescriptor());
final CandidatesQuery candidatesQuery = CandidatesQuery
.builder()
.type(CandidateType.DEMAND)
.businessCase(CandidateBusinessCase.SHIPMENT)
.demandDetailsQuery(demandDetailsQuery)
.build();
final DemandDetail demandDetail = DemandDetail.forDocumentLine(
event.getShipmentScheduleId(),
|
event.getDocumentLineDescriptor(),
event.getMaterialDescriptor().getQuantity());
final CandidateBuilder candidateBuilder = Candidate
.builderForEventDescriptor(event.getEventDescriptor())
.materialDescriptor(event.getMaterialDescriptor())
.minMaxDescriptor(event.getMinMaxDescriptor())
.type(CandidateType.DEMAND)
.businessCase(CandidateBusinessCase.SHIPMENT)
.businessCaseDetail(demandDetail);
final Candidate existingCandidate = candidateRepository.retrieveLatestMatchOrNull(candidatesQuery);
if (existingCandidate != null)
{
candidateBuilder.id(existingCandidate.getId());
}
final Candidate candidate = candidateBuilder.build();
candidateChangeHandler.onCandidateNewOrChange(candidate);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.material\dispo-service\src\main\java\de\metas\material\dispo\service\event\handler\shipmentschedule\ShipmentScheduleCreatedHandler.java
| 2
|
请完成以下Java代码
|
public class DocumentAdjustment1 {
@XmlElement(name = "Amt", required = true)
protected ActiveOrHistoricCurrencyAndAmount amt;
@XmlElement(name = "CdtDbtInd")
@XmlSchemaType(name = "string")
protected CreditDebitCode cdtDbtInd;
@XmlElement(name = "Rsn")
protected String rsn;
@XmlElement(name = "AddtlInf")
protected String addtlInf;
/**
* Gets the value of the amt property.
*
* @return
* possible object is
* {@link ActiveOrHistoricCurrencyAndAmount }
*
*/
public ActiveOrHistoricCurrencyAndAmount getAmt() {
return amt;
}
/**
* Sets the value of the amt property.
*
* @param value
* allowed object is
* {@link ActiveOrHistoricCurrencyAndAmount }
*
*/
public void setAmt(ActiveOrHistoricCurrencyAndAmount value) {
this.amt = value;
}
/**
* Gets the value of the cdtDbtInd property.
*
* @return
* possible object is
* {@link CreditDebitCode }
*
*/
public CreditDebitCode getCdtDbtInd() {
return cdtDbtInd;
}
/**
* Sets the value of the cdtDbtInd property.
*
* @param value
* allowed object is
* {@link CreditDebitCode }
*
*/
|
public void setCdtDbtInd(CreditDebitCode value) {
this.cdtDbtInd = value;
}
/**
* Gets the value of the rsn property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRsn() {
return rsn;
}
/**
* Sets the value of the rsn property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRsn(String value) {
this.rsn = value;
}
/**
* Gets the value of the addtlInf property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAddtlInf() {
return addtlInf;
}
/**
* Sets the value of the addtlInf property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAddtlInf(String value) {
this.addtlInf = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_02\DocumentAdjustment1.java
| 1
|
请完成以下Java代码
|
public class AD_User_MKTG_Channels
{
public static final AD_User_MKTG_Channels INSTANCE = new AD_User_MKTG_Channels();
private final IMKTGChannelDao mktgChannelDao = Services.get(IMKTGChannelDao.class);
private final IUserDAO userDAO = Services.get(IUserDAO.class);
private final ISysConfigBL sysConfigBL = Services.get(ISysConfigBL.class);
private static final AdMessageKey MSG_CAN_NOT_REMOVE_CHANNEL = AdMessageKey.of("de.metas.marketing.base.userMarketingChannelRemovalError");
private static final String SYS_CONFIG_MARKETING_CHANNELS_ENFORCED = "de.metas.marketing.EnforceUserHasMarketingChannels";
private AD_User_MKTG_Channels()
{
}
@ModelChange(
timings = { ModelValidator.TYPE_BEFORE_DELETE })
public void checkIfCanBeDeleted(@NonNull final I_AD_User_MKTG_Channels userMktgChannels)
{
final I_AD_User user = userDAO.getById(userMktgChannels.getAD_User_ID());
|
if (!isMarketingChannelsUseEnforced(user.getAD_Client_ID(), user.getAD_Org_ID()))
{
return;
}
if (userDAO.isSystemUser(UserId.ofRepoId(user.getAD_User_ID())))
{
return;
}
final int count = mktgChannelDao.retrieveMarketingChannelsCountForUser(UserId.ofRepoId(userMktgChannels.getAD_User_ID()));
if (count == 1)
{
throw new AdempiereException(MSG_CAN_NOT_REMOVE_CHANNEL).markAsUserValidationError();
}
}
private boolean isMarketingChannelsUseEnforced(int clientID, int orgID)
{
return sysConfigBL.getBooleanValue(SYS_CONFIG_MARKETING_CHANNELS_ENFORCED, false, clientID, orgID);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.marketing\base\src\main\java\de\metas\marketing\base\interceptor\AD_User_MKTG_Channels.java
| 1
|
请完成以下Java代码
|
public boolean canReserveMoney()
{
return true;
}
@Override
public void processReservation(@NonNull final PaymentReservation reservation)
{
final PaymentReservationStatus status = reservation.getStatus();
if (PaymentReservationStatus.WAITING_PAYER_APPROVAL.equals(status))
{
paypal.createPayPalOrderAndRequestPayerApproval(reservation);
}
else if (PaymentReservationStatus.APPROVED_BY_PAYER.equals(status))
{
paypal.authorizePayPalOrder(reservation);
}
else if (PaymentReservationStatus.COMPLETED.equals(status))
{
|
throw new AdempiereException("already completed: " + reservation);
}
else if (PaymentReservationStatus.VOIDED.equals(status))
{
throw new AdempiereException("Request for approval for a voided reservation makes no sense: " + reservation);
}
else
{
throw new AdempiereException("Unknown status: " + reservation);
}
}
@Override
public void processCapture(
@NonNull final PaymentReservation reservation,
@NonNull final PaymentReservationCapture capture)
{
paypal.processCapture(reservation, capture);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.paypal\src\main\java\de\metas\payment\paypal\processor\PayPalPaymentProcessor.java
| 1
|
请完成以下Java代码
|
public JsonNode createJsonNode(Double parameter) {
return objectMapper.getNodeFactory().numberNode(parameter);
}
public JsonNode createJsonNode(Long parameter) {
return objectMapper.getNodeFactory().numberNode(parameter);
}
public JsonNode createJsonNode(Boolean parameter) {
return objectMapper.getNodeFactory().booleanNode(parameter);
}
public JsonNode createJsonNode(List<Object> parameter) {
if (parameter != null) {
ArrayNode node = objectMapper.getNodeFactory().arrayNode();
for(Object entry : parameter) {
node.add(createJsonNode(entry));
}
return node;
}
else {
|
return createNullJsonNode();
}
}
public JsonNode createJsonNode(Map<String, Object> parameter) {
if (parameter != null) {
ObjectNode node = objectMapper.getNodeFactory().objectNode();
for (Map.Entry<String, Object> entry : parameter.entrySet()) {
node.set(entry.getKey(), createJsonNode(entry.getValue()));
}
return node;
}
else {
return createNullJsonNode();
}
}
public JsonNode createNullJsonNode() {
return objectMapper.getNodeFactory().nullNode();
}
}
|
repos\camunda-bpm-platform-master\spin\dataformat-json-jackson\src\main\java\org\camunda\spin\impl\json\jackson\format\JacksonJsonDataFormat.java
| 1
|
请完成以下Java代码
|
public void setPaperFormat (java.lang.String PaperFormat)
{
set_Value (COLUMNNAME_PaperFormat, PaperFormat);
}
/** Get Papierformat.
@return Papierformat */
@Override
public java.lang.String getPaperFormat ()
{
return (java.lang.String)get_Value(COLUMNNAME_PaperFormat);
}
/** Set URL Api Shipment Service.
@param ShipmentServiceApiUrl URL Api Shipment Service */
@Override
public void setShipmentServiceApiUrl (java.lang.String ShipmentServiceApiUrl)
{
set_Value (COLUMNNAME_ShipmentServiceApiUrl, ShipmentServiceApiUrl);
}
/** Get URL Api Shipment Service.
@return URL Api Shipment Service */
@Override
public java.lang.String getShipmentServiceApiUrl ()
{
return (java.lang.String)get_Value(COLUMNNAME_ShipmentServiceApiUrl);
}
|
/** Set Shipper Product.
@param ShipperProduct Shipper Product */
@Override
public void setShipperProduct (java.lang.String ShipperProduct)
{
set_Value (COLUMNNAME_ShipperProduct, ShipperProduct);
}
/** Get Shipper Product.
@return Shipper Product */
@Override
public java.lang.String getShipperProduct ()
{
return (java.lang.String)get_Value(COLUMNNAME_ShipperProduct);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.dpd\src\main\java-gen\de\metas\shipper\gateway\dpd\model\X_DPD_Shipper_Config.java
| 1
|
请完成以下Java代码
|
public static Word compile(IWord word)
{
return compile((Word)word);
}
/**
* 在忽略ns的前提下预编译
* @param wordList
*/
public static void compileWithoutNS(List<IWord> wordList)
{
for (IWord word : wordList)
{
if (word.getLabel().startsWith("ns")) continue;
word.setValue(PosTagCompiler.compile(word.getLabel(), word.getValue()));
// switch (word.getLabel())
// {
// case "nx":
// {
// word.setValue(Predefine.TAG_PROPER);
// }
// break;
// case "nt":
// case "ntc":
// case "ntcf":
// case "ntcb":
// case "ntch":
// case "nto":
// case "ntu":
// case "nts":
// case "nth":
// {
// word.setValue(Predefine.TAG_GROUP);
// }
// break;
// case "m":
// case "mq":
// {
// word.setValue(Predefine.TAG_NUMBER);
// }
// break;
// case "x":
// {
// word.setValue(Predefine.TAG_CLUSTER);
// }
// break;
// case "xx":
// {
// word.setValue(Predefine.TAG_OTHER);
// }
// break;
|
// case "t":
// {
// word.setValue(Predefine.TAG_TIME);
// }
// break;
// case "nr":
// {
// word.setValue(Predefine.TAG_PEOPLE);
// }
// break;
// }
}
}
/**
* 在忽略ns的前提下预编译
* @param wordList
*/
public static void compileWithoutNT(List<IWord> wordList)
{
for (IWord word : wordList)
{
if (word.getLabel().startsWith("nt")) continue;
word.setValue(PosTagCompiler.compile(word.getLabel(), word.getValue()));
}
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\corpus\util\Precompiler.java
| 1
|
请完成以下Java代码
|
public boolean isCompleteJobAutomatically()
{
return get_ValueAsBoolean(COLUMNNAME_IsCompleteJobAutomatically);
}
@Override
public void setIsNavigateToJobsListAfterPickFromComplete (final boolean IsNavigateToJobsListAfterPickFromComplete)
{
set_Value (COLUMNNAME_IsNavigateToJobsListAfterPickFromComplete, IsNavigateToJobsListAfterPickFromComplete);
}
@Override
public boolean isNavigateToJobsListAfterPickFromComplete()
{
return get_ValueAsBoolean(COLUMNNAME_IsNavigateToJobsListAfterPickFromComplete);
}
@Override
public void setIsRequireScanningProductCode (final boolean IsRequireScanningProductCode)
{
set_Value (COLUMNNAME_IsRequireScanningProductCode, IsRequireScanningProductCode);
}
@Override
public boolean isRequireScanningProductCode()
{
return get_ValueAsBoolean(COLUMNNAME_IsRequireScanningProductCode);
}
@Override
public void setIsRequireTrolley (final boolean IsRequireTrolley)
{
set_Value (COLUMNNAME_IsRequireTrolley, IsRequireTrolley);
}
@Override
public boolean isRequireTrolley()
{
return get_ValueAsBoolean(COLUMNNAME_IsRequireTrolley);
}
@Override
public void setMaxLaunchers (final int MaxLaunchers)
{
set_Value (COLUMNNAME_MaxLaunchers, MaxLaunchers);
}
@Override
public int getMaxLaunchers()
{
return get_ValueAsInt(COLUMNNAME_MaxLaunchers);
}
|
@Override
public void setMaxStartedLaunchers (final int MaxStartedLaunchers)
{
set_Value (COLUMNNAME_MaxStartedLaunchers, MaxStartedLaunchers);
}
@Override
public int getMaxStartedLaunchers()
{
return get_ValueAsInt(COLUMNNAME_MaxStartedLaunchers);
}
@Override
public void setMobileUI_UserProfile_DD_ID (final int MobileUI_UserProfile_DD_ID)
{
if (MobileUI_UserProfile_DD_ID < 1)
set_ValueNoCheck (COLUMNNAME_MobileUI_UserProfile_DD_ID, null);
else
set_ValueNoCheck (COLUMNNAME_MobileUI_UserProfile_DD_ID, MobileUI_UserProfile_DD_ID);
}
@Override
public int getMobileUI_UserProfile_DD_ID()
{
return get_ValueAsInt(COLUMNNAME_MobileUI_UserProfile_DD_ID);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_MobileUI_UserProfile_DD.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
PropagatingReceiverTracingObservationHandler<?> propagatingReceiverTracingObservationHandler(Tracer tracer,
Propagator propagator) {
return new PropagatingReceiverTracingObservationHandler<>(tracer, propagator);
}
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(Advice.class)
@ConditionalOnBooleanProperty("management.observations.annotations.enabled")
static class SpanAspectConfiguration {
@Bean
@ConditionalOnMissingBean(NewSpanParser.class)
DefaultNewSpanParser newSpanParser() {
return new DefaultNewSpanParser();
}
@Bean
@ConditionalOnMissingBean
@ConditionalOnBean(ValueExpressionResolver.class)
SpanTagAnnotationHandler spanTagAnnotationHandler(BeanFactory beanFactory,
ValueExpressionResolver valueExpressionResolver) {
return new SpanTagAnnotationHandler(beanFactory::getBean, (ignored) -> valueExpressionResolver);
}
|
@Bean
@ConditionalOnMissingBean(MethodInvocationProcessor.class)
ImperativeMethodInvocationProcessor imperativeMethodInvocationProcessor(NewSpanParser newSpanParser,
Tracer tracer, ObjectProvider<SpanTagAnnotationHandler> spanTagAnnotationHandler) {
return new ImperativeMethodInvocationProcessor(newSpanParser, tracer,
spanTagAnnotationHandler.getIfAvailable());
}
@Bean
@ConditionalOnMissingBean
SpanAspect spanAspect(MethodInvocationProcessor methodInvocationProcessor) {
return new SpanAspect(methodInvocationProcessor);
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-micrometer-tracing\src\main\java\org\springframework\boot\micrometer\tracing\autoconfigure\MicrometerTracingAutoConfiguration.java
| 2
|
请完成以下Java代码
|
public Exception getFailure() {
return failure;
}
public void setFailure(Exception failure) {
this.failure = failure;
}
public enum State
{
NOT_APPLIED,
APPLIED,
/**
* Indicates that the operation was not performed for any reason except
* concurrent modifications.
*/
FAILED_ERROR,
|
/**
* Indicates that the operation was not performed and that the reason
* was a concurrent modification to the data to be updated.
* Applies to databases with isolation level READ_COMMITTED.
*/
FAILED_CONCURRENT_MODIFICATION,
/**
* Indicates that the operation was not performed and was a concurrency
* conflict with a SQL exception. Applies to PostgreSQL.
*/
FAILED_CONCURRENT_MODIFICATION_EXCEPTION
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\db\entitymanager\operation\DbOperation.java
| 1
|
请完成以下Java代码
|
public void setCommodityCode (final @Nullable java.lang.String CommodityCode)
{
set_Value (COLUMNNAME_CommodityCode, CommodityCode);
}
@Override
public java.lang.String getCommodityCode()
{
return get_ValueAsString(COLUMNNAME_CommodityCode);
}
@Override
public void setDescription (final @Nullable java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
@Override
public java.lang.String getDescription()
{
return get_ValueAsString(COLUMNNAME_Description);
}
@Override
public void setInternalName (final @Nullable java.lang.String InternalName)
{
set_Value (COLUMNNAME_InternalName, InternalName);
}
@Override
public java.lang.String getInternalName()
{
return get_ValueAsString(COLUMNNAME_InternalName);
}
@Override
public void setName (final java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
/**
* ProductType AD_Reference_ID=270
* Reference name: M_Product_ProductType
*/
public static final int PRODUCTTYPE_AD_Reference_ID=270;
/** Item = I */
public static final String PRODUCTTYPE_Item = "I";
/** Service = S */
public static final String PRODUCTTYPE_Service = "S";
|
/** Resource = R */
public static final String PRODUCTTYPE_Resource = "R";
/** ExpenseType = E */
public static final String PRODUCTTYPE_ExpenseType = "E";
/** Online = O */
public static final String PRODUCTTYPE_Online = "O";
/** FreightCost = F */
public static final String PRODUCTTYPE_FreightCost = "F";
@Override
public void setProductType (final @Nullable java.lang.String ProductType)
{
set_Value (COLUMNNAME_ProductType, ProductType);
}
@Override
public java.lang.String getProductType()
{
return get_ValueAsString(COLUMNNAME_ProductType);
}
/**
* VATType AD_Reference_ID=540842
* Reference name: VATType
*/
public static final int VATTYPE_AD_Reference_ID=540842;
/** RegularVAT = N */
public static final String VATTYPE_RegularVAT = "N";
/** ReducedVAT = R */
public static final String VATTYPE_ReducedVAT = "R";
/** TaxExempt = E */
public static final String VATTYPE_TaxExempt = "E";
@Override
public void setVATType (final @Nullable java.lang.String VATType)
{
set_Value (COLUMNNAME_VATType, VATType);
}
@Override
public java.lang.String getVATType()
{
return get_ValueAsString(COLUMNNAME_VATType);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_TaxCategory.java
| 1
|
请完成以下Java代码
|
protected final boolean isShowGlassPane()
{
return showGlassPane;
}
@Override
public final IClientUIInvoker setOnFail(OnFail onFail)
{
Check.assumeNotNull(onFail, "onFail not null");
this.onFail = onFail;
return this;
}
private final OnFail getOnFail()
{
return onFail;
}
@Override
public final IClientUIInvoker setExceptionHandler(IExceptionHandler exceptionHandler)
{
Check.assumeNotNull(exceptionHandler, "exceptionHandler not null");
this.exceptionHandler = exceptionHandler;
return this;
}
private final IExceptionHandler getExceptionHandler()
{
return exceptionHandler;
}
@Override
public abstract IClientUIInvoker setParentComponent(final Object parentComponent);
@Override
public abstract IClientUIInvoker setParentComponentByWindowNo(final int windowNo);
protected final void setParentComponent(final int windowNo, final Object component)
{
this.parentWindowNo = windowNo;
this.parentComponent = component;
}
|
protected final Object getParentComponent()
{
return parentComponent;
}
protected final int getParentWindowNo()
{
return parentWindowNo;
}
@Override
public final IClientUIInvoker setRunnable(final Runnable runnable)
{
this.runnable = runnable;
return this;
}
private final Runnable getRunnable()
{
return runnable;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\adempiere\form\AbstractClientUIInvoker.java
| 1
|
请完成以下Java代码
|
private String decrypt(final Path path, String encryptPrefix, String encryptSuffix, String decryptPrefix, String decryptSuffix) throws MojoExecutionException {
log.info("Decrypting file " + path);
try {
String contents = FileService.read(path);
return getOldEncryptionService().decrypt(contents, encryptPrefix, encryptSuffix, decryptPrefix, decryptSuffix);
} catch (Exception e) {
throw new MojoExecutionException("Error Decrypting: " + e.getMessage(), e);
}
}
private EncryptionService getOldEncryptionService() {
JasyptEncryptorConfigurationProperties properties = new JasyptEncryptorConfigurationProperties();
configure(properties);
StringEncryptor encryptor = new StringEncryptorBuilder(properties, "jasypt.plugin.old").build();
return new EncryptionService(encryptor);
}
|
/**
* <p>configure.</p>
*
* @param properties a {@link com.ulisesbocchio.jasyptspringboot.properties.JasyptEncryptorConfigurationProperties} object
*/
protected abstract void configure(JasyptEncryptorConfigurationProperties properties);
/**
* <p>setIfNotNull.</p>
*
* @param setter a {@link java.util.function.Consumer} object
* @param value a T object
* @param <T> a T class
*/
protected <T> void setIfNotNull(Consumer<T> setter, T value) {
if (value != null) {
setter.accept(value);
}
}
}
|
repos\jasypt-spring-boot-master\jasypt-maven-plugin\src\main\java\com\ulisesbocchio\jasyptmavenplugin\mojo\AbstractReencryptMojo.java
| 1
|
请完成以下Java代码
|
public class PlanItemControlImpl extends CmmnElementImpl implements PlanItemControl {
protected static ChildElement<RepetitionRule> repetitionRuleChild;
protected static ChildElement<RequiredRule> requiredRuleChild;
protected static ChildElement<ManualActivationRule> manualActivationRuleChild;
public PlanItemControlImpl(ModelTypeInstanceContext instanceContext) {
super(instanceContext);
}
public RepetitionRule getRepetitionRule() {
return repetitionRuleChild.getChild(this);
}
public void setRepetitionRule(RepetitionRule repetitionRule) {
repetitionRuleChild.setChild(this, repetitionRule);
}
public RequiredRule getRequiredRule() {
return requiredRuleChild.getChild(this);
}
public void setRequiredRule(RequiredRule requiredRule) {
requiredRuleChild.setChild(this, requiredRule);
}
public ManualActivationRule getManualActivationRule() {
return manualActivationRuleChild.getChild(this);
}
public void setManualActivationRule(ManualActivationRule manualActivationRule) {
manualActivationRuleChild.setChild(this, manualActivationRule);
|
}
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(PlanItemControl.class, CMMN_ELEMENT_PLAN_ITEM_CONTROL)
.namespaceUri(CMMN11_NS)
.extendsType(CmmnElement.class)
.instanceProvider(new ModelTypeInstanceProvider<PlanItemControl>() {
public PlanItemControl newInstance(ModelTypeInstanceContext instanceContext) {
return new PlanItemControlImpl(instanceContext);
}
});
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
repetitionRuleChild = sequenceBuilder.element(RepetitionRule.class)
.build();
requiredRuleChild = sequenceBuilder.element(RequiredRule.class)
.build();
manualActivationRuleChild = sequenceBuilder.element(ManualActivationRule.class)
.build();
typeBuilder.build();
}
}
|
repos\camunda-bpm-platform-master\model-api\cmmn-model\src\main\java\org\camunda\bpm\model\cmmn\impl\instance\PlanItemControlImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
class UserWorkstationAssignmentRepository
{
private final IQueryBL queryBL = Services.get(IQueryBL.class);
private final CCache<UserId, Optional<UserWorkstationAssignment>> cacheByUserId = CCache.<UserId, Optional<UserWorkstationAssignment>>builder()
.tableName(I_PP_Workstation_UserAssign.Table_Name)
.build();
public Optional<UserWorkstationAssignment> getByUserId(@NonNull final UserId userId)
{
return cacheByUserId.getOrLoad(userId, this::retrieveByUserId);
}
private Optional<UserWorkstationAssignment> retrieveByUserId(@NonNull final UserId userId)
{
return retrieveRecordByUserId(userId).map(UserWorkstationAssignmentRepository::fromRecord);
}
private Optional<I_PP_Workstation_UserAssign> retrieveRecordByUserId(@NonNull final UserId userId)
{
return queryBL.createQueryBuilder(I_PP_Workstation_UserAssign.class)
.addEqualsFilter(I_PP_Workstation_UserAssign.COLUMNNAME_AD_User_ID, userId)
.create()
.firstOnlyOptional(I_PP_Workstation_UserAssign.class);
}
private static UserWorkstationAssignment fromRecord(final I_PP_Workstation_UserAssign record)
|
{
return UserWorkstationAssignment.builder()
.userId(UserId.ofRepoId(record.getAD_User_ID()))
.workstationId(ResourceId.ofRepoId(record.getWorkStation_ID()))
.active(record.isActive())
.build();
}
public void assign(@NonNull final UserId userId, @NonNull final ResourceId workstationId)
{
final I_PP_Workstation_UserAssign record = retrieveRecordByUserId(userId)
.orElseGet(() -> InterfaceWrapperHelper.newInstance(I_PP_Workstation_UserAssign.class));
record.setAD_User_ID(userId.getRepoId());
record.setWorkStation_ID(workstationId.getRepoId());
record.setIsActive(true);
InterfaceWrapperHelper.save(record);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\resource\UserWorkstationAssignmentRepository.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class JwtTokenFilter extends OncePerRequestFilter {
@Autowired
private UserDetailsService userDetailsService;
@Autowired
private JwtTokenUtil jwtTokenUtil;
/**
* 存放Token的Header Key
*/
public static final String HEADER_STRING = "Authorization";
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException {
String token = request.getHeader( HEADER_STRING );
|
if (null != token) {
String username = jwtTokenUtil.getUsernameFromToken(token);
if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) {
UserDetails userDetails = this.userDetailsService.loadUserByUsername(username);
if (jwtTokenUtil.validateToken(token, userDetails)) {
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(
userDetails, null, userDetails.getAuthorities());
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(
request));
SecurityContextHolder.getContext().setAuthentication(authentication);
}
}
}
chain.doFilter(request, response);
}
}
|
repos\SpringBootLearning-master (1)\springboot-jwt\src\main\java\com\gf\filter\JwtTokenFilter.java
| 2
|
请完成以下Java代码
|
public Integer getGrowth() {
return growth;
}
public void setGrowth(Integer growth) {
this.growth = growth;
}
public Integer getLuckeyCount() {
return luckeyCount;
}
public void setLuckeyCount(Integer luckeyCount) {
this.luckeyCount = luckeyCount;
}
public Integer getHistoryIntegration() {
return historyIntegration;
}
public void setHistoryIntegration(Integer historyIntegration) {
this.historyIntegration = historyIntegration;
}
@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(", memberLevelId=").append(memberLevelId);
sb.append(", username=").append(username);
sb.append(", password=").append(password);
sb.append(", nickname=").append(nickname);
sb.append(", phone=").append(phone);
sb.append(", status=").append(status);
sb.append(", createTime=").append(createTime);
sb.append(", icon=").append(icon);
sb.append(", gender=").append(gender);
sb.append(", birthday=").append(birthday);
sb.append(", city=").append(city);
sb.append(", job=").append(job);
sb.append(", personalizedSignature=").append(personalizedSignature);
sb.append(", sourceType=").append(sourceType);
sb.append(", integration=").append(integration);
sb.append(", growth=").append(growth);
sb.append(", luckeyCount=").append(luckeyCount);
sb.append(", historyIntegration=").append(historyIntegration);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
|
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\UmsMember.java
| 1
|
请完成以下Java代码
|
public String idFromBaseType() {
return this.delegate.idFromBaseType();
}
@Override
public JavaType typeFromId(DatabindContext context, String id) throws IOException {
DeserializationConfig config = (DeserializationConfig) context.getConfig();
JavaType result = this.delegate.typeFromId(context, id);
String className = result.getRawClass().getName();
if (isInAllowlist(className)) {
return result;
}
boolean isExplicitMixin = config.findMixInClassFor(result.getRawClass()) != null;
if (isExplicitMixin) {
return result;
}
JacksonAnnotation jacksonAnnotation = AnnotationUtils.findAnnotation(result.getRawClass(),
JacksonAnnotation.class);
if (jacksonAnnotation != null) {
return result;
}
throw new IllegalArgumentException("The class with " + id + " and name of " + className
+ " is not in the allowlist. "
+ "If you believe this class is safe to deserialize, please provide an explicit mapping using Jackson annotations or by providing a Mixin. "
+ "If the serialization is only done by a trusted source, you can also enable default typing. "
+ "See https://github.com/spring-projects/spring-security/issues/4370 for details");
|
}
private boolean isInAllowlist(String id) {
return ALLOWLIST_CLASS_NAMES.contains(id);
}
@Override
public String getDescForKnownTypeIds() {
return this.delegate.getDescForKnownTypeIds();
}
@Override
public JsonTypeInfo.Id getMechanism() {
return this.delegate.getMechanism();
}
}
}
|
repos\spring-security-main\core\src\main\java\org\springframework\security\jackson2\SecurityJackson2Modules.java
| 1
|
请完成以下Java代码
|
public String getDeploymentId() {
return deploymentId;
}
public void setDeploymentId(String deploymentId) {
this.deploymentId = deploymentId;
}
public void setBytes(byte[] bytes) {
this.bytes = bytes;
}
@Override
public int getRevision() {
return revision;
}
@Override
public void setRevision(int revision) {
this.revision = revision;
}
@Override
public String toString() {
return "ByteArrayEntity[id=" + id + ", name=" + name + ", size=" + (bytes != null ? bytes.length : 0) + "]";
}
// Wrapper for a byte array, needed to do byte array comparisons
// See https://activiti.atlassian.net/browse/ACT-1524
private static class PersistentState {
private final String name;
private final byte[] bytes;
|
public PersistentState(String name, byte[] bytes) {
this.name = name;
this.bytes = bytes;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof PersistentState) {
PersistentState other = (PersistentState) obj;
return Objects.equals(this.name, other.name)
&& Arrays.equals(this.bytes, other.bytes);
}
return false;
}
@Override
public int hashCode() {
throw new UnsupportedOperationException();
}
}
}
|
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\persistence\entity\ByteArrayEntity.java
| 1
|
请完成以下Java代码
|
public void setM_AttributeSetInstance(final org.compiere.model.I_M_AttributeSetInstance M_AttributeSetInstance)
{
set_ValueFromPO(COLUMNNAME_M_AttributeSetInstance_ID, org.compiere.model.I_M_AttributeSetInstance.class, M_AttributeSetInstance);
}
@Override
public void setM_AttributeSetInstance_ID (final int M_AttributeSetInstance_ID)
{
if (M_AttributeSetInstance_ID < 0)
set_Value (COLUMNNAME_M_AttributeSetInstance_ID, null);
else
set_Value (COLUMNNAME_M_AttributeSetInstance_ID, M_AttributeSetInstance_ID);
}
@Override
public int getM_AttributeSetInstance_ID()
{
return get_ValueAsInt(COLUMNNAME_M_AttributeSetInstance_ID);
}
@Override
public void setQty_Reported (final @Nullable BigDecimal Qty_Reported)
{
set_Value (COLUMNNAME_Qty_Reported, Qty_Reported);
|
}
@Override
public BigDecimal getQty_Reported()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty_Reported);
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.contracts\src\main\java-gen\de\metas\contracts\model\X_C_Flatrate_DataEntry_Detail.java
| 1
|
请完成以下Java代码
|
public class GenerateHUQRCodes extends JavaProcess
{
private final IAttributeDAO attributeDAO = Services.get(IAttributeDAO.class);
private final HUQRCodesService huQRCodesService = SpringContextHolder.instance.getBean(HUQRCodesService.class);
@Param(parameterName = I_M_HU_PI.COLUMNNAME_M_HU_PI_ID)
private HuPackingInstructionsId huPackingInstructionsId;
@Param(parameterName = I_M_Product.COLUMNNAME_M_Product_ID, mandatory = true)
private ProductId productId;
@Param(parameterName = "LabelsCount", mandatory = true)
private int labelsCount;
@Param(parameterName = "Lot")
private String lotNo;
@Override
protected String doIt()
|
{
final List<HUQRCode> qrCodes = huQRCodesService.generate(
HUQRCodeGenerateRequest.builder()
.count(labelsCount)
.huPackingInstructionsId(huPackingInstructionsId)
.productId(productId)
.lotNo(lotNo, attributeDAO::getAttributeIdByCode)
.build());
final QRCodePDFResource pdf = huQRCodesService.createPDF(qrCodes);
getResult().setReportData(pdf);
return MSG_OK;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\process\GenerateHUQRCodes.java
| 1
|
请完成以下Java代码
|
public HistoricActivityInstanceQueryImpl orderByProcessInstanceId() {
orderBy(HistoricActivityInstanceQueryProperty.PROCESS_INSTANCE_ID);
return this;
}
public HistoricActivityInstanceQueryImpl orderByHistoricActivityInstanceStartTime() {
orderBy(HistoricActivityInstanceQueryProperty.START);
return this;
}
public HistoricActivityInstanceQuery orderByActivityId() {
orderBy(HistoricActivityInstanceQueryProperty.ACTIVITY_ID);
return this;
}
public HistoricActivityInstanceQueryImpl orderByActivityName() {
orderBy(HistoricActivityInstanceQueryProperty.ACTIVITY_NAME);
return this;
}
public HistoricActivityInstanceQueryImpl orderByActivityType() {
orderBy(HistoricActivityInstanceQueryProperty.ACTIVITY_TYPE);
return this;
}
public HistoricActivityInstanceQueryImpl orderByTenantId() {
orderBy(HistoricActivityInstanceQueryProperty.TENANT_ID);
return this;
}
public HistoricActivityInstanceQueryImpl activityInstanceId(String activityInstanceId) {
this.activityInstanceId = activityInstanceId;
return this;
}
// getters and setters
// //////////////////////////////////////////////////////
public String getProcessInstanceId() {
return processInstanceId;
}
public String getExecutionId() {
return executionId;
}
|
public String getProcessDefinitionId() {
return processDefinitionId;
}
public String getActivityId() {
return activityId;
}
public String getActivityName() {
return activityName;
}
public String getActivityType() {
return activityType;
}
public String getAssignee() {
return assignee;
}
public boolean isFinished() {
return finished;
}
public boolean isUnfinished() {
return unfinished;
}
public String getActivityInstanceId() {
return activityInstanceId;
}
public String getDeleteReason() {
return deleteReason;
}
public String getDeleteReasonLike() {
return deleteReasonLike;
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\HistoricActivityInstanceQueryImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public static Map<String, Map<String, Object>> toMap() {
NotifyStatusEnum[] ary = NotifyStatusEnum.values();
Map<String, Map<String, Object>> enumMap = new HashMap<String, Map<String, Object>>();
for (int num = 0; num < ary.length; num++) {
Map<String, Object> map = new HashMap<String, Object>();
String key = ary[num].name();
map.put("desc", ary[num].getDesc());
enumMap.put(key, map);
}
return enumMap;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static List toList() {
NotifyStatusEnum[] ary = NotifyStatusEnum.values();
List list = new ArrayList();
for (int i = 0; i < ary.length; i++) {
Map<String, String> map = new HashMap<String, String>();
map.put("desc", ary[i].getDesc());
list.add(map);
}
return list;
}
public static NotifyStatusEnum getEnum(String name) {
NotifyStatusEnum[] arry = NotifyStatusEnum.values();
for (int i = 0; i < arry.length; i++) {
if (arry[i].name().equalsIgnoreCase(name)) {
return arry[i];
}
}
return null;
|
}
/**
* 取枚举的json字符串
*
* @return
*/
public static String getJsonStr() {
NotifyStatusEnum[] enums = NotifyStatusEnum.values();
StringBuffer jsonStr = new StringBuffer("[");
for (NotifyStatusEnum senum : enums) {
if (!"[".equals(jsonStr.toString())) {
jsonStr.append(",");
}
jsonStr.append("{id:'").append(senum).append("',desc:'").append(senum.getDesc()).append("'}");
}
jsonStr.append("]");
return jsonStr.toString();
}
}
|
repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\notify\enums\NotifyStatusEnum.java
| 2
|
请完成以下Java代码
|
public boolean isAllowVirtualPI()
{
return allowVirtualPI;
}
@Override
public void setAllowVirtualPI(final boolean allowVirtualPI)
{
this.allowVirtualPI = allowVirtualPI;
}
@Override
public void setOneConfigurationPerPI(final boolean oneConfigurationPerPI)
{
this.oneConfigurationPerPI = oneConfigurationPerPI;
}
@Override
public boolean isOneConfigurationPerPI()
{
return oneConfigurationPerPI;
}
@Override
public boolean isAllowDifferentCapacities()
{
return allowDifferentCapacities;
}
@Override
public void setAllowDifferentCapacities(final boolean allowDifferentCapacities)
{
this.allowDifferentCapacities = allowDifferentCapacities;
}
@Override
public boolean isAllowInfiniteCapacity()
{
return allowInfiniteCapacity;
}
@Override
public void setAllowInfiniteCapacity(final boolean allowInfiniteCapacity)
|
{
this.allowInfiniteCapacity = allowInfiniteCapacity;
}
@Override
public boolean isAllowAnyPartner()
{
return allowAnyPartner;
}
@Override
public void setAllowAnyPartner(final boolean allowAnyPartner)
{
this.allowAnyPartner = allowAnyPartner;
}
@Override
public int getM_Product_Packaging_ID()
{
return packagingProductId;
}
@Override
public void setM_Product_Packaging_ID(final int packagingProductId)
{
this.packagingProductId = packagingProductId > 0 ? packagingProductId : -1;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\impl\HUPIItemProductQuery.java
| 1
|
请完成以下Java代码
|
public TenantId getTenantId() {
return tenantId;
}
public void setTenantId(TenantId tenantId) {
this.tenantId = tenantId;
}
@Schema(description = "The Administration Settings key, (e.g. 'general' or 'mail')", example = "mail")
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
@Schema(description = "JSON representation of the Administration Settings value")
public JsonNode getJsonValue() {
return jsonValue;
}
public void setJsonValue(JsonNode jsonValue) {
this.jsonValue = jsonValue;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((jsonValue == null) ? 0 : jsonValue.hashCode());
result = prime * result + ((key == null) ? 0 : key.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
|
if (getClass() != obj.getClass())
return false;
AdminSettings other = (AdminSettings) obj;
if (jsonValue == null) {
if (other.jsonValue != null)
return false;
} else if (!jsonValue.equals(other.jsonValue))
return false;
if (key == null) {
if (other.key != null)
return false;
} else if (!key.equals(other.key))
return false;
return true;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("AdminSettings [key=");
builder.append(key);
builder.append(", jsonValue=");
builder.append(jsonValue);
builder.append(", createdTime=");
builder.append(createdTime);
builder.append(", id=");
builder.append(id);
builder.append("]");
return builder.toString();
}
}
|
repos\thingsboard-master\common\data\src\main\java\org\thingsboard\server\common\data\AdminSettings.java
| 1
|
请完成以下Java代码
|
private I_M_Shipper loadShipper(@NonNull final String shipperInternalName)
{
return shipperDAO.getByInternalName(ImmutableSet.of(shipperInternalName)).get(shipperInternalName);
}
public ProductId getProductId(@NonNull final ShipmentScheduleId shipmentScheduleId)
{
final I_M_ShipmentSchedule shipmentSchedule = getShipmentScheduleById(shipmentScheduleId);
return ProductId.ofRepoId(shipmentSchedule.getM_Product_ID());
}
public ProductId getProductId(@NonNull final String productSearchKey, @NonNull final OrgId orgId)
{
final ProductQuery query = ProductQuery.builder()
.value(productSearchKey)
.orgId(orgId)
|
.includeAnyOrg(true) // include articles with org=*
.build();
return productIdsByQuery.computeIfAbsent(query, this::retrieveProductIdByQuery);
}
private ProductId retrieveProductIdByQuery(@NonNull final ProductQuery query)
{
final ProductId productId = productDAO.retrieveProductIdBy(query);
if (productId == null)
{
throw new AdempiereException("No product found for " + query);
}
return productId;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\shipmentschedule\api\ShippingInfoCache.java
| 1
|
请完成以下Java代码
|
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
|
/** Set Printer Name.
@param PrinterName
Name of the Printer
*/
public void setPrinterName (String PrinterName)
{
set_Value (COLUMNNAME_PrinterName, PrinterName);
}
/** Get Printer Name.
@return Name of the Printer
*/
public String getPrinterName ()
{
return (String)get_Value(COLUMNNAME_PrinterName);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_PrintLabel.java
| 1
|
请完成以下Java代码
|
public void setType (final java.lang.String Type)
{
set_Value (COLUMNNAME_Type, Type);
}
@Override
public java.lang.String getType()
{
return get_ValueAsString(COLUMNNAME_Type);
}
@Override
public void setValue (final java.lang.String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
@Override
public java.lang.String getValue()
{
|
return get_ValueAsString(COLUMNNAME_Value);
}
@Override
public void setWorkflowValue (final @Nullable java.lang.String WorkflowValue)
{
set_Value (COLUMNNAME_WorkflowValue, WorkflowValue);
}
@Override
public java.lang.String getWorkflowValue()
{
return get_ValueAsString(COLUMNNAME_WorkflowValue);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Process.java
| 1
|
请完成以下Java代码
|
protected void writeAttributes(HtmlWriteContext context) {
StringWriter writer = context.getWriter();
for (Entry<String, String> attribute : attributes.entrySet()) {
writer.write(" ");
writer.write(attribute.getKey());
if(attribute.getValue() != null) {
writer.write("=\"");
String attributeValue = escapeQuotes(attribute.getValue());
writer.write(attributeValue);
writer.write("\"");
}
}
}
protected String escapeQuotes(String attributeValue){
String escapedHtmlQuote = """;
String escapedJavaQuote = "\"";
return attributeValue.replaceAll(escapedJavaQuote, escapedHtmlQuote);
}
protected void writeEndLine(HtmlWriteContext context) {
StringWriter writer = context.getWriter();
writer.write("\n");
}
protected void writeStartTagClose(HtmlWriteContext context) {
StringWriter writer = context.getWriter();
if(isSelfClosing) {
writer.write(" /");
}
writer.write(">");
}
|
protected void writeLeadingWhitespace(HtmlWriteContext context) {
int stackSize = context.getElementStackSize();
StringWriter writer = context.getWriter();
for (int i = 0; i < stackSize; i++) {
writer.write(" ");
}
}
// builder /////////////////////////////////////
public HtmlElementWriter attribute(String name, String value) {
attributes.put(name, value);
return this;
}
public HtmlElementWriter textContent(String text) {
if(isSelfClosing) {
throw new IllegalStateException("Self-closing element cannot have text content.");
}
this.textContent = text;
return this;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\form\engine\HtmlElementWriter.java
| 1
|
请完成以下Java代码
|
public static void main(String[] args) {
Adempiere.startupEnvironment(true);
JFrame frame = new JFrame("test");
frame.setVisible(true);
String text = "<html><p>this is a line<br>with <b>bold</> info</html>";
int i = 0;
while (true) {
RichTextEditorExperimental ed = new RichTextEditorExperimental(frame, "heading " + ++i,
text, true);
text = ed.getHtmlText();
}
} // main
} // HTMLEditor
/*******************************************************************************
* HTML Editor Menu Action
*/
class HTMLEditor_MenuActionExperimental {
public HTMLEditor_MenuActionExperimental(String name, HTMLEditor_MenuAction[] subMenus) {
m_name = name;
m_subMenus = subMenus;
}
public HTMLEditor_MenuActionExperimental(String name, String actionName) {
m_name = name;
m_actionName = actionName;
}
public HTMLEditor_MenuActionExperimental(String name, Action action) {
m_name = name;
m_action = action;
}
private String m_name;
private String m_actionName;
private Action m_action;
private HTMLEditor_MenuAction[] m_subMenus;
public boolean isSubMenu() {
|
return m_subMenus != null;
}
public boolean isAction() {
return m_action != null;
}
public String getName() {
return m_name;
}
public HTMLEditor_MenuAction[] getSubMenus() {
return m_subMenus;
}
public String getActionName() {
return m_actionName;
}
public Action getAction() {
return m_action;
}
} // MenuAction
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-legacy\org\compiere\grid\ed\RichTextEditorExperimental.java
| 1
|
请完成以下Java代码
|
public List<HalResource<?>> resolve(HalRelation relation, ProcessEngine processEngine) {
HalLinkResolver linkResolver = hal.getLinkResolver(relation.resourceType);
if(linkResolver != null) {
Set<String> linkedIds = getLinkedResourceIdsByRelation(relation);
if(!linkedIds.isEmpty()) {
return linkResolver.resolveLinks(linkedIds.toArray(new String[linkedIds.size()]), processEngine);
} else {
return Collections.emptyList();
}
} else {
throw new RuntimeException("Cannot find HAL link resolver for resource type '"+relation.resourceType+"'.");
}
}
/**
* merge the links of an embedded resource into this linker.
* This is useful when building resources which are actually resource collections.
|
* You can then merge the relations of all resources in the collection and the unique the set of linked resources to embed.
*
* @param embedded the embedded resource for which the links should be merged into this linker.
*/
public void mergeLinks(HalResource<?> embedded) {
for (Entry<HalRelation, Set<String>> linkentry : embedded.linker.linkedResources.entrySet()) {
Set<String> linkedIdSet = linkedResources.get(linkentry.getKey());
if(linkedIdSet != null) {
linkedIdSet.addAll(linkentry.getValue());
}else {
linkedResources.put(linkentry.getKey(), linkentry.getValue());
}
}
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\hal\HalLinker.java
| 1
|
请完成以下Java代码
|
public int getC_BankStatement_Import_File_ID()
{
return get_ValueAsInt(COLUMNNAME_C_BankStatement_Import_File_ID);
}
@Override
public void setC_BankStatement_Import_File_Log_ID (final int C_BankStatement_Import_File_Log_ID)
{
if (C_BankStatement_Import_File_Log_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_BankStatement_Import_File_Log_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_BankStatement_Import_File_Log_ID, C_BankStatement_Import_File_Log_ID);
}
@Override
public int getC_BankStatement_Import_File_Log_ID()
|
{
return get_ValueAsInt(COLUMNNAME_C_BankStatement_Import_File_Log_ID);
}
@Override
public void setLogmessage (final @Nullable java.lang.String Logmessage)
{
set_Value (COLUMNNAME_Logmessage, Logmessage);
}
@Override
public java.lang.String getLogmessage()
{
return get_ValueAsString(COLUMNNAME_Logmessage);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.base\src\main\java\org\adempiere\banking\model\X_C_BankStatement_Import_File_Log.java
| 1
|
请完成以下Java代码
|
public Optional<OrderId> resolveOrderId(@NonNull final IdentifierString orderIdentifier, @NonNull final OrgId orgId)
{
final OrderQuery.OrderQueryBuilder queryBuilder = OrderQuery.builder().orgId(orgId);
switch (orderIdentifier.getType())
{
case METASFRESH_ID:
final OrderId orderId = OrderId.ofRepoId(orderIdentifier.asMetasfreshId().getValue());
return Optional.of(orderId);
case DOC:
final OrderQuery getOrderByDocQuery = queryBuilder
.documentNo(orderIdentifier.asDoc())
.build();
return orderDAO.retrieveByOrderCriteria(getOrderByDocQuery)
.map(I_C_Order::getC_Order_ID)
|
.map(OrderId::ofRepoId);
case EXTERNAL_ID:
final OrderQuery getOrderByExternalId = queryBuilder
.externalId(orderIdentifier.asExternalId())
.build();
return orderDAO.retrieveByOrderCriteria(getOrderByExternalId)
.map(I_C_Order::getC_Order_ID)
.map(OrderId::ofRepoId);
default:
throw new InvalidIdentifierException("Given IdentifierString type is not supported!")
.appendParametersToMessage()
.setParameter("IdentifierStringType", orderIdentifier.getType())
.setParameter("rawIdentifierString", orderIdentifier.getRawIdentifierString());
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business.rest-api-impl\src\main\java\de\metas\rest_api\v2\order\sales\OrderService.java
| 1
|
请完成以下Java代码
|
public void setId(String value) {
this.id = value;
}
/**
* Gets the value of the schmeNm property.
*
* @return
* possible object is
* {@link OrganisationIdentificationSchemeName1Choice }
*
*/
public OrganisationIdentificationSchemeName1Choice getSchmeNm() {
return schmeNm;
}
/**
* Sets the value of the schmeNm property.
*
* @param value
* allowed object is
* {@link OrganisationIdentificationSchemeName1Choice }
*
*/
public void setSchmeNm(OrganisationIdentificationSchemeName1Choice value) {
this.schmeNm = value;
}
/**
* Gets the value of the issr property.
|
*
* @return
* possible object is
* {@link String }
*
*/
public String getIssr() {
return issr;
}
/**
* Sets the value of the issr property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIssr(String value) {
this.issr = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_02\GenericOrganisationIdentification1.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void afterSingletonsInstantiated() {
try {
this.topology = getObject().build(this.properties);
this.infrastructureCustomizer.configureTopology(this.topology);
TopologyDescription description = this.topology.describe();
LOGGER.debug(description::toString);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
private StreamsBuilder createStreamBuilder() {
if (this.properties == null) {
return new StreamsBuilder();
}
else {
StreamsConfig streamsConfig = new StreamsConfig(this.properties);
TopologyConfig topologyConfig = new TopologyConfig(streamsConfig);
return new StreamsBuilder(topologyConfig);
}
}
/**
* Called whenever a {@link KafkaStreams} is added or removed.
*
* @since 2.5.3
*
*/
public interface Listener {
/**
* A new {@link KafkaStreams} was created.
* @param id the streams id (factory bean name).
|
* @param streams the streams;
*/
default void streamsAdded(String id, KafkaStreams streams) {
}
/**
* An existing {@link KafkaStreams} was removed.
* @param id the streams id (factory bean name).
* @param streams the streams;
*/
default void streamsRemoved(String id, KafkaStreams streams) {
}
}
}
|
repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\config\StreamsBuilderFactoryBean.java
| 2
|
请完成以下Java代码
|
public static void main(String[] args){
try {
//Register JDBC driver
Class.forName(JDBC_DRIVER);
//Open a connection
System.out.println("Connecting to database...");
conn = DriverManager.getConnection(DB_URL, USER, PASS);
stmt = conn.createStatement();
}
catch(Exception e)
{
//Handle errors for Class.forName
e.printStackTrace();
}
try {
Scanner sc = new Scanner(System.in);
System.out.println("Enter full path of the file: ");
String filePath= sc.next();
Path path = Paths.get(filePath);
System.out.println("Press 1: Execute SQL Script Using Plain Java: ");
System.out.println("Press 2: Execute SQL Script Using Apache iBatis: ");
List<String> sqlLines=Files.readAllLines(path);
int choice = sc.nextInt();
switch (choice)
{
case 1:
// Running SQL Script using Plain Java
for (String sql : sqlLines) {
System.out.println("Query: " + sql);
if (sql.contains("SELECT")) {
ResultSet rs = stmt.executeQuery(sql);
System.out.print("ID" + "\t" + "Name" + "\t" + "Surname" + "\t" + "Age");
System.out.println("");
// Extract data from result set
while (rs.next()) {
// Retrieve by column name
int id = rs.getRow();
int age = rs.getInt("age");
String name = rs.getString("name");
String surname = rs.getString("surname");
// Display values
|
System.out.print(id + "\t" + name + "\t" + surname + "\t" + age);
System.out.println("");
}
}
else
stmt.execute(sql);
}
break;
case 2:
ScriptRunner scriptExecutor = new ScriptRunner(conn);
BufferedReader reader = new BufferedReader(new FileReader(filePath));
scriptExecutor.runScript(reader);
reader.close();
break;
}
}
catch(SQLException se)
{
//Handle errors for JDBC
se.printStackTrace();
} catch(Exception e)
{
//Handle errors for Class.forName
e.printStackTrace();
}
System.out.println("Reached End of Code!");
}
}
|
repos\tutorials-master\mybatis\src\main\java\com\baeldung\mybatis_sqlscript\Main.java
| 1
|
请完成以下Java代码
|
public final VEditor getEditor()
{
if (context == null)
{
return null;
}
return context.getEditor();
}
public final GridField getGridField()
{
final VEditor editor = getEditor();
if (editor == null)
{
return null;
}
final GridField gridField = editor.getField();
return gridField;
}
public final GridTab getGridTab()
{
final GridField gridField = getGridField();
if (gridField == null)
{
return null;
}
return gridField.getGridTab();
}
@Override
public List<IContextMenuAction> getChildren()
{
return Collections.emptyList();
}
@Override
public boolean isLongOperation()
{
return false;
}
@Override
public boolean isHideWhenNotRunnable()
{
return true; // hide when not runnable - backward compatibility
}
protected final String getColumnName()
{
final GridField gridField = getGridField();
if (gridField == null)
{
return null;
}
final String columnName = gridField.getColumnName();
return columnName;
}
protected final Object getFieldValue()
{
final IContextMenuActionContext context = getContext();
if (context == null)
{
return null;
}
//
// Get value when in Grid Mode
final VTable vtable = context.getVTable();
final int row = context.getViewRow();
final int column = context.getViewColumn();
if (vtable != null && row >= 0 && column >= 0)
{
final Object value = vtable.getValueAt(row, column);
return value;
}
// Get value when in single mode
|
else
{
final GridField gridField = getGridField();
if (gridField == null)
{
return null;
}
final Object value = gridField.getValue();
return value;
}
}
protected final GridController getGridController()
{
final IContextMenuActionContext context = getContext();
if (context == null)
{
return null;
}
final VTable vtable = context.getVTable();
final Component comp;
if (vtable != null)
{
comp = vtable;
}
else
{
final VEditor editor = getEditor();
if (editor instanceof Component)
{
comp = (Component)editor;
}
else
{
comp = null;
}
}
Component p = comp;
while (p != null)
{
if (p instanceof GridController)
{
return (GridController)p;
}
p = p.getParent();
}
return null;
}
protected final boolean isGridMode()
{
final GridController gc = getGridController();
if (gc == null)
{
return false;
}
final boolean gridMode = !gc.isSingleRow();
return gridMode;
}
@Override
public KeyStroke getKeyStroke()
{
return null;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\org\adempiere\ui\AbstractContextMenuAction.java
| 1
|
请完成以下Java代码
|
private void notifyRecordsChangedNow(
@NonNull final TableRecordReferenceSet recordRefs,
@NonNull final IViewsIndexStorage viewsIndexStorage)
{
final ImmutableList<IView> views = viewsIndexStorage.getAllViews();
if (views.isEmpty())
{
return;
}
final MutableInt notifiedCount = MutableInt.zero();
for (final IView view : views)
{
try
{
final boolean watchedByFrontend = isWatchedByFrontend(view.getViewId());
view.notifyRecordsChanged(recordRefs, watchedByFrontend);
notifiedCount.incrementAndGet();
}
catch (final Exception ex)
{
|
logger.warn("Failed calling notifyRecordsChanged on view={} with recordRefs={}. Ignored.", view, recordRefs, ex);
}
}
logger.debug("Notified {} views in {} about changed records: {}", notifiedCount, viewsIndexStorage, recordRefs);
}
@lombok.Value(staticConstructor = "of")
private static class ViewFactoryKey
{
WindowId windowId;
JSONViewDataType viewType;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\view\ViewsRepository.java
| 1
|
请完成以下Java代码
|
public class OrgInfo
{
@NonNull
ClientId clientId;
@NonNull
OrgId orgId;
OrgId parentOrgId;
UserId supervisorId;
CalendarId calendarId;
PricingSystemId pricingSystemId;
WarehouseId warehouseId;
WarehouseId purchaseWarehouseId;
WarehouseId dropShipWarehouseId;
@NonNull
StoreCreditCardNumberMode storeCreditCardNumberMode;
@NonNull
OrgImagesMap imagesMap;
@Nullable
|
WFResponsibleId workflowResponsibleId;
BPartnerLocationId orgBPartnerLocationId;
String reportsPathPrefix;
ZoneId timeZone;
/**
* If the sysconfig FlatrateTerm_Handler#SYS_Config_AUTO_INVOICE is set to N then this is ignored
*/
boolean autoInvoiceFlatrateTerms;
@Nullable
UserGroupId supplierApprovalExpirationNotifyUserGroupID;
@Nullable
UserGroupId partnerCreatedFromAnotherOrgNotifyUserGroupID;
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\organization\OrgInfo.java
| 1
|
请完成以下Java代码
|
private String encoding() {
String encoding = this.messageProperties.getContentEncoding();
if (encoding == null) {
encoding = bodyEncoding;
}
return encoding;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + Arrays.hashCode(this.body);
result = prime * result + ((this.messageProperties == null) ? 0 : this.messageProperties.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;
}
Message other = (Message) obj;
if (!Arrays.equals(this.body, other.body)) {
return false;
}
if (this.messageProperties == null) {
return other.messageProperties == null;
}
return this.messageProperties.equals(other.messageProperties);
}
}
|
repos\spring-amqp-main\spring-amqp\src\main\java\org\springframework\amqp\core\Message.java
| 1
|
请完成以下Java代码
|
public SpinJsonDataFormatException unableToMapInput(Object input, Exception cause) {
return new SpinJsonDataFormatException(exceptionMessage("009", "Unable to map object '{}' to json node", input), cause);
}
public SpinJsonException unableToModifyNode(String nodeName) {
return new SpinJsonException(exceptionMessage("010", "Unable to modify node of type '{}'. Node is not a list.", nodeName));
}
public SpinJsonException unableToGetIndex(String nodeName) {
return new SpinJsonException(exceptionMessage("011", "Unable to get index from '{}'. Node is not a list.", nodeName));
}
public IndexOutOfBoundsException indexOutOfBounds(Integer index, Integer size) {
return new IndexOutOfBoundsException(exceptionMessage("012", "Index is out of bound! Index: '{}', Size: '{}'", index, size));
}
public SpinJsonPathException unableToEvaluateJsonPathExpressionOnNode(SpinJsonNode node, Exception cause) {
return new SpinJsonPathException(
exceptionMessage("013", "Unable to evaluate JsonPath expression on element '{}'", node.getClass().getName()), cause);
}
|
public SpinJsonPathException unableToCompileJsonPathExpression(String expression, Exception cause) {
return new SpinJsonPathException(
exceptionMessage("014", "Unable to compile '{}'!", expression), cause);
}
public SpinJsonPathException unableToCastJsonPathResultTo(Class<?> castClass, Exception cause) {
return new SpinJsonPathException(
exceptionMessage("015", "Unable to cast JsonPath expression to '{}'", castClass.getName()), cause);
}
public SpinJsonPathException invalidJsonPath(Class<?> castClass, Exception cause) {
return new SpinJsonPathException(
exceptionMessage("017", "Invalid json path to '{}'", castClass.getName()), cause);
}
}
|
repos\camunda-bpm-platform-master\spin\dataformat-json-jackson\src\main\java\org\camunda\spin\impl\json\jackson\JacksonJsonLogger.java
| 1
|
请完成以下Java代码
|
public int getM_PackagingTreeItemSched_ID()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_PackagingTreeItemSched_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_M_PackagingTreeItem getM_PackagingTreeItem() throws RuntimeException
{
return (I_M_PackagingTreeItem)MTable.get(getCtx(), I_M_PackagingTreeItem.Table_Name)
.getPO(getM_PackagingTreeItem_ID(), get_TrxName());
}
/**
* Set Packaging Tree Item.
*
* @param M_PackagingTreeItem_ID
* Packaging Tree Item
*/
public void setM_PackagingTreeItem_ID(int M_PackagingTreeItem_ID)
{
if (M_PackagingTreeItem_ID < 1)
set_Value(COLUMNNAME_M_PackagingTreeItem_ID, null);
else
set_Value(COLUMNNAME_M_PackagingTreeItem_ID, Integer.valueOf(M_PackagingTreeItem_ID));
}
/**
* Get Packaging Tree Item.
*
* @return Packaging Tree Item
*/
public int getM_PackagingTreeItem_ID()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_PackagingTreeItem_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public I_M_ShipmentSchedule getM_ShipmentSchedule() throws RuntimeException
{
return (I_M_ShipmentSchedule)MTable.get(getCtx(), I_M_ShipmentSchedule.Table_Name)
.getPO(getM_ShipmentSchedule_ID(), get_TrxName());
}
@Override
public int getM_ShipmentSchedule_ID()
|
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_ShipmentSchedule_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public void setM_ShipmentSchedule_ID(int M_ShipmentSchedule_ID)
{
if (M_ShipmentSchedule_ID < 1)
set_Value(COLUMNNAME_M_ShipmentSchedule_ID, null);
else
set_Value(COLUMNNAME_M_ShipmentSchedule_ID, Integer.valueOf(M_ShipmentSchedule_ID));
}
/**
* Set Menge.
*
* @param Qty
* Menge
*/
public void setQty(BigDecimal Qty)
{
set_Value(COLUMNNAME_Qty, Qty);
}
/**
* Get Menge.
*
* @return Menge
*/
public BigDecimal getQty()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty);
if (bd == null)
return Env.ZERO;
return bd;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\org\compiere\model\X_M_PackagingTreeItemSched.java
| 1
|
请完成以下Java代码
|
public static WebuiASIEditingInfo processParameterASI(
final AttributeSetInstanceId attributeSetInstanceId,
final DocumentPath documentPath)
{
final ASIEditingInfo info = ASIEditingInfo.builder()
.type(WindowType.ProcessParameter)
.soTrx(SOTrx.SALES)
.attributeSetInstanceId(attributeSetInstanceId)
.build();
return builder(info)
.contextDocumentPath(documentPath)
.build();
}
@NonNull
WindowType contextWindowType;
DocumentPath contextDocumentPath;
@NonNull
AttributeSetId attributeSetId;
String attributeSetName;
String attributeSetDescription;
|
@NonNull
AttributeSetInstanceId attributeSetInstanceId;
ProductId productId;
@NonNull
SOTrx soTrx;
String callerTableName;
int callerAdColumnId;
@NonNull
@Singular
ImmutableList<Attribute> attributes;
public ImmutableSet<AttributeId> getAttributeIds()
{
return attributes.stream()
.map(Attribute::getAttributeId)
.collect(ImmutableSet.toImmutableSet());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\pattribute\WebuiASIEditingInfo.java
| 1
|
请完成以下Java代码
|
public abstract class AcctDocProviderTemplate implements IAcctDocProvider
{
private final ImmutableMap<String, AcctDocFactory> docFactoriesByTableName;
protected AcctDocProviderTemplate(final Map<String, AcctDocFactory> docFactoriesByTableName)
{
this.docFactoriesByTableName = ImmutableMap.copyOf(docFactoriesByTableName);
}
@Override
public final Set<String> getDocTableNames()
{
return docFactoriesByTableName.keySet();
}
@Override
public final Doc<?> getOrNull(
@NonNull final AcctDocRequiredServicesFacade services,
@NonNull final List<AcctSchema> acctSchemas,
@NonNull final TableRecordReference documentRef)
{
final String tableName = documentRef.getTableName();
final AcctDocFactory docFactory = docFactoriesByTableName.get(tableName);
if (docFactory == null)
{
return null;
}
return docFactory.createAcctDoc(AcctDocContext.builder()
.services(services)
.acctSchemas(acctSchemas)
.documentModel(retrieveDocumentModel(documentRef))
.build());
}
|
private AcctDocModel retrieveDocumentModel(final TableRecordReference documentRef)
{
final PO po = TableModelLoader.instance.getPO(
Env.getCtx(),
documentRef.getTableName(),
documentRef.getRecord_ID(),
ITrx.TRXNAME_ThreadInherited);
if (po == null)
{
throw new AdempiereException("No document found for " + documentRef);
}
return new POAcctDocModel(po);
}
@FunctionalInterface
protected interface AcctDocFactory
{
Doc<?> createAcctDoc(AcctDocContext ctx);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\doc\AcctDocProviderTemplate.java
| 1
|
请完成以下Java代码
|
public static SessionFactory getSessionFactoryByProperties(Properties properties) throws IOException {
ServiceRegistry serviceRegistry = configureServiceRegistry(properties);
return makeSessionFactory(serviceRegistry);
}
private static SessionFactory makeSessionFactory(ServiceRegistry serviceRegistry) {
MetadataSources metadataSources = new MetadataSources(serviceRegistry);
metadataSources.addPackage("com.baeldung.hibernate.pojo");
metadataSources.addAnnotatedClass(Student.class);
metadataSources.addAnnotatedClass(Comment.class);
metadataSources.addAnnotatedClass(Post.class);
metadataSources.addAnnotatedClass(DeptEmployee.class);
metadataSources.addAnnotatedClass(com.baeldung.hibernate.entities.Department.class);
Metadata metadata = metadataSources.getMetadataBuilder()
.build();
return metadata.getSessionFactoryBuilder()
.build();
}
private static ServiceRegistry configureServiceRegistry() throws IOException {
return configureServiceRegistry(getProperties());
}
|
private static ServiceRegistry configureServiceRegistry(Properties properties) throws IOException {
return new StandardServiceRegistryBuilder().applySettings(properties)
.build();
}
public static Properties getProperties() throws IOException {
Properties properties = new Properties();
URL propertiesURL = Thread.currentThread()
.getContextClassLoader()
.getResource(StringUtils.defaultString(PROPERTY_FILE_NAME, "hibernate.properties"));
try (FileInputStream inputStream = new FileInputStream(propertiesURL.getFile())) {
properties.load(inputStream);
}
return properties;
}
}
|
repos\tutorials-master\persistence-modules\hibernate-queries-2\src\main\java\com\baeldung\hibernate\HibernateUtil.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class SpringFoxConfig {
private ApiInfo apiInfo() {
return new ApiInfo(
"My REST API",
"Some custom description of API.",
"API TOS",
"Terms of service",
new Contact("John Doe", "www.example.com", "myeaddress@company.com"),
"License of API",
"API license URL",
Collections.emptyList());
}
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
/**
* SwaggerUI information
*/
|
@Bean
UiConfiguration uiConfig() {
return UiConfigurationBuilder.builder()
.deepLinking(true)
.displayOperationId(false)
.defaultModelsExpandDepth(1)
.defaultModelExpandDepth(1)
.defaultModelRendering(ModelRendering.EXAMPLE)
.displayRequestDuration(false)
.docExpansion(DocExpansion.NONE)
.filter(false)
.maxDisplayedTags(null)
.operationsSorter(OperationsSorter.ALPHA)
.showExtensions(false)
.tagsSorter(TagsSorter.ALPHA)
.supportedSubmitMethods(UiConfiguration.Constants.DEFAULT_SUBMIT_METHODS)
.validatorUrl(null)
.build();
}
@Bean
public EmailAnnotationPlugin emailPlugin() {
return new EmailAnnotationPlugin();
}
}
|
repos\tutorials-master\spring-boot-modules\spring-boot-mvc-legacy\src\main\java\com\baeldung\swagger2boot\configuration\SpringFoxConfig.java
| 2
|
请完成以下Java代码
|
static Agent parse(String userAgent) {
Matcher matcher = TOOL_REGEX.matcher(userAgent);
if (matcher.matches()) {
String name = matcher.group(1);
for (AgentId id : AgentId.values()) {
if (name.equals(id.name)) {
String version = matcher.group(2);
return new Agent(id, version);
}
}
}
matcher = STS_REGEX.matcher(userAgent);
if (matcher.matches()) {
return new Agent(AgentId.STS, matcher.group(1));
}
matcher = NETBEANS_REGEX.matcher(userAgent);
if (matcher.matches()) {
|
return new Agent(AgentId.NETBEANS, matcher.group(1));
}
if (userAgent.equals(AgentId.INTELLIJ_IDEA.name)) {
return new Agent(AgentId.INTELLIJ_IDEA, null);
}
if (userAgent.contains("Mozilla/5.0")) { // Super heuristics
return new Agent(AgentId.BROWSER, null);
}
return null;
}
}
}
|
repos\initializr-main\initializr-web\src\main\java\io\spring\initializr\web\support\Agent.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public DirectExchange materialEventsExchange()
{
return new DirectExchange(EXCHANGE_NAME_PREFIX);
}
@Bean
public Binding materialEventsBinding()
{
return BindingBuilder.bind(materialEventsQueue())
.to(materialEventsExchange()).with(EXCHANGE_NAME_PREFIX);
}
@Override
public String getQueueName()
{
|
return materialEventsQueue().getName();
}
@Override
public Optional<String> getTopicName()
{
return Optional.of(EVENTBUS_TOPIC.getName());
}
@Override
public String getExchangeName()
{
return materialEventsExchange().getName();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\event\remote\rabbitmq\queues\material_dispo\MaterialEventsQueueConfiguration.java
| 2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.