Skip to main content
Version: 2.0.0

Component Features

API Reference

Task Synchronization APIs (CompositeApiParserController - /worknet/composite-api/parser)

MethodEndpointDescription
POST/runJobTrigger a scheduled task pull job manually. Body: SystemSchedularConfigDto. Requires Authorization header
POST/runJobApiTrigger a job from a generic map payload
GET/getDbYaml?systemId=&process=Returns the DB structure YAML mapping for a given system and process
GET/getJSONFileDebug: fetches and returns OData JSON from a configured URL
POST/updateDbYaml?fileName=Pushes YAML content to Azure DevOps repository
POST/flatten-json?referenceId=Flattens a nested JSON into a flat key-value map for debugging
POST/signUrlGenerates a DocuSign signing URL. Body: SignUrlPayloadDto. Returns signing/consent URL
POST/getcompositecalldataReturns raw composite API call data for a scheduler config
GET/triggerAribaManually triggers the Ariba API integration
GET/fetchSystemsConfigs?systemId=Fetches scheduler configurations for a given system
POST/onDemandJobAd-hoc job trigger for all configured systems for the logged-in user
POST/forceUpdateToDbForce-upserts provided data directly into DB tables. Body: ForceUpdateRequest with systemId and tables map

Task Action APIs (TaskActionController - /task)

MethodEndpointDescription
POST/actionsPrimary task action endpoint. Extracts userId from JWT. Body: ActionDto with list of tasks and actions
POST/userId/actionsSame as above but accepts userId as a header (for MS Teams integration)
POST/processCancelCancels an entire process. Body: ProcessActionDto
POST/get-email-idsResolves group IDs to email addresses via WorkAccess. Body: list of group IDs

Task Creation APIs (TaskCreationController - /task)

MethodEndpointDescription
POST/createCreates a task via the composite API-based task creation service
GET/dummyTest endpoint that fetches all configured systems
POST/createTaskCreates a task directly from a CreateTaskDo entity

Draft Process APIs (DraftProcessController - /v1/draft)

MethodEndpointDescription
POST/processCreates a new draft process
DELETE/process/{processId}Deletes a draft by process ID
GET/process/{processId}Gets a draft by process ID
GET/processByUser/{userId}Gets all drafts for a user
GET/processBySystem/{systemId}Gets all drafts by source system
GET/processName/{processName}Gets drafts by process name
GET/system/{systemId}/processName/{processName}Gets drafts by system + process name

Scheduler Configuration APIs (SystemSchedularMasterController - /system-schedule)

MethodEndpointDescription
POST/configSaves or updates system scheduler configurations. Body: list of SystemSchedularConfigDto
GET/lastRunOn?schedulerId=Returns last job run timestamps for a scheduler

CPI Response APIs (CPIResponseController - /v1/cpi)

MethodEndpointDescription
POST/cpiResponseReceives CPI composite response, creates job log, processes result asynchronously
GET/insertJobLog/{systemId}/{processId}Creates a job log entry and returns its ID

API Configuration APIs (APIResponseController - /api)

MethodEndpointDescription
GET/fetchApisReturns all configured external API endpoints

YAML Management APIs (YamlController - /v1/yaml)

MethodEndpointDescription
POST/uploadUploads a YAML configuration file. Multipart: file + fileName + description
GET/fetchAllLists all uploaded YAML files
DELETE/POST/delete/{id}Deletes a YAML file by ID
GET/download/{id}Downloads a YAML file as byte array

Platform APIs (PlatFormController - /v1/platform)

MethodEndpointDescription
GET/instance/credentialsReturns VCAP service credentials

WorkAccess Test APIs (WorkAccessTestController - /api/v1/test/work-access)

MethodEndpointDescription
GET/groups-by-user?email=Gets group IDs for a user email
POST/user-detailsGets user details for a list of user IDs
POST/user-details-mapGets user details as a map keyed by user ID
POST/users-by-groupsGets user IDs for a list of group IDs
POST/users-basic-infoGets basic info (name, email) for a list of emails
POST/users-from-groupsGets user emails from group IDs

SSE APIs (SSEController)

MethodEndpointDescription
GET/send/{userName}Publishes an SSE event for a specific user
GET/subscribeSSE subscription endpoint (produces text/event-stream)

Data Model

Core Tables

CW_ITM_WN_TASKS

ColumnTypeDescription
TASK_IDVARCHAR (PK)Unique task identifier from source system
SYSTEM_IDVARCHAR (PK)Source system identifier
PROCESS_IDVARCHARParent process identifier
TASK_TYPEVARCHARType/category of the task
TASK_DESCRIPTIONVARCHARHuman-readable task description
STATUSVARCHARSource system status (READY, RESERVED, COMPLETED, CANCELED)
ITM_STATUSVARCHARInternal ITM tracking status
PRIORITYVARCHARTask priority level
CREATED_ONTIMESTAMPTask creation timestamp
DUE_DATETIMESTAMPTask due date
COMPLETED_ONTIMESTAMPTask completion timestamp
COMPLETED_BYVARCHARUser who completed the task
UPDATED_BYVARCHARLast modifier
UPDATED_ONTIMESTAMPLast modification timestamp
CREATED_BYVARCHARTask creator

CW_ITM_WN_TASK_OWNERS

ColumnTypeDescription
TASK_IDVARCHAR (PK)Task identifier
SYSTEM_IDVARCHAR (PK)Source system identifier
OWNER_IDVARCHAR (PK)User ID or group ID
OWNER_TYPEVARCHAR"USER" or "GROUP"
IS_PRIMARYLONG1 = primary owner, 0 = secondary
CREATED_BYVARCHARCreator
CREATED_ONTIMESTAMPCreation timestamp
UPDATED_BYVARCHARLast modifier
UPDATED_ONTIMESTAMPLast modification timestamp

CW_ITM_WN_PROCESS

ColumnTypeDescription
PROCESS_IDVARCHAR (PK)Unique process identifier
SYSTEM_IDVARCHARSource system
PROCESS_NAMEVARCHARProcess type/name
PROCESS_STATUSVARCHARProcess status
PROCESS_DESCRIPTIONVARCHARHuman-readable description
CREATED_BYVARCHARProcess creator
CREATED_ONTIMESTAMPCreation timestamp

CW_ITM_WN_TASK_ATTRIBUTES

ColumnTypeDescription
TASK_IDVARCHAR (PK)Task identifier
SYSTEM_IDVARCHAR (PK)Source system
ATTR_KEYVARCHAR (PK)Attribute name
ATTR_VALUEVARCHAR/CLOBAttribute value
CREATED_BYVARCHARCreator
CREATED_ONTIMESTAMPCreation timestamp
UPDATED_BYVARCHARLast modifier
UPDATED_ONTIMESTAMPLast modification timestamp

CW_ITM_WN_TASK_AUDIT

ColumnTypeDescription
AUDIT_IDVARCHAR (PK)Unique audit entry ID
SYSTEM_IDVARCHARSource system
TASK_IDVARCHARTask identifier
ACTIONVARCHARAction taken (APPROVE, REJECT, CLAIM, etc.)
IS_SUCCESSINTEGER1 = success, 0 = failure
FROM_OWNERVARCHARUser who performed the action
TO_OWNERVARCHARTarget user (for forward/claim)
COMMENTVARCHARAction comment
CREATED_BYVARCHARCreator
CREATED_ONTIMESTAMPWhen the action was taken
UPDATED_BYVARCHARLast modifier
UPDATED_ONTIMESTAMPLast modification timestamp

CW_ITM_JOB_LOG (JobLogDo)

ColumnTypeDescription
IDVARCHAR (PK)UUID
SCHEDULER_IDVARCHARScheduler that triggered this job
ORIGINVARCHARSource system name
JOB_STATEVARCHARRunning, Completed, Failed, Not Processed
START_TIMETIMESTAMPJob start time
END_TIMETIMESTAMPJob end time
TIME_TAKENLONGDuration in milliseconds
RECORD_COUNTINTEGERNumber of records processed
MESSAGEVARCHARStatus message or error details
USER_IDVARCHARUser who triggered the job

Supporting Tables

  • SystemMasterDo - Registry of connected source systems
  • SystemSchedularConfigDo - Scheduler configurations (system, process, frequency, cron)
  • DraftProcessDo / DraftProcessAttributesDo - Draft process storage
  • YamlEntity - Uploaded YAML configuration files
  • CreateTaskDo - Direct task creation entity

Core Business Logic Flows

Task Synchronization Pipeline (processResult)

Scheduler triggers job
v
Composite API calls source system(s) -> gets raw JSON response
v
CompositeApiParserServiceImpl.processResult():
v
1. Load DB structure YAML (maps JSON paths -> DB columns)
2. Load custom attribute config (special field handling)
3. For each composite response:
a. Parse JSON response
b. Flatten nested JSON into key-value map
c. Filter to only required keys (from YAML config)
d. Create hash map indexed by record number
e. Handle system-specific logic
f. Handle custom attributes (from customattribute.yaml)
g. Merge with previous response maps
h. Clean flat map (remove prefixes)
4. Convert flat map to table-specific data
5. Batch upsert into database tables
6. Execute delta changes
7. Update job log with record count and status
8. On failure: send notification email to admin

Task Action Flow (taskAction)

POST /task/actions
Body: { isAdmin, tasks: [{ taskId, systemId, action, comment, forwardOwners, ... }] }
Header: Authorization: Bearer <jwt>

1. Extract userId from JWT token
2. Fetch task attributes for all task IDs
3. Fetch user's group memberships from WorkAccess
4. For each task:
a. Fetch current status and owners from DB
b. Validate authorization
c. Check for re-action
d. Route by action type (CLAIM/FORWARD/RELEASE/SEND_BACK/RESUBMIT/DEFAULT)
e. Insert audit record
f. Insert comment (if provided)
5. Send notifications for successful actions (async)
6. AOP @After advice triggers cache eviction (async)

DocuSign Signing URL Flow

POST /worknet/composite-api/parser/signUrl
Body: { taskId, envelopeId, systemId }

1. Extract userId from JWT
2. Load action config YAML (systemId + "_SIGN")
3. Fetch DocuSign user mapping from task attributes
4. Build return URL
5. Load DocuSign composite API YAML
6. Load DocuSign account details
7. Generate JWT assertion token (RSA256)
8. Set assertion token in composite request
9. Execute composite API
10. If consent_required: return consent redirect URL
11. Otherwise: return signing URL

Cache Eviction Flow (AOP-driven)

After any task action (via AspectUtil @After advice):
1. Extract ActionDto and authorization from method args
2. AsyncExecuter.asyncMethodWithReturnType() runs in background:
a. Get all task IDs from the action
b. Query task owners from DB
c. Separate owners into USER list and GROUP list
d. Resolve GROUP IDs to user emails via WorkAccess API
e. Combine all affected user IDs
f. Call ITM: POST /cacheEvict/evictForUserList

External Integrations

ITM (Task Center)

DirectionWhenWhat
OutboundAfter task actionCache eviction: POST /cacheEvict/evictForUserList
OutboundAfter task syncCache eviction for affected users
OutboundDocuSign signingReturn URL points to ITM eviction endpoint

Flowable (Native Workflow)

DirectionWhenWhat
OutboundTask action (Flowable tasks)Complete/claim/release/forward via Flowable custom API
InboundScheduled syncPull tasks from Flowable engine

WorkAccess / SAP IAS

DirectionWhenWhat
OutboundTask action validationResolve user's group memberships
OutboundCache evictionResolve group IDs to user emails
OutboundToken acquisitionGet service-to-service token

Notification / Messaging Service

DirectionWhenWhat
OutboundAfter task actionPOST /v1/notification/manageNotification
OutboundNew task sync (adhoc)POST /v1/notification/sendNotification
OutboundJob failureFailure notification email to admin
OutboundJob completionPOST /v1/job/processJob

Composite API Service (worknet-composite-api library)

DirectionWhenWhat
InternalTask syncOrchestrates multi-step API calls to source systems
InternalTask actionsOrchestrates action API calls to source systems
InternalDocuSign signingOrchestrates token + signing URL generation

SAP Destination Service

DirectionWhenWhat
OutboundOn startupResolve ITM URL from destination config
OutboundOn WorkAccess callsResolve WorkAccess URL + exchange token

Spring Cloud Config Server

DirectionWhenWhat
InboundOn startupLoads configuration properties
InboundYAML loadingLoads YAML configs (if readYamlFromConfig profile active)

Error Handling

  • All controllers wrap responses in ResponseMessage or ResponseDto with status, statusCode, message
  • Task actions return per-task status in a list (partial success is possible)
  • Job failures are logged to CW_ITM_JOB_LOG with error message and stack trace info
  • Job failures trigger admin email notification via messaging service
  • Composite API errors are parsed for system-specific error messages
  • HTTP status codes: 200 (success), 401 (unauthorized), 500 (internal error)

Async Operations

Enabled via @EnableAspectJAutoProxy and @EnableScheduling on the application class:

  1. Cache eviction (AsyncExecuter.asyncMethodWithReturnType)
  2. Process cancel cache eviction (AsyncExecuter.asyncMethodForProcess)
  3. Notification dispatch (AsyncExecuter.callNotificationService)
  4. Failure notification (AsyncExecuter.callNotificationServiceForFailure)
  5. Job details forwarding (AsyncExecuter.sendJobDetailsToMessagingService)
  6. Task sync processing (CPIResponseController.cpiResponse)
  7. Custom delegate actions (TaskActionServiceImpl default case)

AOP (Aspect-Oriented Programming)

AspectUtil intercepts task action controller methods:

PointcutAdviceWhat It Does
TaskActionController.taskActions(..)@AfterExtracts ActionDto -> triggers async cache eviction
TaskActionController.teamsActions(..)@AfterSame as above (for Teams integration)
TaskActionController.processCancel(..)@AfterExtracts ProcessActionDto -> triggers async cache eviction for all process tasks

Scheduler System

WorkNet uses Spring's ThreadPoolTaskScheduler (pool size: 10) for automated task pulling.

SchedulerConfig

  • Dynamically registers scheduled tasks based on SystemSchedularConfigDo entries
  • Each scheduler has a cron expression defining run frequency

SchedulerServiceImpl

  • runJob(): Executes composite API calls to source systems, processes results
  • runJobApi(): Same as runJob but accepts generic map input
  • getcompositecalldata(): Returns raw composite call data for debugging
  • azurePush(): Pushes YAML content to Azure DevOps repository
  • getLastRunOn(): Returns last run timestamps for schedulers

Batch Upsert Engine

JdbcBatchRepositoryImpl handles high-performance database operations:

  1. For each table in the data map:
    • Dynamically generate UPSERT SQL
    • Apply data type conversions based on ApplicationConstants
    • Execute in batches for performance
  2. Supports both SAP HANA and MySQL databases
  3. System ID is injected as a column value for multi-tenant isolation

Server-Sent Events (SSE)

SSEController provides real-time push updates:

  • Uses Reactor's Sinks.Many (multicast with backpressure buffer)
  • Publish: GET /send/{userName} -> emits event to all subscribers
  • Subscribe: GET /subscribe -> returns Flux<ServerSentEvent<String>>
  • Events include: ID (timestamp), event name ("periodic-event"), data, comment

Custom Delegate System

The CustomDeligate interface and IntakeImplementation provide extensibility:

  • After a Flowable task action (default case), the system calls customDeligateImplementation.implementAction()
  • This runs asynchronously via CompletableFuture.runAsync()
  • Current implementation: JnJ IntakeRequest dynamic task creation
  • New custom behaviors can be added by implementing the CustomDeligate interface

Observability

  • Actuator: Spring Boot Actuator endpoints enabled (health, info, env)
  • Logging: SLF4J with Lombok's @Slf4j annotation
  • Job Logs: Every scheduler run is logged to CW_ITM_JOB_LOG
  • Structured logging: Class name + method name in log messages
  • Performance logging: Execution time tracked for composite API calls, actions, signing URLs

Maven Dependencies

Internal (from Azure DevOps Artifacts)

Repository: https://pkgs.dev.azure.com/InctureProducts/_packaging/Workbox/maven/v1

com.cherrywork:iwm-security-adapter:0.0.3-SNAPSHOT
com.cherrywork.worknet:worknet-composite-api:0.0.7-SNAPSHOT

Key External Dependencies

org.springframework.boot:spring-boot-starter-web
org.springframework.boot:spring-boot-starter-data-jpa
org.springframework.boot:spring-boot-starter-webflux
org.springframework.boot:spring-boot-starter-aop
org.springframework.boot:spring-boot-starter-actuator
org.springframework.cloud:spring-cloud-starter-config
com.sap.cloud.db.jdbc:ngdbc:2.23.10
com.mysql:mysql-connector-j
org.apache.commons:commons-text:1.15.0
org.apache.tomcat.embed:tomcat-embed-core:11.0.15
com.fasterxml.jackson.core:jackson-databind
com.fasterxml.jackson.datatype:jsr310
org.projectlombok:lombok

API Request/Response Examples

Run Job (POST /worknet/composite-api/parser/runJob)

Request:

{
"schedulerId": "SCHED_001",
"systemId": "Flowable",
"processName": "purchase_approval",
"applicationId": "1784"
}

Header: Authorization: Bearer <jwt_token>

Response: 200 OK - "Running Job"

Task Action (POST /task/actions)

Request:

{
"isAdmin": false,
"tasks": [
{
"taskId": "task-12345",
"systemId": "Flowable",
"processName": "purchase_approval",
"taskType": "Approval Task",
"action": "approve",
"comment": "Looks good, approved.",
"userId": "john@company.com",
"isSubstitutedToMe": false
}
]
}

Response:

{
"status": "SUCCESS",
"statusCode": "200",
"message": "Tasks action performed successfully!",
"data": [
{
"status": "SUCCESS",
"statusCode": "SUCCESS",
"message": "Task(task-12345) approved successfully!"
}
]
}

Forward Task (POST /task/actions)

{
"isAdmin": false,
"tasks": [
{
"taskId": "task-12345",
"systemId": "Flowable",
"action": "forward",
"userId": "john@company.com",
"forwardOwners": [
{ "ownerId": "jane@company.com", "ownerType": "USER" }
]
}
]
}

Process Cancel (POST /task/processCancel)

{
"processId": "proc-67890",
"systemId": "Flowable",
"action": "CANCEL"
}

DocuSign Sign URL (POST /worknet/composite-api/parser/signUrl)

Request:

{
"taskId": "docusign-task-001",
"envelopeId": "env-12345",
"systemId": "DocuSign"
}

Response:

{
"signingUrl": "https://demo.docusign.net/Signing/...",
"type": "SIGNIN",
"envelopeId": "env-12345",
"status": 200,
"message": "Signing URL fetched"
}

Create Draft (POST /v1/draft/process)

{
"processId": "draft-001",
"systemId": "Flowable",
"processName": "purchase_request",
"userId": "john@company.com",
"attributes": [
{ "attrKey": "requestTitle", "attrValue": "New Laptop" },
{ "attrKey": "amount", "attrValue": "1500" }
]
}

Force Update (POST /worknet/composite-api/parser/forceUpdateToDb)

{
"systemId": "CUSTOM_SYSTEM",
"tables": {
"CW_ITM_WN_TASKS": [
{
"TASK_ID": "custom-task-001",
"STATUS": "READY",
"TASK_TYPE": "Approval"
}
]
}
}

Validation: systemId must match pattern ^[A-Z0-9_]{2,30}$

Database Support & Data Type Handling

Supported Databases

DatabaseProfileDriverNotes
SAP HANAconfigDB or vcapDBcom.sap.db.jdbc:ngdbcPrimary production database
MySQLconfigDBcom.mysql:mysql-connector-jAlternative database

Data Type Constants

ConstantSQL TypeHandling
NVARCHAR, VARCHAR, STRING, CHARStringQuoted with single quotes, special chars escaped
DATEDateFormatted and quoted
TIMESTAMP, DATETIMETimestampFormatted and quoted
INT, INTEGER, TINYINTIntegerUnquoted numeric
BOOLEANBooleanUnquoted
DECIMAL, DOUBLE, FLOATDecimalUnquoted numeric
CLOB, LOBLarge ObjectQuoted string

Known Design Notes

  1. Dual action API: taskAction() and taskActionV2()
  2. Composite API pattern: All source system interactions go through composite API orchestration
  3. YAML-driven mapping: DB mapping and action configs are in YAML
  4. Dual DB support: SAP HANA and MySQL supported via db.type
  5. AOP cache eviction: Automatic via AspectJ @After advice
  6. System-specific branching: Extensive system logic in TaskActionServiceImpl
  7. Custom delegate extensibility: CustomDeligate for customer logic
  8. Token dual-path: XSUAA client credentials vs WorkAccess token APIs
  9. Delta sync: Each scheduler run determines creates/updates/completions
  10. Owner resolution chain: user -> group -> admin -> substitution