From 572ec3ff51b07c7b2fc3b53e6878c7a0249e1427 Mon Sep 17 00:00:00 2001 From: Lunix-420 Date: Thu, 7 Nov 2024 12:57:08 +0100 Subject: [PATCH] refactor: Further improve skills --- data/maradona/dbfile.mv.db | Bin 0 -> 40960 bytes data/maradona/dbfile.trace.db | 259 ++++++++++++++++++ pom.xml | 8 + .../{ => api}/SecondarySkillsController.java | 45 ++- .../{ => page}/PageController.java | 2 +- .../services/SecondarySkillService.java | 26 ++ 6 files changed, 312 insertions(+), 28 deletions(-) create mode 100644 data/maradona/dbfile.mv.db create mode 100644 data/maradona/dbfile.trace.db rename src/main/java/com/maradona/backend/controllers/{ => api}/SecondarySkillsController.java (72%) rename src/main/java/com/maradona/backend/controllers/{ => page}/PageController.java (92%) diff --git a/data/maradona/dbfile.mv.db b/data/maradona/dbfile.mv.db new file mode 100644 index 0000000000000000000000000000000000000000..cb19e1d00f79279a0f1a1694c118392abd9d3588 GIT binary patch literal 40960 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.java:291) + at org.h2.mvstore.MVStore$Builder.open(MVStore.java:2035) + at org.h2.mvstore.db.Store.(Store.java:133) + at org.h2.engine.Database.(Database.java:326) + at org.h2.engine.Engine.openSession(Engine.java:92) + at org.h2.engine.Engine.openSession(Engine.java:222) + at org.h2.engine.Engine.createSession(Engine.java:201) + at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:343) + at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:125) + at org.h2.Driver.connect(Driver.java:59) + at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:137) + at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:360) + at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:202) + at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:461) + at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:550) + at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:98) + at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:111) + at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.getConnectionUrl(H2ConsoleAutoConfiguration.java:94) + at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) + at java.base/java.util.ArrayList.forEach(ArrayList.java:1596) + at java.base/java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395) + at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:261) + at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:261) + at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510) + at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) + at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) + at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) + at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616) + at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622) + at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627) + at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.logDataSources(H2ConsoleAutoConfiguration.java:86) + at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.lambda$h2Console$0(H2ConsoleAutoConfiguration.java:69) + at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.withThreadContextClassLoader(H2ConsoleAutoConfiguration.java:78) + at org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration.h2Console(H2ConsoleAutoConfiguration.java:69) + at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) + at java.base/java.lang.reflect.Method.invoke(Method.java:580) + at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:146) + at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:644) + at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1355) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1185) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:562) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:337) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:335) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:205) + at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:211) + at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:202) + at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addServletContextInitializerBeans(ServletContextInitializerBeans.java:97) + at org.springframework.boot.web.servlet.ServletContextInitializerBeans.(ServletContextInitializerBeans.java:86) + at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getServletContextInitializerBeans(ServletWebServerApplicationContext.java:266) + at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:240) + at org.springframework.boot.web.embedded.tomcat.TomcatStarter.onStartup(TomcatStarter.java:52) + at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4412) + at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164) + at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1203) + at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1193) + at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) + at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) + at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) + at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:749) + at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:772) + at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164) + at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1203) + at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1193) + at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) + at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) + at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) + at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:749) + at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:203) + at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164) + at org.apache.catalina.core.StandardService.startInternal(StandardService.java:415) + at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164) + at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:870) + at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164) + at org.apache.catalina.startup.Tomcat.start(Tomcat.java:437) + at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:128) + at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.(TomcatWebServer.java:107) + at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:516) + at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:222) + at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:188) + at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162) + at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:619) + at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) + at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) + at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) + at org.springframework.boot.SpringApplication.run(SpringApplication.java:335) + at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363) + at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352) + at com.maradona.backend.BackendApplication.main(BackendApplication.java:10) +Caused by: org.h2.jdbc.JdbcSQLNonTransientException: General error: "org.h2.mvstore.MVStoreException: The file is locked: /data/development/backend/data/maradona/dbfile.mv.db [2.2.224/7]" [50000-224] + at org.h2.message.DbException.getJdbcSQLException(DbException.java:566) + at org.h2.message.DbException.getJdbcSQLException(DbException.java:489) + ... 96 more +Caused by: org.h2.mvstore.MVStoreException: The file is locked: /data/development/backend/data/maradona/dbfile.mv.db [2.2.224/7] + at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:996) + at org.h2.mvstore.SingleFileStore.lockFileChannel(SingleFileStore.java:143) + at org.h2.mvstore.SingleFileStore.open(SingleFileStore.java:117) + at org.h2.mvstore.SingleFileStore.open(SingleFileStore.java:81) + at org.h2.mvstore.MVStore.(MVStore.java:286) + ... 90 more +2024-11-07 10:15:20.775938+01:00 database: flush +org.h2.message.DbException: General error: "org.h2.mvstore.MVStoreException: The file is locked: /data/development/backend/data/maradona/dbfile.mv.db [2.2.224/7]" [50000-224] + at org.h2.message.DbException.get(DbException.java:212) + at org.h2.message.DbException.convert(DbException.java:407) + at org.h2.mvstore.db.Store.lambda$new$0(Store.java:122) + at org.h2.mvstore.MVStore.handleException(MVStore.java:1546) + at org.h2.mvstore.MVStore.panic(MVStore.java:371) + at org.h2.mvstore.MVStore.(MVStore.java:291) + at org.h2.mvstore.MVStore$Builder.open(MVStore.java:2035) + at org.h2.mvstore.db.Store.(Store.java:133) + at org.h2.engine.Database.(Database.java:326) + at org.h2.engine.Engine.openSession(Engine.java:92) + at org.h2.engine.Engine.openSession(Engine.java:222) + at org.h2.engine.Engine.createSession(Engine.java:201) + at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:343) + at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:125) + at org.h2.Driver.connect(Driver.java:59) + at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:137) + at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:360) + at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:202) + at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:461) + at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:550) + at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:98) + at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:111) + at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) + at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:439) + at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcIsolationDelegate.delegateWork(JdbcIsolationDelegate.java:61) + at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.getJdbcEnvironmentUsingJdbcMetadata(JdbcEnvironmentInitiator.java:292) + at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:124) + at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:78) + at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:130) + at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263) + at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:238) + at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:215) + at org.hibernate.boot.model.relational.Database.(Database.java:45) + at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.getDatabase(InFlightMetadataCollectorImpl.java:221) + at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.(InFlightMetadataCollectorImpl.java:189) + at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:171) + at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1431) + at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1502) + at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:75) + at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:390) + at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) + at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) + at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:366) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1853) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1802) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:337) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:335) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:205) + at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:954) + at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:625) + at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) + at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) + at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) + at org.springframework.boot.SpringApplication.run(SpringApplication.java:335) + at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363) + at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352) + at com.maradona.backend.BackendApplication.main(BackendApplication.java:10) +Caused by: org.h2.jdbc.JdbcSQLNonTransientException: General error: "org.h2.mvstore.MVStoreException: The file is locked: /data/development/backend/data/maradona/dbfile.mv.db [2.2.224/7]" [50000-224] + at org.h2.message.DbException.getJdbcSQLException(DbException.java:566) + at org.h2.message.DbException.getJdbcSQLException(DbException.java:489) + ... 60 more +Caused by: org.h2.mvstore.MVStoreException: The file is locked: /data/development/backend/data/maradona/dbfile.mv.db [2.2.224/7] + at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:996) + at org.h2.mvstore.SingleFileStore.lockFileChannel(SingleFileStore.java:143) + at org.h2.mvstore.SingleFileStore.open(SingleFileStore.java:117) + at org.h2.mvstore.SingleFileStore.open(SingleFileStore.java:81) + at org.h2.mvstore.MVStore.(MVStore.java:286) + ... 54 more +2024-11-07 10:15:22.336042+01:00 database: flush +org.h2.message.DbException: General error: "org.h2.mvstore.MVStoreException: The file is locked: /data/development/backend/data/maradona/dbfile.mv.db [2.2.224/7]" [50000-224] + at org.h2.message.DbException.get(DbException.java:212) + at org.h2.message.DbException.convert(DbException.java:407) + at org.h2.mvstore.db.Store.lambda$new$0(Store.java:122) + at org.h2.mvstore.MVStore.handleException(MVStore.java:1546) + at org.h2.mvstore.MVStore.panic(MVStore.java:371) + at org.h2.mvstore.MVStore.(MVStore.java:291) + at org.h2.mvstore.MVStore$Builder.open(MVStore.java:2035) + at org.h2.mvstore.db.Store.(Store.java:133) + at org.h2.engine.Database.(Database.java:326) + at org.h2.engine.Engine.openSession(Engine.java:92) + at org.h2.engine.Engine.openSession(Engine.java:222) + at org.h2.engine.Engine.createSession(Engine.java:201) + at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:343) + at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:125) + at org.h2.Driver.connect(Driver.java:59) + at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:137) + at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:360) + at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:202) + at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:461) + at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:550) + at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:98) + at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:111) + at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) + at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:439) + at org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl.getIsolatedConnection(DdlTransactionIsolatorNonJtaImpl.java:46) + at org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl.getIsolatedConnection(DdlTransactionIsolatorNonJtaImpl.java:39) + at org.hibernate.tool.schema.internal.exec.ImprovedExtractionContextImpl.getJdbcConnection(ImprovedExtractionContextImpl.java:63) + at org.hibernate.tool.schema.extract.spi.ExtractionContext.getQueryResults(ExtractionContext.java:43) + at org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorLegacyImpl.extractMetadata(SequenceInformationExtractorLegacyImpl.java:39) + at org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl.initializeSequences(DatabaseInformationImpl.java:66) + at org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl.(DatabaseInformationImpl.java:60) + at org.hibernate.tool.schema.internal.Helper.buildDatabaseInformation(Helper.java:185) + at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:100) + at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:280) + at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.lambda$process$5(SchemaManagementToolCoordinator.java:144) + at java.base/java.util.HashMap.forEach(HashMap.java:1429) + at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:141) + at org.hibernate.boot.internal.SessionFactoryObserverForSchemaExport.sessionFactoryCreated(SessionFactoryObserverForSchemaExport.java:37) + at org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(SessionFactoryObserverChain.java:35) + at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:322) + at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:457) + at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1506) + at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:75) + at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:390) + at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) + at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) + at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:366) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1853) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1802) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:337) + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:335) + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:205) + at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:954) + at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:625) + at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) + at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) + at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) + at org.springframework.boot.SpringApplication.run(SpringApplication.java:335) + at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363) + at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352) + at com.maradona.backend.BackendApplication.main(BackendApplication.java:10) +Caused by: org.h2.jdbc.JdbcSQLNonTransientException: General error: "org.h2.mvstore.MVStoreException: The file is locked: /data/development/backend/data/maradona/dbfile.mv.db [2.2.224/7]" [50000-224] + at org.h2.message.DbException.getJdbcSQLException(DbException.java:566) + at org.h2.message.DbException.getJdbcSQLException(DbException.java:489) + ... 64 more +Caused by: org.h2.mvstore.MVStoreException: The file is locked: /data/development/backend/data/maradona/dbfile.mv.db [2.2.224/7] + at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:996) + at org.h2.mvstore.SingleFileStore.lockFileChannel(SingleFileStore.java:143) + at org.h2.mvstore.SingleFileStore.open(SingleFileStore.java:117) + at org.h2.mvstore.SingleFileStore.open(SingleFileStore.java:81) + at org.h2.mvstore.MVStore.(MVStore.java:286) + ... 58 more diff --git a/pom.xml b/pom.xml index 117affd..1d19678 100644 --- a/pom.xml +++ b/pom.xml @@ -94,6 +94,14 @@ exec + + org.apache.maven.plugins + maven-javadoc-plugin + 3.4.1 + + ${project.build.directory}/docs + + diff --git a/src/main/java/com/maradona/backend/controllers/SecondarySkillsController.java b/src/main/java/com/maradona/backend/controllers/api/SecondarySkillsController.java similarity index 72% rename from src/main/java/com/maradona/backend/controllers/SecondarySkillsController.java rename to src/main/java/com/maradona/backend/controllers/api/SecondarySkillsController.java index ced2330..530d6da 100644 --- a/src/main/java/com/maradona/backend/controllers/SecondarySkillsController.java +++ b/src/main/java/com/maradona/backend/controllers/api/SecondarySkillsController.java @@ -1,6 +1,7 @@ -package com.maradona.backend.controllers; +package com.maradona.backend.controllers.api; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; @@ -10,32 +11,37 @@ import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.stereotype.Controller; import com.maradona.backend.entities.SecondarySkill; import com.maradona.backend.entities.PrimarySkill; -import com.maradona.backend.services.EmployeeService; -import com.maradona.backend.services.PrimarySkillService; import com.maradona.backend.services.SecondarySkillService; /** * Controller for handling secondary skill data. * + * List of endpoints: + * - GET /api/secondary-skills + * - GET /api/secondary-skills/all + * - GET /api/secondary-skills/from-primary-skill + * - POST /api/secondary-skills + * - PUT /api/secondary-skills + * - DELETE /api/secondary-skills + * * @see SecondarySkill */ @Controller @RequestMapping("/api/secondary-skills") public class SecondarySkillsController { - @Autowired - private EmployeeService employeeService; - - @Autowired - private PrimarySkillService primarySkillService; + /** + * Service for handling secondary skill data. + */ @Autowired private SecondarySkillService secondarySkillService; - // Hardcoded placeholder user ID for now + /** + * Hardcoded user ID for testing purposes. + */ Long user = Long.valueOf(1); /** @@ -74,8 +80,7 @@ public class SecondarySkillsController { @GetMapping("/from-primary-skill") @ResponseBody public Iterable getSecondarySkills(@RequestParam Long primarySkillId) { - var list = secondarySkillService.getSecondarySkillsByPrimarySkillId(primarySkillId); - return list; + return secondarySkillService.getSecondarySkillsByPrimarySkillId(primarySkillId); } /** @@ -88,15 +93,6 @@ public class SecondarySkillsController { */ @PostMapping({ "/", "" }) public void post(@ModelAttribute SecondarySkill secondarySkill) { - var primarySkillDescription = secondarySkill.getPrimarySkill().getDescription(); - var existingPrimarySkill = primarySkillService.findByDescription(primarySkillDescription); - - if (existingPrimarySkill.isPresent()) { - secondarySkill.setPrimarySkill(existingPrimarySkill.get()); - } else { - primarySkillService.savePrimarySkill(secondarySkill.getPrimarySkill()); - } - secondarySkillService.saveSecondarySkill(secondarySkill); } @@ -119,11 +115,6 @@ public class SecondarySkillsController { */ @DeleteMapping({ "/", "" }) public void delete(@RequestParam Long id) { - var employee = employeeService.getEmployeeById(user).orElseThrow(() -> new RuntimeException("Employee not found")); - secondarySkillService.getSecondarySkillById(id) - .orElseThrow(() -> new RuntimeException("Secondary Skill not found")); - - employee.getSecondarySkills().removeIf(skill -> skill.getSecondarySkill().getSsid().equals(id)); - employeeService.saveEmployee(employee); + secondarySkillService.deleteSecondarySkillFromEmployee(user, id); } } diff --git a/src/main/java/com/maradona/backend/controllers/PageController.java b/src/main/java/com/maradona/backend/controllers/page/PageController.java similarity index 92% rename from src/main/java/com/maradona/backend/controllers/PageController.java rename to src/main/java/com/maradona/backend/controllers/page/PageController.java index 3b92499..860e85c 100644 --- a/src/main/java/com/maradona/backend/controllers/PageController.java +++ b/src/main/java/com/maradona/backend/controllers/page/PageController.java @@ -1,4 +1,4 @@ -package com.maradona.backend.controllers; +package com.maradona.backend.controllers.page; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; diff --git a/src/main/java/com/maradona/backend/services/SecondarySkillService.java b/src/main/java/com/maradona/backend/services/SecondarySkillService.java index 61a1a81..52d1fc4 100644 --- a/src/main/java/com/maradona/backend/services/SecondarySkillService.java +++ b/src/main/java/com/maradona/backend/services/SecondarySkillService.java @@ -13,7 +13,23 @@ public class SecondarySkillService { @Autowired private SecondarySkillRepository secondarySkillRepository; + @Autowired + private PrimarySkillService primarySkillService; + + @Autowired + private EmployeeService employeeService; + public SecondarySkill saveSecondarySkill(SecondarySkill secondarySkill) { + // TODO: Use the primaries ID to find the primary skill not the description + var primarySkillDescription = secondarySkill.getPrimarySkill().getDescription(); + var existingPrimarySkill = primarySkillService.findByDescription(primarySkillDescription); + + if (existingPrimarySkill.isPresent()) { + secondarySkill.setPrimarySkill(existingPrimarySkill.get()); + } else { + primarySkillService.savePrimarySkill(secondarySkill.getPrimarySkill()); + } + return secondarySkillRepository.save(secondarySkill); } @@ -40,4 +56,14 @@ public class SecondarySkillService { } return result; } + + public void deleteSecondarySkillFromEmployee(Long userId, Long skillId) { + var employee = employeeService.getEmployeeById(userId) + .orElseThrow(() -> new RuntimeException("Employee not found")); + getSecondarySkillById(skillId) + .orElseThrow(() -> new RuntimeException("Secondary Skill not found")); + + employee.getSecondarySkills().removeIf(skill -> skill.getSecondarySkill().getSsid().equals(skillId)); + employeeService.saveEmployee(employee); + } }