instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请完成以下Java代码
|
public class User {
private final Logger logger = LoggerFactory.getLogger(User.class);
private long id;
private String name;
private String email;
public User(long id, String name, String email) {
this.id = id;
this.name = name;
this.email = email;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null)
return false;
if (this.getClass() != o.getClass())
|
return false;
User user = (User) o;
return id == user.id && (name.equals(user.name) && email.equals(user.email));
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37).
append(id).
append(name).
append(email).
toHashCode();
}
// getters and setters here
}
|
repos\tutorials-master\core-java-modules\core-java-lang-oop-methods\src\main\java\com\baeldung\hashcode\apachecommons\User.java
| 1
|
请完成以下Java代码
|
public void setIsDisplayed (boolean IsDisplayed)
{
set_Value (COLUMNNAME_IsDisplayed, Boolean.valueOf(IsDisplayed));
}
/** Get Displayed.
@return Determines, if this field is displayed
*/
@Override
public boolean isDisplayed ()
{
Object oo = get_Value(COLUMNNAME_IsDisplayed);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set ModelPackage.
@param ModelPackage
Java Package of the model classes
*/
@Override
public void setModelPackage (java.lang.String ModelPackage)
{
set_Value (COLUMNNAME_ModelPackage, ModelPackage);
}
/** Get ModelPackage.
@return Java Package of the model classes
*/
@Override
public java.lang.String getModelPackage ()
{
return (java.lang.String)get_Value(COLUMNNAME_ModelPackage);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
@Override
public void setName (java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
@Override
public java.lang.String getName ()
{
return (java.lang.String)get_Value(COLUMNNAME_Name);
}
/** Set Verarbeiten.
@param Processing Verarbeiten */
@Override
public void setProcessing (boolean Processing)
{
set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
}
|
/** Get Verarbeiten.
@return Verarbeiten */
@Override
public boolean isProcessing ()
{
Object oo = get_Value(COLUMNNAME_Processing);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Version.
@param Version
Version of the table definition
*/
@Override
public void setVersion (java.lang.String Version)
{
set_Value (COLUMNNAME_Version, Version);
}
/** Get Version.
@return Version of the table definition
*/
@Override
public java.lang.String getVersion ()
{
return (java.lang.String)get_Value(COLUMNNAME_Version);
}
/** Set WebUIServletListener Class.
@param WebUIServletListenerClass
Optional class to execute custom code on WebUI startup; A declared class needs to implement IWebUIServletListener
*/
@Override
public void setWebUIServletListenerClass (java.lang.String WebUIServletListenerClass)
{
set_Value (COLUMNNAME_WebUIServletListenerClass, WebUIServletListenerClass);
}
/** Get WebUIServletListener Class.
@return Optional class to execute custom code on WebUI startup; A declared class needs to implement IWebUIServletListener
*/
@Override
public java.lang.String getWebUIServletListenerClass ()
{
return (java.lang.String)get_Value(COLUMNNAME_WebUIServletListenerClass);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_EntityType.java
| 1
|
请完成以下Java代码
|
public class AuthorityRequirementImpl extends DmnModelElementInstanceImpl implements AuthorityRequirement {
protected static ElementReference<Decision, RequiredDecisionReference> requiredDecisionRef;
protected static ElementReference<InputData, RequiredInputReference> requiredInputRef;
protected static ElementReference<KnowledgeSource, RequiredAuthorityReference> requiredAuthorityRef;
public AuthorityRequirementImpl(ModelTypeInstanceContext instanceContext) {
super(instanceContext);
}
public Decision getRequiredDecision() {
return requiredDecisionRef.getReferenceTargetElement(this);
}
public void setRequiredDecision(Decision requiredDecision) {
requiredDecisionRef.setReferenceTargetElement(this, requiredDecision);
}
public InputData getRequiredInput() {
return requiredInputRef.getReferenceTargetElement(this);
}
public void setRequiredInput(InputData requiredInput) {
requiredInputRef.setReferenceTargetElement(this, requiredInput);
}
public KnowledgeSource getRequiredAuthority() {
return requiredAuthorityRef.getReferenceTargetElement(this);
}
public void setRequiredAuthority(KnowledgeSource requiredAuthority) {
requiredAuthorityRef.setReferenceTargetElement(this, requiredAuthority);
}
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(AuthorityRequirement.class, DMN_ELEMENT_AUTHORITY_REQUIREMENT)
.namespaceUri(LATEST_DMN_NS)
.instanceProvider(new ModelTypeInstanceProvider<AuthorityRequirement>() {
public AuthorityRequirement newInstance(ModelTypeInstanceContext instanceContext) {
|
return new AuthorityRequirementImpl(instanceContext);
}
});
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
requiredDecisionRef = sequenceBuilder.element(RequiredDecisionReference.class)
.uriElementReference(Decision.class)
.build();
requiredInputRef = sequenceBuilder.element(RequiredInputReference.class)
.uriElementReference(InputData.class)
.build();
requiredAuthorityRef = sequenceBuilder.element(RequiredAuthorityReference.class)
.uriElementReference(KnowledgeSource.class)
.build();
typeBuilder.build();
}
}
|
repos\camunda-bpm-platform-master\model-api\dmn-model\src\main\java\org\camunda\bpm\model\dmn\impl\instance\AuthorityRequirementImpl.java
| 1
|
请完成以下Java代码
|
public class C_BPartner
{
public static final transient C_BPartner instance = new C_BPartner();
private C_BPartner()
{
}
/**
* Make sure an partner with currently running contracts always has <code>IsVendor='Y'</code>.
*
* @param bpartner
*/
@ModelChange(timings = ModelValidator.TYPE_BEFORE_CHANGE, ifColumnsChanged = I_C_BPartner.COLUMNNAME_IsVendor)
public void preventDisablingVendorFlag(final I_C_BPartner bpartner)
{
// Do nothing if vendor flag is set
if (bpartner.isVendor())
{
return;
|
}
if (Services.get(IPMMContractsDAO.class).hasRunningContract(bpartner))
{
throw new AdempiereException("@C_BPartner_ID@ @IsVendor@=@N@: " + bpartner.getValue() + "_" + bpartner.getName());
}
}
@ModelChange(timings = ModelValidator.TYPE_AFTER_CHANGE //
, ifColumnsChanged = {
I_C_BPartner.COLUMNNAME_Name,
I_C_BPartner.COLUMNNAME_AD_Language,
I_C_BPartner.COLUMNNAME_IsVendor } //
, afterCommit = true)
public void pushToWebUI(@NonNull final I_C_BPartner bpartner)
{
Services.get(IWebuiPush.class).pushBPartnerAndUsers(bpartner);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.procurement.base\src\main\java\de\metas\procurement\base\model\interceptor\C_BPartner.java
| 1
|
请完成以下Java代码
|
public void setValue(Object value, ValueFields valueFields) {
byte[] bytes = serialize(value, valueFields);
valueFields.setCachedValue(value);
super.setValue(bytes, valueFields);
if (trackDeserializedObjects && valueFields instanceof VariableInstanceEntity) {
Context.getCommandContext().addCloseListener(
new VerifyDeserializedObjectCommandContextCloseListener(
new DeserializedObject(
this,
valueFields.getCachedValue(),
bytes,
(VariableInstanceEntity) valueFields
)
)
);
}
}
public byte[] serialize(Object value, ValueFields valueFields) {
if (value == null) {
return null;
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = null;
try {
oos = createObjectOutputStream(baos);
oos.writeObject(value);
} catch (Exception e) {
throw new ActivitiException(
"Couldn't serialize value '" + value + "' in variable '" + valueFields.getName() + "'",
e
);
} finally {
IoUtil.closeSilently(oos);
}
return baos.toByteArray();
}
public Object deserialize(byte[] bytes, ValueFields valueFields) {
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
try {
ObjectInputStream ois = createObjectInputStream(bais);
Object deserializedObject = ois.readObject();
return deserializedObject;
} catch (Exception e) {
throw new ActivitiException("Couldn't deserialize object in variable '" + valueFields.getName() + "'", e);
|
} finally {
IoUtil.closeSilently(bais);
}
}
public boolean isAbleToStore(Object value) {
// TODO don't we need null support here?
return value instanceof Serializable;
}
protected ObjectInputStream createObjectInputStream(InputStream is) throws IOException {
return new ObjectInputStream(is) {
protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
return ReflectUtil.loadClass(desc.getName());
}
};
}
protected ObjectOutputStream createObjectOutputStream(OutputStream os) throws IOException {
return new ObjectOutputStream(os);
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\variable\SerializableType.java
| 1
|
请完成以下Java代码
|
public int vote(Authentication authentication, FilterInvocation filterInvocation,
Collection<ConfigAttribute> attributes) {
Assert.notNull(authentication, "authentication must not be null");
Assert.notNull(filterInvocation, "filterInvocation must not be null");
Assert.notNull(attributes, "attributes must not be null");
WebExpressionConfigAttribute webExpressionConfigAttribute = findConfigAttribute(attributes);
if (webExpressionConfigAttribute == null) {
this.logger
.trace("Abstained since did not find a config attribute of instance WebExpressionConfigAttribute");
return ACCESS_ABSTAIN;
}
EvaluationContext ctx = webExpressionConfigAttribute.postProcess(
this.expressionHandler.createEvaluationContext(authentication, filterInvocation), filterInvocation);
boolean granted = ExpressionUtils.evaluateAsBoolean(webExpressionConfigAttribute.getAuthorizeExpression(), ctx);
if (granted) {
return ACCESS_GRANTED;
}
this.logger.trace("Voted to deny authorization");
return ACCESS_DENIED;
}
private @Nullable WebExpressionConfigAttribute findConfigAttribute(Collection<ConfigAttribute> attributes) {
for (ConfigAttribute attribute : attributes) {
if (attribute instanceof WebExpressionConfigAttribute) {
return (WebExpressionConfigAttribute) attribute;
}
}
|
return null;
}
@Override
public boolean supports(ConfigAttribute attribute) {
return attribute instanceof WebExpressionConfigAttribute;
}
@Override
public boolean supports(Class<?> clazz) {
return FilterInvocation.class.isAssignableFrom(clazz);
}
public void setExpressionHandler(SecurityExpressionHandler<FilterInvocation> expressionHandler) {
this.expressionHandler = expressionHandler;
}
}
|
repos\spring-security-main\access\src\main\java\org\springframework\security\web\access\expression\WebExpressionVoter.java
| 1
|
请完成以下Java代码
|
public void updateDraftReceiptCandidate(@NonNull UpdateDraftReceiptCandidateRequest request)
{
final PPOrderId pickingOrderId = request.getPickingOrderId();
final HuId huId = request.getHuID();
final Quantity qtyToUpdate = request.getQtyReceived();
huPPOrderQtyDAO.retrieveOrderQtyForHu(pickingOrderId, huId)
.filter(candidate -> !candidate.isProcessed() && isReceipt(candidate))
.ifPresent(candidate -> {
I_M_HU hu = candidate.getM_HU();
candidate.setQty(qtyToUpdate.toBigDecimal());
huPPOrderQtyDAO.save(candidate);
});
}
@Override
public Set<HuId> getFinishedGoodsReceivedHUIds(@NonNull final PPOrderId ppOrderId)
|
{
final HashSet<HuId> receivedHUIds = new HashSet<>();
huPPOrderQtyDAO.retrieveOrderQtyForFinishedGoodsReceive(ppOrderId)
.stream()
.filter(I_PP_Order_Qty::isProcessed)
.forEach(processedCandidate -> {
final HuId huId = HuId.ofRepoId(processedCandidate.getM_HU_ID());
receivedHUIds.add(huId);
final I_M_HU parentHU = handlingUnitsBL.getTopLevelParent(huId);
receivedHUIds.add(HuId.ofRepoId(parentHU.getM_HU_ID()));
});
return receivedHUIds;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\pporder\api\impl\HUPPOrderQtyBL.java
| 1
|
请完成以下Java代码
|
public WorkpackageCleanupStaleEntries setStaleDateFrom(final Date staleDateFrom)
{
this._staleDateFrom = staleDateFrom;
return this;
}
private Date getStaleDateFrom()
{
if (_staleDateFrom != null)
{
return _staleDateFrom;
}
//
// Get default stale date
final int staleDays = sysConfigBL.getIntValue(SYSCONFIG_StaleDays, DEFAULT_StaleDays);
if (staleDays <= 0)
{
throw new AdempiereException("Invalid stale days sysconfig value: " + SYSCONFIG_StaleDays);
}
final Date staleDateFromDefault = TimeUtil.addDays(now, -staleDays);
return staleDateFromDefault;
}
public WorkpackageCleanupStaleEntries setStaleErrorMsg(final String staleErrorMsg)
{
this._staleErrorMsg = staleErrorMsg;
return this;
}
private String buildFullStaleErrorMsg()
{
final StringBuilder errorMsg = new StringBuilder();
final String baseErrorMsg = getStaleErrorMsg();
errorMsg.append(baseErrorMsg);
final PInstanceId adPInstanceId = getPinstanceId();
if (adPInstanceId != null)
{
errorMsg.append("; Updated by AD_PInstance_ID=").append(adPInstanceId.getRepoId());
}
return errorMsg.toString();
}
private String getStaleErrorMsg()
{
if (!Check.isEmpty(_staleErrorMsg, true))
{
return _staleErrorMsg;
}
|
// Get the default
return sysConfigBL.getValue(SYSCONFIG_StaleErrorMsg, DEFAULT_StaleErrorMsg);
}
/**
* Sets AD_PInstance_ID to be used and tag all those workpackages which were deactivated.
*
* This is optional.
*
* @param adPInstanceId
*/
public WorkpackageCleanupStaleEntries setAD_PInstance_ID(final PInstanceId adPInstanceId)
{
this._adPInstanceId = adPInstanceId;
return this;
}
private PInstanceId getPinstanceId()
{
return _adPInstanceId;
}
public WorkpackageCleanupStaleEntries setLogger(final ILoggable logger)
{
Check.assumeNotNull(logger, "logger not null");
this.logger = logger;
return this;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.async\src\main\java\de\metas\async\api\impl\WorkpackageCleanupStaleEntries.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public JobStoreType getJobStoreType() {
return this.jobStoreType;
}
public void setJobStoreType(JobStoreType jobStoreType) {
this.jobStoreType = jobStoreType;
}
public @Nullable String getSchedulerName() {
return this.schedulerName;
}
public void setSchedulerName(@Nullable String schedulerName) {
this.schedulerName = schedulerName;
}
public boolean isAutoStartup() {
return this.autoStartup;
}
public void setAutoStartup(boolean autoStartup) {
this.autoStartup = autoStartup;
}
public Duration getStartupDelay() {
return this.startupDelay;
}
public void setStartupDelay(Duration startupDelay) {
this.startupDelay = startupDelay;
}
public boolean isWaitForJobsToCompleteOnShutdown() {
|
return this.waitForJobsToCompleteOnShutdown;
}
public void setWaitForJobsToCompleteOnShutdown(boolean waitForJobsToCompleteOnShutdown) {
this.waitForJobsToCompleteOnShutdown = waitForJobsToCompleteOnShutdown;
}
public boolean isOverwriteExistingJobs() {
return this.overwriteExistingJobs;
}
public void setOverwriteExistingJobs(boolean overwriteExistingJobs) {
this.overwriteExistingJobs = overwriteExistingJobs;
}
public Map<String, String> getProperties() {
return this.properties;
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-quartz\src\main\java\org\springframework\boot\quartz\autoconfigure\QuartzProperties.java
| 2
|
请完成以下Java代码
|
private List<Node> getAllNodesInTraversePath(String pattern, Node startNode, boolean isAllowPartialMatch) {
List<Node> nodes = new ArrayList<>();
for (int i = 0; i < startNode.getChildren()
.size(); i++) {
Node currentNode = startNode.getChildren()
.get(i);
String nodeText = currentNode.getText();
if (pattern.charAt(0) == nodeText.charAt(0)) {
if (isAllowPartialMatch && pattern.length() <= nodeText.length()) {
nodes.add(currentNode);
return nodes;
}
int compareLength = Math.min(nodeText.length(), pattern.length());
for (int j = 1; j < compareLength; j++) {
if (pattern.charAt(j) != nodeText.charAt(j)) {
if (isAllowPartialMatch) {
nodes.add(currentNode);
}
return nodes;
}
}
nodes.add(currentNode);
if (pattern.length() > compareLength) {
List<Node> nodes2 = getAllNodesInTraversePath(pattern.substring(compareLength), currentNode, isAllowPartialMatch);
if (nodes2.size() > 0) {
|
nodes.addAll(nodes2);
} else if (!isAllowPartialMatch) {
nodes.add(null);
}
}
return nodes;
}
}
return nodes;
}
public String printTree() {
return root.printTree("");
}
}
|
repos\tutorials-master\algorithms-modules\algorithms-searching\src\main\java\com\baeldung\algorithms\suffixtree\SuffixTree.java
| 1
|
请完成以下Java代码
|
private Boolean checkRoute(String routeId) {
Boolean hasRoute = false;
try {
//修复使用带命名空间启动网关swagger看不到接口文档的问题
Properties properties=new Properties();
properties.setProperty("serverAddr",serverAddr);
if(namespace!=null && !"".equals(namespace)){
log.info("nacos.discovery.namespace = {}", namespace);
properties.setProperty("namespace",namespace);
}
if(username!=null && !"".equals(username)){
properties.setProperty("username",username);
}
if(password!=null && !"".equals(password)){
properties.setProperty("password",password);
}
|
//【issues/5115】因swagger文档导致gateway内存溢出
if (this.naming == null) {
this.naming = NamingFactory.createNamingService(properties);
}
log.info(" config.group : {}", group);
List<Instance> list = this.naming.selectInstances(routeId, group , true);
if (ObjectUtil.isNotEmpty(list)) {
hasRoute = true;
}
} catch (Exception e) {
e.printStackTrace();
}
return hasRoute;
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-server-cloud\jeecg-cloud-gateway\src\main\java\org\jeecg\handler\swagger\MySwaggerResourceProvider.java
| 1
|
请完成以下Java代码
|
public static void main(String[] args) {
System.setProperty(AbstractEnvironment.ACTIVE_PROFILES_PROPERTY_NAME, "jdbcintro");
SpringApplication.run(Application.class, args);
}
@Override
public void run(String... arg0) throws Exception {
LOGGER.info("@@ Inserting Data....");
dbSeeder.insertData();
LOGGER.info("@@ findAll() call...");
repository.findAll()
.forEach(person -> LOGGER.info(person.toString()));
LOGGER.info("@@ findById() call...");
Optional<Person> optionalPerson = repository.findById(1L);
optionalPerson.ifPresent(person -> LOGGER.info(person.toString()));
LOGGER.info("@@ save() call...");
|
Person newPerson = new Person("Franz", "Kafka");
Person result = repository.save(newPerson);
LOGGER.info(result.toString());
LOGGER.info("@@ delete");
optionalPerson.ifPresent(person -> repository.delete(person));
LOGGER.info("@@ findAll() call...");
repository.findAll()
.forEach(person -> LOGGER.info(person.toString()));
LOGGER.info("@@ findByFirstName() call...");
repository.findByFirstName("Franz")
.forEach(person -> LOGGER.info(person.toString()));
LOGGER.info("@@ updateByFirstName() call...");
repository.updateByFirstName(2L, "Date Inferno");
repository.findAll()
.forEach(person -> LOGGER.info(person.toString()));
}
}
|
repos\tutorials-master\persistence-modules\spring-data-jdbc\src\main\java\com\baeldung\springdatajdbcintro\Application.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getReceiptId() {
return receiptId;
}
public void setReceiptId(String receiptId) {
this.receiptId = receiptId;
}
public String getLocationId() {
return locationId;
}
public void setLocationId(String locationId) {
this.locationId = locationId;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Map<ProductEntity, Integer> getProdEntityCountMap() {
return prodEntityCountMap;
}
public void setProdEntityCountMap(Map<ProductEntity, Integer> prodEntityCountMap) {
this.prodEntityCountMap = prodEntityCountMap;
}
public String getProdIdCountJson() {
return prodIdCountJson;
}
public void setProdIdCountJson(String prodIdCountJson) {
|
this.prodIdCountJson = prodIdCountJson;
}
@Override
public String toString() {
return "OrderInsertReq{" +
"userId='" + userId + '\'' +
", prodIdCountJson='" + prodIdCountJson + '\'' +
", prodIdCountMap=" + prodIdCountMap +
", prodEntityCountMap=" + prodEntityCountMap +
", payModeCode=" + payModeCode +
", receiptId='" + receiptId + '\'' +
", locationId='" + locationId + '\'' +
", remark='" + remark + '\'' +
'}';
}
}
|
repos\SpringBoot-Dubbo-Docker-Jenkins-master\Gaoxi-Common-Service-Facade\src\main\java\com\gaoxi\req\order\OrderInsertReq.java
| 2
|
请完成以下Java代码
|
public class StringType implements VariableType {
private final int maxLength;
public StringType(int maxLength) {
this.maxLength = maxLength;
}
public String getTypeName() {
return "string";
}
public boolean isCachable() {
return true;
}
public Object getValue(ValueFields valueFields) {
return valueFields.getTextValue();
|
}
public void setValue(Object value, ValueFields valueFields) {
valueFields.setTextValue((String) value);
}
public boolean isAbleToStore(Object value) {
if (value == null) {
return true;
}
if (String.class.isAssignableFrom(value.getClass())) {
String stringValue = (String) value;
return stringValue.length() <= maxLength;
}
return false;
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\variable\StringType.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public BigDecimal getManualPrice()
{
return manualPrice;
}
@Override
public IEditablePricingContext setManualPrice(@Nullable final BigDecimal manualPrice)
{
this.manualPrice = manualPrice;
return this;
}
@Override
public boolean isSkipCheckingPriceListSOTrxFlag()
{
return skipCheckingPriceListSOTrxFlag;
}
/** If set to not-{@code null}, then the {@link de.metas.pricing.rules.Discount} rule with go with this break as opposed to look for the currently matching break. */
@Override
public IEditablePricingContext setForcePricingConditionsBreak(@Nullable final PricingConditionsBreak forcePricingConditionsBreak)
{
this.forcePricingConditionsBreak = forcePricingConditionsBreak;
return this;
}
@Override
public Optional<IAttributeSetInstanceAware> getAttributeSetInstanceAware()
{
final Object referencedObj = getReferencedObject();
if (referencedObj == null)
{
return Optional.empty();
|
}
final IAttributeSetInstanceAwareFactoryService attributeSetInstanceAwareFactoryService = Services.get(IAttributeSetInstanceAwareFactoryService.class);
final IAttributeSetInstanceAware asiAware = attributeSetInstanceAwareFactoryService.createOrNull(referencedObj);
return Optional.ofNullable(asiAware);
}
@Override
public Quantity getQuantity()
{
final BigDecimal ctxQty = getQty();
if (ctxQty == null)
{
return null;
}
final UomId ctxUomId = getUomId();
if (ctxUomId == null)
{
return null;
}
return Quantitys.of(ctxQty, ctxUomId);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\pricing\service\impl\PricingContext.java
| 2
|
请完成以下Java代码
|
public int compareTo(MachineInfo o) {
if (this == o) {
return 0;
}
if (!port.equals(o.getPort())) {
return port.compareTo(o.getPort());
}
if (!StringUtil.equals(app, o.getApp())) {
return app.compareToIgnoreCase(o.getApp());
}
return ip.compareToIgnoreCase(o.getIp());
}
@Override
public String toString() {
return new StringBuilder("MachineInfo {")
.append("app='").append(app).append('\'')
.append(",appType='").append(appType).append('\'')
.append(", hostname='").append(hostname).append('\'')
.append(", ip='").append(ip).append('\'')
.append(", port=").append(port)
.append(", heartbeatVersion=").append(heartbeatVersion)
.append(", lastHeartbeat=").append(lastHeartbeat)
.append(", version='").append(version).append('\'')
.append(", healthy=").append(isHealthy())
.append('}').toString();
}
@Override
|
public boolean equals(Object o) {
if (this == o) { return true; }
if (!(o instanceof MachineInfo)) { return false; }
MachineInfo that = (MachineInfo)o;
return Objects.equals(app, that.app) &&
Objects.equals(ip, that.ip) &&
Objects.equals(port, that.port);
}
@Override
public int hashCode() {
return Objects.hash(app, ip, port);
}
/**
* Information for log
*
* @return
*/
public String toLogString() {
return app + "|" + ip + "|" + port + "|" + version;
}
}
|
repos\spring-boot-student-master\spring-boot-student-sentinel-dashboard\src\main\java\com\alibaba\csp\sentinel\dashboard\discovery\MachineInfo.java
| 1
|
请完成以下Java代码
|
public static String getStringFromReader(Reader reader) throws IOException {
return getStringFromReader(reader, true);
}
/**
* Convert an {@link Reader} to a {@link String}
*
* @param reader the {@link Reader} to convert
* @param trim trigger if whitespaces are trimmed in the output
* @return the resulting {@link String}
* @throws IOException
*/
public static String getStringFromReader(Reader reader, boolean trim) throws IOException {
BufferedReader bufferedReader = null;
StringBuilder stringBuilder = new StringBuilder();
try {
bufferedReader = new BufferedReader(reader);
String line;
while ((line = bufferedReader.readLine()) != null) {
if (trim) {
stringBuilder.append(line.trim());
} else {
stringBuilder.append(line).append("\n");
}
}
|
} finally {
closeSilently(bufferedReader);
}
return stringBuilder.toString();
}
public static Reader classpathResourceAsReader(String fileName) {
try {
File classpathFile = getClasspathFile(fileName);
return new FileReader(classpathFile);
} catch (FileNotFoundException e) {
throw LOG.fileNotFoundException(fileName, e);
}
}
public static Reader stringAsReader(String string) {
return new StringReader(string);
}
}
|
repos\camunda-bpm-platform-master\spin\core\src\main\java\org\camunda\spin\impl\util\SpinIoUtil.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public DefaultServiceInstanceConverter serviceInstanceConverter() {
return new DefaultServiceInstanceConverter();
}
@Configuration(proxyBeanMethods = false)
@ConditionalOnMissingBean({ ServiceInstanceConverter.class })
@ConditionalOnBean(EurekaClient.class)
public static class EurekaConverterConfiguration {
@Bean
@ConfigurationProperties(prefix = "spring.boot.admin.discovery.converter")
public EurekaServiceInstanceConverter serviceInstanceConverter() {
return new EurekaServiceInstanceConverter();
}
}
@Configuration(proxyBeanMethods = false)
@ConditionalOnMissingBean({ ServiceInstanceConverter.class })
@Conditional(KubernetesDiscoveryClientCondition.class)
public static class KubernetesConverterConfiguration {
@Bean
@ConfigurationProperties(prefix = "spring.boot.admin.discovery.converter")
public KubernetesServiceInstanceConverter serviceInstanceConverter(
KubernetesDiscoveryProperties discoveryProperties) {
return new KubernetesServiceInstanceConverter(discoveryProperties);
}
}
|
private static class KubernetesDiscoveryClientCondition extends AnyNestedCondition {
KubernetesDiscoveryClientCondition() {
super(ConfigurationPhase.REGISTER_BEAN);
}
@ConditionalOnBean(KubernetesInformerDiscoveryClient.class)
static class OfficialKubernetesCondition {
}
@ConditionalOnBean(KubernetesDiscoveryClient.class)
static class Fabric8KubernetesCondition {
}
}
}
|
repos\spring-boot-admin-master\spring-boot-admin-server-cloud\src\main\java\de\codecentric\boot\admin\server\cloud\config\AdminServerDiscoveryAutoConfiguration.java
| 2
|
请完成以下Java代码
|
public String getISIN() {
return isin;
}
/**
* Sets the value of the isin property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setISIN(String value) {
this.isin = value;
}
/**
* Gets the value of the othrId 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 othrId property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getOthrId().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link OtherIdentification1 }
*
*
*/
|
public List<OtherIdentification1> getOthrId() {
if (othrId == null) {
othrId = new ArrayList<OtherIdentification1>();
}
return this.othrId;
}
/**
* Gets the value of the desc property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDesc() {
return desc;
}
/**
* Sets the value of the desc property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDesc(String value) {
this.desc = 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_04\SecurityIdentification14.java
| 1
|
请完成以下Java代码
|
public void setAD_Table_AttachmentListener_ID (int AD_Table_AttachmentListener_ID)
{
if (AD_Table_AttachmentListener_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_Table_AttachmentListener_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_Table_AttachmentListener_ID, Integer.valueOf(AD_Table_AttachmentListener_ID));
}
/** Get AD_Table_AttachmentListener.
@return AD_Table_AttachmentListener */
@Override
public int getAD_Table_AttachmentListener_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Table_AttachmentListener_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set DB-Tabelle.
@param AD_Table_ID
Database Table information
*/
@Override
public void setAD_Table_ID (int AD_Table_ID)
{
if (AD_Table_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_Table_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_Table_ID, Integer.valueOf(AD_Table_ID));
}
/** Get DB-Tabelle.
@return Database Table information
*/
@Override
public int getAD_Table_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Table_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Send Notification.
@param IsSendNotification Send Notification */
@Override
public void setIsSendNotification (boolean IsSendNotification)
{
set_Value (COLUMNNAME_IsSendNotification, Boolean.valueOf(IsSendNotification));
}
/** Get Send Notification.
@return Send Notification */
@Override
|
public boolean isSendNotification ()
{
Object oo = get_Value(COLUMNNAME_IsSendNotification);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Reihenfolge.
@param SeqNo
Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst
*/
@Override
public void setSeqNo (int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo));
}
/** Get Reihenfolge.
@return Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst
*/
@Override
public int getSeqNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Table_AttachmentListener.java
| 1
|
请完成以下Java代码
|
public void setMandateDate (final java.sql.Timestamp MandateDate)
{
set_Value (COLUMNNAME_MandateDate, MandateDate);
}
@Override
public java.sql.Timestamp getMandateDate()
{
return get_ValueAsTimestamp(COLUMNNAME_MandateDate);
}
@Override
public void setMandateReference (final java.lang.String MandateReference)
{
set_Value (COLUMNNAME_MandateReference, MandateReference);
}
@Override
public java.lang.String getMandateReference()
{
return get_ValueAsString(COLUMNNAME_MandateReference);
}
/**
* MandateStatus AD_Reference_ID=541976
* Reference name: Mandat Status
*/
|
public static final int MANDATESTATUS_AD_Reference_ID=541976;
/** FirstTime = F */
public static final String MANDATESTATUS_FirstTime = "F";
/** Recurring = R */
public static final String MANDATESTATUS_Recurring = "R";
/** LastTime = L */
public static final String MANDATESTATUS_LastTime = "L";
@Override
public void setMandateStatus (final java.lang.String MandateStatus)
{
set_Value (COLUMNNAME_MandateStatus, MandateStatus);
}
@Override
public java.lang.String getMandateStatus()
{
return get_ValueAsString(COLUMNNAME_MandateStatus);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_BP_BankAccount_DirectDebitMandate.java
| 1
|
请完成以下Java代码
|
public static void setOverallNumberOfInvoicings(final int overallNumberOfInvoicings)
{
HardCodedQualityBasedConfig.overallNumberOfInvoicings = overallNumberOfInvoicings;
}
@Override
public int getOverallNumberOfInvoicings()
{
return overallNumberOfInvoicings;
}
public static void setQualityAdjustmentActive(final boolean qualityAdjustmentOn)
{
HardCodedQualityBasedConfig.qualityAdjustmentsActive = qualityAdjustmentOn;
}
@Override
public I_M_Product getRegularPPOrderProduct()
{
final IContextAware ctxAware = getContext();
|
return productPA.retrieveProduct(ctxAware.getCtx(),
M_PRODUCT_REGULAR_PP_ORDER_VALUE,
true, // throwExIfProductNotFound
ctxAware.getTrxName());
}
/**
* @return the date that was set with {@link #setValidToDate(Timestamp)}, or falls back to "now plus 2 months". Never returns <code>null</code>.
*/
@Override
public Timestamp getValidToDate()
{
if (validToDate == null)
{
return TimeUtil.addMonths(SystemTime.asDate(), 2);
}
return validToDate;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java\de\metas\materialtracking\ch\lagerkonf\impl\HardCodedQualityBasedConfig.java
| 1
|
请完成以下Spring Boot application配置
|
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=Europe/Zagreb
spring.h2.console.path=/h2
spring.h2.console.enabled=true
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driver-class-name=org.h2.Driver
spri
|
ng.datasource.username=sa
spring.datasource.password=
spring.main.allow-bean-definition-overriding=true
|
repos\tutorials-master\spring-boot-modules\spring-boot-data\src\main\resources\application.properties
| 2
|
请完成以下Java代码
|
default LookupValuesList retrieveLookupValueByIdsInOrder(@NonNull final LookupDataSourceContext evalCtx)
{
return evalCtx.streamSingleIdContexts()
.map(this::retrieveLookupValueById)
.filter(Objects::nonNull)
.collect(LookupValuesList.collect());
}
LookupDataSourceContext.Builder newContextForFetchingList();
LookupValuesPage retrieveEntities(LookupDataSourceContext evalCtx);
//
// Caching
//@formatter:off
/** @return true if this fetcher already has caching embedded so on upper levels, caching is not needed */
boolean isCached();
/** @return cache prefix; relevant only if {@link #isCached()} returns <code>false</code> */
@Nullable String getCachePrefix();
|
default List<CCacheStats> getCacheStats() { return ImmutableList.of(); }
//@formatter:on
/**
* @return tableName if available
*/
Optional<String> getLookupTableName();
/**
* @return optional WindowId to be used when zooming into
*/
Optional<WindowId> getZoomIntoWindowId();
void cacheInvalidate();
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\model\lookup\LookupDataSourceFetcher.java
| 1
|
请完成以下Java代码
|
protected void startCaseInstance(CmmnEngine cmmnEngine, EmailService emailService) {
String customerId = "2";
String email = "email@email.com";
CmmnRuntimeService cmmnRuntimeService = cmmnEngine.getCmmnRuntimeService();
CmmnTaskService cmmnTaskService = cmmnEngine.getCmmnTaskService();
String caseInstanceId = cmmnRuntimeService.createCaseInstanceBuilder()
.caseDefinitionKey("signupCase")
.variable("customerId", customerId)
.variable("email", email)
.start()
.getId();
System.out.println("case instance ID: " + caseInstanceId);
Assert.notNull(caseInstanceId, "the case instance ID should not be null");
List<Task> tasks = cmmnTaskService
.createTaskQuery()
.taskName("Confirm email task")
.includeProcessVariables()
.caseVariableValueEquals("customerId", customerId)
.list();
Assert.state(!tasks.isEmpty(), "there should be one outstanding task");
tasks.forEach(task -> {
cmmnTaskService.claim(task.getId(), "jbarrez");
cmmnTaskService.complete(task.getId());
});
Assert.isTrue(emailService.getSendCount(email).get() == 2, "there should be 2 emails sent");
|
}
protected void executeRule(DmnEngine dmnEngine) {
Map<String, Object> result = dmnEngine.getDmnDecisionService().createExecuteDecisionBuilder()
.decisionKey("myDecisionTable")
.variable("customerTotalOrderPrice", 99999)
.executeWithSingleResult();
Assert.isTrue(result.size() == 1, "Expected one result");
Object tier = result.get("tier");
Assert.isTrue(tier.equals("SILVER"), "Expected SILVER as output, but was " + tier);
System.out.println("Executed DMN rule correctly");
}
}
|
repos\flowable-engine-main\modules\flowable-spring-boot\flowable-spring-boot-samples\flowable-spring-boot-sample-native\src\main\java\com\example\flowable\FlowableApplication.java
| 1
|
请完成以下Java代码
|
public class ArchiveSetDataResponse
{
private int adArchiveId;
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + adArchiveId;
return result;
}
@Override
public boolean equals(final Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
|
}
final ArchiveSetDataResponse other = (ArchiveSetDataResponse)obj;
if (adArchiveId != other.adArchiveId)
{
return false;
}
return true;
}
public int getAdArchiveId()
{
return adArchiveId;
}
public void setAdArchiveId(final int adArchiveId)
{
this.adArchiveId = adArchiveId;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.document.archive.api\src\main\java\de\metas\document\archive\esb\api\ArchiveSetDataResponse.java
| 1
|
请完成以下Java代码
|
public void onSuccess(@Nullable String result) {
log.info(result);
ctx.tellSuccess(msg);
}
@Override
public void onFailure(@NonNull Throwable t) {
ctx.tellFailure(msg, t);
}
}, MoreExecutors.directExecutor()); //usually js responses runs on js callback executor
}
boolean isStandard(TbLogNodeConfiguration conf) {
Objects.requireNonNull(conf, "node config is null");
final TbLogNodeConfiguration defaultConfig = new TbLogNodeConfiguration().defaultConfiguration();
if (conf.getScriptLang() == null || conf.getScriptLang().equals(ScriptLanguage.JS)) {
return defaultConfig.getJsScript().equals(conf.getJsScript());
} else if (conf.getScriptLang().equals(ScriptLanguage.TBEL)) {
return defaultConfig.getTbelScript().equals(conf.getTbelScript());
} else {
log.warn("No rule to define isStandard script for script language [{}], assuming that is non-standard", conf.getScriptLang());
|
return false;
}
}
void logStandard(TbContext ctx, TbMsg msg) {
log.info(toLogMessage(msg));
ctx.tellSuccess(msg);
}
String toLogMessage(TbMsg msg) {
return "\n" +
"Incoming message:\n" + msg.getData() + "\n" +
"Incoming metadata:\n" + JacksonUtil.toString(msg.getMetaData().getData());
}
@Override
public void destroy() {
if (scriptEngine != null) {
scriptEngine.destroy();
}
}
}
|
repos\thingsboard-master\rule-engine\rule-engine-components\src\main\java\org\thingsboard\rule\engine\action\TbLogNode.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class OrderServiceImpl implements OrderService {
private HashMap<String, Customer> customerMap;
private HashMap<String, Order> customerOneOrderMap;
private HashMap<String, Order> customerTwoOrderMap;
private HashMap<String, Order> customerThreeOrderMap;
public OrderServiceImpl() {
customerMap = new HashMap<>();
customerOneOrderMap = new HashMap<>();
customerTwoOrderMap = new HashMap<>();
customerThreeOrderMap = new HashMap<>();
customerOneOrderMap.put("001A", new Order("001A", 150.00, 25));
customerOneOrderMap.put("002A", new Order("002A", 250.00, 15));
customerTwoOrderMap.put("002B", new Order("002B", 550.00, 325));
customerTwoOrderMap.put("002B", new Order("002B", 450.00, 525));
final Customer customerOne = new Customer("10A", "Jane", "ABC Company");
final Customer customerTwo = new Customer("20B", "Bob", "XYZ Company");
final Customer customerThree = new Customer("30C", "Tim", "CKV Company");
customerOne.setOrders(customerOneOrderMap);
customerTwo.setOrders(customerTwoOrderMap);
customerThree.setOrders(customerThreeOrderMap);
customerMap.put("10A", customerOne);
customerMap.put("20B", customerTwo);
customerMap.put("30C", customerThree);
|
}
@Override
public List<Order> getAllOrdersForCustomer(final String customerId) {
return new ArrayList<>(customerMap.get(customerId).getOrders().values());
}
@Override
public Order getOrderByIdForCustomer(final String customerId, final String orderId) {
final Map<String, Order> orders = customerMap.get(customerId).getOrders();
Order selectedOrder = orders.get(orderId);
return selectedOrder;
}
}
|
repos\tutorials-master\spring-web-modules\spring-boot-rest\src\main\java\com\baeldung\services\OrderServiceImpl.java
| 2
|
请完成以下Java代码
|
private String toSqlWhereClause0(@Nullable final String importTableAlias, final boolean prefixWithAND)
{
final String importTableAliasWithDot = StringUtils.trimBlankToOptional(importTableAlias).map(alias -> alias + ".").orElse("");
final StringBuilder whereClause = new StringBuilder();
if (prefixWithAND)
{
whereClause.append(" AND ");
}
whereClause.append("(");
if (empty)
{
return "1=2";
}
else
{
// AD_Client
whereClause.append(importTableAliasWithDot).append(ImportTableDescriptor.COLUMNNAME_AD_Client_ID).append("=").append(clientId.getRepoId());
// Selection_ID
|
if (selectionId != null)
{
final String importKeyColumnNameFQ = importTableAliasWithDot + importKeyColumnName;
whereClause.append(" AND ").append(DB.createT_Selection_SqlWhereClause(selectionId, importKeyColumnNameFQ));
}
}
whereClause.append(")");
return whereClause.toString();
}
public IQueryFilter<Object> toQueryFilter(@Nullable final String importTableAlias)
{
return empty
? ConstantQueryFilter.of(false)
: TypedSqlQueryFilter.of(toSqlWhereClause0(importTableAlias, false));
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\impexp\processing\ImportRecordsSelection.java
| 1
|
请完成以下Java代码
|
public <S> void createGauge(String type, String name, S stateObject, ToDoubleFunction<S> numberProvider, String... tags) {
meterRegistry.gauge(type, Tags.of(getTags(name, tags)), stateObject, numberProvider);
}
@Override
public MessagesStats createMessagesStats(String key) {
StatsCounter totalCounter = createStatsCounter(key, TOTAL_MSGS);
StatsCounter successfulCounter = createStatsCounter(key, SUCCESSFUL_MSGS);
StatsCounter failedCounter = createStatsCounter(key, FAILED_MSGS);
return new DefaultMessagesStats(totalCounter, successfulCounter, failedCounter);
}
@Override
public Timer createTimer(String key, String... tags) {
Timer.Builder timerBuilder = Timer.builder(key)
.tags(tags)
.publishPercentiles();
if (timerPercentiles != null && timerPercentiles.length > 0) {
timerBuilder.publishPercentiles(timerPercentiles);
}
return timerBuilder.register(meterRegistry);
}
@Override
public StatsTimer createStatsTimer(String type, String name, String... tags) {
return new StatsTimer(name, Timer.builder(type)
.tags(getTags(name, tags))
.register(meterRegistry));
}
private static String[] getTags(String statsName, String[] otherTags) {
String[] tags = new String[]{STATS_NAME_TAG, statsName};
if (otherTags.length > 0) {
if (otherTags.length % 2 != 0) {
throw new IllegalArgumentException("Invalid tags array size");
}
tags = ArrayUtils.addAll(tags, otherTags);
}
return tags;
|
}
private static class StubCounter implements Counter {
@Override
public void increment(double amount) {
}
@Override
public double count() {
return 0;
}
@Override
public Id getId() {
return null;
}
}
}
|
repos\thingsboard-master\common\stats\src\main\java\org\thingsboard\server\common\stats\DefaultStatsFactory.java
| 1
|
请完成以下Java代码
|
public String getF_TOLLSORT() {
return F_TOLLSORT;
}
public void setF_TOLLSORT(String f_TOLLSORT) {
F_TOLLSORT = f_TOLLSORT;
}
public String getF_STARTDATE() {
return F_STARTDATE;
}
public void setF_STARTDATE(String f_STARTDATE) {
F_STARTDATE = f_STARTDATE;
}
public String getF_ENDDATE() {
return F_ENDDATE;
}
public void setF_ENDDATE(String f_ENDDATE) {
F_ENDDATE = f_ENDDATE;
}
public String getF_TAX() {
return F_TAX;
}
public void setF_TAX(String f_TAX) {
F_TAX = f_TAX;
}
public String getF_ISPUB() {
return F_ISPUB;
}
public void setF_ISPUB(String f_ISPUB) {
F_ISPUB = f_ISPUB;
}
public String getF_ALLOWADD() {
return F_ALLOWADD;
}
public void setF_ALLOWADD(String f_ALLOWADD) {
F_ALLOWADD = f_ALLOWADD;
}
public String getF_MEMO() {
return F_MEMO;
}
public void setF_MEMO(String f_MEMO) {
F_MEMO = f_MEMO;
}
public String getF_LEVEL() {
return F_LEVEL;
}
public void setF_LEVEL(String f_LEVEL) {
F_LEVEL = f_LEVEL;
}
public String getF_END() {
return F_END;
}
public void setF_END(String f_END) {
F_END = f_END;
}
public String getF_SHAREDIREC() {
return F_SHAREDIREC;
}
public void setF_SHAREDIREC(String f_SHAREDIREC) {
F_SHAREDIREC = f_SHAREDIREC;
}
public String getF_HISTORYID() {
return F_HISTORYID;
|
}
public void setF_HISTORYID(String f_HISTORYID) {
F_HISTORYID = f_HISTORYID;
}
public String getF_STATUS() {
return F_STATUS;
}
public void setF_STATUS(String f_STATUS) {
F_STATUS = f_STATUS;
}
public String getF_VERSION() {
return F_VERSION;
}
public void setF_VERSION(String f_VERSION) {
F_VERSION = f_VERSION;
}
public String getF_ISSTD() {
return F_ISSTD;
}
public void setF_ISSTD(String f_ISSTD) {
F_ISSTD = f_ISSTD;
}
public Timestamp getF_EDITTIME() {
return F_EDITTIME;
}
public void setF_EDITTIME(Timestamp f_EDITTIME) {
F_EDITTIME = f_EDITTIME;
}
public String getF_PLATFORM_ID() {
return F_PLATFORM_ID;
}
public void setF_PLATFORM_ID(String f_PLATFORM_ID) {
F_PLATFORM_ID = f_PLATFORM_ID;
}
public String getF_ISENTERPRISES() {
return F_ISENTERPRISES;
}
public void setF_ISENTERPRISES(String f_ISENTERPRISES) {
F_ISENTERPRISES = f_ISENTERPRISES;
}
public String getF_ISCLEAR() {
return F_ISCLEAR;
}
public void setF_ISCLEAR(String f_ISCLEAR) {
F_ISCLEAR = f_ISCLEAR;
}
public String getF_PARENTID() {
return F_PARENTID;
}
public void setF_PARENTID(String f_PARENTID) {
F_PARENTID = f_PARENTID;
}
}
|
repos\SpringBootBucket-master\springboot-batch\src\main\java\com\xncoding\trans\modules\common\vo\BscTollItem.java
| 1
|
请完成以下Java代码
|
public Set<String> supportedFileAttributeViews() {
assertNotClosed();
return SUPPORTED_FILE_ATTRIBUTE_VIEWS;
}
@Override
public Path getPath(String first, String... more) {
assertNotClosed();
if (more.length != 0) {
throw new IllegalArgumentException("Nested paths must contain a single element");
}
return new NestedPath(this, first);
}
@Override
public PathMatcher getPathMatcher(String syntaxAndPattern) {
throw new UnsupportedOperationException("Nested paths do not support path matchers");
}
@Override
public UserPrincipalLookupService getUserPrincipalLookupService() {
throw new UnsupportedOperationException("Nested paths do not have a user principal lookup service");
}
@Override
public WatchService newWatchService() throws IOException {
throw new UnsupportedOperationException("Nested paths do not support the WatchService");
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
|
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
NestedFileSystem other = (NestedFileSystem) obj;
return this.jarPath.equals(other.jarPath);
}
@Override
public int hashCode() {
return this.jarPath.hashCode();
}
@Override
public String toString() {
return this.jarPath.toAbsolutePath().toString();
}
private void assertNotClosed() {
if (this.closed) {
throw new ClosedFileSystemException();
}
}
}
|
repos\spring-boot-4.0.1\loader\spring-boot-loader\src\main\java\org\springframework\boot\loader\nio\file\NestedFileSystem.java
| 1
|
请完成以下Java代码
|
public WorkflowLaunchersList provideLaunchers(final WorkflowLaunchersQuery query)
{
query.assertNoFilterByDocumentNo();
query.assertNoFilterByQRCode();
query.assertNoFacetIds();
final UserId userId = query.getUserId();
final Workplace workplace = workplaceService.getWorkplaceByUserId(userId).orElse(null);
final WarehouseId warehouseId = workplace != null ? workplace.getWarehouseId() : null;
final QueryLimit limit = query.getLimit().orElseGet(this::getLaunchersLimit);
//
// Already started jobs
final ArrayList<InventoryJobReference> jobReferences = new ArrayList<>();
streamReferences(InventoryQuery.builder()
.limit(limit)
.onlyDraftOrInProgress()
//.onlyWarehouseIdOrAny(warehouseId)
.onlyResponsibleId(userId)
.build())
.forEach(jobReferences::add);
//
// New jobs
if (limit.isBelowLimit(jobReferences))
{
streamReferences(InventoryQuery.builder()
.limit(limit.minusSizeOf(jobReferences))
.onlyDraftOrInProgress()
.onlyWarehouseIdOrAny(warehouseId)
.noResponsibleId()
.excludeInventoryIdsOf(jobReferences, InventoryJobReference::getInventoryId)
.build())
.forEach(jobReferences::add);
}
//
return WorkflowLaunchersList.builder()
.launchers(jobReferences.stream()
.map(InventoryWorkflowLaunchersProvider::toWorkflowLauncher)
.collect(ImmutableList.toImmutableList()))
.build();
}
|
public Stream<InventoryJobReference> streamReferences(@NonNull final InventoryQuery query)
{
return mapperService.toInventoryJobReferencesStream(inventoryService.streamReferences(query));
}
private static WorkflowLauncher toWorkflowLauncher(final InventoryJobReference jobRef)
{
final WorkflowLauncherBuilder builder = WorkflowLauncher.builder()
.applicationId(APPLICATION_ID)
.caption(computeCaption(jobRef));
if (jobRef.isJobStarted())
{
final WFProcessId wfProcessId = toWFProcessId(jobRef.getInventoryId());
return builder.startedWFProcessId(wfProcessId).build();
}
else
{
return builder.wfParameters(InventoryWFProcessStartParams.of(jobRef).toParams()).build();
}
}
private static @NonNull WorkflowLauncherCaption computeCaption(final InventoryJobReference jobRef)
{
return WorkflowLauncherCaption.of(
TranslatableStrings.builder()
.append(jobRef.getWarehouseName())
.append(" | ")
.appendDate(jobRef.getMovementDate())
.append(" | ")
.append(jobRef.getDocumentNo())
.build()
);
}
public QueryLimit getLaunchersLimit()
{
final int limitInt = sysConfigBL.getIntValue(Constants.SYSCONFIG_LaunchersLimit, -100);
return limitInt == -100
? Constants.DEFAULT_LaunchersLimit
: QueryLimit.ofInt(limitInt);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.inventory.mobileui\src\main\java\de\metas\inventory\mobileui\launchers\InventoryWorkflowLaunchersProvider.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class ServerHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(ServerHandler.class);
public Mono<ServerResponse> useHandler(final ServerRequest request) {
// there are chances that something goes wrong here...
return ServerResponse.ok()
.contentType(MediaType.TEXT_EVENT_STREAM)
.body(getFlux(), Foo.class);
}
public Mono<ServerResponse> useHandlerFinite(final ServerRequest request) {
return ServerResponse.ok()
.contentType(MediaType.TEXT_EVENT_STREAM)
.body(Flux.range(0, 50)
|
.map(sequence -> new Foo(new Long(sequence), "theFooNameNumber" + sequence)
), Foo.class);
}
private static Flux<Foo> getFlux() {
return Flux.interval(Duration.ofSeconds(1))
.map(sequence -> {
LOGGER.info("retrieving Foo. Sequence: {}", sequence);
if (ThreadLocalRandom.current().nextInt(0, 50) == 1) {
throw new RuntimeException("There was an error retrieving the Foo!");
}
return new Foo(sequence, "name" + sequence);
});
}
}
|
repos\tutorials-master\spring-reactive-modules\spring-reactive\src\main\java\com\baeldung\reactive\debugging\server\handlers\ServerHandler.java
| 2
|
请完成以下Java代码
|
public void setLogoutHandlers(List<LogoutHandler> handlers) {
this.handlers = new CompositeLogoutHandler(handlers);
}
/**
* Sets the {@link RedirectStrategy} used with
* {@link #ConcurrentSessionFilter(SessionRegistry, String)}
* @param redirectStrategy the {@link RedirectStrategy} to use
* @deprecated use
* {@link #ConcurrentSessionFilter(SessionRegistry, SessionInformationExpiredStrategy)}
* instead.
*/
@Deprecated
public void setRedirectStrategy(RedirectStrategy redirectStrategy) {
Assert.notNull(redirectStrategy, "redirectStrategy cannot be null");
this.redirectStrategy = redirectStrategy;
}
/**
* A {@link SessionInformationExpiredStrategy} that writes an error message to the
* response body.
*
* @author Rob Winch
* @since 4.2
|
*/
private static final class ResponseBodySessionInformationExpiredStrategy
implements SessionInformationExpiredStrategy {
@Override
public void onExpiredSessionDetected(SessionInformationExpiredEvent event) throws IOException {
HttpServletResponse response = event.getResponse();
response.getWriter()
.print("This session has been expired (possibly due to multiple concurrent "
+ "logins being attempted as the same user).");
response.flushBuffer();
}
}
}
|
repos\spring-security-main\web\src\main\java\org\springframework\security\web\session\ConcurrentSessionFilter.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class Vet extends Person {
@ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name = "vet_specialties", joinColumns = @JoinColumn(name = "vet_id"),
inverseJoinColumns = @JoinColumn(name = "specialty_id"))
private Set<Specialty> specialties;
protected Set<Specialty> getSpecialtiesInternal() {
if (this.specialties == null) {
this.specialties = new HashSet<>();
}
return this.specialties;
}
@XmlElement
|
public List<Specialty> getSpecialties() {
return getSpecialtiesInternal().stream()
.sorted(Comparator.comparing(NamedEntity::getName))
.collect(Collectors.toList());
}
public int getNrOfSpecialties() {
return getSpecialtiesInternal().size();
}
public void addSpecialty(Specialty specialty) {
getSpecialtiesInternal().add(specialty);
}
}
|
repos\spring-petclinic-main\src\main\java\org\springframework\samples\petclinic\vet\Vet.java
| 2
|
请完成以下Java代码
|
public void setPMM_PurchaseCandidate_OrderLine_ID (int PMM_PurchaseCandidate_OrderLine_ID)
{
if (PMM_PurchaseCandidate_OrderLine_ID < 1)
set_ValueNoCheck (COLUMNNAME_PMM_PurchaseCandidate_OrderLine_ID, null);
else
set_ValueNoCheck (COLUMNNAME_PMM_PurchaseCandidate_OrderLine_ID, Integer.valueOf(PMM_PurchaseCandidate_OrderLine_ID));
}
/** Get Purchase order candidate - order line.
@return Purchase order candidate - order line */
@Override
public int getPMM_PurchaseCandidate_OrderLine_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_PMM_PurchaseCandidate_OrderLine_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Bestellte Menge.
@param QtyOrdered
Bestellte Menge
*/
@Override
public void setQtyOrdered (java.math.BigDecimal QtyOrdered)
{
set_Value (COLUMNNAME_QtyOrdered, QtyOrdered);
}
/** Get Bestellte Menge.
@return Bestellte Menge
|
*/
@Override
public java.math.BigDecimal getQtyOrdered ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyOrdered);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Bestellte Menge (TU).
@param QtyOrdered_TU
Bestellte Menge (TU)
*/
@Override
public void setQtyOrdered_TU (java.math.BigDecimal QtyOrdered_TU)
{
set_Value (COLUMNNAME_QtyOrdered_TU, QtyOrdered_TU);
}
/** Get Bestellte Menge (TU).
@return Bestellte Menge (TU)
*/
@Override
public java.math.BigDecimal getQtyOrdered_TU ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyOrdered_TU);
if (bd == null)
return Env.ZERO;
return bd;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.procurement.base\src\main\java-gen\de\metas\procurement\base\model\X_PMM_PurchaseCandidate_OrderLine.java
| 1
|
请完成以下Java代码
|
private static class ApplicationContextResourceLoader extends DefaultResourceLoader {
private final Supplier<Collection<ProtocolResolver>> protocolResolvers;
ApplicationContextResourceLoader(Supplier<Collection<ProtocolResolver>> protocolResolvers) {
super(null);
this.protocolResolvers = protocolResolvers;
}
@Override
public Collection<ProtocolResolver> getProtocolResolvers() {
return this.protocolResolvers.get();
}
}
/**
* {@link ResourceLoader} that optionally supports {@link ServletContextResource
* ServletContextResources}.
*/
private static class WebApplicationContextResourceLoader extends ApplicationContextResourceLoader {
|
private final WebApplicationContext applicationContext;
WebApplicationContextResourceLoader(Supplier<Collection<ProtocolResolver>> protocolResolvers,
WebApplicationContext applicationContext) {
super(protocolResolvers);
this.applicationContext = applicationContext;
}
@Override
protected Resource getResourceByPath(String path) {
if (this.applicationContext.getServletContext() != null) {
return new ServletContextResource(this.applicationContext.getServletContext(), path);
}
return super.getResourceByPath(path);
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-devtools\src\main\java\org\springframework\boot\devtools\restart\ClassLoaderFilesResourcePatternResolver.java
| 1
|
请完成以下Java代码
|
public static String colorRevert(String base, String src) throws IOException {
int color, r, g, b, pixel;
// 读原始文件
BufferedImage srcImage = ImageIO.read(new File(base + src));
// 修改后的文件
BufferedImage destImage = new BufferedImage(srcImage.getWidth(), srcImage.getHeight(), srcImage.getType());
for (int i=0; i<srcImage.getWidth(); i++) {
for (int j=0; j<srcImage.getHeight(); j++) {
color = srcImage.getRGB(i, j);
r = (color >> 16) & 0xff;
g = (color >> 8) & 0xff;
b = color & 0xff;
pixel = colorToRGB(255, 0xff - r, 0xff - g, 0xff - b);
destImage.setRGB(i, j, pixel);
}
}
// 反射文件的名字
String revertFileName = src.substring(0, src.lastIndexOf(".")) + "-revert.png";
// 转换后的图片写文件
ImageIO.write(destImage, "png", new File(base + revertFileName));
return revertFileName;
}
/**
* 取黑白图片的特征
* @param base
* @param fileName
* @return
* @throws Exception
*/
public static INDArray getGrayImageFeatures(String base, String fileName) throws Exception {
log.info("start getImageFeatures [{}]", base + fileName);
// 和训练模型时一样的设置
ImageRecordReader imageRecordReader = new ImageRecordReader(RESIZE_HEIGHT, RESIZE_WIDTH, 1);
FileSplit fileSplit = new FileSplit(new File(base + fileName),
NativeImageLoader.ALLOWED_FORMATS);
imageRecordReader.initialize(fileSplit);
DataSetIterator dataSetIterator = new RecordReaderDataSetIterator(imageRecordReader, 1);
|
dataSetIterator.setPreProcessor(new ImagePreProcessingScaler(0, 1));
// 取特征
return dataSetIterator.next().getFeatures();
}
/**
* 批量清理文件
* @param base 处理文件的目录
* @param fileNames 待清理文件集合
*/
public static void clear(String base, String...fileNames) {
for (String fileName : fileNames) {
if (null==fileName) {
continue;
}
File file = new File(base + fileName);
if (file.exists()) {
file.delete();
}
}
}
}
|
repos\springboot-demo-master\Deeplearning4j\src\main\java\com\et\dl4j\util\ImageFileUtil.java
| 1
|
请完成以下Java代码
|
public static EventDescriptor ofClientAndOrg(@NonNull final ClientAndOrgId clientAndOrgId)
{
return ofClientOrgAndTraceId(clientAndOrgId, null);
}
public static EventDescriptor ofClientOrgAndUserId(@NonNull final ClientAndOrgId clientAndOrgId,
@NonNull final UserId userId)
{
return ofClientOrgUserIdAndTraceId(clientAndOrgId, userId, null);
}
public static EventDescriptor ofClientOrgAndTraceId(@NonNull final ClientAndOrgId clientAndOrgId,
@Nullable final String traceId)
{
return ofClientOrgUserIdAndTraceId(
clientAndOrgId,
Env.getLoggedUserIdIfExists().orElse(UserId.SYSTEM),
traceId);
}
public static EventDescriptor ofClientOrgUserIdAndTraceId(
@NonNull final ClientAndOrgId clientAndOrgId,
@NonNull final UserId userId,
@Nullable final String traceId)
{
return builder()
.eventId(newEventId())
.clientAndOrgId(clientAndOrgId)
.userId(userId)
.traceId(traceId)
.build();
}
|
private static String newEventId()
{
return UUID.randomUUID().toString();
}
public ClientId getClientId()
{
return getClientAndOrgId().getClientId();
}
public OrgId getOrgId()
{
return getClientAndOrgId().getOrgId();
}
@NonNull
public EventDescriptor withNewEventId()
{
return toBuilder()
.eventId(newEventId())
.build();
}
@NonNull
public EventDescriptor withClientAndOrg(@NonNull final ClientAndOrgId clientAndOrgId)
{
return toBuilder()
.clientAndOrgId(clientAndOrgId)
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.material\event\src\main\java\de\metas\material\event\commons\EventDescriptor.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class UserService {
private final UserRepository userRepository;
private final PasswordEncoder passwordEncoder;
public UserService(UserRepository userRepository, PasswordEncoder passwordEncoder) {
this.userRepository = userRepository;
this.passwordEncoder = passwordEncoder;
}
public String register(RegisterRequestDto request) {
if (userRepository.findByUsername(request.getUsername()).isPresent()) {
return "Username already exists";
}
User user = new User();
user.setUsername(request.getUsername());
user.setEmail(request.getEmail());
user.setPassword(passwordEncoder.encode(request.getPassword()));
|
user.setRole(request.getRole());
userRepository.save(user);
return "User registered successfully";
}
public UserProfileDto profile(String username) {
Optional<User> user = userRepository.findByUsername(username);
return user.map(value -> new UserProfileDto(value.getUsername(), value.getEmail(), value.getRole())).orElseThrow();
}
public User getUser(String username) {
Optional<User> user = userRepository.findByUsername(username);
return user.orElse(null);
}
}
|
repos\tutorials-master\spring-security-modules\spring-security-authorization\spring-security-url-http-method-auth\src\main\java\com\baeldung\springsecurity\service\UserService.java
| 2
|
请完成以下Java代码
|
public URI expand(Map<String, String> parameters) {
AtomicReference<String> result = new AtomicReference<>(this.href);
this.templateVariables.forEach((var) -> {
Object value = parameters.get(var);
if (value == null) {
throw new IllegalArgumentException(
"Could not expand " + this.href + ", missing value for '" + var + "'");
}
result.set(result.get().replace("{" + var + "}", value.toString()));
});
try {
return new URI(result.get());
}
catch (URISyntaxException ex) {
throw new IllegalStateException("Invalid URL", ex);
}
|
}
public static Link create(String rel, String href) {
return new Link(rel, href);
}
public static Link create(String rel, String href, String description) {
return new Link(rel, href, description);
}
public static Link create(String rel, String href, boolean templated) {
return new Link(rel, href, templated);
}
}
|
repos\initializr-main\initializr-metadata\src\main\java\io\spring\initializr\metadata\Link.java
| 1
|
请完成以下Java代码
|
protected double[] evaluate(String developFile, String modelFile) throws IOException
{
return evaluate(developFile, new LinearModel(modelFile));
}
protected double[] evaluate(String developFile, final LinearModel model) throws IOException
{
final int[] stat = new int[2];
IOUtility.loadInstance(developFile, new InstanceHandler()
{
@Override
public boolean process(Sentence sentence)
{
Utility.normalize(sentence);
Instance instance = createInstance(sentence, model.featureMap);
IOUtility.evaluate(instance, model, stat);
|
return false;
}
});
return new double[]{stat[1] / (double) stat[0] * 100};
}
protected String normalize(String text)
{
char[] result = new char[text.length()];
for (int i = 0; i < result.length; i++)
{
result[i] = tableChar[text.charAt(i)];
}
return new String(result);
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\model\perceptron\InstanceConsumer.java
| 1
|
请完成以下Java代码
|
public String getRewardMode ()
{
return (String)get_Value(COLUMNNAME_RewardMode);
}
/** RewardType AD_Reference_ID=53298 */
public static final int REWARDTYPE_AD_Reference_ID=53298;
/** Percentage = P */
public static final String REWARDTYPE_Percentage = "P";
/** Flat Discount = F */
public static final String REWARDTYPE_FlatDiscount = "F";
/** Absolute Amount = A */
public static final String REWARDTYPE_AbsoluteAmount = "A";
/** Set Reward Type.
@param RewardType
Type of reward which consists of percentage discount, flat discount or absolute amount
*/
public void setRewardType (String RewardType)
{
set_Value (COLUMNNAME_RewardType, RewardType);
}
/** Get Reward Type.
@return Type of reward which consists of percentage discount, flat discount or absolute amount
*/
public String getRewardType ()
{
return (String)get_Value(COLUMNNAME_RewardType);
}
/** Set Reihenfolge.
|
@param SeqNo
Method of ordering records; lowest number comes first
*/
public void setSeqNo (int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo));
}
/** Get Reihenfolge.
@return Method of ordering records; lowest number comes first
*/
public int getSeqNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_PromotionReward.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public void setResource(String resource) {
this.resource = resource;
}
@ApiModelProperty(example = "http://localhost:8182/cmmn-repository/deployments/2/resources/testCase.cmmn", value = "Contains the actual deployed CMMN 1.1 xml.")
public String getResource() {
return resource;
}
@ApiModelProperty(example = "This is a case for testing purposes")
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public void setDiagramResource(String diagramResource) {
this.diagramResource = diagramResource;
|
}
@ApiModelProperty(example = "http://localhost:8182/cmmn-repository/deployments/2/resources/testProcess.png", value = "Contains a graphical representation of the case, null when no diagram is available.")
public String getDiagramResource() {
return diagramResource;
}
public void setGraphicalNotationDefined(boolean graphicalNotationDefined) {
this.graphicalNotationDefined = graphicalNotationDefined;
}
@ApiModelProperty(value = "Indicates the case definition contains graphical information (CMMN DI).")
public boolean isGraphicalNotationDefined() {
return graphicalNotationDefined;
}
public void setStartFormDefined(boolean startFormDefined) {
this.startFormDefined = startFormDefined;
}
public boolean isStartFormDefined() {
return startFormDefined;
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\repository\CaseDefinitionResponse.java
| 2
|
请完成以下Java代码
|
public class ReadWriteThread {
public static void readFile(String filePath) {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try (BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath))) {
String line;
while ((line = bufferedReader.readLine()) != null) {
System.out.println(line);
}
} catch (IOException e) {
e.printStackTrace();
}
}
});
thread.start();
}
public static void writeFile(String filePath, String content) {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try (FileWriter fileWriter = new FileWriter(filePath)) {
fileWriter.write("Hello, world!");
} catch (IOException e) {
|
e.printStackTrace();
}
}
});
thread.start();
}
public static void main(String[] args) {
String file = "src/main/resources/text.txt";
writeFile(file, "Hello, world!");
readFile(file);
// Sleep for a while to allow the threads to complete
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
|
repos\tutorials-master\core-java-modules\core-java-io-5\src\main\java\com\baeldung\readwritethread\ReadWriteThread.java
| 1
|
请完成以下Java代码
|
private static DDOrderMoveScheduleCreateRequest toScheduleToMoveRequest(
@NonNull final DDOrderMovePlanStep planStep,
@NonNull final DDOrderId ddOrderId,
@NonNull final DDOrderLineId ddOrderLineId)
{
return DDOrderMoveScheduleCreateRequest.builder()
.ddOrderId(ddOrderId)
.ddOrderLineId(ddOrderLineId)
.productId(planStep.getProductId())
//
// Pick From
.pickFromLocatorId(planStep.getPickFromLocatorId())
.pickFromHUId(planStep.getPickFromHUId())
.qtyToPick(planStep.getQtyToPick())
.isPickWholeHU(planStep.isPickWholeHU())
//
// Drop To
.dropToLocatorId(planStep.getDropToLocatorId())
//
.build();
}
public DDOrderMoveSchedule pickFromHU(@NonNull final DDOrderPickFromRequest request)
{
return DDOrderPickFromCommand.builder()
.ddOrderLowLevelDAO(ddOrderLowLevelDAO)
.ddOrderMoveScheduleRepository(ddOrderMoveScheduleRepository)
.handlingUnitsBL(handlingUnitsBL)
.request(request)
.build()
.execute();
}
public ImmutableList<DDOrderMoveSchedule> dropTo(@NonNull final DDOrderDropToRequest request)
{
return DDOrderDropToCommand.builder()
.ppOrderSourceHUService(ppOrderSourceHUService)
.ddOrderLowLevelDAO(ddOrderLowLevelDAO)
.ddOrderMoveScheduleRepository(ddOrderMoveScheduleRepository)
.request(request)
|
.build()
.execute();
}
public void unpick(@NonNull final DDOrderMoveScheduleId scheduleId, @Nullable final HUQRCode unpickToTargetQRCode)
{
DDOrderUnpickCommand.builder()
.ddOrderMoveScheduleRepository(ddOrderMoveScheduleRepository)
.huqrCodesService(huqrCodesService)
.scheduleId(scheduleId)
.unpickToTargetQRCode(unpickToTargetQRCode)
.build()
.execute();
}
public Set<DDOrderId> retrieveDDOrderIdsInTransit(@NonNull final LocatorId inTransitLocatorId)
{
return ddOrderMoveScheduleRepository.retrieveDDOrderIdsInTransit(inTransitLocatorId);
}
public boolean hasInTransitSchedules(@NonNull final LocatorId inTransitLocatorId)
{
return ddOrderMoveScheduleRepository.queryInTransitSchedules(inTransitLocatorId).anyMatch();
}
public void printMaterialInTransitReport(
@NonNull final LocatorId inTransitLocatorId,
@NonNull String adLanguage)
{
MaterialInTransitReportCommand.builder()
.adLanguage(adLanguage)
.inTransitLocatorId(inTransitLocatorId)
.build()
.execute();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\distribution\ddorder\movement\schedule\DDOrderMoveScheduleService.java
| 1
|
请完成以下Java代码
|
public class Customer implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String name;
private String image;
private String email;
private int total_order;
private int total_order_amount;
// Order
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "customer")
@JsonIgnore
private List<OrderInfo> orderInfos;
// Card (Bank)
|
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "customer")
@JsonIgnore
private List<BankInfo> bankInfos;
// Address
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "customer")
@JsonIgnore
private List<AddressInfo> adresses;
// Contact
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "contactInfo_id", referencedColumnName = "id")
private ContactInfo contactInfo;
// searching engine
}
|
repos\SpringBoot-Projects-FullStack-master\Part-9.SpringBoot-React-Projects\Project-5.Spring-ReactJS-Ecommerce-Shopping\fullstack\backend\model\src\main\java\com\urunov\entity\customer\Customer.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public EndpointDetector endpointDetector(InstanceRepository instanceRepository,
InstanceWebClient.Builder instanceWebClientBuilder) {
InstanceWebClient instanceWebClient = instanceWebClientBuilder.build();
ChainingStrategy strategy = new ChainingStrategy(
new QueryIndexEndpointStrategy(instanceWebClient, new ApiMediaTypeHandler()),
new ProbeEndpointsStrategy(instanceWebClient, this.adminServerProperties.getProbedEndpoints()));
return new EndpointDetector(instanceRepository, strategy);
}
@Bean(initMethod = "start", destroyMethod = "stop")
@ConditionalOnMissingBean
public EndpointDetectionTrigger endpointDetectionTrigger(EndpointDetector endpointDetector,
Publisher<InstanceEvent> events) {
return new EndpointDetectionTrigger(endpointDetector, events);
}
@Bean
@ConditionalOnMissingBean
public InfoUpdater infoUpdater(InstanceRepository instanceRepository,
InstanceWebClient.Builder instanceWebClientBuilder) {
return new InfoUpdater(instanceRepository, instanceWebClientBuilder.build(), new ApiMediaTypeHandler());
}
@Bean(initMethod = "start", destroyMethod = "stop")
@ConditionalOnMissingBean
public InfoUpdateTrigger infoUpdateTrigger(InfoUpdater infoUpdater, Publisher<InstanceEvent> events) {
return new InfoUpdateTrigger(infoUpdater, events, this.adminServerProperties.getMonitor().getInfoInterval(),
this.adminServerProperties.getMonitor().getInfoLifetime(),
this.adminServerProperties.getMonitor().getInfoMaxBackoff());
|
}
@Bean
@ConditionalOnMissingBean(InstanceEventStore.class)
public InMemoryEventStore eventStore() {
return new InMemoryEventStore();
}
@Bean(initMethod = "start", destroyMethod = "stop")
@ConditionalOnMissingBean(InstanceRepository.class)
public SnapshottingInstanceRepository instanceRepository(InstanceEventStore eventStore) {
return new SnapshottingInstanceRepository(eventStore);
}
}
|
repos\spring-boot-admin-master\spring-boot-admin-server\src\main\java\de\codecentric\boot\admin\server\config\AdminServerAutoConfiguration.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
private Mono<UserData> createEmployee(@RequestBody CreateUserData createUserData) {
return userService.create(createUserData);
}
@GetMapping("/{id}")
private Mono<UserData> getEmployeeById(@PathVariable String id) {
return userService.getEmployee(id);
}
@GetMapping
private Flux<UserData> getAllEmployees() {
return userService.getAll();
}
@PutMapping()
private Mono<UserData> updateEmployee(@RequestBody UserData employee) {
return userService.update(employee);
}
@DeleteMapping("/{id}")
|
private Mono<UserData> deleteEmployee(@PathVariable String id) {
return userService.delete(id);
}
@PutMapping("/create/{n}")
private void createUsersBulk(@PathVariable Integer n) {
userService.createUsersBulk(n);
}
@GetMapping(value = "/stream", produces = MediaType.APPLICATION_STREAM_JSON_VALUE)
private Flux<UserData> streamAllEmployees() {
return Flux.from(userService.getAllStream());
}
}
|
repos\spring-examples-java-17\spring-webflux\src\main\java\itx\examples\webflux\controller\UserController.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public static ImmutableList<IPackingItem> createPackingItems(final Set<ShipmentScheduleId> shipmentScheduleIds)
{
if (shipmentScheduleIds.isEmpty())
{
return ImmutableList.of();
}
final IShipmentSchedulePA shipmentSchedulesRepo = Services.get(IShipmentSchedulePA.class);
final IShipmentScheduleBL shipmentScheduleBL = Services.get(IShipmentScheduleBL.class);
final Map<ShipmentScheduleId, I_M_ShipmentSchedule> shipmentSchedules = shipmentSchedulesRepo.getByIdsOutOfTrx(shipmentScheduleIds, I_M_ShipmentSchedule.class);
final Map<PackingItemGroupingKey, IPackingItem> packingItems = new LinkedHashMap<>();
for (final I_M_ShipmentSchedule sched : shipmentSchedules.values())
{
final Quantity qtyToDeliverTarget = shipmentScheduleBL.getQtyToDeliver(sched);
if (qtyToDeliverTarget.signum() <= 0)
{
continue;
}
// task 08153: these code-lines are obsolete now, because the sched's qtyToDeliver(_Override) has the qtyPicked already factored in
// final BigDecimal qtyPicked = shipmentScheduleAllocBL.getQtyPicked(sched);
// final BigDecimal qtyToDeliver = qtyToDeliverTarget.subtract(qtyPicked == null ? BigDecimal.ZERO : qtyPicked);
final PackingItemPart part = newPackingItemPart(sched)
.qty(qtyToDeliverTarget)
.build();
final IPackingItem newItem = newPackingItem(part);
final IPackingItem existingItem = packingItems.get(newItem.getGroupingKey());
if (existingItem != null)
{
existingItem.addParts(newItem);
}
else
{
packingItems.put(newItem.getGroupingKey(), newItem);
}
}
|
return ImmutableList.copyOf(packingItems.values());
}
public static PackingItemPartBuilder newPackingItemPart(final de.metas.inoutcandidate.model.I_M_ShipmentSchedule sched)
{
final IShipmentScheduleEffectiveBL shipmentScheduleEffectiveBL = Services.get(IShipmentScheduleEffectiveBL.class);
final IHUShipmentScheduleBL huShipmentScheduleBL = Services.get(IHUShipmentScheduleBL.class);
final ShipmentScheduleId shipmentScheduleId = ShipmentScheduleId.ofRepoId(sched.getM_ShipmentSchedule_ID());
return PackingItemPart.builder()
.id(PackingItemPartId.of(shipmentScheduleId))
.productId(ProductId.ofRepoId(sched.getM_Product_ID()))
.bpartnerId(shipmentScheduleEffectiveBL.getBPartnerId(sched))
.bpartnerLocationId(shipmentScheduleEffectiveBL.getBPartnerLocationId(sched))
.packingMaterialId(huShipmentScheduleBL.getEffectivePackingMaterialId(sched))
.warehouseId(shipmentScheduleEffectiveBL.getWarehouseId(sched))
.deliveryRule(shipmentScheduleEffectiveBL.getDeliveryRule(sched))
.sourceDocumentLineRef(TableRecordReference.of(sched.getAD_Table_ID(), sched.getRecord_ID()));
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\picking\service\PackingItems.java
| 2
|
请完成以下Java代码
|
public void dfs(IWalker walker)
{
checkForConstructedFailureStates();
dfs(rootState, "", walker);
}
private void dfs(State currentState, String path, IWalker walker)
{
walker.meet(path, currentState);
for (Character transition : currentState.getTransitions())
{
State targetState = currentState.nextState(transition);
dfs(targetState, path + transition, walker);
}
}
public static interface IWalker
{
/**
* 遇到了一个节点
* @param path
* @param state
*/
void meet(String path, State state);
}
/**
* 保存匹配结果
*
* @param position 当前位置,也就是匹配到的模式串的结束位置+1
* @param currentState 当前状态
* @param collectedEmits 保存位置
*/
private static void storeEmits(int position, State currentState, List<Emit> collectedEmits)
{
|
Collection<String> emits = currentState.emit();
if (emits != null && !emits.isEmpty())
{
for (String emit : emits)
{
collectedEmits.add(new Emit(position - emit.length() + 1, position, emit));
}
}
}
/**
* 文本是否包含任何模式
*
* @param text 待匹配的文本
* @return 文本包含模式時回傳true
*/
public boolean hasKeyword(String text)
{
checkForConstructedFailureStates();
State currentState = this.rootState;
for (int i = 0; i < text.length(); ++i)
{
State nextState = getState(currentState, text.charAt(i));
if (nextState != null && nextState != currentState && nextState.emit().size() != 0) {
return true;
}
currentState = nextState;
}
return false;
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\algorithm\ahocorasick\trie\Trie.java
| 1
|
请完成以下Java代码
|
public void setM_Product_ID (final int M_Product_ID)
{
if (M_Product_ID < 1)
set_Value (COLUMNNAME_M_Product_ID, null);
else
set_Value (COLUMNNAME_M_Product_ID, M_Product_ID);
}
@Override
public int getM_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_ID);
}
@Override
public void setSeqNo (final int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, SeqNo);
}
@Override
public int getSeqNo()
{
return get_ValueAsInt(COLUMNNAME_SeqNo);
}
/**
* Type AD_Reference_ID=540836
* Reference name: C_CompensationGroup_SchemaLine_Type
*/
|
public static final int TYPE_AD_Reference_ID=540836;
/** Revenue = R */
public static final String TYPE_Revenue = "R";
/** Flatrate = F */
public static final String TYPE_Flatrate = "F";
@Override
public void setType (final @Nullable java.lang.String Type)
{
set_Value (COLUMNNAME_Type, Type);
}
@Override
public java.lang.String getType()
{
return get_ValueAsString(COLUMNNAME_Type);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\de\metas\order\model\X_C_CompensationGroup_SchemaLine.java
| 1
|
请完成以下Java代码
|
public void setC_OLCand_ID (final int C_OLCand_ID)
{
if (C_OLCand_ID < 1)
set_Value (COLUMNNAME_C_OLCand_ID, null);
else
set_Value (COLUMNNAME_C_OLCand_ID, C_OLCand_ID);
}
@Override
public int getC_OLCand_ID()
{
return get_ValueAsInt(COLUMNNAME_C_OLCand_ID);
}
@Override
public void setDurationAmount (final @Nullable BigDecimal DurationAmount)
{
set_Value (COLUMNNAME_DurationAmount, DurationAmount);
}
@Override
public BigDecimal getDurationAmount()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_DurationAmount);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setExternalId (final String ExternalId)
{
set_Value (COLUMNNAME_ExternalId, ExternalId);
}
@Override
public String getExternalId()
{
return get_ValueAsString(COLUMNNAME_ExternalId);
}
@Override
public void setExternallyUpdatedAt (final @Nullable java.sql.Timestamp ExternallyUpdatedAt)
{
set_Value (COLUMNNAME_ExternallyUpdatedAt, ExternallyUpdatedAt);
}
@Override
public java.sql.Timestamp getExternallyUpdatedAt()
{
return get_ValueAsTimestamp(COLUMNNAME_ExternallyUpdatedAt);
}
@Override
public void setIsPrivateSale (final boolean IsPrivateSale)
{
set_Value (COLUMNNAME_IsPrivateSale, IsPrivateSale);
}
@Override
public boolean isPrivateSale()
{
|
return get_ValueAsBoolean(COLUMNNAME_IsPrivateSale);
}
@Override
public void setIsRentalEquipment (final boolean IsRentalEquipment)
{
set_Value (COLUMNNAME_IsRentalEquipment, IsRentalEquipment);
}
@Override
public boolean isRentalEquipment()
{
return get_ValueAsBoolean(COLUMNNAME_IsRentalEquipment);
}
@Override
public void setSalesLineId (final @Nullable String SalesLineId)
{
set_Value (COLUMNNAME_SalesLineId, SalesLineId);
}
@Override
public String getSalesLineId()
{
return get_ValueAsString(COLUMNNAME_SalesLineId);
}
@Override
public void setTimePeriod (final @Nullable BigDecimal TimePeriod)
{
set_Value (COLUMNNAME_TimePeriod, TimePeriod);
}
@Override
public BigDecimal getTimePeriod()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_TimePeriod);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setUnit (final @Nullable String Unit)
{
set_Value (COLUMNNAME_Unit, Unit);
}
@Override
public String getUnit()
{
return get_ValueAsString(COLUMNNAME_Unit);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.healthcare.alberta\src\main\java-gen\de\metas\vertical\healthcare\alberta\model\X_Alberta_OrderedArticleLine.java
| 1
|
请完成以下Java代码
|
public int getSalesRep_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SalesRep_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Start Date.
@param StartDate
First effective day (inclusive)
*/
public void setStartDate (Timestamp StartDate)
{
set_Value (COLUMNNAME_StartDate, StartDate);
}
/** Get Start Date.
@return First effective day (inclusive)
*/
public Timestamp getStartDate ()
{
return (Timestamp)get_Value(COLUMNNAME_StartDate);
}
/** Set Summary.
@param Summary
Textual summary of this request
*/
public void setSummary (String Summary)
{
set_ValueNoCheck (COLUMNNAME_Summary, Summary);
}
/** Get Summary.
@return Textual summary of this request
*/
public String getSummary ()
{
return (String)get_Value(COLUMNNAME_Summary);
}
|
/** TaskStatus AD_Reference_ID=366 */
public static final int TASKSTATUS_AD_Reference_ID=366;
/** 0% Not Started = 0 */
public static final String TASKSTATUS_0NotStarted = "0";
/** 100% Complete = D */
public static final String TASKSTATUS_100Complete = "D";
/** 20% Started = 2 */
public static final String TASKSTATUS_20Started = "2";
/** 80% Nearly Done = 8 */
public static final String TASKSTATUS_80NearlyDone = "8";
/** 40% Busy = 4 */
public static final String TASKSTATUS_40Busy = "4";
/** 60% Good Progress = 6 */
public static final String TASKSTATUS_60GoodProgress = "6";
/** 90% Finishing = 9 */
public static final String TASKSTATUS_90Finishing = "9";
/** 95% Almost Done = A */
public static final String TASKSTATUS_95AlmostDone = "A";
/** 99% Cleaning up = C */
public static final String TASKSTATUS_99CleaningUp = "C";
/** Set Task Status.
@param TaskStatus
Status of the Task
*/
public void setTaskStatus (String TaskStatus)
{
set_Value (COLUMNNAME_TaskStatus, TaskStatus);
}
/** Get Task Status.
@return Status of the Task
*/
public String getTaskStatus ()
{
return (String)get_Value(COLUMNNAME_TaskStatus);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_R_RequestAction.java
| 1
|
请完成以下Java代码
|
private Alarm buildAlarm(TbMsg msg, JsonNode details, TenantId tenantId) {
long ts = msg.getMetaDataTs();
return Alarm.builder()
.tenantId(tenantId)
.originator(msg.getOriginator())
.cleared(false)
.acknowledged(false)
.severity(config.isDynamicSeverity() ? processAlarmSeverity(msg) : notDynamicAlarmSeverity)
.propagate(config.isPropagate())
.propagateToOwner(config.isPropagateToOwner())
.propagateToTenant(config.isPropagateToTenant())
.type(TbNodeUtils.processPattern(config.getAlarmType(), msg))
.propagateRelationTypes(relationTypes)
.startTs(ts)
.endTs(ts)
.details(details)
|
.build();
}
private AlarmSeverity processAlarmSeverity(TbMsg msg) {
AlarmSeverity severity = EnumUtils.getEnum(AlarmSeverity.class, TbNodeUtils.processPattern(config.getSeverity(), msg));
if (severity == null) {
throw new RuntimeException("Used incorrect pattern or Alarm Severity not included in message");
}
return severity;
}
long currentTimeMillis() {
return System.currentTimeMillis();
}
}
|
repos\thingsboard-master\rule-engine\rule-engine-components\src\main\java\org\thingsboard\rule\engine\action\TbCreateAlarmNode.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class QtyCalculationsBOM
{
@NonNull
ImmutableList<QtyCalculationsBOMLine> lines;
// References
@Nullable
PPOrderId orderId;
@Builder
private QtyCalculationsBOM(
@NonNull @Singular final List<QtyCalculationsBOMLine> lines,
//
@Nullable final PPOrderId orderId)
{
this.lines = ImmutableList.copyOf(lines);
this.orderId = orderId;
}
public ProductId getBomProductId()
{
if (lines.isEmpty())
{
throw new AdempiereException("No lines");
}
return lines.get(0).getBomProductId();
}
public I_C_UOM getBomProductUOM()
{
if (lines.isEmpty())
{
throw new AdempiereException("No lines");
}
return lines.get(0).getBomProductUOM();
}
|
public QtyCalculationsBOMLine getLineByOrderBOMLineId(@NonNull final PPOrderBOMLineId orderBOMLineId)
{
return lines.stream()
.filter(line -> PPOrderBOMLineId.equals(line.getOrderBOMLineId(), orderBOMLineId))
.findFirst()
.orElseThrow(() -> new AdempiereException("No BOM line found for " + orderBOMLineId + " in " + this));
}
public Optional<QtyCalculationsBOMLine> getLineByComponentId(@NonNull final ProductId componentId)
{
return lines.stream()
.filter(line -> ProductId.equals(line.getProductId(), componentId))
.findFirst();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\org\eevolution\api\QtyCalculationsBOM.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class Possession {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
private String name;
public Possession() {
super();
}
public Possession(final String name) {
super();
this.name = name;
}
public long getId() {
return id;
}
public void setId(final int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = (prime * result) + (int) (id ^ (id >>> 32));
result = (prime * result) + ((name == null) ? 0 : name.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;
}
final Possession other = (Possession) obj;
if (id != other.id) {
return false;
}
if (name == null) {
if (other.name != null) {
return false;
}
} else if (!name.equals(other.name)) {
return false;
}
return true;
}
@Override
public String toString() {
final StringBuilder builder = new StringBuilder();
builder.append("Possesion [id=").append(id).append(", name=").append(name).append("]");
return builder.toString();
}
}
|
repos\tutorials-master\persistence-modules\spring-data-jpa-enterprise\src\main\java\com\baeldung\boot\domain\Possession.java
| 2
|
请完成以下Java代码
|
protected JpaRepository<TenantProfileEntity, UUID> getRepository() {
return tenantProfileRepository;
}
@Override
public EntityInfo findTenantProfileInfoById(TenantId tenantId, UUID tenantProfileId) {
return tenantProfileRepository.findTenantProfileInfoById(tenantProfileId);
}
@Override
public PageData<TenantProfile> findTenantProfiles(TenantId tenantId, PageLink pageLink) {
return DaoUtil.toPageData(
tenantProfileRepository.findTenantProfiles(
pageLink.getTextSearch(),
DaoUtil.toPageable(pageLink)));
}
@Override
public PageData<EntityInfo> findTenantProfileInfos(TenantId tenantId, PageLink pageLink) {
return DaoUtil.pageToPageData(
tenantProfileRepository.findTenantProfileInfos(
pageLink.getTextSearch(),
DaoUtil.toPageable(pageLink)));
}
@Override
public TenantProfile findDefaultTenantProfile(TenantId tenantId) {
return DaoUtil.getData(tenantProfileRepository.findByDefaultTrue());
}
@Override
public EntityInfo findDefaultTenantProfileInfo(TenantId tenantId) {
|
return tenantProfileRepository.findDefaultTenantProfileInfo();
}
@Override
public List<TenantProfile> findTenantProfilesByIds(TenantId tenantId, UUID[] ids) {
return DaoUtil.convertDataList(tenantProfileRepository.findByIdIn(Arrays.asList(ids)));
}
@Override
public List<TenantProfileFields> findNextBatch(UUID id, int batchSize) {
return tenantProfileRepository.findNextBatch(id, Limit.of(batchSize));
}
@Override
public EntityType getEntityType() {
return EntityType.TENANT_PROFILE;
}
}
|
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\sql\tenant\JpaTenantProfileDao.java
| 1
|
请完成以下Java代码
|
public class SessionStoreDirectory {
private @Nullable File directory;
@Nullable File getDirectory() {
return this.directory;
}
void setDirectory(@Nullable File directory) {
this.directory = directory;
}
public File getValidDirectory(boolean mkdirs) {
File dir = getDirectory();
if (dir == null) {
return new ApplicationTemp().getDir("servlet-sessions");
}
|
if (!dir.isAbsolute()) {
dir = new File(new ApplicationHome().getDir(), dir.getPath());
}
if (!dir.exists() && mkdirs) {
dir.mkdirs();
}
assertDirectory(mkdirs, dir);
return dir;
}
private void assertDirectory(boolean mkdirs, File dir) {
Assert.state(!mkdirs || dir.exists(), () -> "Session dir " + dir + " does not exist");
Assert.state(!dir.isFile(), () -> "Session dir " + dir + " points to a file");
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-web-server\src\main\java\org\springframework\boot\web\server\servlet\SessionStoreDirectory.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void setAmount(BigDecimal value) {
this.amount = value;
}
/**
* Free text for the reudction/surcharge.
*
* @return
* possible object is
* {@link String }
*
*/
public String getComment() {
return comment;
}
/**
* Sets the value of the comment property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setComment(String value) {
this.comment = value;
}
/**
* The type of surcharge or reduction. May be used to aggregate surcharges and reductions into different categories.Gets the value of the classification 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 classification property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
|
* getClassification().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ClassificationType }
*
*
*/
public List<ClassificationType> getClassification() {
if (classification == null) {
classification = new ArrayList<ClassificationType>();
}
return this.classification;
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\ReductionAndSurchargeBaseType.java
| 2
|
请完成以下Java代码
|
public @Nullable Collection<TopicPartition> getTopicPartitions() {
return this.topicPartitions == null ? null : Collections.unmodifiableList(this.topicPartitions);
}
/**
* The id of the listener (if {@code @KafkaListener}) or the container bean name.
* @return the id.
*/
public String getListenerId() {
return this.listenerId;
}
/**
* Retrieve the consumer. Only populated if the listener is consumer-aware.
* Allows the listener to resume a paused consumer.
|
* @return the consumer.
*/
public Consumer<?, ?> getConsumer() {
return this.consumer;
}
@Override
public String toString() {
return "NonResponsiveConsumerEvent [timeSinceLastPoll="
+ ((float) this.timeSinceLastPoll / 1000) + "s, listenerId=" + this.listenerId // NOSONAR magic #
+ ", container=" + getSource()
+ ", topicPartitions=" + this.topicPartitions + "]";
}
}
|
repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\event\NonResponsiveConsumerEvent.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void createAndAddMissingShares(
@NonNull final CommissionInstance instance,
@NonNull final CommissionTriggerDocument commissionTriggerDocument)
{
final Optional<CreateCommissionSharesRequest> request = commissionInstanceRequestFactory.createRequestFor(commissionTriggerDocument);
if (!request.isPresent())
{
return;
}
final Optional<HierarchyLevel> existingSharesHierarchyTopLevel = instance
.getShares()
.stream()
.filter(share -> share.getLevel() != null)
.map(CommissionShare::getLevel)
.max(HierarchyLevel::compareTo);
final HierarchyLevel startingHierarchyLevel = existingSharesHierarchyTopLevel.isPresent()
? existingSharesHierarchyTopLevel.get().incByOne()
: HierarchyLevel.ZERO;
final ImmutableSet<CommissionConfig> existingConfigs = instance.getShares()
.stream()
.map(CommissionShare::getConfig)
.collect(ImmutableSet.toImmutableSet());
|
final CreateCommissionSharesRequest sparsedOutRequest = request.get()
.withoutConfigs(existingConfigs)
.toBuilder()
.startingHierarchyLevel(startingHierarchyLevel)
.build();
if (sparsedOutRequest.getConfigs().isEmpty())
{
logger.debug("There are no CommissionConfigs that were not already applied to the commission instance");
return;
}
final ImmutableList<CommissionShare> additionalShares = commissionAlgorithmInvoker.createCommissionShares(sparsedOutRequest);
instance.addShares(additionalShares);
logger.debug("Added {} additional salesCommissionShares to instance", additionalShares.size());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\commission\commissioninstance\services\CommissionInstanceService.java
| 2
|
请完成以下Java代码
|
private static List<EntityData> convertListToEntityData(List<Map<String, Object>> result, List<EntityKeyMapping> selectionMapping) {
return result.stream().map(row -> toEntityData(row, selectionMapping)).collect(Collectors.toList());
}
private static EntityData toEntityData(Map<String, Object> row, List<EntityKeyMapping> selectionMapping) {
UUID id = (UUID)row.get("id");
EntityType entityType = EntityType.valueOf((String) row.get("entity_type"));
EntityId entityId = EntityIdFactory.getByTypeAndUuid(entityType, id);
Map<EntityKeyType, Map<String, TsValue>> latest = new HashMap<>();
//Maybe avoid empty hashmaps?
EntityData entityData = new EntityData(entityId, latest, new HashMap<>(), new HashMap<>());
for (EntityKeyMapping mapping : selectionMapping) {
if (!mapping.isIgnore()) {
EntityKey entityKey = mapping.getEntityKey();
Object value = row.get(mapping.getValueAlias());
String strValue;
long ts;
if (entityKey.getType().equals(EntityKeyType.ENTITY_FIELD)) {
strValue = value != null ? value.toString() : "";
ts = System.currentTimeMillis();
} else {
strValue = convertValue(value);
Object tsObject = row.get(mapping.getTsAlias());
ts = tsObject != null ? Long.parseLong(tsObject.toString()) : 0;
}
TsValue tsValue = new TsValue(ts, strValue);
latest.computeIfAbsent(entityKey.getType(), entityKeyType -> new HashMap<>()).put(entityKey.getKey(), tsValue);
}
}
return entityData;
}
static String convertValue(Object value) {
if (value != null) {
String strVal = value.toString();
// check number
if (NumberUtils.isParsable(strVal)) {
if (strVal.startsWith("0") && !strVal.startsWith("0.")) {
return strVal;
}
try {
BigInteger longVal = new BigInteger(strVal);
|
return longVal.toString();
} catch (NumberFormatException ignored) {
}
try {
double dblVal = Double.parseDouble(strVal);
String doubleAsString = Double.toString(dblVal);
if (!Double.isInfinite(dblVal) && isSimpleDouble(doubleAsString)) {
return doubleAsString;
}
} catch (NumberFormatException ignored) {
}
}
return strVal;
} else {
return "";
}
}
private static boolean isSimpleDouble(String valueAsString) {
return valueAsString.contains(".") && !valueAsString.contains("E") && !valueAsString.contains("e");
}
}
|
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\sql\query\EntityDataAdapter.java
| 1
|
请完成以下Java代码
|
public XAResource[] getXAResources(ActivationSpec[] specs) throws ResourceException {
log.finest("getXAResources()");
return null;
}
// getters ///////////////////////////////////////////////////////////////
public ExecutorServiceWrapper getExecutorServiceWrapper() {
return executorServiceWrapper;
}
public JobExecutionHandlerActivation getJobHandlerActivation() {
return jobHandlerActivation;
}
public Boolean getIsUseCommonJWorkManager() {
return isUseCommonJWorkManager;
}
public void setIsUseCommonJWorkManager(Boolean isUseCommonJWorkManager) {
this.isUseCommonJWorkManager = isUseCommonJWorkManager;
}
public String getCommonJWorkManagerName() {
return commonJWorkManagerName;
}
public void setCommonJWorkManagerName(String commonJWorkManagerName) {
this.commonJWorkManagerName = commonJWorkManagerName;
|
}
// misc //////////////////////////////////////////////////////////////////
@Override
public int hashCode() {
return 17;
}
@Override
public boolean equals(Object other) {
if (other == null) {
return false;
}
if (other == this) {
return true;
}
if (!(other instanceof JcaExecutorServiceConnector)) {
return false;
}
return true;
}
}
|
repos\camunda-bpm-platform-master\javaee\jobexecutor-ra\src\main\java\org\camunda\bpm\container\impl\threading\ra\JcaExecutorServiceConnector.java
| 1
|
请完成以下Java代码
|
public ProcessPreconditionsResolution checkPreconditionsApplicable()
{
if (!isViewClass(HUEditorView.class))
{
return ProcessPreconditionsResolution.rejectWithInternalReason("The current view is not an HUEditorView");
}
final DocumentIdsSelection selectedRowIds = getSelectedRowIds();
if (selectedRowIds.isEmpty())
{
return ProcessPreconditionsResolution.rejectBecauseNoSelection();
}
final MutableInt checkedDocumentsCount = new MutableInt(0);
final ProcessPreconditionsResolution firstRejection = getView(HUEditorView.class)
.streamByIds(selectedRowIds)
.filter(document -> document.isPureHU())
.peek(document -> checkedDocumentsCount.incrementAndGet()) // count checked documents
.map(document -> rejectResolutionOrNull(document)) // create reject resolution if any
.filter(Objects::nonNull) // filter out those which are not errors
.findFirst()
.orElse(null);
if (firstRejection != null)
{
// found a record which is not eligible => don't run the process
return firstRejection;
}
if (checkedDocumentsCount.getValue() <= 0)
|
{
return ProcessPreconditionsResolution.rejectWithInternalReason("no eligible rows");
}
return ProcessPreconditionsResolution.accept();
}
/**
* Check the individual given row, to find out if this process can be applied to it or not.
*
* @return {@code null} if there is no reason to reject the given {@code document}.
*/
abstract ProcessPreconditionsResolution rejectResolutionOrNull(HUEditorRow document);
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\process\WEBUI_M_HU_Receipt_Base.java
| 1
|
请完成以下Java代码
|
public static boolean isEnabled()
{
return distributedEventsEnabled;
}
/**
* Locally disable distributed events.
* <p>
* So, EventBus system will work, but all busses will be local, nothing will be broadcasted on network.
* <p>
* To be used by tools build on top of ADempiere, which require only a minimal set of functionalities.
*/
public static void disableDistributedEvents()
{
if (!distributedEventsEnabled)
{
return;
}
distributedEventsEnabled = false;
getLogger(EventBusConfig.class).info("Distributed events broadcasting disabled");
}
/**
* Topic used for general notifications. To be used mainly for broadcasting messages to everybody.
*/
public static final Topic TOPIC_GeneralUserNotifications = Topic.distributed("de.metas.event.GeneralNotifications");
/**
* Topic used for general notifications inside this JVM instance.
* <p>
* Compared to {@link #TOPIC_GeneralUserNotifications}, this topic is NOT broadcasting the events remotely.
*/
public static final Topic TOPIC_GeneralUserNotificationsLocal = TOPIC_GeneralUserNotifications.toLocal();
public static final String JMX_BASE_NAME = "de.metas.event.EventBus";
/**
* World wide unique Sender ID of this JVM instance
*/
private static final String SENDER_ID = ManagementFactory.getRuntimeMXBean().getName() + "-" + UUID.randomUUID();
/**
* @return world wide unique Sender ID of this JVM instance
*/
|
public static String getSenderId()
{
return SENDER_ID;
}
/**
* @return true of calls to {@link IEventBus#processEvent(Event)} shall be performed asynchronously
*/
public static boolean isEventBusPostAsync(@NonNull final Topic topic)
{
if (alwaysConsiderAsyncTopics.contains(topic))
{
return true;
}
// NOTE: in case of unit tests which are checking what notifications were arrived,
// allowing the events to be posted async could be a problem because the event might arrive after the check.
if (Adempiere.isUnitTestMode())
{
return false;
}
final String nameForAllTopics = "de.metas.event.asyncEventBus";
final ISysConfigBL sysConfigBL = Services.get(ISysConfigBL.class);
final Map<String, String> valuesForPrefix = sysConfigBL.getValuesForPrefix(nameForAllTopics, ClientAndOrgId.SYSTEM);
final String keyForTopic = nameForAllTopics + ".topic_" + topic.getName();
final String valueForTopic = valuesForPrefix.get(keyForTopic);
if (Check.isNotBlank(valueForTopic))
{
getLogger(EventBusConfig.class).debug("SysConfig returned value={} for keyForTopic={}", valueForTopic, keyForTopic);
return StringUtils.toBoolean(valueForTopic);
}
final String standardValue = valuesForPrefix.get(nameForAllTopics);
getLogger(EventBusConfig.class).debug("SysConfig returned value={} for keyForTopic={}", standardValue, keyForTopic);
return StringUtils.toBoolean(standardValue);
}
public static void alwaysConsiderAsync(@NonNull final Topic topic)
{
alwaysConsiderAsyncTopics.add(topic);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\event\EventBusConfig.java
| 1
|
请完成以下Java代码
|
public int getC_BP_BankAccount_ID()
{
return get_ValueAsInt(COLUMNNAME_C_BP_BankAccount_ID);
}
@Override
public void setESR_PostFinanceUserNumber_ID (final int ESR_PostFinanceUserNumber_ID)
{
if (ESR_PostFinanceUserNumber_ID < 1)
set_ValueNoCheck (COLUMNNAME_ESR_PostFinanceUserNumber_ID, null);
else
set_ValueNoCheck (COLUMNNAME_ESR_PostFinanceUserNumber_ID, ESR_PostFinanceUserNumber_ID);
}
@Override
public int getESR_PostFinanceUserNumber_ID()
{
|
return get_ValueAsInt(COLUMNNAME_ESR_PostFinanceUserNumber_ID);
}
@Override
public void setESR_RenderedAccountNo (final java.lang.String ESR_RenderedAccountNo)
{
set_Value (COLUMNNAME_ESR_RenderedAccountNo, ESR_RenderedAccountNo);
}
@Override
public java.lang.String getESR_RenderedAccountNo()
{
return get_ValueAsString(COLUMNNAME_ESR_RenderedAccountNo);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.esr\src\main\java-gen\de\metas\payment\esr\model\X_ESR_PostFinanceUserNumber.java
| 1
|
请完成以下Java代码
|
public String getId()
{
return id;
}
@Override
public String toString()
{
return MoreObjects.toStringHelper(this)
.add("id", id)
.toString();
}
@Override
public int hashCode()
{
return Objects.hash(id);
}
@Override
public boolean equals(final Object obj)
{
if (this == obj)
{
return true;
}
final MethodNameCalloutInstance other = EqualsBuilder.getOther(this, obj);
if (other == null)
{
return false;
}
return id.equals(other.id);
}
@Override
public void execute(final ICalloutExecutor executor, final ICalloutField field)
{
|
try
{
legacyCallout.start(methodName, field);
}
catch (final CalloutException e)
{
throw e.setCalloutExecutor(executor)
.setCalloutInstance(this)
.setField(field);
}
catch (final Exception e)
{
throw CalloutExecutionException.wrapIfNeeded(e)
.setCalloutExecutor(executor)
.setCalloutInstance(this)
.setField(field);
}
}
@VisibleForTesting
public org.compiere.model.Callout getLegacyCallout()
{
return legacyCallout;
}
public String getMethodName()
{
return methodName;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\callout\api\impl\MethodNameCalloutInstance.java
| 1
|
请完成以下Java代码
|
public class GenericIdentification3 {
@XmlElement(name = "Id", required = true)
protected String id;
@XmlElement(name = "Issr")
protected String issr;
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
/**
* Gets the value of the 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\GenericIdentification3.java
| 1
|
请完成以下Java代码
|
public ProcessVariablesMap<String, Object> deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException {
ProcessVariablesMap<String, Object> map = new ProcessVariablesMap<>();
ObjectMapper codec = (ObjectMapper) jp.getCodec();
JsonNode node = codec.readTree(jp);
node
.fields()
.forEachRemaining(entry -> {
String name = entry.getKey();
JsonNode entryValue = entry.getValue();
if (!entryValue.isNull()) {
if (entryValue.get(TYPE) != null && entryValue.get(VALUE) != null) {
String type = entryValue.get(TYPE).textValue();
String value = entryValue.get(VALUE).asText();
Class<?> clazz = ProcessVariablesMapTypeRegistry.forType(type);
Object result = conversionService.convert(value, clazz);
if (ObjectValue.class.isInstance(result)) {
result = ObjectValue.class.cast(result).getObject();
}
|
map.put(name, result);
} else {
Object value = null;
try {
value = objectMapper.treeToValue(entryValue, Object.class);
} catch (JsonProcessingException e) {
logger.error("Unexpected Json Processing Exception: ", e);
}
map.put(name, value);
}
} else {
map.put(name, null);
}
});
return map;
}
}
|
repos\Activiti-develop\activiti-core\activiti-api-impl\activiti-api-process-model-impl\src\main\java\org\activiti\api\runtime\model\impl\ProcessVariablesMapDeserializer.java
| 1
|
请完成以下Java代码
|
public String getCurrentActivityName() {
return currentActivityName;
}
/** return the Id of the current transition */
public String getCurrentTransitionId() {
return currentTransitionId;
}
/**
* The {@link ExecutionListener#EVENTNAME_START event name} in case this
* execution is passed in for an {@link ExecutionListener}
*/
public String getEventName() {
return eventName;
}
/**
* Unique id of this path of execution that can be used as a handle to provide
* external signals back into the engine after wait states.
*/
public String getId() {
return id;
}
/**
* return the Id of the parent activity instance currently executed by this
* execution
*/
public String getParentActivityInstanceId() {
return parentActivityInstanceId;
}
/**
* Gets the id of the parent of this execution. If null, the execution
* represents a process-instance.
*/
public String getParentId() {
return parentId;
}
/**
* The business key for the process instance this execution is associated
* with.
*/
public String getProcessBusinessKey() {
return processBusinessKey;
|
}
/**
* The process definition key for the process instance this execution is
* associated with.
*/
public String getProcessDefinitionId() {
return processDefinitionId;
}
/** Reference to the overall process instance */
public String getProcessInstanceId() {
return processInstanceId;
}
/**
* Return the id of the tenant this execution belongs to. Can be
* <code>null</code> if the execution belongs to no single tenant.
*/
public String getTenantId() {
return tenantId;
}
@Override
public String toString() {
return this.getClass().getSimpleName()
+ "[id=" + id
+ ", eventName=" + eventName
+ ", businessKey=" + businessKey
+ ", activityInstanceId=" + activityInstanceId
+ ", currentActivityId=" + currentActivityId
+ ", currentActivityName=" + currentActivityName
+ ", currentTransitionId=" + currentTransitionId
+ ", parentActivityInstanceId=" + parentActivityInstanceId
+ ", parentId=" + parentId
+ ", processBusinessKey=" + processBusinessKey
+ ", processDefinitionId=" + processDefinitionId
+ ", processInstanceId=" + processInstanceId
+ ", tenantId=" + tenantId
+ "]";
}
}
|
repos\camunda-bpm-platform-master\spring-boot-starter\starter\src\main\java\org\camunda\bpm\spring\boot\starter\event\ExecutionEvent.java
| 1
|
请完成以下Java代码
|
private void fixColumn(I_AD_Column column)
{
final AdTableId adTableId = AdTableId.ofRepoId(column.getAD_Table_ID());
final String tableName = Services.get(IADTableDAO.class).retrieveTableName(adTableId);
final String readOnlyLogic = column.getReadOnlyLogic();
if (!Check.isEmpty(readOnlyLogic, true))
{
final String info1 = "Column " + tableName + "." + column.getColumnName() + " ReadOnlyLogic '" + readOnlyLogic;
final String readOnlyLogicNew = fixExpression(readOnlyLogic, info1);
if (!isEquivalent(readOnlyLogic, readOnlyLogicNew))
{
column.setReadOnlyLogic(readOnlyLogicNew);
addLog(info1 + " => " + readOnlyLogicNew);
}
}
final String mandatoryLogic = column.getMandatoryLogic();
if (!Check.isEmpty(mandatoryLogic, true))
{
final String info2 = "Column " + tableName + "." + column.getColumnName() + " MandatoryLogic '" + mandatoryLogic;
final String mandatoryLogicNew = fixExpression(column.getMandatoryLogic(), info2);
if (!isEquivalent(mandatoryLogic, mandatoryLogicNew))
{
column.setMandatoryLogic(mandatoryLogicNew);
addLog(info2 + " => " + mandatoryLogicNew);
}
|
}
InterfaceWrapperHelper.save(column);
}
private String fixExpression(String logic, String info)
{
try
{
final ILogicExpression tree = Services.get(IExpressionFactory.class).compile(logic, ILogicExpression.class);
return tree.getFormatedExpressionString();
}
catch (Exception e)
{
addLog("Exception " + e.getMessage() + " thrown on " + info);
return logic;
}
}
private boolean isEquivalent(String oldLogic, String newLogic)
{
return Objects.equals(oldLogic.replaceAll(" ", "").replace("!=", "!"), newLogic.replaceAll(" ", ""));
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\expression\process\EnableOperatorPrecedence.java
| 1
|
请完成以下Java代码
|
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Set Alternative Group.
@param M_BOMAlternative_ID
Product BOM Alternative Group
*/
public void setM_BOMAlternative_ID (int M_BOMAlternative_ID)
{
if (M_BOMAlternative_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_BOMAlternative_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_BOMAlternative_ID, Integer.valueOf(M_BOMAlternative_ID));
}
/** Get Alternative Group.
@return Product BOM Alternative Group
*/
public int getM_BOMAlternative_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_BOMAlternative_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_M_Product getM_Product() throws RuntimeException
{
return (I_M_Product)MTable.get(getCtx(), I_M_Product.Table_Name)
.getPO(getM_Product_ID(), get_TrxName()); }
/** Set Product.
@param M_Product_ID
Product, Service, Item
*/
public void setM_Product_ID (int M_Product_ID)
{
if (M_Product_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Product_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID));
|
}
/** Get Product.
@return Product, Service, Item
*/
public int getM_Product_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_BOMAlternative.java
| 1
|
请完成以下Java代码
|
public class Queen extends Person {
/**
* 名字
*/
private String name;
/**
* 家系:家族关系
*/
private String clan;
/**
* 年号:生活的时代
*/
private String times;
/**
* 庙号:君主于庙中被供奉时所称呼的名号
*/
private String TempleNumber;
/**
* 谥号:人死之后,后人给予评价
*/
private String posthumousTitle;
/**
* 陵墓
*/
private String son;
/**
* 备注
*/
private String remark;
/**
* 关系指向自己
*/
@Relationship(type = "皇后", direction = Relationship.INCOMING)
private King king;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getClan() {
return clan;
}
public void setClan(String clan) {
this.clan = clan;
}
public String getTimes() {
return times;
}
public void setTimes(String times) {
this.times = times;
}
public String getTempleNumber() {
return TempleNumber;
}
public void setTempleNumber(String templeNumber) {
TempleNumber = templeNumber;
|
}
public String getPosthumousTitle() {
return posthumousTitle;
}
public void setPosthumousTitle(String posthumousTitle) {
this.posthumousTitle = posthumousTitle;
}
public String getSon() {
return son;
}
public void setSon(String son) {
this.son = son;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public King getKing() {
return king;
}
public void setKing(King king) {
this.king = king;
}
}
|
repos\springBoot-master\springboot-neo4j\src\main\java\cn\abel\neo4j\bean\Queen.java
| 1
|
请完成以下Java代码
|
public class CustomerDTO implements Serializable {
private String firstName;
private String lastName;
private String socialSecurityCode;
public CustomerDTO() {
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getSocialSecurityCode() {
return socialSecurityCode;
|
}
public void setSocialSecurityCode(String socialSecurityCode) {
this.socialSecurityCode = socialSecurityCode;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("CustomerDTO{");
sb.append("firstName='").append(firstName).append('\'');
sb.append(", lastName='").append(lastName).append('\'');
sb.append(", socialSecurityCode='").append(socialSecurityCode).append('\'');
sb.append('}');
return sb.toString();
}
}
|
repos\springboot-demo-master\rmi\rmi-common\src\main\java\om\et\rmi\common\CustomerDTO.java
| 1
|
请完成以下Java代码
|
public String toString()
{
StringBuffer sb = new StringBuffer ("X_PA_SLA_Criteria[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set Classname.
@param Classname
Java Classname
*/
public void setClassname (String Classname)
{
set_Value (COLUMNNAME_Classname, Classname);
}
/** Get Classname.
@return Java Classname
*/
public String getClassname ()
{
return (String)get_Value(COLUMNNAME_Classname);
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** Set Comment/Help.
@param Help
Comment or Hint
*/
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 Manual.
@param IsManual
This is a manual process
*/
public void setIsManual (boolean IsManual)
{
set_Value (COLUMNNAME_IsManual, Boolean.valueOf(IsManual));
}
/** Get Manual.
@return This is a manual process
*/
public boolean isManual ()
{
Object oo = get_Value(COLUMNNAME_IsManual);
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 SLA Criteria.
@param PA_SLA_Criteria_ID
Service Level Agreement Criteria
*/
public void setPA_SLA_Criteria_ID (int PA_SLA_Criteria_ID)
{
if (PA_SLA_Criteria_ID < 1)
set_ValueNoCheck (COLUMNNAME_PA_SLA_Criteria_ID, null);
else
set_ValueNoCheck (COLUMNNAME_PA_SLA_Criteria_ID, Integer.valueOf(PA_SLA_Criteria_ID));
}
/** Get SLA Criteria.
@return Service Level Agreement Criteria
*/
public int getPA_SLA_Criteria_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_PA_SLA_Criteria_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_PA_SLA_Criteria.java
| 1
|
请完成以下Java代码
|
public void setUser2_ID (final int User2_ID)
{
if (User2_ID < 1)
set_Value (COLUMNNAME_User2_ID, null);
else
set_Value (COLUMNNAME_User2_ID, User2_ID);
}
@Override
public int getUser2_ID()
{
return get_ValueAsInt(COLUMNNAME_User2_ID);
}
@Override
public void setUserElementString1 (final @Nullable java.lang.String UserElementString1)
{
set_Value (COLUMNNAME_UserElementString1, UserElementString1);
}
@Override
public java.lang.String getUserElementString1()
{
return get_ValueAsString(COLUMNNAME_UserElementString1);
}
@Override
public void setUserElementString2 (final @Nullable java.lang.String UserElementString2)
{
set_Value (COLUMNNAME_UserElementString2, UserElementString2);
}
@Override
public java.lang.String getUserElementString2()
{
return get_ValueAsString(COLUMNNAME_UserElementString2);
}
@Override
public void setUserElementString3 (final @Nullable java.lang.String UserElementString3)
{
set_Value (COLUMNNAME_UserElementString3, UserElementString3);
}
@Override
public java.lang.String getUserElementString3()
{
return get_ValueAsString(COLUMNNAME_UserElementString3);
}
@Override
public void setUserElementString4 (final @Nullable java.lang.String UserElementString4)
{
set_Value (COLUMNNAME_UserElementString4, UserElementString4);
}
@Override
public java.lang.String getUserElementString4()
{
return get_ValueAsString(COLUMNNAME_UserElementString4);
}
@Override
public void setUserElementString5 (final @Nullable java.lang.String UserElementString5)
{
set_Value (COLUMNNAME_UserElementString5, UserElementString5);
}
|
@Override
public java.lang.String getUserElementString5()
{
return get_ValueAsString(COLUMNNAME_UserElementString5);
}
@Override
public void setUserElementString6 (final @Nullable java.lang.String UserElementString6)
{
set_Value (COLUMNNAME_UserElementString6, UserElementString6);
}
@Override
public java.lang.String getUserElementString6()
{
return get_ValueAsString(COLUMNNAME_UserElementString6);
}
@Override
public void setUserElementString7 (final @Nullable java.lang.String UserElementString7)
{
set_Value (COLUMNNAME_UserElementString7, UserElementString7);
}
@Override
public java.lang.String getUserElementString7()
{
return get_ValueAsString(COLUMNNAME_UserElementString7);
}
@Override
public void setC_Flatrate_Term_ID (final int C_Flatrate_Term_ID)
{
if (C_Flatrate_Term_ID < 1)
set_Value (COLUMNNAME_C_Flatrate_Term_ID, null);
else
set_Value (COLUMNNAME_C_Flatrate_Term_ID, C_Flatrate_Term_ID);
}
@Override
public int getC_Flatrate_Term_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Flatrate_Term_ID);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_InvoiceLine.java
| 1
|
请完成以下Java代码
|
public <T> Stream<T> streamSelectedModels(@NonNull final Class<T> modelClass)
{
return Stream.of(getSelectedModel(modelClass));
}
@Override
public int getSingleSelectedRecordId()
{
return document.getDocumentIdAsInt();
}
@Override
public SelectionSize getSelectionSize()
{
return SelectionSize.ofSize(1);
}
@Override
|
public <T> IQueryFilter<T> getQueryFilter(@NonNull final Class<T> recordClass)
{
final String keyColumnName = InterfaceWrapperHelper.getKeyColumnName(tableName);
return EqualsQueryFilter.of(keyColumnName, getSingleSelectedRecordId());
}
@Override
public OptionalBoolean isExistingDocument()
{
return OptionalBoolean.ofBoolean(!document.isNew());
}
@Override
public OptionalBoolean isProcessedDocument()
{
return OptionalBoolean.ofBoolean(document.isProcessed());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\process\DocumentPreconditionsAsContext.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
StreamsBuilderFactoryBeanConfigurer kafkaPropertiesStreamsBuilderFactoryBeanConfigurer() {
return new KafkaPropertiesStreamsBuilderFactoryBeanConfigurer(this.properties);
}
private void applyKafkaConnectionDetailsForStreams(Map<String, Object> properties,
KafkaConnectionDetails connectionDetails) {
KafkaConnectionDetails.Configuration streams = connectionDetails.getStreams();
properties.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, streams.getBootstrapServers());
KafkaAutoConfiguration.applySecurityProtocol(properties, streams.getSecurityProtocol());
KafkaAutoConfiguration.applySslBundle(properties, streams.getSslBundle());
}
static class KafkaPropertiesStreamsBuilderFactoryBeanConfigurer implements StreamsBuilderFactoryBeanConfigurer {
private final KafkaProperties properties;
KafkaPropertiesStreamsBuilderFactoryBeanConfigurer(KafkaProperties properties) {
this.properties = properties;
}
|
@Override
public void configure(StreamsBuilderFactoryBean factoryBean) {
factoryBean.setAutoStartup(this.properties.getStreams().isAutoStartup());
KafkaProperties.Cleanup cleanup = this.properties.getStreams().getCleanup();
CleanupConfig cleanupConfig = new CleanupConfig(cleanup.isOnStartup(), cleanup.isOnShutdown());
factoryBean.setCleanupConfig(cleanupConfig);
}
@Override
public int getOrder() {
return Ordered.HIGHEST_PRECEDENCE;
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-kafka\src\main\java\org\springframework\boot\kafka\autoconfigure\KafkaStreamsAnnotationDrivenConfiguration.java
| 2
|
请完成以下Java代码
|
public int getRequestCode() {
return requestCode;
}
public void setRequestCode(int requestCode) {
this.requestCode = requestCode;
}
}
@JsonNaming(PropertyNamingStrategies.UpperCamelCaseStrategy.class)
public static class ResponseResult {
private int resultCode;
public int getResultCode() {
return resultCode;
}
public void setResultCode(int resultCode) {
this.resultCode = resultCode;
}
}
private Fonts fonts;
private Background background;
@JsonProperty("RequestResult")
private RequestResult requestResult;
@JsonProperty("ResponseResult")
private ResponseResult responseResult;
public Fonts getFonts() {
|
return fonts;
}
public void setFonts(Fonts fonts) {
this.fonts = fonts;
}
public Background getBackground() {
return background;
}
public void setBackground(Background background) {
this.background = background;
}
public RequestResult getRequestResult() {
return requestResult;
}
public void setRequestResult(RequestResult requestResult) {
this.requestResult = requestResult;
}
public ResponseResult getResponseResult() {
return responseResult;
}
public void setResponseResult(ResponseResult responseResult) {
this.responseResult = responseResult;
}
}
|
repos\tutorials-master\libraries-files\src\main\java\com\baeldung\ini\MyConfiguration.java
| 1
|
请完成以下Spring Boot application配置
|
server:
port: 8080
servlet:
context-path: /demo
qiniu:
## 此处填写你自己的七牛云 access key
accessKey:
## 此处填写你自己的七牛云 secret key
secretKey:
## 此处填写你自己的七牛云 bucket
bucket:
## 此处填写你自己的七牛云 域名
prefix:
spring:
servlet:
multipart:
enabled: true
location: /Users/yangkai.sh
|
en/Documents/code/back-end/spring-boot-demo/spring-boot-demo-upload/tmp
file-size-threshold: 5MB
max-file-size: 20MB
|
repos\spring-boot-demo-master\demo-upload\src\main\resources\application.yml
| 2
|
请完成以下Java代码
|
protected final RelatedProcessDescriptor createProcessDescriptor(final int sortNo, @NonNull final Class<?> processClass)
{
final IADProcessDAO adProcessDAO = Services.get(IADProcessDAO.class);
final AdProcessId processId = adProcessDAO.retrieveProcessIdByClass(processClass);
if (processId == null)
{
throw new AdempiereException("No processId found for " + processClass);
}
return RelatedProcessDescriptor.builder()
.processId(processId)
.anyTable().anyWindow()
.displayPlace(DisplayPlace.ViewQuickActions)
.sortNo(sortNo)
.build();
}
@Override
public WindowId getWindowId()
{
return WINDOW_ID;
}
@Override
public void put(final IView view)
{
views.put(view);
}
@Nullable
@Override
public PaymentsView getByIdOrNull(final ViewId viewId)
{
return PaymentsView.cast(views.getByIdOrNull(viewId));
}
@Override
|
public void closeById(final ViewId viewId, final ViewCloseAction closeAction)
{
views.closeById(viewId, closeAction);
}
@Override
public Stream<IView> streamAllViews()
{
return views.streamAllViews();
}
@Override
public void invalidateView(final ViewId viewId)
{
views.invalidateView(viewId);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\payment_allocation\PaymentsViewFactory.java
| 1
|
请完成以下Java代码
|
private String convert (int number)
{
/* special case */
if (number == 0)
return "ZERO";
String prefix = "";
if (number < 0)
{
number = -number;
prefix = "MENO ";
}
String soFar = "";
int place = 0;
do
{
long n = number % 1000;
if (n != 0)
{
String s = convertLessThanOneThousand ((int)n);
if (n == 1)
soFar = majorNames[place] + soFar;
else
soFar = s + majorNamesPlural[place] + soFar;
}
place++;
number /= 1000;
}
while (number > 0);
return (prefix + soFar).trim ();
} // convert
/**************************************************************************
* Get Amount in Words
* @param amount numeric amount (352.80 or 352,80)
* @return amount in words (TRECENTOCINQUANTADUE/80)
* @throws Exception
*/
public String getAmtInWords (String amount) throws Exception
{
if (amount == null)
return amount;
//
StringBuffer sb = new StringBuffer ();
int pos = amount.lastIndexOf (',');
int pos2 = amount.lastIndexOf ('.');
if (pos2 > pos)
pos = pos2;
String oldamt = amount;
amount = amount.replaceAll( "\\.","");
|
int newpos = amount.lastIndexOf (',');
int amt = Integer.parseInt (amount.substring (0, newpos));
sb.append (convert (amt));
for (int i = 0; i < oldamt.length (); i++)
{
if (pos == i) // we are done
{
String cents = oldamt.substring (i + 1);
sb.append ("/").append (cents);
break;
}
}
return sb.toString ();
} // getAmtInWords
public static void main(String[] args) throws Exception {
AmtInWords_IT aiw = new AmtInWords_IT();
System.out.println(aiw.getAmtInWords("0,00"));
System.out.println(aiw.getAmtInWords("1000,00"));
System.out.println(aiw.getAmtInWords("14000,99"));
System.out.println(aiw.getAmtInWords("28000000,99"));
System.out.println(aiw.getAmtInWords("301000000,00"));
System.out.println(aiw.getAmtInWords("200000,99"));
System.out.println(aiw.getAmtInWords("-1234567890,99"));
System.out.println(aiw.getAmtInWords("2147483647,99"));
}
} // AmtInWords_IT
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\util\AmtInWords_IT.java
| 1
|
请完成以下Java代码
|
public class DBRes_bg extends ListResourceBundle
{
/** Data */
static final Object[][] contents = new String[][]{
{ "CConnectionDialog", "\u0412\u0440\u044a\u0437\u043a\u0430" },
{ "Name", "\u0418\u043c\u0435" },
{ "AppsHost", "\u0421\u044a\u0440\u0432\u0435\u0440 \u043d\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u0442\u043e" },
{ "AppsPort", "\u041f\u043e\u0440\u0442 \u043d\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u0442\u043e" },
{ "TestApps", "\u0422\u0435\u0441\u0442 \u043d\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u0442\u043e" },
{ "DBHost", "\u0421\u044a\u0440\u0432\u0435\u0440 \u043d\u0430 \u0431\u0430\u0437\u0430\u0442\u0430 \u0434\u0430\u043d\u043d\u0438" },
{ "DBPort", "\u041f\u043e\u0440\u0442 \u043d\u0430 \u0431\u0430\u0437\u0430\u0442\u0430 \u0434\u0430\u043d\u043d\u0438" },
{ "DBName", "\u0418\u043c\u0435 \u043d\u0430 \u0431\u0430\u0437\u0430\u0442\u0430 \u0434\u0430\u043d\u043d\u0438" },
{ "DBUidPwd", "\u041f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b / \u041f\u0430\u0440\u043e\u043b\u0430" },
{ "ViaFirewall", "\u0417\u0430\u0434 \u0437\u0430\u0449\u0438\u0442\u043d\u0430 \u0441\u0442\u0435\u043d\u0430" },
{ "FWHost", "\u0421\u044a\u0440\u0432\u0435\u0440 \u043d\u0430 \u0437\u0430\u0449\u0438\u0442\u043d\u0430\u0442\u0430 \u0441\u0442\u0435\u043d\u0430" },
{ "FWPort", "\u041f\u043e\u0440\u0442 \u043d\u0430 \u0437\u0430\u0449\u0438\u0442\u043d\u0430\u0442\u0430 \u0441\u0442\u0435\u043d\u0430" },
{ "TestConnection", "\u0422\u0435\u0441\u0442 \u043d\u0430 \u0431\u0430\u0437\u0430\u0442\u0430 \u0434\u0430\u043d\u043d\u0438" },
{ "Type", "\u0412\u0438\u0434 \u043d\u0430 \u0431\u0430\u0437\u0430\u0442\u0430 \u0434\u0430\u043d\u043d\u0438" },
{ "BequeathConnection", "\u041b\u043e\u043a\u0430\u043b\u043d\u0430 \u0432\u0440\u044a\u0437\u043a\u0430" },
{ "Overwrite", "\u0417\u0430\u043c\u044f\u043d\u0430" },
{ "ConnectionProfile", "Connection" },
{ "LAN", "LAN" },
|
{ "TerminalServer", "Terminal Server" },
{ "VPN", "VPN" },
{ "WAN", "WAN" },
{ "ConnectionError", "\u0413\u0440\u0435\u0448\u043a\u0430 \u043f\u0440\u0438 \u0441\u0432\u044a\u0440\u0437\u0432\u0430\u043d\u0435" },
{ "ServerNotActive", "\u0421\u044a\u0440\u0432\u0435\u0440\u044a\u0442 \u043d\u0435 \u0435 \u0430\u043a\u0442\u0438\u0432\u0435\u043d" }
};
/**
* Get Contsnts
* @return contents
*/
public Object[][] getContents()
{
return contents;
}
} // Res
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\db\connectiondialog\i18n\DBRes_bg.java
| 1
|
请完成以下Java代码
|
private synchronized final CollapsiblePanel getCollapsiblePanel()
{
if (_findPanelCollapsible == null)
{
_findPanelCollapsible = new CollapsiblePanel();
}
return _findPanelCollapsible;
}
@Override
public JComponent getComponent()
{
final CollapsiblePanel findPanelCollapsible = getCollapsiblePanel();
return findPanelCollapsible;
}
@Override
public boolean isExpanded()
{
final CollapsiblePanel findPanelCollapsible = getCollapsiblePanel();
return !findPanelCollapsible.isCollapsed();
}
@Override
public void setExpanded(final boolean expanded)
{
final CollapsiblePanel findPanelCollapsible = getCollapsiblePanel();
findPanelCollapsible.setCollapsed(!expanded);
}
@Override
public final void requestFocus()
{
final CollapsiblePanel findPanelCollapsible = getCollapsiblePanel();
if (findPanelCollapsible.isCollapsed())
{
return;
}
findPanel.requestFocus();
}
@Override
public final boolean requestFocusInWindow()
{
final CollapsiblePanel findPanelCollapsible = getCollapsiblePanel();
if (findPanelCollapsible.isCollapsed())
{
return false;
}
return findPanel.requestFocusInWindow();
}
/**
* @return true if it's expanded and the underlying {@link FindPanel} allows focus.
*/
@Override
public boolean isFocusable()
{
if (!isExpanded())
{
return false;
}
return findPanel.isFocusable();
}
/**
|
* Adds a runnable to be executed when the this panel is collapsed or expanded.
*
* @param runnable
*/
@Override
public void runOnExpandedStateChange(final Runnable runnable)
{
Check.assumeNotNull(runnable, "runnable not null");
final CollapsiblePanel findPanelCollapsible = getCollapsiblePanel();
findPanelCollapsible.addPropertyChangeListener("collapsed", new PropertyChangeListener()
{
@Override
public void propertyChange(final PropertyChangeEvent evt)
{
runnable.run();
}
});
}
private static final class CollapsiblePanel extends JXTaskPane implements IUISubClassIDAware
{
private static final long serialVersionUID = 1L;
public CollapsiblePanel()
{
super();
}
@Override
public String getUISubClassID()
{
return AdempiereTaskPaneUI.UISUBCLASSID_VPanel_FindPanel;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\apps\search\FindPanelContainer_Collapsible.java
| 1
|
请完成以下Java代码
|
private boolean contextChanged(SecurityContext context) {
return this.isSaveContextInvoked || context != this.contextBeforeExecution
|| context.getAuthentication() != this.authBeforeExecution;
}
private @Nullable HttpSession createNewSessionIfAllowed(SecurityContext context) {
if (this.httpSessionExistedAtStartOfRequest) {
this.logger.debug("HttpSession is now null, but was not null at start of request; "
+ "session was invalidated, so do not create a new session");
return null;
}
if (!HttpSessionSecurityContextRepository.this.allowSessionCreation) {
this.logger.debug("The HttpSession is currently null, and the "
+ HttpSessionSecurityContextRepository.class.getSimpleName()
+ " is prohibited from creating an HttpSession "
+ "(because the allowSessionCreation property is false) - SecurityContext thus not "
+ "stored for next request");
return null;
}
// Generate a HttpSession only if we need to
if (HttpSessionSecurityContextRepository.this.contextObject.equals(context)) {
this.logger.debug(LogMessage.format(
"HttpSession is null, but SecurityContext has not changed from "
+ "default empty context %s so not creating HttpSession or storing SecurityContext",
context));
return null;
}
|
try {
HttpSession session = this.request.getSession(true);
this.logger.debug("Created HttpSession as SecurityContext is non-default");
return session;
}
catch (IllegalStateException ex) {
// Response must already be committed, therefore can't create a new
// session
this.logger.warn("Failed to create a session, as response has been committed. "
+ "Unable to store SecurityContext.");
}
return null;
}
}
}
|
repos\spring-security-main\web\src\main\java\org\springframework\security\web\context\HttpSessionSecurityContextRepository.java
| 1
|
请完成以下Java代码
|
public class UserData {
private final String id;
private final String name;
private final String email;
private final Boolean enabled;
@JsonCreator
public UserData(@JsonProperty("id") String id,
@JsonProperty("name") String name,
@JsonProperty("email") String email,
@JsonProperty("enabled") Boolean enabled) {
this.id = id;
this.name = name;
this.email = email;
this.enabled = enabled;
}
public String getId() {
return id;
|
}
public String getName() {
return name;
}
public String getEmail() {
return email;
}
public Boolean getEnabled() {
return enabled;
}
}
|
repos\spring-examples-java-17\spring-data\src\main\java\itx\examples\springdata\dto\UserData.java
| 1
|
请完成以下Java代码
|
public String getContent() {
return content;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column rule.content
*
* @param content the value for rule.content
*
* @mbggenerated
*/
public void setContent(String content) {
this.content = content == null ? null : content.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column rule.create_time
*
* @return the value of rule.create_time
*
* @mbggenerated
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column rule.create_time
*
|
* @param createTime the value for rule.create_time
*
* @mbggenerated
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column rule.update_time
*
* @return the value of rule.update_time
*
* @mbggenerated
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column rule.update_time
*
* @param updateTime the value for rule.update_time
*
* @mbggenerated
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
|
repos\spring-boot-student-master\spring-boot-student-drools\src\main\java\com\xiaolyuh\domain\model\Rule.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class OAuth2AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {
/**
* 用户认证 Manager
*/
@Autowired
private AuthenticationManager authenticationManager;
/**
* 用户详情 Service
*/
@Autowired
private UserDetailsService userDetailsService;
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
endpoints.authenticationManager(authenticationManager)
.userDetailsService(userDetailsService)
;
}
@Override
public void configure(AuthorizationServerSecurityConfigurer oauthServer) throws Exception {
oauthServer.checkTokenAccess("isAuthenticated()");
// oauthServer.tokenKeyAccess("isAuthenticated()")
// .checkTokenAccess("isAuthenticated()");
// oauthServer.tokenKeyAccess("permitAll()")
|
// .checkTokenAccess("permitAll()");
}
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients.inMemory()
.withClient("clientapp").secret("112233") // Client 账号、密码。
.authorizedGrantTypes("password", "refresh_token") // 密码模式
.scopes("read_userinfo", "read_contacts") // 可授权的 Scope
.accessTokenValiditySeconds(3600) // 访问令牌的有效期为 3600 秒 = 2 小时
.refreshTokenValiditySeconds(864000) // 刷新令牌的有效期为 864000 秒 = 10 天
// .and().withClient() // 可以继续配置新的 Client
;
}
}
|
repos\SpringBoot-Labs-master\lab-68-spring-security-oauth\lab-68-demo03-authorization-server-with-resource-owner-password-credentials\src\main\java\cn\iocoder\springboot\lab68\authorizationserverdemo\config\OAuth2AuthorizationServerConfig.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public boolean anyMatch(@NonNull final MatchInvQuery query)
{
return toSqlQuery(query).anyMatch();
}
public ImmutableList<MatchInv> deleteAndReturn(@NonNull final MatchInvQuery query)
{
final ImmutableList<I_M_MatchInv> records = toSqlQuery(query).list();
if (records.isEmpty())
{
return ImmutableList.of();
}
final ImmutableList<MatchInv> matchInvs = records.stream().map(MatchInvoiceRepository::fromRecord).collect(ImmutableList.toImmutableList());
InterfaceWrapperHelper.deleteAll(records, false);
return matchInvs;
}
private IQueryBuilder<I_M_MatchInv> toSqlQuery(final MatchInvQuery query)
{
final IQueryBuilder<I_M_MatchInv> sqlQueryBuilder = queryBL.createQueryBuilder(I_M_MatchInv.class)
.orderBy(I_M_MatchInv.COLUMN_M_MatchInv_ID);
if (query.isOnlyActive())
{
sqlQueryBuilder.addOnlyActiveRecordsFilter();
}
if (query.getType() != null)
{
sqlQueryBuilder.addEqualsFilter(I_M_MatchInv.COLUMNNAME_Type, query.getType());
}
if (query.getInvoiceId() != null)
{
sqlQueryBuilder.addEqualsFilter(I_M_MatchInv.COLUMNNAME_C_Invoice_ID, query.getInvoiceId());
}
if (query.getInvoiceAndLineId() != null)
{
sqlQueryBuilder.addEqualsFilter(I_M_MatchInv.COLUMNNAME_C_InvoiceLine_ID, query.getInvoiceAndLineId());
}
if (query.getInoutId() != null)
{
sqlQueryBuilder.addEqualsFilter(I_M_MatchInv.COLUMNNAME_M_InOut_ID, query.getInoutId());
}
if (query.getInoutLineId() != null)
{
sqlQueryBuilder.addEqualsFilter(I_M_MatchInv.COLUMNNAME_M_InOutLine_ID, query.getInoutLineId());
}
if (query.getInoutCostId() != null)
{
sqlQueryBuilder.addEqualsFilter(I_M_MatchInv.COLUMNNAME_M_InOut_Cost_ID, query.getInoutCostId());
}
|
if (query.getAsiId() != null)
{
sqlQueryBuilder.addEqualsFilter(I_M_MatchInv.COLUMNNAME_M_AttributeSetInstance_ID, query.getAsiId());
}
return sqlQueryBuilder;
}
public Set<MatchInvId> getIdsProcessedButNotPostedByInOutLineIds(@NonNull final Set<InOutLineId> inoutLineIds)
{
if (inoutLineIds.isEmpty())
{
return ImmutableSet.of();
}
return queryBL
.createQueryBuilder(I_M_MatchInv.class)
.addOnlyActiveRecordsFilter()
.addInArrayFilter(I_M_MatchInv.COLUMN_M_InOutLine_ID, inoutLineIds)
.addEqualsFilter(I_M_MatchInv.COLUMN_Processed, true)
.addNotEqualsFilter(I_M_MatchInv.COLUMN_Posted, true)
.create()
.idsAsSet(MatchInvId::ofRepoId);
}
public Set<MatchInvId> getIdsProcessedButNotPostedByInvoiceLineIds(@NonNull final Set<InvoiceAndLineId> invoiceAndLineIds)
{
if (invoiceAndLineIds.isEmpty())
{
return ImmutableSet.of();
}
return queryBL
.createQueryBuilder(I_M_MatchInv.class)
.addOnlyActiveRecordsFilter()
.addInArrayOrAllFilter(I_M_MatchInv.COLUMN_C_InvoiceLine_ID, invoiceAndLineIds)
.addEqualsFilter(I_M_MatchInv.COLUMN_Processed, true)
.addNotEqualsFilter(I_M_MatchInv.COLUMN_Posted, true)
.create()
.idsAsSet(MatchInvId::ofRepoId);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\invoice\matchinv\service\MatchInvoiceRepository.java
| 2
|
请完成以下Java代码
|
public class DeliveryLineCandidate
{
/**
* A more generic replacement for order..needed at least for deliveryRule complete-order
*/
// FIXME: we shall not have the link to parent here (which introduces a cyclic reference)
@NonNull
private final DeliveryGroupCandidate group;
@NonNull
@Getter(AccessLevel.NONE)
private final I_M_ShipmentSchedule shipmentSchedule;
@NonNull
private final ShipmentScheduleId shipmentScheduleId;
@NonNull
private BigDecimal qtyToDeliver = BigDecimal.ZERO;
@Setter(AccessLevel.NONE)
private boolean discarded = false;
@NonNull
private CompleteStatus completeStatus;
public DeliveryLineCandidate(
@NonNull final DeliveryGroupCandidate group,
@NonNull final I_M_ShipmentSchedule shipmentSchedule,
@NonNull final CompleteStatus completeStatus)
{
this.group = group;
this.shipmentSchedule = shipmentSchedule;
this.shipmentScheduleId = ShipmentScheduleId.ofRepoId(shipmentSchedule.getM_ShipmentSchedule_ID());
this.completeStatus = completeStatus;
}
public int getProductId()
{
return shipmentSchedule.getM_Product_ID();
}
public TableRecordReference getReferenced()
{
return TableRecordReference.ofReferenced(shipmentSchedule);
|
}
public BigDecimal getQtyToDeliverOverride()
{
return shipmentSchedule.getQtyToDeliver_Override();
}
public int getBillBPartnerId()
{
return shipmentSchedule.getBill_BPartner_ID();
}
public DeliveryRule getDeliveryRule()
{
final IShipmentScheduleEffectiveBL shipmentScheduleBL = Services.get(IShipmentScheduleEffectiveBL.class);
return shipmentScheduleBL.getDeliveryRule(shipmentSchedule);
}
public void setDiscarded()
{
this.discarded = true;
}
public void removeFromGroup()
{
group.removeLine(this);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\org\adempiere\inout\util\DeliveryLineCandidate.java
| 1
|
请完成以下Java代码
|
public static DocBaseAndSubType of(@NonNull final DocBaseType docBaseType, @Nullable final String docSubType)
{
return interner.intern(new DocBaseAndSubType(docBaseType, DocSubType.ofNullableCode(docSubType)));
}
public static DocBaseAndSubType of(@NonNull final DocBaseType docBaseType, @NonNull final DocSubType docSubType)
{
return interner.intern(new DocBaseAndSubType(docBaseType, docSubType));
}
@Nullable
public static DocBaseAndSubType ofNullable(
@Nullable final String docBaseType,
@Nullable final String docSubType)
{
final String docBaseTypeNorm = StringUtils.trimBlankToNull(docBaseType);
return docBaseTypeNorm != null ? of(docBaseTypeNorm, docSubType) : null;
}
private static final Interner<DocBaseAndSubType> interner = Interners.newStrongInterner();
@NonNull DocBaseType docBaseType;
@NonNull DocSubType docSubType;
private DocBaseAndSubType(
@NonNull final DocBaseType docBaseType,
@NonNull final DocSubType docSubType)
{
this.docBaseType = docBaseType;
|
this.docSubType = docSubType;
}
// DocBaseAndSubTypeChecks
public boolean isSalesInvoice() {return docBaseType.isSalesInvoice() && docSubType.isNone();}
public boolean isPrepaySO() {return docBaseType.isSalesOrder() && docSubType.isPrepay();}
public boolean isCallOrder() {return (docBaseType.isSalesOrder() || docBaseType.isPurchaseOrder()) && docSubType.isCallOrder();}
public boolean isFrameAgreement() { return ( docBaseType.isSalesOrder() || docBaseType.isPurchaseOrder() ) && docSubType.isFrameAgreement(); }
public boolean isMediated() {return (docBaseType.isPurchaseOrder()) && docSubType.isMediated();}
public boolean isRequisition() {return (docBaseType.isPurchaseOrder()) && docSubType.isRequisition();}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\document\DocBaseAndSubType.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class JsonBOMLine
{
@NonNull
@JsonProperty("ARTNR")
String productValue;
@NonNull
@JsonProperty("ARTNRID")
String productId;
@Nullable
@JsonProperty("HERKUNFTSLAND")
String countryCode;
@NonNull
@JsonProperty("POS")
Integer line;
@JsonProperty("ANTEIL")
BigDecimal qtyBOM;
@NonNull
@JsonProperty("UOM")
String uom;
@Builder
public JsonBOMLine(
@JsonProperty("ARTNR") final @NonNull String productValue,
|
@JsonProperty("ARTNRID") final @NonNull String productId,
@JsonProperty("HERKUNFTSLAND") final @Nullable String countryCode,
@JsonProperty("POS") final @NonNull Integer line,
@JsonProperty("ANTEIL") final @NonNull BigDecimal qtyBOM,
@JsonProperty("UOM") final @NonNull String uom)
{
this.productValue = productValue;
this.productId = productId;
this.countryCode = countryCode;
this.line = line;
this.qtyBOM = qtyBOM;
this.uom = uom;
}
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonPOJOBuilder(withPrefix = "")
static class JsonBOMLineBuilder
{
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\de-metas-camel-grssignum\src\main\java\de\metas\camel\externalsystems\grssignum\to_grs\api\model\JsonBOMLine.java
| 2
|
请完成以下Java代码
|
public String getInvoiceExportProviderId()
{
return ForumDatenaustauschChConstants.INVOICE_EXPORT_PROVIDER_ID;
}
@Override
public Optional<InvoiceExportClient> newClientForInvoice(@NonNull final InvoiceToExport invoice)
{
try (final MDCCloseable ignored = TableRecordMDC.putTableRecordReference(I_C_Invoice.Table_Name, invoice.getId()))
{
final String requiredAttachmentTag = ForumDatenaustauschChConstants.INVOICE_EXPORT_PROVIDER_ID;
final ILoggable loggable = Loggables.withLogger(logger, Level.DEBUG);
final boolean supported = invoice.getInvoiceAttachments()
.stream()
.map(attachment -> attachment.getTags().get(InvoiceExportClientFactory.ATTACHMENT_TAGNAME_EXPORT_PROVIDER)) // might be null
.anyMatch(providerId -> requiredAttachmentTag.equals(providerId));
if (!supported)
{
loggable.addLog("forum_datenaustausch_ch - The invoice with id={} has no attachment with an {}-tag", invoice.getId(), requiredAttachmentTag);
return Optional.empty();
}
final BPartnerId recipientId = invoice.getRecipient().getId();
final BPartnerQuery query = BPartnerQuery
.builder()
.bPartnerId(de.metas.bpartner.BPartnerId.ofRepoId(recipientId.getRepoId()))
.build();
final ExportConfig config = configRepository.getForQueryOrNull(query);
if (config == null)
|
{
loggable.addLog("forum_datenaustausch_ch - There is no export config for the recipiend-id={} of the invoice with id={}", recipientId, invoice.getId());
return Optional.empty();
}
final InvoiceExportClientImpl client = new InvoiceExportClientImpl(crossVersionServiceRegistry, config);
if (!client.applies(invoice))
{
loggable.addLog("forum_datenaustausch_ch - the export-client {} said that it won't export the invoice with id={}", client.getClass().getSimpleName(), invoice.getId());
return Optional.empty();
}
return Optional.of(client);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_base\src\main\java\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\base\export\invoice\InvoiceExportClientFactoryImpl.java
| 1
|
请完成以下Java代码
|
public int getAD_Image_ID()
{
return AD_Image_ID;
}
/**
* Get AD_Color_ID
* @return color
*/
public int getAD_Color_ID()
{
return AD_Color_ID;
}
/**
* Get PA_Goal_ID
* @return goal
*/
public int getPA_Goal_ID()
{
return PA_Goal_ID;
}
/*************************************************************************/
/**
* Init Workbench Windows
* @return true if initilized
*/
private boolean initDesktopWorkbenches()
{
String sql = "SELECT AD_Workbench_ID "
+ "FROM AD_DesktopWorkbench "
+ "WHERE AD_Desktop_ID=? AND IsActive='Y' "
+ "ORDER BY SeqNo";
try
{
PreparedStatement pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, AD_Desktop_ID);
ResultSet rs = pstmt.executeQuery();
while (rs.next())
{
int AD_Workbench_ID = rs.getInt(1);
m_workbenches.add (new Integer(AD_Workbench_ID));
}
rs.close();
pstmt.close();
}
catch (SQLException e)
{
log.error("MWorkbench.initDesktopWorkbenches", e);
|
return false;
}
return true;
} // initDesktopWorkbenches
/**
* Get Window Count
* @return no of windows
*/
public int getWindowCount()
{
return m_workbenches.size();
} // getWindowCount
/**
* Get AD_Workbench_ID of index
* @param index index
* @return -1 if not valid
*/
public int getAD_Workbench_ID (int index)
{
if (index < 0 || index > m_workbenches.size())
return -1;
Integer id = (Integer)m_workbenches.get(index);
return id.intValue();
} // getAD_Workbench_ID
} // MDesktop
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MDesktop.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getReferences() {
return references;
}
/**
* Sets the value of the references property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setReferences(String value) {
this.references = value;
}
/**
* Flag indicating whether the message is a test message or not.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isTestIndicator() {
|
return testIndicator;
}
/**
* Sets the value of the testIndicator property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setTestIndicator(Boolean value) {
this.testIndicator = value;
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\messaging\header\ErpelBusinessDocumentHeaderType.java
| 2
|
请完成以下Java代码
|
public class TimerRetriesDecrementedListenerDelegate implements ActivitiEventListener {
private List<BPMNElementEventListener<BPMNTimerRetriesDecrementedEvent>> processRuntimeEventListeners;
private ToTimerRetriesDecrementedConverter converter;
public TimerRetriesDecrementedListenerDelegate(
List<BPMNElementEventListener<BPMNTimerRetriesDecrementedEvent>> processRuntimeEventListeners,
ToTimerRetriesDecrementedConverter converter
) {
this.processRuntimeEventListeners = processRuntimeEventListeners;
this.converter = converter;
}
@Override
public void onEvent(ActivitiEvent event) {
|
converter
.from(event)
.ifPresent(convertedEvent -> {
for (BPMNElementEventListener<
BPMNTimerRetriesDecrementedEvent
> listener : processRuntimeEventListeners) {
listener.onEvent(convertedEvent);
}
});
}
@Override
public boolean isFailOnException() {
return false;
}
}
|
repos\Activiti-develop\activiti-core\activiti-api-impl\activiti-api-process-runtime-impl\src\main\java\org\activiti\runtime\api\event\internal\TimerRetriesDecrementedListenerDelegate.java
| 1
|
请完成以下Java代码
|
public void setActionCommand(String actionCommand) {
super.setActionCommand(actionCommand);
if (getName() == null && actionCommand != null
&& actionCommand.length() > 0)
setName(actionCommand);
} // setActionCommand
// @formatter:off
// 08267: on german and swiss keyboards, this "CTRL+ALT" stuff also activates when the user presses '\'...which happens often in the file editor (VFile).
// The result is that if you press backslash in a process dialog's file editor, the dialog is canceled..explain that to the customer ;-).
// Note: see https://bugs.openjdk.java.net/browse/JDK-4274105 for the best background info I found so far
//
// /**
// * Overrides the JButton.setMnemonic() method, setting modifier keys to
// * CTRL+ALT.
// *
// * @param mnemonic
// * The mnemonic character code.
// */
// @Override
// public void setMnemonic(int mnemonic) {
|
// super.setMnemonic(mnemonic);
//
// InputMap map = SwingUtilities.getUIInputMap(this,
// JComponent.WHEN_IN_FOCUSED_WINDOW);
//
// if (map == null) {
// map = new ComponentInputMapUIResource(this);
// SwingUtilities.replaceUIInputMap(this,
// JComponent.WHEN_IN_FOCUSED_WINDOW, map);
// }
// map.clear();
//
// int mask = InputEvent.ALT_MASK + InputEvent.CTRL_MASK; // Default
// // Buttons
// map.put(KeyStroke.getKeyStroke(mnemonic, mask, false), "pressed");
// map.put(KeyStroke.getKeyStroke(mnemonic, mask, true), "released");
// map.put(KeyStroke.getKeyStroke(mnemonic, 0, true), "released");
// setInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW, map);
// } // setMnemonic
// @formatter:on
} // CButton
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\swing\CButton.java
| 1
|
请完成以下Java代码
|
public boolean isValid(int M_AttributeSetInstance_ID)
{
// TODO: check/uncomment/reimplement when it will be needed
// //MAttributeSet mas = MAttributeSet.get(getCtx(), getM_AttributeSet_ID());
//
//// Save Instance Attributes
//
// MAttributeSetInstance asi = new MAttributeSetInstance(getCtx(),M_AttributeSetInstance_ID, get_TrxName());
// MAttributeSet as = MAttributeSet.get(AttributeSetId.ofRepoId(asi.getM_AttributeSet_ID()));
// for (final I_M_Attribute attribute : as.getMAttributes(false))
// {
//
// //MAttribute attribute = new MAttribute(getCtx(),0,null);
// MAttributeInstance instance = attribute.getMAttributeInstance(M_AttributeSetInstance_ID);
// MQMSpecificationLine[] lines = getLines(" M_Attribute_ID="+attribute.getM_Attribute_ID());
// for (int s = 0; s < lines.length; i++)
// {
// MQMSpecificationLine line = lines[s];
// if (MAttribute.ATTRIBUTEVALUETYPE_Number.equals(attribute.getAttributeValueType()))
// {
// BigDecimal objValue = instance.getValueNumber();
// if(!line.evaluate(objValue,instance.getValue()));
|
// return false;
// }
// else
// {
// String objValue = instance.getValue();
// if(!line.evaluate(objValue,instance.getValue()))
// return false;
// }
// //if(line.evaluate(mas.getValueNumber())
// }
// } // for all attributes
return true;
}
} // MQMSpecification
|
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\model\MQMSpecification.java
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.