instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请完成以下Java代码
|
public String getLocationHeaderName() {
return locationHeaderName;
}
public Config setLocationHeaderName(String locationHeaderName) {
this.locationHeaderName = locationHeaderName;
return this;
}
public @Nullable String getHostValue() {
return hostValue;
}
public Config setHostValue(String hostValue) {
this.hostValue = hostValue;
return this;
}
public String getProtocols() {
return protocols;
}
public Config setProtocols(String protocols) {
this.protocols = protocols;
this.hostPortPattern = compileHostPortPattern(protocols);
|
this.hostPortVersionPattern = compileHostPortVersionPattern(protocols);
return this;
}
public Pattern getHostPortPattern() {
return hostPortPattern;
}
public Pattern getHostPortVersionPattern() {
return hostPortVersionPattern;
}
}
}
|
repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webflux\src\main\java\org\springframework\cloud\gateway\filter\factory\RewriteLocationResponseHeaderGatewayFilterFactory.java
| 1
|
请完成以下Java代码
|
public int discoverServers(String msg) throws IOException {
copyMessageOnBuffer(msg);
multicastPacket();
return receivePackets();
}
private void copyMessageOnBuffer(String msg) {
buf = msg.getBytes();
}
private void multicastPacket() throws IOException {
DatagramPacket packet = new DatagramPacket(buf, buf.length, group, 4446);
socket.send(packet);
}
private int receivePackets() throws IOException {
int serversDiscovered = 0;
while (serversDiscovered != expectedServerCount) {
|
receivePacket();
serversDiscovered++;
}
return serversDiscovered;
}
private void receivePacket() throws IOException {
DatagramPacket packet = new DatagramPacket(buf, buf.length);
socket.receive(packet);
}
public void close() {
socket.close();
}
}
|
repos\tutorials-master\core-java-modules\core-java-networking-5\src\main\java\com\baeldung\networking\udp\multicast\MulticastingClient.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public List<Book> related(Book book, @LocalContextValue Author author) {
List<Book> relatedBooks = new ArrayList<>();
relatedBooks.addAll(fetchBooksByAuthor(author));
relatedBooks.addAll(fetchSimilarBooks(book));
return relatedBooks;
}
// end::localcontext[]
private BookAndAuthor fetchBookAndAuthorById(Long id) {
return new BookAndAuthor(new Book(id, "Spring for GraphQL", 12L),
new Author(1L, "Jane Doe"));
}
private List<Book> fetchBooksByAuthor(Author author) {
return List.of(new Book(1, "Spring for GraphQL", 12L));
}
|
private List<Book> fetchSimilarBooks(Book book) {
return List.of();
}
record BookAndAuthor(Book book, Author author) {
}
record Book(long id, String title, long authorId) {
}
record Author(long id, String name) {
}
}
|
repos\spring-graphql-main\spring-graphql-docs\src\main\java\org\springframework\graphql\docs\controllers\schemamapping\localcontext\LocalContextBookController.java
| 2
|
请完成以下Java代码
|
public String getSerializationDataFormat() {
return serializationDataFormat;
}
public void setSerializationDataFormat(String serializationDataFormat) {
this.serializationDataFormat = serializationDataFormat;
}
public String getObjectTypeName() {
return objectTypeName;
}
public void setObjectTypeName(String objectTypeName) {
this.objectTypeName = objectTypeName;
}
public String getValueSerialized() {
return serializedValue;
}
public void setSerializedValue(String serializedValue) {
this.serializedValue = serializedValue;
}
public boolean isDeserialized() {
return isDeserialized;
}
@Override
public Object getValue() {
if(isDeserialized) {
return super.getValue();
}
else {
throw new IllegalStateException("Object is not deserialized.");
}
}
@SuppressWarnings("unchecked")
public <T> T getValue(Class<T> type) {
Object value = getValue();
if(type.isAssignableFrom(value.getClass())) {
return (T) value;
}
else {
throw new IllegalArgumentException("Value '"+value+"' is not of type '"+type+"'.");
}
}
public Class<?> getObjectType() {
Object value = getValue();
if(value == null) {
return null;
}
else {
|
return value.getClass();
}
}
@Override
public SerializableValueType getType() {
return (SerializableValueType) super.getType();
}
public void setTransient(boolean isTransient) {
this.isTransient = isTransient;
}
@Override
public String toString() {
return "ObjectValue ["
+ "value=" + value
+ ", isDeserialized=" + isDeserialized
+ ", serializationDataFormat=" + serializationDataFormat
+ ", objectTypeName=" + objectTypeName
+ ", serializedValue="+ (serializedValue != null ? (serializedValue.length() + " chars") : null)
+ ", isTransient=" + isTransient
+ "]";
}
}
|
repos\camunda-bpm-platform-master\commons\typed-values\src\main\java\org\camunda\bpm\engine\variable\impl\value\ObjectValueImpl.java
| 1
|
请完成以下Java代码
|
public I_C_UOM getEachUOM()
{
return getByX12DE355(X12DE355.EACH);
}
@Override
public TemporalUnit getTemporalUnitByUomId(@NonNull final UomId uomId)
{
final I_C_UOM uom = getById(uomId);
return UOMUtil.toTemporalUnit(uom);
}
@Override
public I_C_UOM getByTemporalUnit(@NonNull final TemporalUnit temporalUnit)
{
final UomId uomId = getUomIdByTemporalUnit(temporalUnit);
return getById(uomId);
}
@Override
public UomId getUomIdByTemporalUnit(@NonNull final TemporalUnit temporalUnit)
{
final X12DE355 x12de355 = X12DE355.ofTemporalUnit(temporalUnit);
try
{
return getUomIdByX12DE355(x12de355);
}
catch (final Exception ex)
{
throw AdempiereException.wrapIfNeeded(ex)
.setParameter("temporalUnit", temporalUnit)
.setParameter("x12de355", x12de355)
.setParameter("Suggestion", "Create an UOM for that X12DE355 code or activate it if already exists.")
.appendParametersToMessage();
}
}
@Override
public UOMPrecision getStandardPrecision(final UomId uomId)
{
if (uomId == null)
{
// NOTE: if there is no UOM specified, we assume UOM is Each => precision=0
return UOMPrecision.ZERO;
}
final I_C_UOM uom = getById(uomId);
return UOMPrecision.ofInt(uom.getStdPrecision());
}
@Override
public boolean isUOMForTUs(@NonNull final UomId uomId)
|
{
final I_C_UOM uom = getById(uomId);
return isUOMForTUs(uom);
}
public static boolean isUOMForTUs(@NonNull final I_C_UOM uom)
{
final X12DE355 x12de355 = X12DE355.ofCode(uom.getX12DE355());
return X12DE355.COLI.equals(x12de355) || X12DE355.TU.equals(x12de355);
}
@Override
public @NonNull UOMType getUOMTypeById(@NonNull final UomId uomId)
{
final I_C_UOM uom = getById(uomId);
return UOMType.ofNullableCodeOrOther(uom.getUOMType());
}
@Override
public @NonNull Optional<I_C_UOM> getBySymbol(@NonNull final String uomSymbol)
{
return Optional.ofNullable(queryBL.createQueryBuilder(I_C_UOM.class)
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_C_UOM.COLUMNNAME_UOMSymbol, uomSymbol)
.create()
.firstOnlyOrNull(I_C_UOM.class));
}
@Override
public ITranslatableString getUOMSymbolById(@NonNull final UomId uomId)
{
final I_C_UOM uom = getById(uomId);
return InterfaceWrapperHelper.getModelTranslationMap(uom).getColumnTrl(I_C_UOM.COLUMNNAME_UOMSymbol, uom.getUOMSymbol());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\uom\impl\UOMDAO.java
| 1
|
请完成以下Java代码
|
public int getSeqNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
if (ii == null)
return 0;
return ii.intValue();
}
/**
* StatusCode AD_Reference_ID=53311
* Reference name: AD_Migration Status
*/
public static final int STATUSCODE_AD_Reference_ID=53311;
/** Applied = A */
public static final String STATUSCODE_Applied = "A";
/** Unapplied = U */
public static final String STATUSCODE_Unapplied = "U";
/** Failed = F */
public static final String STATUSCODE_Failed = "F";
/** Partially applied = P */
public static final String STATUSCODE_PartiallyApplied = "P";
/** Set Status Code.
@param StatusCode Status Code */
|
@Override
public void setStatusCode (java.lang.String StatusCode)
{
set_Value (COLUMNNAME_StatusCode, StatusCode);
}
/** Get Status Code.
@return Status Code */
@Override
public java.lang.String getStatusCode ()
{
return (java.lang.String)get_Value(COLUMNNAME_StatusCode);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\adempiere\ad\migration\model\X_AD_Migration.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class DataScopeModelHandler implements ScopeModelHandler {
/**
* 获取数据权限
*
* @param mapperId 数据权限mapperId
* @param roleId 用户角色集合
* @return DataScopeModel
*/
@Override
public DataScopeModel getDataScopeByMapper(String mapperId, String roleId) {
return DataScopeCache.getDataScopeByMapper(mapperId, roleId);
}
/**
* 获取数据权限
*
* @param code 数据权限资源编号
* @return DataScopeModel
|
*/
@Override
public DataScopeModel getDataScopeByCode(String code) {
return DataScopeCache.getDataScopeByCode(code);
}
/**
* 获取部门子级
*
* @param deptId 部门id
* @return deptIds
*/
@Override
public List<Long> getDeptAncestors(Long deptId) {
return DataScopeCache.getDeptAncestors(deptId);
}
}
|
repos\SpringBlade-master\blade-service-api\blade-scope-api\src\main\java\org\springblade\system\handler\DataScopeModelHandler.java
| 2
|
请完成以下Java代码
|
public void completeAdhocSubProcess(String executionId) {
commandExecutor.execute(new CompleteAdhocSubProcessCmd(executionId));
}
@Override
public ProcessInstanceBuilder createProcessInstanceBuilder() {
return new ProcessInstanceBuilderImpl(this);
}
@Override
public ProcessInstance startCreatedProcessInstance(
ProcessInstance createdProcessInstance,
Map<String, Object> variables
) {
return commandExecutor.execute(new StartCreatedProcessInstanceCmd<>(createdProcessInstance, variables));
}
public ProcessInstance startProcessInstance(ProcessInstanceBuilderImpl processInstanceBuilder) {
if (processInstanceBuilder.hasProcessDefinitionIdOrKey()) {
return commandExecutor.execute(new StartProcessInstanceCmd<ProcessInstance>(processInstanceBuilder));
} else if (processInstanceBuilder.getMessageName() != null) {
return commandExecutor.execute(new StartProcessInstanceByMessageCmd(processInstanceBuilder));
} else {
|
throw new ActivitiIllegalArgumentException(
"No processDefinitionId, processDefinitionKey nor messageName provided"
);
}
}
public ProcessInstance createProcessInstance(ProcessInstanceBuilderImpl processInstanceBuilder) {
if (processInstanceBuilder.hasProcessDefinitionIdOrKey()) {
return commandExecutor.execute(new CreateProcessInstanceCmd(processInstanceBuilder));
} else {
throw new ActivitiIllegalArgumentException(
"No processDefinitionId, processDefinitionKey nor messageName provided"
);
}
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\RuntimeServiceImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class BookstoreService {
private final BookRepository bookRepository;
public BookstoreService(BookRepository bookRepository) {
this.bookRepository = bookRepository;
}
// this will successfully pass the `check_book_pages` trigger check
@Transactional
public void addNewChapterSuccess() {
Book book = bookRepository.findById(1L).orElseThrow();
Chapter chapter6 = new Chapter();
chapter6.setTitle("Chapter 6");
chapter6.setPages(20);
|
book.addChapter(chapter6);
}
// this will cause database trigger `check_book_pages` to fail
@Transactional
public void addNewChapterFail() {
Book book = bookRepository.findById(1L).orElseThrow();
Chapter chapter7 = new Chapter();
chapter7.setTitle("Chapter 7");
chapter7.setPages(40);
book.addChapter(chapter7);
}
}
|
repos\Hibernate-SpringBoot-master\HibernateSpringBootDatabaseTriggers\src\main\java\com\bookstore\service\BookstoreService.java
| 2
|
请完成以下Java代码
|
public void setC_UOM_ID (final int C_UOM_ID)
{
if (C_UOM_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_UOM_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_UOM_ID, C_UOM_ID);
}
@Override
public int getC_UOM_ID()
{
return get_ValueAsInt(COLUMNNAME_C_UOM_ID);
}
@Override
public org.eevolution.model.I_PP_Order_Candidate getPP_Order_Candidate()
{
return get_ValueAsPO(COLUMNNAME_PP_Order_Candidate_ID, org.eevolution.model.I_PP_Order_Candidate.class);
}
@Override
public void setPP_Order_Candidate(final org.eevolution.model.I_PP_Order_Candidate PP_Order_Candidate)
{
set_ValueFromPO(COLUMNNAME_PP_Order_Candidate_ID, org.eevolution.model.I_PP_Order_Candidate.class, PP_Order_Candidate);
}
@Override
public void setPP_Order_Candidate_ID (final int PP_Order_Candidate_ID)
{
if (PP_Order_Candidate_ID < 1)
set_ValueNoCheck (COLUMNNAME_PP_Order_Candidate_ID, null);
else
set_ValueNoCheck (COLUMNNAME_PP_Order_Candidate_ID, PP_Order_Candidate_ID);
}
@Override
public int getPP_Order_Candidate_ID()
{
return get_ValueAsInt(COLUMNNAME_PP_Order_Candidate_ID);
}
@Override
public org.eevolution.model.I_PP_Order getPP_Order()
{
return get_ValueAsPO(COLUMNNAME_PP_Order_ID, org.eevolution.model.I_PP_Order.class);
}
@Override
public void setPP_Order(final org.eevolution.model.I_PP_Order PP_Order)
{
set_ValueFromPO(COLUMNNAME_PP_Order_ID, org.eevolution.model.I_PP_Order.class, PP_Order);
}
@Override
public void setPP_Order_ID (final int PP_Order_ID)
{
if (PP_Order_ID < 1)
set_ValueNoCheck (COLUMNNAME_PP_Order_ID, null);
|
else
set_ValueNoCheck (COLUMNNAME_PP_Order_ID, PP_Order_ID);
}
@Override
public int getPP_Order_ID()
{
return get_ValueAsInt(COLUMNNAME_PP_Order_ID);
}
@Override
public void setPP_OrderCandidate_PP_Order_ID (final int PP_OrderCandidate_PP_Order_ID)
{
if (PP_OrderCandidate_PP_Order_ID < 1)
set_ValueNoCheck (COLUMNNAME_PP_OrderCandidate_PP_Order_ID, null);
else
set_ValueNoCheck (COLUMNNAME_PP_OrderCandidate_PP_Order_ID, PP_OrderCandidate_PP_Order_ID);
}
@Override
public int getPP_OrderCandidate_PP_Order_ID()
{
return get_ValueAsInt(COLUMNNAME_PP_OrderCandidate_PP_Order_ID);
}
@Override
public void setQtyEntered (final @Nullable BigDecimal QtyEntered)
{
set_Value (COLUMNNAME_QtyEntered, QtyEntered);
}
@Override
public BigDecimal getQtyEntered()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyEntered);
return bd != null ? bd : BigDecimal.ZERO;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_PP_OrderCandidate_PP_Order.java
| 1
|
请完成以下Java代码
|
public class User {
@GraphQLField
private Long id;
@GraphQLField
private String name;
@GraphQLField
private String email;
@GraphQLField
private Integer age;
public User(String name, String email, Integer age) {
this.id = genId();
this.name = name;
this.email = email;
this.age = age;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setEmail(String email) {
this.email = email;
}
public String getEmail() {
return email;
}
public void setName(String name) {
this.name = name;
}
public Integer getAge() {
return age;
}
|
public void setAge(Integer age) {
this.age = age;
}
public static Long genId() {
Long id = 1L;
try {
List<User> users = new UserHandler().getUsers();
for (User user : users)
id = (user.getId() > id ? user.getId() : id) + 1;
} catch (Exception e) {
e.printStackTrace();
}
return id;
}
public String toString() {
return "[id=" + id + ", name=" + name + ", email="+email+ ", age="+ age +"]";
}
}
|
repos\tutorials-master\graphql-modules\graphql-java\src\main\java\com\baeldung\graphql\entity\User.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getLOCATIONNAME() {
return locationname;
}
/**
* Sets the value of the locationname property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLOCATIONNAME(String value) {
this.locationname = value;
}
/**
* Gets the value of the hfini1 property.
*
* @return
* possible object is
* {@link HFINI1 }
*
*/
public HFINI1 getHFINI1() {
return hfini1;
}
/**
* Sets the value of the hfini1 property.
*
* @param value
* allowed object is
* {@link HFINI1 }
*
*/
public void setHFINI1(HFINI1 value) {
this.hfini1 = value;
}
/**
* Gets the value of the hrfad1 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 hrfad1 property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getHRFAD1().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link HRFAD1 }
*
*
|
*/
public List<HRFAD1> getHRFAD1() {
if (hrfad1 == null) {
hrfad1 = new ArrayList<HRFAD1>();
}
return this.hrfad1;
}
/**
* Gets the value of the hctad1 property.
*
* @return
* possible object is
* {@link HCTAD1 }
*
*/
public HCTAD1 getHCTAD1() {
return hctad1;
}
/**
* Sets the value of the hctad1 property.
*
* @param value
* allowed object is
* {@link HCTAD1 }
*
*/
public void setHCTAD1(HCTAD1 value) {
this.hctad1 = value;
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_stepcom_invoic\de\metas\edi\esb\jaxb\stepcom\invoic\HADRE1.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
private BeanMetadataElement createSaml2LogoutRequestMatcher() {
BeanMetadataElement logoutRequestMatcher = BeanDefinitionBuilder
.rootBeanDefinition(RequestMatcherFactoryBean.class)
.addConstructorArgValue(this.logoutRequestUrl)
.getBeanDefinition();
BeanMetadataElement saml2RequestMatcher = BeanDefinitionBuilder
.rootBeanDefinition(ParameterRequestMatcher.class)
.addConstructorArgValue("SAMLRequest")
.getBeanDefinition();
return BeanDefinitionBuilder.rootBeanDefinition(AndRequestMatcher.class)
.addConstructorArgValue(toManagedList(logoutRequestMatcher, saml2RequestMatcher))
.getBeanDefinition();
}
private BeanMetadataElement createSaml2LogoutResponseMatcher() {
BeanMetadataElement logoutResponseMatcher = BeanDefinitionBuilder
.rootBeanDefinition(RequestMatcherFactoryBean.class)
.addConstructorArgValue(this.logoutResponseUrl)
.getBeanDefinition();
BeanMetadataElement saml2ResponseMatcher = BeanDefinitionBuilder
.rootBeanDefinition(ParameterRequestMatcher.class)
.addConstructorArgValue("SAMLResponse")
.getBeanDefinition();
return BeanDefinitionBuilder.rootBeanDefinition(AndRequestMatcher.class)
.addConstructorArgValue(toManagedList(logoutResponseMatcher, saml2ResponseMatcher))
.getBeanDefinition();
}
private static List<BeanMetadataElement> toManagedList(BeanMetadataElement... elements) {
List<BeanMetadataElement> managedList = new ManagedList<>();
managedList.addAll(Arrays.asList(elements));
return managedList;
}
BeanDefinition getLogoutRequestFilter() {
return this.logoutRequestFilter;
}
BeanDefinition getLogoutResponseFilter() {
return this.logoutResponseFilter;
}
BeanDefinition getLogoutFilter() {
|
return this.logoutFilter;
}
public static class Saml2RequestMatcher implements RequestMatcher {
private SecurityContextHolderStrategy securityContextHolderStrategy = SecurityContextHolder
.getContextHolderStrategy();
@Override
public boolean matches(HttpServletRequest request) {
Authentication authentication = this.securityContextHolderStrategy.getContext().getAuthentication();
if (authentication == null) {
return false;
}
if (authentication.getPrincipal() instanceof Saml2AuthenticatedPrincipal) {
return true;
}
if (authentication.getCredentials() instanceof Saml2ResponseAssertionAccessor) {
return true;
}
return authentication instanceof Saml2Authentication;
}
public void setSecurityContextHolderStrategy(SecurityContextHolderStrategy securityContextHolderStrategy) {
this.securityContextHolderStrategy = securityContextHolderStrategy;
}
}
}
|
repos\spring-security-main\config\src\main\java\org\springframework\security\config\http\Saml2LogoutBeanDefinitionParser.java
| 2
|
请完成以下Java代码
|
public class NullValueImpl implements TypedValue {
private static final long serialVersionUID = 1L;
private boolean isTransient;
// null is always null
public static final NullValueImpl INSTANCE = new NullValueImpl(false);
public static final NullValueImpl INSTANCE_TRANSIENT = new NullValueImpl(true);
private NullValueImpl(boolean isTransient) {
this.isTransient = isTransient;
}
public Object getValue() {
return null;
|
}
public ValueType getType() {
return ValueType.NULL;
}
public String toString() {
return "Untyped 'null' value";
}
@Override
public boolean isTransient() {
return isTransient;
}
}
|
repos\camunda-bpm-platform-master\commons\typed-values\src\main\java\org\camunda\bpm\engine\variable\impl\value\NullValueImpl.java
| 1
|
请完成以下Java代码
|
static void iterateUsingAsMap(Multimap<String, String> multiMap) {
multiMap.asMap()
.entrySet()
.forEach(entry -> LOGGER.info("{} => {}", entry.getKey(), entry.getValue()));
}
static void iterateUsingKeySet(Multimap<String, String> multiMap) {
multiMap.keySet()
.forEach(LOGGER::info);
}
static void iterateUsingKeys(Multimap<String, String> multiMap) {
multiMap.keys()
.forEach(LOGGER::info);
}
static void iterateUsingValues(Multimap<String, String> multiMap) {
multiMap.values()
.forEach(LOGGER::info);
}
|
public static void main(String[] args) {
Multimap<String, String> multiMap = ArrayListMultimap.create();
multiMap.putAll("key1", List.of("value1", "value11", "value111"));
multiMap.putAll("key2", List.of("value2", "value22", "value222"));
multiMap.putAll("key3", List.of("value3", "value33", "value333"));
iterateUsingEntries(multiMap);
iterateUsingAsMap(multiMap);
iterateUsingKeys(multiMap);
iterateUsingKeySet(multiMap);
iterateUsingValues(multiMap);
}
}
|
repos\tutorials-master\guava-modules\guava-collections-map\src\main\java\com\baeldung\guava\multimap\MultimapIteration.java
| 1
|
请完成以下Java代码
|
public TaxInformation3 getTax() {
return tax;
}
/**
* Sets the value of the tax property.
*
* @param value
* allowed object is
* {@link TaxInformation3 }
*
*/
public void setTax(TaxInformation3 value) {
this.tax = value;
}
/**
* Gets the value of the rtrInf property.
*
* @return
* possible object is
* {@link ReturnReasonInformation10 }
*
*/
public ReturnReasonInformation10 getRtrInf() {
return rtrInf;
}
/**
* Sets the value of the rtrInf property.
*
* @param value
* allowed object is
* {@link ReturnReasonInformation10 }
*
*/
public void setRtrInf(ReturnReasonInformation10 value) {
this.rtrInf = value;
}
/**
* Gets the value of the corpActn property.
*
* @return
* possible object is
* {@link CorporateAction1 }
*
*/
public CorporateAction1 getCorpActn() {
return corpActn;
}
/**
* Sets the value of the corpActn property.
*
* @param value
* allowed object is
* {@link CorporateAction1 }
*
*/
public void setCorpActn(CorporateAction1 value) {
this.corpActn = value;
}
/**
* Gets the value of the sfkpgAcct property.
*
* @return
* possible object is
* {@link CashAccount16 }
*
*/
public CashAccount16 getSfkpgAcct() {
return sfkpgAcct;
}
|
/**
* Sets the value of the sfkpgAcct property.
*
* @param value
* allowed object is
* {@link CashAccount16 }
*
*/
public void setSfkpgAcct(CashAccount16 value) {
this.sfkpgAcct = value;
}
/**
* Gets the value of the addtlTxInf property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAddtlTxInf() {
return addtlTxInf;
}
/**
* Sets the value of the addtlTxInf property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAddtlTxInf(String value) {
this.addtlTxInf = 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\EntryTransaction2.java
| 1
|
请完成以下Java代码
|
public String dateAcct(final ICalloutField field)
{
if (isCalloutActive())
{
return NO_ERROR;
}
final Object value = field.getValue();
if (!(value instanceof java.util.Date)/*this also covers value=null*/)
{
return NO_ERROR;
}
final java.util.Date valueDate = (java.util.Date)value;
final Object model = field.getModel(Object.class);
InterfaceWrapperHelper.setValue(model, "DateAcct", TimeUtil.asTimestamp(valueDate));
return NO_ERROR;
} // dateAcct
/**
* Rate - set Multiply Rate from Divide Rate and vice versa
* org.compiere.model.CalloutEngine.rate
*
* @return null or error message
*/
@Deprecated
public String rate(final ICalloutField field)
{
// NOTE: atm this method is used only by UOMConversions. When we will provide an implementation for that, we can get rid of this shit.
final Object value = field.getValue();
if (isCalloutActive() || value == null)
{
|
return NO_ERROR;
}
final BigDecimal rate1 = (BigDecimal)value;
BigDecimal rate2 = BigDecimal.ZERO;
final BigDecimal one = BigDecimal.ONE;
if (rate1.signum() != 0)
{
rate2 = one.divide(rate1, 12, BigDecimal.ROUND_HALF_UP);
}
//
final String columnName = field.getColumnName();
final Object model = field.getModel(Object.class);
if ("MultiplyRate".equals(columnName))
{
InterfaceWrapperHelper.setValue(model, "DivideRate", rate2);
}
else
{
InterfaceWrapperHelper.setValue(model, "MultiplyRate", rate2);
}
log.info("columnName={}; value={} => result={}", columnName, rate1, rate2);
return NO_ERROR;
} // rate
} // CalloutEngine
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\CalloutEngine.java
| 1
|
请完成以下Java代码
|
public void setValueFromPO(final String idPropertyName, final Class<?> parameterType, final Object value)
{
final String propertyName;
if (idPropertyName.endsWith("_ID"))
{
propertyName = idPropertyName.substring(0, idPropertyName.length() - 3);
}
else
{
throw new AdempiereException("Invalid idPropertyName: " + idPropertyName);
}
pojoWrapper.setReferencedObject(propertyName, value);
}
@Override
public boolean invokeEquals(final Object[] methodArgs)
{
return pojoWrapper.invokeEquals(methodArgs);
}
@Override
public Object invokeParent(final Method method, final Object[] methodArgs) throws Exception
{
throw new IllegalStateException("Invoking parent method is not supported");
}
@Override
public boolean isKeyColumnName(final String columnName)
{
|
return pojoWrapper.isKeyColumnName(columnName);
}
@Override
public boolean isCalculated(final String columnName)
{
return pojoWrapper.isCalculated(columnName);
}
@Override
public boolean hasColumnName(String columnName)
{
return pojoWrapper.hasColumnName(columnName);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\wrapper\POJOModelInternalAccessor.java
| 1
|
请完成以下Java代码
|
public Quantity getQtyAvailableToAllocate(final UomId uomId)
{
return uomConverter.convertQuantityTo(getQtyAvailableToAllocateInHuUom(), productId, uomId);
}
public Quantity getQtyAvailableToAllocateInHuUom()
{
final Quantity qtyStorageInHuUom = getStorageQtyInHuUom();
return qtyAllocatedInHuUom != null
? qtyStorageInHuUom.subtract(qtyAllocatedInHuUom)
: qtyStorageInHuUom;
}
private Quantity getStorageQtyInHuUom()
{
Quantity storageQtyInHuUom = this._storageQtyInHuUom;
if (storageQtyInHuUom == null)
{
storageQtyInHuUom = this._storageQtyInHuUom = storageFactory.getStorage(topLevelHU).getProductStorage(productId).getQty();
}
return storageQtyInHuUom;
}
public void addQtyAllocated(@NonNull final Quantity qtyAllocatedToAdd0)
{
final Quantity storageQtyInHuUom = getStorageQtyInHuUom();
final Quantity qtyAllocatedToAddInHuUom = uomConverter.convertQuantityTo(qtyAllocatedToAdd0, productId, storageQtyInHuUom.getUomId());
|
final Quantity newQtyAllocatedInHuUom = this.qtyAllocatedInHuUom != null
? this.qtyAllocatedInHuUom.add(qtyAllocatedToAddInHuUom)
: qtyAllocatedToAddInHuUom;
if (newQtyAllocatedInHuUom.isGreaterThan(storageQtyInHuUom))
{
throw new AdempiereException("Over-allocating is not allowed")
.appendParametersToMessage()
.setParameter("this.qtyAllocated", this.qtyAllocatedInHuUom)
.setParameter("newQtyAllocated", newQtyAllocatedInHuUom)
.setParameter("storageQty", storageQtyInHuUom);
}
this.qtyAllocatedInHuUom = newQtyAllocatedInHuUom;
}
public boolean hasQtyAvailable()
{
return getQtyAvailableToAllocateInHuUom().signum() > 0;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\manufacturing\issue\plan\AllocableHU.java
| 1
|
请完成以下Java代码
|
public class DeleteProcessInstanceCmd implements Command<Void>, Serializable {
private static final long serialVersionUID = 1L;
protected String processInstanceId;
protected String deleteReason;
public DeleteProcessInstanceCmd(String processInstanceId, String deleteReason) {
this.processInstanceId = processInstanceId;
this.deleteReason = deleteReason;
}
@Override
public Void execute(CommandContext commandContext) {
if (processInstanceId == null) {
throw new FlowableIllegalArgumentException("processInstanceId is null");
}
ExecutionEntity processInstanceEntity = CommandContextUtil.getExecutionEntityManager(commandContext).findById(processInstanceId);
if (processInstanceEntity == null) {
throw new FlowableObjectNotFoundException("No process instance found for id '" + processInstanceId + "'", ProcessInstance.class);
}
|
if (processInstanceEntity.isDeleted()) {
return null;
}
if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, processInstanceEntity.getProcessDefinitionId())) {
Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();
compatibilityHandler.deleteProcessInstance(processInstanceId, deleteReason);
} else {
CommandContextUtil.getExecutionEntityManager(commandContext).deleteProcessInstance(processInstanceEntity.getProcessInstanceId(), deleteReason, false, true);
}
return null;
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\cmd\DeleteProcessInstanceCmd.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class PackageId implements RepoIdAware
{
int repoId;
@JsonCreator
public static PackageId ofRepoId(final int repoId)
{
return new PackageId(repoId);
}
public static PackageId ofRepoIdOrNull(final int repoId)
{
return repoId > 0 ? new PackageId(repoId) : null;
}
public static int toRepoId(final PackageId id)
|
{
return id != null ? id.getRepoId() : -1;
}
private PackageId(final int repoId)
{
this.repoId = Check.assumeGreaterThanZero(repoId, "M_Package_ID");
}
@Override
@JsonValue
public int getRepoId()
{
return repoId;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\shipping\mpackage\PackageId.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
private static JsonRfqQty toJsonRfqQty(
@NonNull final RfqQty rfqQty,
@NonNull final String uom,
@NonNull final Locale locale)
{
final BigDecimal qtyPromised = rfqQty.getQtyPromisedUserEntered();
return JsonRfqQty.builder()
.date(rfqQty.getDatePromised())
.dayCaption(DateUtils.getDayName(rfqQty.getDatePromised(), locale))
.qtyPromised(qtyPromised)
.qtyPromisedRendered(renderQty(qtyPromised, uom, locale))
.confirmedByUser(rfqQty.isConfirmedByUser())
.build();
}
private static JsonRfqQty toZeroJsonRfqQty(
@NonNull final LocalDate date,
@NonNull final String uom,
@NonNull final Locale locale)
{
return JsonRfqQty.builder()
.date(date)
.dayCaption(DateUtils.getDayName(date, locale))
.qtyPromised(BigDecimal.ZERO)
.qtyPromisedRendered(renderQty(BigDecimal.ZERO, uom, locale))
.confirmedByUser(true)
|
.build();
}
private static String renderQty(
@NonNull final BigDecimal qty,
@NonNull final String uom,
@NonNull final Locale locale)
{
final NumberFormat formatter = NumberFormat.getNumberInstance(locale);
return formatter.format(qty) + " " + uom;
}
private static String renderPrice(
@NonNull final BigDecimal price,
@NonNull final String currencyCode,
@NonNull final Locale locale)
{
final NumberFormat formatter = NumberFormat.getNumberInstance(locale);
return formatter.format(price) + " " + currencyCode;
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\procurement-webui\procurement-webui-backend\src\main\java\de\metas\procurement\webui\rest\rfq\RfQRestController.java
| 2
|
请完成以下Java代码
|
public Class<?> getCommonPropertyType(ELContext context, Object base) {
if (this.subject.isInstance(base)) {
return Object.class;
} else {
return null;
}
}
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
return null;
}
@Override
public Class<?> getType(ELContext context, Object base, Object property) {
if (base == null || this.getCommonPropertyType(context, base) == null) {
return null;
}
context.setPropertyResolved(true);
return Object.class;
}
@Override
public Object getValue(ELContext context, Object base, Object property) {
if (base == null || this.getCommonPropertyType(context, base) == null) {
return null;
}
String propertyName = property.toString();
|
try {
Object value = ReflectUtil.invoke(base, this.readMethodName, new Object[] { propertyName });
context.setPropertyResolved(true);
return value;
} catch (Exception e) {
throw new ELException(e);
}
}
@Override
public boolean isReadOnly(ELContext context, Object base, Object property) {
return this.readOnly;
}
@Override
public void setValue(ELContext context, Object base, Object property, Object value) {
if (base == null || this.getCommonPropertyType(context, base) == null) {
return;
}
String propertyName = property.toString();
try {
ReflectUtil.invoke(base, this.writeMethodName, new Object[] { propertyName, value });
context.setPropertyResolved(true);
} catch (Exception e) {
throw new ELException(e);
}
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\el\DynamicBeanPropertyELResolver.java
| 1
|
请完成以下Java代码
|
private void setDescription(final String description)
{
fieldDescription.setValue(description, true);
}
private <T> T toModel(final Class<T> modelClass, final Object idObj)
{
final int id = toID(idObj);
if (id <= 0)
{
return null;
}
return InterfaceWrapperHelper.create(getCtx(), id, modelClass, ITrx.TRXNAME_None);
}
private static final int toID(final Object idObj)
{
if (idObj == null)
{
return -1;
}
else if (idObj instanceof Number)
{
return ((Number)idObj).intValue();
}
else
{
return -1;
}
}
private void doConvert(final String reason)
{
// Reset
setDescription(null);
setQtyConv(null);
final I_C_UOM uomFrom = getC_UOM();
final I_C_UOM uomTo = getC_UOM_To();
if (uomFrom == null || uomTo == null)
{
return;
}
final I_M_Product product = getM_Product();
final BigDecimal qty = getQty();
try
|
{
final BigDecimal qtyConv;
if (product != null)
{
final UOMConversionContext conversionCtx = UOMConversionContext.of(product);
qtyConv = uomConversionBL.convertQty(conversionCtx, qty, uomFrom, uomTo);
}
else
{
qtyConv = uomConversionBL.convert(uomFrom, uomTo, qty).orElse(null);
}
setQtyConv(qtyConv);
setDescription("Converted "
+ NumberUtils.stripTrailingDecimalZeros(qty) + " " + uomFrom.getUOMSymbol()
+ " to "
+ NumberUtils.stripTrailingDecimalZeros(qtyConv) + " " + uomTo.getUOMSymbol()
+ "<br>Product: " + (product == null ? "-" : product.getName())
+ "<br>Reason: " + reason);
}
catch (final Exception e)
{
setDescription(e.getLocalizedMessage());
// because this is a test form, printing the exception directly to console it's totally fine.
// More, if we would log it as WARNING/SEVERE, an AD_Issue would be created, but we don't want that.
e.printStackTrace();
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java\de\metas\uom\form\UOMConversionCheckFormPanel.java
| 1
|
请完成以下Java代码
|
private BestellungAnteil toJAXB(final OrderResponsePackageItemPart itemPart)
{
final BestellungAnteil soap = jaxbObjectFactory.createBestellungAnteil();
soap.setMenge(itemPart.getQty().getValueAsInt());
final String type = Type.getValueOrNull(itemPart.getType());
if (type != null)
{
soap.setTyp(BestellungRueckmeldungTyp.fromValue(type));
}
soap.setLieferzeitpunkt(JAXBDateUtils.toXMLGregorianCalendar(itemPart.getDeliveryDate()));
soap.setGrund(itemPart.getDefectReason().getV2SoapCode());
soap.setTour(itemPart.getTour());
soap.setTourId(itemPart.getTourId());
soap.setTourabweichung(itemPart.isTourDeviation());
return soap;
}
private OrderResponsePackageItemSubstitution fromJAXB(final BestellungSubstitution soap)
{
if (soap == null)
{
return null;
}
return OrderResponsePackageItemSubstitution.builder()
.substitutionReason(OrderSubstitutionReason.fromV2SoapCode(soap.getSubstitutionsgrund()))
.defectReason(OrderDefectReason.fromV2SoapCode(soap.getGrund()))
.pzn(PZN.of(soap.getLieferPzn()))
.build();
}
|
private BestellungSubstitution toJAXB(final OrderResponsePackageItemSubstitution itemSubstitution)
{
if (itemSubstitution == null)
{
return null;
}
final BestellungSubstitution soap = jaxbObjectFactory.createBestellungSubstitution();
soap.setSubstitutionsgrund(itemSubstitution.getSubstitutionReason().getV2SoapCode());
soap.setGrund(itemSubstitution.getDefectReason().getV2SoapCode());
soap.setLieferPzn(itemSubstitution.getPzn().getValueAsLong());
return soap;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.msv3.commons\src\main\java\de\metas\vertical\pharma\msv3\protocol\order\v2\OrderJAXBConvertersV2.java
| 1
|
请完成以下Java代码
|
private void validatePackaging(String packaging, InitializrMetadata metadata) {
if (packaging != null) {
DefaultMetadataElement packagingFromMetadata = metadata.getPackagings().get(packaging);
if (packagingFromMetadata == null) {
throw new InvalidProjectRequestException(
"Unknown packaging '" + packaging + "' check project metadata");
}
}
}
private void validateDependencies(ProjectRequest request, InitializrMetadata metadata) {
List<String> dependencies = request.getDependencies();
dependencies.forEach((dep) -> {
Dependency dependency = metadata.getDependencies().get(dep);
if (dependency == null) {
throw new InvalidProjectRequestException("Unknown dependency '" + dep + "' check project metadata");
}
});
}
private void validateDependencyRange(Version platformVersion, List<Dependency> resolvedDependencies) {
resolvedDependencies.forEach((dep) -> {
if (!dep.match(platformVersion)) {
throw new InvalidProjectRequestException(
"Dependency '" + dep.getId() + "' is not compatible " + "with Spring Boot " + platformVersion);
}
});
}
|
private BuildSystem getBuildSystem(ProjectRequest request, InitializrMetadata metadata) {
Map<String, String> typeTags = metadata.getTypes().get(request.getType()).getTags();
String id = typeTags.get("build");
String dialect = typeTags.get("dialect");
return BuildSystem.forIdAndDialect(id, dialect);
}
private Version getPlatformVersion(ProjectRequest request, InitializrMetadata metadata) {
String versionText = (request.getBootVersion() != null) ? request.getBootVersion()
: metadata.getBootVersions().getDefault().getId();
Version version = Version.parse(versionText);
return this.platformVersionTransformer.transform(version, metadata);
}
private List<Dependency> getResolvedDependencies(ProjectRequest request, Version platformVersion,
InitializrMetadata metadata) {
List<String> depIds = request.getDependencies();
return depIds.stream().map((it) -> {
Dependency dependency = metadata.getDependencies().get(it);
return dependency.resolve(platformVersion);
}).collect(Collectors.toList());
}
}
|
repos\initializr-main\initializr-web\src\main\java\io\spring\initializr\web\project\DefaultProjectRequestToDescriptionConverter.java
| 1
|
请完成以下Java代码
|
public int getOrder() {
return this.order;
}
public void setOrder(int order) {
this.order = order;
}
@Override
public void afterPropertiesSet() {
Assert.hasLength(this.realmName, "realmName must be specified");
Assert.hasLength(this.key, "key must be specified");
}
@Override
public void commence(HttpServletRequest request, HttpServletResponse response,
AuthenticationException authException) throws IOException {
// compute a nonce (do not use remote IP address due to proxy farms) format of
// nonce is: base64(expirationTime + ":" + md5Hex(expirationTime + ":" + key))
long expiryTime = System.currentTimeMillis() + (this.nonceValiditySeconds * 1000);
String signatureValue = DigestAuthUtils.md5Hex(expiryTime + ":" + this.key);
String nonceValue = expiryTime + ":" + signatureValue;
String nonceValueBase64 = new String(Base64.getEncoder().encode(nonceValue.getBytes()));
// qop is quality of protection, as defined by RFC 2617. We do not use opaque due
// to IE violation of RFC 2617 in not representing opaque on subsequent requests
// in same session.
String authenticateHeader = "Digest realm=\"" + this.realmName + "\", " + "qop=\"auth\", nonce=\""
+ nonceValueBase64 + "\"";
if (authException instanceof NonceExpiredException) {
authenticateHeader = authenticateHeader + ", stale=\"true\"";
}
logger.debug(LogMessage.format("WWW-Authenticate header sent to user agent: %s", authenticateHeader));
response.addHeader("WWW-Authenticate", authenticateHeader);
response.sendError(HttpStatus.UNAUTHORIZED.value(), HttpStatus.UNAUTHORIZED.getReasonPhrase());
}
public @Nullable String getKey() {
return this.key;
}
public int getNonceValiditySeconds() {
return this.nonceValiditySeconds;
|
}
public @Nullable String getRealmName() {
return this.realmName;
}
public void setKey(String key) {
this.key = key;
}
public void setNonceValiditySeconds(int nonceValiditySeconds) {
this.nonceValiditySeconds = nonceValiditySeconds;
}
public void setRealmName(String realmName) {
this.realmName = realmName;
}
}
|
repos\spring-security-main\web\src\main\java\org\springframework\security\web\authentication\www\DigestAuthenticationEntryPoint.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class DatasourceController extends BladeController {
private IDatasourceService datasourceService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入datasource")
public R<Datasource> detail(Datasource datasource) {
Datasource detail = datasourceService.getOne(Condition.getQueryWrapper(datasource));
return R.data(detail);
}
/**
* 分页 数据源配置表
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入datasource")
public R<IPage<Datasource>> list(Datasource datasource, Query query) {
IPage<Datasource> pages = datasourceService.page(Condition.getPage(query), Condition.getQueryWrapper(datasource));
return R.data(pages);
}
/**
* 新增 数据源配置表
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入datasource")
public R save(@Valid @RequestBody Datasource datasource) {
return R.status(datasourceService.save(datasource));
}
/**
* 修改 数据源配置表
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入datasource")
public R update(@Valid @RequestBody Datasource datasource) {
return R.status(datasourceService.updateById(datasource));
}
/**
* 新增或修改 数据源配置表
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入datasource")
public R submit(@Valid @RequestBody Datasource datasource) {
|
datasource.setUrl(datasource.getUrl().replace("&", "&"));
return R.status(datasourceService.saveOrUpdate(datasource));
}
/**
* 删除 数据源配置表
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(datasourceService.deleteLogic(Func.toLongList(ids)));
}
/**
* 数据源列表
*/
@GetMapping("/select")
@ApiOperationSupport(order = 8)
@Operation(summary = "下拉数据源", description = "查询列表")
public R<List<Datasource>> select() {
List<Datasource> list = datasourceService.list();
return R.data(list);
}
}
|
repos\SpringBlade-master\blade-ops\blade-develop\src\main\java\org\springblade\develop\controller\DatasourceController.java
| 2
|
请完成以下Java代码
|
public DepartIdModel convert(SysDepartTreeModel treeModel) {
this.key = treeModel.getId();
this.value = treeModel.getId();
this.title = treeModel.getDepartName();
return this;
}
/**
* 该方法为用户部门的实现类所使用
* @param sysDepart
* @return
*/
public DepartIdModel convertByUserDepart(SysDepart sysDepart) {
this.key = sysDepart.getId();
this.value = sysDepart.getId();
this.code = sysDepart.getOrgCode();
this.title = sysDepart.getDepartName();
return this;
}
public List<DepartIdModel> getChildren() {
return children;
}
public void setChildren(List<DepartIdModel> children) {
this.children = children;
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
public String getKey() {
return key;
|
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-module-system\jeecg-system-biz\src\main\java\org\jeecg\modules\system\model\DepartIdModel.java
| 1
|
请完成以下Java代码
|
public class Term
{
/**
* 词语
*/
public String word;
/**
* 词性
*/
public Nature nature;
/**
* 在文本中的起始位置(需开启分词器的offset选项)
*/
public int offset;
/**
* 构造一个单词
* @param word 词语
* @param nature 词性
*/
public Term(String word, Nature nature)
{
this.word = word;
this.nature = nature;
}
@Override
public String toString()
{
if (HanLP.Config.ShowTermNature)
return word + "/" + nature;
return word;
}
|
/**
* 长度
* @return
*/
public int length()
{
return word.length();
}
/**
* 获取本词语在HanLP词库中的频次
* @return 频次,0代表这是个OOV
*/
public int getFrequency()
{
return LexiconUtility.getFrequency(word);
}
/**
* 判断Term是否相等
*/
@Override
public boolean equals(Object obj) {
if (obj instanceof Term)
{
Term term = (Term)obj;
if (this.nature == term.nature && this.word.equals(term.word))
{
return true;
}
}
return super.equals(obj);
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\seg\common\Term.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public static StaticResourceRequest toStaticResources() {
return StaticResourceRequest.INSTANCE;
}
/**
* Returns a matcher that includes the H2 console location. For example:
* <pre class="code">
* PathRequest.toH2Console()
* </pre>
* @return the configured {@link RequestMatcher}
*/
public static H2ConsoleRequestMatcher toH2Console() {
return new H2ConsoleRequestMatcher();
}
/**
* The request matcher used to match against h2 console path.
*/
public static final class H2ConsoleRequestMatcher extends ApplicationContextRequestMatcher<ApplicationContext> {
private volatile @Nullable RequestMatcher delegate;
private H2ConsoleRequestMatcher() {
super(ApplicationContext.class);
}
|
@Override
protected boolean ignoreApplicationContext(WebApplicationContext applicationContext) {
return hasServerNamespace(applicationContext, "management");
}
@Override
protected void initialized(Supplier<ApplicationContext> context) {
String path = context.get().getBean(H2ConsoleProperties.class).getPath();
Assert.hasText(path, "'path' in H2ConsoleProperties must not be empty");
this.delegate = PathPatternRequestMatcher.withDefaults().matcher(path + "/**");
}
@Override
protected boolean matches(HttpServletRequest request, Supplier<ApplicationContext> context) {
RequestMatcher delegate = this.delegate;
Assert.state(delegate != null, "'delegate' must not be null");
return delegate.matches(request);
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-security\src\main\java\org\springframework\boot\security\autoconfigure\web\servlet\PathRequest.java
| 2
|
请完成以下Java代码
|
public <T> T execute(final Command<T> command) {
ProcessApplicationIdentifier processApplicationIdentifier = ProcessApplicationContextImpl.get();
if (processApplicationIdentifier != null) {
// clear the identifier so this interceptor does not apply to nested commands
ProcessApplicationContextImpl.clear();
try {
ProcessApplicationReference reference = getPaReference(processApplicationIdentifier);
return Context.executeWithinProcessApplication(new Callable<T>() {
@Override
public T call() throws Exception {
return next.execute(command);
}
},
reference);
}
finally {
// restore the identifier for subsequent commands
ProcessApplicationContextImpl.set(processApplicationIdentifier);
}
}
else {
return next.execute(command);
}
}
protected ProcessApplicationReference getPaReference(ProcessApplicationIdentifier processApplicationIdentifier) {
if (processApplicationIdentifier.getReference() != null) {
return processApplicationIdentifier.getReference();
}
else if (processApplicationIdentifier.getProcessApplication() != null) {
|
return processApplicationIdentifier.getProcessApplication().getReference();
}
else if (processApplicationIdentifier.getName() != null) {
RuntimeContainerDelegate runtimeContainerDelegate = RuntimeContainerDelegate.INSTANCE.get();
ProcessApplicationReference reference = runtimeContainerDelegate.getDeployedProcessApplication(processApplicationIdentifier.getName());
if (reference == null) {
throw LOG.paWithNameNotRegistered(processApplicationIdentifier.getName());
}
else {
return reference;
}
}
else {
throw LOG.cannotReolvePa(processApplicationIdentifier);
}
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\interceptor\ProcessApplicationContextInterceptor.java
| 1
|
请完成以下Java代码
|
public static final boolean lt(TypeConverter converter, Object o1, Object o2) {
if (o1 == o2) {
return false;
}
if (o1 == null || o2 == null) {
return false;
}
return lt0(converter, o1, o2);
}
public static final boolean gt(TypeConverter converter, Object o1, Object o2) {
if (o1 == o2) {
return false;
}
if (o1 == null || o2 == null) {
return false;
}
return gt0(converter, o1, o2);
}
public static final boolean ge(TypeConverter converter, Object o1, Object o2) {
if (o1 == o2) {
return true;
}
if (o1 == null || o2 == null) {
return false;
}
return !lt0(converter, o1, o2);
}
public static final boolean le(TypeConverter converter, Object o1, Object o2) {
if (o1 == o2) {
return true;
}
if (o1 == null || o2 == null) {
return false;
}
return !gt0(converter, o1, o2);
}
public static final boolean eq(TypeConverter converter, Object o1, Object o2) {
if (o1 == o2) {
return true;
}
if (o1 == null || o2 == null) {
return false;
}
Class<?> t1 = o1.getClass();
Class<?> t2 = o2.getClass();
if (BigDecimal.class.isAssignableFrom(t1) || BigDecimal.class.isAssignableFrom(t2)) {
return converter.convert(o1, BigDecimal.class).equals(converter.convert(o2, BigDecimal.class));
}
if (SIMPLE_FLOAT_TYPES.contains(t1) || SIMPLE_FLOAT_TYPES.contains(t2)) {
return converter.convert(o1, Double.class).equals(converter.convert(o2, Double.class));
}
if (BigInteger.class.isAssignableFrom(t1) || BigInteger.class.isAssignableFrom(t2)) {
return converter.convert(o1, BigInteger.class).equals(converter.convert(o2, BigInteger.class));
}
if (SIMPLE_INTEGER_TYPES.contains(t1) || SIMPLE_INTEGER_TYPES.contains(t2)) {
return converter.convert(o1, Long.class).equals(converter.convert(o2, Long.class));
}
if (t1 == Boolean.class || t2 == Boolean.class) {
|
return converter.convert(o1, Boolean.class).equals(converter.convert(o2, Boolean.class));
}
if (o1 instanceof Enum<?>) {
return o1 == converter.convert(o2, o1.getClass());
}
if (o2 instanceof Enum<?>) {
return converter.convert(o1, o2.getClass()) == o2;
}
if (t1 == String.class || t2 == String.class) {
return converter.convert(o1, String.class).equals(converter.convert(o2, String.class));
}
return o1.equals(o2);
}
public static final boolean ne(TypeConverter converter, Object o1, Object o2) {
return !eq(converter, o1, o2);
}
public static final boolean empty(TypeConverter converter, Object o) {
if (o == null || "".equals(o)) {
return true;
}
if (o instanceof Object[]) {
return ((Object[])o).length == 0;
}
if (o instanceof Map<?,?>) {
return ((Map<?,?>)o).isEmpty();
}
if (o instanceof Collection<?>) {
return ((Collection<?>)o).isEmpty();
}
return false;
}
}
|
repos\camunda-bpm-platform-master\juel\src\main\java\org\camunda\bpm\impl\juel\BooleanOperations.java
| 1
|
请完成以下Java代码
|
public void setC_Location_ID (final int C_Location_ID)
{
if (C_Location_ID < 1)
set_Value (COLUMNNAME_C_Location_ID, null);
else
set_Value (COLUMNNAME_C_Location_ID, C_Location_ID);
}
@Override
public int getC_Location_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Location_ID);
}
@Override
public void setDescription (final @Nullable java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
@Override
public java.lang.String getDescription()
{
return get_ValueAsString(COLUMNNAME_Description);
}
@Override
public void setESR_PostBank (final boolean ESR_PostBank)
{
set_Value (COLUMNNAME_ESR_PostBank, ESR_PostBank);
}
@Override
public boolean isESR_PostBank()
{
return get_ValueAsBoolean(COLUMNNAME_ESR_PostBank);
}
@Override
public void setIsCashBank (final boolean IsCashBank)
{
set_Value (COLUMNNAME_IsCashBank, IsCashBank);
}
@Override
public boolean isCashBank()
{
return get_ValueAsBoolean(COLUMNNAME_IsCashBank);
}
@Override
public void setIsImportAsSingleSummaryLine (final boolean IsImportAsSingleSummaryLine)
{
set_Value (COLUMNNAME_IsImportAsSingleSummaryLine, IsImportAsSingleSummaryLine);
}
@Override
public boolean isImportAsSingleSummaryLine()
{
return get_ValueAsBoolean(COLUMNNAME_IsImportAsSingleSummaryLine);
}
@Override
public void setIsOwnBank (final boolean IsOwnBank)
{
set_Value (COLUMNNAME_IsOwnBank, IsOwnBank);
}
|
@Override
public boolean isOwnBank()
{
return get_ValueAsBoolean(COLUMNNAME_IsOwnBank);
}
@Override
public void setName (final java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
@Override
public void setRoutingNo (final java.lang.String RoutingNo)
{
set_Value (COLUMNNAME_RoutingNo, RoutingNo);
}
@Override
public java.lang.String getRoutingNo()
{
return get_ValueAsString(COLUMNNAME_RoutingNo);
}
@Override
public void setSwiftCode (final @Nullable java.lang.String SwiftCode)
{
set_Value (COLUMNNAME_SwiftCode, SwiftCode);
}
@Override
public java.lang.String getSwiftCode()
{
return get_ValueAsString(COLUMNNAME_SwiftCode);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Bank.java
| 1
|
请完成以下Java代码
|
public void setC_CycleStep_ID (int C_CycleStep_ID)
{
if (C_CycleStep_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_CycleStep_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_CycleStep_ID, Integer.valueOf(C_CycleStep_ID));
}
/** Get Cycle Step.
@return The step for this Cycle
*/
public int getC_CycleStep_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_CycleStep_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());
}
/** Set Relative Weight.
@param RelativeWeight
Relative weight of this step (0 = ignored)
*/
public void setRelativeWeight (BigDecimal RelativeWeight)
{
set_Value (COLUMNNAME_RelativeWeight, RelativeWeight);
}
/** Get Relative Weight.
@return Relative weight of this step (0 = ignored)
*/
|
public BigDecimal getRelativeWeight ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_RelativeWeight);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Sequence.
@param SeqNo
Method of ordering records; lowest number comes first
*/
public void setSeqNo (int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo));
}
/** Get Sequence.
@return Method of ordering records; lowest number comes first
*/
public int getSeqNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_CycleStep.java
| 1
|
请完成以下Java代码
|
public class Person {
String name;
String address;
public Person(String name, String address) {
this.name = name;
this.address = address;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
|
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
@Override
public String toString() {
return "Person [name: " + getName() + " address: " + getAddress() + "]";
}
}
|
repos\tutorials-master\web-modules\jersey\src\main\java\com\baeldung\jersey\server\model\Person.java
| 1
|
请完成以下Java代码
|
public class RepositorySettings implements Serializable {
private static final long serialVersionUID = -3211552851889198721L;
private String repositoryUri;
private RepositoryAuthMethod authMethod;
private String username;
private String password;
private String privateKeyFileName;
private String privateKey;
private String privateKeyPassword;
private String defaultBranch;
private boolean readOnly;
private boolean showMergeCommits;
private boolean localOnly;
public RepositorySettings() {
}
|
public RepositorySettings(RepositorySettings settings) {
this.repositoryUri = settings.getRepositoryUri();
this.authMethod = settings.getAuthMethod();
this.username = settings.getUsername();
this.password = settings.getPassword();
this.privateKeyFileName = settings.getPrivateKeyFileName();
this.privateKey = settings.getPrivateKey();
this.privateKeyPassword = settings.getPrivateKeyPassword();
this.defaultBranch = settings.getDefaultBranch();
this.readOnly = settings.isReadOnly();
this.showMergeCommits = settings.isShowMergeCommits();
this.localOnly = settings.isLocalOnly();
}
}
|
repos\thingsboard-master\common\data\src\main\java\org\thingsboard\server\common\data\sync\vc\RepositorySettings.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public boolean isDeployResources() {
return deployResources;
}
public void setDeployResources(boolean deployResources) {
this.deployResources = deployResources;
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public boolean isHistoryEnabled() {
return historyEnabled;
}
public void setHistoryEnabled(boolean historyEnabled) {
this.historyEnabled = historyEnabled;
}
|
public boolean isEnableSafeXml() {
return enableSafeXml;
}
public void setEnableSafeXml(boolean enableSafeXml) {
this.enableSafeXml = enableSafeXml;
}
public boolean isStrictMode() {
return strictMode;
}
public void setStrictMode(boolean strictMode) {
this.strictMode = strictMode;
}
public FlowableServlet getServlet() {
return servlet;
}
}
|
repos\flowable-engine-main\modules\flowable-spring-boot\flowable-spring-boot-starters\flowable-spring-boot-autoconfigure\src\main\java\org\flowable\spring\boot\dmn\FlowableDmnProperties.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public BatchPart create() {
if (batch == null) {
throw new FlowableIllegalArgumentException("batch has to be provided");
}
if (type == null) {
throw new FlowableIllegalArgumentException("type has to be provided");
}
if (commandExecutor != null) {
return commandExecutor.execute(commandContext -> createSafe());
} else {
return createSafe();
}
}
protected BatchPart createSafe() {
BatchPartEntityManager partEntityManager = batchServiceConfiguration.getBatchPartEntityManager();
BatchPartEntity batchPart = partEntityManager.create();
batchPart.setBatchId(batch.getId());
batchPart.setBatchType(batch.getBatchType());
batchPart.setBatchSearchKey(batch.getBatchSearchKey());
batchPart.setBatchSearchKey2(batch.getBatchSearchKey2());
if (batch.getTenantId() != null) {
batchPart.setTenantId(batch.getTenantId());
}
|
batchPart.setType(type);
batchPart.setSearchKey(searchKey);
batchPart.setSearchKey2(searchKey2);
batchPart.setStatus(status);
batchPart.setScopeId(scopeId);
batchPart.setSubScopeId(subScopeId);
batchPart.setScopeType(scopeType);
batchPart.setCreateTime(batchServiceConfiguration.getClock().getCurrentTime());
partEntityManager.insert(batchPart);
return batchPart;
}
}
|
repos\flowable-engine-main\modules\flowable-batch-service\src\main\java\org\flowable\batch\service\BatchPartBuilderImpl.java
| 2
|
请完成以下Java代码
|
public static String toString(JSONObject o) throws JSONException {
StringBuilder sb = new StringBuilder();
sb.append(escape(o.getString("name")));
sb.append("=");
sb.append(escape(o.getString("value")));
if (o.has("expires")) {
sb.append(";expires=");
sb.append(o.getString("expires"));
}
if (o.has("domain")) {
sb.append(";domain=");
sb.append(escape(o.getString("domain")));
}
if (o.has("path")) {
sb.append(";path=");
sb.append(escape(o.getString("path")));
}
if (o.optBoolean("secure")) {
sb.append(";secure");
}
return sb.toString();
}
/**
* Convert <code>%</code><i>hh</i> sequences to single characters, and convert plus to space.
*
* @param s
* A string that may contain <code>+</code> <small>(plus)</small> and <code>%</code><i>hh</i> sequences.
* @return The unescaped string.
*/
public static String unescape(String s) {
int len = s.length();
StringBuilder b = new StringBuilder();
for (int i = 0; i < len; ++i) {
|
char c = s.charAt(i);
if (c == '+') {
c = ' ';
} else if (c == '%' && i + 2 < len) {
int d = JSONTokener.dehexchar(s.charAt(i + 1));
int e = JSONTokener.dehexchar(s.charAt(i + 2));
if (d >= 0 && e >= 0) {
c = (char) (d * 16 + e);
i += 2;
}
}
b.append(c);
}
return b.toString();
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\util\json\Cookie.java
| 1
|
请完成以下Java代码
|
public boolean getDone() {
return done;
}
public Date getCreatedOn() {
return createdOn;
}
public Date getCompletedOn() {
return completedOn;
}
public void setDone(boolean done) {
this.done = done;
}
|
public void setCompletedOn(Date completedOn) {
this.completedOn = completedOn;
}
public long doneSince() {
return done ? Duration
.between(createdOn.toInstant(), completedOn.toInstant())
.toMinutes() : 0;
}
public Function<Object, Object> handleDone() {
return (obj) -> done ? String.format("<small>Done %s minutes ago<small>", obj) : "";
}
}
|
repos\tutorials-master\mustache\src\main\java\com\baeldung\mustache\model\Todo.java
| 1
|
请完成以下Java代码
|
public class MBPartnerLocation extends X_C_BPartner_Location
{
private static final IQueryBL queryBL = Services.get(IQueryBL.class);
private static final IBPartnerDAO bpartnerDAO = Services.get(IBPartnerDAO.class);
public MBPartnerLocation(final Properties ctx, final int C_BPartner_Location_ID, final String trxName)
{
super(ctx, C_BPartner_Location_ID, trxName);
if (is_new())
{
setName(".");
//
setIsShipTo(true);
setIsRemitTo(true);
setIsPayFrom(true);
setIsBillTo(true);
}
}
@Deprecated
public MBPartnerLocation(final I_C_BPartner bp)
{
this(InterfaceWrapperHelper.getCtx(bp),
0,
InterfaceWrapperHelper.getTrxName(bp));
setClientOrg(InterfaceWrapperHelper.getPO(bp));
// may (still) be 0
set_ValueNoCheck("C_BPartner_ID", bp.getC_BPartner_ID());
}
public MBPartnerLocation(final Properties ctx, final ResultSet rs, final String trxName)
{
super(ctx, rs, trxName);
}
@Override
public String toString()
{
return "MBPartnerLocation[ID=" + get_ID()
+ ",C_Location_ID=" + getC_Location_ID()
+ ",Name=" + getName()
+ "]";
}
@Override
protected boolean beforeSave(final boolean newRecord)
|
{
if (getC_Location_ID() <= 0)
{
throw new FillMandatoryException(COLUMNNAME_C_Location_ID);
}
// Set New Name only if new record
if (newRecord)
{
final int cBPartnerId = getC_BPartner_ID();
// gh12157: Please, keep in sync with de.metas.bpartner.quick_input.callout.C_BPartner_Location_QuickInput.onLocationChanged
setName(MakeUniqueLocationNameCommand.builder()
.name(getName())
.address(getC_Location())
.companyName(bpartnerDAO.getBPartnerNameById(BPartnerId.ofRepoId(cBPartnerId)))
.existingNames(getOtherLocationNames(cBPartnerId, getC_BPartner_Location_ID()))
.maxLength(getPOInfo().getFieldLength(I_C_BPartner_Location.COLUMNNAME_Name))
.build()
.execute());
}
return true;
}
private static List<String> getOtherLocationNames(
final int bpartnerId,
final int bpartnerLocationIdToExclude)
{
return queryBL
.createQueryBuilder(I_C_BPartner_Location.class)
.addEqualsFilter(I_C_BPartner_Location.COLUMNNAME_C_BPartner_ID, bpartnerId)
.addNotEqualsFilter(I_C_BPartner_Location.COLUMNNAME_C_BPartner_Location_ID, bpartnerLocationIdToExclude)
.create()
.listDistinct(I_C_BPartner_Location.COLUMNNAME_Name, String.class);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MBPartnerLocation.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Integer getAcceptors() {
return this.acceptors;
}
public void setAcceptors(Integer acceptors) {
this.acceptors = acceptors;
}
public Integer getSelectors() {
return this.selectors;
}
public void setSelectors(Integer selectors) {
this.selectors = selectors;
}
public void setMin(Integer min) {
this.min = min;
}
public Integer getMin() {
return this.min;
}
public void setMax(Integer max) {
this.max = max;
}
|
public Integer getMax() {
return this.max;
}
public @Nullable Integer getMaxQueueCapacity() {
return this.maxQueueCapacity;
}
public void setMaxQueueCapacity(@Nullable Integer maxQueueCapacity) {
this.maxQueueCapacity = maxQueueCapacity;
}
public void setIdleTimeout(Duration idleTimeout) {
this.idleTimeout = idleTimeout;
}
public Duration getIdleTimeout() {
return this.idleTimeout;
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-jetty\src\main\java\org\springframework\boot\jetty\autoconfigure\JettyServerProperties.java
| 2
|
请完成以下Java代码
|
protected ITranslatableString buildMessage()
{
final TranslatableStringBuilder message = TranslatableStrings.builder();
final ITranslatableString originalMessage = super.buildMessage();
if (TranslatableStrings.isBlank(originalMessage))
{
message.append("Illegal transaction run state");
}
else
{
message.append(originalMessage);
}
if (trxRunConfig != null)
{
message.append("\nTrxRunConfig: ").appendObj(trxRunConfig);
}
if (trxNameSet)
{
message.append("\nTrxName: ").append(trxName);
}
return message.build();
}
|
public IllegalTrxRunStateException setTrxRunConfig(final ITrxRunConfig trxRunConfig)
{
this.trxRunConfig = trxRunConfig;
resetMessageBuilt();
return this;
}
public IllegalTrxRunStateException setTrxName(final String trxName)
{
this.trxName = trxName;
this.trxNameSet = true;
resetMessageBuilt();
return this;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\trx\exceptions\IllegalTrxRunStateException.java
| 1
|
请完成以下Java代码
|
public boolean hasAlternativeUri() {
return alternativeUri != null;
}
public String getNamespaceUri() {
return namespaceUri;
}
public String getAlternativeUri() {
return alternativeUri;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((namespaceUri == null) ? 0 : namespaceUri.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;
Namespace other = (Namespace) obj;
if (namespaceUri == null) {
if (other.namespaceUri != null)
return false;
} else if (!namespaceUri.equals(other.namespaceUri))
return false;
return true;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\util\xml\Namespace.java
| 1
|
请完成以下Java代码
|
public boolean isUseSuspenseBalancing ()
{
Object oo = get_Value(COLUMNNAME_UseSuspenseBalancing);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set CpD-Fehlerkonto verwenden.
@param UseSuspenseError CpD-Fehlerkonto verwenden */
@Override
public void setUseSuspenseError (boolean UseSuspenseError)
{
set_Value (COLUMNNAME_UseSuspenseError, Boolean.valueOf(UseSuspenseError));
}
|
/** Get CpD-Fehlerkonto verwenden.
@return CpD-Fehlerkonto verwenden */
@Override
public boolean isUseSuspenseError ()
{
Object oo = get_Value(COLUMNNAME_UseSuspenseError);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_AcctSchema_GL.java
| 1
|
请完成以下Java代码
|
public String getNumPartitions() {
return numPartitions;
}
public void setNumPartitions(String numPartitions) {
this.numPartitions = numPartitions;
}
public String getReplicationFactor() {
return replicationFactor;
}
public void setReplicationFactor(String replicationFactor) {
this.replicationFactor = replicationFactor;
}
}
public static class NonBlockingRetryBackOff {
protected String delay;
protected String maxDelay;
protected String multiplier;
protected String random;
public String getDelay() {
return delay;
}
public void setDelay(String delay) {
this.delay = delay;
}
public String getMaxDelay() {
return maxDelay;
}
public void setMaxDelay(String maxDelay) {
this.maxDelay = maxDelay;
}
public String getMultiplier() {
return multiplier;
}
public void setMultiplier(String multiplier) {
this.multiplier = multiplier;
|
}
public String getRandom() {
return random;
}
public void setRandom(String random) {
this.random = random;
}
}
public static class TopicPartition {
protected String topic;
protected Collection<String> partitions;
public String getTopic() {
return topic;
}
public void setTopic(String topic) {
this.topic = topic;
}
public Collection<String> getPartitions() {
return partitions;
}
public void setPartitions(Collection<String> partitions) {
this.partitions = partitions;
}
}
}
|
repos\flowable-engine-main\modules\flowable-event-registry-model\src\main\java\org\flowable\eventregistry\model\KafkaInboundChannelModel.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private static boolean isInteger(final BigDecimal numberCandidate)
{
return numberCandidate.stripTrailingZeros().scale() <= 0;
}
@Nullable
private Date extractDate(@NonNull final Map<String, Object> map, @NonNull final String key)
{
final Object value = getValue(map, key);
if (value == null)
{
return null;
}
if (value instanceof Date)
{
return (Date)value;
}
//
// Fallback: try parsing the dates from strings using some common predefined formats
// NOTE: this shall not happen very often because we take care of dates when we are parsing the Excel file.
final String valueStr = value.toString().trim();
if (valueStr.isEmpty())
{
return null;
}
for (final DateFormat dateFormat : dateFormats)
{
|
try
{
return dateFormat.parse(valueStr);
}
catch (final ParseException e)
{
// ignore it
}
}
return null;
}
private static <T> T coalesce(final T value, final T defaultValue)
{
return value == null ? defaultValue : value;
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java\de\metas\edi\esb\excelimport\Excel_OLCand_Row_Builder.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public RepositoryType getRepositoryType() {
return this.repositoryType;
}
public void setRepositoryType(RepositoryType repositoryType) {
this.repositoryType = repositoryType;
}
/**
* Strategies for configuring and validating Redis.
*/
public enum ConfigureAction {
/**
* Ensure that Redis Keyspace events for Generic commands and Expired events are
* enabled.
*/
NOTIFY_KEYSPACE_EVENTS,
/**
* No not attempt to apply any custom Redis configuration.
*/
|
NONE
}
/**
* Type of Redis session repository to auto-configure.
*/
public enum RepositoryType {
/**
* Auto-configure a RedisSessionRepository or ReactiveRedisSessionRepository.
*/
DEFAULT,
/**
* Auto-configure a RedisIndexedSessionRepository or
* ReactiveRedisIndexedSessionRepository.
*/
INDEXED
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-session-data-redis\src\main\java\org\springframework\boot\session\data\redis\autoconfigure\SessionDataRedisProperties.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public Mono<User> findByUserIdWithoutDefer(String id) {
return fetchFromCache(id).switchIfEmpty(fetchFromFile(id));
}
private Mono<User> fetchFromCache(String id) {
User user = usersCache.get(id);
if (user != null) {
LOG.info("Fetched user {} from cache", id);
return Mono.just(user);
}
return Mono.empty();
}
private Mono<User> fetchFromFile(String id) {
try {
File file = new ClassPathResource("users.json").getFile();
String usersData = new String(Files.readAllBytes(file.toPath()));
|
List<User> users = objectMapper.readValue(usersData, new TypeReference<List<User>>() {
});
User user = users.stream()
.filter(u -> u.getId()
.equalsIgnoreCase(id))
.findFirst()
.get();
usersCache.put(user.getId(), user);
LOG.info("Fetched user {} from file", id);
return Mono.just(user);
} catch (IOException e) {
return Mono.error(e);
}
}
}
|
repos\tutorials-master\spring-reactive-modules\spring-reactive-4\src\main\java\com\baeldung\switchIfEmpty\service\UserService.java
| 2
|
请完成以下Java代码
|
public Object getPersistentState() {
Map<String, Object> persistentState = (Map<String, Object>) new HashMap<String, Object>();
persistentState.put("endTime", endTime);
persistentState.put("durationInMillis", durationInMillis);
persistentState.put("deleteReason", deleteReason);
persistentState.put("executionId", executionId);
persistentState.put("assignee", assignee);
return persistentState;
}
// getters and setters //////////////////////////////////////////////////////
public String getActivityId() {
return activityId;
}
public void setActivityId(String activityId) {
this.activityId = activityId;
}
public String getActivityName() {
return activityName;
}
public void setActivityName(String activityName) {
this.activityName = activityName;
}
public String getActivityType() {
return activityType;
}
public void setActivityType(String activityType) {
this.activityType = activityType;
}
public String getExecutionId() {
return executionId;
}
public void setExecutionId(String executionId) {
this.executionId = executionId;
}
public String getAssignee() {
return assignee;
}
public void setAssignee(String assignee) {
this.assignee = assignee;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getCalledProcessInstanceId() {
return calledProcessInstanceId;
}
|
public void setCalledProcessInstanceId(String calledProcessInstanceId) {
this.calledProcessInstanceId = calledProcessInstanceId;
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public Date getTime() {
return getStartTime();
}
// common methods //////////////////////////////////////////////////////////
@Override
public String toString() {
return (
"HistoricActivityInstanceEntity[id=" +
id +
", activityId=" +
activityId +
", activityName=" +
activityName +
"]"
);
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\persistence\entity\HistoricActivityInstanceEntityImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
//校验用户
auth.userDetailsService( userDetailsService ).passwordEncoder( new PasswordEncoder() {
//对密码进行加密
@Override
public String encode(CharSequence charSequence) {
System.out.println(charSequence.toString());
return DigestUtils.md5DigestAsHex(charSequence.toString().getBytes());
}
//对密码进行判断匹配
@Override
public boolean matches(CharSequence charSequence, String s) {
String encode = DigestUtils.md5DigestAsHex(charSequence.toString().getBytes());
boolean res = s.equals( encode );
return res;
}
} );
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable()
//因为使用JWT,所以不需要HttpSession
.sessionManagement().sessionCreationPolicy( SessionCreationPolicy.STATELESS).and()
.authorizeRequests()
//OPTIONS请求全部放行
.antMatchers( HttpMethod.OPTIONS, "/**").permitAll()
//登录接口放行
.antMatchers("/auth/login").permitAll()
//其他接口全部接受验证
.anyRequest().authenticated();
|
//使用自定义的 Token过滤器 验证请求的Token是否合法
http.addFilterBefore(authenticationTokenFilterBean(), UsernamePasswordAuthenticationFilter.class);
http.headers().cacheControl();
}
@Bean
public JwtTokenFilter authenticationTokenFilterBean() throws Exception {
return new JwtTokenFilter();
}
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
}
|
repos\SpringBootLearning-master (1)\springboot-jwt\src\main\java\com\gf\config\SecurityConfig.java
| 2
|
请完成以下Java代码
|
public void setM_WarehouseSource_ID (final int M_WarehouseSource_ID)
{
if (M_WarehouseSource_ID < 1)
set_Value (COLUMNNAME_M_WarehouseSource_ID, null);
else
set_Value (COLUMNNAME_M_WarehouseSource_ID, M_WarehouseSource_ID);
}
@Override
public int getM_WarehouseSource_ID()
{
return get_ValueAsInt(COLUMNNAME_M_WarehouseSource_ID);
}
@Override
public void setPercent (final BigDecimal Percent)
{
set_Value (COLUMNNAME_Percent, Percent);
}
@Override
public BigDecimal getPercent()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Percent);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setPriorityNo (final int PriorityNo)
{
set_Value (COLUMNNAME_PriorityNo, PriorityNo);
}
@Override
public int getPriorityNo()
{
return get_ValueAsInt(COLUMNNAME_PriorityNo);
}
@Override
public void setTransfertTime (final @Nullable BigDecimal TransfertTime)
{
set_Value (COLUMNNAME_TransfertTime, TransfertTime);
}
@Override
public BigDecimal getTransfertTime()
|
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_TransfertTime);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setValidFrom (final @Nullable java.sql.Timestamp ValidFrom)
{
set_Value (COLUMNNAME_ValidFrom, ValidFrom);
}
@Override
public java.sql.Timestamp getValidFrom()
{
return get_ValueAsTimestamp(COLUMNNAME_ValidFrom);
}
@Override
public void setValidTo (final @Nullable java.sql.Timestamp ValidTo)
{
set_Value (COLUMNNAME_ValidTo, ValidTo);
}
@Override
public java.sql.Timestamp getValidTo()
{
return get_ValueAsTimestamp(COLUMNNAME_ValidTo);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_DD_NetworkDistributionLine.java
| 1
|
请完成以下Java代码
|
public class DwzAjax {
/**
* Ajax请求的执行状态码.<br/>
* statusCode:{ok:200, error:300, timeout:301}.<br/>
* 200:成功,300:错误,301:请求超时.
*/
private String statusCode;
/**
* Ajax提示消息.<br/>
* message.
*/
private String message;
/**
* navTabId. 服务器传回navTabId可以把那个navTab标记为reloadFlag=1.<br/>
* 下次切换到那个navTab时会重新载入内容.
*/
private String navTabId;
/**
* callbackType ajax请求回调类型. <br/>
* callbackType如果是closeCurrent就会关闭当前tab选项,
* 只有callbackType="forward"时需要forwardUrl值,以重定向到另一个URL.
*/
private String callbackType;
/**
* 重定向URL. <br/>
* forwardUrl.
*/
private String forwardUrl;
/**
* @return the statusCode
*/
public final String getStatusCode() {
return statusCode;
}
/**
* @param argStatusCode
* the statusCode to set
*/
public final void setStatusCode(final String argStatusCode) {
this.statusCode = argStatusCode;
}
/**
* @return the message
*/
public final String getMessage() {
return message;
}
/**
* @param argMessage
* the message to set
*/
public final void setMessage(final String argMessage) {
|
this.message = argMessage;
}
/**
* @return the navTabId
*/
public final String getNavTabId() {
return navTabId;
}
/**
* @param argNavTabId
* the navTabId to set
*/
public final void setNavTabId(final String argNavTabId) {
this.navTabId = argNavTabId;
}
/**
* @return the callbackType
*/
public final String getCallbackType() {
return callbackType;
}
/**
* @param argCallbackType
* the callbackType to set
*/
public final void setCallbackType(final String argCallbackType) {
this.callbackType = argCallbackType;
}
/**
* @return the forwardUrl
*/
public final String getForwardUrl() {
return forwardUrl;
}
/**
* @param argForwardUrl
* the forwardUrl to set
*/
public final void setForwardUrl(final String argForwardUrl) {
this.forwardUrl = argForwardUrl;
}
}
|
repos\roncoo-pay-master\roncoo-pay-common-core\src\main\java\com\roncoo\pay\common\core\dwz\DwzAjax.java
| 1
|
请完成以下Java代码
|
public List<FieldExtension> getFieldExtensions() {
return fieldExtensions;
}
public void setFieldExtensions(List<FieldExtension> fieldExtensions) {
this.fieldExtensions = fieldExtensions;
}
public String getOnTransaction() {
return onTransaction;
}
public void setOnTransaction(String onTransaction) {
this.onTransaction = onTransaction;
}
/**
* Return the script info, if present.
* <p>
* ScriptInfo must be populated, when {@code <executionListener type="script" ...>} e.g. when
* implementationType is 'script'.
* </p>
*/
public ScriptInfo getScriptInfo() {
return scriptInfo;
}
/**
* Sets the script info
*
* @see #getScriptInfo()
*/
public void setScriptInfo(ScriptInfo scriptInfo) {
this.scriptInfo = scriptInfo;
}
public Object getInstance() {
return instance;
}
public void setInstance(Object instance) {
this.instance = instance;
}
|
@Override
public FlowableListener clone() {
FlowableListener clone = new FlowableListener();
clone.setValues(this);
return clone;
}
public void setValues(FlowableListener otherListener) {
super.setValues(otherListener);
setEvent(otherListener.getEvent());
setSourceState(otherListener.getSourceState());
setTargetState(otherListener.getTargetState());
setImplementation(otherListener.getImplementation());
setImplementationType(otherListener.getImplementationType());
setOnTransaction(otherListener.getOnTransaction());
Optional.ofNullable(otherListener.getScriptInfo()).map(ScriptInfo::clone).ifPresent(this::setScriptInfo);
fieldExtensions = new ArrayList<>();
if (otherListener.getFieldExtensions() != null && !otherListener.getFieldExtensions().isEmpty()) {
for (FieldExtension extension : otherListener.getFieldExtensions()) {
fieldExtensions.add(extension.clone());
}
}
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-model\src\main\java\org\flowable\cmmn\model\FlowableListener.java
| 1
|
请完成以下Java代码
|
private BigDecimal round(BigDecimal bd)
{
final CurrencyPrecision precision = result.getPrecision();
if (precision != null)
{
return precision.roundIfNeeded(bd);
}
return bd;
} // round
/**************************************************************************
* Get C_UOM_ID
*
* @return uom
*/
public int getC_UOM_ID()
{
calculatePrice(false);
return UomId.toRepoId(result.getPriceUomId());
}
/**
* Get Price List
*
* @return list
*/
public BigDecimal getPriceList()
{
calculatePrice(false);
return round(result.getPriceList());
}
/**
* Get Price Std
*
* @return std
*/
public BigDecimal getPriceStd()
{
calculatePrice(false);
return round(result.getPriceStd());
}
/**
* Get Price Limit
*
* @return limit
*/
public BigDecimal getPriceLimit()
{
calculatePrice(false);
return round(result.getPriceLimit());
}
/**
* Is Price List enforded?
*
* @return enforce limit
*/
public boolean isEnforcePriceLimit()
{
calculatePrice(false);
return result.getEnforcePriceLimit().isTrue();
} // isEnforcePriceLimit
/**
* Is a DiscountSchema active?
*
* @return active Discount Schema
*/
public boolean isDiscountSchema()
{
return !result.isDisallowDiscount()
|
&& result.isUsesDiscountSchema();
} // isDiscountSchema
/**
* Is the Price Calculated (i.e. found)?
*
* @return calculated
*/
public boolean isCalculated()
{
return result.isCalculated();
} // isCalculated
/**
* Convenience method to get priceStd with the discount already subtracted. Note that the result matches the former behavior of {@link #getPriceStd()}.
*/
public BigDecimal mkPriceStdMinusDiscount()
{
calculatePrice(false);
return result.getDiscount().subtractFromBase(result.getPriceStd(), result.getPrecision().toInt());
}
@Override
public String toString()
{
return "MProductPricing ["
+ pricingCtx
+ ", " + result
+ "]";
}
public void setConvertPriceToContextUOM(boolean convertPriceToContextUOM)
{
pricingCtx.setConvertPriceToContextUOM(convertPriceToContextUOM);
}
public void setReferencedObject(Object referencedObject)
{
pricingCtx.setReferencedObject(referencedObject);
}
// metas: end
public int getC_TaxCategory_ID()
{
return TaxCategoryId.toRepoId(result.getTaxCategoryId());
}
public boolean isManualPrice()
{
return pricingCtx.getManualPriceEnabled().isTrue();
}
public void setManualPrice(boolean manualPrice)
{
pricingCtx.setManualPriceEnabled(manualPrice);
}
public void throwProductNotOnPriceListException()
{
throw new ProductNotOnPriceListException(pricingCtx);
}
} // MProductPrice
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\MProductPricing.java
| 1
|
请完成以下Java代码
|
public abstract class ProjectRequestEvent {
private final ProjectRequest request;
private final InitializrMetadata metadata;
private final long timestamp;
protected ProjectRequestEvent(ProjectRequest request, InitializrMetadata metadata) {
this.request = request;
this.metadata = metadata;
this.timestamp = System.currentTimeMillis();
}
/**
* Return the {@link ProjectRequest} used to generate the project.
* @return the project request
*/
public ProjectRequest getProjectRequest() {
|
return this.request;
}
/**
* Return the timestamp at which the request was processed.
* @return the timestamp that the request was processed
*/
public long getTimestamp() {
return this.timestamp;
}
/**
* Return the metadata that was used to generate the project.
* @return the metadata
*/
public InitializrMetadata getMetadata() {
return this.metadata;
}
}
|
repos\initializr-main\initializr-web\src\main\java\io\spring\initializr\web\project\ProjectRequestEvent.java
| 1
|
请完成以下Java代码
|
public void setGLN (final @Nullable java.lang.String GLN)
{
set_Value (COLUMNNAME_GLN, GLN);
}
@Override
public java.lang.String getGLN()
{
return get_ValueAsString(COLUMNNAME_GLN);
}
@Override
public void setLookup_Label (final @Nullable java.lang.String Lookup_Label)
{
set_ValueNoCheck (COLUMNNAME_Lookup_Label, Lookup_Label);
}
@Override
public java.lang.String getLookup_Label()
{
|
return get_ValueAsString(COLUMNNAME_Lookup_Label);
}
@Override
public void setStoreGLN (final @Nullable java.lang.String StoreGLN)
{
set_Value (COLUMNNAME_StoreGLN, StoreGLN);
}
@Override
public java.lang.String getStoreGLN()
{
return get_ValueAsString(COLUMNNAME_StoreGLN);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.edi\src\main\java-gen\de\metas\esb\edi\model\X_EDI_C_BPartner_Lookup_BPL_GLN_v.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void add(ConfigurationMetadataProperty property, ConfigurationMetadataSource source) {
if (source != null) {
source.getProperties().putIfAbsent(property.getId(), property);
}
getGroup(source).getProperties().putIfAbsent(property.getId(), property);
}
/**
* Merge the content of the specified repository to this repository.
* @param repository the repository to include
*/
public void include(ConfigurationMetadataRepository repository) {
for (ConfigurationMetadataGroup group : repository.getAllGroups().values()) {
ConfigurationMetadataGroup existingGroup = this.allGroups.get(group.getId());
if (existingGroup == null) {
this.allGroups.put(group.getId(), group);
}
else {
// Merge properties
group.getProperties().forEach((name, value) -> existingGroup.getProperties().putIfAbsent(name, value));
// Merge sources
group.getSources().forEach((name, value) -> addOrMergeSource(existingGroup.getSources(), name, value));
}
}
}
private ConfigurationMetadataGroup getGroup(ConfigurationMetadataSource source) {
|
if (source == null) {
return this.allGroups.computeIfAbsent(ROOT_GROUP, (key) -> new ConfigurationMetadataGroup(ROOT_GROUP));
}
return this.allGroups.get(source.getGroupId());
}
private void addOrMergeSource(Map<String, ConfigurationMetadataSource> sources, String name,
ConfigurationMetadataSource source) {
ConfigurationMetadataSource existingSource = sources.get(name);
if (existingSource == null) {
sources.put(name, source);
}
else {
source.getProperties().forEach((k, v) -> existingSource.getProperties().putIfAbsent(k, v));
}
}
}
|
repos\spring-boot-4.0.1\configuration-metadata\spring-boot-configuration-metadata\src\main\java\org\springframework\boot\configurationmetadata\SimpleConfigurationMetadataRepository.java
| 2
|
请完成以下Java代码
|
public class FMeasure implements Serializable
{
/**
* 测试样本空间
*/
int size;
/**
* 平均准确率
*/
public double average_accuracy;
/**
* 平均精确率
*/
public double average_precision;
/**
* 平均召回率
*/
public double average_recall;
/**
* 平均F1
*/
public double average_f1;
/**
* 分类准确率
*/
public double accuracy[];
/**
* 分类精确率
*/
public double precision[];
/**
* 分类召回率
*/
public double recall[];
/**
* 分类F1
*/
public double[] f1;
/**
* 分类名称
*/
public String[] catalog;
/**
* 速度
*/
public double speed;
@Override
public String toString()
{
int l = -1;
for (String c : catalog)
{
l = Math.max(l, c.length());
}
|
final int w = 6;
final StringBuilder sb = new StringBuilder(10000);
printf(sb, "%*s\t%*s\t%*s\t%*s\t%*s%n".replace('*', Character.forDigit(w, 10)), "P", "R", "F1", "A", "");
for (int i = 0; i < catalog.length; i++)
{
printf(sb, ("%*.2f\t%*.2f\t%*.2f\t%*.2f\t%"+l+"s%n").replace('*', Character.forDigit(w, 10)),
precision[i] * 100.,
recall[i] * 100.,
f1[i] * 100.,
accuracy[i] * 100.,
catalog[i]);
}
printf(sb, ("%*.2f\t%*.2f\t%*.2f\t%*.2f\t%"+l+"s%n").replace('*', Character.forDigit(w, 10)),
average_precision * 100.,
average_recall * 100.,
average_f1 * 100.,
average_accuracy * 100.,
"avg.");
printf(sb, "data size = %d, speed = %.2f doc/s\n", size, speed);
return sb.toString();
}
private static void printf(StringBuilder sb, String format, Object... args)
{
sb.append(String.format(format, args));
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\classification\statistics\evaluations\FMeasure.java
| 1
|
请完成以下Java代码
|
public @NotNull DeliveryOrder createDraftDeliveryOrder(
@NonNull final CreateDraftDeliveryOrderRequest request)
{
final DeliveryOrderKey deliveryOrderKey = request.getDeliveryOrderKey();
final Set<PackageId> mpackageIds = request.getPackageIds();
final IBPartnerOrgBL bpartnerOrgBL = Services.get(IBPartnerOrgBL.class);
final I_C_BPartner pickupFromBPartner = bpartnerOrgBL.retrieveLinkedBPartner(deliveryOrderKey.getFromOrgId());
final I_C_Location pickupFromLocation = bpartnerOrgBL.retrieveOrgLocation(OrgId.ofRepoId(deliveryOrderKey.getFromOrgId()));
final LocalDate pickupDate = deliveryOrderKey.getPickupDate();
final int deliverToBPartnerId = deliveryOrderKey.getDeliverToBPartnerId();
final I_C_BPartner deliverToBPartner = load(deliverToBPartnerId, I_C_BPartner.class);
final int deliverToBPartnerLocationId = deliveryOrderKey.getDeliverToBPartnerLocationId();
final I_C_BPartner_Location deliverToBPLocation = load(deliverToBPartnerLocationId, I_C_BPartner_Location.class);
final I_C_Location deliverToLocation = deliverToBPLocation.getC_Location();
final DerKurierShipperConfig config = derKurierShipperConfigRepository
.retrieveConfigForShipperId(request.getDeliveryOrderKey().getShipperId().getRepoId());
final ParcelNumberGenerator parcelNumberGenerator = config.getParcelNumberGenerator();
final DerKurierDeliveryData derKurierDeliveryData = //
DerKurierDeliveryData.builder()
.customerNumber(config.getCustomerNumber())
.parcelNumber(parcelNumberGenerator.getNextParcelNumber())
.collectorCode(config.getCollectorCode())
.customerCode(config.getCustomerCode())
.desiredTimeFrom(config.getDesiredTimeFrom())
.desiredTimeTo(config.getDesiredTimeTo())
.build();
return DeliveryOrder.builder()
.shipperProduct(DerKurierShipperProduct.OVERNIGHT)
.shipperId(deliveryOrderKey.getShipperId())
.shipperTransportationId(deliveryOrderKey.getShipperTransportationId())
//
// Pickup
.pickupAddress(DeliveryOrderUtil.prepareAddressFromLocationBP(pickupFromLocation, pickupFromBPartner)
.build())
.pickupDate(PickupDate.builder()
|
.date(pickupDate)
.build())
//
// Delivery
.deliveryAddress(DeliveryOrderUtil.prepareAddressFromLocationBP(deliverToLocation, deliverToBPartner)
//.companyDepartment("-") // N/A
.bpartnerId(deliverToBPartnerId)
.build())
.deliveryContact(ContactPerson.builder()
.name(deliverToBPartner.getName())
.emailAddress(deliverToBPartner.getEMail())
.build())
//
// Delivery content
.deliveryPosition(DeliveryPosition.builder()
.numberOfPackages(mpackageIds.size())
.packageIds(mpackageIds)
.grossWeightKg(request.getAllPackagesGrossWeightInKg(DEFAULT_PackageWeightInKg))
.content(request.getAllPackagesContentDescription().orElse("-"))
.customDeliveryData(derKurierDeliveryData)
.build())
// .customerReference(null)
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.derkurier\src\main\java\de\metas\shipper\gateway\derkurier\DerKurierDraftDeliveryOrderCreator.java
| 1
|
请完成以下Java代码
|
public class ActivityBeforeInstantiationCmd extends AbstractInstantiationCmd {
protected String activityId;
public ActivityBeforeInstantiationCmd(String activityId) {
this(null, activityId);
}
public ActivityBeforeInstantiationCmd(String processInstanceId, String activityId) {
this(processInstanceId, activityId, null);
}
public ActivityBeforeInstantiationCmd(String processInstanceId, String activityId,
String ancestorActivityInstanceId) {
super(processInstanceId, ancestorActivityInstanceId);
this.activityId = activityId;
}
@Override
public Void execute(CommandContext commandContext) {
ExecutionEntity processInstance = commandContext.getExecutionManager().findExecutionById(processInstanceId);
ProcessDefinitionImpl processDefinition = processInstance.getProcessDefinition();
PvmActivity activity = processDefinition.findActivity(activityId);
// forbid instantiation of compensation boundary events
if (activity != null && "compensationBoundaryCatch".equals(activity.getProperty("type"))) {
throw new ProcessEngineException("Cannot start before activity " + activityId + "; activity " +
"is a compensation boundary event.");
}
return super.execute(commandContext);
}
@Override
protected ScopeImpl getTargetFlowScope(ProcessDefinitionImpl processDefinition) {
PvmActivity activity = processDefinition.findActivity(activityId);
return activity.getFlowScope();
}
|
@Override
protected CoreModelElement getTargetElement(ProcessDefinitionImpl processDefinition) {
ActivityImpl activity = processDefinition.findActivity(activityId);
return activity;
}
@Override
public String getTargetElementId() {
return activityId;
}
@Override
protected String describe() {
StringBuilder sb = new StringBuilder();
sb.append("Start before activity '");
sb.append(activityId);
sb.append("'");
if (ancestorActivityInstanceId != null) {
sb.append(" with ancestor activity instance '");
sb.append(ancestorActivityInstanceId);
sb.append("'");
}
return sb.toString();
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmd\ActivityBeforeInstantiationCmd.java
| 1
|
请完成以下Java代码
|
private static class RequestContext {
private final Integer requestId;
private final SnmpCommunicationSpec communicationSpec;
private final SnmpMethod method;
private final List<SnmpMapping> responseMappings;
private final int requestSize;
private List<PDU> responseParts;
@Builder
public RequestContext(Integer requestId, SnmpCommunicationSpec communicationSpec, SnmpMethod method, List<SnmpMapping> responseMappings, int requestSize) {
this.requestId = requestId;
this.communicationSpec = communicationSpec;
this.method = method;
this.responseMappings = responseMappings;
|
this.requestSize = requestSize;
if (requestSize > 1) {
this.responseParts = Collections.synchronizedList(new ArrayList<>());
}
}
}
private interface ResponseDataMapper {
JsonObject map(List<PDU> pdus, RequestContext requestContext);
}
private interface ResponseProcessor {
void process(JsonObject responseData, RequestContext requestContext, DeviceSessionContext sessionContext);
}
}
|
repos\thingsboard-master\common\transport\snmp\src\main\java\org\thingsboard\server\transport\snmp\service\SnmpTransportService.java
| 1
|
请完成以下Java代码
|
protected HistoricDetailQuery baseQuery() {
return engine.getHistoryService().createHistoricDetailQuery().detailId(getId());
}
@Override
protected Query<HistoricDetailQuery, HistoricDetail> baseQueryForBinaryVariable() {
return baseQuery().disableCustomObjectDeserialization();
}
@Override
protected Query<HistoricDetailQuery, HistoricDetail> baseQueryForVariable(boolean deserializeObjectValue) {
HistoricDetailQuery query = baseQuery().disableBinaryFetching();
if (!deserializeObjectValue) {
query.disableCustomObjectDeserialization();
}
return query;
}
@Override
|
protected TypedValue transformQueryResultIntoTypedValue(HistoricDetail queryResult) {
if (!(queryResult instanceof HistoricVariableUpdate)) {
throw new InvalidRequestException(Status.BAD_REQUEST, "Historic detail with Id '" + getId() + "' is not a variable update.");
}
HistoricVariableUpdate update = (HistoricVariableUpdate) queryResult;
return update.getTypedValue();
}
@Override
protected HistoricDetailDto transformToDto(HistoricDetail queryResult) {
return HistoricDetailDto.fromHistoricDetail(queryResult);
}
@Override
protected String getResourceNameForErrorMessage() {
return "Historic detail";
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\sub\history\impl\HistoricDetailResourceImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class DmnDeploymentResource {
@Autowired
protected DmnRestResponseFactory dmnRestResponseFactory;
@Autowired
protected DmnRepositoryService dmnRepositoryService;
@Autowired(required=false)
protected DmnRestApiInterceptor restApiInterceptor;
@ApiOperation(value = "Get a decision deployment", tags = { "Deployment" }, nickname = "getDecisionDeployment")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Indicates the deployment was found and returned."),
@ApiResponse(code = 404, message = "Indicates the requested deployment was not found.")
})
@GetMapping(value = "/dmn-repository/deployments/{deploymentId}", produces = "application/json")
public DmnDeploymentResponse getDmnDeployment(@ApiParam(name = "deploymentId") @PathVariable String deploymentId) {
DmnDeployment deployment = dmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
if (deployment == null) {
throw new FlowableObjectNotFoundException("Could not find a DMN deployment with id '" + deploymentId);
}
if (restApiInterceptor != null) {
restApiInterceptor.accessDeploymentById(deployment);
|
}
return dmnRestResponseFactory.createDmnDeploymentResponse(deployment);
}
@ApiOperation(value = "Delete a decision deployment", tags = { "Deployment" }, nickname = "deleteDecisionDeployment", code = 204)
@ApiResponses(value = {
@ApiResponse(code = 204, message = "Indicates the deployment was found and has been deleted. Response-body is intentionally empty."),
@ApiResponse(code = 404, message = "Indicates the requested deployment was not found.")
})
@DeleteMapping(value = "/dmn-repository/deployments/{deploymentId}", produces = "application/json")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteDmnDeployment(@ApiParam(name = "deploymentId") @PathVariable String deploymentId) {
DmnDeployment deployment = dmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
if (deployment == null) {
throw new FlowableObjectNotFoundException("Could not find a DMN deployment with id '" + deploymentId);
}
if (restApiInterceptor != null) {
restApiInterceptor.deleteDeployment(deployment);
}
dmnRepositoryService.deleteDeployment(deploymentId);
}
}
|
repos\flowable-engine-main\modules\flowable-dmn-rest\src\main\java\org\flowable\dmn\rest\service\api\repository\DmnDeploymentResource.java
| 2
|
请完成以下Java代码
|
public class KafkaMessageHandlerMethodFactory extends DefaultMessageHandlerMethodFactory {
private final HandlerMethodArgumentResolverComposite argumentResolvers =
new HandlerMethodArgumentResolverComposite();
@SuppressWarnings("NullAway.Init")
private MessageConverter messageConverter;
private @Nullable Validator validator;
@Override
public void setMessageConverter(MessageConverter messageConverter) {
super.setMessageConverter(messageConverter);
this.messageConverter = messageConverter;
}
@Override
public void setValidator(Validator validator) {
super.setValidator(validator);
this.validator = validator;
}
@Override
|
protected List<HandlerMethodArgumentResolver> initArgumentResolvers() {
List<HandlerMethodArgumentResolver> resolvers = super.initArgumentResolvers();
if (KotlinDetector.isKotlinPresent()) {
// Insert before PayloadMethodArgumentResolver
resolvers.add(resolvers.size() - 1, new ContinuationHandlerMethodArgumentResolver());
}
// Has to be at the end - look at PayloadMethodArgumentResolver documentation
resolvers.add(resolvers.size() - 1, new KafkaNullAwarePayloadArgumentResolver(this.messageConverter, this.validator));
this.argumentResolvers.addResolvers(resolvers);
return resolvers;
}
@Override
public InvocableHandlerMethod createInvocableHandlerMethod(Object bean, Method method) {
InvocableHandlerMethod handlerMethod = new KotlinAwareInvocableHandlerMethod(bean, method);
handlerMethod.setMessageMethodArgumentResolvers(this.argumentResolvers);
return handlerMethod;
}
}
|
repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\listener\adapter\KafkaMessageHandlerMethodFactory.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public SecurityManager securityManager(){
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
securityManager.setRealm(shiroRealm());
securityManager.setRememberMeManager(rememberMeManager());
securityManager.setCacheManager(getEhCacheManager());
return securityManager;
}
@Bean(name = "lifecycleBeanPostProcessor")
public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
return new LifecycleBeanPostProcessor();
}
@Bean
public ShiroRealm shiroRealm(){
ShiroRealm shiroRealm = new ShiroRealm();
return shiroRealm;
}
public SimpleCookie rememberMeCookie() {
SimpleCookie cookie = new SimpleCookie("rememberMe");
cookie.setMaxAge(86400);
return cookie;
}
public CookieRememberMeManager rememberMeManager() {
CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager();
cookieRememberMeManager.setCookie(rememberMeCookie());
cookieRememberMeManager.setCipherKey(Base64.decode("4AvVhmFLUs0KTA3Kprsdag=="));
return cookieRememberMeManager;
}
@Bean
@DependsOn({"lifecycleBeanPostProcessor"})
public DefaultAdvisorAutoProxyCreator advisorAutoProxyCreator() {
|
DefaultAdvisorAutoProxyCreator advisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
advisorAutoProxyCreator.setProxyTargetClass(true);
return advisorAutoProxyCreator;
}
@Bean
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager) {
AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor();
authorizationAttributeSourceAdvisor.setSecurityManager(securityManager);
return authorizationAttributeSourceAdvisor;
}
@Bean
public ShiroDialect shiroDialect() {
return new ShiroDialect();
}
}
|
repos\SpringAll-master\16.Spring-Boot-Shiro-Thymeleaf-Tag\src\main\java\com\springboot\config\ShiroConfig.java
| 2
|
请完成以下Java代码
|
public class ReadingActor extends AbstractActor {
private final LoggingAdapter log = Logging.getLogger(getContext().getSystem(), this);
private String text;
public ReadingActor(String text) {
this.text = text;
}
public static Props props(String text) {
return Props.create(ReadingActor.class, text);
}
public static final class ReadLines {
}
@Override
public void preStart() {
log.info("Starting ReadingActor {}", this);
}
@Override
public void postStop() {
log.info("Stopping ReadingActor {}", this);
}
@Override
public Receive createReceive() {
return receiveBuilder()
.match(ReadLines.class, r -> {
|
log.info("Received ReadLines message from " + getSender());
String[] lines = text.split("\n");
List<CompletableFuture> futures = new ArrayList<>();
for (int i = 0; i < lines.length; i++) {
String line = lines[i];
ActorRef wordCounterActorRef = getContext().actorOf(Props.create(WordCounterActor.class), "word-counter-" + i);
CompletableFuture<Object> future =
ask(wordCounterActorRef, new WordCounterActor.CountWords(line), 1000).toCompletableFuture();
futures.add(future);
}
Integer totalNumberOfWords = futures.stream()
.map(CompletableFuture::join)
.mapToInt(n -> (Integer) n)
.sum();
ActorRef printerActorRef = getContext().actorOf(Props.create(PrinterActor.class), "Printer-Actor");
printerActorRef.forward(new PrinterActor.PrintFinalResult(totalNumberOfWords), getContext());
// printerActorRef.tell(new PrinterActor.PrintFinalResult(totalNumberOfWords), getSelf());
})
.build();
}
}
|
repos\tutorials-master\akka-modules\akka-actors\src\main\java\com\baeldung\akkaactors\ReadingActor.java
| 1
|
请完成以下Java代码
|
public class NumberUtil {
private NumberUtil() {
}
/**
* 判断是否为11位电话号码
*
* @param phone
* @return
*/
public static boolean isPhone(String phone) {
Pattern pattern = Pattern.compile("^((13[0-9])|(14[5,7])|(15[^4,\\D])|(17[0-8])|(18[0-9]))\\d{8}$");
Matcher matcher = pattern.matcher(phone);
return matcher.matches();
}
/**
* 生成指定长度的随机数
*
* @param length
* @return
*/
public static int genRandomNum(int length) {
int num = 1;
double random = Math.random();
if (random < 0.1) {
random = random + 0.1;
}
for (int i = 0; i < length; i++) {
num = num * 10;
}
return (int) ((random * num));
}
/**
|
* 生成订单流水号
*
* @return
*/
public static String genOrderNo() {
StringBuffer buffer = new StringBuffer(String.valueOf(System.currentTimeMillis()));
int num = genRandomNum(4);
buffer.append(num);
return buffer.toString();
}
public static String formatMoney2Str(Double money) {
java.text.DecimalFormat df = new java.text.DecimalFormat("0.00");
return df.format(money);
}
public static String formatMoney2Str(float money) {
java.text.DecimalFormat df = new java.text.DecimalFormat("0.00");
return df.format(money);
}
}
|
repos\spring-boot-projects-main\SpringBoot前后端分离实战项目源码\spring-boot-project-front-end&back-end\src\main\java\cn\lanqiao\springboot3\utils\NumberUtil.java
| 1
|
请完成以下Java代码
|
public VariableMap getVariables() {
return variables;
}
public String getTenantId() {
return tenantId;
}
public boolean isTenantIdSet() {
return isTenantIdSet;
}
protected <T> T execute(Command<T> command) {
return commandExecutor.execute(command);
}
@Override
public ConditionEvaluationBuilder processInstanceBusinessKey(String businessKey) {
ensureNotNull("businessKey", businessKey);
this.businessKey = businessKey;
return this;
}
@Override
public ConditionEvaluationBuilder processDefinitionId(String processDefinitionId) {
ensureNotNull("processDefinitionId", processDefinitionId);
this.processDefinitionId = processDefinitionId;
return this;
}
@Override
public ConditionEvaluationBuilder setVariable(String variableName, Object variableValue) {
ensureNotNull("variableName", variableName);
this.variables.put(variableName, variableValue);
return this;
|
}
@Override
public ConditionEvaluationBuilder setVariables(Map<String, Object> variables) {
ensureNotNull("variables", variables);
if (variables != null) {
this.variables.putAll(variables);
}
return this;
}
@Override
public ConditionEvaluationBuilder tenantId(String tenantId) {
ensureNotNull(
"The tenant-id cannot be null. Use 'withoutTenantId()' if you want to evaluate conditional start event with a process definition which has no tenant-id.",
"tenantId", tenantId);
isTenantIdSet = true;
this.tenantId = tenantId;
return this;
}
@Override
public ConditionEvaluationBuilder withoutTenantId() {
isTenantIdSet = true;
tenantId = null;
return this;
}
@Override
public List<ProcessInstance> evaluateStartConditions() {
return execute(new EvaluateStartConditionCmd(this));
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\ConditionEvaluationBuilderImpl.java
| 1
|
请完成以下Java代码
|
public List<GraphicInfo> getDecisionServiceDividerGraphicInfo(String key) {
return decisionServiceDividerLocationMap.get(key);
}
public void addDecisionServiceDividerGraphicInfoList(String key, List<GraphicInfo> graphicInfoList) {
decisionServiceDividerLocationMap.put(key, graphicInfoList);
}
public void addDecisionServiceDividerGraphicInfoListByDiagramId(String diagramId, String key, List<GraphicInfo> graphicInfoList) {
decisionServiceDividerLocationByDiagramIdMap.computeIfAbsent(diagramId, k -> new LinkedHashMap<>());
decisionServiceDividerLocationByDiagramIdMap.get(diagramId).put(key, graphicInfoList);
decisionServiceDividerLocationMap.put(key, graphicInfoList);
}
public String getExporter() {
return exporter;
}
public void setExporter(String exporter) {
this.exporter = exporter;
}
|
public String getExporterVersion() {
return exporterVersion;
}
public void setExporterVersion(String exporterVersion) {
this.exporterVersion = exporterVersion;
}
public Map<String, String> getNamespaces() {
return namespaceMap;
}
public void addNamespace(String prefix, String uri) {
namespaceMap.put(prefix, uri);
}
}
|
repos\flowable-engine-main\modules\flowable-dmn-model\src\main\java\org\flowable\dmn\model\DmnDefinition.java
| 1
|
请完成以下Java代码
|
public void setIsPaid (final boolean IsPaid)
{
throw new IllegalArgumentException ("IsPaid is virtual column"); }
@Override
public boolean isPaid()
{
return get_ValueAsBoolean(COLUMNNAME_IsPaid);
}
@Override
public void setM_Shipment_Constraint_ID (final int M_Shipment_Constraint_ID)
{
if (M_Shipment_Constraint_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Shipment_Constraint_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Shipment_Constraint_ID, M_Shipment_Constraint_ID);
}
@Override
public int getM_Shipment_Constraint_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Shipment_Constraint_ID);
}
@Override
public void setSourceDoc_Record_ID (final int SourceDoc_Record_ID)
|
{
if (SourceDoc_Record_ID < 1)
set_Value (COLUMNNAME_SourceDoc_Record_ID, null);
else
set_Value (COLUMNNAME_SourceDoc_Record_ID, SourceDoc_Record_ID);
}
@Override
public int getSourceDoc_Record_ID()
{
return get_ValueAsInt(COLUMNNAME_SourceDoc_Record_ID);
}
@Override
public void setSourceDoc_Table_ID (final int SourceDoc_Table_ID)
{
if (SourceDoc_Table_ID < 1)
set_Value (COLUMNNAME_SourceDoc_Table_ID, null);
else
set_Value (COLUMNNAME_SourceDoc_Table_ID, SourceDoc_Table_ID);
}
@Override
public int getSourceDoc_Table_ID()
{
return get_ValueAsInt(COLUMNNAME_SourceDoc_Table_ID);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\de\metas\inoutcandidate\model\X_M_Shipment_Constraint.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class DefaultRuleEngineCallService implements RuleEngineCallService {
private final TbClusterService clusterService;
private ScheduledExecutorService executor;
private final ConcurrentMap<UUID, Consumer<TbMsg>> requests = new ConcurrentHashMap<>();
public DefaultRuleEngineCallService(TbClusterService clusterService) {
this.clusterService = clusterService;
}
@PostConstruct
public void initExecutor() {
executor = ThingsBoardExecutors.newSingleThreadScheduledExecutor("re-rest-callback");
}
@PreDestroy
public void shutdownExecutor() {
if (executor != null) {
executor.shutdownNow();
}
}
@Override
public void processRestApiCallToRuleEngine(TenantId tenantId, UUID requestId, TbMsg request, boolean useQueueFromTbMsg, Consumer<TbMsg> responseConsumer) {
log.trace("[{}] Processing REST API call to rule engine: [{}] for entity: [{}]", tenantId, requestId, request.getOriginator());
requests.put(requestId, responseConsumer);
sendRequestToRuleEngine(tenantId, request, useQueueFromTbMsg);
scheduleTimeout(request, requestId, requests);
}
@Override
public void onQueueMsg(TransportProtos.RestApiCallResponseMsgProto restApiCallResponseMsg, TbCallback callback) {
UUID requestId = new UUID(restApiCallResponseMsg.getRequestIdMSB(), restApiCallResponseMsg.getRequestIdLSB());
Consumer<TbMsg> consumer = requests.remove(requestId);
if (consumer != null) {
consumer.accept(TbMsg.fromProto(null, restApiCallResponseMsg.getResponseProto(), restApiCallResponseMsg.getResponse(), TbMsgCallback.EMPTY));
} else {
log.trace("[{}] Unknown or stale rest api call response received", requestId);
}
callback.onSuccess();
|
}
private void sendRequestToRuleEngine(TenantId tenantId, TbMsg msg, boolean useQueueFromTbMsg) {
clusterService.pushMsgToRuleEngine(tenantId, msg.getOriginator(), msg, useQueueFromTbMsg, null);
}
private void scheduleTimeout(TbMsg request, UUID requestId, ConcurrentMap<UUID, Consumer<TbMsg>> requestsMap) {
long expirationTime = Long.parseLong(request.getMetaData().getValue("expirationTime"));
long timeout = Math.max(0, expirationTime - System.currentTimeMillis());
log.trace("[{}] processing the request: [{}]", this.hashCode(), requestId);
executor.schedule(() -> {
Consumer<TbMsg> consumer = requestsMap.remove(requestId);
if (consumer != null) {
log.trace("[{}] request timeout detected: [{}]", this.hashCode(), requestId);
consumer.accept(null);
}
}, timeout, TimeUnit.MILLISECONDS);
}
}
|
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\ruleengine\DefaultRuleEngineCallService.java
| 2
|
请完成以下Java代码
|
private void cmd_export()
{
JFileChooser jc = new JFileChooser();
jc.setDialogTitle(Msg.getMsg(Env.getCtx(), "Export"));
jc.setDialogType(JFileChooser.SAVE_DIALOG);
jc.setFileSelectionMode(JFileChooser.FILES_ONLY);
//
if (jc.showSaveDialog(this) != JFileChooser.APPROVE_OPTION)
return;
try
{
EditorKit kit = editorPane.getEditorKit();
OutputStreamWriter writer = new OutputStreamWriter
(new FileOutputStream (jc.getSelectedFile()));
editorPane.write(writer);
writer.flush();
writer.close();
}
catch (Exception e)
{
log.error("HTMLEditor.export" + e.getMessage());
}
} // cmd_export
/*************************************************************************
* Get Html Text
* @return text
*/
public String getHtmlText()
{
return m_text;
} // getHTMLText
/**
* Set Html Text
* @param htmlText
*/
public void setHtmlText (String htmlText)
{
m_text = htmlText;
editorPane.setText(htmlText);
} // setHTMLText
/**************************************************************************
* Test
* @param args ignored
*/
public static void main (String[] args)
{
Adempiere.startupEnvironment(true);
JFrame frame = new JFrame("test");
frame.setVisible(true);
String text = "<html><p>this is a line<br>with <b>bold</> info</html>";
int i = 0;
while (true)
{
HTMLEditor ed = new HTMLEditor (frame, "heading " + ++i, text, true);
text = ed.getHtmlText();
}
} // main
// metas: begin
public HTMLEditor (Frame owner, String title, String htmlText, boolean editable, GridField gridField)
{
super (owner, title == null ? Msg.getMsg(Env.getCtx(), "Editor") : title, true);
BoilerPlateMenu.createFieldMenu(editorPane, null, gridField);
init(owner, htmlText, editable);
}
// metas: end
} // HTMLEditor
/******************************************************************************
* HTML Editor Menu Action
*/
class HTMLEditor_MenuAction
{
|
public HTMLEditor_MenuAction(String name, HTMLEditor_MenuAction[] subMenus)
{
m_name = name;
m_subMenus = subMenus;
}
public HTMLEditor_MenuAction(String name, String actionName)
{
m_name = name;
m_actionName = actionName;
}
public HTMLEditor_MenuAction(String name, Action action)
{
m_name = name;
m_action = action;
}
private String m_name;
private String m_actionName;
private Action m_action;
private HTMLEditor_MenuAction[] m_subMenus;
public boolean isSubMenu()
{
return m_subMenus != null;
}
public boolean isAction()
{
return m_action != null;
}
public String getName()
{
return m_name;
}
public HTMLEditor_MenuAction[] getSubMenus()
{
return m_subMenus;
}
public String getActionName()
{
return m_actionName;
}
public Action getAction()
{
return m_action;
}
} // MenuAction
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\grid\ed\HTMLEditor.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Integer getDateFrom() {
return dateFrom;
}
/**
* Sets the value of the dateFrom property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setDateFrom(Integer value) {
this.dateFrom = value;
}
/**
* Gets the value of the dateTo property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getDateTo() {
return dateTo;
}
/**
* Sets the value of the dateTo property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setDateTo(Integer value) {
this.dateTo = value;
}
/**
* Gets the value of the timeFrom property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getTimeFrom() {
return timeFrom;
}
/**
* Sets the value of the timeFrom property.
*
|
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setTimeFrom(Integer value) {
this.timeFrom = value;
}
/**
* Gets the value of the timeTo property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getTimeTo() {
return timeTo;
}
/**
* Sets the value of the timeTo property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setTimeTo(Integer value) {
this.timeTo = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.dpd\src\main\java-xjc\com\dpd\common\service\types\shipmentservice\_3\Delivery.java
| 2
|
请完成以下Java代码
|
public ChannelDefinitionParse sourceResource(String resource) {
if (name == null) {
name(resource);
}
setStreamSource(new ResourceStreamSource(resource));
return this;
}
public ChannelDefinitionParse sourceString(String string) {
if (name == null) {
name("string");
}
setStreamSource(new StringStreamSource(string));
return this;
}
protected void setStreamSource(StreamSource streamSource) {
if (this.streamSource != null) {
throw new FlowableException("invalid: multiple sources " + this.streamSource + " and " + streamSource);
}
this.streamSource = streamSource;
}
/*
* ------------------- GETTERS AND SETTERS -------------------
*/
|
public List<ChannelDefinitionEntity> getChannelDefinitions() {
return channelDefinitions;
}
public EventDeploymentEntity getDeployment() {
return deployment;
}
public void setDeployment(EventDeploymentEntity deployment) {
this.deployment = deployment;
}
public ChannelModel getChannelModel() {
return channelModel;
}
public void setChannelModel(ChannelModel channelModel) {
this.channelModel = channelModel;
}
}
|
repos\flowable-engine-main\modules\flowable-event-registry\src\main\java\org\flowable\eventregistry\impl\parser\ChannelDefinitionParse.java
| 1
|
请完成以下Java代码
|
public String getLanguage() {
return language;
}
/**
* Sets the value of the language property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLanguage(String value) {
this.language = value;
}
/**
* Gets the value of the modus property.
*
* @return
* possible object is
* {@link String }
*
|
*/
public String getModus() {
if (modus == null) {
return "production";
} else {
return modus;
}
}
/**
* Sets the value of the modus property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setModus(String value) {
this.modus = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_440_response\src\main\java-xjc\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_440\response\ResponseType.java
| 1
|
请完成以下Java代码
|
public static Vertex newB()
{
return new Vertex(Predefine.TAG_BIGIN, " ", new CoreDictionary.Attribute(Nature.begin, Predefine.TOTAL_FREQUENCY / 10), CoreDictionary.getWordID(Predefine.TAG_BIGIN));
}
/**
* 生成线程安全的终止节点
* @return
*/
public static Vertex newE()
{
return new Vertex(Predefine.TAG_END, " ", new CoreDictionary.Attribute(Nature.end, Predefine.TOTAL_FREQUENCY / 10), CoreDictionary.getWordID(Predefine.TAG_END));
}
public int length()
|
{
return realWord.length();
}
@Override
public String toString()
{
return realWord;
// return "WordNode{" +
// "word='" + word + '\'' +
// (word.equals(realWord) ? "" : (", realWord='" + realWord + '\'')) +
//// ", attribute=" + attribute +
// '}';
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\seg\common\Vertex.java
| 1
|
请完成以下Java代码
|
public java.lang.String getReplaceRegExp()
{
return get_ValueAsString(COLUMNNAME_ReplaceRegExp);
}
@Override
public void setTargetFieldName (final java.lang.String TargetFieldName)
{
set_Value (COLUMNNAME_TargetFieldName, TargetFieldName);
}
@Override
public java.lang.String getTargetFieldName()
{
return get_ValueAsString(COLUMNNAME_TargetFieldName);
}
/**
* TargetFieldType AD_Reference_ID=541611
* Reference name: AttributeTypeList
*/
public static final int TARGETFIELDTYPE_AD_Reference_ID=541611;
/** textArea = textArea */
public static final String TARGETFIELDTYPE_TextArea = "textArea";
/** EAN13 = EAN13 */
public static final String TARGETFIELDTYPE_EAN13 = "EAN13";
/** EAN128 = EAN128 */
public static final String TARGETFIELDTYPE_EAN128 = "EAN128";
/** numberField = numberField */
public static final String TARGETFIELDTYPE_NumberField = "numberField";
/** date = date */
public static final String TARGETFIELDTYPE_Date = "date";
/** unitChar = unitChar */
|
public static final String TARGETFIELDTYPE_UnitChar = "unitChar";
/** graphic = graphic */
public static final String TARGETFIELDTYPE_Graphic = "graphic";
@Override
public void setTargetFieldType (final java.lang.String TargetFieldType)
{
set_Value (COLUMNNAME_TargetFieldType, TargetFieldType);
}
@Override
public java.lang.String getTargetFieldType()
{
return get_ValueAsString(COLUMNNAME_TargetFieldType);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java-gen\de\metas\externalsystem\model\X_LeichMehl_PluFile_Config.java
| 1
|
请完成以下Java代码
|
public class PMMContractsBL implements IPMMContractsBL
{
private static final String SYSCONFIG_AD_USER_IN_CHARGE = "de.metas.procurement.C_Flatrate_Term_Create_ProcurementContract.AD_User_InCharge_ID";
@Override
public int getDefaultContractUserInCharge_ID(final Properties ctx)
{
final int ad_Client_ID = Env.getAD_Client_ID(ctx);
final int ad_Org_ID = Env.getAD_Org_ID(ctx);
final int adUserInChargeId = Services.get(ISysConfigBL.class).getIntValue(SYSCONFIG_AD_USER_IN_CHARGE, -1, ad_Client_ID, ad_Org_ID);
return adUserInChargeId <= 0 ? -1 : adUserInChargeId;
}
@Override
public I_AD_User getDefaultContractUserInChargeOrNull(final Properties ctx)
{
final int userInChangeId = getDefaultContractUserInCharge_ID(ctx);
if (userInChangeId <= 0)
{
return null;
}
final I_AD_User userInCharge = InterfaceWrapperHelper.create(ctx, userInChangeId, I_AD_User.class, ITrx.TRXNAME_None);
|
return userInCharge;
}
@Override
public boolean hasPriceOrQty(final I_C_Flatrate_DataEntry dataEntry)
{
if (dataEntry == null)
{
return false;
}
final boolean hasPrice = !InterfaceWrapperHelper.isNull(dataEntry, I_C_Flatrate_DataEntry.COLUMNNAME_FlatrateAmtPerUOM)
&& dataEntry.getFlatrateAmtPerUOM().signum() >= 0;
final boolean hasQty = !InterfaceWrapperHelper.isNull(dataEntry, I_C_Flatrate_DataEntry.COLUMNNAME_Qty_Planned)
&& dataEntry.getQty_Planned().signum() >= 0;
return hasPrice || hasQty;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.procurement.base\src\main\java\de\metas\procurement\base\impl\PMMContractsBL.java
| 1
|
请完成以下Java代码
|
public static X_AD_ReplicationDocument getReplicationDocument(Properties ctx ,int AD_ReplicationStrategy_ID , int AD_Table_ID)
{
final String whereClause = I_AD_ReplicationDocument.COLUMNNAME_AD_ReplicationStrategy_ID + "=? AND "
+ I_AD_ReplicationDocument.COLUMNNAME_AD_Table_ID + "=?";
return new Query(ctx, I_AD_ReplicationDocument.Table_Name, whereClause, null)
.setClient_ID()
.setOnlyActiveRecords(true)
.setRequiredAccess(Access.READ)
.setParameters(AD_ReplicationStrategy_ID, AD_Table_ID)
.first()
;
}
/**
*
* @param AD_Table_ID
* @return X_AD_ReplicationDocument Document to replication
|
*/
public static X_AD_ReplicationDocument getReplicationDocument(Properties ctx ,int AD_ReplicationStrategy_ID , int AD_Table_ID, int C_DocType_ID)
{
final String whereClause = I_AD_ReplicationDocument.COLUMNNAME_AD_ReplicationStrategy_ID + "=? AND "
+ I_AD_ReplicationDocument.COLUMNNAME_AD_Table_ID + "=? AND "
+ I_AD_ReplicationDocument.COLUMNNAME_C_DocType_ID + "=?";
return new Query(ctx, X_AD_ReplicationDocument.Table_Name, whereClause, null)
.setClient_ID()
.setOnlyActiveRecords(true)
.setRequiredAccess(Access.READ)
.setParameters(AD_ReplicationStrategy_ID, AD_Table_ID, C_DocType_ID)
.first();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\MReplicationStrategy.java
| 1
|
请完成以下Java代码
|
public void initData() {
log.info("Context Refreshed !!, Initializing environment (db, folders etc)... ");
File uploadFolder = new File(appProperties.getFileStorage().getUploadFolder());
if (!uploadFolder.exists()) {
if (uploadFolder.mkdirs() && Stream.of(ReceivedFile.FileGroup.values()).allMatch(f -> new File(uploadFolder.getAbsolutePath() + File.separator + f.path).mkdir())) {
log.info("Upload folder created successfully");
} else {
log.info("Failure to create upload folder");
}
}
if (userService.existsByUsername("system")) {
log.info("DB already initialized !!!");
return;
}
Authority adminAuthority = new Authority();
adminAuthority.setName(Constants.ROLE_ADMIN);
authorityService.save(adminAuthority);
Authority userAuthority = new Authority();
userAuthority.setName(Constants.ROLE_USER);
authorityService.save(userAuthority);
String systemUserId = "a621ac4c-6172-4103-9050-b27c053b11eb";
if (userService.exists(UUID.fromString(systemUserId))) {
log.info("DB already initialized !!!");
return;
}
//ID and login are linked with the keycloak export json
AppUser adminUser = new AppUser(systemUserId, "system", "System", "Tiwari", "system@email");
userService.save(adminUser);
AppUser user1 = new AppUser("d1460f56-7f7e-43e1-8396-bddf39dba08f", "user1", "Ganesh", "Tiwari", "user1@email");
userService.save(user1);
AppUser user2 = new AppUser("fa6820a5-cf39-4cbf-9e50-89cc832bebee", "user2", "Jyoti", "Kattel", "user2@email");
userService.save(user2);
createArticle(adminUser, "Admin's First Article", "Content1 Admin");
|
createArticle(adminUser, "Admin's Second Article", "Content2 Admin");
createArticle(user1, "User1 Article", "Content User 1");
createArticle(user2, "User2 Article", "Content User 2");
}
void createArticle(AppUser user, String title, String content) {
var n = new Article();
n.setCreatedByUser(user);
n.setTitle(title);
n.setContent(content);
articleRepository.save(n);
Comment c = new Comment();
c.setStatus(CommentStatus.SHOWING);
c.setContent("Test comment for " + title);
c.setArticleId(n.getId());
c.setCreatedByUser(user); //self
commentRepository.save(c);
}
}
|
repos\spring-boot-web-application-sample-master\main-app\main-webapp\src\main\java\gt\app\DataCreator.java
| 1
|
请完成以下Java代码
|
public BigDecimal getPriceStd()
{
calculatePrice(false);
return round(result.getPriceStd());
}
/**
* Get Price Limit
*
* @return limit
*/
public BigDecimal getPriceLimit()
{
calculatePrice(false);
return round(result.getPriceLimit());
}
/**
* Is Price List enforded?
*
* @return enforce limit
*/
public boolean isEnforcePriceLimit()
{
calculatePrice(false);
return result.getEnforcePriceLimit().isTrue();
} // isEnforcePriceLimit
/**
* Is a DiscountSchema active?
*
* @return active Discount Schema
*/
public boolean isDiscountSchema()
{
return !result.isDisallowDiscount()
&& result.isUsesDiscountSchema();
} // isDiscountSchema
/**
* Is the Price Calculated (i.e. found)?
*
* @return calculated
*/
public boolean isCalculated()
{
return result.isCalculated();
} // isCalculated
/**
* Convenience method to get priceStd with the discount already subtracted. Note that the result matches the former behavior of {@link #getPriceStd()}.
*/
public BigDecimal mkPriceStdMinusDiscount()
{
calculatePrice(false);
return result.getDiscount().subtractFromBase(result.getPriceStd(), result.getPrecision().toInt());
}
@Override
public String toString()
{
return "MProductPricing ["
+ pricingCtx
+ ", " + result
+ "]";
}
|
public void setConvertPriceToContextUOM(boolean convertPriceToContextUOM)
{
pricingCtx.setConvertPriceToContextUOM(convertPriceToContextUOM);
}
public void setReferencedObject(Object referencedObject)
{
pricingCtx.setReferencedObject(referencedObject);
}
// metas: end
public int getC_TaxCategory_ID()
{
return TaxCategoryId.toRepoId(result.getTaxCategoryId());
}
public boolean isManualPrice()
{
return pricingCtx.getManualPriceEnabled().isTrue();
}
public void setManualPrice(boolean manualPrice)
{
pricingCtx.setManualPriceEnabled(manualPrice);
}
public void throwProductNotOnPriceListException()
{
throw new ProductNotOnPriceListException(pricingCtx);
}
} // MProductPrice
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\MProductPricing.java
| 1
|
请完成以下Java代码
|
public final void initialize(final ModelValidationEngine engine, final MClient client)
{
interceptor.initialize(engine, client);
}
@Override
public final int getAD_Client_ID()
{
return interceptor.getAD_Client_ID();
}
@Override
public final String modelChange(final PO po, final int changeTypeCode) throws Exception
{
final ModelChangeType changeType = ModelChangeType.valueOf(changeTypeCode);
interceptor.onModelChange(po, changeType);
return null;
}
@Override
public final String docValidate(final PO po, final int timingCode) throws Exception
{
final DocTimingType timing = DocTimingType.valueOf(timingCode);
interceptor.onDocValidate(po, timing);
return null;
}
@Override
public final String login(final int AD_Org_ID, final int AD_Role_ID, final int AD_User_ID)
{
interceptor.onUserLogin(AD_Org_ID, AD_Role_ID, AD_User_ID);
|
return null;
}
@Override
public void onUserLogin(final int AD_Org_ID, final int AD_Role_ID, final int AD_User_ID)
{
interceptor.onUserLogin(AD_Org_ID, AD_Role_ID, AD_User_ID);
}
@Override
public void beforeLogout(final MFSession session)
{
if (userLoginListener != null)
{
userLoginListener.beforeLogout(session);
}
}
@Override
public void afterLogout(final MFSession session)
{
if (userLoginListener != null)
{
userLoginListener.afterLogout(session);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\modelvalidator\ModelInterceptor2ModelValidatorWrapper.java
| 1
|
请完成以下Java代码
|
public static List<String> importDateSave(List<?> list, Class serviceClass, List<String> errorMessage, String errorFlag) {
IService bean =(IService) SpringContextUtils.getBean(serviceClass);
for (int i = 0; i < list.size(); i++) {
try {
boolean save = bean.save(list.get(i));
if(!save){
throw new Exception(errorFlag);
}
} catch (Exception e) {
String message = e.getMessage().toLowerCase();
int lineNumber = i + 1;
// 通过索引名判断出错信息
if (message.contains(CommonConstant.SQL_INDEX_UNIQ_SYS_ROLE_CODE)) {
errorMessage.add("第 " + lineNumber + " 行:角色编码已经存在,忽略导入。");
} else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_JOB_CLASS_NAME)) {
errorMessage.add("第 " + lineNumber + " 行:任务类名已经存在,忽略导入。");
}else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_CODE)) {
errorMessage.add("第 " + lineNumber + " 行:职务编码已经存在,忽略导入。");
}else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_DEPART_ORG_CODE)) {
errorMessage.add("第 " + lineNumber + " 行:部门编码已经存在,忽略导入。");
}else {
errorMessage.add("第 " + lineNumber + " 行:未知错误,忽略导入");
log.error(e.getMessage(), e);
}
}
}
return errorMessage;
}
public static List<String> importDateSaveOne(Object obj, Class serviceClass,List<String> errorMessage,int i,String errorFlag) {
IService bean =(IService) SpringContextUtils.getBean(serviceClass);
try {
boolean save = bean.save(obj);
if(!save){
|
throw new Exception(errorFlag);
}
} catch (Exception e) {
String message = e.getMessage().toLowerCase();
int lineNumber = i + 1;
// 通过索引名判断出错信息
if (message.contains(CommonConstant.SQL_INDEX_UNIQ_SYS_ROLE_CODE)) {
errorMessage.add("第 " + lineNumber + " 行:角色编码已经存在,忽略导入。");
} else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_JOB_CLASS_NAME)) {
errorMessage.add("第 " + lineNumber + " 行:任务类名已经存在,忽略导入。");
}else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_CODE)) {
errorMessage.add("第 " + lineNumber + " 行:职务编码已经存在,忽略导入。");
}else if (message.contains(CommonConstant.SQL_INDEX_UNIQ_DEPART_ORG_CODE)) {
errorMessage.add("第 " + lineNumber + " 行:部门编码已经存在,忽略导入。");
}else {
errorMessage.add("第 " + lineNumber + " 行:未知错误,忽略导入");
log.error(e.getMessage(), e);
}
}
return errorMessage;
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-boot-base-core\src\main\java\org\jeecg\common\util\ImportExcelUtil.java
| 1
|
请完成以下Java代码
|
public class HmmUtils
{
private static final Pattern hmmPattern = Pattern.compile("^-?[0-9]+:[0-5][0-9]$");
@NonNull
public static String secondsToHmm(final long seconds)
{
final long hours = seconds / 3600;
final long hoursRemainder = seconds - (hours * 3600);
final long mins = hoursRemainder < 0 ? -( hoursRemainder / 60 ) : hoursRemainder / 60;
return hours + ":" + (mins < 10L ? "0" + mins : mins);
}
public static long hmmToSeconds(@NonNull final String hmm)
{
if (!matches(hmm))
{
throw new RuntimeException("Wrong format! Was expecting a value in format: " + hmmPattern.toString() + ", but received: " + hmm);
|
}
final String[] parts = hmm.split(":");
final long hours = Long.parseLong(parts[0]);
final long minutes = Long.parseLong(parts[1]);
return (hours * 3600) + (minutes * 60);
}
public static boolean matches(@NonNull final String hmmValue)
{
final Matcher matcher = hmmPattern.matcher(hmmValue);
return matcher.matches();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\de\metas\util\time\HmmUtils.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public abstract class BeanIds {
private static final String PREFIX = "org.springframework.security.";
/**
* The "global" AuthenticationManager instance, registered by the
* <authentication-manager> element
*/
public static final String AUTHENTICATION_MANAGER = PREFIX + "authenticationManager";
/**
* External alias for FilterChainProxy bean, for use in web.xml files
*/
public static final String SPRING_SECURITY_FILTER_CHAIN = "springSecurityFilterChain";
public static final String CONTEXT_SOURCE_SETTING_POST_PROCESSOR = PREFIX + "contextSettingPostProcessor";
public static final String USER_DETAILS_SERVICE = PREFIX + "userDetailsService";
public static final String USER_DETAILS_SERVICE_FACTORY = PREFIX + "userDetailsServiceFactory";
|
public static final String METHOD_ACCESS_MANAGER = PREFIX + "defaultMethodAccessManager";
public static final String FILTER_CHAIN_PROXY = PREFIX + "filterChainProxy";
public static final String FILTER_CHAINS = PREFIX + "filterChains";
public static final String METHOD_SECURITY_METADATA_SOURCE_ADVISOR = PREFIX + "methodSecurityMetadataSourceAdvisor";
public static final String EMBEDDED_UNBOUNDID = PREFIX + "unboundidServerContainer";
public static final String CONTEXT_SOURCE = PREFIX + "securityContextSource";
public static final String DEBUG_FILTER = PREFIX + "debugFilter";
}
|
repos\spring-security-main\config\src\main\java\org\springframework\security\config\BeanIds.java
| 2
|
请完成以下Java代码
|
public class SSLSocketEchoServer {
static void startServer(int port) throws IOException {
ServerSocketFactory factory = SSLServerSocketFactory.getDefault();
try (SSLServerSocket listener = (SSLServerSocket) factory.createServerSocket(port)) {
listener.setNeedClientAuth(true);
listener.setEnabledCipherSuites(new String[] { "TLS_AES_128_GCM_SHA256" });
listener.setEnabledProtocols(new String[] { "TLSv1.3" });
System.out.println("listening for messages...");
try (Socket socket = listener.accept()) {
InputStream is = new BufferedInputStream(socket.getInputStream());
OutputStream os = new BufferedOutputStream(socket.getOutputStream());
byte[] data = new byte[2048];
int len = is.read(data);
if (len <= 0) {
|
throw new IOException("no data received");
}
String message = new String(data, 0, len);
System.out.printf("server received %d bytes: %s%n", len, message);
String response = message + " processed by server";
os.write(response.getBytes(), 0, response.getBytes().length);
os.flush();
}
System.out.println("message processed, exiting");
}
}
public static void main(String[] args) throws IOException {
startServer(8443);
}
}
|
repos\tutorials-master\core-java-modules\core-java-11-2\src\main\java\com\baeldung\httpsclientauthentication\SSLSocketEchoServer.java
| 1
|
请完成以下Java代码
|
public ReturnsInOutHeaderFiller setExternalId(@Nullable final String externalId)
{
this.externalId = externalId;
return this;
}
private String getExternalId()
{
return this.externalId;
}
private String getExternalResourceURL()
{
return this.externalResourceURL;
}
public ReturnsInOutHeaderFiller setExternalResourceURL(@Nullable final String externalResourceURL)
|
{
this.externalResourceURL = externalResourceURL;
return this;
}
public ReturnsInOutHeaderFiller setDateReceived(@Nullable final Timestamp dateReceived)
{
this.dateReceived = dateReceived;
return this;
}
private Timestamp getDateReceived()
{
return dateReceived;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\inout\returns\ReturnsInOutHeaderFiller.java
| 1
|
请完成以下Java代码
|
protected IExternalSystemChildConfigId getExternalChildConfigId()
{
final int id;
if (this.childConfigId > 0)
{
id = this.childConfigId;
}
else
{
id = externalSystemConfigDAO.getChildByParentIdAndType(ExternalSystemParentConfigId.ofRepoId(getRecord_ID()), getExternalSystemType())
.get().getId().getRepoId();
}
return ExternalSystemAlbertaConfigId.ofRepoId(id);
}
@Override
protected Map<String, String> extractExternalSystemParameters(@NonNull final ExternalSystemParentConfig externalSystemParentConfig)
{
final ExternalSystemAlbertaConfig albertaConfig = ExternalSystemAlbertaConfig.cast(externalSystemParentConfig.getChildConfig());
final Map<String, String> parameters = new HashMap<>();
parameters.put(ExternalSystemConstants.PARAM_API_KEY, albertaConfig.getApiKey());
parameters.put(ExternalSystemConstants.PARAM_BASE_PATH, albertaConfig.getBaseUrl());
parameters.put(ExternalSystemConstants.PARAM_TENANT, albertaConfig.getTenant());
if (getSinceParameterValue() != null)
{
parameters.put(ExternalSystemConstants.PARAM_UPDATED_AFTER_OVERRIDE, String.valueOf(TimeUtil.asInstant(getSinceParameterValue())));
}
parameters.put(ExternalSystemConstants.PARAM_CHILD_CONFIG_VALUE, albertaConfig.getValue());
|
if (albertaConfig.getRootBPartnerIdForUsers() != null)
{
parameters.put(ExternalSystemConstants.PARAM_ROOT_BPARTNER_ID_FOR_USERS, String.valueOf(albertaConfig.getRootBPartnerIdForUsers().getRepoId()));
}
return parameters;
}
@NonNull
protected String getTabName()
{
return ExternalSystemType.Alberta.getValue();
}
@NonNull
protected ExternalSystemType getExternalSystemType()
{
return ExternalSystemType.Alberta;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java\de\metas\externalsystem\process\InvokeAlbertaAction.java
| 1
|
请完成以下Java代码
|
public void setMarketingPlatformGatewayId (java.lang.String MarketingPlatformGatewayId)
{
set_Value (COLUMNNAME_MarketingPlatformGatewayId, MarketingPlatformGatewayId);
}
/** Get Marketing Platform GatewayId.
@return Marketing Platform GatewayId */
@Override
public java.lang.String getMarketingPlatformGatewayId ()
{
return (java.lang.String)get_Value(COLUMNNAME_MarketingPlatformGatewayId);
}
/** Set MKTG_Consent.
@param MKTG_Consent_ID MKTG_Consent */
@Override
public void setMKTG_Consent_ID (int MKTG_Consent_ID)
{
if (MKTG_Consent_ID < 1)
set_ValueNoCheck (COLUMNNAME_MKTG_Consent_ID, null);
else
set_ValueNoCheck (COLUMNNAME_MKTG_Consent_ID, Integer.valueOf(MKTG_Consent_ID));
}
/** Get MKTG_Consent.
@return MKTG_Consent */
@Override
public int getMKTG_Consent_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_MKTG_Consent_ID);
if (ii == null)
return 0;
return ii.intValue();
}
@Override
public de.metas.marketing.base.model.I_MKTG_ContactPerson getMKTG_ContactPerson() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_MKTG_ContactPerson_ID, de.metas.marketing.base.model.I_MKTG_ContactPerson.class);
}
|
@Override
public void setMKTG_ContactPerson(de.metas.marketing.base.model.I_MKTG_ContactPerson MKTG_ContactPerson)
{
set_ValueFromPO(COLUMNNAME_MKTG_ContactPerson_ID, de.metas.marketing.base.model.I_MKTG_ContactPerson.class, MKTG_ContactPerson);
}
/** Set MKTG_ContactPerson.
@param MKTG_ContactPerson_ID MKTG_ContactPerson */
@Override
public void setMKTG_ContactPerson_ID (int MKTG_ContactPerson_ID)
{
if (MKTG_ContactPerson_ID < 1)
set_Value (COLUMNNAME_MKTG_ContactPerson_ID, null);
else
set_Value (COLUMNNAME_MKTG_ContactPerson_ID, Integer.valueOf(MKTG_ContactPerson_ID));
}
/** Get MKTG_ContactPerson.
@return MKTG_ContactPerson */
@Override
public int getMKTG_ContactPerson_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_MKTG_ContactPerson_ID);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.marketing\base\src\main\java-gen\de\metas\marketing\base\model\X_MKTG_Consent.java
| 1
|
请完成以下Spring Boot application配置
|
app.datasource.url=jdbc:mysql://localhost:3306/numberdb?createDatabaseIfNotExist=true&useSSL=false
app.datasource.username=root
app.datasource.password=root
app.datasource.initialization-mode=always
app.datasource.platform=mysql
app.datasource.initial-size=5
app.datasource.max-total=15
# disable auto-commit
#app.datasource.default-auto-commit=false
# more settings can be added
|
as app.datasource.*
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
spring.jpa.open-in-view=false
spring.jpa.hibernate.ddl-auto=none
|
repos\Hibernate-SpringBoot-master\HibernateSpringBootDataSourceBuilderDBCP2Kickoff\src\main\resources\application.properties
| 2
|
请完成以下Java代码
|
public Double getHighestSystemLoad() {
return highestSystemLoad;
}
public void setHighestSystemLoad(Double highestSystemLoad) {
this.highestSystemLoad = highestSystemLoad;
}
public Long getAvgRt() {
return avgRt;
}
public void setAvgRt(Long avgRt) {
this.avgRt = avgRt;
}
public Long getMaxThread() {
return maxThread;
}
public void setMaxThread(Long maxThread) {
this.maxThread = maxThread;
}
public Double getQps() {
return qps;
}
public void setQps(Double qps) {
this.qps = qps;
}
public Double getHighestCpuUsage() {
return highestCpuUsage;
}
public void setHighestCpuUsage(Double highestCpuUsage) {
this.highestCpuUsage = highestCpuUsage;
}
|
@Override
public Date getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
public Date getGmtModified() {
return gmtModified;
}
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
@Override
public SystemRule toRule() {
SystemRule rule = new SystemRule();
rule.setHighestSystemLoad(highestSystemLoad);
rule.setAvgRt(avgRt);
rule.setMaxThread(maxThread);
rule.setQps(qps);
rule.setHighestCpuUsage(highestCpuUsage);
return rule;
}
}
|
repos\spring-boot-student-master\spring-boot-student-sentinel-dashboard\src\main\java\com\alibaba\csp\sentinel\dashboard\datasource\entity\rule\SystemRuleEntity.java
| 1
|
请完成以下Java代码
|
public class ProductPricingConditionsViewFactory extends PricingConditionsViewFactoryTemplate
{
public static final String WINDOW_ID_STRING = "productPricingConditions";
public static final WindowId WINDOW_ID = WindowId.fromJson(WINDOW_ID_STRING);
public ProductPricingConditionsViewFactory(
@NonNull final LookupDataSourceFactory lookupDataSourceFactory)
{
super(lookupDataSourceFactory, WINDOW_ID);
}
@Override
protected PricingConditionsRowData createPricingConditionsRowData(final CreateViewRequest request)
{
final Set<ProductId> productIds = ProductId.ofRepoIds(request.getFilterOnlyIds());
Check.assumeNotEmpty(productIds, "productIds is not empty");
final IProductDAO productsRepo = Services.get(IProductDAO.class);
final Set<ProductAndCategoryAndManufacturerId> products = productsRepo.retrieveProductAndCategoryAndManufacturersByProductIds(productIds);
return preparePricingConditionsRowData()
.pricingConditionsBreaksExtractor(pricingConditions -> pricingConditions.streamBreaksMatchingAnyOfProducts(products))
.basePricingSystemPriceCalculator(this::calculateBasePricingSystemPrice)
.load();
}
private Money calculateBasePricingSystemPrice(final BasePricingSystemPriceCalculatorRequest request)
{
final IPricingConditionsService pricingConditionsService = Services.get(IPricingConditionsService.class);
return pricingConditionsService.calculatePricingConditions(CalculatePricingConditionsRequest.builder()
.forcePricingConditionsBreak(request.getPricingConditionsBreak())
.pricingCtx(createPricingContext(request))
.build())
|
.map(result -> Money.of(result.getPriceStdOverride(), result.getCurrencyId()))
.orElse(null);
}
private IPricingContext createPricingContext(final BasePricingSystemPriceCalculatorRequest request)
{
final IPricingBL pricingBL = Services.get(IPricingBL.class);
final PricingConditionsBreak pricingConditionsBreak = request.getPricingConditionsBreak();
final IEditablePricingContext pricingCtx = pricingBL.createPricingContext();
final ProductId productId = pricingConditionsBreak.getMatchCriteria().getProductId();
pricingCtx.setProductId(productId);
pricingCtx.setQty(BigDecimal.ONE);
pricingCtx.setBPartnerId(request.getBpartnerId());
pricingCtx.setSOTrx(SOTrx.ofBoolean(request.isSOTrx()));
return pricingCtx;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\order\pricingconditions\view\ProductPricingConditionsViewFactory.java
| 1
|
请完成以下Java代码
|
public int getM_IolCandHandler_ID()
{
return get_ValueAsInt(COLUMNNAME_M_IolCandHandler_ID);
}
@Override
public void setM_ShipmentSchedule_AttributeConfig_ID (final int M_ShipmentSchedule_AttributeConfig_ID)
{
if (M_ShipmentSchedule_AttributeConfig_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_ShipmentSchedule_AttributeConfig_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_ShipmentSchedule_AttributeConfig_ID, M_ShipmentSchedule_AttributeConfig_ID);
}
@Override
public int getM_ShipmentSchedule_AttributeConfig_ID()
|
{
return get_ValueAsInt(COLUMNNAME_M_ShipmentSchedule_AttributeConfig_ID);
}
@Override
public void setOnlyIfInReferencedASI (final boolean OnlyIfInReferencedASI)
{
set_Value (COLUMNNAME_OnlyIfInReferencedASI, OnlyIfInReferencedASI);
}
@Override
public boolean isOnlyIfInReferencedASI()
{
return get_ValueAsBoolean(COLUMNNAME_OnlyIfInReferencedASI);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\de\metas\inoutcandidate\model\X_M_ShipmentSchedule_AttributeConfig.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class EmbedRatpackApp {
@Autowired private Content content;
@Autowired private ArticleList list;
@Bean
public Action<Chain> hello() {
return chain -> chain.get("hello", ctx -> ctx.render(content.body()));
}
@Bean
public Action<Chain> list() {
return chain -> chain.get("list", ctx -> ctx.render(list
.articles()
.toString()));
|
}
@Bean
public ServerConfig ratpackServerConfig() {
return ServerConfig
.builder()
.findBaseDir("public")
.build();
}
public static void main(String[] args) {
SpringApplication.run(EmbedRatpackApp.class, args);
}
}
|
repos\tutorials-master\web-modules\ratpack\src\main\java\com\baeldung\spring\EmbedRatpackApp.java
| 2
|
请完成以下Java代码
|
public void onRefreshAll(final ICalloutRecord calloutRecord)
{
for (final ITabCallout tabCallout : tabCallouts)
{
tabCallout.onRefreshAll(calloutRecord);
}
}
@Override
public void onAfterQuery(final ICalloutRecord calloutRecord)
{
for (final ITabCallout tabCallout : tabCallouts)
{
tabCallout.onAfterQuery(calloutRecord);
}
}
public static final class Builder
{
private final List<ITabCallout> tabCalloutsAll = new ArrayList<>();
private Builder()
{
super();
}
public ITabCallout build()
{
if (tabCalloutsAll.isEmpty())
{
return ITabCallout.NULL;
}
else if (tabCalloutsAll.size() == 1)
|
{
return tabCalloutsAll.get(0);
}
else
{
return new CompositeTabCallout(tabCalloutsAll);
}
}
public Builder addTabCallout(final ITabCallout tabCallout)
{
Check.assumeNotNull(tabCallout, "tabCallout not null");
if (tabCalloutsAll.contains(tabCallout))
{
return this;
}
tabCalloutsAll.add(tabCallout);
return this;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\ui\spi\impl\CompositeTabCallout.java
| 1
|
请完成以下Java代码
|
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_PA_Benchmark[")
.append(get_ID()).append("]");
return sb.toString();
}
/** AccumulationType AD_Reference_ID=370 */
public static final int ACCUMULATIONTYPE_AD_Reference_ID=370;
/** Average = A */
public static final String ACCUMULATIONTYPE_Average = "A";
/** Sum = S */
public static final String ACCUMULATIONTYPE_Sum = "S";
/** Set Accumulation Type.
@param AccumulationType
How to accumulate data on time axis
*/
public void setAccumulationType (String AccumulationType)
{
set_Value (COLUMNNAME_AccumulationType, AccumulationType);
}
/** Get Accumulation Type.
@return How to accumulate data on time axis
*/
public String getAccumulationType ()
{
return (String)get_Value(COLUMNNAME_AccumulationType);
}
/** 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 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 Benchmark.
@param PA_Benchmark_ID
Performance Benchmark
*/
public void setPA_Benchmark_ID (int PA_Benchmark_ID)
{
if (PA_Benchmark_ID < 1)
set_ValueNoCheck (COLUMNNAME_PA_Benchmark_ID, null);
else
set_ValueNoCheck (COLUMNNAME_PA_Benchmark_ID, Integer.valueOf(PA_Benchmark_ID));
}
/** Get Benchmark.
@return Performance Benchmark
*/
public int getPA_Benchmark_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_PA_Benchmark_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_Benchmark.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class MainApplication {
private final BookstoreService bookstoreService;
public MainApplication(BookstoreService bookstoreService) {
this.bookstoreService = bookstoreService;
}
public static void main(String[] args) {
SpringApplication.run(MainApplication.class, args);
}
@Bean
public ApplicationRunner init() {
return args -> {
System.out.println("Fetch authors via a DTO with setters:");
|
List<AuthorDtoWithSetters> authors1 = bookstoreService.fetchAuthorsWithSetters();
for (AuthorDtoWithSetters author : authors1) {
System.out.println("Author name: " + author.getName()
+ " | Age: " + author.getAge());
}
System.out.println("\nFetch authors via a DTO without setters:");
List<AuthorDtoNoSetters> authors2 = bookstoreService.fetchAuthorsNoSetters();
for (AuthorDtoNoSetters author : authors2) {
System.out.println("Author name: " + author.getName()
+ " | Age: " + author.getAge());
}
};
}
}
|
repos\Hibernate-SpringBoot-master\HibernateSpringBootDtoResultTransformer\src\main\java\com\bookstore\MainApplication.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
private static String computeEffectiveConfigLevel(
@NonNull final String name,
@NonNull final ClientId clientId,
@NonNull final OrgId orgId,
@Nullable final String currentConfigLevel)
{
if (clientId.isRegular() || orgId.isRegular())
{
// Get the configuration level from the System Record
String newConfigLevel = retrieveConfigLevel(name, ClientId.SYSTEM);
if (newConfigLevel == null)
{
// not found for system
// if saving an org parameter - look config in client
if (orgId.isRegular())
{
newConfigLevel = retrieveConfigLevel(name, clientId);
}
}
if (newConfigLevel != null)
{
// Disallow saving org parameter if the system parameter is marked as 'S' or 'C'
if (orgId.isRegular()
&& (newConfigLevel.equals(X_AD_SysConfig.CONFIGURATIONLEVEL_System) || newConfigLevel.equals(X_AD_SysConfig.CONFIGURATIONLEVEL_Client)))
{
throw new AdempiereException("Can't Save Org Level. This is a system or client parameter, you can't save it as organization parameter");
}
// Disallow saving client parameter if the system parameter is marked as 'S'
if (clientId.isRegular() && newConfigLevel.equals(X_AD_SysConfig.CONFIGURATIONLEVEL_System))
{
throw new AdempiereException("Can't Save Client Level. This is a system parameter, you can't save it as client parameter");
}
return newConfigLevel;
}
else
{
// fix possible wrong config level
if (orgId.isRegular())
{
return X_AD_SysConfig.CONFIGURATIONLEVEL_Organization;
}
else if (clientId.isRegular() && X_AD_SysConfig.CONFIGURATIONLEVEL_System.equals(currentConfigLevel))
{
return X_AD_SysConfig.CONFIGURATIONLEVEL_Client;
}
}
}
|
return currentConfigLevel;
}
@Nullable
private static String retrieveConfigLevel(
@NonNull final String name,
@NonNull final ClientId clientId)
{
final String sql = "SELECT ConfigurationLevel FROM AD_SysConfig WHERE Name=? AND AD_Client_ID=? AND AD_Org_ID=?";
final List<Object> sqlParams = Arrays.asList(name, clientId, OrgId.ANY);
return DB.getSQLValueStringEx(ITrx.TRXNAME_ThreadInherited, sql, sqlParams);
}
@ModelChange(timings = { ModelValidator.TYPE_AFTER_NEW, ModelValidator.TYPE_AFTER_CHANGE })
public void afterSave(final I_AD_SysConfig record)
{
listeners.fireValueChanged(record.getName(), record.getValue());
// IMPORTANT: we have to reset the SysConfigs cache once again
// because cache is invalidated while saving, and it's also accessed before the trx which changed a give sysconfig gets committed,
// so at that time the sysconfigs cache is still stale.
// To make sure we have fresh sysconfigs, we are resetting the cache again after trx commit.
final CacheMgt cacheMgt = CacheMgt.get();
final int recordId = record.getAD_SysConfig_ID();
trxManager.runAfterCommit(() -> cacheMgt.reset(I_AD_SysConfig.Table_Name, recordId));
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\sysconfig\interceptor\AD_SysConfig.java
| 2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.