-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0202aa5
commit 70d0aae
Showing
3 changed files
with
104 additions
and
20 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
src/main/java/ch/zhaw/gpi/twitterreview/delegates/NotifyEmployeeDelegate.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,54 @@ | ||
package ch.zhaw.gpi.twitterreview.delegates; | ||
|
||
import javax.inject.Named; | ||
import org.camunda.bpm.engine.delegate.DelegateExecution; | ||
import org.camunda.bpm.engine.delegate.JavaDelegate; | ||
|
||
/** | ||
* Implementation des Send Task "Mitarbeiter benachrichtigen" | ||
* | ||
* @author scep | ||
*/ | ||
@Named("notifyEmployeeAdapter") | ||
public class NotifyEmployeeDelegate implements JavaDelegate { | ||
|
||
/** | ||
* Mockt das Senden einer Benachrichtigung per Mail | ||
* | ||
* 1. Die benötigten Prozessvariablen auslesen | ||
* 2. Die E-Mail-Nachricht zusammenstellen | ||
* 3. Die E-Mail in der Konsole ausgeben | ||
* | ||
* @param de | ||
* @throws Exception | ||
*/ | ||
@Override | ||
public void execute(DelegateExecution de) throws Exception { | ||
// Prozessvariablen auslesen | ||
String email = (String) de.getVariable("email"); | ||
String tweetContent = (String) de.getVariable("tweetContent"); | ||
String checkResult = (String) de.getVariable("checkResult"); | ||
String checkResultComment = (String) de.getVariable("checkResultComment"); | ||
|
||
// Die E-Mail-Nachricht zusammenbauen | ||
String mailHauptteil; | ||
if(checkResult.equals("rejected")){ | ||
mailHauptteil = "Leider wurde diese Tweet-Anfrage abgelehnt mit " + | ||
"folgender Begründung:\n" + checkResultComment; | ||
} else { | ||
mailHauptteil = "Dein Tweet wurde geposted. Herzlichen Dank für Deinen Beitrag."; | ||
} | ||
|
||
// Mail-Text zusammenbauen | ||
String mailBody = "Hallo Mitarbeiter\n\n" + "Du hast folgenden Text zum " + | ||
"Veröffentlichen als Tweet vorgeschlagen:\n" + tweetContent + "\n\n" + | ||
mailHauptteil + "\n\n" + "Deine Kommunikationsabteilung"; | ||
|
||
// Mail in Konsole ausgeben | ||
System.out.println("########### BEGIN MAIL ##########################"); | ||
System.out.println("############################### Mail-Empfänger: " + email); | ||
System.out.println(mailBody); | ||
System.out.println("########### END MAIL ############################"); | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/ch/zhaw/gpi/twitterreview/delegates/SendTweetDelegate.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,30 @@ | ||
package ch.zhaw.gpi.twitterreview.delegates; | ||
|
||
import javax.inject.Named; | ||
import org.camunda.bpm.engine.delegate.DelegateExecution; | ||
import org.camunda.bpm.engine.delegate.JavaDelegate; | ||
|
||
/** | ||
* Implementation des Service Task "Tweet senden" | ||
* | ||
* @author scep | ||
*/ | ||
@Named("sendTweetAdapter") | ||
public class SendTweetDelegate implements JavaDelegate { | ||
|
||
/** | ||
* Mockt das Senden eines Tweeets | ||
* | ||
* 1. Die Prozessvariable tweetContent wird ausgelesen | ||
* 2. Dieser Text wird in der Console ausgegeben | ||
* | ||
* @param de Objekt, welches die Verknüpfung zur Process Engine und zur aktuellen Execution enthält | ||
* @throws Exception | ||
*/ | ||
@Override | ||
public void execute(DelegateExecution de) throws Exception { | ||
String tweetContent = (String) de.getVariable("tweetContent"); | ||
System.out.println("!!!!!!!!!!!!!!!! Folgender Tweet wird veröffentlicht: " + tweetContent); | ||
} | ||
|
||
} |
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