public class TextGridProjectFile extends Object
Modifier and Type | Field and Description |
---|---|
static QName |
appData |
static String |
basicMetadataSectionNS |
static QName |
basicMetadataSectionQName |
static org.apache.axiom.om.OMAttribute |
descriptionChanged |
static QName |
descriptionChangedQName |
static QName |
metadataSectionQName |
static String |
PROJECT_FILE_TYPE |
static String |
projectFileNS |
static QName |
TG_PROJECT_FILE_QNAME |
Constructor and Description |
---|
TextGridProjectFile(TextGridProject project) |
Modifier and Type | Method and Description |
---|---|
protected TextGridObject |
createNewProjectFile(IProgressMonitor monitor)
Creates a new TextGridObject pre-initialized with contents and metadata
appropriate for (empty) project files.
|
protected TextGridObject |
createNewProjectFileObject()
Creates and returns a new
TextGridObject suitable for a project file.
|
protected info.textgrid.namespaces.metadata.projectfile._2008_11_27.TgProjectFile |
createProjectFileSkeleton() |
static org.apache.axiom.om.OMElement[] |
extractAppDataChildren(info.textgrid.namespaces.metadata.projectfile._2008_11_27.TgProjectFile projectFile) |
static org.apache.axiom.om.OMElement |
extractAppDataXML(info.textgrid.namespaces.metadata.projectfile._2008_11_27.TgProjectFile projectFile)
Extracts the application specific part of the given argument and converts
it to an array of
OMElement s. |
info.textgrid.namespaces.metadata.projectfile._2008_11_27.TgProjectFile |
getProjectFileData(boolean create,
boolean reload,
IProgressMonitor monitor) |
TextGridObject |
getProjectFileObject(boolean create,
IProgressMonitor monitor)
Returns the
TextGridObject for a project file for this project. |
static String |
getTypeFromFormat(String format)
Returns the type of the object (item, edition,...) from its format.
|
protected void |
saveProjectFile(info.textgrid.namespaces.metadata.projectfile._2008_11_27.TgProjectFile projectFile,
TextGridObject object,
IProgressMonitor monitor)
Saves the given project file record to the given file.
|
TextGridObject |
saveProjectFileData(info.textgrid.namespaces.metadata.projectfile._2008_11_27.TgProjectFile data,
IProgressMonitor monitor)
maybe Saves the given data as the associated project's project file.
|
static void |
setBasicMetadataToNewObject(String project,
String type,
TextGridObject newObj)
Set the basic metadata to the new created object.
|
boolean |
setProjectFile(TextGridObject object) |
boolean |
setProjectFile(URI uri) |
public static final String PROJECT_FILE_TYPE
public static final String projectFileNS
public static final QName TG_PROJECT_FILE_QNAME
public static final QName appData
public static final QName metadataSectionQName
public static String basicMetadataSectionNS
public static final QName basicMetadataSectionQName
public static final org.apache.axiom.om.OMAttribute descriptionChanged
public static final QName descriptionChangedQName
public TextGridProjectFile(TextGridProject project)
public TextGridObject getProjectFileObject(boolean create, IProgressMonitor monitor) throws ProjectFileException
TextGridObject
for a project file for this project.
This may be a long-running operation.create
- if there does not yet exist a project file for this project
and create is true, a new one is created and saved.monitor
- TextGridObject
for the project file, or
null
if none exists and none has been created.ProjectFileException
- when something went wrong while reading or creating the
project file.protected TextGridObject createNewProjectFile(IProgressMonitor monitor) throws ProjectFileException
monitor
- the progress monitor to use for reporting progress to the
user. It is the caller's responsibility to call done() on the
given monitor. Accepts null, indicating that no progress
should be reported and that the operation cannot be cancelled.TextGridObject
created for the given file. This is no
longer new and has been
written to the grid, but all fields are empty.ProjectFileException
- when something goes wrong.protected TextGridObject createNewProjectFileObject()
protected void saveProjectFile(info.textgrid.namespaces.metadata.projectfile._2008_11_27.TgProjectFile projectFile, TextGridObject object, IProgressMonitor monitor) throws ProjectFileException
projectFile
- The project file record to save.file
- The IFile
to save to.monitor
- Provides progress monitoring.ProjectFileException
- when either serializing fails (= bug) or writing failsprotected info.textgrid.namespaces.metadata.projectfile._2008_11_27.TgProjectFile createProjectFileSkeleton()
public boolean setProjectFile(URI uri)
public boolean setProjectFile(TextGridObject object)
public info.textgrid.namespaces.metadata.projectfile._2008_11_27.TgProjectFile getProjectFileData(boolean create, boolean reload, IProgressMonitor monitor) throws ProjectFileException
ProjectFileException
public TextGridObject saveProjectFileData(info.textgrid.namespaces.metadata.projectfile._2008_11_27.TgProjectFile data, IProgressMonitor monitor) throws ProjectFileException, CrudServiceException
data
- monitor
- ProjectFileException
CrudServiceException
public static String getTypeFromFormat(String format)
format
- public static void setBasicMetadataToNewObject(String project, String type, TextGridObject newObj)
project
- type
- newObj
- public static org.apache.axiom.om.OMElement extractAppDataXML(info.textgrid.namespaces.metadata.projectfile._2008_11_27.TgProjectFile projectFile)
OMElement
s.
TODO this could probably be refactored to be a proper method.projectFile
- project file recordnull
if either
projectFile was null
or no application
data has been found.public static org.apache.axiom.om.OMElement[] extractAppDataChildren(info.textgrid.namespaces.metadata.projectfile._2008_11_27.TgProjectFile projectFile)