net.sf.borg.model
Class LinkModel

java.lang.Object
  extended by net.sf.borg.model.Model
      extended by net.sf.borg.model.LinkModel

public class LinkModel
extends Model

LinkModel manages the Link Entities, which are associations between BORG Entities and other BORG Entities, files, and URLs.


Nested Class Summary
static class LinkModel.LinkType
          LinkType holds the various link types.
 
Nested classes/interfaces inherited from class net.sf.borg.model.Model
Model.Listener
 
Method Summary
 void addLink(KeyedEntity<?> owner, String pathIn, LinkModel.LinkType linkType)
          Adds a link.
static String attachmentFolder()
          get the folder where attachments are stored
 void delete(int key)
          Delete a link
 void delete(Link l)
          Delete a link
 void deleteLinksFromEntity(KeyedEntity<?> owner)
          Delete links for an owning entity
 void deleteLinksToEntity(KeyedEntity<?> target)
          Delete links that target a given entity
 void export(Writer fw)
          Export links to XML
 EntityDB<Link> getDB()
          Gets the dB.
 Link getLink(int key)
          Gets a link.
 Collection<Link> getLinks()
          Gets all links.
 Collection<Link> getLinks(KeyedEntity<?> ownerbean)
          Gets the links for an owning entity
static LinkModel getReference()
          Gets the singleton.
 void importXml(String fileName)
          Import xml.
 void moveLinks(KeyedEntity<?> oldOwner, KeyedEntity<?> newOwner)
          Move links from one object to another
 Link newLink()
          return a new link object
 void refresh()
          Refresh listeners
 void saveLink(Link link)
          Save a link.
 
Methods inherited from class net.sf.borg.model.Model
addListener, refreshListeners, remove, removeListener, removeListeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

attachmentFolder

public static String attachmentFolder()
get the folder where attachments are stored

Returns:
the attachment folder path

getReference

public static LinkModel getReference()
Gets the singleton.

Returns:
the singleton

addLink

public void addLink(KeyedEntity<?> owner,
                    String pathIn,
                    LinkModel.LinkType linkType)
             throws Exception
Adds a link.

Parameters:
owner - the owning Entity
pathIn - the path (url, filepath, or entity key)
linkType - the link type
Throws:
Exception - the exception

delete

public void delete(int key)
            throws Exception
Delete a link

Parameters:
key - the key
Throws:
Exception - the exception

delete

public void delete(Link l)
            throws Exception
Delete a link

Parameters:
l - the Link
Throws:
Exception - the exception

deleteLinksFromEntity

public void deleteLinksFromEntity(KeyedEntity<?> owner)
                           throws Exception
Delete links for an owning entity

Parameters:
owner - the owning entity object
Throws:
Exception - the exception

deleteLinksToEntity

public void deleteLinksToEntity(KeyedEntity<?> target)
                         throws Exception
Delete links that target a given entity

Parameters:
target - the target entity object
Throws:
Exception - the exception

export

public void export(Writer fw)
            throws Exception
Export links to XML

Parameters:
fw - the writer to write XML to
Throws:
Exception - the exception

getDB

public EntityDB<Link> getDB()
Gets the dB.

Returns:
the dB

getLink

public Link getLink(int key)
             throws Exception
Gets a link.

Parameters:
key - the key
Returns:
the link
Throws:
Exception - the exception

getLinks

public Collection<Link> getLinks()
                          throws Exception
Gets all links.

Returns:
all links
Throws:
Exception - the exception

getLinks

public Collection<Link> getLinks(KeyedEntity<?> ownerbean)
                          throws Exception
Gets the links for an owning entity

Parameters:
ownerbean - the owning entity
Returns:
the links
Throws:
Exception - the exception

importXml

public void importXml(String fileName)
               throws Exception
Import xml.

Parameters:
fileName - the file name of the file containing the XML
Throws:
Exception - the exception

moveLinks

public void moveLinks(KeyedEntity<?> oldOwner,
                      KeyedEntity<?> newOwner)
               throws Exception
Move links from one object to another

Parameters:
oldOwner - the old owner
newOwner - the new owner
Throws:
Exception - the exception

newLink

public Link newLink()
return a new link object

Returns:
the link

refresh

public void refresh()
Refresh listeners


saveLink

public void saveLink(Link link)
              throws Exception
Save a link.

Parameters:
link - the link
Throws:
Exception - the exception


Generated September 24 2010 by mbb using Apache Ant version 1.7.1 compiled on June 27 2008 and Java version 1.6.0_20 from Sun Microsystems Inc. on Linux i386 2.6.24-28-generic