diff --git a/CRM/Dataprocessor/DAO/DataProcessor.php b/CRM/Dataprocessor/DAO/DataProcessor.php
index cb6c049e427de40543ea85579090642318f00c58..0a2da39ab03f5014244a85f4e7776679aa025b21 100644
--- a/CRM/Dataprocessor/DAO/DataProcessor.php
+++ b/CRM/Dataprocessor/DAO/DataProcessor.php
@@ -4,9 +4,9 @@
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2019
  *
- * Generated from /buildkit/build/search/sites/default/files/civicrm/ext/dataprocessor/xml/schema/CRM/Dataprocessor/DataProcessor.xml
+ * Generated from /buildkit/build/search/web/sites/all/modules/civicrm/tools/extensions/dataprocessor/xml/schema/CRM/Dataprocessor/DataProcessor.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:28cee8d17fc4e4fca4b21a0b4dbf17ff)
+ * (GenCodeChecksum:d6907bd0c85e77ce033cc7aef3d0aa3a)
  */
 
 /**
@@ -19,19 +19,19 @@ class CRM_Dataprocessor_DAO_DataProcessor extends CRM_Core_DAO {
    *
    * @var string
    */
-  static $_tableName = 'civicrm_data_processor';
+  public static $_tableName = 'civicrm_data_processor';
 
   /**
    * Should CiviCRM log any modifications to this table in the civicrm_log table.
    *
    * @var bool
    */
-  static $_log = FALSE;
+  public static $_log = FALSE;
 
   /**
    * Unique DataProcessor ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -56,12 +56,7 @@ class CRM_Dataprocessor_DAO_DataProcessor extends CRM_Core_DAO {
   public $configuration;
 
   /**
-   * @var text
-   */
-  public $aggregation;
-
-  /**
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
@@ -81,7 +76,7 @@ class CRM_Dataprocessor_DAO_DataProcessor extends CRM_Core_DAO {
   public $storage_configuration;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $status;
 
@@ -111,6 +106,7 @@ class CRM_Dataprocessor_DAO_DataProcessor extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_INT,
           'description' => CRM_Dataprocessor_ExtensionUtil::ts('Unique DataProcessor ID'),
           'required' => TRUE,
+          'where' => 'civicrm_data_processor.id',
           'table_name' => 'civicrm_data_processor',
           'entity' => 'DataProcessor',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
@@ -123,6 +119,7 @@ class CRM_Dataprocessor_DAO_DataProcessor extends CRM_Core_DAO {
           'required' => FALSE,
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
+          'where' => 'civicrm_data_processor.name',
           'table_name' => 'civicrm_data_processor',
           'entity' => 'DataProcessor',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
@@ -135,6 +132,7 @@ class CRM_Dataprocessor_DAO_DataProcessor extends CRM_Core_DAO {
           'required' => TRUE,
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
+          'where' => 'civicrm_data_processor.title',
           'table_name' => 'civicrm_data_processor',
           'entity' => 'DataProcessor',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
@@ -147,6 +145,7 @@ class CRM_Dataprocessor_DAO_DataProcessor extends CRM_Core_DAO {
           'required' => TRUE,
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
+          'where' => 'civicrm_data_processor.type',
           'table_name' => 'civicrm_data_processor',
           'entity' => 'DataProcessor',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
@@ -157,17 +156,7 @@ class CRM_Dataprocessor_DAO_DataProcessor extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_TEXT,
           'title' => CRM_Dataprocessor_ExtensionUtil::ts('Configuration'),
           'required' => FALSE,
-          'table_name' => 'civicrm_data_processor',
-          'entity' => 'DataProcessor',
-          'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
-          'localizable' => 0,
-          'serialize' => self::SERIALIZE_JSON,
-        ],
-        'aggregation' => [
-          'name' => 'aggregation',
-          'type' => CRM_Utils_Type::T_TEXT,
-          'title' => CRM_Dataprocessor_ExtensionUtil::ts('Aggregation Fields'),
-          'required' => FALSE,
+          'where' => 'civicrm_data_processor.configuration',
           'table_name' => 'civicrm_data_processor',
           'entity' => 'DataProcessor',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
@@ -179,6 +168,7 @@ class CRM_Dataprocessor_DAO_DataProcessor extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_BOOLEAN,
           'title' => CRM_Dataprocessor_ExtensionUtil::ts('Is active'),
           'required' => TRUE,
+          'where' => 'civicrm_data_processor.is_active',
           'table_name' => 'civicrm_data_processor',
           'entity' => 'DataProcessor',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
@@ -189,6 +179,7 @@ class CRM_Dataprocessor_DAO_DataProcessor extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_TEXT,
           'title' => CRM_Dataprocessor_ExtensionUtil::ts('Description'),
           'required' => FALSE,
+          'where' => 'civicrm_data_processor.description',
           'table_name' => 'civicrm_data_processor',
           'entity' => 'DataProcessor',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
@@ -201,6 +192,7 @@ class CRM_Dataprocessor_DAO_DataProcessor extends CRM_Core_DAO {
           'required' => FALSE,
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
+          'where' => 'civicrm_data_processor.storage_type',
           'table_name' => 'civicrm_data_processor',
           'entity' => 'DataProcessor',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
@@ -211,6 +203,7 @@ class CRM_Dataprocessor_DAO_DataProcessor extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_TEXT,
           'title' => CRM_Dataprocessor_ExtensionUtil::ts('Storage Configuration'),
           'required' => FALSE,
+          'where' => 'civicrm_data_processor.storage_configuration',
           'table_name' => 'civicrm_data_processor',
           'entity' => 'DataProcessor',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
@@ -222,6 +215,7 @@ class CRM_Dataprocessor_DAO_DataProcessor extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_INT,
           'title' => CRM_Dataprocessor_ExtensionUtil::ts('Status'),
           'required' => FALSE,
+          'where' => 'civicrm_data_processor.status',
           'default' => '0',
           'table_name' => 'civicrm_data_processor',
           'entity' => 'DataProcessor',
@@ -235,6 +229,7 @@ class CRM_Dataprocessor_DAO_DataProcessor extends CRM_Core_DAO {
           'required' => FALSE,
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
+          'where' => 'civicrm_data_processor.source_file',
           'table_name' => 'civicrm_data_processor',
           'entity' => 'DataProcessor',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessor',
diff --git a/CRM/Dataprocessor/DAO/DataProcessorField.php b/CRM/Dataprocessor/DAO/DataProcessorField.php
index 1818c0fbdb693e29a7431cbba0b95d2912de305b..d4c0393992c351249eff6b964f88892b8c5813de 100644
--- a/CRM/Dataprocessor/DAO/DataProcessorField.php
+++ b/CRM/Dataprocessor/DAO/DataProcessorField.php
@@ -4,9 +4,9 @@
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2019
  *
- * Generated from /buildkit/build/search/sites/default/files/civicrm/ext/dataprocessor/xml/schema/CRM/Dataprocessor/DataProcessorField.xml
+ * Generated from /buildkit/build/search/web/sites/all/modules/civicrm/tools/extensions/dataprocessor/xml/schema/CRM/Dataprocessor/DataProcessorField.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:31241877b684b9293303c171b4a4dcbb)
+ * (GenCodeChecksum:d274dcffe6113de94c614b35f32dc06b)
  */
 
 /**
@@ -19,26 +19,26 @@ class CRM_Dataprocessor_DAO_DataProcessorField extends CRM_Core_DAO {
    *
    * @var string
    */
-  static $_tableName = 'civicrm_data_processor_field';
+  public static $_tableName = 'civicrm_data_processor_field';
 
   /**
    * Should CiviCRM log any modifications to this table in the civicrm_log table.
    *
    * @var bool
    */
-  static $_log = FALSE;
+  public static $_log = FALSE;
 
   /**
    * Unique DataProcessorField ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Data Processor
    *
-   * @var int unsigned
+   * @var int
    */
   public $data_processor_id;
 
@@ -83,7 +83,7 @@ class CRM_Dataprocessor_DAO_DataProcessorField extends CRM_Core_DAO {
    */
   public static function getReferenceColumns() {
     if (!isset(Civi::$statics[__CLASS__]['links'])) {
-      Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
+      Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
       Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'data_processor_id', 'civicrm_data_processor', 'id');
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
     }
@@ -103,6 +103,7 @@ class CRM_Dataprocessor_DAO_DataProcessorField extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_INT,
           'description' => CRM_Dataprocessor_ExtensionUtil::ts('Unique DataProcessorField ID'),
           'required' => TRUE,
+          'where' => 'civicrm_data_processor_field.id',
           'table_name' => 'civicrm_data_processor_field',
           'entity' => 'DataProcessorField',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorField',
@@ -114,6 +115,7 @@ class CRM_Dataprocessor_DAO_DataProcessorField extends CRM_Core_DAO {
           'title' => CRM_Dataprocessor_ExtensionUtil::ts('Data Processor ID'),
           'description' => CRM_Dataprocessor_ExtensionUtil::ts('FK to Data Processor'),
           'required' => TRUE,
+          'where' => 'civicrm_data_processor_field.data_processor_id',
           'table_name' => 'civicrm_data_processor_field',
           'entity' => 'DataProcessorField',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorField',
@@ -124,6 +126,7 @@ class CRM_Dataprocessor_DAO_DataProcessorField extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_INT,
           'title' => CRM_Dataprocessor_ExtensionUtil::ts('Weight'),
           'required' => FALSE,
+          'where' => 'civicrm_data_processor_field.weight',
           'table_name' => 'civicrm_data_processor_field',
           'entity' => 'DataProcessorField',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorField',
@@ -136,6 +139,7 @@ class CRM_Dataprocessor_DAO_DataProcessorField extends CRM_Core_DAO {
           'required' => FALSE,
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
+          'where' => 'civicrm_data_processor_field.name',
           'table_name' => 'civicrm_data_processor_field',
           'entity' => 'DataProcessorField',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorField',
@@ -148,6 +152,7 @@ class CRM_Dataprocessor_DAO_DataProcessorField extends CRM_Core_DAO {
           'required' => TRUE,
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
+          'where' => 'civicrm_data_processor_field.title',
           'table_name' => 'civicrm_data_processor_field',
           'entity' => 'DataProcessorField',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorField',
@@ -160,6 +165,7 @@ class CRM_Dataprocessor_DAO_DataProcessorField extends CRM_Core_DAO {
           'required' => TRUE,
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
+          'where' => 'civicrm_data_processor_field.type',
           'table_name' => 'civicrm_data_processor_field',
           'entity' => 'DataProcessorField',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorField',
@@ -170,6 +176,7 @@ class CRM_Dataprocessor_DAO_DataProcessorField extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_TEXT,
           'title' => CRM_Dataprocessor_ExtensionUtil::ts('Configuration'),
           'required' => FALSE,
+          'where' => 'civicrm_data_processor_field.configuration',
           'table_name' => 'civicrm_data_processor_field',
           'entity' => 'DataProcessorField',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorField',
diff --git a/CRM/Dataprocessor/DAO/DataProcessorFilter.php b/CRM/Dataprocessor/DAO/DataProcessorFilter.php
index 4177364016c77eeeed4c5ef0f021d8bc29113888..f8db5256df224d14b5a7cb9837efc7a6227b836c 100644
--- a/CRM/Dataprocessor/DAO/DataProcessorFilter.php
+++ b/CRM/Dataprocessor/DAO/DataProcessorFilter.php
@@ -4,9 +4,9 @@
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2019
  *
- * Generated from /buildkit/build/search/sites/default/files/civicrm/ext/dataprocessor/xml/schema/CRM/Dataprocessor/DataProcessorFilter.xml
+ * Generated from /buildkit/build/search/web/sites/all/modules/civicrm/tools/extensions/dataprocessor/xml/schema/CRM/Dataprocessor/DataProcessorFilter.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:6dd12cb48d198744c5d17149671521c9)
+ * (GenCodeChecksum:24f21f0d15aa13b3b28792ad454e68e8)
  */
 
 /**
@@ -19,26 +19,26 @@ class CRM_Dataprocessor_DAO_DataProcessorFilter extends CRM_Core_DAO {
    *
    * @var string
    */
-  static $_tableName = 'civicrm_data_processor_filter';
+  public static $_tableName = 'civicrm_data_processor_filter';
 
   /**
    * Should CiviCRM log any modifications to this table in the civicrm_log table.
    *
    * @var bool
    */
-  static $_log = FALSE;
+  public static $_log = FALSE;
 
   /**
    * Unique DataProcessorFilter ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Data Processor
    *
-   * @var int unsigned
+   * @var int
    */
   public $data_processor_id;
 
@@ -63,12 +63,12 @@ class CRM_Dataprocessor_DAO_DataProcessorFilter extends CRM_Core_DAO {
   public $type;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_required;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_exposed;
 
@@ -98,7 +98,7 @@ class CRM_Dataprocessor_DAO_DataProcessorFilter extends CRM_Core_DAO {
    */
   public static function getReferenceColumns() {
     if (!isset(Civi::$statics[__CLASS__]['links'])) {
-      Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
+      Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
       Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'data_processor_id', 'civicrm_data_processor', 'id');
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
     }
@@ -118,6 +118,7 @@ class CRM_Dataprocessor_DAO_DataProcessorFilter extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_INT,
           'description' => CRM_Dataprocessor_ExtensionUtil::ts('Unique DataProcessorFilter ID'),
           'required' => TRUE,
+          'where' => 'civicrm_data_processor_filter.id',
           'table_name' => 'civicrm_data_processor_filter',
           'entity' => 'DataProcessorFilter',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilter',
@@ -129,6 +130,7 @@ class CRM_Dataprocessor_DAO_DataProcessorFilter extends CRM_Core_DAO {
           'title' => CRM_Dataprocessor_ExtensionUtil::ts('Data Processor ID'),
           'description' => CRM_Dataprocessor_ExtensionUtil::ts('FK to Data Processor'),
           'required' => TRUE,
+          'where' => 'civicrm_data_processor_filter.data_processor_id',
           'table_name' => 'civicrm_data_processor_filter',
           'entity' => 'DataProcessorFilter',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilter',
@@ -139,6 +141,7 @@ class CRM_Dataprocessor_DAO_DataProcessorFilter extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_INT,
           'title' => CRM_Dataprocessor_ExtensionUtil::ts('Weight'),
           'required' => FALSE,
+          'where' => 'civicrm_data_processor_filter.weight',
           'table_name' => 'civicrm_data_processor_filter',
           'entity' => 'DataProcessorFilter',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilter',
@@ -151,6 +154,7 @@ class CRM_Dataprocessor_DAO_DataProcessorFilter extends CRM_Core_DAO {
           'required' => FALSE,
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
+          'where' => 'civicrm_data_processor_filter.name',
           'table_name' => 'civicrm_data_processor_filter',
           'entity' => 'DataProcessorFilter',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilter',
@@ -163,6 +167,7 @@ class CRM_Dataprocessor_DAO_DataProcessorFilter extends CRM_Core_DAO {
           'required' => TRUE,
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
+          'where' => 'civicrm_data_processor_filter.title',
           'table_name' => 'civicrm_data_processor_filter',
           'entity' => 'DataProcessorFilter',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilter',
@@ -175,6 +180,7 @@ class CRM_Dataprocessor_DAO_DataProcessorFilter extends CRM_Core_DAO {
           'required' => TRUE,
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
+          'where' => 'civicrm_data_processor_filter.type',
           'table_name' => 'civicrm_data_processor_filter',
           'entity' => 'DataProcessorFilter',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilter',
@@ -185,6 +191,7 @@ class CRM_Dataprocessor_DAO_DataProcessorFilter extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_BOOLEAN,
           'title' => CRM_Dataprocessor_ExtensionUtil::ts('Is required'),
           'required' => FALSE,
+          'where' => 'civicrm_data_processor_filter.is_required',
           'table_name' => 'civicrm_data_processor_filter',
           'entity' => 'DataProcessorFilter',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilter',
@@ -195,6 +202,7 @@ class CRM_Dataprocessor_DAO_DataProcessorFilter extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_BOOLEAN,
           'title' => CRM_Dataprocessor_ExtensionUtil::ts('Is exposed'),
           'required' => FALSE,
+          'where' => 'civicrm_data_processor_filter.is_exposed',
           'default' => '1',
           'table_name' => 'civicrm_data_processor_filter',
           'entity' => 'DataProcessorFilter',
@@ -206,6 +214,7 @@ class CRM_Dataprocessor_DAO_DataProcessorFilter extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_TEXT,
           'title' => CRM_Dataprocessor_ExtensionUtil::ts('Configuration'),
           'required' => FALSE,
+          'where' => 'civicrm_data_processor_filter.configuration',
           'table_name' => 'civicrm_data_processor_filter',
           'entity' => 'DataProcessorFilter',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilter',
@@ -217,6 +226,7 @@ class CRM_Dataprocessor_DAO_DataProcessorFilter extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_TEXT,
           'title' => CRM_Dataprocessor_ExtensionUtil::ts('Default Filter Value'),
           'required' => FALSE,
+          'where' => 'civicrm_data_processor_filter.filter_value',
           'table_name' => 'civicrm_data_processor_filter',
           'entity' => 'DataProcessorFilter',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorFilter',
diff --git a/CRM/Dataprocessor/DAO/DataProcessorOutput.php b/CRM/Dataprocessor/DAO/DataProcessorOutput.php
index 292d810ab4532ebe5a701c52c69c1fc60615655c..9651e89afd387e505ebb3c3968d7424291821226 100644
--- a/CRM/Dataprocessor/DAO/DataProcessorOutput.php
+++ b/CRM/Dataprocessor/DAO/DataProcessorOutput.php
@@ -4,9 +4,9 @@
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2019
  *
- * Generated from /buildkit/build/search/sites/default/files/civicrm/ext/dataprocessor/xml/schema/CRM/Dataprocessor/DataProcessorOutput.xml
+ * Generated from /buildkit/build/search/web/sites/all/modules/civicrm/tools/extensions/dataprocessor/xml/schema/CRM/Dataprocessor/DataProcessorOutput.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:f38dc40dc234990d0664637ae1b9a8d6)
+ * (GenCodeChecksum:b084899f5823b297a409b16cc41bdf7a)
  */
 
 /**
@@ -19,26 +19,26 @@ class CRM_Dataprocessor_DAO_DataProcessorOutput extends CRM_Core_DAO {
    *
    * @var string
    */
-  static $_tableName = 'civicrm_data_processor_output';
+  public static $_tableName = 'civicrm_data_processor_output';
 
   /**
    * Should CiviCRM log any modifications to this table in the civicrm_log table.
    *
    * @var bool
    */
-  static $_log = FALSE;
+  public static $_log = FALSE;
 
   /**
    * Unique DataProcessorOutput ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Data Processor
    *
-   * @var int unsigned
+   * @var int
    */
   public $data_processor_id;
 
@@ -88,7 +88,7 @@ class CRM_Dataprocessor_DAO_DataProcessorOutput extends CRM_Core_DAO {
    */
   public static function getReferenceColumns() {
     if (!isset(Civi::$statics[__CLASS__]['links'])) {
-      Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
+      Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
       Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'data_processor_id', 'civicrm_data_processor', 'id');
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
     }
@@ -108,6 +108,7 @@ class CRM_Dataprocessor_DAO_DataProcessorOutput extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_INT,
           'description' => CRM_Dataprocessor_ExtensionUtil::ts('Unique DataProcessorOutput ID'),
           'required' => TRUE,
+          'where' => 'civicrm_data_processor_output.id',
           'table_name' => 'civicrm_data_processor_output',
           'entity' => 'DataProcessorOutput',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorOutput',
@@ -119,6 +120,7 @@ class CRM_Dataprocessor_DAO_DataProcessorOutput extends CRM_Core_DAO {
           'title' => CRM_Dataprocessor_ExtensionUtil::ts('Data Processor ID'),
           'description' => CRM_Dataprocessor_ExtensionUtil::ts('FK to Data Processor'),
           'required' => TRUE,
+          'where' => 'civicrm_data_processor_output.data_processor_id',
           'table_name' => 'civicrm_data_processor_output',
           'entity' => 'DataProcessorOutput',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorOutput',
@@ -131,6 +133,7 @@ class CRM_Dataprocessor_DAO_DataProcessorOutput extends CRM_Core_DAO {
           'required' => TRUE,
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
+          'where' => 'civicrm_data_processor_output.type',
           'table_name' => 'civicrm_data_processor_output',
           'entity' => 'DataProcessorOutput',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorOutput',
@@ -141,6 +144,7 @@ class CRM_Dataprocessor_DAO_DataProcessorOutput extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_TEXT,
           'title' => CRM_Dataprocessor_ExtensionUtil::ts('Configuration'),
           'required' => FALSE,
+          'where' => 'civicrm_data_processor_output.configuration',
           'table_name' => 'civicrm_data_processor_output',
           'entity' => 'DataProcessorOutput',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorOutput',
@@ -154,6 +158,7 @@ class CRM_Dataprocessor_DAO_DataProcessorOutput extends CRM_Core_DAO {
           'required' => FALSE,
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
+          'where' => 'civicrm_data_processor_output.permission',
           'table_name' => 'civicrm_data_processor_output',
           'entity' => 'DataProcessorOutput',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorOutput',
@@ -166,6 +171,7 @@ class CRM_Dataprocessor_DAO_DataProcessorOutput extends CRM_Core_DAO {
           'required' => FALSE,
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
+          'where' => 'civicrm_data_processor_output.api_entity',
           'table_name' => 'civicrm_data_processor_output',
           'entity' => 'DataProcessorOutput',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorOutput',
@@ -178,6 +184,7 @@ class CRM_Dataprocessor_DAO_DataProcessorOutput extends CRM_Core_DAO {
           'required' => FALSE,
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
+          'where' => 'civicrm_data_processor_output.api_action',
           'table_name' => 'civicrm_data_processor_output',
           'entity' => 'DataProcessorOutput',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorOutput',
@@ -190,6 +197,7 @@ class CRM_Dataprocessor_DAO_DataProcessorOutput extends CRM_Core_DAO {
           'required' => FALSE,
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
+          'where' => 'civicrm_data_processor_output.api_count_action',
           'table_name' => 'civicrm_data_processor_output',
           'entity' => 'DataProcessorOutput',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorOutput',
diff --git a/CRM/Dataprocessor/DAO/DataProcessorSource.php b/CRM/Dataprocessor/DAO/DataProcessorSource.php
index c9c8251e8084ee35ff9edc4f804f1b1fdd6f2871..5aab7945248b68b6b99b85867a8bc8e2bf7d0039 100644
--- a/CRM/Dataprocessor/DAO/DataProcessorSource.php
+++ b/CRM/Dataprocessor/DAO/DataProcessorSource.php
@@ -4,9 +4,9 @@
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2019
  *
- * Generated from /buildkit/build/search/sites/default/files/civicrm/ext/dataprocessor/xml/schema/CRM/Dataprocessor/DataProcessorSource.xml
+ * Generated from /buildkit/build/search/web/sites/all/modules/civicrm/tools/extensions/dataprocessor/xml/schema/CRM/Dataprocessor/DataProcessorSource.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:41ade3cbfbb5da57e4ce47f3580c7c36)
+ * (GenCodeChecksum:8b610b28b2023badbccde15e8fa1010d)
  */
 
 /**
@@ -19,26 +19,26 @@ class CRM_Dataprocessor_DAO_DataProcessorSource extends CRM_Core_DAO {
    *
    * @var string
    */
-  static $_tableName = 'civicrm_data_processor_source';
+  public static $_tableName = 'civicrm_data_processor_source';
 
   /**
    * Should CiviCRM log any modifications to this table in the civicrm_log table.
    *
    * @var bool
    */
-  static $_log = FALSE;
+  public static $_log = FALSE;
 
   /**
    * Unique DataProcessorSource ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Data Processor
    *
-   * @var int unsigned
+   * @var int
    */
   public $data_processor_id;
 
@@ -93,7 +93,7 @@ class CRM_Dataprocessor_DAO_DataProcessorSource extends CRM_Core_DAO {
    */
   public static function getReferenceColumns() {
     if (!isset(Civi::$statics[__CLASS__]['links'])) {
-      Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
+      Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
       Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'data_processor_id', 'civicrm_data_processor', 'id');
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
     }
@@ -113,6 +113,7 @@ class CRM_Dataprocessor_DAO_DataProcessorSource extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_INT,
           'description' => CRM_Dataprocessor_ExtensionUtil::ts('Unique DataProcessorSource ID'),
           'required' => TRUE,
+          'where' => 'civicrm_data_processor_source.id',
           'table_name' => 'civicrm_data_processor_source',
           'entity' => 'DataProcessorSource',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorSource',
@@ -124,6 +125,7 @@ class CRM_Dataprocessor_DAO_DataProcessorSource extends CRM_Core_DAO {
           'title' => CRM_Dataprocessor_ExtensionUtil::ts('Data Processor ID'),
           'description' => CRM_Dataprocessor_ExtensionUtil::ts('FK to Data Processor'),
           'required' => TRUE,
+          'where' => 'civicrm_data_processor_source.data_processor_id',
           'table_name' => 'civicrm_data_processor_source',
           'entity' => 'DataProcessorSource',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorSource',
@@ -134,6 +136,7 @@ class CRM_Dataprocessor_DAO_DataProcessorSource extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_INT,
           'title' => CRM_Dataprocessor_ExtensionUtil::ts('Weight'),
           'required' => FALSE,
+          'where' => 'civicrm_data_processor_source.weight',
           'table_name' => 'civicrm_data_processor_source',
           'entity' => 'DataProcessorSource',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorSource',
@@ -146,6 +149,7 @@ class CRM_Dataprocessor_DAO_DataProcessorSource extends CRM_Core_DAO {
           'required' => FALSE,
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
+          'where' => 'civicrm_data_processor_source.name',
           'table_name' => 'civicrm_data_processor_source',
           'entity' => 'DataProcessorSource',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorSource',
@@ -158,6 +162,7 @@ class CRM_Dataprocessor_DAO_DataProcessorSource extends CRM_Core_DAO {
           'required' => TRUE,
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
+          'where' => 'civicrm_data_processor_source.title',
           'table_name' => 'civicrm_data_processor_source',
           'entity' => 'DataProcessorSource',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorSource',
@@ -170,6 +175,7 @@ class CRM_Dataprocessor_DAO_DataProcessorSource extends CRM_Core_DAO {
           'required' => TRUE,
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
+          'where' => 'civicrm_data_processor_source.type',
           'table_name' => 'civicrm_data_processor_source',
           'entity' => 'DataProcessorSource',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorSource',
@@ -180,6 +186,7 @@ class CRM_Dataprocessor_DAO_DataProcessorSource extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_TEXT,
           'title' => CRM_Dataprocessor_ExtensionUtil::ts('Configuration'),
           'required' => FALSE,
+          'where' => 'civicrm_data_processor_source.configuration',
           'table_name' => 'civicrm_data_processor_source',
           'entity' => 'DataProcessorSource',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorSource',
@@ -193,6 +200,7 @@ class CRM_Dataprocessor_DAO_DataProcessorSource extends CRM_Core_DAO {
           'required' => FALSE,
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
+          'where' => 'civicrm_data_processor_source.join_type',
           'table_name' => 'civicrm_data_processor_source',
           'entity' => 'DataProcessorSource',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorSource',
@@ -203,6 +211,7 @@ class CRM_Dataprocessor_DAO_DataProcessorSource extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_TEXT,
           'title' => CRM_Dataprocessor_ExtensionUtil::ts('Join Configuration'),
           'required' => FALSE,
+          'where' => 'civicrm_data_processor_source.join_configuration',
           'table_name' => 'civicrm_data_processor_source',
           'entity' => 'DataProcessorSource',
           'bao' => 'CRM_Dataprocessor_DAO_DataProcessorSource',
diff --git a/CRM/Dataprocessor/Form/AggregateField.php b/CRM/Dataprocessor/Form/AggregateField.php
deleted file mode 100644
index 3782e89944b2482b4994f737fb12fe59b7f74a37..0000000000000000000000000000000000000000
--- a/CRM/Dataprocessor/Form/AggregateField.php
+++ /dev/null
@@ -1,109 +0,0 @@
-<?php
-
-use CRM_Dataprocessor_ExtensionUtil as E;
-
-/**
- * Form controller class
- *
- * @see https://wiki.civicrm.org/confluence/display/CRMDOC/QuickForm+Reference
- */
-class CRM_Dataprocessor_Form_AggregateField extends CRM_Core_Form {
-
-  private $dataProcessorId;
-
-  private $dataProcessor;
-
-  private $id;
-
-  /**
-   * Function to perform processing before displaying form (overrides parent function)
-   *
-   * @access public
-   */
-  function preProcess() {
-    $this->dataProcessorId = CRM_Utils_Request::retrieve('id', 'Integer');
-    $this->dataProcessor = civicrm_api3('DataProcessor', 'getsingle', array('id' => $this->dataProcessorId));
-    $this->dataProcessorClass = CRM_Dataprocessor_BAO_DataProcessor::dataProcessorToClass($this->dataProcessor, true);
-    $this->assign('data_processor_id', $this->dataProcessorId);
-
-    $title = E::ts('Data Processor Field');
-    CRM_Utils_System::setTitle($title);
-  }
-
-  public function buildQuickForm() {
-    $this->add('hidden', 'id');
-    $this->add('hidden', 'alias');
-    if ($this->_action != CRM_Core_Action::DELETE) {
-      $aggregationFieldsFormatted = array();
-      foreach($this->dataProcessorClass->getDataSources() as $dataSource) {
-        foreach($dataSource->getAvailableAggregationFields() as $field) {
-          $aggregationFieldsFormatted[$field->fieldSpecification->alias] = $field->dataSource->getSourceTitle()." :: ".$field->fieldSpecification->title;
-        }
-      }
-
-      $this->add('select', 'field', E::ts('Select Field'), $aggregationFieldsFormatted, true, array(
-        'style' => 'min-width:250px',
-        'class' => 'crm-select2 huge',
-        'placeholder' => E::ts('- select -'),
-      ));
-    }
-    if ($this->_action == CRM_Core_Action::ADD) {
-      $this->addButtons(array(
-        array('type' => 'next', 'name' => E::ts('Add'), 'isDefault' => TRUE,),
-        array('type' => 'cancel', 'name' => E::ts('Cancel'))));
-    } elseif ($this->_action == CRM_Core_Action::DELETE) {
-      $this->addButtons(array(
-        array('type' => 'next', 'name' => E::ts('Delete'), 'isDefault' => TRUE,),
-        array('type' => 'cancel', 'name' => E::ts('Cancel'))));
-    }
-    parent::buildQuickForm();
-  }
-
-  function setDefaultValues() {
-    $defaults = [];
-    $defaults['id'] = $this->dataProcessorId;
-    $defaults['alias'] =CRM_Utils_Request::retrieve('alias', 'String');
-    return $defaults;
-  }
-
-  /**
-   * Function that can be defined in Form to override or.
-   * perform specific action on cancel action
-   */
-  public function cancelAction() {
-    $this->dataProcessorId = CRM_Utils_Request::retrieve('data_processor_id', 'Integer');
-    $redirectUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/edit', array('reset' => 1, 'action' => 'update', 'id' => $this->dataProcessorId));
-    CRM_Utils_System::redirect($redirectUrl);
-  }
-
-  public function postProcess() {
-    $session = CRM_Core_Session::singleton();
-    $redirectUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/edit', array('reset' => 1, 'action' => 'update', 'id' => $this->dataProcessorId));
-    if ($this->_action == CRM_Core_Action::DELETE) {
-      $values = $this->exportValues();
-      $aggregation = $this->dataProcessor['aggregation'];
-      $this->dataProcessor['aggregation'] = array();
-      foreach($aggregation as $alias) {
-        if ($alias != $values['alias']) {
-          $this->dataProcessor['aggregation'][] = $alias;
-        }
-      }
-      $result = civicrm_api3('DataProcessor', 'create', $this->dataProcessor);
-
-      $session->setStatus(E::ts('Field removed'), E::ts('Removed'), 'success');
-      CRM_Utils_System::redirect($redirectUrl);
-    }
-
-    $values = $this->exportValues();
-    $aggregation = $this->dataProcessor['aggregation'];
-    if (!in_array($values['field'], $aggregation)) {
-      $aggregation[] = $values['field'];
-    }
-    $this->dataProcessor['aggregation'] = $aggregation;
-    $result = civicrm_api3('DataProcessor', 'create', $this->dataProcessor);
-
-    CRM_Utils_System::redirect($redirectUrl);
-    parent::postProcess();
-  }
-
-}
\ No newline at end of file
diff --git a/CRM/Dataprocessor/Form/DataProcessor.php b/CRM/Dataprocessor/Form/DataProcessor.php
index 3b02f3a7082a57966918b0587da0c14219515a23..41ad721c9b9641406fccbb0de1e98f2917e859cf 100644
--- a/CRM/Dataprocessor/Form/DataProcessor.php
+++ b/CRM/Dataprocessor/Form/DataProcessor.php
@@ -74,15 +74,12 @@ class CRM_Dataprocessor_Form_DataProcessor extends CRM_Core_Form {
       $this->addSources();
       $this->addFields();
       $this->addFilters();
-      $this->addAggregateFields();
       $this->addOutputs();
       $dataSourceAddUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/source', 'reset=1&action=add&data_processor_id='.$this->dataProcessorId, TRUE);
-      $addAggregateFieldUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/aggregate_field', 'reset=1&action=add&id='.$this->dataProcessorId, TRUE);
       $addFieldUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/field', 'reset=1&action=add&data_processor_id='.$this->dataProcessorId, TRUE);
       $addFilterUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/filter', 'reset=1&action=add&data_processor_id='.$this->dataProcessorId, TRUE);
       $outputAddUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/output', 'reset=1&action=add&data_processor_id='.$this->dataProcessorId, TRUE);
       $this->assign('addDataSourceUrl', $dataSourceAddUrl);
-      $this->assign('addAggregateFieldUrl', $addAggregateFieldUrl);
       $this->assign('addFieldUrl', $addFieldUrl);
       $this->assign('addFilterUrl', $addFilterUrl);
       $this->assign('addOutputUrl', $outputAddUrl);
@@ -119,11 +116,6 @@ class CRM_Dataprocessor_Form_DataProcessor extends CRM_Core_Form {
     $this->assign('filters', $filters);
   }
 
-  protected function addAggregateFields() {
-    $fields = $this->dataProcessor['aggregation'];
-    $this->assign('aggregateFields', $fields);
-  }
-
   protected function addOutputs() {
     $factory = dataprocessor_get_factory();
     $types = $factory->getOutputs();
diff --git a/CRM/Dataprocessor/Upgrader.php b/CRM/Dataprocessor/Upgrader.php
index 0a663251837286198bc5ed64d602326d5be43ee9..aafee48502f934ec3e62d12f69a22495b9c16e02 100644
--- a/CRM/Dataprocessor/Upgrader.php
+++ b/CRM/Dataprocessor/Upgrader.php
@@ -13,8 +13,8 @@ class CRM_Dataprocessor_Upgrader extends CRM_Dataprocessor_Upgrader_Base {
   public function uninstall() {
     // Remove output from menu
     $dao = CRM_Core_DAO::executeQuery("SELECT configuration FROM civicrm_data_processor_output");
-    while($dao->fetch()) {
-      $configuration = json_decode($dao->configuration, true);
+    while ($dao->fetch()) {
+      $configuration = json_decode($dao->configuration, TRUE);
       if (isset($configuration['navigation_id']) && $configuration['navigation_id']) {
         $navId = $configuration['navigation_id'];
         \CRM_Core_BAO_Navigation::processDelete($navId);
@@ -23,4 +23,15 @@ class CRM_Dataprocessor_Upgrader extends CRM_Dataprocessor_Upgrader_Base {
     \CRM_Core_BAO_Navigation::resetNavigation();
   }
 
+  /**
+   * Upgrade after refactor of Aggregation functionality.
+   *
+   * @return bool
+   */
+  public function upgrade_1001() {
+    CRM_Dataprocessor_Upgrader_Version_1_1_0::upgradeAggregationFields();
+    CRM_Core_DAO::executeQuery("ALTER TABLE `civicrm_data_processor` DROP `aggregation`;");
+    return TRUE;
+  }
+
 }
diff --git a/CRM/Dataprocessor/Upgrader/Version/1/1/0.php b/CRM/Dataprocessor/Upgrader/Version/1/1/0.php
new file mode 100644
index 0000000000000000000000000000000000000000..a324a7d3ccaa32f2fa42fd368851cf9e2054b637
--- /dev/null
+++ b/CRM/Dataprocessor/Upgrader/Version/1/1/0.php
@@ -0,0 +1,78 @@
+<?php
+/**
+ * @author Jaap Jansma <jaap.jansma@civicoop.org>
+ * @license AGPL-3.0
+ */
+
+use CRM_Dataprocessor_ExtensionUtil as E;
+
+class CRM_Dataprocessor_Upgrader_Version_1_1_0 {
+
+  /**
+   * Move the aggregation fields from the data processor table and
+   * add them as a new field with the flag is_aggregate is set.
+   */
+  public static function upgradeAggregationFields() {
+    $updatedDataProcessors = array();
+    $dao = CRM_Core_DAO::executeQuery("select * from civicrm_data_processor where aggregation is not null;");
+    while($dao->fetch()) {
+      $aggreagtion = json_decode($dao->aggregation, true);
+      if (count($aggreagtion)) {
+        foreach($aggreagtion as $aggr_field) {
+          list($datasource, $field) = self::splitDataSourceAndFieldName($aggr_field, $dao->id);
+          try {
+            civicrm_api3('DataProcessorField', 'create', array(
+              'data_processor_id' => $dao->id,
+              'type' => 'raw',
+              'name' => $aggr_field,
+              'title' => $aggr_field,
+              'configuration' => array(
+                'is_aggregate' => 1,
+                'datasource' => $datasource,
+                'field' => $field,
+              )
+            ));
+            $updatedDataProcessors[] = $dao->title;
+          } catch (\Exception $e) {
+            CRM_Core_Session::setStatus(E::ts('Error during upgrading data processor: %1', [1=>$dao->title]), '', 'error');
+          }
+        }
+      }
+    }
+    if (count($updatedDataProcessors)) {
+      $message = E::ts('The following data processors have been updated. Please check them if they still work. The aggregate fields have been added to the field section');
+      $message .= '<ul>';
+      foreach ($updatedDataProcessors as $updatedDataProcessor) {
+        $message .= '<li>' . $updatedDataProcessor . '</li>';
+      }
+      $message .= '</ul>';
+      CRM_Core_Session::setStatus($message, E::ts('Update data processor configuration'), 'info', ['expires' => 0]);
+    }
+  }
+
+  /**
+   * @param $fieldName
+   * @param $data_processor_id
+   * @return array
+   */
+  private static function splitDataSourceAndFieldName($fieldName, $data_processor_id) {
+    $nameParts = explode("_", $fieldName);
+    $name = '';
+    while ($namePart = array_shift($nameParts)) {
+      $name .= $namePart;
+      $sql = "SELECT `name` FROM `civicrm_data_processor_source` WHERE `data_processor_id` = %1 AND `name` = %2";
+      $sqlParams[1] = [$data_processor_id, 'Integer'];
+      $sqlParams[2] = [$name, 'String'];
+      $sourceName = CRM_Core_DAO::singleValueQuery($sql, $sqlParams);
+      if ($sourceName) {
+        return array(
+          $sourceName,
+          implode("_", $nameParts),
+        );
+      }
+      $name .= '_';
+    }
+    return array();
+  }
+
+}
diff --git a/Civi/DataProcessor/DataSpecification/CountFieldSpecification.php b/Civi/DataProcessor/DataSpecification/CountFieldSpecification.php
deleted file mode 100644
index 47d06604860fb901fb2ff3386c5f381f5710eacd..0000000000000000000000000000000000000000
--- a/Civi/DataProcessor/DataSpecification/CountFieldSpecification.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-/**
- * @author Jaap Jansma <jaap.jansma@civicoop.org>
- * @license AGPL-3.0
- */
-
-namespace Civi\DataProcessor\DataSpecification;
-
-class CountFieldSpecification extends FieldSpecification {
-
-  /**
-   * Returns the select statement for this field.
-   * E.g. COUNT(civicrm_contact.id) AS contact_id_count
-   *
-   * @param String $table_alias
-   * @return string
-   */
-  public function getSqlSelectStatement($table_alias) {
-    return "COUNT(DISTINCT `{$table_alias}`.`{$this->name}`) AS `{$this->alias}`";
-  }
-
-}
\ No newline at end of file
diff --git a/Civi/DataProcessor/DataSpecification/MaxFieldSpecification.php b/Civi/DataProcessor/DataSpecification/MaxFieldSpecification.php
deleted file mode 100644
index 16d3e1a4bc52d092569246f2044e4bde8ab24599..0000000000000000000000000000000000000000
--- a/Civi/DataProcessor/DataSpecification/MaxFieldSpecification.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-/**
- * @author Jaap Jansma <jaap.jansma@civicoop.org>
- * @license AGPL-3.0
- */
-
-namespace Civi\DataProcessor\DataSpecification;
-
-class MaxFieldSpecification extends FieldSpecification {
-
-  /**
-   * Returns the select statement for this field.
-   * E.g. COUNT(civicrm_contact.id) AS contact_id_count
-   *
-   * @param String $table_alias
-   * @return string
-   */
-  public function getSqlSelectStatement($table_alias) {
-    return "MAX(`{$table_alias}`.`{$this->name}`) AS `{$this->alias}`";
-  }
-
-}
\ No newline at end of file
diff --git a/api/v3/DataProcessor.php b/api/v3/DataProcessor.php
index f2417d9006e85f4311e35da4e2148f6f7ccefda9..13a9412b70c118d80bcafe2b86f04666124cb3f5 100644
--- a/api/v3/DataProcessor.php
+++ b/api/v3/DataProcessor.php
@@ -97,11 +97,6 @@ function civicrm_api3_data_processor_get($params) {
     } else {
       $return['values'][$id]['configuration'] = array();
     }
-    if (isset($value['aggregation'])) {
-      $return['values'][$id]['aggregation'] = json_decode($value['aggregation'], TRUE);
-    } else {
-      $return['values'][$id]['aggregation'] = array();
-    }
     if (isset($value['storage_configuration'])) {
       $return['values'][$id]['storage_configuration'] = json_decode($value['storage_configuration'], TRUE);
     } else {
diff --git a/dataprocessor.civix.php b/dataprocessor.civix.php
index b4cbf227932589c2da71f7a2ad05218a89cfcefc..ca12f343bffe55b61eb011f906d002b0700e6282 100644
--- a/dataprocessor.civix.php
+++ b/dataprocessor.civix.php
@@ -82,7 +82,7 @@ use CRM_Dataprocessor_ExtensionUtil as E;
 /**
  * (Delegated) Implements hook_civicrm_config().
  *
- * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_config
+ * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_config
  */
 function _dataprocessor_civix_civicrm_config(&$config = NULL) {
   static $configured = FALSE;
@@ -112,7 +112,7 @@ function _dataprocessor_civix_civicrm_config(&$config = NULL) {
  *
  * @param $files array(string)
  *
- * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_xmlMenu
+ * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_xmlMenu
  */
 function _dataprocessor_civix_civicrm_xmlMenu(&$files) {
   foreach (_dataprocessor_civix_glob(__DIR__ . '/xml/Menu/*.xml') as $file) {
@@ -123,7 +123,7 @@ function _dataprocessor_civix_civicrm_xmlMenu(&$files) {
 /**
  * Implements hook_civicrm_install().
  *
- * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_install
+ * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_install
  */
 function _dataprocessor_civix_civicrm_install() {
   _dataprocessor_civix_civicrm_config();
@@ -135,7 +135,7 @@ function _dataprocessor_civix_civicrm_install() {
 /**
  * Implements hook_civicrm_postInstall().
  *
- * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_postInstall
+ * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_postInstall
  */
 function _dataprocessor_civix_civicrm_postInstall() {
   _dataprocessor_civix_civicrm_config();
@@ -149,7 +149,7 @@ function _dataprocessor_civix_civicrm_postInstall() {
 /**
  * Implements hook_civicrm_uninstall().
  *
- * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_uninstall
+ * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_uninstall
  */
 function _dataprocessor_civix_civicrm_uninstall() {
   _dataprocessor_civix_civicrm_config();
@@ -161,7 +161,7 @@ function _dataprocessor_civix_civicrm_uninstall() {
 /**
  * (Delegated) Implements hook_civicrm_enable().
  *
- * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_enable
+ * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_enable
  */
 function _dataprocessor_civix_civicrm_enable() {
   _dataprocessor_civix_civicrm_config();
@@ -175,7 +175,7 @@ function _dataprocessor_civix_civicrm_enable() {
 /**
  * (Delegated) Implements hook_civicrm_disable().
  *
- * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_disable
+ * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_disable
  * @return mixed
  */
 function _dataprocessor_civix_civicrm_disable() {
@@ -196,7 +196,7 @@ function _dataprocessor_civix_civicrm_disable() {
  * @return mixed  based on op. for 'check', returns array(boolean) (TRUE if upgrades are pending)
  *                for 'enqueue', returns void
  *
- * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_upgrade
+ * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_upgrade
  */
 function _dataprocessor_civix_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) {
   if ($upgrader = _dataprocessor_civix_upgrader()) {
@@ -259,7 +259,7 @@ function _dataprocessor_civix_find_files($dir, $pattern) {
  *
  * Find any *.mgd.php files, merge their content, and return.
  *
- * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_managed
+ * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_managed
  */
 function _dataprocessor_civix_civicrm_managed(&$entities) {
   $mgdFiles = _dataprocessor_civix_find_files(__DIR__, '*.mgd.php');
@@ -285,7 +285,7 @@ function _dataprocessor_civix_civicrm_managed(&$entities) {
  *
  * Note: This hook only runs in CiviCRM 4.4+.
  *
- * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_caseTypes
+ * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_caseTypes
  */
 function _dataprocessor_civix_civicrm_caseTypes(&$caseTypes) {
   if (!is_dir(__DIR__ . '/xml/case')) {
@@ -314,7 +314,7 @@ function _dataprocessor_civix_civicrm_caseTypes(&$caseTypes) {
  *
  * Note: This hook only runs in CiviCRM 4.5+.
  *
- * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
+ * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_angularModules
  */
 function _dataprocessor_civix_civicrm_angularModules(&$angularModules) {
   if (!is_dir(__DIR__ . '/ang')) {
@@ -332,6 +332,25 @@ function _dataprocessor_civix_civicrm_angularModules(&$angularModules) {
   }
 }
 
+/**
+ * (Delegated) Implements hook_civicrm_themes().
+ *
+ * Find any and return any files matching "*.theme.php"
+ */
+function _dataprocessor_civix_civicrm_themes(&$themes) {
+  $files = _dataprocessor_civix_glob(__DIR__ . '/*.theme.php');
+  foreach ($files as $file) {
+    $themeMeta = include $file;
+    if (empty($themeMeta['name'])) {
+      $themeMeta['name'] = preg_replace(':\.theme\.php$:', '', basename($file));
+    }
+    if (empty($themeMeta['ext'])) {
+      $themeMeta['ext'] = E::LONG_NAME;
+    }
+    $themes[$themeMeta['name']] = $themeMeta;
+  }
+}
+
 /**
  * Glob wrapper which is guaranteed to return an array.
  *
@@ -432,17 +451,11 @@ function _dataprocessor_civix_fixNavigationMenuItems(&$nodes, &$maxNavID, $paren
 /**
  * (Delegated) Implements hook_civicrm_alterSettingsFolders().
  *
- * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_alterSettingsFolders
+ * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterSettingsFolders
  */
 function _dataprocessor_civix_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) {
-  static $configured = FALSE;
-  if ($configured) {
-    return;
-  }
-  $configured = TRUE;
-
   $settingsDir = __DIR__ . DIRECTORY_SEPARATOR . 'settings';
-  if (is_dir($settingsDir) && !in_array($settingsDir, $metaDataFolders)) {
+  if (!in_array($settingsDir, $metaDataFolders) && is_dir($settingsDir)) {
     $metaDataFolders[] = $settingsDir;
   }
 }
@@ -452,7 +465,7 @@ function _dataprocessor_civix_civicrm_alterSettingsFolders(&$metaDataFolders = N
  *
  * Find any *.entityType.php files, merge their content, and return.
  *
- * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_entityTypes
+ * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_entityTypes
  */
 
 function _dataprocessor_civix_civicrm_entityTypes(&$entityTypes) {
diff --git a/sql/auto_install.sql b/sql/auto_install.sql
index 664ff4f43f8d9c4f96c4cebaacb1d55fb1cec462..b13c428b9b8042dc57b2081a5c9cf6d6608d45d5 100644
--- a/sql/auto_install.sql
+++ b/sql/auto_install.sql
@@ -88,7 +88,6 @@ CREATE TABLE `civicrm_data_processor` (
      `title` varchar(255) NOT NULL   ,
      `type` varchar(255) NOT NULL   ,
      `configuration` text NULL   ,
-     `aggregation` text NULL   ,
      `is_active` tinyint NOT NULL   ,
      `description` text NULL   ,
      `storage_type` varchar(255) NULL   ,
diff --git a/sql/update1_1_0.sql b/sql/update1_1_0.sql
deleted file mode 100644
index 8f775d0193615b9057d06cba16cf8ba17b966224..0000000000000000000000000000000000000000
--- a/sql/update1_1_0.sql
+++ /dev/null
@@ -1 +0,0 @@
-ALTER TABLE `civicrm_data_processor_field` ADD COLUMN `is_aggregate` tinyint NULL;
diff --git a/templates/CRM/Dataprocessor/Form/AggregateField.tpl b/templates/CRM/Dataprocessor/Form/AggregateField.tpl
deleted file mode 100644
index b33955e14680de2e74698062a4be2527d418fa95..0000000000000000000000000000000000000000
--- a/templates/CRM/Dataprocessor/Form/AggregateField.tpl
+++ /dev/null
@@ -1,28 +0,0 @@
-{crmScope extensionKey='dataprocessor'}
-<div class="crm-submit-buttons">
-    {include file="CRM/common/formButtons.tpl" location="top"}
-</div>
-
-{if $action eq 8}
-    {* Are you sure to delete form *}
-    <h3>{ts}Delete Field{/ts}</h3>
-    <div class="crm-block crm-form-block crm-data-processor_label-block">
-        <div class="crm-section">{ts}Are you sure to remove this field?{/ts}</div>
-    </div>
-{else}
-
-    {* block for rule data *}
-    <h3>{ts}Aggregation Field{/ts}</h3>
-    <div class="crm-block crm-form-block crm-data-processor_source-block">
-        <div class="crm-section">
-            <div class="label">{$form.field.label}</div>
-            <div class="content">{$form.field.html}</div>
-            <div class="clear"></div>
-        </div>
-    </div>
-{/if}
-
-<div class="crm-submit-buttons">
-    {include file="CRM/common/formButtons.tpl" location="bottom"}
-</div>
-{/crmScope}
\ No newline at end of file
diff --git a/templates/CRM/Dataprocessor/Form/DataProcessor.tpl b/templates/CRM/Dataprocessor/Form/DataProcessor.tpl
index aa481e24e6aeba707ecf92a739986c74c662b31f..de1a0d677d881d725bf91ca95ae074477fc36a6b 100644
--- a/templates/CRM/Dataprocessor/Form/DataProcessor.tpl
+++ b/templates/CRM/Dataprocessor/Form/DataProcessor.tpl
@@ -53,7 +53,6 @@
       <tr>
         <td style="width: 50%;">
           {include file="CRM/Dataprocessor/Form/DataProcessorBlocks/Sources.tpl"}
-          {include file="CRM/Dataprocessor/Form/DataProcessorBlocks/AggregateFields.tpl"}
           {include file="CRM/Dataprocessor/Form/DataProcessorBlocks/Outputs.tpl"}
         </td>
         <td style="width: 50%;">
@@ -89,4 +88,4 @@
 <div class="crm-submit-buttons">
   {include file="CRM/common/formButtons.tpl" location="bottom"}
 </div>
-{/crmScope}
\ No newline at end of file
+{/crmScope}
diff --git a/templates/CRM/Dataprocessor/Form/DataProcessorBlocks/AggregateFields.tpl b/templates/CRM/Dataprocessor/Form/DataProcessorBlocks/AggregateFields.tpl
deleted file mode 100644
index a72211da90befb796295da6e8fcd92edb86c3767..0000000000000000000000000000000000000000
--- a/templates/CRM/Dataprocessor/Form/DataProcessorBlocks/AggregateFields.tpl
+++ /dev/null
@@ -1,24 +0,0 @@
-{crmScope extensionKey='dataprocessor'}
-<h3>{ts}Aggregation{/ts}</h3>
-<div class="crm-block crm-form-block crm-data-processor_source-block">
-    <table>
-        <tr>
-            <th>{ts}Field{/ts}</th>
-            <th></th>
-        </tr>
-        {foreach from=$aggregateFields item=field key=alias}
-            <tr>
-                <td>{$field}</td>
-                <td class="right nowrap" style="width: 100px;">
-                    <a class="crm-hover-button" href="{crmURL p="civicrm/dataprocessor/form/aggregate_field" q="reset=1&action=delete&id=`$data_processor_id`&alias=`$alias`"}">{ts}Remove{/ts}</a>
-                </td>
-            </tr>
-        {/foreach}
-    </table>
-
-    <div class="crm-submit-buttons">
-        <a class="add button" title="{ts}Add Aggregate Field{/ts}" href="{$addAggregateFieldUrl}">
-            <i class='crm-i fa-plus-circle'></i> {ts}Add Aggregate Field{/ts}</a>
-    </div>
-</div>
-{/crmScope}
\ No newline at end of file
diff --git a/xml/Menu/dataprocessor.xml b/xml/Menu/dataprocessor.xml
index 693306e000859e61f8d16f92f34b6a5286f6e640..e8f44a8ab4d289997f8d62734696bf1b08d21653 100644
--- a/xml/Menu/dataprocessor.xml
+++ b/xml/Menu/dataprocessor.xml
@@ -49,13 +49,6 @@
     <access_arguments>access CiviCRM</access_arguments>
     <access_arguments>administer CiviCRM</access_arguments>
   </item>
-  <item>
-    <path>civicrm/dataprocessor/form/aggregate_field</path>
-    <page_callback>CRM_Dataprocessor_Form_AggregateField</page_callback>
-    <title>DataProcessor</title>
-    <access_arguments>access CiviCRM</access_arguments>
-    <access_arguments>administer CiviCRM</access_arguments>
-  </item>
   <item>
     <path>civicrm/dataprocessor/form/output</path>
     <page_callback>CRM_Dataprocessor_Form_Output</page_callback>
diff --git a/xml/schema/CRM/Dataprocessor/DataProcessor.xml b/xml/schema/CRM/Dataprocessor/DataProcessor.xml
index ebcc8997a3632ed5b51337cf9bf18c9213aaa244..963d12fff7d778f92e22fecebdd6ad3905165021 100644
--- a/xml/schema/CRM/Dataprocessor/DataProcessor.xml
+++ b/xml/schema/CRM/Dataprocessor/DataProcessor.xml
@@ -45,14 +45,6 @@
     <length>255</length>
     <serialize>JSON</serialize>
   </field>
-  <field>
-    <name>aggregation</name>
-    <title>Aggregation Fields</title>
-    <type>text</type>
-    <required>false</required>
-    <length>255</length>
-    <serialize>JSON</serialize>
-  </field>
   <field>
     <name>is_active</name>
     <title>Is active</title>