Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
0005295: Relational to JSON writer with nesting using group of tables
- Loading branch information
Showing
3 changed files
with
407 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
symmetric-io/src/main/java/org/jumpmind/symmetric/io/data/transform/CsvDataHier.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,54 @@ | ||
/** | ||
* Licensed to JumpMind Inc under one or more contributor | ||
* license agreements. See the NOTICE file distributed | ||
* with this work for additional information regarding | ||
* copyright ownership. JumpMind Inc licenses this file | ||
* to you under the GNU General Public License, version 3.0 (GPLv3) | ||
* (the "License"); you may not use this file except in compliance | ||
* with the License. | ||
* | ||
* You should have received a copy of the GNU General Public License, | ||
* version 3.0 (GPLv3) along with this library; if not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
* 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.jumpmind.symmetric.io.data.transform; | ||
|
||
import java.util.List; | ||
|
||
import org.jumpmind.symmetric.io.data.CsvData; | ||
|
||
public class CsvDataHier { | ||
private CsvData csvData; | ||
private List<CsvDataHier> children; | ||
|
||
public CsvDataHier(CsvData csvData) { | ||
this.csvData = csvData; | ||
} | ||
|
||
public CsvData getCsvData() { | ||
return csvData; | ||
} | ||
|
||
public void setCsvData(CsvData csvData) { | ||
this.csvData = csvData; | ||
} | ||
|
||
public List<CsvDataHier> getChildren() { | ||
return children; | ||
} | ||
|
||
public void setChildren(List<CsvDataHier> children) { | ||
this.children = children; | ||
} | ||
|
||
public void addChild(CsvDataHier csvDataHier) { | ||
children.add(csvDataHier); | ||
} | ||
} |
117 changes: 117 additions & 0 deletions
117
symmetric-io/src/main/java/org/jumpmind/symmetric/io/data/transform/TableGroup.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,117 @@ | ||
/** | ||
* Licensed to JumpMind Inc under one or more contributor | ||
* license agreements. See the NOTICE file distributed | ||
* with this work for additional information regarding | ||
* copyright ownership. JumpMind Inc licenses this file | ||
* to you under the GNU General Public License, version 3.0 (GPLv3) | ||
* (the "License"); you may not use this file except in compliance | ||
* with the License. | ||
* | ||
* You should have received a copy of the GNU General Public License, | ||
* version 3.0 (GPLv3) along with this library; if not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
* 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.jumpmind.symmetric.io.data.transform; | ||
|
||
import java.util.Date; | ||
|
||
public class TableGroup implements Cloneable { | ||
private String id; | ||
private WriterType writerType; | ||
private Date createTime; | ||
private Date lastUpdateTime; | ||
private String lastUpdateBy; | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (obj instanceof TableGroup && id != null) { | ||
return id.equals(((TableGroup) obj).id); | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
if (id != null) { | ||
return id.hashCode(); | ||
} | ||
return super.hashCode(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
if (id != null) { | ||
return id; | ||
} | ||
return super.toString(); | ||
} | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
public WriterType getWriterType() { | ||
return writerType; | ||
} | ||
|
||
public void setWriterType(WriterType writerType) { | ||
this.writerType = writerType; | ||
} | ||
|
||
public Date getCreateTime() { | ||
return createTime; | ||
} | ||
|
||
public Date getLastUpdateTime() { | ||
return lastUpdateTime; | ||
} | ||
|
||
public String getLastUpdateBy() { | ||
return lastUpdateBy; | ||
} | ||
|
||
public void setCreateTime(Date createdOn) { | ||
this.createTime = createdOn; | ||
} | ||
|
||
public void setLastUpdateTime(Date lastModifiedOn) { | ||
this.lastUpdateTime = lastModifiedOn; | ||
} | ||
|
||
public void setLastUpdateBy(String updatedBy) { | ||
this.lastUpdateBy = updatedBy; | ||
} | ||
|
||
public enum WriterType { | ||
DEFAULT("D"), JSON("J"); | ||
|
||
private String code; | ||
|
||
WriterType(String code) { | ||
this.code = code; | ||
} | ||
|
||
public String getCode() { | ||
return code; | ||
} | ||
|
||
public static WriterType getWriterType(String s) { | ||
if (s.equals(JSON.getCode())) { | ||
return JSON; | ||
} else { | ||
return DEFAULT; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.