@Override public JsonObject convert(IFeatureRenderer renderer){
  RepresentationRenderer representationRenderer=(RepresentationRenderer)renderer;
  logger.info(RepresentationRendererKeys.REPRESENTATION_RENDERER);
  String value=null;
  String referenceValue=null;
  int index=-1;
  try {
    JsonObject jsonObject=new JsonObject();
    JsonObject rendererObject=new JsonObject();
    JsonArray fieldArray=new JsonArray();
    IName dataSourceName=representationRenderer.getDataSourceName();
    if (dataSourceName != null) {
      rendererObject.addProperty(RepresentationRendererKeys.DATA_SOURCE_NAME,dataSourceName.getNameString());
    }
    JsonObject invalidRuleColour=CommonObjects.createColour(representationRenderer.getInvalidRuleColor());
    if (invalidRuleColour != null) {
      rendererObject.add(RepresentationRendererKeys.INVALID_RULE_COLOUR,invalidRuleColour);
    }
    JsonObject invisibleRuleColour=CommonObjects.createColour(representationRenderer.getInvisibleColor());
    if (invisibleRuleColour != null) {
      rendererObject.add(RepresentationRendererKeys.INVISIBLE_RULE_COLOUR,invisibleRuleColour);
    }
    rendererObject.addProperty(RepresentationRendererKeys.RELATIVE_BASE,representationRenderer.getRelativeBase());
    JsonObject representationClassObject=getRepresentationClass(representationRenderer.getRepresentationClass());
    if (representationClassObject != null) {
      rendererObject.add(RepresentationRendererKeys.REPRESENTATION_CLASS,representationClassObject);
    }
    for (int fieldIndex=0; fieldIndex < representationRenderer.getFieldCount(); fieldIndex++) {
      JsonObject jsonValueObject=new JsonObject();
      jsonValueObject.addProperty(RepresentationRendererKeys.FIELD_NAME,representationRenderer.getField(fieldIndex));
      ITable table=null;
      jsonValueObject.addProperty(RepresentationRendererKeys.WHERE_CLAUSE,representationRenderer.getWhereClause(fieldIndex,table));
      fieldArray.add(jsonValueObject);
    }
    rendererObject.addProperty(RepresentationRendererKeys.DRAW_INVALID_RULE,representationRenderer.isDrawInvalidRule());
    rendererObject.addProperty(RepresentationRendererKeys.DRAW_INVISIBLE,representationRenderer.isDrawInvisible());
    rendererObject.addProperty(CommonRendererKeys.GRADUATED_SYMBOLS,representationRenderer.isSymbolsAreGraduated());
    rendererObject.add(RepresentationRendererKeys.FIELDS,fieldArray);
    jsonObject.add(RepresentationRendererKeys.REPRESENTATION_RENDERER,rendererObject);
    return jsonObject;
  }
 catch (  AutomationException e) {
    logger.error(String.format("%s %s %d",value,referenceValue,index));
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
    logger.error(e.getMessage());
  }
  return null;
}

@ Override public JsonObject convert ( IFeatureRenderer renderer ) { RepresentationRenderer representationRenderer = ( RepresentationRenderer ) renderer ; logger . info ( RepresentationRendererKeys . REPRESENTATION_RENDERER ) ; String value = null ; String referenceValue = null ; int index = - 1 ; try { JsonObject jsonObject = new JsonObject ( ) ; JsonObject rendererObject = new JsonObject ( ) ; JsonArray fieldArray = new JsonArray ( ) ; IName dataSourceName = representationRenderer . getDataSourceName ( ) ; if ( dataSourceName != null ) { rendererObject . addProperty ( RepresentationRendererKeys . DATA_SOURCE_NAME , dataSourceName . getNameString ( ) ) ; } JsonObject invalidRuleColour = CommonObjects . createColour ( representationRenderer . getInvalidRuleColor ( ) ) ; if ( invalidRuleColour != null ) { rendererObject . add ( RepresentationRendererKeys . INVALID_RULE_COLOUR , invalidRuleColour ) ; } JsonObject invisibleRuleColour = CommonObjects . createColour ( representationRenderer . getInvisibleColor ( ) ) ; if ( invisibleRuleColour != null ) { rendererObject . add ( RepresentationRendererKeys . INVISIBLE_RULE_COLOUR , invisibleRuleColour ) ; } rendererObject . addProperty ( RepresentationRendererKeys . RELATIVE_BASE , representationRenderer . getRelativeBase ( ) ) ; JsonObject representationClassObject = getRepresentationClass ( representationRenderer . getRepresentationClass ( ) ) ; if ( representationClassObject != null ) { rendererObject . add ( RepresentationRendererKeys . REPRESENTATION_CLASS , representationClassObject ) ; } for ( int fieldIndex = 0 ; fieldIndex < representationRenderer . getFieldCount ( ) ; fieldIndex ++ ) { JsonObject jsonValueObject = new JsonObject ( ) ; jsonValueObject . addProperty ( RepresentationRendererKeys . FIELD_NAME , representationRenderer . getField ( fieldIndex ) ) ; ITable table = null ; jsonValueObject . addProperty ( RepresentationRendererKeys . WHERE_CLAUSE , representationRenderer . getWhereClause ( fieldIndex , table ) ) ; fieldArray . add ( jsonValueObject ) ; } rendererObject . addProperty ( RepresentationRendererKeys . DRAW_INVALID_RULE , representationRenderer . isDrawInvalidRule ( ) ) ; rendererObject . addProperty ( RepresentationRendererKeys . DRAW_INVISIBLE , representationRenderer . isDrawInvisible ( ) ) ; rendererObject . addProperty ( CommonRendererKeys . GRADUATED_SYMBOLS , representationRenderer . isSymbolsAreGraduated ( ) ) ; rendererObject . add ( RepresentationRendererKeys . FIELDS , fieldArray ) ; jsonObject . add ( RepresentationRendererKeys . REPRESENTATION_RENDERER , rendererObject ) ; return jsonObject ; } catch ( AutomationException e ) { logger . error ( String . format ( "%s %s %d" , value , referenceValue , index ) ) ; e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; logger . error ( e . getMessage ( ) ) ; } return null ; }
convert unique value renderer .
