Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Posts: 28
Registered: ‎11-04-2015
Accepted Solution

Offline WF - maximum elemements

Hi all,


I don't want to let user create more than one (or defined amount )  element in offline WF. So steps are:

  1. start offline WF 
  2. capture 
  3. if user wants to create next element (+1 then defined in code), he gets alert and element is not saved (automatically deleted).

has anybody already solved it and has a working sample for that JAVA plugin?




Frequent Contributor
Posts: 78
Registered: ‎10-12-2015

Re: Offline WF - maximum elemements

[ Edited ]

Hi Lukas,


I believe this can be achieved by implementing the IValidator interface.

Here's a sample:

package com.hgdn.gmsc.extensions;
public class SampleClientValidationHandler implements IValidator
       public List<ValidationError> validate(List<PersistenceElement> elements)
              List<ValidationError> validationErrors  = new ArrayList<ValidationError>();
              Feature featureToEdit = ((EditPlugin) ApplicationContext.getPluginCurator().getByName("EditPlugin")).getEditSettings().getFeature();
              if(elements.size() == 0 || !featureToEdit.getName().equals("FeatureName"))
                     return validationErrors;
                     validationErrors.add(new ValidationError("Only one element may be saved using this workflow", true));
       return validationErrors;


IValidator is following the Service Loader Pattern. This means that you have to create a file und META-INF/services: com.intergraph.web.plugin.edit.validation.IValidator and add your instance using package name + class name: com.hgdn.gmsc.extensions.SampleClientValidationHandler




The above sample first checks if a certain feature is active and if so, validates if only one element has been modified.


Hope this helps

Posts: 28
Registered: ‎11-04-2015

Re: Offline WF - maximum elemements



it looks good. I will forwarrd it to develepor.