Ejemplo n.º 1
0
 /**
  * Create author by node data
  *
  * @param node
  * @return
  * @throws RepositoryException
  */
 private Author createAuthorByNode(Node node) throws RepositoryException {
   if (node != null) {
     Author author = new Author();
     try {
       author.setAuthorId(Integer.valueOf(node.getName()));
     } catch (RepositoryException re) {
       log.error("Error in convert integer", re);
       return null;
     }
     PropertyReader reader = new PropertyReader(node);
     author.setName(reader.string(BookNodeTypes.EXO_AUTHOR_NAME));
     author.setPhone(reader.string(BookNodeTypes.EXO_AUTHOR_PHONE));
     author.setAddress(reader.string(BookNodeTypes.EXO_AUTHOR_ADDRESS));
     return author;
   }
   return null;
 }
Ejemplo n.º 2
0
 /**
  * Create book by node data
  *
  * @param node
  * @return
  * @throws RepositoryException
  */
 private Book createBookByNode(Node node) throws RepositoryException {
   if (node != null) {
     Book book = new Book();
     try {
       book.setBookId(Integer.valueOf(node.getName()));
     } catch (Exception e) {
       return null;
     }
     PropertyReader reader = new PropertyReader(node);
     book.setCategory(
         Utils.bookCategoryStringToEnum(reader.string(BookNodeTypes.EXO_BOOK_CATEGORY)));
     book.setName(reader.string(BookNodeTypes.EXO_BOOK_NAME));
     book.setContent(reader.string(BookNodeTypes.EXO_BOOK_CONTENT));
     return book;
   }
   return null;
 }
Ejemplo n.º 3
0
 /**
  * Create user by node data
  *
  * @param node
  * @return
  * @throws RepositoryException
  */
 private User createUserByNode(Node node) throws RepositoryException {
   if (node != null) {
     User user = new User();
     try {
       user.setUserId(Integer.valueOf(node.getName()));
     } catch (RepositoryException re) {
       log.error("Error in convert integer", re);
       return null;
     }
     PropertyReader reader = new PropertyReader(node);
     user.setUsername(reader.string(BookNodeTypes.EXO_USER_NAME));
     user.setPassword(reader.string(BookNodeTypes.EXO_USER_PASSWORD));
     user.setFullname(reader.string(BookNodeTypes.EXO_USER_FULLNAME));
     user.setAddress(reader.string(BookNodeTypes.EXO_USER_ADDRESS));
     user.setPhone(reader.string(BookNodeTypes.EXO_USER_PHONE));
     return user;
   }
   return null;
 }