-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switched to bus and added db populate (#64)
- Loading branch information
Showing
6 changed files
with
209 additions
and
43 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
src/main/java/com/redhat/labs/omp/model/event/BackendEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.redhat.labs.omp.model.event; | ||
|
||
import java.util.List; | ||
|
||
import com.redhat.labs.omp.model.Engagement; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
public class BackendEvent { | ||
|
||
private EventType eventType; | ||
private List<Engagement> engagementList; | ||
@Builder.Default | ||
private boolean forceUpdate = false; | ||
|
||
public static BackendEvent createDatabaseRefreshRequestedEvent(boolean forceUpdate) { | ||
return BackendEvent.builder().eventType(EventType.DB_REFRESH_REQUESTED).forceUpdate(forceUpdate).build(); | ||
} | ||
|
||
public static BackendEvent createDatabaseRefreshEvent(List<Engagement> engagmentList, boolean forceUpdate) { | ||
return BackendEvent.builder().eventType(EventType.DB_REFRESH).engagementList(engagmentList) | ||
.forceUpdate(forceUpdate).build(); | ||
} | ||
|
||
public static BackendEvent createPushToGitRequestedEvent() { | ||
return BackendEvent.builder().eventType(EventType.PUSH_TO_GIT_REQUESTED).build(); | ||
} | ||
|
||
public static BackendEvent createUpdateEngagementsInDbRequestedEvent(List<Engagement> engagementList) { | ||
return BackendEvent.builder().eventType(EventType.UPDATE_ENGAGEMENTS_IN_DB_REQUESTED) | ||
.engagementList(engagementList).build(); | ||
} | ||
|
||
public static BackendEvent createUpdateEngagementsInGitRequestedEvent(List<Engagement> engagementList) { | ||
return BackendEvent.builder().eventType(EventType.UPDATE_ENGAGEMENTS_IN_GIT_REQUESTED) | ||
.engagementList(engagementList).build(); | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/redhat/labs/omp/model/event/EventType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.redhat.labs.omp.model.event; | ||
|
||
public enum EventType { | ||
|
||
DB_REFRESH_REQUESTED(Constants.DB_REFRESH_REQUESTED_ADDRESS), | ||
DB_REFRESH(Constants.DB_REFRESH_ADDRESS), | ||
PUSH_TO_GIT_REQUESTED(Constants.PUSH_TO_GIT_REQUESTED_ADDRESS), | ||
UPDATE_ENGAGEMENTS_IN_DB_REQUESTED(Constants.UPDATE_ENGAGEMENTS_IN_DB_REQUESTED_ADDRESS), | ||
UPDATE_ENGAGEMENTS_IN_GIT_REQUESTED(Constants.UPDATE_ENGAGEMENTS_IN_GIT_REQUESTED_ADDRESS); | ||
|
||
private String eventBusAddress; | ||
|
||
EventType(String eventBusAddress) { | ||
this.eventBusAddress = eventBusAddress; | ||
} | ||
|
||
public String getEventBusAddress() { | ||
return this.eventBusAddress; | ||
} | ||
|
||
public class Constants { | ||
|
||
public static final String DB_REFRESH_REQUESTED_ADDRESS = "db.refresh.requested.event"; | ||
public static final String DB_REFRESH_ADDRESS = "db.refresh.event"; | ||
public static final String PUSH_TO_GIT_REQUESTED_ADDRESS = "push.to.git.requested.event"; | ||
public static final String UPDATE_ENGAGEMENTS_IN_DB_REQUESTED_ADDRESS = "update.engagements.in.db.requested.event"; | ||
public static final String UPDATE_ENGAGEMENTS_IN_GIT_REQUESTED_ADDRESS = "update.engagements.in.git.requested.event"; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.