instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请完成以下Java代码
|
public boolean greaterThan(SentinelVersion version) {
if (version == null) {
return true;
}
return getFullVersion() > version.getFullVersion();
}
public boolean greaterOrEqual(SentinelVersion version) {
if (version == null) {
return true;
}
return getFullVersion() >= version.getFullVersion();
}
@Override
public boolean equals(Object o) {
if (this == o) { return true; }
if (o == null || getClass() != o.getClass()) { return false; }
SentinelVersion that = (SentinelVersion)o;
if (getFullVersion() != that.getFullVersion()) { return false; }
return postfix != null ? postfix.equals(that.postfix) : that.postfix == null;
}
|
@Override
public int hashCode() {
int result = majorVersion;
result = 31 * result + minorVersion;
result = 31 * result + fixVersion;
result = 31 * result + (postfix != null ? postfix.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "SentinelVersion{" +
"majorVersion=" + majorVersion +
", minorVersion=" + minorVersion +
", fixVersion=" + fixVersion +
", postfix='" + postfix + '\'' +
'}';
}
}
|
repos\spring-boot-student-master\spring-boot-student-sentinel-dashboard\src\main\java\com\alibaba\csp\sentinel\dashboard\datasource\entity\SentinelVersion.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class MainApplication {
@Autowired
private BookstoreService bookstoreService;
public static void main(String[] args) {
SpringApplication.run(MainApplication.class, args);
}
@Bean
public ApplicationRunner init() {
return args -> {
System.out.println("\n\n Calling fetchAuthorByNameAsEntityJpql():");
bookstoreService.fetchAuthorByNameAsEntityJpql();
System.out.println("\n\n Calling fetchAuthorByNameAsDtoNameEmailJpql():");
bookstoreService.fetchAuthorByNameAsDtoNameEmailJpql();
System.out.println("\n\n Calling fetchAuthorByNameAsDtoGenreJpql():");
|
bookstoreService.fetchAuthorByNameAsDtoGenreJpql();
System.out.println("\n\n Calling fetchAuthorByNameAndAgeAsEntityJpql():");
bookstoreService.fetchAuthorByNameAndAgeAsEntityJpql();
System.out.println("\n\n Calling fetchAuthorByNameAndAgeAsDtoNameEmailJpql():");
bookstoreService.fetchAuthorByNameAndAgeAsDtoNameEmailJpql();
System.out.println("\n\n Calling fetchAuthorByNameAndAgeAsDtoGenreJpql():");
bookstoreService.fetchAuthorByNameAndAgeAsDtoGenreJpql();
System.out.println("\n\n Calling fetchAuthorsAsEntitiesJpql():");
bookstoreService.fetchAuthorsAsEntitiesJpql();
System.out.println("\n\n Calling fetchAuthorsAsDtoJpql():");
bookstoreService.fetchAuthorsAsDtoJpql();
};
}
}
|
repos\Hibernate-SpringBoot-master\HibernateSpringBootDynamicProjectionClass\src\main\java\com\bookstore\MainApplication.java
| 2
|
请完成以下Java代码
|
public String getServerID()
{
return "ReplicationProcessor" + impProcessor.getIMP_Processor_ID();
}
@Override
public Timestamp getDateNextRun(boolean requery)
{
if (requery)
{
InterfaceWrapperHelper.refresh(impProcessor);
}
return impProcessor.getDateNextRun();
}
@Override
public void setDateNextRun(Timestamp dateNextWork)
{
impProcessor.setDateNextRun(dateNextWork);
}
@Override
public Timestamp getDateLastRun()
{
return impProcessor.getDateLastRun();
}
@Override
public void setDateLastRun(Timestamp dateLastRun)
{
impProcessor.setDateLastRun(dateLastRun);
}
@Override
public boolean saveOutOfTrx()
|
{
InterfaceWrapperHelper.save(impProcessor, ITrx.TRXNAME_None);
return true;
}
@Override
public AdempiereProcessorLog[] getLogs()
{
final List<AdempiereProcessorLog> list = Services.get(IIMPProcessorDAO.class).retrieveAdempiereProcessorLogs(impProcessor);
return list.toArray(new AdempiereProcessorLog[list.size()]);
}
@Override
public String get_TableName()
{
return I_IMP_Processor.Table_Name;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\server\rpl\api\impl\IMPProcessorAdempiereProcessorAdapter.java
| 1
|
请完成以下Java代码
|
public void validate()
{
}
public String generate()
{
return null;
}
public void executeQuery()
{
}
public Trx getTrx() {
return trx;
}
public void setTrx(Trx trx) {
this.trx = trx;
}
public ProcessInfo getProcessInfo() {
return pi;
}
public void setProcessInfo(ProcessInfo pi) {
this.pi = pi;
}
public boolean isSelectionActive() {
return m_selectionActive;
}
public void setSelectionActive(boolean active) {
m_selectionActive = active;
}
public ArrayList<Integer> getSelection() {
return selection;
}
public void setSelection(ArrayList<Integer> selection) {
this.selection = selection;
}
public String getTitle() {
return title;
}
|
public void setTitle(String title) {
this.title = title;
}
public int getReportEngineType() {
return reportEngineType;
}
public void setReportEngineType(int reportEngineType) {
this.reportEngineType = reportEngineType;
}
public MPrintFormat getPrintFormat() {
return this.printFormat;
}
public void setPrintFormat(MPrintFormat printFormat) {
this.printFormat = printFormat;
}
public String getAskPrintMsg() {
return askPrintMsg;
}
public void setAskPrintMsg(String askPrintMsg) {
this.askPrintMsg = askPrintMsg;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\apps\form\GenForm.java
| 1
|
请完成以下Java代码
|
protected LdapContext openContext() {
return openContext(ldapConfiguration.getManagerDn(), ldapConfiguration.getManagerPassword());
}
protected void closeLdapCtx() {
closeLdapCtx(initialContext);
}
protected void closeLdapCtx(LdapContext context) {
if (context != null) {
try {
context.close();
} catch (NamingException e) {
// ignore
LdapPluginLogger.INSTANCE.exceptionWhenClosingLdapContext(e);
}
}
}
public LdapSearchResults search(String baseDn, String searchFilter) {
try {
return new LdapSearchResults(initialContext.search(baseDn, searchFilter, ldapConfiguration.getSearchControls()));
} catch (NamingException e) {
throw new IdentityProviderException("LDAP search request failed.", e);
}
}
public void setRequestControls(List<Control> listControls) {
try {
initialContext.setRequestControls(listControls.toArray(new Control[0]));
} catch (NamingException e) {
throw new IdentityProviderException("LDAP server failed to set request controls.", e);
}
}
public Control[] getResponseControls() {
try {
return initialContext.getResponseControls();
} catch (NamingException e) {
throw new IdentityProviderException("Error occurred while getting the response controls from the LDAP server.", e);
}
}
public static void addPaginationControl(List<Control> listControls, byte[] cookie, Integer pageSize) {
try {
listControls.add(new PagedResultsControl(pageSize, cookie, Control.NONCRITICAL));
} catch (IOException e) {
throw new IdentityProviderException("Pagination couldn't be enabled.", e);
}
}
public static void addSortKey(SortKey sortKey, List<Control> controls) {
try {
controls.add(new SortControl(new SortKey[] { sortKey }, Control.CRITICAL));
} catch (IOException e) {
throw new IdentityProviderException("Sorting couldn't be enabled.", e);
}
}
protected static String getValue(String attrName, Attributes attributes) {
Attribute attribute = attributes.get(attrName);
if (attribute != null) {
try {
|
return (String) attribute.get();
} catch (NamingException e) {
throw new IdentityProviderException("Error occurred while retrieving the value.", e);
}
} else {
return null;
}
}
@SuppressWarnings("unchecked")
public static NamingEnumeration<String> getAllMembers(String attributeId, LdapSearchResults searchResults) {
SearchResult result = searchResults.nextElement();
Attributes attributes = result.getAttributes();
if (attributes != null) {
Attribute memberAttribute = attributes.get(attributeId);
if (memberAttribute != null) {
try {
return (NamingEnumeration<String>) memberAttribute.getAll();
} catch (NamingException e) {
throw new IdentityProviderException("Value couldn't be retrieved.", e);
}
}
}
return null;
}
}
|
repos\camunda-bpm-platform-master\engine-plugins\identity-ldap\src\main\java\org\camunda\bpm\identity\impl\ldap\LdapClient.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public KieSession getKieSession(Resource dt) {
KieFileSystem kieFileSystem = kieServices.newKieFileSystem()
.write(dt);
KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem)
.buildAll();
KieRepository kieRepository = kieServices.getRepository();
ReleaseId krDefaultReleaseId = kieRepository.getDefaultReleaseId();
KieContainer kieContainer = kieServices.newKieContainer(krDefaultReleaseId);
KieSession ksession = kieContainer.newKieSession();
return ksession;
}
/*
* Can be used for debugging
|
* Input excelFile example: com/baeldung/drools/rules/Discount.drl.xls
*/
public String getDrlFromExcel(String excelFile) {
DecisionTableConfiguration configuration = KnowledgeBuilderFactory.newDecisionTableConfiguration();
configuration.setInputType(DecisionTableInputType.XLS);
Resource dt = ResourceFactory.newClassPathResource(excelFile, getClass());
DecisionTableProviderImpl decisionTableProvider = new DecisionTableProviderImpl();
String drl = decisionTableProvider.loadFromResource(dt, null);
return drl;
}
}
|
repos\tutorials-master\drools\src\main\java\com\baeldung\drools\config\DroolsBeanFactory.java
| 2
|
请完成以下Java代码
|
public void keyPressed (KeyEvent e)
{
} // keyPressed
/**
* Key Typed
* @param e ignored
*/
@Override
public void keyTyped (KeyEvent e)
{
} // keyTyped
/**
* Add Action Listener
* @param listener listener
*/
@Override
public void addActionListener (ActionListener listener)
{
m_text.addActionListener(listener);
} // addActionListener
@Override
public void addMouseListener(MouseListener l)
{
m_text.addMouseListener(l);
}
/**
* Data Binding to MTable (via GridController) - Enter pressed
* @param e event
*/
@Override
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == m_button)
{
action_button();
return;
}
// Data Binding
try
{
fireVetoableChange(m_columnName, m_oldText, getText());
}
catch (PropertyVetoException pve)
{
}
} // actionPerformed
/**
* Preliminary check if this current URL is valid.
*
* NOTE: This method is used to check if we shall enable the "browse/action button", so for performance purposes we are not actually validate if the URL is really valid.
*
* @return true if value
*/
private final boolean isValidURL()
{
final String urlString = m_text.getText();
if (Check.isEmpty(urlString, true))
{
return false;
}
return true;
}
/**
* Action button pressed - show URL
*/
private void action_button()
{
String urlString = m_text.getText();
if (!Check.isEmpty(urlString, true))
{
urlString = urlString.trim();
try
{
// validate the URL
new URL(urlString);
Env.startBrowser(urlString);
return;
}
catch (Exception e)
{
final String message = e.getLocalizedMessage();
ADialog.warn(0, this, "URLnotValid", message);
}
}
} // action button
/**
* Set Field/WindowNo for ValuePreference
* @param mField field
*/
@Override
|
public void setField (GridField mField)
{
this.m_mField = mField;
EditorContextPopupMenu.onGridFieldSet(this);
} // setField
@Override
public GridField getField() {
return m_mField;
}
/**
* Set Text
* @param text text
*/
public void setText (String text)
{
m_text.setText (text);
validateOnTextChanged();
} // setText
/**
* Get Text (clear)
* @return text
*/
public String getText ()
{
String text = m_text.getText();
return text;
} // getText
/**
* Focus Gained.
* Enabled with Obscure
* @param e event
*/
public void focusGained (FocusEvent e)
{
m_infocus = true;
setText(getText()); // clear
} // focusGained
/**
* Focus Lost
* Enabled with Obscure
* @param e event
*/
public void focusLost (FocusEvent e)
{
m_infocus = false;
setText(getText()); // obscure
} // focus Lost
// metas
@Override
public boolean isAutoCommit()
{
return true;
}
@Override
public final ICopyPasteSupportEditor getCopyPasteSupport()
{
return m_text == null ? NullCopyPasteSupportEditor.instance : m_text.getCopyPasteSupport();
}
} // VURL
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\grid\ed\VURL.java
| 1
|
请完成以下Java代码
|
default String getTokenEndpointAuthenticationSigningAlgorithm() {
return getClaimAsString(OidcClientMetadataClaimNames.TOKEN_ENDPOINT_AUTH_SIGNING_ALG);
}
/**
* Returns the {@link SignatureAlgorithm JWS} algorithm required for signing the
* {@link OidcIdToken ID Token} issued to the Client
* {@code (id_token_signed_response_alg)}.
* @return the {@link SignatureAlgorithm JWS} algorithm required for signing the
* {@link OidcIdToken ID Token} issued to the Client
*/
default String getIdTokenSignedResponseAlgorithm() {
return getClaimAsString(OidcClientMetadataClaimNames.ID_TOKEN_SIGNED_RESPONSE_ALG);
}
/**
* Returns the Registration Access Token that can be used at the Client Configuration
* Endpoint.
* @return the Registration Access Token that can be used at the Client Configuration
|
* Endpoint
*/
default String getRegistrationAccessToken() {
return getClaimAsString(OidcClientMetadataClaimNames.REGISTRATION_ACCESS_TOKEN);
}
/**
* Returns the {@code URL} of the Client Configuration Endpoint where the Registration
* Access Token can be used.
* @return the {@code URL} of the Client Configuration Endpoint where the Registration
* Access Token can be used
*/
default URL getRegistrationClientUrl() {
return getClaimAsURL(OidcClientMetadataClaimNames.REGISTRATION_CLIENT_URI);
}
}
|
repos\spring-security-main\oauth2\oauth2-authorization-server\src\main\java\org\springframework\security\oauth2\server\authorization\oidc\OidcClientMetadataClaimAccessor.java
| 1
|
请完成以下Java代码
|
public static boolean usingStringMatchesMethod(String text, String suffix) {
if (text == null || suffix == null) {
return false;
}
String regex = ".*" + suffix + "$";
return text.matches(regex);
}
public static boolean usingStringRegionMatchesMethod(String text, String suffix) {
if (text == null || suffix == null) {
return false;
}
int toffset = text.length() - suffix.length();
return text.regionMatches(toffset, suffix, 0, suffix.length());
}
|
public static boolean usingPatternClass(String text, String suffix) {
if (text == null || suffix == null) {
return false;
}
Pattern pattern = Pattern.compile(".*" + suffix + "$");
return pattern.matcher(text)
.find();
}
public static boolean usingApacheCommonsLang(String text, String suffix) {
return StringUtils.endsWith(text, suffix);
}
}
|
repos\tutorials-master\core-java-modules\core-java-string-operations-4\src\main\java\com\baeldung\endswithpattern\StringEndsWithPattern.java
| 1
|
请完成以下Java代码
|
public void setPeriodStatus (java.lang.String PeriodStatus)
{
set_ValueNoCheck (COLUMNNAME_PeriodStatus, PeriodStatus);
}
/** Get Period Status.
@return Current state of this period
*/
@Override
public java.lang.String getPeriodStatus ()
{
return (java.lang.String)get_Value(COLUMNNAME_PeriodStatus);
}
/** Set Verarbeiten.
@param Processing Verarbeiten */
@Override
public void setProcessing (boolean Processing)
{
set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
}
|
/** Get Verarbeiten.
@return Verarbeiten */
@Override
public boolean isProcessing ()
{
Object oo = get_Value(COLUMNNAME_Processing);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_PeriodControl.java
| 1
|
请完成以下Java代码
|
private static void initDatabaseUsingPlainJDBCWithURL() {
try (Connection conn = DriverManager.
getConnection("jdbc:h2:mem:baeldung;INIT=CREATE SCHEMA IF NOT EXISTS baeldung\\;SET SCHEMA baeldung;",
"admin",
"password")) {
conn.createStatement().execute("create table users (name VARCHAR(100) NOT NULL, email VARCHAR(100) NOT NULL);");
System.out.println("Created table users");
conn.createStatement().execute("insert into users (name, email) values ('Mike', 'mike@baeldung.com')");
System.out.println("Added user mike");
}
catch (Exception e) {
e.printStackTrace();
}
}
/**
* Initialize in-memory database using plain JDBC and SQL
* statements in a file.
*/
private static void initDatabaseUsingPlainJDBCWithFile() {
try (Connection conn = DriverManager.
getConnection("jdbc:h2:mem:baeldung;INIT=RUNSCRIPT FROM 'src/main/resources/h2init.sql';",
"admin",
"password")) {
conn.createStatement().execute("insert into users (name, email) values ('Mike', 'mike@baeldung.com')");
System.out.println("Added user mike");
}
|
catch (Exception e) {
e.printStackTrace();
}
}
/**
* Initialize in-memory database using Spring Boot
* properties. See article for full details of required
* properties for this method to work.
*/
private static void initDatabaseUsingSpring(DataSource ds) {
try (Connection conn = ds.getConnection()) {
conn.createStatement().execute("insert into users (name, email) values ('Mike', 'mike@baeldung.com')");
System.out.println("Added user mike");
}
catch (Exception e) {
e.printStackTrace();
}
}
}
|
repos\tutorials-master\libraries-data-db\src\main\java\com\baeldung\libraries\h2\H2InitDemoApplication.java
| 1
|
请完成以下Java代码
|
public List<String> readMultiLines(@NonNull final byte[] data, @NonNull final Charset charset) throws IOException
{
return ByteSource.wrap(data).asCharSource(charset).readLines(new MultiLineProcessor());
}
/**
* Read file that has not any multi-line text
*
* @param file
* @param charset
* @return
* @throws IOException
*/
public List<String> readRegularLines(@NonNull final File file, @NonNull final Charset charset) throws IOException
{
return Files.readLines(file, charset, new SingleLineProcessor());
}
public List<String> readRegularLines(@NonNull final byte[] data, @NonNull final Charset charset) throws IOException
{
return ByteSource.wrap(data).asCharSource(charset).readLines(new SingleLineProcessor());
}
/**
|
* Build the preview from the loaded lines
*
* @param lines
* @return
*/
public String buildDataPreview(@NonNull final List<String> lines)
{
String dataPreview = lines.stream()
.limit(MAX_LOADED_LINES)
.collect(Collectors.joining("\n"));
if (lines.size() > MAX_LOADED_LINES)
{
dataPreview = dataPreview + "\n......................................................\n";
}
return dataPreview;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\impexp\parser\FileImportReader.java
| 1
|
请完成以下Java代码
|
public static void jdkFlatMapping() {
System.out.println("JDK FlatMap -> Uncomment line 68 to test");
System.out.println("====================================");
int[][] intOfInts = new int[][]{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
IntStream mapToInt = Arrays.stream(intOfInts)
.map(intArr -> Arrays.stream(intArr))
.flatMapToInt(val -> val.map(n -> {
return n * n;
}))
.peek(n -> System.out.println("Peeking at " + n));
//Uncomment to execute pipeline
//mapToInt.forEach(n -> System.out.println("FlatMapped Result "+n));
}
public static void vavrStreamManipulation() {
System.out.println("Vavr Stream Manipulation");
System.out.println("====================================");
List<String> stringList = new ArrayList<>();
stringList.add("foo");
|
stringList.add("bar");
stringList.add("baz");
Stream<String> vavredStream = Stream.ofAll(stringList);
vavredStream.forEach(item -> System.out.println("Vavr Stream item: " + item));
Stream<String> vavredStream2 = vavredStream.insert(2, "buzz");
vavredStream2.forEach(item -> System.out.println("Vavr Stream item after stream addition: " + item));
stringList.forEach(item -> System.out.println("List item after stream addition: " + item));
Stream<String> deletionStream = vavredStream.remove("bar");
deletionStream.forEach(item -> System.out.println("Vavr Stream item after stream item deletion: " + item));
}
public static void vavrStreamDistinct() {
Stream<String> vavredStream = Stream.of("foo", "bar", "baz", "buxx", "bar", "bar", "foo");
Stream<String> distinctVavrStream = vavredStream.distinctBy((y, z) -> {
return y.compareTo(z);
});
distinctVavrStream.forEach(item -> System.out.println("Vavr Stream item after distinct query " + item));
}
}
|
repos\tutorials-master\vavr-modules\java-vavr-stream\src\main\java\com\baeldung\samples\java\vavr\VavrSampler.java
| 1
|
请完成以下Java代码
|
protected void configure(HttpSecurity http) throws Exception {
http
.csrf().disable()
.authorizeRequests()
.antMatchers("/", "index", "/css/*", "/js/*").permitAll()
.antMatchers("/api/**").hasRole(STUDENT.name()) // given role each user
.antMatchers(HttpMethod.DELETE,"/management/api/**").hasAuthority(COURSE_WRITE.name())
.antMatchers(HttpMethod.POST, "/management/api/**").hasAuthority(COURSE_WRITE.name())
.antMatchers(HttpMethod.PUT, "/management/api/**").hasAuthority(COURSE_WRITE.name())
.antMatchers(HttpMethod.GET, "/management/api/**").hasAnyRole(ADMIN.name(), ADMINTRAINEE.name())
.anyRequest()
.authenticated()
.and()
.httpBasic();
}
@Override
@Bean
protected UserDetailsService userDetailsService() {
// Permission User(s)
UserDetails urunovUser =
User.builder()
.username("urunov")
.password(passwordEncoder.encode("urunov1987"))
.authorities("STUDENT")
.authorities(STUDENT.getGrantedAuthorities())
// .roles(STUDENT.name()) // ROLE_STUDENT
.build();
UserDetails lindaUser = User.builder()
.username("linda")
.password(passwordEncoder.encode("linda333"))
|
.authorities("ADMIN")
.authorities(ADMIN.getGrantedAuthorities())
// .roles(ADMIN.name()) // ROLE_ADMIN
.build();
UserDetails tomUser = User.builder()
.username("tom")
.password(passwordEncoder.encode("tom555"))
.authorities("ADMINTRAINEE")
.authorities(ADMINTRAINEE.getGrantedAuthorities())
// .roles(ADMINTRAINEE.name()) // ROLE ADMINTRAINEE
.build();
UserDetails hotamboyUser = User.builder()
.username("hotam")
.password(passwordEncoder.encode("hotamboy"))
.build();
return new InMemoryUserDetailsManager( // manage user(s)
lindaUser,
urunovUser,
tomUser,
hotamboyUser
);
}
}
|
repos\SpringBoot-Projects-FullStack-master\Advanced-SpringSecure\spring-security-encode\src\main\java\uz\bepro\secure\springsecurityencode\security\ApplicationSecurityConfig.java
| 1
|
请完成以下Java代码
|
private static void updatePhoneAndFax(
@NonNull final I_I_BPartner importRecord,
@NonNull final I_C_BPartner_Location bpartnerLocation)
{
if (importRecord.getPhone() != null)
{
bpartnerLocation.setPhone(importRecord.getPhone());
}
if (importRecord.getPhone2() != null)
{
bpartnerLocation.setPhone2(importRecord.getPhone2());
}
if (importRecord.getFax() != null)
{
bpartnerLocation.setFax(importRecord.getFax());
}
}
private void fireImportValidator(
@NonNull final I_I_BPartner importRecord,
|
@NonNull final I_C_BPartner_Location bpartnerLocation)
{
ModelValidationEngine.get().fireImportValidate(process, importRecord, bpartnerLocation, IImportInterceptor.TIMING_AFTER_IMPORT);
}
@VisibleForTesting
static boolean extractIsShipTo(@NonNull final I_I_BPartner importRecord)
{
return importRecord.isShipToDefault() || importRecord.isShipTo();
}
@VisibleForTesting
static boolean extractIsBillTo(@NonNull final I_I_BPartner importRecord)
{
return importRecord.isBillToDefault() || importRecord.isBillTo();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\bpartner\impexp\BPartnerLocationImportHelper.java
| 1
|
请完成以下Java代码
|
public class TablePageQueryImpl implements TablePageQuery, Command<TablePage>, Serializable {
private static final long serialVersionUID = 1L;
transient CommandExecutor commandExecutor;
transient AbstractEngineConfiguration engineConfiguration;
protected String tableName;
protected String order;
protected int firstResult;
protected int maxResults;
public TablePageQueryImpl() {
}
public TablePageQueryImpl(CommandExecutor commandExecutor, AbstractEngineConfiguration engineConfiguration) {
this.commandExecutor = commandExecutor;
this.engineConfiguration = engineConfiguration;
}
@Override
public TablePageQueryImpl tableName(String tableName) {
this.tableName = tableName;
return this;
}
@Override
public TablePageQueryImpl orderAsc(String column) {
addOrder(column, ListQueryParameterObject.SORTORDER_ASC);
return this;
}
@Override
public TablePageQueryImpl orderDesc(String column) {
addOrder(column, ListQueryParameterObject.SORTORDER_DESC);
return this;
}
|
public String getTableName() {
return tableName;
}
protected void addOrder(String column, String sortOrder) {
if (order == null) {
order = "";
} else {
order = order + ", ";
}
order = order + column + " " + sortOrder;
}
@Override
public TablePage listPage(int firstResult, int maxResults) {
this.firstResult = firstResult;
this.maxResults = maxResults;
return commandExecutor.execute(this);
}
@Override
public TablePage execute(CommandContext commandContext) {
return engineConfiguration.getTableDataManager().getTablePage(this, firstResult, maxResults);
}
public String getOrder() {
return order;
}
}
|
repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\persistence\entity\TablePageQueryImpl.java
| 1
|
请完成以下Java代码
|
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getEmail() {
|
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
}
|
repos\tutorials-master\web-modules\jakarta-ee\src\main\java\com\baeldung\eclipse\krazo\User.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getCalcuationCode() {
return calcuationCode;
}
/**
* Sets the value of the calcuationCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCalcuationCode(String value) {
this.calcuationCode = value;
}
/**
* Gets the value of the vatRate property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getVATRate() {
return vatRate;
}
/**
* Sets the value of the vatRate property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setVATRate(BigDecimal value) {
this.vatRate = value;
}
/**
* Gets the value of the allowanceOrChargeQualifier property.
*
* @return
* possible object is
* {@link String }
|
*
*/
public String getAllowanceOrChargeQualifier() {
return allowanceOrChargeQualifier;
}
/**
* Sets the value of the allowanceOrChargeQualifier property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAllowanceOrChargeQualifier(String value) {
this.allowanceOrChargeQualifier = value;
}
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\extensions\edifact\AdditionalChargesAndReductionsType.java
| 2
|
请完成以下Java代码
|
public void deleteExistingADElementLinkForFieldId(final AdFieldId adFieldId)
{
// IMPORTANT: we have to call delete directly because we don't want to have the AD_Element_Link_ID is the migration scripts
DB.executeUpdateAndThrowExceptionOnFail(
"DELETE FROM " + I_AD_Element_Link.Table_Name + " WHERE AD_Field_ID=" + adFieldId.getRepoId(),
ITrx.TRXNAME_ThreadInherited);
}
@Override
public void recreateADElementLinkForTabId(@NonNull final AdTabId adTabId)
{
deleteExistingADElementLinkForTabId(adTabId);
createADElementLinkForTabId(adTabId);
}
@Override
public void createADElementLinkForTabId(@NonNull final AdTabId adTabId)
{
// NOTE: no params because we want to log migration scripts
DB.executeFunctionCallEx(ITrx.TRXNAME_ThreadInherited,
MigrationScriptFileLoggerHolder.DDL_PREFIX + "select AD_Element_Link_Create_Missing_Tab(" + adTabId.getRepoId() + ")",
new Object[] {});
}
@Override
public void deleteExistingADElementLinkForTabId(final AdTabId adTabId)
{
// IMPORTANT: we have to call delete directly because we don't want to have the AD_Element_Link_ID is the migration scripts
DB.executeUpdateAndThrowExceptionOnFail(
"DELETE FROM " + I_AD_Element_Link.Table_Name + " WHERE AD_Tab_ID=" + adTabId.getRepoId(),
ITrx.TRXNAME_ThreadInherited);
}
@Override
|
public void recreateADElementLinkForWindowId(final AdWindowId adWindowId)
{
deleteExistingADElementLinkForWindowId(adWindowId);
createADElementLinkForWindowId(adWindowId);
}
@Override
public void createADElementLinkForWindowId(final AdWindowId adWindowId)
{
// NOTE: no params because we want to log migration scripts
DB.executeFunctionCallEx(ITrx.TRXNAME_ThreadInherited,
MigrationScriptFileLoggerHolder.DDL_PREFIX + "select AD_Element_Link_Create_Missing_Window(" + adWindowId.getRepoId() + ")",
new Object[] {});
}
@Override
public void deleteExistingADElementLinkForWindowId(final AdWindowId adWindowId)
{
// IMPORTANT: we have to call delete directly because we don't want to have the AD_Element_Link_ID is the migration scripts
DB.executeUpdateAndThrowExceptionOnFail(
"DELETE FROM " + I_AD_Element_Link.Table_Name + " WHERE AD_Window_ID=" + adWindowId.getRepoId(),
ITrx.TRXNAME_ThreadInherited);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\element\api\impl\ElementLinkBL.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class UserAuthToken
{
@NonNull UserId userId;
@NonNull String authToken;
@Nullable String description;
@NonNull ClientId clientId;
@NonNull OrgId orgId;
@NonNull RoleId roleId;
@Builder
private UserAuthToken(
@NonNull final UserId userId,
@NonNull final String authToken,
@Nullable final String description,
@NonNull final ClientId clientId,
@NonNull final OrgId orgId,
|
@NonNull final RoleId roleId)
{
Check.assume(userId.isRegularUser(), "userId shall be regular user: {}", userId);
Check.assumeNotEmpty(authToken, "authToken is not empty");
// Check.assume(clientId.isRegular(), "clientId shall be regular"); allow SYSTEM client, just as we allow SYSTEM users to log into WEBUI
// Check.assume(orgId.isRegular(), "orgId shall be regular"); allow Org=* as well, just as we allow users to log into the UI with Org=*
Check.assume(roleId.isRegular(), "roleId shall be regular");
this.userId = userId;
this.authToken = authToken;
this.description = description;
this.clientId = clientId;
this.orgId = orgId;
this.roleId = roleId;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\security\UserAuthToken.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public String buildJoinCondition(
@NonNull final String targetTableNameOrAlias,
@Nullable final String selectionTableNameOrAlias)
{
Check.assumeNotEmpty(targetTableNameOrAlias, "targetTableNameOrAlias not empty");
final String selectionTableNameOrAliasWithDot = StringUtils.trimBlankToOptional(selectionTableNameOrAlias)
.map(alias -> alias + ".")
.orElse("");
final StringBuilder sql = new StringBuilder();
for (final FTSJoinColumn joinColumn : joinColumns)
{
if (sql.length() > 0)
{
sql.append(" AND ");
}
if (joinColumn.isNullable())
{
|
sql.append("(")
.append(selectionTableNameOrAliasWithDot).append(joinColumn.getSelectionTableColumnName()).append(" IS NULL")
.append(" OR ")
.append(targetTableNameOrAlias).append(".").append(joinColumn.getTargetTableColumnName())
.append(" IS NOT DISTINCT FROM ")
.append(selectionTableNameOrAliasWithDot).append(joinColumn.getSelectionTableColumnName())
.append(")");
}
else
{
sql.append(targetTableNameOrAlias).append(".").append(joinColumn.getTargetTableColumnName())
.append("=")
.append(selectionTableNameOrAliasWithDot).append(joinColumn.getSelectionTableColumnName());
}
}
return sql.toString();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.elasticsearch\src\main\java\de\metas\fulltextsearch\config\FTSJoinColumnList.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public void importUser(List<UserExcel> data) {
data.forEach(userExcel -> {
User user = Objects.requireNonNull(BeanUtil.copyProperties(userExcel, User.class));
// 设置部门ID
user.setDeptId(sysClient.getDeptIds(userExcel.getTenantId(), userExcel.getDeptName()));
// 设置岗位ID
user.setPostId(sysClient.getPostIds(userExcel.getTenantId(), userExcel.getPostName()));
// 设置角色ID
user.setRoleId(sysClient.getRoleIds(userExcel.getTenantId(), userExcel.getRoleName()));
// 设置默认密码
user.setPassword(CommonConstant.DEFAULT_PASSWORD);
this.submit(user);
});
}
@Override
public List<UserExcel> exportUser(Wrapper<User> queryWrapper) {
List<UserExcel> userList = baseMapper.exportUser(queryWrapper);
userList.forEach(user -> {
user.setRoleName(StringUtil.join(sysClient.getRoleNames(user.getRoleId())));
user.setDeptName(StringUtil.join(sysClient.getDeptNames(user.getDeptId())));
user.setPostName(StringUtil.join(sysClient.getPostNames(user.getPostId())));
});
return userList;
}
|
@Override
@Transactional(rollbackFor = Exception.class)
public boolean registerGuest(User user, Long oauthId) {
R<Tenant> result = sysClient.getTenant(user.getTenantId());
Tenant tenant = result.getData();
if (!result.isSuccess() || tenant == null || tenant.getId() == null) {
throw new ServiceException("租户信息错误!");
}
UserOauth userOauth = userOauthService.getById(oauthId);
if (userOauth == null || userOauth.getId() == null) {
throw new ServiceException("第三方登陆信息错误!");
}
user.setRealName(user.getName());
user.setAvatar(userOauth.getAvatar());
user.setRoleId(MINUS_ONE);
user.setDeptId(MINUS_ONE);
user.setPostId(MINUS_ONE);
boolean userTemp = this.submit(user);
userOauth.setUserId(user.getId());
userOauth.setTenantId(user.getTenantId());
boolean oauthTemp = userOauthService.updateById(userOauth);
return (userTemp && oauthTemp);
}
}
|
repos\SpringBlade-master\blade-service\blade-system\src\main\java\org\springblade\system\service\impl\UserServiceImpl.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
private List<I_C_AllocationLine> retrieveAllocationLines(final org.compiere.model.I_C_Invoice invoice)
{
Adempiere.assertUnitTestMode();
return db.getRecords(I_C_AllocationLine.class, pojo -> {
if (pojo == null)
{
return false;
}
if (pojo.getC_Invoice_ID() != invoice.getC_Invoice_ID())
{
return false;
}
return true;
});
}
private BigDecimal retrieveAllocatedAmt(final org.compiere.model.I_C_Invoice invoice, final TypedAccessor<BigDecimal> amountAccessor)
{
Adempiere.assertUnitTestMode();
final Properties ctx = InterfaceWrapperHelper.getCtx(invoice);
BigDecimal sum = BigDecimal.ZERO;
for (final I_C_AllocationLine line : retrieveAllocationLines(invoice))
{
final I_C_AllocationHdr ah = line.getC_AllocationHdr();
final BigDecimal lineAmt = amountAccessor.getValue(line);
if ((null != ah) && (ah.getC_Currency_ID() != invoice.getC_Currency_ID()))
{
final BigDecimal lineAmtConv = Services.get(ICurrencyBL.class).convert(
lineAmt, // Amt
CurrencyId.ofRepoId(ah.getC_Currency_ID()), // CurFrom_ID
CurrencyId.ofRepoId(invoice.getC_Currency_ID()), // CurTo_ID
ah.getDateTrx().toInstant(), // ConvDate
CurrencyConversionTypeId.ofRepoIdOrNull(invoice.getC_ConversionType_ID()),
|
ClientId.ofRepoId(line.getAD_Client_ID()),
OrgId.ofRepoId(line.getAD_Org_ID()));
sum = sum.add(lineAmtConv);
}
else
{
sum = sum.add(lineAmt);
}
}
return sum;
}
public BigDecimal retrieveWriteOffAmt(final org.compiere.model.I_C_Invoice invoice)
{
Adempiere.assertUnitTestMode();
return retrieveAllocatedAmt(invoice, o -> {
final I_C_AllocationLine line = (I_C_AllocationLine)o;
return line.getWriteOffAmt();
});
}
@Override
public List<I_C_InvoiceTax> retrieveTaxes(org.compiere.model.I_C_Invoice invoice)
{
throw new UnsupportedOperationException();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\invoice\service\impl\PlainInvoiceDAO.java
| 2
|
请完成以下Java代码
|
private Mono<Void> handleAuthorizationException(ClientRequest request,
OAuth2AuthorizationException authorizationException) {
return Mono.justOrEmpty(request).flatMap((req) -> {
Map<String, Object> attrs = req.attributes();
OAuth2AuthorizedClient authorizedClient = getOAuth2AuthorizedClient(attrs);
if (authorizedClient == null) {
return Mono.empty();
}
Authentication principal = createAuthentication(authorizedClient.getPrincipalName());
HttpServletRequest servletRequest = getRequest(attrs);
HttpServletResponse servletResponse = getResponse(attrs);
return handleAuthorizationFailure(authorizationException, principal, servletRequest, servletResponse);
});
}
/**
* Delegates the failed authorization to the
* {@link OAuth2AuthorizationFailureHandler}.
* @param exception the {@link OAuth2AuthorizationException} to include in the
* failure event
* @param principal the principal associated with the failed authorization attempt
* @param servletRequest the currently active {@code HttpServletRequest}
* @param servletResponse the currently active {@code HttpServletResponse}
* @return a {@link Mono} that completes empty after the
* {@link OAuth2AuthorizationFailureHandler} completes
*/
private Mono<Void> handleAuthorizationFailure(OAuth2AuthorizationException exception, Authentication principal,
HttpServletRequest servletRequest, HttpServletResponse servletResponse) {
|
Runnable runnable = () -> this.authorizationFailureHandler.onAuthorizationFailure(exception, principal,
createAttributes(servletRequest, servletResponse));
// @formatter:off
return Mono.fromRunnable(runnable)
.subscribeOn(Schedulers.boundedElastic())
.then();
// @formatter:on
}
private static Map<String, Object> createAttributes(HttpServletRequest servletRequest,
HttpServletResponse servletResponse) {
Map<String, Object> attributes = new HashMap<>();
attributes.put(HttpServletRequest.class.getName(), servletRequest);
attributes.put(HttpServletResponse.class.getName(), servletResponse);
return attributes;
}
}
}
|
repos\spring-security-main\oauth2\oauth2-client\src\main\java\org\springframework\security\oauth2\client\web\reactive\function\client\ServletOAuth2AuthorizedClientExchangeFilterFunction.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class User
{
@Id @GeneratedValue(strategy=GenerationType.AUTO)
private Integer id;
@Column(nullable=false)
@NotEmpty()
private String name;
@Column(nullable=false, unique=true)
@NotEmpty
@Email(message="{errors.invalid_email}")
private String email;
@Column(nullable=false)
@NotEmpty
@Size(min=4)
private String password;
@ManyToMany(cascade=CascadeType.MERGE)
@JoinTable(
name="user_role",
joinColumns={@JoinColumn(name="USER_ID", referencedColumnName="ID")},
inverseJoinColumns={@JoinColumn(name="ROLE_ID", referencedColumnName="ID")})
private List<Role> roles;
public Integer getId()
{
return id;
}
public void setId(Integer id)
{
this.id = id;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getEmail()
{
|
return email;
}
public void setEmail(String email)
{
this.email = email;
}
public String getPassword()
{
return password;
}
public void setPassword(String password)
{
this.password = password;
}
public List<Role> getRoles()
{
return roles;
}
public void setRoles(List<Role> roles)
{
this.roles = roles;
}
}
|
repos\Spring-Boot-Advanced-Projects-main\springboot-thymeleaf-security-demo\src\main\java\net\alanbinu\springbootsecurity\entities\User.java
| 2
|
请完成以下Java代码
|
public static PPOrderRoutingActivityStatus ofDocStatus(@NonNull final String docStatus)
{
final PPOrderRoutingActivityStatus type = typesByDocStatus.get(docStatus);
if (type == null)
{
throw new AdempiereException("No " + PPOrderRoutingActivityStatus.class + " found for DocStatus: " + docStatus);
}
return type;
}
public void assertCanChangeTo(@NonNull final PPOrderRoutingActivityStatus nextStatus)
{
if (!canChangeTo(nextStatus))
{
throw new AdempiereException("Invalid transition from " + this + " to " + nextStatus);
}
}
private boolean canChangeTo(@NonNull final PPOrderRoutingActivityStatus nextStatus)
{
return allowedTransitions.get(this).contains(nextStatus);
}
public boolean canReport()
{
return this == NOT_STARTED || this == IN_PROGRESS;
}
|
private static final ImmutableMap<String, PPOrderRoutingActivityStatus> typesByDocStatus = Maps.uniqueIndex(Arrays.asList(values()), PPOrderRoutingActivityStatus::getDocStatus);
private static final ImmutableSetMultimap<PPOrderRoutingActivityStatus, PPOrderRoutingActivityStatus> allowedTransitions = ImmutableSetMultimap.<PPOrderRoutingActivityStatus, PPOrderRoutingActivityStatus> builder()
.put(NOT_STARTED, IN_PROGRESS)
.put(NOT_STARTED, COMPLETED)
.put(NOT_STARTED, VOIDED)
.put(IN_PROGRESS, NOT_STARTED)
.put(IN_PROGRESS, COMPLETED)
.put(IN_PROGRESS, VOIDED)
// .put(COMPLETED, NOT_STARTED)
.put(COMPLETED, CLOSED)
.put(COMPLETED, IN_PROGRESS)
.put(COMPLETED, NOT_STARTED)
// .put(COMPLETED, VOIDED)
.put(CLOSED, IN_PROGRESS)
.build();
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\api\PPOrderRoutingActivityStatus.java
| 1
|
请完成以下Java代码
|
public Builder setDisplayName(final Map<String, String> displayNameTrls)
{
this.displayNameTrls = TranslatableStrings.ofMap(displayNameTrls);
return this;
}
public Builder setDisplayName(final ITranslatableString displayNameTrls)
{
this.displayNameTrls = displayNameTrls;
return this;
}
public Builder setDisplayName(final String displayName)
{
displayNameTrls = TranslatableStrings.constant(displayName);
return this;
}
public Builder setDisplayName(final AdMessageKey displayName)
{
return setDisplayName(TranslatableStrings.adMessage(displayName));
}
@Nullable
public ITranslatableString getDisplayNameTrls()
{
if (displayNameTrls != null)
{
return displayNameTrls;
}
if (parameters.size() == 1)
{
return parameters.get(0).getDisplayName();
}
return null;
}
public Builder setFrequentUsed(final boolean frequentUsed)
{
this.frequentUsed = frequentUsed;
return this;
}
public Builder setInlineRenderMode(final DocumentFilterInlineRenderMode inlineRenderMode)
{
this.inlineRenderMode = inlineRenderMode;
return this;
}
private DocumentFilterInlineRenderMode getInlineRenderMode()
{
return inlineRenderMode != null ? inlineRenderMode : DocumentFilterInlineRenderMode.BUTTON;
}
public Builder setParametersLayoutType(final PanelLayoutType parametersLayoutType)
{
this.parametersLayoutType = parametersLayoutType;
return this;
}
private PanelLayoutType getParametersLayoutType()
{
return parametersLayoutType != null ? parametersLayoutType : PanelLayoutType.Panel;
}
public Builder setFacetFilter(final boolean facetFilter)
{
this.facetFilter = facetFilter;
|
return this;
}
public boolean hasParameters()
{
return !parameters.isEmpty();
}
public Builder addParameter(final DocumentFilterParamDescriptor.Builder parameter)
{
parameters.add(parameter);
return this;
}
public Builder addInternalParameter(final String parameterName, final Object constantValue)
{
return addInternalParameter(DocumentFilterParam.ofNameEqualsValue(parameterName, constantValue));
}
public Builder addInternalParameter(final DocumentFilterParam parameter)
{
internalParameters.add(parameter);
return this;
}
public Builder putDebugProperty(final String name, final Object value)
{
Check.assumeNotEmpty(name, "name is not empty");
if (debugProperties == null)
{
debugProperties = new LinkedHashMap<>();
}
debugProperties.put("debug-" + name, value);
return this;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\document\filter\DocumentFilterDescriptor.java
| 1
|
请完成以下Java代码
|
public DocumentId getId()
{
return rowId;
}
@Override
public boolean isProcessed()
{
return false;
}
@Override
public DocumentPath getDocumentPath()
{
return null;
}
@Override
public Set<String> getFieldNames()
{
return values.getFieldNames();
}
@Override
public ViewRowFieldNameAndJsonValues getFieldNameAndJsonValues()
|
{
return values.get(this);
}
public BPartnerId getBPartnerId()
{
return bpartner.getIdAs(BPartnerId::ofRepoId);
}
@Override
public boolean isSingleColumn()
{
return DEFAULT_PAYMENT_ROW.equals(this);
}
@Override
public ITranslatableString getSingleColumnCaption()
{
return msgBL.getTranslatableMsgText(MSG_NO_PAYMENTS_AVAILABLE);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\payment_allocation\PaymentRow.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void setC_Tax_ID (final int C_Tax_ID)
{
if (C_Tax_ID < 1)
set_Value (COLUMNNAME_C_Tax_ID, null);
else
set_Value (COLUMNNAME_C_Tax_ID, C_Tax_ID);
}
@Override
public int getC_Tax_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Tax_ID);
}
@Override
public void setC_UOM_ID (final int C_UOM_ID)
{
if (C_UOM_ID < 1)
set_Value (COLUMNNAME_C_UOM_ID, null);
else
set_Value (COLUMNNAME_C_UOM_ID, C_UOM_ID);
}
@Override
public int getC_UOM_ID()
{
return get_ValueAsInt(COLUMNNAME_C_UOM_ID);
}
@Override
public void setExternalId (final java.lang.String ExternalId)
{
set_Value (COLUMNNAME_ExternalId, ExternalId);
}
@Override
public java.lang.String getExternalId()
{
return get_ValueAsString(COLUMNNAME_ExternalId);
}
@Override
public void setM_Product_ID (final int M_Product_ID)
{
if (M_Product_ID < 1)
set_Value (COLUMNNAME_M_Product_ID, null);
else
set_Value (COLUMNNAME_M_Product_ID, M_Product_ID);
}
@Override
public int getM_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_ID);
}
@Override
public void setPrice (final BigDecimal Price)
{
set_Value (COLUMNNAME_Price, Price);
}
@Override
public BigDecimal getPrice()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Price);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setProductName (final java.lang.String ProductName)
{
set_Value (COLUMNNAME_ProductName, ProductName);
}
|
@Override
public java.lang.String getProductName()
{
return get_ValueAsString(COLUMNNAME_ProductName);
}
@Override
public void setQty (final BigDecimal Qty)
{
set_Value (COLUMNNAME_Qty, Qty);
}
@Override
public BigDecimal getQty()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setScannedBarcode (final @Nullable java.lang.String ScannedBarcode)
{
set_Value (COLUMNNAME_ScannedBarcode, ScannedBarcode);
}
@Override
public java.lang.String getScannedBarcode()
{
return get_ValueAsString(COLUMNNAME_ScannedBarcode);
}
@Override
public void setTaxAmt (final BigDecimal TaxAmt)
{
set_Value (COLUMNNAME_TaxAmt, TaxAmt);
}
@Override
public BigDecimal getTaxAmt()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_TaxAmt);
return bd != null ? bd : BigDecimal.ZERO;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.pos.base\src\main\java-gen\de\metas\pos\repository\model\X_C_POS_OrderLine.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public String getSiteName() {
return siteName;
}
/**
* Sets the value of the siteName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSiteName(String value) {
this.siteName = value;
}
/**
* Gets the value of the contact property.
*
* @return
* possible object is
* {@link String }
|
*
*/
public String getContact() {
return contact;
}
/**
* Sets the value of the contact property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setContact(String value) {
this.contact = value;
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_metasfreshinhousev1\de\metas\edi\esb\jaxb\metasfreshinhousev1\EDICctop119VType.java
| 2
|
请完成以下Java代码
|
public ProcessPreconditionsResolution checkPreconditionsApplicable(final IProcessPreconditionsContext context)
{
if (context.isNoSelection())
{
return ProcessPreconditionsResolution.rejectBecauseNoSelection();
}
else if (!context.isSingleSelection())
{
return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection();
}
return ProcessPreconditionsResolution.accept();
}
@Override
protected String doIt() throws Exception
{
|
final int countCreated = datevExportLinesRepo.createLines(
DATEVExportCreateLinesRequest.builder()
.datevExportId(DATEVExportId.ofRepoId(getRecord_ID()))
.now(SystemTime.asInstant())
.userId(getUserId())
.isOneLinePerInvoiceTax(isOneLinePerInvoiceTax())
.build());
return "@Created@ #" + countCreated;
}
private boolean isOneLinePerInvoiceTax()
{
return sysConfigBL.getBooleanValue(SYS_CONFIG_ONE_LINE_PER_INVOICETAX, false);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.datev\src\main\java\de\metas\datev\process\DATEV_CreateExportLines.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public static Builder withDefaults() {
return new Builder(false, true, true);
}
public boolean shouldObserveRequests() {
return this.observeRequests;
}
public boolean shouldObserveAuthentications() {
return this.observeAuthentications;
}
public boolean shouldObserveAuthorizations() {
return this.observeAuthorizations;
}
/**
* A builder for configuring a {@link SecurityObservationSettings}
*/
public static final class Builder {
private boolean observeRequests;
private boolean observeAuthentications;
private boolean observeAuthorizations;
Builder(boolean observeRequests, boolean observeAuthentications, boolean observeAuthorizations) {
|
this.observeRequests = observeRequests;
this.observeAuthentications = observeAuthentications;
this.observeAuthorizations = observeAuthorizations;
}
public Builder shouldObserveRequests(boolean excludeFilters) {
this.observeRequests = excludeFilters;
return this;
}
public Builder shouldObserveAuthentications(boolean excludeAuthentications) {
this.observeAuthentications = excludeAuthentications;
return this;
}
public Builder shouldObserveAuthorizations(boolean excludeAuthorizations) {
this.observeAuthorizations = excludeAuthorizations;
return this;
}
public SecurityObservationSettings build() {
return new SecurityObservationSettings(this.observeRequests, this.observeAuthentications,
this.observeAuthorizations);
}
}
}
|
repos\spring-security-main\config\src\main\java\org\springframework\security\config\observation\SecurityObservationSettings.java
| 2
|
请完成以下Java代码
|
public Properties getCtx()
{
return InterfaceWrapperHelper.getCtx(qtyReportEvent);
}
@Override
public I_C_BPartner getC_BPartner()
{
return qtyReportEvent.getC_BPartner();
}
@Override
public boolean isContractedProduct()
{
final String contractLine_uuid = qtyReportEvent.getContractLine_UUID();
return !Check.isEmpty(contractLine_uuid, true);
}
@Override
public I_M_Product getM_Product()
{
return qtyReportEvent.getM_Product();
}
@Override
public int getProductId()
{
return qtyReportEvent.getM_Product_ID();
}
@Override
public I_C_UOM getC_UOM()
{
return qtyReportEvent.getC_UOM();
}
@Override
public I_C_Flatrate_Term getC_Flatrate_Term()
{
return qtyReportEvent.getC_Flatrate_Term();
}
@Override
public I_C_Flatrate_DataEntry getC_Flatrate_DataEntry()
{
return InterfaceWrapperHelper.create(qtyReportEvent.getC_Flatrate_DataEntry(), I_C_Flatrate_DataEntry.class);
}
@Override
public Object getWrappedModel()
{
return qtyReportEvent;
}
|
@Override
public Timestamp getDate()
{
return qtyReportEvent.getDatePromised();
}
@Override
public BigDecimal getQty()
{
return qtyReportEvent.getQtyPromised();
}
@Override
public void setM_PricingSystem_ID(final int M_PricingSystem_ID)
{
qtyReportEvent.setM_PricingSystem_ID(M_PricingSystem_ID);
}
@Override
public void setM_PriceList_ID(final int M_PriceList_ID)
{
qtyReportEvent.setM_PriceList_ID(M_PriceList_ID);
}
@Override
public void setCurrencyId(final CurrencyId currencyId)
{
qtyReportEvent.setC_Currency_ID(CurrencyId.toRepoId(currencyId));
}
@Override
public void setPrice(final BigDecimal price)
{
qtyReportEvent.setPrice(price);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.procurement.base\src\main\java\de\metas\procurement\base\event\impl\PMMPricingAware_QtyReportEvent.java
| 1
|
请完成以下Java代码
|
private AsyncBatchId getParentAsyncBatchId()
{
return Optional.ofNullable(_parentAsyncBatchId)
.orElse(contextFactory.getThreadInheritedWorkpackageAsyncBatch());
}
@Override
public IAsyncBatchBuilder setParentAsyncBatchId(final AsyncBatchId parentAsyncBatchId)
{
_parentAsyncBatchId = parentAsyncBatchId;
return this;
}
@Override
public IAsyncBatchBuilder setName(final String name)
{
_name = name;
return this;
}
public String getName()
{
return _name;
}
@Override
public IAsyncBatchBuilder setDescription(final String description)
{
_description = description;
return this;
}
private String getDescription()
{
return _description;
}
private OrgId getOrgId()
{
|
return orgId;
}
@Override
public IAsyncBatchBuilder setC_Async_Batch_Type(final String internalName)
{
_asyncBatchType = asyncBatchDAO.retrieveAsyncBatchType(getCtx(), internalName);
return this;
}
public I_C_Async_Batch_Type getC_Async_Batch_Type()
{
Check.assumeNotNull(_asyncBatchType, "_asyncBatchType not null");
return _asyncBatchType;
}
@Override
public IAsyncBatchBuilder setOrgId(final OrgId orgId)
{
this.orgId = orgId;
return this;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.async\src\main\java\de\metas\async\api\impl\AsyncBatchBuilder.java
| 1
|
请完成以下Java代码
|
public Builder setDate(final Date date)
{
this.date = date;
return this;
}
/**
* @param allowedWriteOffTypes allowed write-off types, in the same order they were enabled
*/
public Builder setAllowedWriteOffTypes(final Set<InvoiceWriteOffAmountType> allowedWriteOffTypes)
{
this.allowedWriteOffTypes.clear();
if (allowedWriteOffTypes != null)
{
this.allowedWriteOffTypes.addAll(allowedWriteOffTypes);
}
return this;
}
public Builder addAllowedWriteOffType(final InvoiceWriteOffAmountType allowedWriteOffType)
{
Check.assumeNotNull(allowedWriteOffType, "allowedWriteOffType not null");
allowedWriteOffTypes.add(allowedWriteOffType);
return this;
}
public Builder setWarningsConsumer(final IProcessor<Exception> warningsConsumer)
{
this.warningsConsumer = warningsConsumer;
return this;
}
|
public Builder setDocumentIdsToIncludeWhenQuering(final Multimap<AllocableDocType, Integer> documentIds)
{
this.documentIds = documentIds;
return this;
}
public Builder setFilter_Payment_ID(int filter_Payment_ID)
{
this.filterPaymentId = filter_Payment_ID;
return this;
}
public Builder setFilter_POReference(String filterPOReference)
{
this.filterPOReference = filterPOReference;
return this;
}
public Builder allowPurchaseSalesInvoiceCompensation(final boolean allowPurchaseSalesInvoiceCompensation)
{
this.allowPurchaseSalesInvoiceCompensation = allowPurchaseSalesInvoiceCompensation;
return this;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.swingui\src\main\java\de\metas\banking\payment\paymentallocation\model\PaymentAllocationContext.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void setBIC(String value) {
this.bic = value;
}
/**
* Bank account number.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBankAccountNr() {
return bankAccountNr;
}
/**
* Sets the value of the bankAccountNr property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBankAccountNr(String value) {
this.bankAccountNr = value;
}
/**
* International Bank Account Number.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIBAN() {
return iban;
|
}
/**
* Sets the value of the iban property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIBAN(String value) {
this.iban = value;
}
/**
* Name of the bank account holder.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBankAccountOwner() {
return bankAccountOwner;
}
/**
* Sets the value of the bankAccountOwner property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBankAccountOwner(String value) {
this.bankAccountOwner = value;
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\AccountType.java
| 2
|
请完成以下Java代码
|
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Error.class, BPMN_ELEMENT_ERROR)
.namespaceUri(BpmnModelConstants.BPMN20_NS)
.extendsType(RootElement.class)
.instanceProvider(new ModelTypeInstanceProvider<Error>() {
public Error newInstance(ModelTypeInstanceContext instanceContext) {
return new ErrorImpl(instanceContext);
}
});
nameAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_NAME)
.build();
errorCodeAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_ERROR_CODE)
.build();
camundaErrorMessageAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_ERROR_MESSAGE).namespace(CAMUNDA_NS)
.build();
structureRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_STRUCTURE_REF)
.qNameAttributeReference(ItemDefinition.class)
.build();
typeBuilder.build();
}
public ErrorImpl(ModelTypeInstanceContext context) {
super(context);
}
public String getName() {
return nameAttribute.getValue(this);
}
public void setName(String name) {
|
nameAttribute.setValue(this, name);
}
public String getErrorCode() {
return errorCodeAttribute.getValue(this);
}
public void setErrorCode(String errorCode) {
errorCodeAttribute.setValue(this, errorCode);
}
public String getCamundaErrorMessage() {
return camundaErrorMessageAttribute.getValue(this);
}
public void setCamundaErrorMessage(String camundaErrorMessage) {
camundaErrorMessageAttribute.setValue(this, camundaErrorMessage);
}
public ItemDefinition getStructure() {
return structureRefAttribute.getReferenceTargetElement(this);
}
public void setStructure(ItemDefinition structure) {
structureRefAttribute.setReferenceTargetElement(this, structure);
}
}
|
repos\camunda-bpm-platform-master\model-api\bpmn-model\src\main\java\org\camunda\bpm\model\bpmn\impl\instance\ErrorImpl.java
| 1
|
请完成以下Java代码
|
public SpinXPathQuery xPath(String expression) {
XPath query = getXPathFactory().newXPath();
return new DomXPathQuery(this, query, expression, dataFormat);
}
/**
* Adopts an xml dom element to the owner document of this element if necessary.
*
* @param elementToAdopt the element to adopt
*/
protected void adoptElement(DomXmlElement elementToAdopt) {
Document document = this.domElement.getOwnerDocument();
Element element = elementToAdopt.domElement;
if (!document.equals(element.getOwnerDocument())) {
Node node = document.adoptNode(element);
if (node == null) {
throw LOG.unableToAdoptElement(elementToAdopt);
}
}
}
public String toString() {
StringWriter writer = new StringWriter();
writeToWriter(writer);
return writer.toString();
}
public void writeToWriter(Writer writer) {
dataFormat.getWriter().writeToWriter(writer, this.domElement);
}
/**
* Returns a XPath Factory
*
* @return the XPath factory
|
*/
protected XPathFactory getXPathFactory() {
if (cachedXPathFactory == null) {
cachedXPathFactory = XPathFactory.newInstance();
}
return cachedXPathFactory;
}
public <C> C mapTo(Class<C> javaClass) {
DataFormatMapper mapper = dataFormat.getMapper();
return mapper.mapInternalToJava(this.domElement, javaClass);
}
public <C> C mapTo(String javaClass) {
DataFormatMapper mapper = dataFormat.getMapper();
return mapper.mapInternalToJava(this.domElement, javaClass);
}
}
|
repos\camunda-bpm-platform-master\spin\dataformat-xml-dom\src\main\java\org\camunda\spin\impl\xml\dom\DomXmlElement.java
| 1
|
请完成以下Java代码
|
public class MessageEventReceivedCmd extends NeedsActiveExecutionCmd<Void> {
private static final long serialVersionUID = 1L;
protected final Map<String, Object> payload;
protected final String messageName;
protected final boolean async;
public MessageEventReceivedCmd(String messageName, String executionId, Map<String, Object> processVariables) {
super(executionId);
this.messageName = messageName;
if (processVariables != null) {
this.payload = new HashMap<String, Object>(processVariables);
} else {
this.payload = null;
}
this.async = false;
}
public MessageEventReceivedCmd(String messageName, String executionId, boolean async) {
super(executionId);
this.messageName = messageName;
this.payload = null;
this.async = async;
}
protected Void execute(CommandContext commandContext, ExecutionEntity execution) {
if (messageName == null) {
throw new ActivitiIllegalArgumentException("messageName cannot be null");
}
executeInternal(commandContext, execution);
return null;
}
protected void executeInternal(CommandContext commandContext, ExecutionEntity execution) {
EventSubscriptionEntityManager eventSubscriptionEntityManager =
|
commandContext.getEventSubscriptionEntityManager();
List<EventSubscriptionEntity> eventSubscriptions =
eventSubscriptionEntityManager.findEventSubscriptionsByNameAndExecution(
MessageEventHandler.EVENT_HANDLER_TYPE,
messageName,
executionId
);
if (eventSubscriptions.isEmpty()) {
throw new ActivitiException(
"Execution with id '" +
executionId +
"' does not have a subscription to a message event with name '" +
messageName +
"'"
);
}
// there can be only one:
EventSubscriptionEntity eventSubscriptionEntity = eventSubscriptions.get(0);
eventSubscriptionEntityManager.eventReceived(eventSubscriptionEntity, payload, async);
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\cmd\MessageEventReceivedCmd.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class CallOrderService
{
private final IFlatrateBL flatrateBL = Services.get(IFlatrateBL.class);
private final IOrderBL orderBL = Services.get(IOrderBL.class);
private final IDocTypeBL docTypeBL = Services.get(IDocTypeBL.class);
private final CallOrderSummaryService summaryService;
private final CallOrderDetailService detailService;
private final CallOrderContractService callContractService;
private final CallOrderSummaryRepo summaryRepo;
public CallOrderService(
@NonNull final CallOrderSummaryService summaryService,
@NonNull final CallOrderDetailService detailService,
@NonNull final CallOrderContractService callContractService,
@NonNull final CallOrderSummaryRepo summaryRepo)
{
this.summaryService = summaryService;
this.detailService = detailService;
this.callContractService = callContractService;
this.summaryRepo = summaryRepo;
}
public void handleCallOrderDetailUpsert(@NonNull final UpsertCallOrderDetailRequest request)
{
final FlatrateTermId flatrateTermId = request.getCallOrderContractId();
final Optional<CallOrderSummary> summaryOptional = summaryRepo.getByFlatrateTermId(flatrateTermId);
if (!summaryOptional.isPresent())
{
return;
}
final CallOrderSummary summary = summaryOptional.get();
if (request.getOrderLine() != null)
{
detailService.upsertOrderRelatedDetail(summary.getSummaryId(), request.getOrderLine());
}
else if (request.getShipmentLine() != null)
{
detailService.upsertShipmentRelatedDetail(summary.getSummaryId(), request.getShipmentLine());
}
else if (request.getInvoiceLine() != null)
{
detailService.upsertInvoiceRelatedDetail(summary.getSummaryId(), request.getInvoiceLine());
|
}
}
public void createCallOrderContractIfRequired(@NonNull final I_C_OrderLine ol)
{
if (!callContractService.isCallOrderContractLine(ol))
{
return;
}
if (flatrateBL.existsTermForOrderLine(ol))
{
return;
}
final I_C_Flatrate_Term newCallOrderTerm = callContractService.createCallOrderContract(ol);
summaryService.createSummaryForOrderLine(ol, newCallOrderTerm);
}
public boolean isCallOrder(@NonNull final OrderId orderId)
{
final I_C_Order order = orderBL.getById(orderId);
return isCallOrder(order);
}
public boolean isCallOrder(@NonNull final I_C_Order order)
{
final DocTypeId docTypeTargetId = DocTypeId.ofRepoIdOrNull(order.getC_DocTypeTarget_ID());
if (docTypeTargetId == null)
{
return false;
}
return docTypeBL.isCallOrder(docTypeTargetId);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\callorder\CallOrderService.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public Boolean getWithoutCategory() {
return withoutCategory;
}
public void setWithoutCategory(Boolean withoutCategory) {
this.withoutCategory = withoutCategory;
}
public String getRootScopeId() {
return rootScopeId;
}
public void setRootScopeId(String rootScopeId) {
this.rootScopeId = rootScopeId;
}
public String getParentScopeId() {
|
return parentScopeId;
}
public void setParentScopeId(String parentScopeId) {
this.parentScopeId = parentScopeId;
}
public Set<String> getScopeIds() {
return scopeIds;
}
public void setScopeIds(Set<String> scopeIds) {
this.scopeIds = scopeIds;
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\runtime\task\TaskQueryRequest.java
| 2
|
请完成以下Java代码
|
public static synchronized Date parseDatetime(String dateStr) {
try {
return sdf.parse(dateStr);
} catch (ParseException e) {
return new Date();
}
}
public static synchronized Timestamp parseTimestamp(String dateStr) {
try {
return new Timestamp(sdf.parse(dateStr).getTime());
} catch (ParseException e) {
try {
return new Timestamp(sdf2.parse(dateStr).getTime());
} catch (ParseException ee) {
|
return new Timestamp(System.currentTimeMillis());
}
}
}
public static synchronized String formatTimestamp(Timestamp date) {
return sdf.format(date);
}
public static void main(String[] args) {
Timestamp t = parseTimestamp("08-12月-17 05.38.07.859000 下午");
System.out.println(t);
System.out.println(formatTimestamp(t));
}
}
|
repos\SpringBootBucket-master\springboot-batch\src\main\java\com\xncoding\trans\modules\common\DateUtil.java
| 1
|
请完成以下Java代码
|
public EventModelBuilder parentDeploymentId(String parentDeploymentId) {
this.parentDeploymentId = parentDeploymentId;
return this;
}
@Override
public EventModelBuilder deploymentTenantId(String deploymentTenantId) {
this.deploymentTenantId = deploymentTenantId;
return this;
}
@Override
public EventModelBuilder header(String name, String type) {
eventPayloadDefinitions.put(name, EventPayload.header(name, type));
return this;
}
@Override
public EventModelBuilder headerWithCorrelation(String name, String type) {
eventPayloadDefinitions.put(name, EventPayload.headerWithCorrelation(name, type));
return this;
}
@Override
public EventModelBuilder correlationParameter(String name, String type) {
eventPayloadDefinitions.put(name, EventPayload.correlation(name, type));
return this;
}
@Override
public EventModelBuilder payload(String name, String type) {
eventPayloadDefinitions.put(name, new EventPayload(name, type));
return this;
}
@Override
public EventModelBuilder metaParameter(String name, String type) {
EventPayload payload = new EventPayload(name, type);
payload.setMetaParameter(true);
eventPayloadDefinitions.put(name, payload);
return this;
}
@Override
public EventModelBuilder fullPayload(String name) {
eventPayloadDefinitions.put(name, EventPayload.fullPayload(name));
return this;
}
@Override
public EventModel createEventModel() {
return buildEventModel();
}
|
@Override
public EventDeployment deploy() {
if (resourceName == null) {
throw new FlowableIllegalArgumentException("A resource name is mandatory");
}
EventModel eventModel = buildEventModel();
return eventRepository.createDeployment()
.name(deploymentName)
.addEventDefinition(resourceName, eventJsonConverter.convertToJson(eventModel))
.category(category)
.parentDeploymentId(parentDeploymentId)
.tenantId(deploymentTenantId)
.deploy();
}
protected EventModel buildEventModel() {
EventModel eventModel = new EventModel();
if (StringUtils.isNotEmpty(key)) {
eventModel.setKey(key);
} else {
throw new FlowableIllegalArgumentException("An event definition key is mandatory");
}
eventModel.setPayload(eventPayloadDefinitions.values());
return eventModel;
}
}
|
repos\flowable-engine-main\modules\flowable-event-registry\src\main\java\org\flowable\eventregistry\impl\model\EventModelBuilderImpl.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public UnitType getShipmentNetWeight() {
return shipmentNetWeight;
}
/**
* Sets the value of the shipmentNetWeight property.
*
* @param value
* allowed object is
* {@link UnitType }
*
*/
public void setShipmentNetWeight(UnitType value) {
this.shipmentNetWeight = value;
}
/**
* Gets the value of the shipmentGrossWeight property.
*
* @return
* possible object is
* {@link UnitType }
*
*/
public UnitType getShipmentGrossWeight() {
return shipmentGrossWeight;
}
/**
* Sets the value of the shipmentGrossWeight property.
*
* @param value
* allowed object is
* {@link UnitType }
*
*/
public void setShipmentGrossWeight(UnitType value) {
this.shipmentGrossWeight = value;
}
/**
* Gets the value of the shipmentNumberOfPackages property.
*
* @return
|
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getShipmentNumberOfPackages() {
return shipmentNumberOfPackages;
}
/**
* Sets the value of the shipmentNumberOfPackages property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setShipmentNumberOfPackages(BigInteger value) {
this.shipmentNumberOfPackages = value;
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_ecosio_remadv\at\erpel\schemas\_1p0\documents\extensions\edifact\DeliveryDetailsExtensionType.java
| 2
|
请完成以下Java代码
|
public Object log(ProceedingJoinPoint joinPoint) throws Throwable {
boolean isSuccess = setMdc();
try {
// 执行方法,并获取返回值
return joinPoint.proceed();
} catch (Throwable t) {
throw t;
} finally {
try {
if (isSuccess) {
MDC.remove(MdcConstant.SESSION_KEY);
MDC.remove(MdcConstant.REQUEST_KEY);
}
} catch (Exception e) {
logger.warn(e.getMessage(), e);
}
}
}
/**
* 为每个请求设置唯一标示到MDC容器中
*
* @return
|
*/
private boolean setMdc() {
try {// 设置SessionId
if (StringUtils.isEmpty(MDC.get(MdcConstant.REQUEST_KEY))) {
String sessionId = UUID.randomUUID().toString();
String requestId = UUID.randomUUID().toString().replace("-", "");
MDC.put(MdcConstant.SESSION_KEY, sessionId);
MDC.put(MdcConstant.REQUEST_KEY, requestId);
return true;
}
} catch (Exception e) {
logger.warn(e.getMessage(), e);
}
return false;
}
}
|
repos\spring-boot-student-master\spring-boot-student-log\src\main\java\com\xiaolyuh\aspect\LogTrackAspect.java
| 1
|
请完成以下Java代码
|
public HistoricProcessInstanceQueryImpl createHistoricProcessInstanceQuery() {
return new HistoricProcessInstanceQueryImpl();
}
public HistoricActivityInstanceQueryImpl createHistoricActivityInstanceQuery() {
return new HistoricActivityInstanceQueryImpl();
}
public HistoricTaskInstanceQueryImpl createHistoricTaskInstanceQuery() {
return new HistoricTaskInstanceQueryImpl();
}
public HistoricDetailQueryImpl createHistoricDetailQuery() {
return new HistoricDetailQueryImpl();
}
public HistoricVariableInstanceQueryImpl createHistoricVariableInstanceQuery() {
return new HistoricVariableInstanceQueryImpl();
}
public HistoricJobLogQueryImpl createHistoricJobLogQuery() {
return new HistoricJobLogQueryImpl();
}
|
public UserQueryImpl createUserQuery() {
return new DbUserQueryImpl();
}
public GroupQueryImpl createGroupQuery() {
return new DbGroupQueryImpl();
}
public void registerOptimisticLockingListener(OptimisticLockingListener optimisticLockingListener) {
if(optimisticLockingListeners == null) {
optimisticLockingListeners = new ArrayList<>();
}
optimisticLockingListeners.add(optimisticLockingListener);
}
public List<String> getTableNamesPresentInDatabase() {
return persistenceSession.getTableNamesPresent();
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\db\entitymanager\DbEntityManager.java
| 1
|
请完成以下Java代码
|
private static ITranslatableString extractPriority(final @NotNull DDOrderReference ddOrderReference)
{
final String priority = StringUtils.trimBlankToNull(ddOrderReference.getPriority());
return priority != null
? TranslatableStrings.adRefList(X_DD_Order.PRIORITYRULE_AD_Reference_ID, priority)
: TranslatableStrings.empty();
}
private ITranslatableString extractWarehouseFrom(final @NotNull DDOrderReference ddOrderReference)
{
return TranslatableStrings.anyLanguage(warehouseService.getWarehouseName(ddOrderReference.getFromWarehouseId()));
}
private ITranslatableString extractWarehouseTo(final @NotNull DDOrderReference ddOrderReference)
{
return TranslatableStrings.anyLanguage(warehouseService.getWarehouseName(ddOrderReference.getToWarehouseId()));
}
private ITranslatableString extractPickDate(final @NotNull DDOrderReference ddOrderReference)
{
return TranslatableStrings.dateAndTime(ddOrderReference.getDisplayDate());
}
private ITranslatableString extractPlant(final @NotNull DDOrderReference ddOrderReference)
{
final ResourceId plantId = ddOrderReference.getPlantId();
return plantId != null
? TranslatableStrings.anyLanguage(sourceDocService.getPlantName(plantId))
: TranslatableStrings.empty();
}
private static ITranslatableString extractQty(final @NotNull DDOrderReference ddOrderReference)
{
final Quantity qty = ddOrderReference.getQty();
return qty != null
? TranslatableStrings.builder().appendQty(qty.toBigDecimal(), qty.getUOMSymbol()).build()
: TranslatableStrings.empty();
}
private ITranslatableString extractProductValueAndName(final @NotNull DDOrderReference ddOrderReference)
{
final ProductId productId = ddOrderReference.getProductId();
return productId != null
? TranslatableStrings.anyLanguage(productService.getProductValueAndName(productId))
: TranslatableStrings.empty();
}
private @NotNull ITranslatableString extractGTIN(final @NotNull DDOrderReference ddOrderReference)
{
return Optional.ofNullable(ddOrderReference.getProductId())
.flatMap(productService::getGTIN)
|
.map(GTIN::getAsString)
.map(TranslatableStrings::anyLanguage)
.orElse(TranslatableStrings.empty());
}
@NonNull
private ITranslatableString extractSourceDoc(@NonNull final DDOrderReference ddOrderReference)
{
ImmutablePair<ITranslatableString, String> documentTypeAndNo;
if (ddOrderReference.getSalesOrderId() != null)
{
documentTypeAndNo = sourceDocService.getDocumentTypeAndName(ddOrderReference.getSalesOrderId());
}
else if (ddOrderReference.getPpOrderId() != null)
{
documentTypeAndNo = sourceDocService.getDocumentTypeAndName(ddOrderReference.getPpOrderId());
}
else
{
return TranslatableStrings.empty();
}
return TranslatableStrings.builder()
.append(documentTypeAndNo.getLeft())
.append(" ")
.append(documentTypeAndNo.getRight())
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.distribution.rest-api\src\main\java\de\metas\distribution\mobileui\launchers\DistributionLauncherCaptionProvider.java
| 1
|
请完成以下Java代码
|
public Flux<Route> getRoutes() {
return this.routes;
}
/**
* Clears the routes cache.
* @return routes flux
*/
public Flux<Route> refresh() {
this.cache.remove(CACHE_KEY);
return this.routes;
}
@Override
public void onApplicationEvent(RefreshRoutesEvent event) {
try {
if (this.cache.containsKey(CACHE_KEY) && event.isScoped()) {
final Mono<List<Route>> scopedRoutes = fetch(event.getMetadata()).collect(Collectors.toList())
.onErrorResume(s -> Mono.just(List.of()));
scopedRoutes.subscribe(scopedRoutesList -> {
updateCache(Flux.concat(Flux.fromIterable(scopedRoutesList), getNonScopedRoutes(event))
.sort(AnnotationAwareOrderComparator.INSTANCE));
}, this::handleRefreshError);
}
else {
final Mono<List<Route>> allRoutes = fetch().collect(Collectors.toList());
allRoutes.subscribe(list -> updateCache(Flux.fromIterable(list)), this::handleRefreshError);
}
}
catch (Throwable e) {
handleRefreshError(e);
}
}
private synchronized void updateCache(Flux<Route> routes) {
routes.materialize()
|
.collect(Collectors.toList())
.subscribe(this::publishRefreshEvent, this::handleRefreshError);
}
private void publishRefreshEvent(List<Signal<Route>> signals) {
cache.put(CACHE_KEY, signals);
Objects.requireNonNull(applicationEventPublisher, "ApplicationEventPublisher is required");
applicationEventPublisher.publishEvent(new RefreshRoutesResultEvent(this));
}
private Flux<Route> getNonScopedRoutes(RefreshRoutesEvent scopedEvent) {
return this.getRoutes()
.filter(route -> !RouteLocator.matchMetadata(route.getMetadata(), scopedEvent.getMetadata()));
}
private void handleRefreshError(Throwable throwable) {
if (log.isErrorEnabled()) {
log.error("Refresh routes error !!!", throwable);
}
Objects.requireNonNull(applicationEventPublisher, "ApplicationEventPublisher is required");
applicationEventPublisher.publishEvent(new RefreshRoutesResultEvent(this, throwable));
}
@Override
public int getOrder() {
return 0;
}
@Override
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
this.applicationEventPublisher = applicationEventPublisher;
}
}
|
repos\spring-cloud-gateway-main\spring-cloud-gateway-server-webflux\src\main\java\org\springframework\cloud\gateway\route\CachingRouteLocator.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class ExposeAttemptedPathAuthorizationAuditListener extends AbstractAuthorizationAuditListener {
public static final String AUTHORIZATION_FAILURE = "AUTHORIZATION_FAILURE";
@Override
public void onApplicationEvent(AuthorizationEvent event) {
if (event instanceof AuthorizationDeniedEvent) {
onAuthorizationFailureEvent(event);
}
}
private void onAuthorizationFailureEvent(AuthorizationEvent event) {
String name = this.getName(event.getAuthentication());
Map<String, Object> data = new LinkedHashMap<>();
Object details = this.getDetails(event.getAuthentication());
if (details != null) {
data.put("details", details);
}
publish(new AuditEvent(name, "AUTHORIZATION_FAILURE", data));
}
private String getName(Supplier<Authentication> authentication) {
|
try {
return authentication.get().getName();
} catch (Exception var3) {
return "<unknown>";
}
}
private Object getDetails(Supplier<Authentication> authentication) {
try {
return (authentication.get()).getDetails();
} catch (Exception var3) {
return null;
}
}
}
|
repos\tutorials-master\spring-security-modules\spring-security-core-2\src\main\java\com\baeldung\app\auditing\ExposeAttemptedPathAuthorizationAuditListener.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class SecondEntityManagerFactory {
@Bean
public LocalContainerEntityManagerFactoryBean ds2EntityManagerFactory(
EntityManagerFactoryBuilder builder, @Qualifier("dataSourceAuthorsDb") DataSource dataSource) {
return builder
.dataSource(dataSource)
.packages(packagesToScan())
.persistenceUnit("ds2-pu")
.properties(hibernateProperties())
.build();
}
@Bean
public PlatformTransactionManager ds2TransactionManager(
@Qualifier("ds2EntityManagerFactory") EntityManagerFactory secondEntityManagerFactory) {
return new JpaTransactionManager(secondEntityManagerFactory);
|
}
protected String[] packagesToScan() {
return new String[]{
"com.bookstore.ds2"
};
}
protected Map<String, String> hibernateProperties() {
return new HashMap<String, String>() {
{
put("hibernate.dialect", "org.hibernate.dialect.MySQL8Dialect");
}
};
}
}
|
repos\Hibernate-SpringBoot-master\HibernateSpringBootFlywayMySQLTwoDatabases\src\main\java\com\bookstore\config\SecondEntityManagerFactory.java
| 2
|
请完成以下Java代码
|
public void setEventData (final @Nullable java.lang.String EventData)
{
set_ValueNoCheck (COLUMNNAME_EventData, EventData);
}
@Override
public java.lang.String getEventData()
{
return get_ValueAsString(COLUMNNAME_EventData);
}
@Override
public void setEventName (final @Nullable java.lang.String EventName)
{
set_Value (COLUMNNAME_EventName, EventName);
}
@Override
public java.lang.String getEventName()
{
return get_ValueAsString(COLUMNNAME_EventName);
}
@Override
public void setEventTime (final @Nullable java.sql.Timestamp EventTime)
{
set_ValueNoCheck (COLUMNNAME_EventTime, EventTime);
}
@Override
public java.sql.Timestamp getEventTime()
{
return get_ValueAsTimestamp(COLUMNNAME_EventTime);
}
@Override
public void setEventTopicName (final @Nullable java.lang.String EventTopicName)
{
set_Value (COLUMNNAME_EventTopicName, EventTopicName);
}
@Override
public java.lang.String getEventTopicName()
{
return get_ValueAsString(COLUMNNAME_EventTopicName);
}
/**
* EventTypeName AD_Reference_ID=540802
* Reference name: EventTypeName
*/
public static final int EVENTTYPENAME_AD_Reference_ID=540802;
/** LOCAL = LOCAL */
public static final String EVENTTYPENAME_LOCAL = "LOCAL";
/** DISTRIBUTED = DISTRIBUTED */
public static final String EVENTTYPENAME_DISTRIBUTED = "DISTRIBUTED";
@Override
public void setEventTypeName (final @Nullable java.lang.String EventTypeName)
{
set_Value (COLUMNNAME_EventTypeName, EventTypeName);
}
@Override
public java.lang.String getEventTypeName()
{
|
return get_ValueAsString(COLUMNNAME_EventTypeName);
}
@Override
public void setEvent_UUID (final java.lang.String Event_UUID)
{
set_ValueNoCheck (COLUMNNAME_Event_UUID, Event_UUID);
}
@Override
public java.lang.String getEvent_UUID()
{
return get_ValueAsString(COLUMNNAME_Event_UUID);
}
@Override
public void setIsError (final boolean IsError)
{
set_Value (COLUMNNAME_IsError, IsError);
}
@Override
public boolean isError()
{
return get_ValueAsBoolean(COLUMNNAME_IsError);
}
@Override
public void setIsErrorAcknowledged (final boolean IsErrorAcknowledged)
{
set_Value (COLUMNNAME_IsErrorAcknowledged, IsErrorAcknowledged);
}
@Override
public boolean isErrorAcknowledged()
{
return get_ValueAsBoolean(COLUMNNAME_IsErrorAcknowledged);
}
@Override
public void setRecord_ID (final int Record_ID)
{
if (Record_ID < 0)
set_Value (COLUMNNAME_Record_ID, null);
else
set_Value (COLUMNNAME_Record_ID, Record_ID);
}
@Override
public int getRecord_ID()
{
return get_ValueAsInt(COLUMNNAME_Record_ID);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\de\metas\event\model\X_AD_EventLog.java
| 1
|
请完成以下Java代码
|
public Builder setDiscount(final BigDecimal discount)
{
this.discount = discount;
return this;
}
public Builder setPaymentRequestAmt(final BigDecimal paymentRequestAmt)
{
Check.assumeNotNull(paymentRequestAmt, "paymentRequestAmt not null");
this.paymentRequestAmtSupplier = Suppliers.ofInstance(paymentRequestAmt);
return this;
}
public Builder setPaymentRequestAmt(final Supplier<BigDecimal> paymentRequestAmtSupplier)
{
this.paymentRequestAmtSupplier = paymentRequestAmtSupplier;
return this;
}
public Builder setMultiplierAP(final BigDecimal multiplierAP)
{
this.multiplierAP = multiplierAP;
|
return this;
}
public Builder setIsPrepayOrder(final boolean isPrepayOrder)
{
this.isPrepayOrder = isPrepayOrder;
return this;
}
public Builder setPOReference(final String POReference)
{
this.POReference = POReference;
return this;
}
public Builder setCreditMemo(final boolean creditMemo)
{
this.creditMemo = creditMemo;
return this;
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.swingui\src\main\java\de\metas\banking\payment\paymentallocation\model\InvoiceRow.java
| 1
|
请完成以下Java代码
|
public String getDefaultCondition() {
return defaultCondition;
}
public void setDefaultCondition(String defaultCondition) {
this.defaultCondition = defaultCondition;
}
public String getActivateCondition() {
return activateCondition;
}
public void setActivateCondition(String activateCondition) {
this.activateCondition = activateCondition;
}
public String getIgnoreCondition() {
return ignoreCondition;
}
public void setIgnoreCondition(String ignoreCondition) {
this.ignoreCondition = ignoreCondition;
}
@Override
public String toString() {
return "ReactivationRule{} " + super.toString();
}
@Override
|
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ReactivationRule that = (ReactivationRule) o;
return Objects.equals(activateCondition, that.activateCondition) && Objects.equals(ignoreCondition, that.ignoreCondition)
&& Objects.equals(defaultCondition, that.defaultCondition);
}
@Override
public int hashCode() {
return Objects.hash(activateCondition, ignoreCondition, defaultCondition);
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-model\src\main\java\org\flowable\cmmn\model\ReactivationRule.java
| 1
|
请完成以下Java代码
|
public Font getFont ()
{
Font base = new Font(null);
if (!isEditable())
return base;
// Return Bold Italic Font
return new Font(base.getName(), Font.ITALIC | Font.BOLD, base.getSize());
} // getFont
/**************************************************************************
* Get Preferred Size
* @return size
*/
public Dimension getPreferredSize ()
{
return s_size;
} // getPreferredSize
/**
* Paint Component
* @param g Graphics
*/
protected void paintComponent (Graphics g)
{
Graphics2D g2D = (Graphics2D)g;
// center icon
m_icon.paintIcon(this, g2D, s_size.width/2 - m_icon.getIconWidth()/2, 5);
// Paint Text
Color color = getForeground();
|
g2D.setPaint(color);
Font font = getFont();
//
AttributedString aString = new AttributedString(m_name);
aString.addAttribute(TextAttribute.FONT, font);
aString.addAttribute(TextAttribute.FOREGROUND, color);
AttributedCharacterIterator iter = aString.getIterator();
//
LineBreakMeasurer measurer = new LineBreakMeasurer(iter, g2D.getFontRenderContext());
float width = s_size.width - m_icon.getIconWidth() - 2;
TextLayout layout = measurer.nextLayout(width);
// center text
float xPos = (float)(s_size.width/2 - layout.getBounds().getWidth()/2);
float yPos = m_icon.getIconHeight() + 20;
//
layout.draw(g2D, xPos, yPos);
width = s_size.width - 4; // 2 pt
while (measurer.getPosition() < iter.getEndIndex())
{
layout = measurer.nextLayout(width);
yPos += layout.getAscent() + layout.getDescent() + layout.getLeading();
layout.draw(g2D, xPos, yPos);
}
} // paintComponent
} // WFNode
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\apps\wf\WFNodeComponent.java
| 1
|
请完成以下Java代码
|
public void setProcessed (final boolean Processed)
{
set_Value (COLUMNNAME_Processed, Processed);
}
@Override
public boolean isProcessed()
{
return get_ValueAsBoolean(COLUMNNAME_Processed);
}
@Override
public void setProcessingTag (final @Nullable java.lang.String ProcessingTag)
{
set_Value (COLUMNNAME_ProcessingTag, ProcessingTag);
}
@Override
public java.lang.String getProcessingTag()
{
return get_ValueAsString(COLUMNNAME_ProcessingTag);
}
@Override
public void setSource_Record_ID (final int Source_Record_ID)
{
if (Source_Record_ID < 1)
set_ValueNoCheck (COLUMNNAME_Source_Record_ID, null);
else
set_ValueNoCheck (COLUMNNAME_Source_Record_ID, Source_Record_ID);
}
@Override
public int getSource_Record_ID()
{
return get_ValueAsInt(COLUMNNAME_Source_Record_ID);
}
@Override
public void setSource_Table_ID (final int Source_Table_ID)
{
if (Source_Table_ID < 1)
set_ValueNoCheck (COLUMNNAME_Source_Table_ID, null);
else
|
set_ValueNoCheck (COLUMNNAME_Source_Table_ID, Source_Table_ID);
}
@Override
public int getSource_Table_ID()
{
return get_ValueAsInt(COLUMNNAME_Source_Table_ID);
}
@Override
public void setTriggering_User_ID (final int Triggering_User_ID)
{
if (Triggering_User_ID < 1)
set_Value (COLUMNNAME_Triggering_User_ID, null);
else
set_Value (COLUMNNAME_Triggering_User_ID, Triggering_User_ID);
}
@Override
public int getTriggering_User_ID()
{
return get_ValueAsInt(COLUMNNAME_Triggering_User_ID);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_BusinessRule_Event.java
| 1
|
请完成以下Java代码
|
public Book author(String author) {
this.author = author;
return this;
}
public void setAuthor(String author) {
this.author = author;
}
public LocalDate getPublished() {
return published;
}
public Book published(LocalDate published) {
this.published = published;
return this;
}
public void setPublished(LocalDate published) {
this.published = published;
}
public Integer getQuantity() {
return quantity;
}
public Book quantity(Integer quantity) {
this.quantity = quantity;
return this;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public Double getPrice() {
return price;
}
public Book price(Double price) {
this.price = price;
return this;
}
public void setPrice(Double price) {
this.price = price;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
public boolean equals(Object o) {
|
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Book book = (Book) o;
if (book.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), book.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "Book{" +
"id=" + getId() +
", title='" + getTitle() + "'" +
", author='" + getAuthor() + "'" +
", published='" + getPublished() + "'" +
", quantity=" + getQuantity() +
", price=" + getPrice() +
"}";
}
}
|
repos\tutorials-master\jhipster-6\bookstore-monolith\src\main\java\com\baeldung\jhipster6\domain\Book.java
| 1
|
请完成以下Java代码
|
private IQuickInputDescriptorFactory getQuickInputDescriptorFactory(final QuickInputDescriptorKey key)
{
return getQuickInputDescriptorFactory(
//
// factory for included document:
IQuickInputDescriptorFactory.MatchingKey.includedDocument(
key.getDocumentType(),
key.getDocumentTypeId(),
key.getIncludedTableName().orElse(null)),
//
// factory for table:
IQuickInputDescriptorFactory.MatchingKey.ofTableName(key.getIncludedTableName().orElse(null)));
}
private IQuickInputDescriptorFactory getQuickInputDescriptorFactory(final IQuickInputDescriptorFactory.MatchingKey... matchingKeys)
{
for (final IQuickInputDescriptorFactory.MatchingKey matchingKey : matchingKeys)
{
final IQuickInputDescriptorFactory factory = getQuickInputDescriptorFactory(matchingKey);
if (factory != null)
{
return factory;
}
}
return null;
}
private IQuickInputDescriptorFactory getQuickInputDescriptorFactory(final IQuickInputDescriptorFactory.MatchingKey matchingKey)
|
{
final ImmutableList<IQuickInputDescriptorFactory> matchingFactories = factories.get(matchingKey);
if (matchingFactories.isEmpty())
{
return null;
}
if (matchingFactories.size() > 1)
{
logger.warn("More than one factory found for {}. Using the first one.", matchingFactories);
}
return matchingFactories.get(0);
}
@lombok.Builder
@lombok.Value
private static class QuickInputDescriptorKey
{
@NonNull DocumentType documentType;
@NonNull DocumentId documentTypeId;
@NonNull Optional<String> includedTableName;
@NonNull DetailId includedTabId;
@NonNull Optional<SOTrx> soTrx;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\quickinput\QuickInputDescriptorFactoryService.java
| 1
|
请完成以下Java代码
|
public class CompositeHistoryEventHandler implements HistoryEventHandler {
/**
* The list of {@link HistoryEventHandler} which consume the event.
*/
protected final List<HistoryEventHandler> historyEventHandlers = new ArrayList<>();
/**
* Non-argument constructor for default initialization.
*/
public CompositeHistoryEventHandler() {
}
/**
* Constructor that takes a varargs parameter {@link HistoryEventHandler} that
* consume the event.
*
* @param historyEventHandlers
* the list of {@link HistoryEventHandler} that consume the event.
*/
public CompositeHistoryEventHandler(final HistoryEventHandler... historyEventHandlers) {
initializeHistoryEventHandlers(Arrays.asList(historyEventHandlers));
}
/**
* Constructor that takes a list of {@link HistoryEventHandler} that consume
* the event.
*
* @param historyEventHandlers
* the list of {@link HistoryEventHandler} that consume the event.
*/
public CompositeHistoryEventHandler(final List<HistoryEventHandler> historyEventHandlers) {
initializeHistoryEventHandlers(historyEventHandlers);
}
/**
* Initialize {@link #historyEventHandlers} with data transfered from constructor
*
|
* @param historyEventHandlers
*/
private void initializeHistoryEventHandlers(final List<HistoryEventHandler> historyEventHandlers) {
EnsureUtil.ensureNotNull("History event handler", historyEventHandlers);
for (HistoryEventHandler historyEventHandler : historyEventHandlers) {
EnsureUtil.ensureNotNull("History event handler", historyEventHandler);
this.historyEventHandlers.add(historyEventHandler);
}
}
/**
* Adds the {@link HistoryEventHandler} to the list of
* {@link HistoryEventHandler} that consume the event.
*
* @param historyEventHandler
* the {@link HistoryEventHandler} that consume the event.
*/
public void add(final HistoryEventHandler historyEventHandler) {
EnsureUtil.ensureNotNull("History event handler", historyEventHandler);
historyEventHandlers.add(historyEventHandler);
}
@Override
public void handleEvent(final HistoryEvent historyEvent) {
for (HistoryEventHandler historyEventHandler : historyEventHandlers) {
historyEventHandler.handleEvent(historyEvent);
}
}
@Override
public void handleEvents(final List<HistoryEvent> historyEvents) {
for (HistoryEvent historyEvent : historyEvents) {
handleEvent(historyEvent);
}
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\history\handler\CompositeHistoryEventHandler.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class ArchiveRequest
{
@Nullable
DocumentReportFlavor flavor;
Resource data;
/**
* if true, the document will be archived anyway (even if auto-archive is not activated)
*/
boolean force;
/**
* save I_AD_Archive record
*/
boolean save;
@Nullable
Integer asyncBatchId;
@NonNull
@Builder.Default
Properties ctx = Env.getCtx();
String trxName;
// ported from ArchiveInfo
boolean isReport;
@Nullable
TableRecordReference recordRef;
@Nullable
AdProcessId processId;
@Nullable
|
PInstanceId pinstanceId;
@Nullable
String archiveName;
@Nullable
BPartnerId bpartnerId;
@Nullable
String documentNo;
@Nullable
Language language;
@Nullable
String poReference;
//
// Printing:
boolean isDirectEnqueue;
// create the print job or store PDF; not only enqueue to printing queue:
boolean isDirectProcessQueueItem;
@NonNull @Builder.Default PrintCopies copies = PrintCopies.ONE;
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\archive\api\ArchiveRequest.java
| 2
|
请完成以下Java代码
|
public boolean has(String name) {
return this.services.containsKey(name);
}
/**
* Return the {@link ComposeService services} to customize.
* @return the compose services
*/
public Stream<ComposeService> values() {
return this.services.values().stream().map(Builder::build);
}
/**
* Add a {@link ComposeService} with the specified name and {@link Consumer} to
* customize the object. If the service has already been added, the consumer can be
* used to further tune the existing service configuration.
* @param name the name of the service
* @param service a {@link Consumer} to customize the {@link ComposeService}
|
*/
public void add(String name, Consumer<Builder> service) {
service.accept(this.services.computeIfAbsent(name, Builder::new));
}
/**
* Remove the service with the specified {@code name}.
* @param name the name of the service
* @return {@code true} if such a service was registered, {@code false} otherwise
*/
public boolean remove(String name) {
return this.services.remove(name) != null;
}
}
|
repos\initializr-main\initializr-generator\src\main\java\io\spring\initializr\generator\container\docker\compose\ComposeServiceContainer.java
| 1
|
请完成以下Java代码
|
public void sendGreetingMessage(Greeting greeting) {
greetingKafkaTemplate.send(greetingTopicName, greeting);
}
}
public static class MessageListener {
private CountDownLatch latch = new CountDownLatch(3);
private CountDownLatch partitionLatch = new CountDownLatch(2);
private CountDownLatch filterLatch = new CountDownLatch(2);
private CountDownLatch greetingLatch = new CountDownLatch(1);
@KafkaListener(topics = "${message.topic.name}", groupId = "foo", containerFactory = "fooKafkaListenerContainerFactory")
public void listenGroupFoo(String message) {
System.out.println("Received Message in group 'foo': " + message);
latch.countDown();
}
@KafkaListener(topics = "${message.topic.name}", groupId = "bar", containerFactory = "barKafkaListenerContainerFactory")
public void listenGroupBar(String message) {
System.out.println("Received Message in group 'bar': " + message);
latch.countDown();
}
|
@KafkaListener(topics = "${message.topic.name}", containerFactory = "headersKafkaListenerContainerFactory")
public void listenWithHeaders(@Payload String message, @Header(KafkaHeaders.RECEIVED_PARTITION) int partition) {
System.out.println("Received Message: " + message + " from partition: " + partition);
latch.countDown();
}
@KafkaListener(topicPartitions = @TopicPartition(topic = "${partitioned.topic.name}", partitions = { "0", "3" }), containerFactory = "partitionsKafkaListenerContainerFactory")
public void listenToPartition(@Payload String message, @Header(KafkaHeaders.RECEIVED_PARTITION) int partition) {
System.out.println("Received Message: " + message + " from partition: " + partition);
this.partitionLatch.countDown();
}
@KafkaListener(topics = "${filtered.topic.name}", containerFactory = "filterKafkaListenerContainerFactory")
public void listenWithFilter(String message) {
System.out.println("Received Message in filtered listener: " + message);
this.filterLatch.countDown();
}
@KafkaListener(topics = "${greeting.topic.name}", containerFactory = "greetingKafkaListenerContainerFactory")
public void greetingListener(Greeting greeting) {
System.out.println("Received greeting message: " + greeting);
this.greetingLatch.countDown();
}
}
}
|
repos\tutorials-master\spring-kafka\src\main\java\com\baeldung\spring\kafka\KafkaApplication.java
| 1
|
请完成以下Java代码
|
public void updateFactAcctEndingBalanceForTag(final String processingTag)
{
final String sql = "SELECT " + DB_FUNC_Fact_Acct_EndingBalance_UpdateForTag + "(?)";
final Object[] sqlParams = new Object[] { processingTag };
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql, ITrx.TRXNAME_ThreadInherited);
DB.setParameters(pstmt, sqlParams);
rs = pstmt.executeQuery();
if (rs.next())
{
final String resultStr = rs.getString(1);
Loggables.withLogger(logger, Level.DEBUG).addLog(resultStr);
}
}
catch (final SQLException e)
{
throw DBException.wrapIfNeeded(e).appendParametersToMessage()
.setParameter("sql", sql)
.setParameter("sqlParams", sqlParams);
}
finally
{
DB.close(rs, pstmt);
}
}
private final class FactAcctLogIterable implements IFactAcctLogIterable
{
@ToStringBuilder(skip = true)
private final Properties ctx;
private final String processingTag;
public FactAcctLogIterable(final Properties ctx, final String processingTag)
{
super();
this.ctx = ctx;
this.processingTag = processingTag;
}
@Override
|
public String toString()
{
return ObjectUtils.toString(this);
}
@Override
public Properties getCtx()
{
return ctx;
}
@Override
public String getProcessingTag()
{
return processingTag;
}
@Override
public void close()
{
releaseTag(ctx, processingTag);
}
@Override
@NonNull
public Iterator<I_Fact_Acct_Log> iterator()
{
return retrieveForTag(ctx, processingTag);
}
@Override
public void deleteAll()
{
deleteAllForTag(ctx, processingTag);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java\de\metas\acct\aggregation\legacy\impl\LegacyFactAcctLogDAO.java
| 1
|
请完成以下Spring Boot application配置
|
spring:
security:
oauth2:
client:
provider:
azure:
issuer-uri: https://login.microsoftonline.com/2e9fde3a-38ec-44f9-8bcd-c184dc1e8033/v2.0
user-name-attribute: name
registration:
azure-dev:
provider: azure
#client-id: "6035bfd4-22f0-437c-b76f-da729a916cbf"
#client-secret: "fo28Q~-aLbmQvonnZtzbgtSiqYstmBWEmGPAodmx"
client-id: your-client-id
client-secret: your-secret-id
scope:
- openid
-
|
email
- profile
# Group mapping
baeldung:
jwt:
authorization:
group-to-authorities:
"ceef656a-fca9-49b6-821b-f7543b7065cb": BAELDUNG_RW
"eaaecb69-ccbc-4143-b111-7dd1ce1d99f1": BAELDUNG_RO,BAELDUNG_ADMIN
|
repos\tutorials-master\spring-security-modules\spring-security-azuread\src\main\resources\application-azuread.yml
| 2
|
请完成以下Java代码
|
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public BigDecimal getPrice() {
|
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public LocalDateTime getDateTime() {
return dateTime;
}
public void setDateTime(LocalDateTime dateTime) {
this.dateTime = dateTime;
}
}
|
repos\tutorials-master\apache-cxf-modules\sse-jaxrs\sse-jaxrs-server\src\main\java\com\baeldung\sse\jaxrs\Stock.java
| 1
|
请完成以下Java代码
|
public HUEditorViewBuilder setParameter(final String name, @Nullable final Object value)
{
if (value == null)
{
if (parameters != null)
{
parameters.remove(name);
}
}
else
{
if (parameters == null)
{
parameters = new LinkedHashMap<>();
}
parameters.put(name, value);
}
return this;
}
public HUEditorViewBuilder setParameters(final Map<String, Object> parameters)
{
parameters.forEach(this::setParameter);
return this;
}
ImmutableMap<String, Object> getParameters()
{
return parameters != null ? ImmutableMap.copyOf(parameters) : ImmutableMap.of();
}
@Nullable
public <T> T getParameter(@NonNull final String name)
{
if (parameters == null)
{
return null;
}
@SuppressWarnings("unchecked") final T value = (T)parameters.get(name);
return value;
}
public void assertParameterSet(final String name)
{
final Object value = getParameter(name);
if (value == null)
{
throw new AdempiereException("Parameter " + name + " is expected to be set in " + parameters + " for " + this);
}
}
public HUEditorViewBuilder setHUEditorViewRepository(final HUEditorViewRepository huEditorViewRepository)
{
this.huEditorViewRepository = huEditorViewRepository;
|
return this;
}
HUEditorViewBuffer createRowsBuffer(@NonNull final SqlDocumentFilterConverterContext context)
{
final ViewId viewId = getViewId();
final DocumentFilterList stickyFilters = getStickyFilters();
final DocumentFilterList filters = getFilters();
if (HUEditorViewBuffer_HighVolume.isHighVolume(stickyFilters))
{
return new HUEditorViewBuffer_HighVolume(viewId, huEditorViewRepository, stickyFilters, filters, getOrderBys(), context);
}
else
{
return new HUEditorViewBuffer_FullyCached(viewId, huEditorViewRepository, stickyFilters, filters, getOrderBys(), context);
}
}
public HUEditorViewBuilder setUseAutoFilters(final boolean useAutoFilters)
{
this.useAutoFilters = useAutoFilters;
return this;
}
public boolean isUseAutoFilters()
{
return useAutoFilters;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\HUEditorViewBuilder.java
| 1
|
请完成以下Java代码
|
public Optional<ProductId> getProductIdByEAN13(@NonNull final EAN13 ean13, @Nullable final BPartnerId bpartnerId, @NonNull final ClientId clientId)
{
return getProductIdByGTIN(ean13.toGTIN(), bpartnerId, clientId);
}
private Optional<ProductId> getProductIdByEAN13ProductCode(
@NonNull final EAN13ProductCode ean13ProductCode,
@Nullable final BPartnerId bpartnerId,
@NonNull final ClientId clientId)
{
if (bpartnerId != null)
{
final ImmutableSet<ProductId> productIds = partnerProductDAO.retrieveByEAN13ProductCode(ean13ProductCode, bpartnerId)
.stream()
.map(partnerProduct -> ProductId.ofRepoId(partnerProduct.getM_Product_ID()))
.collect(ImmutableSet.toImmutableSet());
if (productIds.size() == 1)
{
return Optional.of(productIds.iterator().next());
}
}
return productsRepo.getProductIdByEAN13ProductCode(ean13ProductCode, clientId);
}
@Override
public boolean isValidEAN13Product(@NonNull final EAN13 ean13, @NonNull final ProductId expectedProductId)
{
return getGS1ProductCodesCollection(expectedProductId).isValidProductNo(ean13, null);
}
@Override
public boolean isValidEAN13Product(@NonNull final EAN13 ean13, @NonNull final ProductId expectedProductId, @Nullable final BPartnerId bpartnerId)
{
return getGS1ProductCodesCollection(expectedProductId).isValidProductNo(ean13, bpartnerId);
}
@Override
public Set<ProductId> getProductIdsMatchingQueryString(
@NonNull final String queryString,
@NonNull final ClientId clientId,
@NonNull final QueryLimit limit)
{
return productsRepo.getProductIdsMatchingQueryString(queryString, clientId, limit);
}
@Override
@NonNull
public List<I_M_Product> getByIds(@NonNull final Set<ProductId> productIds)
{
return productsRepo.getByIds(productIds);
}
@Override
public boolean isExistingValue(@NonNull final String value, @NonNull final ClientId clientId)
{
return productsRepo.isExistingValue(value, clientId);
|
}
@Override
public void setProductCodeFieldsFromGTIN(@NonNull final I_M_Product record, @Nullable final GTIN gtin)
{
record.setGTIN(gtin != null ? gtin.getAsString() : null);
record.setUPC(gtin != null ? gtin.getAsString() : null);
if (gtin != null)
{
record.setEAN13_ProductCode(null);
}
}
@Override
public void setProductCodeFieldsFromEAN13ProductCode(@NonNull final I_M_Product record, @Nullable final EAN13ProductCode ean13ProductCode)
{
record.setEAN13_ProductCode(ean13ProductCode != null ? ean13ProductCode.getAsString() : null);
if (ean13ProductCode != null)
{
record.setGTIN(null);
record.setUPC(null);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\product\impl\ProductBL.java
| 1
|
请完成以下Java代码
|
public String[] getTo() {
return Arrays.copyOf(to, to.length);
}
public void setTo(String[] to) {
this.to = Arrays.copyOf(to, to.length);
}
public String[] getCc() {
return Arrays.copyOf(cc, cc.length);
}
public void setCc(String[] cc) {
this.cc = Arrays.copyOf(cc, cc.length);
}
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
public String getTemplate() {
return template;
}
public void setTemplate(String template) {
this.template = template;
|
}
@Nullable
public String getBaseUrl() {
return baseUrl;
}
public void setBaseUrl(@Nullable String baseUrl) {
this.baseUrl = baseUrl;
}
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
}
public void setAdditionalProperties(Map<String, Object> additionalProperties) {
this.additionalProperties = additionalProperties;
}
}
|
repos\spring-boot-admin-master\spring-boot-admin-server\src\main\java\de\codecentric\boot\admin\server\notify\MailNotifier.java
| 1
|
请完成以下Java代码
|
protected Optional<ProcessPreconditionsResolution> checkValidSelection()
{
if (getParentViewRowIdsSelection() == null)
{
return Optional.of(ProcessPreconditionsResolution.rejectBecauseNoSelection());
}
if (getSelectedRowIds().isMoreThanOneDocumentId()
|| getParentViewRowIdsSelection().getRowIds().isMoreThanOneDocumentId() )
{
return Optional.of(ProcessPreconditionsResolution.rejectBecauseNotSingleSelection());
}
final PickingSlotRow pickingSlotRow = getSingleSelectedRow();
if (!pickingSlotRow.isPickedHURow())
{
return Optional.of(ProcessPreconditionsResolution.reject(msgBL.getTranslatableMsgText(MSG_WEBUI_PICKING_SELECT_PICKED_HU)));
}
if (pickingSlotRow.isProcessed())
{
return Optional.of(ProcessPreconditionsResolution.reject(msgBL.getTranslatableMsgText(MSG_WEBUI_PICKING_NO_UNPROCESSED_RECORDS)));
}
if (getPickingConfig().isForbidAggCUsForDifferentOrders() && isAggregatingCUsToDifferentOrders())
{
return Optional.of(ProcessPreconditionsResolution.reject(msgBL.getTranslatableMsgText(MSG_WEBUI_PICKING_AGGREGATING_CUS_TO_DIFF_ORDER_IS_FORBIDDEN)));
}
return Optional.empty();
}
@NonNull
protected HuId getPackToHuId()
{
final PickingSlotRow selectedRow = getSingleSelectedRow();
if (!getPickingConfig().isForbidAggCUsForDifferentOrders())
|
{
return selectedRow.getHuId();
}
final OrderId orderId = getCurrentlyPickingOrderId();
if (orderId == null)
{
throw new AdempiereException(MSG_WEBUI_PICKING_AGGREGATING_CUS_TO_DIFF_ORDER_IS_FORBIDDEN);
}
if (!selectedRow.isLU())
{
return selectedRow.getHuId();
}
return selectedRow.findRowMatching(row -> !row.isLU() && row.thereIsAnOpenPickingForOrderId(orderId))
.map(PickingSlotRow::getHuId)
.orElseThrow(() -> new AdempiereException(MSG_WEBUI_PICKING_AGGREGATING_CUS_TO_DIFF_ORDER_IS_FORBIDDEN));
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\picking\pickingslot\process\WEBUI_Picking_PickQtyToExistingHU.java
| 1
|
请完成以下Java代码
|
public List<String> executeIdsList(CommandContext commandContext) {
ensureVariablesInitialized();
checkQueryOk();
return commandContext
.getExternalTaskManager()
.findExternalTaskIdsByQueryCriteria(this);
}
@Override
public List<ImmutablePair<String, String>> executeDeploymentIdMappingsList(CommandContext commandContext) {
checkQueryOk();
return commandContext
.getExternalTaskManager()
.findDeploymentIdMappingsByQueryCriteria(this);
}
public String getExternalTaskId() {
return externalTaskId;
}
public String getWorkerId() {
return workerId;
}
public Date getLockExpirationBefore() {
return lockExpirationBefore;
}
public Date getLockExpirationAfter() {
return lockExpirationAfter;
}
public String getTopicName() {
return topicName;
}
public Boolean getLocked() {
return locked;
}
public Boolean getNotLocked() {
return notLocked;
}
public String getExecutionId() {
return executionId;
}
public String getProcessInstanceId() {
return processInstanceId;
}
public String getProcessDefinitionKey() {
return processDefinitionKey;
|
}
public String[] getProcessDefinitionKeys() {
return processDefinitionKeys;
}
public String getProcessDefinitionId() {
return processDefinitionId;
}
public String getProcessDefinitionName() {
return processDefinitionName;
}
public String getProcessDefinitionNameLike() {
return processDefinitionNameLike;
}
public String getActivityId() {
return activityId;
}
public SuspensionState getSuspensionState() {
return suspensionState;
}
public Boolean getRetriesLeft() {
return retriesLeft;
}
public Date getNow() {
return ClockUtil.getCurrentTime();
}
protected void ensureVariablesInitialized() {
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
VariableSerializers variableSerializers = processEngineConfiguration.getVariableSerializers();
String dbType = processEngineConfiguration.getDatabaseType();
for(QueryVariableValue var : variables) {
var.initialize(variableSerializers, dbType);
}
}
public List<QueryVariableValue> getVariables() {
return variables;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\ExternalTaskQueryImpl.java
| 1
|
请完成以下Java代码
|
public String getExecutionId() {
return executionId;
}
public void setExecutionId(String executionId) {
this.executionId = executionId;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public Date getTimeStamp() {
return timeStamp;
}
public void setTimeStamp(Date timeStamp) {
this.timeStamp = timeStamp;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public byte[] getData() {
return data;
}
public void setData(byte[] data) {
this.data = data;
}
public String getLockOwner() {
return lockOwner;
}
public void setLockOwner(String lockOwner) {
this.lockOwner = lockOwner;
}
|
public String getLockTime() {
return lockTime;
}
public void setLockTime(String lockTime) {
this.lockTime = lockTime;
}
public int getProcessed() {
return isProcessed;
}
public void setProcessed(int isProcessed) {
this.isProcessed = isProcessed;
}
@Override
public String toString() {
return timeStamp.toString() + " : " + type;
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\persistence\entity\EventLogEntryEntityImpl.java
| 1
|
请完成以下Java代码
|
public Map<String, Float> getTermAndRank(List<Term> termList)
{
List<String> wordList = new ArrayList<String>(termList.size());
for (Term t : termList)
{
if (shouldInclude(t))
{
wordList.add(t.word);
}
}
// System.out.println(wordList);
Map<String, Set<String>> words = new TreeMap<String, Set<String>>();
Queue<String> que = new LinkedList<String>();
for (String w : wordList)
{
if (!words.containsKey(w))
{
words.put(w, new TreeSet<String>());
}
// 复杂度O(n-1)
if (que.size() >= 5)
{
que.poll();
}
for (String qWord : que)
{
if (w.equals(qWord))
{
continue;
}
//既然是邻居,那么关系是相互的,遍历一遍即可
words.get(w).add(qWord);
words.get(qWord).add(w);
}
que.offer(w);
}
// System.out.println(words);
Map<String, Float> score = new HashMap<String, Float>();
//依据TF来设置初值
for (Map.Entry<String, Set<String>> entry : words.entrySet())
{
score.put(entry.getKey(), sigMoid(entry.getValue().size()));
}
for (int i = 0; i < max_iter; ++i)
{
Map<String, Float> m = new HashMap<String, Float>();
float max_diff = 0;
for (Map.Entry<String, Set<String>> entry : words.entrySet())
{
String key = entry.getKey();
Set<String> value = entry.getValue();
m.put(key, 1 - d);
for (String element : value)
{
int size = words.get(element).size();
if (key.equals(element) || size == 0) continue;
m.put(key, m.get(key) + d / size * (score.get(element) == null ? 0 : score.get(element)));
|
}
max_diff = Math.max(max_diff, Math.abs(m.get(key) - (score.get(key) == null ? 0 : score.get(key))));
}
score = m;
if (max_diff <= min_diff) break;
}
return score;
}
/**
* sigmoid函数
*
* @param value
* @return
*/
public static float sigMoid(float value)
{
return (float) (1d / (1d + Math.exp(-value)));
}
@Override
public List<String> getKeywords(List<Term> termList, int size)
{
Set<Map.Entry<String, Float>> entrySet = top(size, getTermAndRank(termList)).entrySet();
List<String> result = new ArrayList<String>(entrySet.size());
for (Map.Entry<String, Float> entry : entrySet)
{
result.add(entry.getKey());
}
return result;
}
}
|
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\summary\TextRankKeyword.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public String getSqlCacheClass() {
return sqlCacheClass;
}
public void setSqlCacheClass(String sqlCacheClass) {
this.sqlCacheClass = sqlCacheClass;
Optional.ofNullable(sqlCacheClass).ifPresent(v -> properties.setProperty("sqlCacheClass", v));
}
public String getBoundSqlInterceptors() {
return boundSqlInterceptors;
}
public void setBoundSqlInterceptors(String boundSqlInterceptors) {
this.boundSqlInterceptors = boundSqlInterceptors;
Optional.ofNullable(boundSqlInterceptors).ifPresent(v -> properties.setProperty("boundSqlInterceptors", v));
}
public Boolean getKeepOrderBy() {
return keepOrderBy;
}
public void setKeepOrderBy(Boolean keepOrderBy) {
this.keepOrderBy = keepOrderBy;
Optional.ofNullable(keepOrderBy).ifPresent(v -> properties.setProperty("keepOrderBy", v.toString()));
}
public Boolean getKeepSubSelectOrderBy() {
return keepSubSelectOrderBy;
}
public void setKeepSubSelectOrderBy(Boolean keepSubSelectOrderBy) {
this.keepSubSelectOrderBy = keepSubSelectOrderBy;
Optional.ofNullable(keepSubSelectOrderBy).ifPresent(v -> properties.setProperty("keepSubSelectOrderBy", v.toString()));
}
public String getSqlParser() {
return sqlParser;
}
public void setSqlParser(String sqlParser) {
this.sqlParser = sqlParser;
|
Optional.ofNullable(sqlParser).ifPresent(v -> properties.setProperty("sqlParser", v));
}
public Boolean getAsyncCount() {
return asyncCount;
}
public void setAsyncCount(Boolean asyncCount) {
this.asyncCount = asyncCount;
Optional.ofNullable(asyncCount).ifPresent(v -> properties.setProperty("asyncCount", v.toString()));
}
public String getCountSqlParser() {
return countSqlParser;
}
public void setCountSqlParser(String countSqlParser) {
this.countSqlParser = countSqlParser;
Optional.ofNullable(countSqlParser).ifPresent(v -> properties.setProperty("countSqlParser", v));
}
public String getOrderBySqlParser() {
return orderBySqlParser;
}
public void setOrderBySqlParser(String orderBySqlParser) {
this.orderBySqlParser = orderBySqlParser;
Optional.ofNullable(orderBySqlParser).ifPresent(v -> properties.setProperty("orderBySqlParser", v));
}
public String getSqlServerSqlParser() {
return sqlServerSqlParser;
}
public void setSqlServerSqlParser(String sqlServerSqlParser) {
this.sqlServerSqlParser = sqlServerSqlParser;
Optional.ofNullable(sqlServerSqlParser).ifPresent(v -> properties.setProperty("sqlServerSqlParser", v));
}
}
|
repos\pagehelper-spring-boot-master\pagehelper-spring-boot-autoconfigure\src\main\java\com\github\pagehelper\autoconfigure\PageHelperStandardProperties.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class ExternalReferenceRouteBuilderV2 extends RouteBuilder
{
@Override
public void configure()
{
errorHandler(noErrorHandler());
from(direct(MF_LOOKUP_EXTERNALREFERENCE_V2_CAMEL_URI))
.routeId(MF_LOOKUP_EXTERNALREFERENCE_V2_CAMEL_URI)
.streamCache("true")
.log("Route invoked")
.process(exchange -> {
final Object camelRequest = exchange.getIn().getBody();
if (!(camelRequest instanceof ExternalReferenceLookupCamelRequest))
{
throw new RuntimeCamelException("The route " + MF_LOOKUP_EXTERNALREFERENCE_V2_CAMEL_URI + " requires the body to be instanceof ExternalReferenceLookupCamelRequest. "
+ "However, it is " + (camelRequest == null ? "null" : camelRequest.getClass().getName()));
}
final ExternalReferenceLookupCamelRequest externalReferenceLookupCamelRequest = (ExternalReferenceLookupCamelRequest)camelRequest;
exchange.getIn().setHeader(HEADER_EXTERNALSYSTEM_CONFIG_ID, externalReferenceLookupCamelRequest.getExternalSystemConfigId().getValue());
|
exchange.getIn().setHeader(HEADER_ORG_CODE, externalReferenceLookupCamelRequest.getOrgCode());
if (externalReferenceLookupCamelRequest.getAdPInstanceId() != null)
{
exchange.getIn().setHeader(ExternalSystemConstants.HEADER_PINSTANCE_ID, externalReferenceLookupCamelRequest.getAdPInstanceId().getValue());
}
final JsonExternalReferenceLookupRequest request = externalReferenceLookupCamelRequest.getJsonExternalReferenceLookupRequest();
exchange.getIn().setBody(request);
log.info("Route invoked with " + request.getItems().size() + " request items");
})
.marshal(CamelRouteHelper.setupJacksonDataFormatFor(getContext(), JsonExternalReferenceLookupRequest.class))
.removeHeaders("CamelHttp*")
.setHeader(Exchange.HTTP_METHOD, constant(HttpMethods.PUT))
.toD("{{metasfresh.lookup-externalreference-v2.api.uri}}/${header.orgCode}")
.to(direct(UNPACK_V2_API_RESPONSE));
}
}
|
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\core\src\main\java\de\metas\camel\externalsystems\core\to_mf\v2\ExternalReferenceRouteBuilderV2.java
| 2
|
请完成以下Java代码
|
public Date getCompletedAfter() {
return completedAfter;
}
public Date getCompletedBefore() {
return completedBefore;
}
@Override
public HistoricTaskInstanceReport completedAfter(Date completedAfter) {
ensureNotNull(NotValidException.class, "completedAfter", completedAfter);
this.completedAfter = completedAfter;
return this;
}
@Override
public HistoricTaskInstanceReport completedBefore(Date completedBefore) {
ensureNotNull(NotValidException.class, "completedBefore", completedBefore);
this.completedBefore = completedBefore;
return this;
}
public TenantCheck getTenantCheck() {
return tenantCheck;
}
public String getReportPeriodUnitName() {
return durationPeriodUnit.name();
}
|
protected class ExecuteDurationCmd implements Command<List<DurationReportResult>> {
@Override
public List<DurationReportResult> execute(CommandContext commandContext) {
return executeDuration(commandContext);
}
}
protected class HistoricTaskInstanceCountByNameCmd implements Command<List<HistoricTaskInstanceReportResult>> {
@Override
public List<HistoricTaskInstanceReportResult> execute(CommandContext commandContext) {
return executeCountByTaskName(commandContext);
}
}
protected class HistoricTaskInstanceCountByProcessDefinitionKey implements Command<List<HistoricTaskInstanceReportResult>> {
@Override
public List<HistoricTaskInstanceReportResult> execute(CommandContext commandContext) {
return executeCountByProcessDefinitionKey(commandContext);
}
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\HistoricTaskInstanceReportImpl.java
| 1
|
请完成以下Java代码
|
public String getF_CANTONLEV() {
return F_CANTONLEV;
}
public void setF_CANTONLEV(String f_CANTONLEV) {
F_CANTONLEV = f_CANTONLEV;
}
public String getF_TAXORGCODE() {
return F_TAXORGCODE;
}
public void setF_TAXORGCODE(String f_TAXORGCODE) {
F_TAXORGCODE = f_TAXORGCODE;
}
public String getF_MEMO() {
return F_MEMO;
}
public void setF_MEMO(String f_MEMO) {
F_MEMO = f_MEMO;
}
public String getF_USING() {
return F_USING;
}
public void setF_USING(String f_USING) {
F_USING = f_USING;
}
public String getF_USINGDATE() {
return F_USINGDATE;
}
public void setF_USINGDATE(String f_USINGDATE) {
F_USINGDATE = f_USINGDATE;
}
public Integer getF_LEVEL() {
return F_LEVEL;
}
public void setF_LEVEL(Integer f_LEVEL) {
F_LEVEL = f_LEVEL;
}
public String getF_END() {
return F_END;
}
|
public void setF_END(String f_END) {
F_END = f_END;
}
public String getF_QRCANTONID() {
return F_QRCANTONID;
}
public void setF_QRCANTONID(String f_QRCANTONID) {
F_QRCANTONID = f_QRCANTONID;
}
public String getF_DECLARE() {
return F_DECLARE;
}
public void setF_DECLARE(String f_DECLARE) {
F_DECLARE = f_DECLARE;
}
public String getF_DECLAREISEND() {
return F_DECLAREISEND;
}
public void setF_DECLAREISEND(String f_DECLAREISEND) {
F_DECLAREISEND = f_DECLAREISEND;
}
}
|
repos\SpringBootBucket-master\springboot-batch\src\main\java\com\xncoding\trans\modules\common\vo\BscCanton.java
| 1
|
请完成以下Java代码
|
public IAttributeAggregationStrategy retrieveAggregationStrategy()
{
return NullAggregationStrategy.instance;
}
/**
* @return {@link NullSplitterStrategy#instance}.
*/
@Override
public IAttributeSplitterStrategy retrieveSplitterStrategy()
{
return NullSplitterStrategy.instance;
}
/**
* @return {@link CopyHUAttributeTransferStrategy#instance}.
*/
@Override
public IHUAttributeTransferStrategy retrieveTransferStrategy()
{
return CopyHUAttributeTransferStrategy.instance;
}
/**
* @return {@code true}.
*/
@Override
public boolean isReadonlyUI()
{
return true;
}
/**
* @return {@code true}.
*/
@Override
public boolean isDisplayedUI()
{
return true;
}
@Override
public boolean isMandatory()
{
|
return false;
}
@Override
public boolean isOnlyIfInProductAttributeSet()
{
return false;
}
/**
* @return our attribute instance's {@code M_Attribute_ID}.
*/
@Override
public int getDisplaySeqNo()
{
return attributeInstance.getM_Attribute_ID();
}
/**
* @return {@code true}
*/
@Override
public boolean isUseInASI()
{
return true;
}
/**
* @return {@code false}, since no HU-PI attribute is involved.
*/
@Override
public boolean isDefinedByTemplate()
{
return false;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\attribute\storage\AIAttributeValue.java
| 1
|
请完成以下Java代码
|
public void initialize(final IModelValidationEngine engine, final I_AD_Client client)
{
if (client != null)
{
adClientId = client.getAD_Client_ID();
}
for (final IModelInterceptor interceptor : interceptors)
{
interceptor.initialize(engine, client);
}
}
@Override
public int getAD_Client_ID()
{
return adClientId;
}
@Override
public void onModelChange(final Object model, final ModelChangeType changeType) throws Exception
{
for (final IModelInterceptor interceptor : interceptors)
{
interceptor.onModelChange(model, changeType);
}
}
@Override
public void onDocValidate(final Object model, final DocTimingType timing) throws Exception
{
for (final IModelInterceptor interceptor : interceptors)
{
interceptor.onDocValidate(model, timing);
}
}
@Override
public void onUserLogin(final int AD_Org_ID, final int AD_Role_ID, final int AD_User_ID)
|
{
// NOTE: we use "interceptors" instead of userLoginListeners because the "onUserLogin" it's implemented on IModelInterceptor level
for (final IModelInterceptor interceptor : interceptors)
{
interceptor.onUserLogin(AD_Org_ID, AD_Role_ID, AD_User_ID);
}
}
@Override
public void beforeLogout(final MFSession session)
{
for (final IUserLoginListener listener : userLoginListeners)
{
listener.beforeLogout(session);
}
}
@Override
public void afterLogout(final MFSession session)
{
for (final IUserLoginListener listener : userLoginListeners)
{
listener.afterLogout(session);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\modelvalidator\CompositeModelInterceptor.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
default void customize(HttpAsyncClientBuilder httpAsyncClientBuilder) {
}
/**
* Customize the {@link org.apache.hc.client5.http.config.RequestConfig.Builder}.
* Unlike {@link Rest5ClientBuilder#setRequestConfigCallback(Consumer)}, implementing
* this method does not replace other customization of the request config builder.
* @param requestConfigBuilder the request config builder
*/
default void customize(RequestConfig.Builder requestConfigBuilder) {
}
/**
* Customize the {@link PoolingAsyncClientConnectionManagerBuilder}. Unlike
* {@link Rest5ClientBuilder#setConnectionManagerCallback(Consumer)}, implementing
* this method does not replace other customization of the connection manager builder.
* @param connectionManagerBuilder the connection manager builder
|
*/
default void customize(PoolingAsyncClientConnectionManagerBuilder connectionManagerBuilder) {
}
/**
* Customize the {@link org.apache.hc.client5.http.config.ConnectionConfig.Builder}.
* Unlike {@link Rest5ClientBuilder#setConnectionConfigCallback(Consumer)},
* implementing this method does not replace other customization of the connection
* config builder.
* @param connectionConfigBuilder the connection config builder
*/
default void customize(ConnectionConfig.Builder connectionConfigBuilder) {
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-elasticsearch\src\main\java\org\springframework\boot\elasticsearch\autoconfigure\Rest5ClientBuilderCustomizer.java
| 2
|
请完成以下Java代码
|
public Date getFinishedAfter() {
return finishedAfter;
}
public Date getFinishedBefore() {
return finishedBefore;
}
public String getInvolvedUser() {
return involvedUser;
}
public String getName() {
return name;
}
public String getNameLike() {
return nameLike;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public String getDeploymentId() {
return deploymentId;
}
public List<String> getDeploymentIds() {
return deploymentIds;
}
public boolean isFinished() {
return finished;
}
public boolean isUnfinished() {
return unfinished;
}
public boolean isDeleted() {
return deleted;
}
public boolean isNotDeleted() {
return notDeleted;
}
public boolean isIncludeProcessVariables() {
return includeProcessVariables;
}
public boolean isWithException() {
return withJobException;
}
|
public String getTenantId() {
return tenantId;
}
public String getTenantIdLike() {
return tenantIdLike;
}
public boolean isWithoutTenantId() {
return withoutTenantId;
}
public String getNameLikeIgnoreCase() {
return nameLikeIgnoreCase;
}
public List<HistoricProcessInstanceQueryImpl> getOrQueryObjects() {
return orQueryObjects;
}
public List<String> getInvolvedGroups() {
return involvedGroups;
}
public HistoricProcessInstanceQuery involvedGroupsIn(List<String> involvedGroups) {
if (involvedGroups == null || involvedGroups.isEmpty()) {
throw new ActivitiIllegalArgumentException("Involved groups list is null or empty.");
}
if (inOrStatement) {
this.currentOrQueryObject.involvedGroups = involvedGroups;
} else {
this.involvedGroups = involvedGroups;
}
return this;
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\HistoricProcessInstanceQueryImpl.java
| 1
|
请完成以下Java代码
|
protected ProcessPreconditionsResolution checkPreconditionsApplicable()
{
if (getSelectedRowIds().isEmpty())
{
return ProcessPreconditionsResolution.rejectBecauseNoSelection();
}
return ProcessPreconditionsResolution.accept();
}
@Override
protected String doIt()
{
addSelectedRowsToInitialView();
closeAllViewsAndShowInitialView();
return MSG_OK;
}
private void addSelectedRowsToInitialView()
{
final ProductsProposalView initialView = getInitialView();
final List<ProductsProposalRowAddRequest> addRequests = getSelectedRows()
.stream()
.map(this::toProductsProposalRowAddRequest)
|
.collect(ImmutableList.toImmutableList());
initialView.addOrUpdateRows(addRequests);
}
private ProductsProposalRowAddRequest toProductsProposalRowAddRequest(final ProductsProposalRow row)
{
return ProductsProposalRowAddRequest.builder()
.product(row.getProduct())
.asiDescription(row.getAsiDescription())
.asiId(row.getAsiId())
.priceListPrice(row.getPrice().getUserEnteredPrice())
.lastShipmentDays(row.getLastShipmentDays())
.copiedFromProductPriceId(row.getProductPriceId())
.packingMaterialId(row.getPackingMaterialId())
.packingDescription(row.getPackingDescription())
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\order\products_proposal\process\WEBUI_ProductsProposal_AddProductFromBasePriceList.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Result<List<DictModel>> loadAllData(@RequestParam(name="code",required = true) String code) {
Result<List<DictModel>> result = new Result<List<DictModel>>();
LambdaQueryWrapper<SysCategory> query = new LambdaQueryWrapper<SysCategory>();
if(oConvertUtils.isNotEmpty(code) && !CATEGORY_ROOT_CODE.equals(code)){
query.likeRight(SysCategory::getCode,code);
}
List<SysCategory> list = this.sysCategoryService.list(query);
if(list==null || list.size()==0) {
result.setMessage("无数据,参数有误.[code]");
result.setSuccess(false);
return result;
}
List<DictModel> rdList = new ArrayList<DictModel>();
for (SysCategory c : list) {
rdList.add(new DictModel(c.getId(),c.getName()));
}
result.setSuccess(true);
result.setResult(rdList);
return result;
}
/**
* 根据父级id批量查询子节点
* @param parentIds
* @return
|
*/
@GetMapping("/getChildListBatch")
public Result getChildListBatch(@RequestParam("parentIds") String parentIds) {
try {
QueryWrapper<SysCategory> queryWrapper = new QueryWrapper<>();
List<String> parentIdList = Arrays.asList(parentIds.split(","));
queryWrapper.in("pid", parentIdList);
List<SysCategory> list = sysCategoryService.list(queryWrapper);
IPage<SysCategory> pageList = new Page<>(1, 10, list.size());
pageList.setRecords(list);
return Result.OK(pageList);
} catch (Exception e) {
log.error(e.getMessage(), e);
return Result.error("批量查询子节点失败:" + e.getMessage());
}
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-module-system\jeecg-system-biz\src\main\java\org\jeecg\modules\system\controller\SysCategoryController.java
| 2
|
请完成以下Java代码
|
public Instant getRegistrationDate() {
return registrationDate;
}
public void setRegistrationDate(Instant registrationDate) {
this.registrationDate = registrationDate;
}
public Instant getLastSeen() {
return lastSeen;
}
public void setLastSeen(Instant lastSeen) {
this.lastSeen = lastSeen;
}
|
// public List<Post> getPosts() {
// return posts;
// }
//
// public void setPosts(List<Post> posts) {
// this.posts = posts;
// }
@Override
public String toString() {
return "User{" + "id='" + id + '\'' + ", username='" + username + '\'' + ", firstname='" + firstname + '\''
+ ", lastname='" + lastname + '\'' + ", registrationDate=" + registrationDate + ", lastSeen=" + lastSeen +
// ", posts=" + posts +
'}';
}
}
|
repos\spring-data-examples-main\jpa\aot-optimization\src\main\java\example\springdata\aot\User.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
class InitializrStatsAutoConfiguration {
private final StatsProperties statsProperties;
InitializrStatsAutoConfiguration(StatsProperties statsProperties) {
this.statsProperties = statsProperties;
}
@Bean
@ConditionalOnBean(InitializrMetadataProvider.class)
ProjectGenerationStatPublisher projectRequestStatHandler(RestTemplateBuilder restTemplateBuilder) {
return new ProjectGenerationStatPublisher(new ProjectRequestDocumentFactory(), this.statsProperties,
restTemplateBuilder, statsRetryTemplate());
}
@Bean
@ConditionalOnMissingBean(name = "statsRetryTemplate")
RetryTemplate statsRetryTemplate() {
RetryTemplate retryTemplate = new RetryTemplate();
ExponentialBackOffPolicy backOffPolicy = new ExponentialBackOffPolicy();
backOffPolicy.setInitialInterval(3000L);
backOffPolicy.setMultiplier(3);
SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy(this.statsProperties.getElastic().getMaxAttempts(),
Collections.singletonMap(Exception.class, true));
|
retryTemplate.setBackOffPolicy(backOffPolicy);
retryTemplate.setRetryPolicy(retryPolicy);
return retryTemplate;
}
static class ElasticUriCondition extends SpringBootCondition {
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
String elasticUri = context.getEnvironment().getProperty("initializr.stats.elastic.uri");
if (StringUtils.hasText(elasticUri)) {
return ConditionOutcome.match("initializr.stats.elastic.uri is set");
}
return ConditionOutcome.noMatch("initializr.stats.elastic.uri is not set");
}
}
}
|
repos\initializr-main\initializr-actuator\src\main\java\io\spring\initializr\actuate\autoconfigure\InitializrStatsAutoConfiguration.java
| 2
|
请完成以下Java代码
|
public boolean createXML (String fileName)
{
try
{
File file = new File(fileName);
file.createNewFile();
StreamResult result = new StreamResult(file);
createXML (result);
}
catch (Exception e)
{
log.error("(file)", e);
return false;
}
return true;
} // createXMLFile
/**************************************************************************
* Create PrintData from XML
* @param ctx context
* @param input InputSource
* @return PrintData
|
*/
public static PrintData parseXML (Properties ctx, File input)
{
log.info(input.toString());
PrintData pd = null;
try
{
PrintDataHandler handler = new PrintDataHandler(ctx);
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = factory.newSAXParser();
parser.parse(input, handler);
pd = handler.getPrintData();
}
catch (Exception e)
{
log.error("", e);
}
return pd;
} // parseXML
} // PrintData
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\print\PrintData.java
| 1
|
请完成以下Java代码
|
public Stream<PickingSlotRow> streamByIds(final DocumentIdsSelection rowIds)
{
if (rowIds.isAll())
{
return getRowsIndex().stream();
}
else
{
return rowIds.stream().map(this::getById);
}
}
@ToString
private static final class PickingSlotRowsIndex
{
private final ImmutableMap<PickingSlotRowId, PickingSlotRow> rowsById;
private final ImmutableMap<PickingSlotRowId, PickingSlotRowId> rowId2rootRowId;
private PickingSlotRowsIndex(final List<PickingSlotRow> rows)
{
rowsById = Maps.uniqueIndex(rows, PickingSlotRow::getPickingSlotRowId);
rowId2rootRowId = rows.stream()
.flatMap(rootRow -> streamChild2RootRowIdsRecursivelly(rootRow))
.collect(GuavaCollectors.toImmutableMap());
}
private static Stream<Map.Entry<PickingSlotRowId, PickingSlotRowId>> streamChild2RootRowIdsRecursivelly(final PickingSlotRow row)
{
final PickingSlotRowId rootRowId = row.getPickingSlotRowId();
return row.streamThisRowAndIncludedRowsRecursivelly()
.map(PickingSlotRow::getPickingSlotRowId)
.map(includedRowId -> GuavaCollectors.entry(includedRowId, rootRowId));
}
|
public PickingSlotRow getRow(final PickingSlotRowId rowId)
{
return rowsById.get(rowId);
}
@Nullable
public PickingSlotRow getRootRow(final PickingSlotRowId rowId)
{
final PickingSlotRowId rootRowId = getRootRowId(rowId);
if (rootRowId == null)
{
return null;
}
return getRow(rootRowId);
}
public PickingSlotRowId getRootRowId(final PickingSlotRowId rowId)
{
return rowId2rootRowId.get(rowId);
}
public long size()
{
return rowsById.size();
}
public Stream<PickingSlotRow> stream()
{
return rowsById.values().stream();
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\picking\pickingslot\PickingSlotRowsCollection.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void displayBooksByAgeGt45CausingNPlus1() {
List<Book> books = bookRepositoryFetchModeJoin.findAll(isPriceGt35()); // N+1
displayBooks(books);
}
public void displayBooksViaEntityGraph() {
List<Book> books = bookRepositoryEntityGraph.findAll(); // LEFT JOIN
displayBooks(books);
}
public void displayBooksByAgeGt45ViaEntityGraph() {
List<Book> books = bookRepositoryEntityGraph.findAll(isPriceGt35()); // LEFT JOIN
displayBooks(books);
}
public void displayBooksViaJoinFetch() {
|
List<Book> books = bookRepositoryJoinFetch.findAll(); // LEFT JOIN
displayBooks(books);
}
private void displayBook(Book book) {
System.out.println(book);
System.out.println(book.getAuthor());
System.out.println(book.getAuthor().getPublisher() + "\n");
}
private void displayBooks(List<Book> books) {
for (Book book : books) {
System.out.println(book);
System.out.println(book.getAuthor());
System.out.println(book.getAuthor().getPublisher() + "\n");
}
}
}
|
repos\Hibernate-SpringBoot-master\HibernateSpringBootFetchJoinAndQueries\src\main\java\com\bookstore\service\BookstoreService.java
| 2
|
请完成以下Java代码
|
public SpinJsonException unableToModifyNode(String nodeName) {
return new SpinJsonException(exceptionMessage("010", "Unable to modify node of type '{}'. Node is not a list.", nodeName));
}
public SpinJsonException unableToGetIndex(String nodeName) {
return new SpinJsonException(exceptionMessage("011", "Unable to get index from '{}'. Node is not a list.", nodeName));
}
public IndexOutOfBoundsException indexOutOfBounds(Integer index, Integer size) {
return new IndexOutOfBoundsException(exceptionMessage("012", "Index is out of bound! Index: '{}', Size: '{}'", index, size));
}
public SpinJsonPathException unableToEvaluateJsonPathExpressionOnNode(SpinJsonNode node, Exception cause) {
return new SpinJsonPathException(
exceptionMessage("013", "Unable to evaluate JsonPath expression on element '{}'", node.getClass().getName()), cause);
}
|
public SpinJsonPathException unableToCompileJsonPathExpression(String expression, Exception cause) {
return new SpinJsonPathException(
exceptionMessage("014", "Unable to compile '{}'!", expression), cause);
}
public SpinJsonPathException unableToCastJsonPathResultTo(Class<?> castClass, Exception cause) {
return new SpinJsonPathException(
exceptionMessage("015", "Unable to cast JsonPath expression to '{}'", castClass.getName()), cause);
}
public SpinJsonPathException invalidJsonPath(Class<?> castClass, Exception cause) {
return new SpinJsonPathException(
exceptionMessage("017", "Invalid json path to '{}'", castClass.getName()), cause);
}
}
|
repos\camunda-bpm-platform-master\spin\dataformat-json-jackson\src\main\java\org\camunda\spin\impl\json\jackson\JacksonJsonLogger.java
| 1
|
请完成以下Java代码
|
private static void shutdownExecutor(@NonNull final ExecutorService executor)
{
logger.info("shutdown - Shutdown started for executor={}", executor);
executor.shutdown();
int retryCount = 5;
boolean terminated = false;
while (!terminated && retryCount > 0)
{
logger.info("shutdown - waiting for executor to be terminated; retries left={}; executor={}", retryCount, executor);
try
{
terminated = executor.awaitTermination(5 * 1000, TimeUnit.MICROSECONDS);
}
catch (final InterruptedException e)
{
logger.warn("Failed shutting down executor for " + executor + ". Retry " + retryCount + " more times.");
terminated = false;
}
retryCount--;
}
executor.shutdownNow();
logger.info("Shutdown finished for executor: {}", executor);
}
@NonNull
private static ThreadPoolExecutor createPlannerThreadExecutor()
{
final CustomizableThreadFactory threadFactory = CustomizableThreadFactory.builder()
.setThreadNamePrefix("QueueProcessorPlanner")
.setDaemon(true)
.build();
return new ThreadPoolExecutor(
1, // corePoolSize
1, // maximumPoolSize
1000, // keepAliveTime
|
TimeUnit.MILLISECONDS, // timeUnit
new SynchronousQueue<>(), // workQueue
threadFactory, // threadFactory
new ThreadPoolExecutor.AbortPolicy());
}
@NonNull
private static ThreadPoolExecutor createQueueProcessorThreadExecutor()
{
final ThreadFactory threadFactory = CustomizableThreadFactory.builder()
.setThreadNamePrefix("QueueProcessor")
.setDaemon(true)
.build();
return new ThreadPoolExecutor(
1, // corePoolSize
100, // maximumPoolSize
1000, // keepAliveTime
TimeUnit.MILLISECONDS, // timeUnit
// SynchronousQueue has *no* capacity. Therefore, each new submitted task will directly cause a new thread to be started,
// which is exactly what we want here.
// Thank you, http://stackoverflow.com/questions/10186397/threadpoolexecutor-without-a-queue !!!
new SynchronousQueue<>(), // workQueue
threadFactory, // threadFactory
new ThreadPoolExecutor.AbortPolicy() // RejectedExecutionHandler
);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.async\src\main\java\de\metas\async\processor\impl\planner\AsyncProcessorPlanner.java
| 1
|
请完成以下Java代码
|
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public String getBirthday() {
return birthday;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
|
public User(String name, Integer age, String birthday) {
this.name = name;
this.age = age;
this.birthday = birthday;
}
public User() {}
@Override
public String toString() {
return "User{" +
"id=" + id +
", name='" + name + '\'' +
", age=" + age +
", birthday=" + birthday +
'}';
}
}
|
repos\springboot-learning-example-master\chapter-4-spring-boot-validating-form-input\src\main\java\spring\boot\core\domain\User.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class ExternalSystemOutboundEndpointRepository
{
CCache<ExternalSystemOutboundEndpointId, ExternalSystemOutboundEndpoint> endpointsCache = CCache.<ExternalSystemOutboundEndpointId, ExternalSystemOutboundEndpoint>builder().tableName(I_ExternalSystem_Outbound_Endpoint.Table_Name)
.build();
@NonNull
public ExternalSystemOutboundEndpoint getById(@NonNull final ExternalSystemOutboundEndpointId id)
{
return endpointsCache.getOrLoad(id, this::retrieveById);
}
@NonNull
private ExternalSystemOutboundEndpoint retrieveById(@NonNull final ExternalSystemOutboundEndpointId id)
{
final I_ExternalSystem_Outbound_Endpoint endpointRecord = InterfaceWrapperHelper.load(id, I_ExternalSystem_Outbound_Endpoint.class);
if (endpointRecord == null)
{
throw new AdempiereException("No Outbound Endpoint found for " + id);
}
return fromRecord(endpointRecord);
}
@NonNull
|
private static ExternalSystemOutboundEndpoint fromRecord(@NonNull final I_ExternalSystem_Outbound_Endpoint endpointRecord)
{
return ExternalSystemOutboundEndpoint.builder()
.id(ExternalSystemOutboundEndpointId.ofRepoId(endpointRecord.getExternalSystem_Outbound_Endpoint_ID()))
.value(endpointRecord.getValue())
.endpointUrl(endpointRecord.getOutboundHttpEP())
.method(endpointRecord.getOutboundHttpMethod())
.authType(OutboundEndpointAuthType.ofCode(endpointRecord.getAuthType()))
.clientId(endpointRecord.getClientId())
.clientSecret(endpointRecord.getClientSecret())
.token(endpointRecord.getAuthToken())
.user(endpointRecord.getLoginUsername())
.password(endpointRecord.getPassword())
.sasSignature(endpointRecord.getSasSignature())
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java\de\metas\externalsystem\outboundendpoint\ExternalSystemOutboundEndpointRepository.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private AccessDeniedHandler accessDeniedHandler;
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
.authorizeRequests()
.antMatchers("/","/home","/about").permitAll()
.antMatchers("/admin/**").hasAnyRole("ADMIN")
.antMatchers("/user/**").hasAnyRole("USER")
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.logout()
.permitAll()
.and()
.exceptionHandling().accessDeniedHandler(accessDeniedHandler);
|
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication()
.withUser("user").password("user123").roles("USER")
.and()
.withUser("admin").password("admin123").roles("ADMIN");
}
@Bean
PasswordEncoder passwordEncoder(){
return new BCryptPasswordEncoder();
}
}
|
repos\Spring-Boot-Advanced-Projects-main\Springboot-Security-Project\src\main\java\spring\security\config\SpringSecurityConfig.java
| 2
|
请完成以下Java代码
|
public void setHelp (String Help)
{
set_Value (COLUMNNAME_Help, Help);
}
/** Get Comment/Help.
@return Comment or Hint
*/
public String getHelp ()
{
return (String)get_Value(COLUMNNAME_Help);
}
/** Set Java Class.
@param JavaClass Java Class */
public void setJavaClass (String JavaClass)
{
set_Value (COLUMNNAME_JavaClass, JavaClass);
}
/** Get Java Class.
@return Java Class */
public String getJavaClass ()
{
return (String)get_Value(COLUMNNAME_JavaClass);
}
/** 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);
}
/** Set Search Key.
@param Value
Search key for the record in the format required - must be unique
*/
public void setValue (String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
/** Get Search Key.
@return Search key for the record in the format required - must be unique
*/
public String getValue ()
{
return (String)get_Value(COLUMNNAME_Value);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_EXP_Processor_Type.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class UserServiceImpl implements UserService {
private static final Logger LOG = LoggerFactory.getLogger(UserServiceImpl.class);
private final Map<String, UserData> data;
public UserServiceImpl() {
this.data = new ConcurrentHashMap<>();
}
@Override
public Mono<UserData> create(CreateUserData createUserData) {
UserData userData = new UserData(UUID.randomUUID().toString(), createUserData.getEmail(), createUserData.getName());
data.put(userData.getId(), userData);
return Mono.just(userData);
}
@Override
public Mono<UserData> getEmployee(String id) {
UserData userData = data.get(id);
if (userData != null) {
return Mono.just(userData);
} else {
return Mono.empty();
}
}
@Override
public Flux<UserData> getAll() {
return Flux.fromIterable(data.values());
}
@Override
public Mono<UserData> update(UserData employee) {
data.put(employee.getId(), employee);
return Mono.just(employee);
}
@Override
public Mono<UserData> delete(String id) {
UserData userData = data.remove(id);
|
if (userData != null) {
return Mono.just(userData);
} else {
return Mono.empty();
}
}
@Override
public void createUsersBulk(Integer n) {
LOG.info("createUsersBulk n={} ...", n);
for (int i=0; i<n; i++) {
String id = "user-id-" + i;
data.put(id, new UserData(id, "email" + i + "@corp.com", "name-" + i));
}
LOG.info("created {} users", n);
}
@Override
public Publisher<UserData> getAllStream() {
LOG.info("getAllStream: ");
return new UserDataPublisher(data.values().stream().collect(Collectors.toUnmodifiableList()));
}
}
|
repos\spring-examples-java-17\spring-webflux\src\main\java\itx\examples\webflux\services\UserServiceImpl.java
| 2
|
请完成以下Java代码
|
private boolean isPricingRelevantAttribute(final Attribute attribute)
{
return attribute.isPricingRelevant() && attribute.getValueType().isList();
}
/**
* @return list of available attributeSet's instance attributes, merged with the attributes which are currently present in our ASI (even if they are not present in attribute set)
*/
private List<Attribute> retrieveAvailableAttributeSetAndInstanceAttributes(
@Nullable final AttributeSetId attributeSetId,
@Nullable final AttributeSetInstanceId attributeSetInstanceId)
{
final LinkedHashMap<AttributeId, Attribute> attributes = new LinkedHashMap<>(); // preserve the order
//
// Retrieve attribute set's instance attributes,
// and index them by M_Attribute_ID
if (attributeSetId != null && !attributeSetId.isNone())
{
attributesRepo.getAttributesByAttributeSetId(attributeSetId)
.stream()
.filter(Attribute::isInstanceAttribute)
.forEach(attribute -> attributes.put(attribute.getAttributeId(), attribute));
|
}
//
// If we have an ASI then fetch the attributes from ASI which are missing in attributeSet
// and add them to our "attributes" index.
if (AttributeSetInstanceId.isRegular(attributeSetInstanceId))
{
final Set<AttributeId> alreadyLoadedAttributeIds = attributes.keySet();
final Set<AttributeId> asiAttributeIds = asiBL.getAttributeIdsByAttributeSetInstanceId(attributeSetInstanceId);
final Set<AttributeId> attributeIdsToLoad = Sets.difference(asiAttributeIds, alreadyLoadedAttributeIds);
attributesRepo.getAttributesByIds(attributeIdsToLoad)
.forEach(attribute -> attributes.put(attribute.getAttributeId(), attribute));
}
//
return ImmutableList.copyOf(attributes.values());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\org\adempiere\mm\attributes\util\ASIEditingInfo.java
| 1
|
请完成以下Java代码
|
public T execute(CommandContext commandContext) {
if (executionId == null) {
throw new FlowableIllegalArgumentException("executionId is null");
}
ExecutionEntity execution = CommandContextUtil.getExecutionEntityManager(commandContext).findById(executionId);
if (execution == null) {
throw new FlowableObjectNotFoundException("execution " + executionId + " doesn't exist", Execution.class);
}
if (execution.isSuspended()) {
throw new FlowableException(getSuspendedExceptionMessagePrefix() + " a suspended " + execution);
}
return execute(commandContext, execution);
|
}
/**
* Subclasses should implement this method. The provided {@link ExecutionEntity} is guaranteed to be active (ie. not suspended).
*/
protected abstract T execute(CommandContext commandContext, ExecutionEntity execution);
/**
* Subclasses can override this to provide a more detailed exception message that will be thrown when the execution is suspended.
*/
protected String getSuspendedExceptionMessagePrefix() {
return "Cannot execute operation for";
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\cmd\NeedsActiveExecutionCmd.java
| 1
|
请完成以下Java代码
|
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public long getValue() {
return value;
}
public void setValue(long value) {
this.value = value;
}
public String getReporter() {
return reporter;
}
public void setReporter(String reporter) {
this.reporter = reporter;
}
|
public Object getPersistentState() {
// immutable
return MeterLogEntity.class;
}
@Override
public Set<String> getReferencedEntityIds() {
Set<String> referencedEntityIds = new HashSet<String>();
return referencedEntityIds;
}
@Override
public Map<String, Class> getReferencedEntitiesIdAndClass() {
Map<String, Class> referenceIdAndClass = new HashMap<String, Class>();
return referenceIdAndClass;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\MeterLogEntity.java
| 1
|
请完成以下Java代码
|
protected final LUTUProducerDestination createNewHUProducer(
@NonNull final PickingSlotRow pickingRow,
@NonNull final I_M_HU_PI targetHUPI)
{
final BPartnerId bpartnerId = BPartnerId.ofRepoIdOrNull(pickingRow.getBPartnerId());
final int bpartnerLocationId = pickingRow.getBPartnerLocationId();
final LocatorId locatorId = pickingRow.getPickingSlotLocatorId();
final I_M_Locator locator = Services.get(IWarehouseDAO.class).getLocatorById(locatorId, I_M_Locator.class);
if (!locator.isAfterPickingLocator())
{
throw new AdempiereException("Picking slot's locator is not an after picking locator: " + locator.getValue());
}
final LUTUProducerDestination lutuProducer = new LUTUProducerDestination();
lutuProducer.setBPartnerId(bpartnerId)
.setC_BPartner_Location_ID(bpartnerLocationId)
.setLocatorId(locatorId)
.setHUStatus(X_M_HU.HUSTATUS_Picked);
final String targetHuType = Services.get(IHandlingUnitsBL.class).getHU_UnitType(targetHUPI);
if (X_M_HU_PI_Version.HU_UNITTYPE_LoadLogistiqueUnit.equals(targetHuType))
{
lutuProducer.setLUPI(targetHUPI);
}
else if (X_M_HU_PI_Version.HU_UNITTYPE_TransportUnit.equals(targetHuType))
{
lutuProducer.setNoLU();
lutuProducer.setTUPI(targetHUPI);
}
return lutuProducer;
}
protected void moveToAfterPickingLocator(@NonNull final I_M_HU hu)
{
final String huStatus = hu.getHUStatus();
// Move the HU to an after picking locator
|
final LocatorId afterPickingLocatorId = huWarehouseDAO.suggestAfterPickingLocatorId(hu.getM_Locator_ID())
.orElseThrow(() -> new AdempiereException("No after picking locator found for locatorId=" + hu.getM_Locator_ID()));
if (afterPickingLocatorId.getRepoId() != hu.getM_Locator_ID())
{
huMovementBL.moveHUsToLocator(ImmutableList.of(hu), afterPickingLocatorId);
//
// FIXME: workaround to restore HU's HUStatus (i.e. which was changed from Picked to Active by the moveHUsToLocator() method, indirectly).
// See https://github.com/metasfresh/metasfresh-webui-api/issues/678#issuecomment-344876035, that's the stacktrace where the HU status was set to Active.
InterfaceWrapperHelper.refresh(hu, ITrx.TRXNAME_ThreadInherited);
if (!Objects.equal(huStatus, hu.getHUStatus()))
{
final IHUContext huContext = huContextFactory.createMutableHUContext();
huStatusBL.setHUStatus(huContext, hu, huStatus);
save(hu);
}
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\pickingslotsClearing\process\PickingSlotsClearingViewBasedProcess.java
| 1
|
请完成以下Java代码
|
public final class ShipperGatewayId
{
@NonNull private final String value;
private static final Interner<ShipperGatewayId> interner = Interners.newStrongInterner();
private ShipperGatewayId(@NonNull final String value)
{
final String valueNorm = StringUtils.trimBlankToNull(value);
if (valueNorm == null)
{
throw new AdempiereException("value shall not be blank");
}
this.value = valueNorm;
}
public static ShipperGatewayId ofString(@NonNull final String value)
{
return interner.intern(new ShipperGatewayId(value));
|
}
@Nullable
@JsonCreator
public static ShipperGatewayId ofNullableString(@Nullable final String value)
{
final String valueNorm = StringUtils.trimBlankToNull(value);
return valueNorm != null ? ofString(valueNorm) : null;
}
@Override
@Deprecated
public String toString() {return toJson();}
@JsonValue
public String toJson() {return value;}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\shipping\ShipperGatewayId.java
| 1
|
请完成以下Java代码
|
public boolean hasValue(String paramName) {
return params.containsKey(paramName);
}
@Override
public Object getValue(String paramName) throws IllegalArgumentException {
return checkParameter(paramName).value;
}
@Override
public int getSqlType(String paramName) {
return checkParameter(paramName).type;
}
private Parameter checkParameter(String paramName) {
Parameter param = params.get(paramName);
if (param == null) {
throw new RuntimeException("Parameter with name: " + paramName + " is not set!");
}
return param;
}
@Override
public String getTypeName(String paramName) {
return params.get(paramName).name;
}
@Override
public String[] getParameterNames() {
return params.keySet().toArray(new String[]{});
}
public void addUuidParameter(String name, UUID value) {
addParameter(name, value, UUID_TYPE.getJdbcTypeCode(), UUID_TYPE.getFriendlyName());
}
public void addStringParameter(String name, String value) {
addParameter(name, value, Types.VARCHAR, "VARCHAR");
}
public void addDoubleParameter(String name, double value) {
addParameter(name, value, Types.DOUBLE, "DOUBLE");
}
public void addLongParameter(String name, long value) {
addParameter(name, value, Types.BIGINT, "BIGINT");
}
public void addStringListParameter(String name, List<String> value) {
addParameter(name, value, Types.VARCHAR, "VARCHAR");
}
public void addBooleanParameter(String name, boolean value) {
addParameter(name, value, Types.BOOLEAN, "BOOLEAN");
}
public void addUuidListParameter(String name, List<UUID> value) {
addParameter(name, value, UUID_TYPE.getJdbcTypeCode(), UUID_TYPE.getFriendlyName());
}
public String getQuery() {
return query.toString();
}
|
public static class Parameter {
private final Object value;
private final int type;
private final String name;
public Parameter(Object value, int type, String name) {
this.value = value;
this.type = type;
this.name = name;
}
}
public TenantId getTenantId() {
return securityCtx.getTenantId();
}
public CustomerId getCustomerId() {
return securityCtx.getCustomerId();
}
public EntityType getEntityType() {
return securityCtx.getEntityType();
}
public boolean isIgnorePermissionCheck() {
return securityCtx.isIgnorePermissionCheck();
}
}
|
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\sql\query\SqlQueryContext.java
| 1
|
请完成以下Java代码
|
public class LocationStats {
private String state;
private String country;
private int latestTotalCases;
private int diffFromPrevDay;
public int getDiffFromPrevDay() {
return diffFromPrevDay;
}
public void setDiffFromPrevDay(int diffFromPrevDay) {
this.diffFromPrevDay = diffFromPrevDay;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public int getLatestTotalCases() {
|
return latestTotalCases;
}
public void setLatestTotalCases(int latestTotalCases) {
this.latestTotalCases = latestTotalCases;
}
@Override
public String toString() {
return "LocationStats{" +
"state='" + state + '\'' +
", country='" + country + '\'' +
", latestTotalCases=" + latestTotalCases +
'}';
}
}
|
repos\Spring-Boot-Advanced-Projects-main\spring covid-19\src\main\java\io\alanbinu\coronavirustracker\models\LocationStats.java
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.