Redwood Documentation

Product Documentation

 

›Processes and Chains

RunMyJobsProcess and Chain Definitions

Process Definitions

  • Creating Process Definitions
  • Setting Chain Definition and Chain Definition Properties
  • Integrating Redwood Server with Web Services
  • Redwood Definition Types
  • Maintenance Process Definitions
  • Template Process Definitions
  • Top Level Process Definition
  • Submit Form Editor
  • Default System Process Definitions

Processes and Chains

  • Advanced Chain Diagram Quick Reference
  • Chain Diagram Quick Reference
  • Chain Runtime Viewer Quick Reference
  • Advanced Chain Definition Editor Quick Reference
  • Advanced Chain Runtime Viewer Quick Reference
  • Advanced Diagram Quick Reference
  • Parameter Validation using Constraints
  • Processes Waiting on Events
  • Setting the Scheduling Behavior on the Control Tab
  • Setting the Retention Period for Processes
  • Runtime Limits
  • Setting Process Definition Options
  • Defining Parameters
  • Constraint Definitions
  • Constraint Class
  • Raising Events
  • Processes with Locks
  • Reaction Processes
  • Restart Behavior on the Process Status Tab
  • Searching Files
  • Setting the Name and Editing the Process Definition Source
  • Customizing Processes with Specific Actions
  • Using Table Parameters
  • Automatically Deleting Old Processes and Chains
  • Editing Process Definitions Safely
  • Parameter Formats

Chain Definitions

  • Using Chain Definitions
  • Creating Chain Definitions
  • Steps
  • Chain Processes
  • Creating Chain Definitions with Sequential Processes
  • Creating Chain Definitions with Parameter Handling
  • Creating Chain Definitions with Parallel Chain Processes
  • Creating Chain Definitions with Chain Processes Dependencies
  • Creating Chain Definitions for Multiple SAP Systems
  • Precondition Functions

Restart Behavior

  • Controlling Global and Partition Restart Behavior
← Constraint DefinitionsRaising Events →

Using The Constraint Class

Constraint class is used by constraint definitions to allow you to veto process submittal with parameters values that violate certain rules defined by the constraint class.

Constraint classes implement Constraint and ConstraintFactory.

Syntax

package com.redwood.scheduler.custom.constraint;

import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;

import com.redwood.scheduler.api.constraint.ConstraintViolatedException;
import com.redwood.scheduler.api.constraint.LOVCollection;
import com.redwood.scheduler.api.constraint.LOVSupport;
import com.redwood.scheduler.api.model.EntityDefinitionConstraintParameterMapping;
import com.redwood.scheduler.api.model.Job;
import com.redwood.scheduler.api.model.JobParameter;
import com.redwood.scheduler.infrastructure.logging.LoggerFactory;
import com.redwood.scheduler.infrastructure.logging.api.Logger;
import com.redwood.scheduler.spi.constraint.Constraint;
import com.redwood.scheduler.api.constraint.ConstraintContext;
import com.redwood.scheduler.spi.constraint.ConstraintFactory;

import com.redwood.scheduler.spi.constraint.ConstraintFactory;

public class SampleConstraint
  implements Constraint, ConstraintFactory
{
  private static final Logger log = LoggerFactory.getRegisteredLogger(RadioConstraint.class,
                                                                      "(C) Copyright 2011-2022 Redwood Technology B.V., Houten, The Netherlands",
                                                                      "$Id$");

  private static final long serialVersionUID = -2920424304798489040L;
  private Map<String, String> parameterMappingsMap;

  @Override
  public Constraint create()
  {
    return new SampleConstraint();
  }

  @Override
  public void execute(ConstraintContext context)
    throws ConstraintViolatedException
  {
    //Logic to validate the constraint
  }

  @Override
  public LOVCollection getLOV(ConstraintContext context, String parameterName, String query, int startAt, int fetchSize)
  {
    //Logic for LOV constraint
  }

  @Override
  public LOVSupport getLOVSupport(ConstraintContext context, String parameterName)
  {
    //Will this contraint return a list of values (LOV)
    //return LOVSupport.NoGetLOV;
    //return
  }

  @Override
  public void validate()
  {
    // nothing to do
  }

  @Override
  public void freeze()
  {
    // TODO Constraint.freeze is an auto-generated method stub

  }

  public Map<String, String> getParameterMappingsMap()
  {
    //Logic for retrieving the parameter mappings
    //return Collections.unmodifiableMap(parameterMappingsMap);
  }

  @Override
  public void setParameterMappings(Iterator<? extends com.redwood.scheduler.api.model.EntityDefinitionConstraintParameterMapping> newParameterMappings)
  {
    parameterMappingsMap = new LinkedHashMap<>();
    if (newParameterMappings == null)
    {
      return;
    }

    while (newParameterMappings.hasNext())
    {
      EntityDefinitionConstraintParameterMapping appliesToParameter = newParameterMappings.next();
      System.out.println("check parameter " + appliesToParameter.getParameterName() + " value:" + appliesToParameter.getValue());
      parameterMappingsMap.put(appliesToParameter.getParameterName(), appliesToParameter.getValue());
    }
  }

  @Override
  public String getDisplayValue(ConstraintContext newContext, String newParameterName, Object newValue)
  {
    // TODO Constraint.getDisplayValue is an auto-generated method stub
    return null;
  }

  @Override
  public void update(ConstraintContext newContext, String newParameterName, String newChangedParameterName)
  {
    //Update the value
  }

  @Override
  public boolean supportsArray()
  {
    // TODO Constraint.supportsArray is an auto-generated method stub
    return false;
  }
}

See Also

Constraint Definition

← Constraint DefinitionsRaising Events →
  • Syntax
  • See Also
Docs
Getting StartedInstallationFinance InstallationConcepts
TroubleshootingArchiving
Learn and Connect
Support Portal
BlogEventsResources
ISO/ IEC 27001 Information Security Management
Automate to be human

2023 All Rights Reserved |

Terms of Service | Policies | Cookies | Glossary | Third-party Software | Contact | Copyright | Impressum |