|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.weblab_project.core.util.ResourceUtil
public class ResourceUtil
A class that contain a useful method when wanting to visualise the content and the structure of a Resource
Method Summary | ||
---|---|---|
static
|
getSelectedSubResources(org.weblab_project.core.model.Resource res,
java.lang.Class<T> resClass)
The same as ResourceUtil.getSubResources(Resource) , but with a filter on the Resource class to be retrieved by the
List . |
|
static java.util.List<org.weblab_project.core.model.Resource> |
getSubResources(org.weblab_project.core.model.Resource res)
|
|
static org.weblab_project.core.model.Resource |
loadFromXMLString(java.lang.String xml)
Simply transform the XML String into a Resource . |
|
static void |
printTree(org.weblab_project.core.model.Resource res,
java.io.OutputStream stream)
Simple visualisation method that enable to print a user friendly (non-xml) description of res . |
|
static java.lang.String |
saveToXMLString(org.weblab_project.core.model.Resource resource)
Simply transforms resource into an XML String . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void printTree(org.weblab_project.core.model.Resource res, java.io.OutputStream stream)
res
. Uses a tree representation. For each type of
Resource
that might me contained by the given Resource
and it's contained Resource
s print their URI
and their class simple name. For any Resource
, it's contained Resource
s might be:
Annotation
s,LowLevelDescriptor
s,Resource
s if it's a ResourceCollection
,Segment
s if it's a MediaUnit
,MediaUnit
s if it's a ComposedUnit
Line
s if it's a Table
Cell
s if it's a Line
MediaUnit
if it's a Cell
Queries
if it's a Cell
PieceOfKnowledge
and Resources
if it's a ResultSet
,
res
- The Resource
to be printedstream
- The OutputStream
to write intopublic static java.lang.String saveToXMLString(org.weblab_project.core.model.Resource resource) throws WebLabCheckedException
resource
into an XML String
. Use the WebLabMarshaler
for more configuration, and usage with files or
streams.
resource
- The Resource
to be transformed into an XML String
.
String
containing the XML view of the Resource
WebLabCheckedException
WebLabMarshaler
public static org.weblab_project.core.model.Resource loadFromXMLString(java.lang.String xml) throws WebLabCheckedException
String
into a Resource
. Use the WebLabMarshaler
for more configuration, and usage with files
or streams.
xml
- The XML String
representing the Resource
Resource
defined in the XML String
.
WebLabCheckedException
public static java.util.List<org.weblab_project.core.model.Resource> getSubResources(org.weblab_project.core.model.Resource res)
res
- The Resource
to retrieve children.
Resource
List
without res
it self.public static <T extends org.weblab_project.core.model.Resource> java.util.List<T> getSelectedSubResources(org.weblab_project.core.model.Resource res, java.lang.Class<T> resClass)
ResourceUtil.getSubResources(Resource)
, but with a filter on the Resource
class to be retrieved by the
List
. I.e. the only retrieved Resource
s are those that are instances of resClass
.
T
- Subclass of Resource to be retrievedres
- The Resource
to retrieve children.resClass
- The Class
of the only children you need in result List
.
List
.getSubResources(Resource)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |