|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ow2.weblab.core.extended.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(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
|
getSelectedSubResourcesMap(Resource res,
java.lang.Class<T> resClass)
The same as ResourceUtil.getSubResources(Resource, Class<T>) ; But in
addition to the sub-resources by themselves, this method return an reference to the resource
containing every subresource. |
|
static java.util.List<Resource> |
getSubResources(Resource res)
|
|
static Resource |
loadFromXMLString(java.lang.String xml)
Simply transform the XML String into a Resource . |
|
static void |
printTree(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(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(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:
Annotations
,LowLevelDescriptors
,Resources
if it's a ComposedResource, a Similarity or a ResultSet
,MediaUnits
if it's a Document
Queries
if it's a ComposedQuery
PieceOfKnowledge
if it's a ResultSet
.
res
- The Resource
to be printedstream
- The OutputStream
to write intopublic static java.lang.String saveToXMLString(Resource resource) throws WebLabCheckedException
resource
into an XML String
. Use the WebLabMarshaller
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
WebLabMarshaller
public static Resource loadFromXMLString(java.lang.String xml) throws WebLabCheckedException
String
into a Resource
. Use the WebLabMarshaller
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<Resource> getSubResources(Resource res)
res
- The Resource
to retrieve children.
Resource
List
without res
it self.public static <T extends Resource> java.util.List<T> getSelectedSubResources(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)
public static <T extends Resource> java.util.Map<T,Resource> getSelectedSubResourcesMap(Resource res, java.lang.Class<T> resClass)
ResourceUtil.getSubResources(Resource, Class<T>)
; But in
addition to the sub-resources by themselves, this method return an reference to the resource
containing every subresource.
T
- Subclass of Resource to be retrievedres
- The Resource
to retrieve children.resClass
- The Class
of the only children you need in result List
.
Map
with their parents.getSelectedSubResources(Resource, Class)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |