WaveMaker Docs

WaveMaker Docs

  • Get started
  • Widgets
  • How-to
  • Releases
  • Login
  • Start free trial

›Java services

How-to-documents

  • How-to Wiki

App solution

  • Creating a Registration Page
  • Support for Password Encryption
  • Error Handling in WaveMaker App
  • Leaving Page with Unsaved Changes

UI design

  • How-tos for App Development
  • How-tos for Widgets
  • Passing Parameters to Pages
  • Passing Parameters to Partial Page
  • Use Static Variable to pass data between pages
  • Incorporating Additional Icons
  • Change Icon Color on Condition
  • Changing Default Favicon
  • Changing App Logo
  • Changing Page Title
  • Customise App Style
  • Customize an Existing Theme
  • Customizing Theme

Localization

  • Localization in WaveMaker Apps
  • Setting Language and Date Format
  • Localization Using Select Locale
  • Localization of Error Messages

Security

  • SAML Integration - OneLogin
  • SAML Integration - ADFS
  • Custom Security using Google OAuth Prefab
  • Multiple Security Provider Implementation
  • Customizing Post Authentication Handlers

Databases

  • Queries with Dynamic Where Clause
  • Connect To Azure SQL Server
  • Download JDBC Driver jar
  • How to fetch more than the default number(100) of records from database?

Web services

  • Using App Environment Properties
  • Using POST method to send data to a REST API
  • How to Intercept Request and Response of all API Calls in One Place

Java services

  • Sending eMail using Java Service
  • Implementing Forgot Password feature using Java Service
  • Accessing REST APIs from Java Service
  • Scheduling a Java Service
  • Pre-Post Processing for Database Service APIs

Variables

  • Using Filter Conditions on Variable
  • Using Live Variable APIs
  • Using Notification Actions
  • Using Navigation Action
  • Using Variables for Queries and Procedure
  • Using Service Variable in a Form
  • Using Filter Criteria for a Data and Live Widgets
  • Using Filter Criteria for a Database CRUD Variable

JavaScript

  • Using JavaScript in Binding
  • Using JavaScript from External URL
  • Using JavaScript to loop a command

Developer-side

  • Synchronizing WaveMaker Apps with IDEs Beta
  • Integrating Amazon Cognito for User Authentication
  • Integrating Sample Jasper Report in WaveMaker Application
  • How to generate PDF File using Jasper Reports
  • Upgrading an App from WaveMaker 9.x to WaveMaker 10.0
  • App Migration from WaveMaker 9x to 10x

Mobile gesture

  • Setting Swipe Gestures on a List Widget
  • Working with Pull to Refresh

Mobile widgets

  • Using Search Widget within the Navbar

Mobile UI design

  • Setting Splashscreen Images and App Icons
  • Using Cordova Plugins

Cards

  • Capturing Card Items

DataTable

  • Customising Data Table Row Action
  • Using Widgets to represent Data Table Columns
  • View Master-Detail Data Records using Data Table
  • Add Master-Detail records using Data Table
  • Export Data from Data Table
  • Dynamic Data Tables
  • Data Table Column bound to Query
  • Custom Styling Data Table Columns & Rows

List

  • Creating an Employee List grouped by City
  • Creating an Employee List grouped by Birth Month and City
  • OnRender Event
  • Including a Data Table within a List
  • Building an Editable List
  • Building Cascading Lists
  • Accessing List Items
  • Localization of Data Table Column Headings

Forms

  • Using Live Form
  • Using Wizard for Cumulative Data Entry in a Form
  • Building Tabbed Live Form
  • How Tos: Live Form
  • Linking Live Form with another Widget for Input
  • Handling Related Fields in a Live Form
  • Adding Master-Detail records in the same transaction
  • Using Cascading Select & Autocomplete for Live Form Fields
  • Using Cascading Select within Live Form
  • Using cascading Filter to populate Live Form
  • Using Wizard for Master-Detail Live Form
  • Using Wizard for Progressive Data Entry in a Live Form
  • Using Wizard for Cumulative Data Entry in a Live Form

Calendar

  • Calendar Usage - Create an Event
  • Calender Usage - Google Calendar Integration

CheckboxSet

  • CheckboxSet to Filter List data

FileUpload

  • File Upload Widget Operations
  • Upload File & Save in Database
  • File Upload & Blob Data
  • File Upload - Custom Directory
  • Accessing File Upload from Java Code
  • Upload Files from Live Form & Form

Radioset

  • Radioset to Filter a List

Rating

  • Building Rating Widget using Static Data
  • Building Rating Widget using Static Variable
  • Build Rating Widget using Model Variable
  • Building an Interactive Rating Widget

Select

  • Configuring Select Widget from a Static List of Values
  • Configuring Select Widget from a Variable
  • Configuring Select Widget using Display and Data Fields
  • Configuring Select Widget from Database Fields
  • Configuring Cascading Select

Charts

  • Charts - Displaying User Selection in another Widget
  • Charts - Handling Dynamic Data
  • Charts - Custom Data

Live filter

  • Applying Live Filter to a Data Table or a Chart
  • Building a Multiple Selection Live Filter
  • Building a Range Live Filter

Container

  • Setting partial page content for Accordion within a List
  • Setting partial page content for Panel within a List using JavaScript

Tree

  • Tree Use Case - from Static Variable
  • Tree Use Case - from Java Service
  • Tree Use Case - Dynamic Tree

Nav

  • Nav - Basic Usage

Dropdown

  • Restricting menu item display based on user role
  • Implementing Localization for Dropdown Menu

Prefabs

  • Create Prefab using Third Party UI Widgets
  • Create Prefab Using D3 & NVD3 Charts
  • Create Prefab Using D3 Library (DataMaps)
  • Create Prefab using JQuery Plugin
Edit

Scheduling a Java Service


Learn how to schedule a Java Service to trigger at certain intervals.

The steps include:

  • How to schedule a Java service and trigger it.
  • The scheduler will be a Spring scheduler which will schedule the java service and trigger it at certain intervals.

Java Service Method

We will be using the following Java Service Method:

package com.testschedulterandemail.simplejavaservice;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

//import com.testschedulerandemail.simplejavaservice.model.\*;
import com.wavemaker.runtime.service.annotations.ExposeToClient;

/\*\*
 \* This is a singleton class with all of its public methods exposed to the client via controller.
 \* Their return values and parameters will be passed to the client or taken
 \* from the client respectively.
 \*/
@ExposeToClient
public class SimpleJavaService {
    private static final Logger logger=LoggerFactory.getLogger(SimpleJavaService.class);
    public String sampleJavaOperation() {
        String result = null;
        try {
            logger.warn("Starting sample operation");
            result = "HELLO SERVICE!";
            logger.warn("Returning {}", result);
            return result;
        } catch (Exception e) {
            logger.error("Sample java service operation has failed", e);
            throw e;
        }}}

We will be using the following XML code in the javaservice_name.spring.xml file:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<beans xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-4.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd"
       xmlns="http://www.springframework.org/schema/beans" 
       xmlns:task="http://www.springframework.org/schema/task" 
       xmlns:security="http://www.springframework.org/schema/security" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <bean class="com.testschedulerandemail.simplejavaservice.SimpleJavaService" scope="singleton" lazy-init="true" id="SimpleJavaService"/>
    <bean class="com.testschedulerandemail.simplejavaservice.controller.SimpleJavaController" id="SimpleJavaServiceController"/>
    <task:scheduled-tasks >
        <task:scheduled cron="\*/10 \* \* \* \* ?" method="sampleJavaOperation" ref="SimpleJavaService"/>
    </task:scheduled-tasks>
</beans>

In the above XML code replace the bean class with the appropriate package name of the Java service and controller files. You can locate these names from the left Files panel under Services option.

The task details include:

  • cron referring to the time interval string we used corresponds to: */10 * * * * ?.

The time interval specified is in the UNIX cron format (refer here).

  • method refers to the Java method to be invoked at the above-mentioned time intervals
  • id refers to the id given to the bean class for the Java controller

The following annotation needs to be added in project-user-spring.xml file:

    <task:annotation-driven scheduler="taskScheduler" />
    <task:scheduler id="taskScheduler" pool-size="5" />

See Also

How to send emails using Java Service
How to implement forgot password feature using Java Service
How to access REST APIs from Java Service
How to accomplish Pre-Post Processing for a DB Service APIs

Last updated on 11/21/2019 by prasanth-reddy-wavemaker-com
← Accessing REST APIs from Java ServiceNext →
  • Java Service Method
  • See Also
WaveMaker
  • PRICING
  • PARTNERS
  • CUSTOMERS
  • ABOUT US
  • CONTACT US
Terms of Use | Copyright © 2013-2019 WaveMaker, Inc. All rights reserved.