Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajjangid05 committed May 8, 2023
2 parents 81b4c27 + 4b59411 commit 11d6957
Show file tree
Hide file tree
Showing 18 changed files with 321 additions and 16 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Build & Deploy on Tag & Push
name: Github Package
on:
push:
tags:
- 'v*.*.*'
branches:
["release-4.*.*", "release-5.*.*", "release-v2.*.*"]
pull_request:
branches:
["release-4.*.*", "release-5.*.*", "release-v2.*.*"]

jobs:
build-deploy-github:
name: Build & Deploy to GitHub
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'temurin'
server-id: github
server-username: GITHUB_USERNAME
server-password: GITHUB_TOKEN

- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-

- name: Delete package specific version
uses: smartsquaregmbh/[email protected]
with:
version: 2.1.0 # This should be same as in the pom.xml file,
# to delete only the pom specified version, not the other older versions
names: |
com.uci.message-rosa
token: ${{ secrets.TOKEN }}

- name: Deploy
run: mvn clean install -Pgithub deploy
env:
GITHUB_USERNAME: ${{ secrets.USERNAME }}
GITHUB_TOKEN: ${{ secrets.TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Build on Push & Pull Request
name: Maven Build
on:
push:
branches:
["release-4.*.*", "release-5.*.*", "release-v2.*.*"]
pull_request:
branches:
["release-4.*.*", "release-5.*.*", "release-v2.*.*"]

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'temurin'

- name: Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Build and analyze
run: mvn clean install
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
![Maven Build](https://github.com/samagra-comms/message-rosa/actions/workflows/build.yml/badge.svg)
![Github Package](https://github.com/samagra-comms/message-rosa/actions/workflows/build-deploy.yml/badge.svg)

# Overview
Message Rosa holds all the core models for XMessage & its property fields.

# Getting Started

## Prerequisites

* java 11 or above
* docker
* kafka
* lombok plugin for IDE
* maven

## Build
* build with tests run using command **mvn clean install -U**
* or build without tests run using command **mvn clean install -DskipTests**

# Detailed Documentation
[Click here](https://uci.sunbird.org/use/developer/uci-basics)
21 changes: 16 additions & 5 deletions dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>spring-boot-starter-parent</artifactId>
<groupId>org.springframework.boot</groupId>
<version>2.3.0.RELEASE</version>
<version>2.5.7</version>
<relativePath>pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand All @@ -16,7 +16,7 @@
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
Expand All @@ -29,6 +29,12 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<version>2.5.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand Down Expand Up @@ -62,7 +68,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<version>4.13.2</version>
<scope>test</scope>
<exclusions>
<exclusion>
Expand Down Expand Up @@ -100,7 +106,7 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.12</version>
<version>4.5.13</version>
<scope>provided</scope>
<exclusions>
<exclusion>
Expand All @@ -109,9 +115,14 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>RELEASE</version>
<scope>provided</scope>
</dependency>
</dependencies>
<properties>
<java.version>11</java.version>
</properties>
</project>

2 changes: 0 additions & 2 deletions message-rosa.iml

This file was deleted.

37 changes: 32 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,41 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.0.RELEASE</version>
<version>2.5.7</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.uci</groupId>
<artifactId>message-rosa</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>2.1.0</version>
<!-- On changing, Set version in deploy.xml to delete the previous packages if exists and deploy new package for the specified version -->
<name>message-rosa</name>
<description>message-rosa for messages</description>
<properties>
<java.version>11</java.version>
</properties>

<profiles>
<profile>
<id>github</id>
<activation>
<property>
<name>useGitHubPackages</name>
<value>true</value>
</property>
</activation>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/samagra-comms/message-rosa</url>
</repository>
</distributionManagement>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand Down Expand Up @@ -51,7 +73,6 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.6.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -63,14 +84,20 @@
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>RELEASE</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<version>3.2.4</version>
<executions>
<!-- Run shade goal on package phase -->
<execution>
Expand Down
1 change: 1 addition & 0 deletions src/main/java/messagerosa/core/model/ButtonChoice.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
public class ButtonChoice {
private String key;
private String text;
private Boolean backmenu;
}
14 changes: 14 additions & 0 deletions src/main/java/messagerosa/core/model/Data.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package messagerosa.core.model;


import lombok.*;

@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Data {
private String key;
private String value;
}
26 changes: 26 additions & 0 deletions src/main/java/messagerosa/core/model/DeviceType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package messagerosa.core.model;

public enum DeviceType {
PHONE("phone"),
FCM("fcm"),
PHONE_PWA("ucipwa"),
PHONE_FCM("phonefcm");


private String name;

DeviceType(String deviceType) {
name=deviceType;
}

public String toString(){
return name;
}

public static String getEnumByString(String code){
for(DeviceType e : DeviceType.values()){
if(e.name.equals(code)) return e.name();
}
return null;
}
}
3 changes: 3 additions & 0 deletions src/main/java/messagerosa/core/model/LocationParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@
public class LocationParams {
private double longitude;
private double latitude;
private String address;
private String url;
private String name;
}
26 changes: 26 additions & 0 deletions src/main/java/messagerosa/core/model/MediaCategory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package messagerosa.core.model;

public enum MediaCategory {
IMAGE("image"),
AUDIO("audio"),
VIDEO("video"),
VOICE("voice"),
FILE("file");

private String name;

MediaCategory(String mediaCategory) {
name=mediaCategory;
}

public String toString(){
return name;
}

public static String getEnumByString(String code){
for(MediaCategory e : MediaCategory.values()){
if(e.name.equals(code)) return e.name();
}
return null;
}
}
4 changes: 3 additions & 1 deletion src/main/java/messagerosa/core/model/MessageMedia.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
@NoArgsConstructor
@AllArgsConstructor
public class MessageMedia {
private String category; //category list {image, audio, document, video}
private MediaCategory category; //category list {image, audio, document, video}
private String text; //caption, if applicable
private String url;
private MessageMediaError messageMediaError;
private Double size;
}
23 changes: 23 additions & 0 deletions src/main/java/messagerosa/core/model/MessageMediaError.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package messagerosa.core.model;

public enum MessageMediaError {
PAYLOAD_TO_LARGE("payloadTooLarge"),
EMPTY_RESPONSE("emptyResponse");
private String name;

MessageMediaError(String name) {
this.name = name;
}

@Override
public String toString() {return name;}

public static MessageMediaError getErrorByText(String text){
for (MessageMediaError e : MessageMediaError.values()){
if(e.name.equals(text))
return e;
}
return null;
}
}

7 changes: 4 additions & 3 deletions src/main/java/messagerosa/core/model/SenderReceiverInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
public class SenderReceiverInfo {

// persist
private String userID;

private String userID; //PhoneNo
private ArrayList<String> groups;

private String campaignID;
private String formID;
private boolean bot;
private boolean broadcast;
private Map<String, String> meta;
private DeviceType deviceType;
private String deviceID; //UUID
private String encryptedDeviceID; //Encrypted Device String
}
Loading

0 comments on commit 11d6957

Please sign in to comment.