|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--it.mokabyte.pattern.dao.MyDaoXmlImpl
Title:MyDaoXmlImpl
MyDaoXmlImpl makes an access to XML repository file whit this format:
Field Summary | |
private java.lang.String |
ATTRIBUTE_PK
tag primary key |
private org.w3c.dom.Document |
doc
the DOM document |
private java.io.File |
fileRepository
the repository file |
private java.lang.String |
TAG_ACCOUNT
tag account |
private java.lang.String |
TAG_ADDRESS
tag address |
private java.lang.String |
TAG_BALANCE
tag balance |
private java.lang.String |
TAG_NAME
tag name |
Constructor Summary | |
MyDaoXmlImpl()
Constructor for the MyDaoXmlImpl object |
Method Summary | |
boolean |
accountExists(AccountPK key)
|
private void |
addNode(AccountOM accOm)
Add an account to the DOM document |
int |
deleteAccount(AccountPK pk)
the Method deletes an exist account |
private org.w3c.dom.Node |
getNode(java.lang.String pkValue)
Gets the node attribute of the DOM repository object |
private AccountOM |
getValueObject(org.w3c.dom.Node node,
java.lang.String pkValue)
Get the valueObject attribute of the DOM repository |
private void |
initResourceFile(java.lang.String dataSourceName)
init the XML reposistory |
int |
insertAccount(AccountPK pk,
java.lang.String name,
java.lang.String address,
double balance)
the Method inserts a new AccountOM in the repository |
private void |
openDocument()
the method inti the DOM document |
AccountOM |
readAccount(AccountPK pk)
the Method read an exist account |
private void |
saveDocument()
the method save the values in an XML file repository |
int |
updateAccount(AccountPK key,
java.lang.String name,
java.lang.String address,
double balance)
the Method update an exist account |
private void |
updateDocument(AccountOM ao)
the method update the value in the repository DOM obejct |
Methods inherited from class java.lang.Object |
|
Field Detail |
private org.w3c.dom.Document doc
private java.io.File fileRepository
private java.lang.String TAG_NAME
private java.lang.String TAG_ADDRESS
private java.lang.String TAG_BALANCE
private java.lang.String TAG_ACCOUNT
private java.lang.String ATTRIBUTE_PK
Constructor Detail |
public MyDaoXmlImpl() throws DAOException
DAOException
- there is not name file repositoryMethod Detail |
public int insertAccount(AccountPK pk, java.lang.String name, java.lang.String address, double balance) throws DAOException
insertAccount
in interface MyDao
pk
- the account primary keyname
- the account nameaddress
- the account email addressbalance
- the account balanceDAOException
- Object already exist, or problem with insertpublic int deleteAccount(AccountPK pk) throws DAOException
deleteAccount
in interface MyDao
pk
- the account primary keyDAOException
- the account element not exist or problem with deletepublic AccountOM readAccount(AccountPK pk) throws DAOException
readAccount
in interface MyDao
pk
- the account primary keyDAOException
- the account not exist, or problem whit selectpublic int updateAccount(AccountPK key, java.lang.String name, java.lang.String address, double balance) throws DAOException
updateAccount
in interface MyDao
key
- the account primary keyname
- the account name valueaddress
- the account address valuebalance
- the account balance valueDAOException
- account not exist or problem with updatepublic boolean accountExists(AccountPK key) throws DAOException
accountExists
in interface MyDao
key
- the Primary Key for this accountDAOException
- thrown if an object not existprivate void initResourceFile(java.lang.String dataSourceName) throws java.lang.Exception
dataSourceName
- the fiel name repositoryjava.lang.Exception
- not found the file in the specify pathprivate void addNode(AccountOM accOm) throws DAOException
accOm
- the account valueDAOException
- object already exist or problem with insertprivate AccountOM getValueObject(org.w3c.dom.Node node, java.lang.String pkValue)
node
- the node valuepkValue
- the primary key valueprivate org.w3c.dom.Node getNode(java.lang.String pkValue) throws DAOException
pkValue
- the primary keyDAOException
- problem with DOM selectprivate void updateDocument(AccountOM ao) throws DAOException
ao
- the account object to updateDAOException
- the object not exist or problem with updateprivate void openDocument() throws DAOException
DAOException
- problem with init DOMprivate void saveDocument() throws DAOException
DAOException
- problem with saving
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |