Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/tm4j1
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv30388/src/org/tm4j/topicmap/tmdm/tm4j1
Modified Files:
AssociationImpl.java TopicMapImpl.java
Log Message:
Implement AssociationImpl.createMember(String id) legacy method.
Index: AssociationImpl.java
===================================================================
RCS file: /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/tm4j1/AssociationImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** AssociationImpl.java 21 Jan 2008 11:13:45 -0000 1.1
--- AssociationImpl.java 22 Jan 2008 21:36:05 -0000 1.2
***************
*** 5,8 ****
--- 5,9 ----
import java.util.Collection;
import java.util.Iterator;
+ import java.util.Collections;
import java.beans.PropertyVetoException;
***************
*** 81,88 ****
* @param id the unique ID to be assigned to the newly created Member object. If
* null, then the back-end will assign a unique ID to the object.
*/
! public Member createMember(String id)
! throws DuplicateObjectIDException, PropertyVetoException {
! throw new UnsupportedOperationException();
}
--- 82,93 ----
* @param id the unique ID to be assigned to the newly created Member object. If
* null, then the back-end will assign a unique ID to the object.
+ * @deprecated As of TMDM, it is not allowed to have association roles without type or without player.
*/
! public Member createMember(String id) throws DuplicateObjectIDException, PropertyVetoException {
! try {
! return createMember(id,null,null,Collections.emptyList());
! } catch (DuplicateResourceLocatorException e) {
! throw new RuntimeException("This may never happen.",e);
! }
}
***************
*** 102,110 ****
@SuppressWarnings("unchecked")
public Member createMember(String id, Locator resourceLoc, Topic roleSpec,Collection players) throws DuplicateObjectIDException,PropertyVetoException,DuplicateResourceLocatorException {
! org.tm4j.topicmap.tmdm.AssociationRole result = null;
! assert roleSpec!=null; // this is allowed in old TM4J
! org.tm4j.topicmap.tmdm.Topic roleType = getContainer().externalToUnmerged(roleSpec);
for (Topic player : (Collection<Topic>) players) {
--- 107,121 ----
@SuppressWarnings("unchecked")
public Member createMember(String id, Locator resourceLoc, Topic roleSpec,Collection players) throws DuplicateObjectIDException,PropertyVetoException,DuplicateResourceLocatorException {
! assert resourceLoc==null; // not implemented
! org.tm4j.topicmap.tmdm.Topic roleType;
! if (roleSpec!=null) {
! roleType = getContainer().externalToUnmerged(roleSpec);
! } else {
! roleType = getContainer().getInternalUnspecifiedTopic();
! }
!
! org.tm4j.topicmap.tmdm.AssociationRole result = null;
for (Topic player : (Collection<Topic>) players) {
***************
*** 112,116 ****
}
! assert result!=null;
return getContainer().unmergedToExternal(result);
--- 123,129 ----
}
! if (result==null) { // We have not have a player. Thus, we use the dummy player.
! result = getRepresentedObject().createRole(roleType,getContainer().getInternalUnspecifiedTopic());
! }
return getContainer().unmergedToExternal(result);
Index: TopicMapImpl.java
===================================================================
RCS file: /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/tm4j1/TopicMapImpl.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** TopicMapImpl.java 22 Jan 2008 21:28:32 -0000 1.11
--- TopicMapImpl.java 22 Jan 2008 21:36:05 -0000 1.12
***************
*** 60,63 ****
--- 60,64 ----
<li>associations without type</li>
<li>association roles without type</li>
+ <li>association roles without player</li>
</ul>
*/
|