public class SourceSchema extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CONFIG_INITIAL_COMMENT |
Modifier | Constructor and Description |
---|---|
protected |
SourceSchema(String name)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addColumn(SourceColumn c)
Adds a new column
|
static SourceSchema |
createSchema(File configFile)
Creates a new SourceSchema from the XML config file
|
static SourceSchema |
createSchema(InputStream configStream)
Creates a new SourceSchema from the XML config steam
|
static SourceSchema |
createSchema(String name)
Creates a new empty schema
|
protected static SourceSchema |
fromXml(File configFile)
Deserializes the schema from XML
|
protected static SourceSchema |
fromXml(InputStream is)
Deserializes the schema from an XML stream
|
List<SourceColumn> |
getAttributes()
Returns all ATTRIBUTE columns
|
SourceColumn |
getColumnByName(String name)
Returns a column by it's name
|
List<SourceColumn> |
getColumnByType(String type)
Returns a column by it's type
|
int |
getColumnIndex(SourceColumn c)
Returns the column's index
|
List<SourceColumn> |
getColumns()
Columns getter
|
String |
getConfig()
Return the config file
|
List<SourceColumn> |
getConnectionPoints()
Returns all CONNECTION POINT columns
|
String |
getDatasetName()
Get a dataset name that should be used for a server-side dataset corresponding
to this schema
|
List<SourceColumn> |
getDates()
Returns all DATE columns
|
List<SourceColumn> |
getFacts()
Returns all FACT columns
|
int |
getIdentityColumn()
Return the position of the IDENTITY column
|
List<SourceColumn> |
getIgnored()
Returns all IGNORE columns
|
List<SourceColumn> |
getLabels()
Returns all LABEL columns
|
String |
getName()
Name getter
|
List<SourceColumn> |
getReferences()
Returns all REFERENCE columns
|
String |
getTitle()
Title getter
|
void |
setColumns(List<SourceColumn> columns)
Columns setter
|
void |
setName(String name)
Name setter
|
String |
toString() |
protected String |
toXml()
Serializes the schema to XML
|
void |
validate()
Validates the source schema
|
void |
writeConfig(File configFile)
Write the config file
|
public static String CONFIG_INITIAL_COMMENT
protected SourceSchema(String name)
name
- schema namepublic int getColumnIndex(SourceColumn c)
c
- columnpublic static SourceSchema createSchema(String name)
name
- the schema namepublic static SourceSchema createSchema(File configFile) throws IOException
configFile
- the config fileIOException
- in case of an IO issuepublic static SourceSchema createSchema(InputStream configStream) throws IOException
configStream
- the config streamIOException
- in case of an IO issuepublic String getDatasetName()
protected String toXml() throws IOException
IOException
- in case of an IO issueprotected static SourceSchema fromXml(File configFile) throws IOException
configFile
- the file with the XML definitionIOException
- in case of an IO issueprotected static SourceSchema fromXml(InputStream is) throws IOException
is
- the stream of the XML definitionIOException
- in case of an IO issuepublic void writeConfig(File configFile) throws IOException
configFile
- the config fileIOException
- in case of an IO issuepublic String getConfig() throws IOException
IOException
- in case of an IO issuepublic List<SourceColumn> getColumns()
public void setColumns(List<SourceColumn> columns)
columns
- the List of columnspublic void addColumn(SourceColumn c)
c
- the new columnpublic String getName()
public String getTitle()
public void setName(String name)
name
- schema namepublic SourceColumn getColumnByName(String name) throws ModelException
name
- name to search for (case sensitive)ModelException
- thrown if the column doesn't existpublic List<SourceColumn> getColumnByType(String type)
type
- type to search for (case sensitive)ModelException
- thrown if the column doesn't existpublic List<SourceColumn> getLabels()
public List<SourceColumn> getAttributes()
public List<SourceColumn> getFacts()
public List<SourceColumn> getReferences()
public List<SourceColumn> getIgnored()
public List<SourceColumn> getConnectionPoints()
public List<SourceColumn> getDates()
public void validate() throws ModelException
ModelException
- in case of a validation errorpublic int getIdentityColumn()
Copyright © 2014. All rights reserved.