Skip to content

Commit

Permalink
issue #18
Browse files Browse the repository at this point in the history
  • Loading branch information
rsoika committed Sep 20, 2015
1 parent 87fc478 commit 949b9c1
Showing 1 changed file with 34 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
import org.imixs.workflow.exceptions.ProcessingErrorException;
import org.imixs.workflow.jee.ejb.EntityService;
import org.imixs.workflow.jee.ejb.WorkflowService;
import org.imixs.workflow.xml.XMLItemCollection;
import org.imixs.workflow.xml.XMLItemCollectionAdapter;

/**
* Magento - Scheduler
Expand Down Expand Up @@ -350,8 +352,10 @@ public ItemCollection stop(ItemCollection config) throws Exception {
private Timer findTimer(String id) {
for (Object obj : timerService.getTimers()) {
Timer timer = (javax.ejb.Timer) obj;
if (timer.getInfo() instanceof ItemCollection) {
ItemCollection adescription = (ItemCollection) timer.getInfo();

if (timer.getInfo() instanceof XMLItemCollection) {
XMLItemCollection xmlItemCollection = (XMLItemCollection) timer.getInfo();
ItemCollection adescription = XMLItemCollectionAdapter.getItemCollection(xmlItemCollection);
if (id.equals(adescription.getItemValueString("$uniqueid"))) {
return timer;
}
Expand Down Expand Up @@ -436,7 +440,9 @@ public void processImport(javax.ejb.Timer timer) {
magentoCache.clearCache();

// load configuration...
ItemCollection configuration = (ItemCollection) timer.getInfo();

XMLItemCollection xmlItemCollection = (XMLItemCollection) timer.getInfo();
ItemCollection configuration = XMLItemCollectionAdapter.getItemCollection(xmlItemCollection);
sTimerID = configuration.getItemValueString(EntityService.UNIQUEID);
configuration = workflowService.getEntityService().load(sTimerID);
try {
Expand Down Expand Up @@ -758,8 +764,19 @@ Timer createTimerOnInterval(ItemCollection configItemCollection) {

endDate = startDate;
}

XMLItemCollection xmlConfigItem = null;
try {
xmlConfigItem = XMLItemCollectionAdapter
.putItemCollection(configItemCollection);
} catch (Exception e) {
logger.severe("Unable to serialize confitItemCollection into a XML object");
e.printStackTrace();
return null;
}

Timer timer = timerService.createTimer(startDate, interval,
configItemCollection);
xmlConfigItem);

return timer;

Expand Down Expand Up @@ -787,7 +804,18 @@ Timer createTimerOnCalendar(ItemCollection configItemCollection)
throws ParseException {

TimerConfig timerConfig = new TimerConfig();
timerConfig.setInfo(configItemCollection);

XMLItemCollection xmlConfigItem = null;
try {
xmlConfigItem = XMLItemCollectionAdapter
.putItemCollection(configItemCollection);
} catch (Exception e) {
logger.severe("Unable to serialize confitItemCollection into a XML object");
e.printStackTrace();
return null;
}

timerConfig.setInfo(xmlConfigItem);
ScheduleExpression scheduerExpression = new ScheduleExpression();

@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -847,6 +875,7 @@ Timer createTimerOnCalendar(ItemCollection configItemCollection)

}


Timer timer = timerService.createCalendarTimer(scheduerExpression,
timerConfig);

Expand Down

0 comments on commit 949b9c1

Please sign in to comment.