Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/tm4j1
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv3433/src/org/tm4j/topicmap/tmdm/tm4j1
Modified Files:
TopicMapImpl.java
Log Message:
Support for TopicMapImpl.getObjectByID(). Fixes testcase mergeSeparateFiles0.
Index: TopicMapImpl.java
===================================================================
RCS file: /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/tm4j1/TopicMapImpl.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** TopicMapImpl.java 11 Jun 2008 02:41:37 -0000 1.19
--- TopicMapImpl.java 12 Jun 2008 07:31:35 -0000 1.20
***************
*** 625,640 ****
*/
public Topic getTopicByID(String id) {
try {
! Locator itemIdentifier = idToItemIdentifier(id);
!
! TopicMapObject o = mergedToExternal(getMergedTopicMapView().getMergedTopicMapConstructForItemIdentifierOrSubjectIdentifier(itemIdentifier));
!
! try {
! return (Topic) o;
! } catch (ClassCastException e) {
! throw new IllegalArgumentException("The id \""+id+"\" does not identify a topic, but it identifies this object: "+o,e);
! }
! } catch (LocatorFactoryException e) {
! throw new RuntimeException("This should not happen.",e);
}
}
--- 625,634 ----
*/
public Topic getTopicByID(String id) {
+ TopicMapObject o = this.getObjectByID(id);
+
try {
! return (Topic) o;
! } catch (ClassCastException e) {
! throw new IllegalArgumentException("The id \""+id+"\" does not identify a topic, but it identifies this object: "+o,e);
}
}
***************
*** 653,659 ****
* @return The topic map object which has the specified identifier or null if no match is found.
*/
! public TopicMapObject getObjectByID(String id) { // FIXME
! // throw new UnsupportedOperationException();
! return null;
}
--- 647,660 ----
* @return The topic map object which has the specified identifier or null if no match is found.
*/
! public TopicMapObject getObjectByID(String id) {
! try {
! Locator itemIdentifier = idToItemIdentifier(id);
!
! TopicMapObject o = mergedToExternal(getMergedTopicMapView().getMergedTopicMapConstructForItemIdentifierOrSubjectIdentifier(itemIdentifier));
!
! return o;
! } catch (LocatorFactoryException e) {
! throw new RuntimeException("This should not happen.",e);
! }
}
|