Skip to content

Commit

Permalink
Initial implementation of SqlSource (CFM-312) and SyncJob (CFM-372)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benn Oshrin committed Jul 2, 2024
1 parent 5f954d6 commit c2d6cd3
Show file tree
Hide file tree
Showing 26 changed files with 2,309 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,66 @@
msgid "controller.SqlProvisioners"
msgstr "{0,plural,=1{SQL Provisioner} other{SQL Provisioners}}"

msgid "enumeration.SqlSourceTableModeEnum.FL"
msgstr "Flat"

msgid "enumeration.SqlSourceTableModeEnum.RL"
msgstr "Relational"

msgid "error.table_prefix"
msgstr "Table Name Prefix must be alphanumeric and end with an underscore"

msgid "error.SqlSources.threshold"
msgstr "Aborting sync due to {0}% of records changed (threshold is {1}%)"

msgid "error.SqlSources.type"
msgstr "Type must be set when using Flat Mode"

msgid "field.SqlProvisioners.table_prefix"
msgstr "Table Name Prefix"

msgid "field.SqlProvisioners.table_prefix.desc"
msgstr "Prefix used when constructing table names, must be alphanumeric and end with an underscore (_)"

msgid "field.SqlSources.address_type_id"
msgstr "Address Type"

msgid "field.SqlSources.email_address_type_id"
msgstr "Email Address Type"

msgid "field.SqlSources.identifier_type_id"
msgstr "Identifier Type"

msgid "field.SqlSources.name_type_id"
msgstr "Name Type"

msgid "field.SqlSources.pronouns_type_id"
msgstr "Pronouns Type"

msgid "field.SqlSources.source_table"
msgstr "Source Table"

msgid "field.SqlSources.table_mode"
msgstr "Table Mode"

msgid "field.SqlSources.telephone_number_type_id"
msgstr "Telephone Number Type"

msgid "field.SqlSources.threshold_check"
msgstr "Check Threshold"

msgid "field.SqlSources.threshold_check.desc"
msgstr "If set, and this percentage of records have changed, a full sync will not be performed"

msgid "field.SqlSources.threshold_override"
msgstr "Threshold Override"

msgid "field.SqlSources.threshold_override.desc"
msgstr "If set, and the next run exceeds the Check Threshold, complete the sync anyway"

msgid "field.SqlSources.url_type_id"
msgstr "URL Type"

msgid "operation.reapply"
msgstr "Reapply Target Database Schema"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
/**
* COmanage Registry SQL Sources Controller
*
* Portions licensed to the University Corporation for Advanced Internet
* Development, Inc. ("UCAID") under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership.
*
* UCAID licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @link https://www.internet2.edu/comanage COmanage Project
* @package registry-plugins
* @since COmanage Registry v5.0.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

declare(strict_types=1);

namespace SqlConnector\Controller;

use App\Controller\StandardPluginController;

class SqlSourcesController extends StandardPluginController {
public $paginate = [
'order' => [
'SqlSources.id' => 'asc'
]
];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/**
* COmanage Registry SQL Source Table Mode Enum
*
* Portions licensed to the University Corporation for Advanced Internet
* Development, Inc. ("UCAID") under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership.
*
* UCAID licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @link https://www.internet2.edu/comanage COmanage Project
* @package registry-plugins
* @since COmanage Registry v5.0.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

declare(strict_types = 1);

namespace SqlConnector\Lib\Enum;

use App\Lib\Enum\StandardEnum;

class SqlSourceTableModeEnum extends StandardEnum {
const Flat = 'FL';
const Relational = 'RL';
}
49 changes: 49 additions & 0 deletions app/availableplugins/SqlConnector/src/Model/Entity/SqlSource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php
/**
* COmanage Registry SQL Source Table
*
* Portions licensed to the University Corporation for Advanced Internet
* Development, Inc. ("UCAID") under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership.
*
* UCAID licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @link https://www.internet2.edu/comanage COmanage Project
* @package registry-plugins
* @since COmanage Registry v5.0.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

declare(strict_types=1);

namespace SqlConnector\Model\Entity;

use Cake\ORM\Entity;

class SqlSource extends Entity {
/**
* Fields that can be mass assigned using newEntity() or patchEntity().
*
* Note that when '*' is set to true, this allows all unspecified fields to
* be mass assigned. For security purposes, it is advised to set '*' to false
* (or remove it), and explicitly make individual fields accessible as needed.
*
* @var array<string, bool>
*/
protected $_accessible = [
'*' => true,
'id' => false,
'slug' => false,
];
}
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,8 @@ public function validationDefault(Validator $validator): Validator {

$this->registerStringValidation($validator, $schema, 'table_prefix', true);

// Table prefixes must be alphanumeric and end in an underscore
// Table prefixes must be alphanumeric and end in an underscore.
// (We don't use validateSqlIdentifier because of the trailing underscore requirement.)
$validator->add('table_prefix', [
'format' => [
'rule' => function ($value, $context) {
Expand Down
Loading

0 comments on commit c2d6cd3

Please sign in to comment.