| Author | SHA1 | Message | Date |
|---|---|---|---|
|
|
b9e4b7b4e4 | Place config display of daily_start within channel section. Always display broadcast section | 1 year ago |
|
|
b94206d547 | Clock resumes PAUSED state whose reason starts with restartable names, instead of equal. | 1 year ago |
|
|
5dc6202b1c | Added Broadcast.getChannelName method | 1 year ago |
|
|
1b0dc1c6bd | Change visibility of class attribute | 1 year ago |
|
|
917298913e | Change 'daily_stop' to 'broadcast_daily_stop' | 1 year ago |
|
|
18204d017f | channel properties in <channel> tag in request xml | 1 year ago |
| @@ -48,6 +48,7 @@ public abstract class Broadcast | |||||
| private static final long SLEEP_BETWEEN_JOBS_DEFAULT = 0; | private static final long SLEEP_BETWEEN_JOBS_DEFAULT = 0; | ||||
| static final String DAILY_STOP_KEY = "daily_stop"; | static final String DAILY_STOP_KEY = "daily_stop"; | ||||
| static final String DAILY_START_KEY = "daily_start"; | static final String DAILY_START_KEY = "daily_start"; | ||||
| static final String CHANNEL_KEY = "channel"; | |||||
| static final String CSV_LOGGER = "csv"; | static final String CSV_LOGGER = "csv"; | ||||
| @@ -77,6 +78,7 @@ public abstract class Broadcast | |||||
| private Postback postback; | private Postback postback; | ||||
| protected String daily_start = ""; | protected String daily_start = ""; | ||||
| protected String daily_stop = ""; | protected String daily_stop = ""; | ||||
| public JSONObject channel_json; | |||||
| /** | /** | ||||
| * Sleep time in milliseconds between consecutive job processing (actualliy batch) | * Sleep time in milliseconds between consecutive job processing (actualliy batch) | ||||
| @@ -1022,7 +1024,7 @@ public abstract class Broadcast | |||||
| if (reason == ACTION_BY_CLOCK) { | if (reason == ACTION_BY_CLOCK) { | ||||
| boolean inAcceptqble = false; | boolean inAcceptqble = false; | ||||
| for (String acceptable : getPauseModesResumableByClock()) { | for (String acceptable : getPauseModesResumableByClock()) { | ||||
| if (this.reason.equalsIgnoreCase(acceptable)) inAcceptqble = true; | |||||
| if (this.reason.startsWith(acceptable)) inAcceptqble = true; | |||||
| } | } | ||||
| if (!inAcceptqble) return null; | if (!inAcceptqble) return null; | ||||
| } | } | ||||
| @@ -1467,8 +1469,6 @@ public abstract class Broadcast | |||||
| @SuppressWarnings("unchecked") | @SuppressWarnings("unchecked") | ||||
| public JSONObject getConfigJSON() { | public JSONObject getConfigJSON() { | ||||
| JSONObject dataMap = new JSONObject(); | JSONObject dataMap = new JSONObject(); | ||||
| dataMap.put(DAILY_START_KEY, daily_start); | |||||
| dataMap.put(DAILY_STOP_KEY, daily_stop); | |||||
| childAddConfigJSON(dataMap); | childAddConfigJSON(dataMap); | ||||
| return dataMap; | return dataMap; | ||||
| } | } | ||||
| @@ -1500,5 +1500,9 @@ public abstract class Broadcast | |||||
| job.setErrorText(errorText); | job.setErrorText(errorText); | ||||
| return true; | return true; | ||||
| } | } | ||||
| public String getChannelName() { | |||||
| return (String)channel_json.get("name"); | |||||
| } | |||||
| } | } | ||||
| @@ -469,7 +469,7 @@ public abstract class CommEngine extends HttpServlet | |||||
| broadcastsConfig.put(broadcastId, broadcast.getConfigJSON()); | broadcastsConfig.put(broadcastId, broadcast.getConfigJSON()); | ||||
| } | } | ||||
| } | } | ||||
| if (broadcastsConfig.size() > 0) config.put("broadcasts", broadcastsConfig); | |||||
| config.put("broadcasts", broadcastsConfig); | |||||
| childAddConfig(config); | childAddConfig(config); | ||||
| @@ -11,6 +11,8 @@ import javax.xml.parsers.ParserConfigurationException; | |||||
| import javax.xml.parsers.SAXParser; | import javax.xml.parsers.SAXParser; | ||||
| import javax.xml.parsers.SAXParserFactory; | import javax.xml.parsers.SAXParserFactory; | ||||
| import org.json.simple.JSONObject; | |||||
| import org.json.simple.parser.JSONParser; | |||||
| import org.xml.sax.Attributes; | import org.xml.sax.Attributes; | ||||
| import org.xml.sax.InputSource; | import org.xml.sax.InputSource; | ||||
| import org.xml.sax.SAXException; | import org.xml.sax.SAXException; | ||||
| @@ -104,13 +106,17 @@ public abstract class XMLSAXBroadcast extends Broadcast | |||||
| { | { | ||||
| postbackURL = getTrimmedText(); | postbackURL = getTrimmedText(); | ||||
| } | } | ||||
| else if (qName.equals(DAILY_STOP_KEY)) | |||||
| else if (qName.equals(CHANNEL_KEY)) | |||||
| { | { | ||||
| daily_stop = getTrimmedText(); | |||||
| } | |||||
| else if (qName.equals(DAILY_START_KEY)) | |||||
| { | |||||
| daily_start = getTrimmedText(); | |||||
| String channel_str = getTrimmedText(); | |||||
| try { | |||||
| JSONParser jsonParser = new JSONParser(); | |||||
| channel_json = (JSONObject) jsonParser.parse(channel_str); | |||||
| } catch (org.json.simple.parser.ParseException e) { | |||||
| throw new RuntimeException(String.format("<%s> is not json string: %s", CHANNEL_KEY, channel_str)); | |||||
| } | |||||
| daily_stop = (String)channel_json.get("broadcast_daily_stop"); | |||||
| daily_start = (String)channel_json.get("broadcast_daily_start"); | |||||
| } | } | ||||
| else if (inRecipientProp) | else if (inRecipientProp) | ||||
| { | { | ||||