diff --git a/packaging/pom.xml b/packaging/pom.xml index 9304d42..acc3888 100644 --- a/packaging/pom.xml +++ b/packaging/pom.xml @@ -2,24 +2,30 @@ 4.0.0 - @@@groupId@@@ - @@@artifactId@@@ + org.exoplatform.addons.training + training-exercices-parent 1.0.x-SNAPSHOT - @@@artifactId@@@-packaging + training-exercices-packaging pom - @@@name@@@ - Packaging + Training Exercises - Packaging ${project.groupId} - @@@artifactId@@@-war - 1.0.x-SNAPSHOT + training-exercises-webapp + ${project.version} war provided + + ${project.groupId} + training-exercises-services + ${project.version} + provided + - @@@artifactId@@@ + training-exercises-packaging org.apache.maven.plugins @@ -32,7 +38,7 @@ single - @@@artifactId@@@ + training-exercises-packaging false src/main/assemblies/packaging.xml diff --git a/packaging/src/main/assemblies/packaging.xml b/packaging/src/main/assemblies/packaging.xml index 314b6b0..806b599 100644 --- a/packaging/src/main/assemblies/packaging.xml +++ b/packaging/src/main/assemblies/packaging.xml @@ -1,7 +1,7 @@ - @@@artifactId@@@-addon + training-exercises-addon zip @@ -12,17 +12,17 @@ false - ${project.groupId}:@@@artifactId@@@-war:war + ${project.groupId}:training-exercises-webapp:war provided - @@@artifactId@@@.war + training-exercises-webapp.war false - ${project.groupId}:@@@artifactId@@@-*:jar + ${project.groupId}:training-exercises-services:jar provided ${artifact.artifactId}-${artifact.baseVersion}.${artifact.extension} diff --git a/pom.xml b/pom.xml index d2731d7..278c0b3 100644 --- a/pom.xml +++ b/pom.xml @@ -26,24 +26,19 @@ org.exoplatform.addons 6 - @@@groupId@@@ - @@@artifactId@@@ + org.exoplatform.addons.training + training-exercices-parent 1.0.x-SNAPSHOT pom - @@@name@@@ - @@@description@@@ + Training addon - Parent + Parent for training addon + services war packaging - - scm:git:git://github.com/exo-addons/@@@git_project@@@.git - scm:git:git@github.com:exo-addons/@@@git_project@@@.git - HEAD - https://github.com/exo-addons/@@@git_project@@@ - - @@@platform_version@@@ + 5.0.1 @@ -55,6 +50,11 @@ pom import + + org.exoplatform.kernel + exo.kernel.commons + ${platform.version} + diff --git a/services/pom.xml b/services/pom.xml new file mode 100644 index 0000000..ac4546e --- /dev/null +++ b/services/pom.xml @@ -0,0 +1,49 @@ + + + + org.exoplatform.addons.training + training-exercices-parent + 1.0.x-SNAPSHOT + + 4.0.0 + training-exercises-services + 1.0.x-SNAPSHOT + + + picocontainer + picocontainer + 1.1 + + + org.exoplatform.kernel + exo.kernel.commons + ${platform.version} + + + org.exoplatform.kernel + exo.kernel.container + ${platform.version} + + + org.exoplatform.commons + commons-api + ${platform.version} + + + org.exoplatform.social + social-component-core-jpa + 5.0.0-RC13 + + + org.exoplatform.social + social-component-core-jpa + 5.0.0-RC13 + + + Training Exercise - Services + + training-exercises-services + + \ No newline at end of file diff --git a/services/src/main/java/org/exoplatform/addons/entity/FavouriteActivity.java b/services/src/main/java/org/exoplatform/addons/entity/FavouriteActivity.java new file mode 100644 index 0000000..b7a76f8 --- /dev/null +++ b/services/src/main/java/org/exoplatform/addons/entity/FavouriteActivity.java @@ -0,0 +1,60 @@ +package org.exoplatform.addons.entity; + +import javax.persistence.*; + +import org.exoplatform.commons.api.persistence.ExoEntity; +import org.exoplatform.social.core.jpa.storage.entity.ActivityEntity; +import org.exoplatform.social.core.jpa.storage.entity.IdentityEntity; + +import java.util.Calendar; + +@Entity +@ExoEntity +@Table(name = "ADDON_FAVOURITE_ACTIVITY") +public class FavouriteActivity { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "ID") + private Long id; + @ManyToOne + private IdentityEntity favouriteBy; + @ManyToOne + private ActivityEntity activity; + + @Temporal(value = TemporalType.TIMESTAMP) + @Column(name = "FAVOURITE_DATE") + private Calendar favouriteDate; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public IdentityEntity getFavouriteBy() { + return favouriteBy; + } + + public void setFavouriteBy(IdentityEntity favouriteBy) { + this.favouriteBy = favouriteBy; + } + + public ActivityEntity getActivity() { + return activity; + } + + public void setActivity(ActivityEntity activity) { + this.activity = activity; + } + + public Calendar getFavouriteDate() { + return favouriteDate; + } + + public void setFavouriteDate(Calendar favouriteDate) { + this.favouriteDate = favouriteDate; + } +} diff --git a/services/src/main/java/org/exoplatform/addons/services/MyService.java b/services/src/main/java/org/exoplatform/addons/services/MyService.java new file mode 100644 index 0000000..37f01d9 --- /dev/null +++ b/services/src/main/java/org/exoplatform/addons/services/MyService.java @@ -0,0 +1,29 @@ +package org.exoplatform.addons.services; + +import org.exoplatform.services.log.ExoLogger; +import org.exoplatform.services.log.Log; + +/** + * Created by eXo Platform SAS. + * + * @author Ali Hamdi + * @since 13/09/18 15:12 + */ + +public class MyService { + /** + * The logger. + */ + private static final Log LOG = ExoLogger.getExoLogger(MyService.class); + private String message="alioua"; + public MyService() { + } + + public String getMessage() { + + + return message; + } + + +} diff --git a/services/src/main/java/org/exoplatform/addons/services/MyStartableService.java b/services/src/main/java/org/exoplatform/addons/services/MyStartableService.java new file mode 100644 index 0000000..8c9a21d --- /dev/null +++ b/services/src/main/java/org/exoplatform/addons/services/MyStartableService.java @@ -0,0 +1,33 @@ +package org.exoplatform.addons.services; + +import org.exoplatform.container.ExoContainerContext; +import org.exoplatform.container.PortalContainer; +import org.picocontainer.Startable; +import org.exoplatform.services.log.*; + +/** + * Created by eXo Platform SAS. + * + */ + +public class MyStartableService implements Startable { + /** + * The logger. + */ + private static final Log LOG = ExoLogger.getExoLogger(MyStartableService.class); + + public MyStartableService() { + + } + + @Override + public void start() { + LOG.info("&&&&&&&&&&&& My Startable service started !"); + + } + + @Override + public void stop() { + LOG.info("&&&&&&&&&&&& My Startable service stopped !"); + } +} diff --git a/services/src/main/resources/conf/configuration.xml b/services/src/main/resources/conf/configuration.xml new file mode 100644 index 0000000..61106db --- /dev/null +++ b/services/src/main/resources/conf/configuration.xml @@ -0,0 +1,41 @@ + + + + + + org.exoplatform.commons.api.persistence.DataInitializer + + SocialRDBMSChangeLogsPlugin + addChangeLogsPlugin + org.exoplatform.commons.persistence.impl.ChangeLogsPlugin + + + changelogs + Change logs of Social RDBMS + db/changelog/addon-training-rdbms.db.changelog-1.0.0.xml + + + + + \ No newline at end of file diff --git a/services/src/main/resources/conf/portal/configuration.xml b/services/src/main/resources/conf/portal/configuration.xml new file mode 100644 index 0000000..374f96a --- /dev/null +++ b/services/src/main/resources/conf/portal/configuration.xml @@ -0,0 +1,37 @@ + + + + + + org.exoplatform.commons.persistence.impl.EntityManagerService + + + org.exoplatform.addons.services.MyService + + + org.exoplatform.addons.services.MyStartableService + + + org.exoplatform.addons.test.MyStartableServiceTest + + \ No newline at end of file diff --git a/services/src/main/resources/db/changelog/addon-training-rdbms.db.changelog-1.0.0.xml b/services/src/main/resources/db/changelog/addon-training-rdbms.db.changelog-1.0.0.xml new file mode 100644 index 0000000..5407070 --- /dev/null +++ b/services/src/main/resources/db/changelog/addon-training-rdbms.db.changelog-1.0.0.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/src/test/org/exoplatform/addons/services/MyServiceTest.java b/services/src/test/org/exoplatform/addons/services/MyServiceTest.java new file mode 100644 index 0000000..e1f1825 --- /dev/null +++ b/services/src/test/org/exoplatform/addons/services/MyServiceTest.java @@ -0,0 +1,16 @@ +package org.exoplatform.addons.services; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class MyServiceTest { + + @Test + void getMessage() { + MyService my=new MyService(); + + assertNotNull(my.getMessage()); + assertEquals("alioua", my.getMessage()); + } +} \ No newline at end of file diff --git a/war/pom.xml b/war/pom.xml index 8597b1b..40f4851 100644 --- a/war/pom.xml +++ b/war/pom.xml @@ -22,14 +22,14 @@ 4.0.0 - @@@groupId@@@ - @@@artifactId@@@ + org.exoplatform.addons.training + training-exercices-parent 1.0.x-SNAPSHOT - @@@artifactId@@@-war + training-exercises-webapp war - @@@name@@@ - Webapp + Training Exercises - Webapp - @@@artifactId@@@-extension + training-exercises-extension diff --git a/war/src/main/webapp/META-INF/exo-conf/configuration.xml b/war/src/main/webapp/META-INF/exo-conf/configuration.xml index 8758580..4743ac8 100644 --- a/war/src/main/webapp/META-INF/exo-conf/configuration.xml +++ b/war/src/main/webapp/META-INF/exo-conf/configuration.xml @@ -46,7 +46,7 @@ - @@@artifactId@@@ + training-exercises-extension diff --git a/war/src/main/webapp/WEB-INF/conf/configuration.xml b/war/src/main/webapp/WEB-INF/conf/configuration.xml index 3ac88a4..00b465e 100644 --- a/war/src/main/webapp/WEB-INF/conf/configuration.xml +++ b/war/src/main/webapp/WEB-INF/conf/configuration.xml @@ -22,5 +22,12 @@ - + + org.exoplatform.addons.services.MyStartableService + org.exoplatform.addons.services.MyStartableService + + + org.exoplatform.addons.services.MyService + org.exoplatform.addons.services.MyService + diff --git a/war/src/main/webapp/WEB-INF/web.xml b/war/src/main/webapp/WEB-INF/web.xml index 4971888..c15ecc3 100644 --- a/war/src/main/webapp/WEB-INF/web.xml +++ b/war/src/main/webapp/WEB-INF/web.xml @@ -24,7 +24,7 @@ - @@@artifactId@@@ + training-exercises-extension