-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#106) Make data objects fetching and rendering work, minor refactoring
- Loading branch information
Showing
18 changed files
with
1,395 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/java/org/fusionsoft/database/mapping/entries/MapEntryOfScalar.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* 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.mapping.entries; | ||
|
||
import java.util.Map; | ||
import org.cactoos.Scalar; | ||
import org.cactoos.scalar.Unchecked; | ||
|
||
public class MapEntryOfScalar<K,V> implements Map.Entry<K,V> { | ||
|
||
private final Unchecked<? extends Map.Entry<K,V>> scalar; | ||
|
||
public MapEntryOfScalar(final Scalar<? extends Map.Entry<K, V>> scalar) { | ||
this.scalar = new Unchecked<>(scalar); | ||
} | ||
|
||
@Override | ||
public K getKey() { | ||
return this.scalar.value().getKey(); | ||
} | ||
|
||
@Override | ||
public V getValue() { | ||
return this.scalar.value().getValue(); | ||
} | ||
|
||
@Override | ||
public V setValue(final V value) { | ||
return this.scalar.value().setValue(value); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/main/java/org/fusionsoft/database/snapshot/data/InlineDataObjectOfTable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* 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.data; | ||
|
||
import java.sql.Connection; | ||
import org.fusionsoft.database.mapping.dbd.DbdDataMapping; | ||
import org.fusionsoft.database.mapping.dbd.DbdTableMapping; | ||
import org.fusionsoft.database.mapping.fields.DbdTableFields; | ||
import org.fusionsoft.database.snapshot.DbObject; | ||
import org.fusionsoft.database.snapshot.objects.ObjectType; | ||
import org.fusionsoft.database.snapshot.objects.SimpleDbObject; | ||
import org.fusionsoft.database.snapshot.objectsignature.FullObjectName; | ||
import org.fusionsoft.database.snapshot.objectsignature.SimpleObjectSignature; | ||
import org.fusionsoft.lib.yaml.YamlMappingOfEntries; | ||
|
||
public class InlineDataObjectOfTable extends SimpleDbObject<DbdDataMapping> { | ||
|
||
/** | ||
* Instantiates a new simple db object. | ||
*/ | ||
public InlineDataObjectOfTable( | ||
final DbObject<DbdTableMapping> table, | ||
final Connection connection | ||
) { | ||
super( | ||
new DbdDataMapping( | ||
new YamlMappingOfEntries( | ||
new DbdDataEntriesOfTable( | ||
connection, | ||
table | ||
) | ||
) | ||
), | ||
new SimpleObjectSignature( | ||
new FullObjectName( | ||
table.signature().name().parent(), | ||
table.signature().name().first(), | ||
DbdTableFields.DATA | ||
), | ||
ObjectType.DATA | ||
) | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.