Skip to content

Commit

Permalink
(#101) Added puzzles and skeleton for latter implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
rocket-3 committed Oct 25, 2021
1 parent 67bb30f commit cddf0ed
Show file tree
Hide file tree
Showing 13 changed files with 582 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (C) 2018-2021 FusionSoft
*
* Licensed 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.
*/
package org.fusionsoft.database.snapshot.objects.dbms.postgres;

import java.sql.Connection;
import org.fusionsoft.database.snapshot.DbObject;
import org.fusionsoft.database.snapshot.Objects;
import org.fusionsoft.database.snapshot.objects.ObjectsOfScalar;
import org.fusionsoft.lib.collection.ListOfResultSet;

/**
* The type of {@link Objects} that can be constructed of connection to Postgres DBMS.
* @since 0.1
* @todo #101:30min Adapt query for constraints from DbGit.
* @checkstyle StringLiteralsConcatenationCheck (100 lines)
*/
public class PgConstraints extends ObjectsOfScalar {

/**
* Instantiates a new Postgres constraints.
* @param connection The Connection to be encapsulated.
*/
public PgConstraints(final Connection connection) {
super(
() ->
new ListOfResultSet<DbObject<?>>(
PostgresSchemaOfResultSet::new,
() -> connection.createStatement().executeQuery(
""
)
)
);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (C) 2018-2021 FusionSoft
*
* Licensed 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.
*/
package org.fusionsoft.database.snapshot.objects.dbms.postgres;

import java.sql.Connection;
import org.cactoos.iterable.IterableOf;
import org.fusionsoft.database.snapshot.Objects;
import org.fusionsoft.database.snapshot.objects.ObjectsOfScalar;

/**
* The type of {@link Objects} that can be constructed of connection to Postgres DBMS.
* @since 0.1
* @todo #101:30min Consider solutions hierarchy for fetching data.
* @checkstyle StringLiteralsConcatenationCheck (100 lines)
*/
@SuppressWarnings("PMD")
public class PgData extends ObjectsOfScalar {

/**
* Instantiates a new Postgres ... .
* @param connection The Connection to be encapsulated.
*/
public PgData(final Connection connection) {
super(
() -> new IterableOf<>()
);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (C) 2018-2021 FusionSoft
*
* Licensed 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.
*/
package org.fusionsoft.database.snapshot.objects.dbms.postgres;

import java.sql.Connection;
import org.cactoos.iterable.IterableOf;
import org.fusionsoft.database.snapshot.Objects;
import org.fusionsoft.database.snapshot.objects.ObjectsOfScalar;

/**
* The type of {@link Objects} that can be constructed of connection to Postgres DBMS.
* @since 0.1
* @todo #101:30min Adapt query for domains from DbGit.
* @checkstyle StringLiteralsConcatenationCheck (100 lines)
*/
@SuppressWarnings("PMD")
public class PgDomains extends ObjectsOfScalar {

/**
* Instantiates a new Postgres domains (UDT's).
* @param connection The Connection to be encapsulated.
*/
public PgDomains(final Connection connection) {
super(
() -> new IterableOf<>()
);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (C) 2018-2021 FusionSoft
*
* Licensed 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.
*/
package org.fusionsoft.database.snapshot.objects.dbms.postgres;

import java.sql.Connection;
import org.fusionsoft.database.snapshot.DbObject;
import org.fusionsoft.database.snapshot.Objects;
import org.fusionsoft.database.snapshot.objects.ObjectsOfScalar;
import org.fusionsoft.lib.collection.ListOfResultSet;

/**
* The type of {@link Objects} that can be constructed of connection to Postgres DBMS.
* @since 0.1
* @todo #101:30min Adapt query for enums from DbGit.
* @checkstyle StringLiteralsConcatenationCheck (100 lines)
*/
public class PgEnums extends ObjectsOfScalar {

/**
* Instantiates a new Postgres enums (UDT's).
* @param connection The Connection to be encapsulated.
*/
public PgEnums(final Connection connection) {
super(
() ->
new ListOfResultSet<DbObject<?>>(
PostgresSchemaOfResultSet::new,
() -> connection.createStatement().executeQuery(
""
)
)
);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (C) 2018-2021 FusionSoft
*
* Licensed 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.
*/
package org.fusionsoft.database.snapshot.objects.dbms.postgres;

import java.sql.Connection;
import org.fusionsoft.database.snapshot.DbObject;
import org.fusionsoft.database.snapshot.Objects;
import org.fusionsoft.database.snapshot.objects.ObjectsOfScalar;
import org.fusionsoft.lib.collection.ListOfResultSet;

/**
* The type of {@link Objects} that can be constructed of connection to Postgres DBMS.
* @since 0.1
* @todo #101:30min Adapt query for functions from DbGit.
* @checkstyle StringLiteralsConcatenationCheck (100 lines)
*/
public class PgFunctions extends ObjectsOfScalar {

/**
* Instantiates a new Postgres ... .
* @param connection The Connection to be encapsulated.
*/
public PgFunctions(final Connection connection) {
super(
() ->
new ListOfResultSet<DbObject<?>>(
PostgresSchemaOfResultSet::new,
() -> connection.createStatement().executeQuery(
""
)
)
);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (C) 2018-2021 FusionSoft
*
* Licensed 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.
*/
package org.fusionsoft.database.snapshot.objects.dbms.postgres;

import java.sql.Connection;
import org.fusionsoft.database.snapshot.DbObject;
import org.fusionsoft.database.snapshot.Objects;
import org.fusionsoft.database.snapshot.objects.ObjectsOfScalar;
import org.fusionsoft.lib.collection.ListOfResultSet;

/**
* The type of {@link Objects} that can be constructed of connection to Postgres DBMS.
* @since 0.1
* @todo #101:30min Adapt query for indexes from DbGit.
* @checkstyle StringLiteralsConcatenationCheck (100 lines)
*/
public class PgIndexes extends ObjectsOfScalar {

/**
* Instantiates a new Postgres ... .
* @param connection The Connection to be encapsulated.
*/
public PgIndexes(final Connection connection) {
super(
() ->
new ListOfResultSet<DbObject<?>>(
PostgresSchemaOfResultSet::new,
() -> connection.createStatement().executeQuery(
""
)
)
);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (C) 2018-2021 FusionSoft
*
* Licensed 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.
*/
package org.fusionsoft.database.snapshot.objects.dbms.postgres;

import java.sql.Connection;
import org.fusionsoft.database.snapshot.DbObject;
import org.fusionsoft.database.snapshot.Objects;
import org.fusionsoft.database.snapshot.objects.ObjectsOfScalar;
import org.fusionsoft.lib.collection.ListOfResultSet;

/**
* The type of {@link Objects} that can be constructed of connection to Postgres DBMS.
* @since 0.1
* @todo #101:30min Adapt query for procedures from DbGit.
* @checkstyle StringLiteralsConcatenationCheck (100 lines)
*/
public class PgProcedures extends ObjectsOfScalar {

/**
* Instantiates a new Postgres ... .
* @param connection The Connection to be encapsulated.
*/
public PgProcedures(final Connection connection) {
super(
() ->
new ListOfResultSet<DbObject<?>>(
PostgresSchemaOfResultSet::new,
() -> connection.createStatement().executeQuery(
""
)
)
);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (C) 2018-2021 FusionSoft
*
* Licensed 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.
*/
package org.fusionsoft.database.snapshot.objects.dbms.postgres;

import java.sql.Connection;
import org.fusionsoft.database.snapshot.DbObject;
import org.fusionsoft.database.snapshot.Objects;
import org.fusionsoft.database.snapshot.objects.ObjectsOfScalar;
import org.fusionsoft.lib.collection.ListOfResultSet;

/**
* The type of {@link Objects} that can be constructed of connection to Postgres DBMS.
* @since 0.1
* @todo #101:30min Adapt query for sequences from DbGit.
* @checkstyle StringLiteralsConcatenationCheck (100 lines)
*/
public class PgSequences extends ObjectsOfScalar {

/**
* Instantiates a new Postgres ... .
* @param connection The Connection to be encapsulated.
*/
public PgSequences(final Connection connection) {
super(
() ->
new ListOfResultSet<DbObject<?>>(
PostgresSchemaOfResultSet::new,
() -> connection.createStatement().executeQuery(
""
)
)
);
}

}
Loading

0 comments on commit cddf0ed

Please sign in to comment.