com.infodesire.infobit.dao
Class InfobitDAO

java.lang.Object
  |
  +--com.infodesire.infobit.dao.BaseDAO
        |
        +--com.infodesire.infobit.dao.InfobitDAO
All Implemented Interfaces:
InfobitManager

public final class InfobitDAO
extends BaseDAO
implements InfobitManager

DAO for infobits - encapsulates infobit creation and manipulation as well as accsess control

Version:
$Revision: 1.14 $
Author:
konstantin

Constructor Summary
InfobitDAO(SecurityProvider sec, SessionProvider sess)
          Constructor for the InfobitDAO object
 
Method Summary
 void createBinary(Infobit ib, java.lang.String name, byte[] data, java.lang.String mime, java.util.Set keywords)
          create binary infobit content
 void createBinary(Infobit ib, java.lang.String name, java.io.InputStream stream, java.lang.String mime, java.util.Set keywords)
          create binary infobit content
 Infobit createInfobit(java.lang.String id, Acl acl)
          create new infobit
 void createScript(Infobit ib, java.lang.String name, Infobit template, java.util.Map links, java.util.Set keywords)
          create script.
 void createTemplate(Infobit ib, java.lang.String name, java.lang.String text)
          create template for scripts.
 void createText(Infobit ib, java.lang.String name, java.lang.String text, java.util.Set keywords)
          create new version with textual content.
 byte[] getBytes(PrimitiveContent content)
          Gets the Bytes attribute of the InfobitDAO object
 java.io.InputStream getContent(PrimitiveContent content)
          return contents of primitive element as binary stream.
 int getContentLength(PrimitiveContent content)
          Gets the size of the content.
 Infobit getInfobit(java.lang.String name)
          load infobit by name
 java.lang.String getString(PrimitiveContent content)
          Gets the String attribute of the InfobitDAO object
 boolean hasInfobit(java.lang.String name)
          whether given infobit exists
 java.util.Collection queryInfobits(java.lang.String where)
          DOCUMENT METHOD
 void removeInfobit(Infobit ib)
          remove infobit from existence.
 void removeInfobit(java.lang.String name)
          remove infobit instance.
 void setActualVersion(Infobit ib, Version version)
          Sets the ActualVersion attribute of the InfobitDAO object
 void setAttribute(Content content, java.lang.String name, java.lang.String value)
          Sets the Attribute attribute of the Content object
 void setAttribute(Infobit infobit, java.lang.String name, java.lang.String value)
          set infobit attrobute.
 
Methods inherited from class com.infodesire.infobit.dao.BaseDAO
doLoad, getSecurityProvider, getSessionProvider, performQuery, performQuery, setSecurityProvider, setSessionProvider
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InfobitDAO

public InfobitDAO(SecurityProvider sec,
                  SessionProvider sess)
Constructor for the InfobitDAO object

Parameters:
sec - security provider
sess - session provider
Method Detail

getString

public java.lang.String getString(PrimitiveContent content)
                           throws InfobitException,
                                  InfobitSecurityException
Gets the String attribute of the InfobitDAO object

Specified by:
getString in interface InfobitManager
Parameters:
content - Description of Parameter
Returns:
The String value
Throws:
InfobitException - Description of Exception
InfobitSecurityException - Description of Exception

getInfobit

public Infobit getInfobit(java.lang.String name)
                   throws InfobitException
load infobit by name

Specified by:
getInfobit in interface InfobitManager
Parameters:
name - name of infobit
Returns:
infobit instance
Throws:
InfobitException - will be thrown is something wrong happens.

getContent

public java.io.InputStream getContent(PrimitiveContent content)
                               throws InfobitException,
                                      InfobitSecurityException
return contents of primitive element as binary stream. resulting stream is coming out of blob, and shall be used ASAP and in any case inside the same transaction. Intendet use is to stream this content out to web client.

Specified by:
getContent in interface InfobitManager
Parameters:
content - Description of Parameter
Returns:
The Content value
Throws:
InfobitException - Description of Exception
InfobitSecurityException - Description of Exception

getContentLength

public int getContentLength(PrimitiveContent content)
                     throws InfobitException,
                            InfobitSecurityException
Gets the size of the content.

Specified by:
getContentLength in interface InfobitManager
Parameters:
content - The content the size of which to query
Returns:
The size of
Throws:
InfobitException - Description of Exception
InfobitSecurityException - Description of Exception

getBytes

public byte[] getBytes(PrimitiveContent content)
                throws InfobitException,
                       InfobitSecurityException
Gets the Bytes attribute of the InfobitDAO object

Specified by:
getBytes in interface InfobitManager
Parameters:
content - Description of Parameter
Returns:
The Bytes value
Throws:
InfobitException - Description of Exception
InfobitSecurityException - Description of Exception

setAttribute

public void setAttribute(Infobit infobit,
                         java.lang.String name,
                         java.lang.String value)
                  throws InfobitException,
                         InfobitSecurityException
set infobit attrobute. to remove infobit attribute set it to null

Specified by:
setAttribute in interface InfobitManager
Parameters:
name - attribute name
value - attribute value
infobit - The new Attribute value
Throws:
InfobitException - will be thrown if something wrong happens
InfobitSecurityException - will be thrown on insufficient security permissions

setAttribute

public void setAttribute(Content content,
                         java.lang.String name,
                         java.lang.String value)
                  throws InfobitException,
                         InfobitSecurityException
Sets the Attribute attribute of the Content object

Specified by:
setAttribute in interface InfobitManager
Parameters:
content - content object
name - attribute name
value - attribute value
Throws:
InfobitException - will be thrown if something wrong happens
InfobitSecurityException - will be thrown on insufficient security permissions

setActualVersion

public void setActualVersion(Infobit ib,
                             Version version)
                      throws InfobitException,
                             InfobitSecurityException
Sets the ActualVersion attribute of the InfobitDAO object

Specified by:
setActualVersion in interface InfobitManager
Parameters:
ib - The new ActualVersion value
version - The new ActualVersion value
Throws:
InfobitException - Description of Exception
InfobitSecurityException - Description of Exception

queryInfobits

public java.util.Collection queryInfobits(java.lang.String where)
                                   throws InfobitException,
                                          InfobitSecurityException
DOCUMENT METHOD

Specified by:
queryInfobits in interface InfobitManager
Parameters:
where - Description of Parameter
Returns:
Description of the Returned Value
Throws:
InfobitException - Description of Exception
InfobitSecurityException - Description of Exception

hasInfobit

public boolean hasInfobit(java.lang.String name)
                   throws InfobitException
whether given infobit exists

Specified by:
hasInfobit in interface InfobitManager
Parameters:
name - Description of Parameter
Returns:
infobit existence status
Throws:
InfobitException - canb be thrown if something wents wrong

removeInfobit

public void removeInfobit(java.lang.String name)
                   throws InfobitException,
                          InfobitSecurityException
remove infobit instance.

Specified by:
removeInfobit in interface InfobitManager
Parameters:
name - Description of Parameter
Throws:
InfobitException - Description of Exception
InfobitSecurityException - Description of Exception

removeInfobit

public void removeInfobit(Infobit ib)
                   throws InfobitException,
                          InfobitSecurityException
remove infobit from existence. if possible

Parameters:
ib - Description of Parameter
Throws:
InfobitException - Description of Exception
InfobitSecurityException - Description of Exception

createInfobit

public Infobit createInfobit(java.lang.String id,
                             Acl acl)
                      throws InfobitException,
                             InfobitSecurityException
create new infobit

Specified by:
createInfobit in interface InfobitManager
Parameters:
id - string id of infobit
acl - Description of Parameter
Returns:
Description of the Returned Value
Throws:
InfobitException - will be thrown if something went wrong
InfobitSecurityException - Description of Exception

createText

public void createText(Infobit ib,
                       java.lang.String name,
                       java.lang.String text,
                       java.util.Set keywords)
                throws InfobitException,
                       InfobitSecurityException
create new version with textual content.

Specified by:
createText in interface InfobitManager
Parameters:
ib - infobit
name - unique version name ( within given infobit )
keywords - keywords for searching. shall contain strings
text - textual content of infobit
Throws:
InfobitException - when some problem occurs
InfobitSecurityException - when insufficient permissions.

createBinary

public void createBinary(Infobit ib,
                         java.lang.String name,
                         java.io.InputStream stream,
                         java.lang.String mime,
                         java.util.Set keywords)
                  throws InfobitException,
                         InfobitSecurityException
create binary infobit content

Specified by:
createBinary in interface InfobitManager
Parameters:
ib - infobit
name - unique version name ( within given infobit )
stream - stream containing binary data
mime - mime type
keywords - keywords for searching . shall contain strings
Throws:
InfobitException - when some problem occurs
InfobitSecurityException - when insufficient permissions.

createBinary

public void createBinary(Infobit ib,
                         java.lang.String name,
                         byte[] data,
                         java.lang.String mime,
                         java.util.Set keywords)
                  throws InfobitException,
                         InfobitSecurityException
create binary infobit content

Specified by:
createBinary in interface InfobitManager
Parameters:
ib - infobit
name - unique version name ( within given infobit )
data - array coontaining binary data
mime - mime type
keywords - keywords for searching. shall contain strings
Throws:
InfobitException - when some problem occurs
InfobitSecurityException - when insufficient permissions.

createTemplate

public void createTemplate(Infobit ib,
                           java.lang.String name,
                           java.lang.String text)
                    throws InfobitException,
                           InfobitSecurityException
create template for scripts. template does not have any keywords. it does not need them

Specified by:
createTemplate in interface InfobitManager
Parameters:
ib - infobit
name - unique version name ( within given infobit )
text - template text
Throws:
InfobitException - when some problem occurs
InfobitSecurityException - when insufficient permissions.

createScript

public void createScript(Infobit ib,
                         java.lang.String name,
                         Infobit template,
                         java.util.Map links,
                         java.util.Set keywords)
                  throws InfobitException,
                         InfobitSecurityException
create script.

Specified by:
createScript in interface InfobitManager
Parameters:
ib - infobit
name - unique version name ( within given infobit )
template - template infobit
links - map of links to be merged with template. shall be keyed by strings and contain infobits
keywords - keywords for searching. shall contain strings
Throws:
InfobitException - Description of Exception
InfobitSecurityException - Description of Exception


Copyright © 2003 Information Desire GmbH. All Rights Reserved.