forked from sakaiproject/sakai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SAK-45601: Modify "ifs" processing for XAPI events and pool usage ins…
…tead of threads (sakaiproject#9353) * SAK-45601: Modify "ifs" processing for XAPI events and pool usage instead of threads * SAK-45601: Included Test JUnit
- Loading branch information
1 parent
0d606e9
commit 6b643f7
Showing
15 changed files
with
483 additions
and
129 deletions.
There are no files selected for viewing
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
34 changes: 34 additions & 0 deletions
34
kernel/api/src/main/java/org/sakaiproject/event/api/TincanapiEvent.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,34 @@ | ||
package org.sakaiproject.event.api; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Entity; | ||
import javax.persistence.Id; | ||
import javax.persistence.NamedQuery; | ||
import javax.persistence.Table; | ||
|
||
import lombok.Data; | ||
|
||
@Entity | ||
@Table( name = "TINCANAPI_EVENT") | ||
@NamedQuery( name = "getAllTincanapiEvent", | ||
query = "from TincanapiEvent") | ||
|
||
@Data | ||
public class TincanapiEvent { | ||
|
||
@Id | ||
@Column(name = "EVENT") | ||
private String event; | ||
|
||
@Column(name = "VERB", length = 255, nullable = false) | ||
private String verb; | ||
|
||
@Column(name = "ORIGIN", length = 255, nullable = false) | ||
private String origin; | ||
|
||
@Column(name = "OBJECT", length = 255, nullable = false) | ||
private String object; | ||
|
||
@Column(name = "EVENT_SUPPLIER", length = 255) | ||
private String eventSupplier; | ||
} |
49 changes: 49 additions & 0 deletions
49
kernel/api/src/main/java/org/sakaiproject/event/api/XAPIFactory.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,49 @@ | ||
package org.sakaiproject.event.api; | ||
|
||
import java.util.Map; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.sakaiproject.event.api.LearningResourceStoreService.EventWrapper; | ||
import org.sakaiproject.event.api.LearningResourceStoreService.LRS_Object; | ||
import org.sakaiproject.event.api.LearningResourceStoreService.LRS_Verb; | ||
|
||
public class XAPIFactory{ | ||
public LRS_Verb getEventVerb(Event event, Map<String, EventWrapper> xAPIEvent) { | ||
LRS_Verb verb = null; | ||
if (event != null) { | ||
String e = StringUtils.lowerCase(event.getEvent()); | ||
if (xAPIEvent.containsKey(e)) { | ||
verb = new LRS_Verb(xAPIEvent.get(e).getVerb()); | ||
} | ||
} | ||
return verb; | ||
} | ||
|
||
public LRS_Object getEventObject(Event event, Map<String, EventWrapper> xAPIEvent, String url) { | ||
LRS_Object object = null; | ||
if (event != null) { | ||
String e = StringUtils.lowerCase(event.getEvent()); | ||
/* | ||
* NOTE: use the following terms "view", "add", "edit", "delete" | ||
*/ | ||
|
||
if (xAPIEvent.containsKey(e)) { | ||
object = new LRS_Object (/*serverConfigurationService.getPortalUrl()*/url + event.getResource(), xAPIEvent.get(e).getObject()); | ||
} | ||
} | ||
return object; | ||
} | ||
|
||
public String getEventOrigin(Event event, Map<String, EventWrapper> xAPIEvent) { | ||
String origin = null; | ||
if (event != null) { | ||
String e = StringUtils.lowerCase(event.getEvent()); | ||
|
||
if (xAPIEvent.containsKey(e)) { | ||
origin = xAPIEvent.get(e).getOrigin(); | ||
} else { | ||
origin = e; | ||
} | ||
} | ||
return origin; | ||
} | ||
} |
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.