Logo Search packages:      
Sourcecode: pcalendar version File versions  Download package

void net::sf::linuxorg::pcal::engine::Engine::loadFromFileDateValues ( final Document  doc ) throws SAXException [inline, private]

loadFromFile helper

Parameters:
doc
Exceptions:
SAXException

Definition at line 666 of file Engine.java.

References bBTList, dateValueTypeToTagMap, notesContainer, and net::sf::linuxorg::pcal::engine::DateIntsContainer::parseFromStringFactory().

Referenced by loadFromFile().

                                                                                  {
            for(Integer valueTypeID: dateValueTypeToTagMap.keySet()) {
                  NodeList nl;
                  Date date;
                  String text;
                  nl = doc.getElementsByTagName(dateValueTypeToTagMap.get(valueTypeID));              
                  for(int i = 0; i<nl.getLength();i++) {
                        NodeList nmp = nl.item(i).getChildNodes();
                        date = null;
                        text = null;
                        for(int j=0;j<nmp.getLength();j++) {
                              Node tmpNode = nmp.item(j);
                              if(tmpNode.getNodeName().equals("date")) { //$NON-NLS-1$
                                    String tmpText = tmpNode.getTextContent();                  
                                    if(tmpText == null) {
                                          throw new SAXException(Messages.getString("Engine.1")); //$NON-NLS-1$
                                    }
                                    try {
                                          date = DATE_FORMAT.parse(tmpText);
                                    } catch (ParseException e) {
                                          throw new SAXException(Messages.getString("Engine.2")+text); //$NON-NLS-1$
                                    }

                              } else 
                                    if(tmpNode.getNodeName().equals("text")) { //$NON-NLS-1$
                                          text = tmpNode.getTextContent();
                                    }
                        }
                        if((text == null) || (date == null)) {
                              throw new SAXException(Messages.getString("Engine.1")); //$NON-NLS-1$
                        }

                        if(valueTypeID.equals(PCAL_TYPE_NOTES)) {
                              notesContainer.put(date, text);
                        } else
                              if(valueTypeID.equals(PCAL_TYPE_BBT)) {
                                    try {
                                          bBTList.put(date, Integer.parseInt(text));                                          
                                    }
                                    catch (NumberFormatException e) {
                                          // Even the minor file corruption can be a big problem. Stop everything.
                                          // Incorrect BBT entry
                                          throw new SAXException(Messages.getString("Engine.4")); //$NON-NLS-1$
                                    }
                              } else
                                    if(valueTypeID.equals(PCAL_TYPE_DATE_INTS)) {
                                          try {
                                                dateIntValues.put(date, DateIntsContainer.parseFromStringFactory(text));
                                          }
                                          catch (NumberFormatException e) {
                                                // Even the minor file corruption can be a big problem. Stop everything.
                                                // Incorrect Date Integer Entry
                                                throw new SAXException(Messages.getString("Engine.3")); //$NON-NLS-1$
                                          }
                                    }

                  }
            }
      }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index