public ISchedule persist(ScheduleCreateRequest.Builder builder) throws SiteWhereException { return getScheduleManagement().createSchedule(builder.build()); }
@Override public void initialize(IScheduleManagement scheduleManagement) throws SiteWhereException { // Skip if not enabled. if (!isEnabled()) { return; } Binding binding = new Binding(); binding.setVariable("logger", LOGGER); binding.setVariable("scheduleBuilder", new ScheduleManagementRequestBuilder(scheduleManagement)); try { // Use system account for logging "created by" on created elements. SecurityContextHolder.getContext().setAuthentication(SiteWhereServer.getSystemAuthentication()); getGroovyConfiguration().getGroovyScriptEngine().run(getScriptPath(), binding); } catch (ResourceException e) { throw new SiteWhereException("Unable to access Groovy script. " + e.getMessage(), e); } catch (ScriptException e) { throw new SiteWhereException("Unable to run Groovy script.", e); } finally { SecurityContextHolder.getContext().setAuthentication(null); } }
@Override public void initialize(IScheduleManagement scheduleManagement) throws SiteWhereException { // Skip if not enabled. if (!isEnabled()) { return; } Binding binding = new Binding(); binding.setVariable("logger", LOGGER); binding.setVariable("scheduleBuilder", new ScheduleManagementRequestBuilder(scheduleManagement)); try { getGroovyConfiguration().run(getScriptPath(), binding); } catch (SiteWhereException e) { throw new SiteWhereException("Unable to run schedule model initializer.", e); } }
public ISchedule persist(ScheduleCreateRequest.Builder builder) throws SiteWhereException { return getScheduleManagement().createSchedule(builder.build()); }