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
def getthegist = [this: 'is', the: 'gist'] | |
getthegist.each {k,v-> println "$k = $v" } |
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
/** | |
* Script to run from a rule, associates the device running the rule to the provided model/serialnumber | |
*/ | |
import com.axeda.drm.sdk.Context | |
import com.axeda.drm.sdk.device.* | |
import com.axeda.drm.sdk.m2m.* | |
try { | |
Context ctx = Context.create() | |
// get the parameters |
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
<!-- Add parameter "assetgroupname" --> | |
import com.axeda.drm.sdk.device.DeviceGroupFinder | |
import com.axeda.drm.sdk.device.DeviceGroup | |
import com.axeda.drm.sdk.Context | |
try { | |
def assetgroupname = parameters.assetgroupname | |
DeviceGroupFinder dgf = new DeviceGroupFinder(Context.create()) |
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
import com.axeda.drm.sdk.Context | |
import com.axeda.drm.sdk.data.HistoricalAlarmFinder | |
import java.util.Calendar | |
import com.axeda.common.sdk.jdbc.DateQuery | |
// get Date object for an hour ago | |
Calendar cal = Calendar.getInstance() | |
cal.add(Calendar.HOUR, -parameters.hours.toInteger()) | |
Date sinceTime = cal.getTime() |
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
// explicit parameters: | |
// numHours check alarms since this many hours ago | |
// implicit parameters: | |
// alarm alarm object passed by the platform | |
import com.axeda.drm.sdk.Context | |
import com.axeda.drm.sdk.data.HistoricalAlarmFinder | |
import java.util.Calendar | |
import com.axeda.common.sdk.jdbc.DateQuery |
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
import com.axeda.drm.sdk.data.*; | |
import com.axeda.drm.sdk.Context; | |
import java.util.*; | |
try{ | |
AlarmFinder alarmFinder = new AlarmFinder(Context.create()); | |
alarmFinder.setDevice(context.device); | |
List alarms = alarmFinder.findAll(); | |
for (Alarm alarm : alarms) | |
{ |
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
import com.axeda.drm.sdk.user.User | |
import com.axeda.drm.sdk.data.DataValue | |
import groovy.lang.PropertyValue | |
import com.axeda.drm.sdk.device.DevicePropertyFinder | |
import com.axeda.drm.sdk.device.Property | |
import com.axeda.drm.sdk.device.PropertyType | |
import com.axeda.drm.sdk.device.DeviceProperty | |
logger.info "Executing groovy script for device: " + context?.device?.serialNumber |
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
import org.apache.commons.httpclient.methods.* | |
import org.apache.commons.httpclient.* | |
import java.text.SimpleDateFormat | |
def location = parameters.location.toString() | |
def locparts = location.split(',') | |
def lat = locparts[0] | |
def lon = locparts[1] |
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
import com.axeda.drm.sdk.scm.CompressedFile | |
if (compressedFile != null) | |
{ | |
File file = compressedFile.getFiles()[0].extractFile() | |
def result = file.eachLine { line -> | |
return line | |
} | |
} |
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
import groovyx.net.http.RESTClient | |
String rmdHostname = "http://ws.geonames.org"; | |
if (mobileLocation != null) | |
{ | |
rmd = new RESTClient(rmdHostname); | |
try { | |
def resp = rmd.get( path: 'findNearestAddress', |
OlderNewer