Transform method

@param object DigitalObject to be transformed
@param jsonConfig String containing configuration for this item
@return DigitalObject The object after being transformed
@throws TransformerException
165769
@Override
    public DigitalObject transform(DigitalObject in, String jsonConfig)
            throws TransformerException {
        if (!valid) {
            error("Instantiation did not complete.");
        }
        log.debug("Received OID '{}'", in.getId());
        return process(in, jsonConfig);
    }
448061
public JSONObject toJSON(Constraint o) throws JSONConverterException {
        ConstraintConverter c = java2json.get(o.getClass());
        if (c == null) {
            throw new JSONConverterException("No converter available for a constraint with the '" + o.getClass() + "' className");
        }
        return c.toJSON(o);
    }
1371168
protected function buildTransformationObject($transformationConfiguration)
    {
        $transformationClassName = $this->resolveTransformationClassName($transformationConfiguration['type']);
        $transformation = new $transformationClassName();

        if (isset($transformationConfiguration['settings']) && is_array($transformationConfiguration['settings'])) {
            foreach ($transformationConfiguration['settings'] as $settingName => $settingValue) {
                if (!ObjectAccess::setProperty($transformation, $settingName, $settingValue)) {
                    throw new MigrationException('Cannot set setting "' . $settingName . '" on transformation "' . $transformationClassName . '" , check your configuration.', 1343293094);
                }
            }
        }

        return $transformation;
    }
97641
@NonNull
  public RequestCreator config(@NonNull Bitmap.Config config) {
    data.config(config);
    return this;
  }
527539
private static void appendJSONProperty(JsonGenerator jsonGen,
	                                       Configuration config, String name, ConfigRedactor redactor)
			throws IOException {
		// skip writing if given property name is empty or null
		if(!Strings.isNullOrEmpty(name) && jsonGen != null) {
			jsonGen.writeStartObject();
			jsonGen.writeStringField("key", name);
			jsonGen.writeStringField("value",
					redactor.redact(name, config.get(name)));
			jsonGen.writeBooleanField("isFinal",
					config.finalParameters.contains(name));
			String[] resources = config.updatingResource != null ?
					config.updatingResource.get(name) : null;
			String resource = UNKNOWN_RESOURCE;
			if (resources != null && resources.length > 0) {
				resource = resources[0];
			}
			jsonGen.writeStringField("resource", resource);
			jsonGen.writeEndObject();
		}
	}
1045161
public Object transformObject(TransformationDescription description, Object source) throws InstantiationException,
        IllegalAccessException, ClassNotFoundException {
        return transformObject(description, source, null);
    }
218806
private static JSONArray _fromArray( double[] array, JsonConfig jsonConfig ) {
      if( !addInstance( array ) ){
         try{
            return jsonConfig.getCycleDetectionStrategy()
                  .handleRepeatedReferenceAsArray( array );
         }catch( JSONException jsone ){
            removeInstance( array );
            fireErrorEvent( jsone, jsonConfig );
            throw jsone;
         }catch( RuntimeException e ){
            removeInstance( array );
            JSONException jsone = new JSONException( e );
            fireErrorEvent( jsone, jsonConfig );
            throw jsone;
         }
      }
      fireArrayStartEvent( jsonConfig );
      
      JSONArray jsonArray = new JSONArray();
      try{
         for( int i = 0; i < array.length; i++ ){
            Double d = new Double( array[i] );
            JSONUtils.testValidity( d );
            jsonArray.addValue( d, jsonConfig );
            fireElementAddedEvent( i, d, jsonConfig );
         }
      }catch( JSONException jsone ){
         removeInstance( array );
         fireErrorEvent( jsone, jsonConfig );
         throw jsone;
      }

      removeInstance( array );
      fireArrayEndEvent( jsonConfig );
      return jsonArray;
   }
66659
public static Object toArray( JSONArray jsonArray, Object root, JsonConfig jsonConfig ) {
      Class objectClass = root.getClass();
      if( jsonArray.size() == 0 ){
         return Array.newInstance( objectClass, 0 );
      }

      int[] dimensions = JSONArray.getDimensions( jsonArray );
      Object array = Array.newInstance( objectClass == null ? Object.class : objectClass,
            dimensions );
      int size = jsonArray.size();
      for( int i = 0; i < size; i++ ){
         Object value = jsonArray.get( i );
         if( JSONUtils.isNull( value ) ){
            Array.set( array, i, null );
         }else{
            Class type = value.getClass();
            if( JSONArray.class.isAssignableFrom( type ) ){
               Array.set( array, i, toArray( (JSONArray) value, root, jsonConfig ) );
            }else if( String.class.isAssignableFrom( type )
                  || Boolean.class.isAssignableFrom( type ) || JSONUtils.isNumber( type )
                  || Character.class.isAssignableFrom( type )
                  || JSONFunction.class.isAssignableFrom( type ) ){
               if( objectClass != null && !objectClass.isAssignableFrom( type ) ){
                  value = JSONUtils.getMorpherRegistry()
                        .morph( objectClass, value );
               }
               Array.set( array, i, value );
            }else{
               try{
                  Object newRoot = jsonConfig.getNewBeanInstanceStrategy()
                        .newInstance( root.getClass(), null );
                  Array.set( array, i, JSONObject.toBean( (JSONObject) value, newRoot, jsonConfig ) );
               }catch( JSONException jsone ){
                  throw jsone;
               }catch( Exception e ){
                  throw new JSONException( e );
               }
            }
         }
      }
      return array;
   }
618999
public Object transformObject(TransformationDescription description, Object source, Object target)
        throws InstantiationException, IllegalAccessException, ClassNotFoundException {
        checkNeededValues(description);
        Class<?> sourceClass = modelRegistry.loadModel(description.getSourceModel());
        Class<?> targetClass = modelRegistry.loadModel(description.getTargetModel());
        if (!sourceClass.isAssignableFrom(source.getClass())) {
            throw new IllegalArgumentException("The given source object does not match the given description");
        }
        this.source = source;
        if (target == null) {
            this.target = targetClass.newInstance();
        } else {
            this.target = target;
        }
        for (TransformationStep step : description.getTransformingSteps()) {
            performTransformationStep(step);
        }
        return this.target;
    }
103969
protected JsonGenerator _config(JsonGenerator g)
    {
        // First, possible pretty printing
        PrettyPrinter pp = _prettyPrinter;
        if (pp != null) {
            if (pp instanceof Instantiatable<?>) {
                pp = (PrettyPrinter) ((Instantiatable<?>) pp).createInstance();
            }
            g.setPrettyPrinter(pp);
        } else if (isEnabled(Feature.PRETTY_PRINT_OUTPUT)) {
            g.useDefaultPrettyPrinter();
        }
        return g;
    }
851323
protected function createEmptyObjectStructure($config)
  {
    try
    {
      $configurator = new EnmConfigurator($this->converter->convertTo($config, 'array'), $this->dispatcher);

      return $this->createPartOfStructure($configurator->getConfig());
    }
    catch (\Exception $e)
    {
      $this->dispatcher->dispatch(TransformerEvents::ON_EXCEPTION, new ExceptionEvent($e));
      throw new TransformerException($e->getMessage());
    }
  }
121114
private static JSONArray _fromArray( byte[] array, JsonConfig jsonConfig ) {
      if( !addInstance( array ) ){
         try{
            return jsonConfig.getCycleDetectionStrategy()
                  .handleRepeatedReferenceAsArray( array );
         }catch( JSONException jsone ){
            removeInstance( array );
            fireErrorEvent( jsone, jsonConfig );
            throw jsone;
         }catch( RuntimeException e ){
            removeInstance( array );
            JSONException jsone = new JSONException( e );
            fireErrorEvent( jsone, jsonConfig );
            throw jsone;
         }
      }
      fireArrayStartEvent( jsonConfig );
      
      JSONArray jsonArray = new JSONArray();
      for( int i = 0; i < array.length; i++ ){
         Number n = JSONUtils.transformNumber( new Byte( array[i] ) );
         jsonArray.addValue( n, jsonConfig );
         fireElementAddedEvent( i, n, jsonConfig );
      }

      removeInstance( array );
      fireArrayEndEvent( jsonConfig );
      return jsonArray;
   }
1302687
function convertConfig(jsonConfig) {
  var bunyanConfig = extend({}, jsonConfig);

  if (Array.isArray(bunyanConfig.streams)) {
    bunyanConfig.streams = bunyanConfig.streams.map(convertStream);
  }

  if (bunyanConfig.serializers) {
    bunyanConfig.serializers = convertSerializers(bunyanConfig.serializers);
  }

  return bunyanConfig;
}
1038140
public JSONObject processBean( Object bean, JsonConfig jsonConfig ) {
      JSONObject jsonObject = null;
      if( bean instanceof java.sql.Date ){
         bean = new Date( ((java.sql.Date) bean).getTime() );
      }
      if( bean instanceof Date ){
         Calendar c = Calendar.getInstance();
         c.setTime( (Date) bean );
         jsonObject = new JSONObject().element( "year", c.get( Calendar.YEAR ) )
               .element( "month", c.get( Calendar.MONTH ) )
               .element( "day", c.get( Calendar.DAY_OF_MONTH ) )
               .element( "hours", c.get( Calendar.HOUR_OF_DAY ) )
               .element( "minutes", c.get( Calendar.MINUTE ) )
               .element( "seconds", c.get( Calendar.SECOND ) )
               .element( "milliseconds", c.get( Calendar.MILLISECOND ) );
      }else{
         jsonObject = new JSONObject( true );
      }
      return jsonObject;
   }
530735
@SuppressWarnings("nls")
    protected JsonObject parseConfig(JdbcOptionsBean config) {
        JsonObject jsonConfig = new JsonObject();
        nullSafePut(jsonConfig, "provider_class", HikariCPDataSourceProvider.class.getCanonicalName()); // Vert.x thing
        nullSafePut(jsonConfig, "jdbcUrl", config.getJdbcUrl());
        nullSafePut(jsonConfig, "username", config.getUsername());
        nullSafePut(jsonConfig, "password", config.getPassword());
        nullSafePut(jsonConfig, "autoCommit", config.isAutoCommit());
        nullSafePut(jsonConfig, "connectionTimeout", config.getConnectionTimeout());
        nullSafePut(jsonConfig, "idleTimeout", config.getIdleTimeout());
        nullSafePut(jsonConfig, "maxLifetime", config.getMaxLifetime());
        nullSafePut(jsonConfig, "minimumIdle", config.getMinimumIdle());
        nullSafePut(jsonConfig, "maximumPoolSize", config.getMaximumPoolSize());
        nullSafePut(jsonConfig, "poolName", config.getPoolName());

        JsonObject dsProperties = new JsonObject();

        for (Entry<String, Object> entry : config.getDsProperties().entrySet()) {
            dsProperties.put(entry.getKey(), entry.getValue());
        }

        jsonConfig.put("properties", dsProperties);
        return jsonConfig;
    }
830698
private static JSON toJSON( JSONString string, JsonConfig jsonConfig ) {
      return toJSON( string.toJSONString(), jsonConfig );
   }
188154
private static JSONArray _fromArray( Object[] array, JsonConfig jsonConfig ) {
      if( !addInstance( array ) ){
         try{
            return jsonConfig.getCycleDetectionStrategy()
                  .handleRepeatedReferenceAsArray( array );
         }catch( JSONException jsone ){
            removeInstance( array );
            fireErrorEvent( jsone, jsonConfig );
            throw jsone;
         }catch( RuntimeException e ){
            removeInstance( array );
            JSONException jsone = new JSONException( e );
            fireErrorEvent( jsone, jsonConfig );
            throw jsone;
         }
      }
      fireArrayStartEvent( jsonConfig );
      
      JSONArray jsonArray = new JSONArray();
      try{
         for( int i = 0; i < array.length; i++ ){
            Object element = array[i];
            jsonArray.addValue( element, jsonConfig );
            fireElementAddedEvent( i, jsonArray.get( i ), jsonConfig );
         }
      }catch( JSONException jsone ){
         removeInstance( array );
         fireErrorEvent( jsone, jsonConfig );
         throw jsone;
      }catch( RuntimeException e ){
         removeInstance( array );
         JSONException jsone = new JSONException( e );
         fireErrorEvent( jsone, jsonConfig );
         throw jsone;
      }

      removeInstance( array );
      fireArrayEndEvent( jsonConfig );
      return jsonArray;
   }