Skip to content

Commit

Permalink
MID-8053: added m_connector.available for the generic repo
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed Aug 23, 2022
1 parent 1e31930 commit 3b62cac
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/sql/generic-old/h2-4.6-all.sql
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ CREATE TABLE m_connector (
framework VARCHAR(255),
name_norm VARCHAR(255),
name_orig VARCHAR(255),
available BOOLEAN,
oid VARCHAR(36) NOT NULL,
PRIMARY KEY (oid)
);
Expand Down
3 changes: 3 additions & 0 deletions config/sql/generic-old/h2-upgrade-4.5-4.6.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
-- resource templates/inheritance
ALTER TABLE m_resource ADD template BOOLEAN;

-- MID-8053: "Active" connectors detection
ALTER TABLE m_connector ADD available BOOLEAN;

-- WRITE CHANGES ABOVE ^^
UPDATE m_global_metadata SET value = '4.6' WHERE name = 'databaseSchemaVersion';
1 change: 1 addition & 0 deletions config/sql/generic-old/oracle-4.6-all.sql
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ CREATE TABLE m_connector (
framework VARCHAR2(255 CHAR),
name_norm VARCHAR2(255 CHAR),
name_orig VARCHAR2(255 CHAR),
available NUMBER(1, 0),
oid VARCHAR2(36 CHAR) NOT NULL,
PRIMARY KEY (oid)
) INITRANS 30;
Expand Down
3 changes: 3 additions & 0 deletions config/sql/generic-old/oracle-upgrade-4.5-4.6.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
-- resource templates/inheritance
ALTER TABLE m_resource ADD template NUMBER(1, 0);

-- MID-8053: "Active" connectors detection
ALTER TABLE m_connector ADD available NUMBER(1, 0);

-- WRITE CHANGES ABOVE ^^
UPDATE m_global_metadata SET value = '4.6' WHERE name = 'databaseSchemaVersion';
COMMIT;
1 change: 1 addition & 0 deletions config/sql/generic-old/postgresql-4.6-all.sql
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ CREATE TABLE m_connector (
framework VARCHAR(255),
name_norm VARCHAR(255),
name_orig VARCHAR(255),
available BOOLEAN,
oid VARCHAR(36) NOT NULL,
PRIMARY KEY (oid)
);
Expand Down
3 changes: 3 additions & 0 deletions config/sql/generic-old/postgresql-upgrade-4.5-4.6.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
-- resource templates/inheritance
ALTER TABLE m_resource ADD template BOOLEAN;

-- MID-8053: "Active" connectors detection
ALTER TABLE m_connector ADD available BOOLEAN;

-- WRITE CHANGES ABOVE ^^
UPDATE m_global_metadata SET value = '4.6' WHERE name = 'databaseSchemaVersion';
COMMIT;
1 change: 1 addition & 0 deletions config/sql/generic-old/sqlserver-4.5-all.sql
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ CREATE TABLE m_connector (
framework NVARCHAR(255) COLLATE database_default,
name_norm NVARCHAR(255) COLLATE database_default,
name_orig NVARCHAR(255) COLLATE database_default,
available BIT,
oid NVARCHAR(36) COLLATE database_default NOT NULL,
PRIMARY KEY (oid)
);
Expand Down
3 changes: 3 additions & 0 deletions config/sql/generic-old/sqlserver-upgrade-4.5-4.6.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
-- resource templates/inheritance
ALTER TABLE m_resource ADD template BIT;

-- MID-8053: "Active" connectors detection
ALTER TABLE m_connector ADD available BIT;

-- WRITE CHANGES ABOVE ^^
GO
UPDATE m_global_metadata SET value = '4.6' WHERE name = 'databaseSchemaVersion';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class RConnector extends RObject {
private String connectorVersion;
private String connectorBundle;
private Set<String> targetSystemType;
private Boolean available;

@Embedded
public REmbeddedReference getConnectorHostRef() {
Expand All @@ -59,6 +60,11 @@ public String getConnectorVersion() {
return connectorVersion;
}

@Column
public Boolean getAvailable() {
return available;
}

@ElementCollection
@ForeignKey(name = "fk_connector_target_system")
@CollectionTable(name = "m_connector_target_system", joinColumns = {
Expand Down Expand Up @@ -112,6 +118,10 @@ public void setTargetSystemType(Set<String> targetSystemType) {
this.targetSystemType = targetSystemType;
}

public void setAvailable(Boolean available) {
this.available = available;
}

// dynamically called
public static void copyFromJAXB(ConnectorType jaxb, RConnector repo, RepositoryContext repositoryContext,
IdGeneratorResult generatorResult) throws DtoTranslationException {
Expand All @@ -123,6 +133,7 @@ public static void copyFromJAXB(ConnectorType jaxb, RConnector repo, RepositoryC
repo.setConnectorVersion(jaxb.getConnectorVersion());
repo.setFramework(jaxb.getFramework());
repo.setConnectorHostRef(RUtil.jaxbRefToEmbeddedRepoRef(jaxb.getConnectorHostRef(), repositoryContext.relationRegistry));
repo.setAvailable(jaxb.isAvailable());

try {
repo.setTargetSystemType(RUtil.listToSet(jaxb.getTargetSystemType()));
Expand Down

0 comments on commit 3b62cac

Please sign in to comment.