Writes the details of a recurring exception.

@param mpxjException source MPXJ calendar exception
@param xmlException target MSPDI exception
428620
private void populateRecurringException(ProjectCalendarException mpxjException, Exceptions.Exception xmlException)
   {
      RecurringData data = mpxjException.getRecurring();
      xmlException.setEnteredByOccurrences(Boolean.TRUE);
      xmlException.setOccurrences(NumberHelper.getBigInteger(data.getOccurrences()));

      switch (data.getRecurrenceType())
      {
         case DAILY:
         {
            xmlException.setType(BigInteger.valueOf(7));
            xmlException.setPeriod(NumberHelper.getBigInteger(data.getFrequency()));
            break;
         }

         case WEEKLY:
         {
            xmlException.setType(BigInteger.valueOf(6));
            xmlException.setPeriod(NumberHelper.getBigInteger(data.getFrequency()));
            xmlException.setDaysOfWeek(getDaysOfTheWeek(data));
            break;
         }

         case MONTHLY:
         {
            xmlException.setPeriod(NumberHelper.getBigInteger(data.getFrequency()));
            if (data.getRelative())
            {
               xmlException.setType(BigInteger.valueOf(5));
               xmlException.setMonthItem(BigInteger.valueOf(data.getDayOfWeek().getValue() + 2));
               xmlException.setMonthPosition(BigInteger.valueOf(NumberHelper.getInt(data.getDayNumber()) - 1));
            }
            else
            {
               xmlException.setType(BigInteger.valueOf(4));
               xmlException.setMonthDay(NumberHelper.getBigInteger(data.getDayNumber()));
            }
            break;
         }

         case YEARLY:
         {
            xmlException.setMonth(BigInteger.valueOf(NumberHelper.getInt(data.getMonthNumber()) - 1));
            if (data.getRelative())
            {
               xmlException.setType(BigInteger.valueOf(3));
               xmlException.setMonthItem(BigInteger.valueOf(data.getDayOfWeek().getValue() + 2));
               xmlException.setMonthPosition(BigInteger.valueOf(NumberHelper.getInt(data.getDayNumber()) - 1));
            }
            else
            {
               xmlException.setType(BigInteger.valueOf(2));
               xmlException.setMonthDay(NumberHelper.getBigInteger(data.getDayNumber()));
            }
         }
      }
   }
1070117
public void writeEndElement() throws XMLStreamException {
		try {
			this.checkPendingATEvents();
			encoder.encodeEndElement();
		} catch (Exception e) {
			throw new XMLStreamException(e.getLocalizedMessage(), e);
		}
	}
118540
@Override
    protected void throwStreamException(String msg, Location loc)
        throws XMLStreamException
    {
        if (loc == null) {
            throw new WstxParsingException(msg);
        }
        throw new WstxParsingException(msg, loc);
    }
950756
private void processExceptions(ProjectCalendar calendar) throws Exception
   {
      List<Row> rows = getRows("select * from zcalendarrule where zcalendar=? and z_ent=?", calendar.getUniqueID(), m_entityMap.get("CalendarExceptionRule"));
      for (Row row : rows)
      {
         Date startDay = row.getDate("ZSTARTDAY");
         Date endDay = row.getDate("ZENDDAY");
         ProjectCalendarException exception = calendar.addCalendarException(startDay, endDay);

         String timeIntervals = row.getString("ZTIMEINTERVALS");
         if (timeIntervals != null)
         {
            NodeList nodes = getNodeList(timeIntervals, m_dayTimeIntervals);
            for (int loop = 0; loop < nodes.getLength(); loop++)
            {
               NamedNodeMap attributes = nodes.item(loop).getAttributes();
               Date startTime = m_calendarTimeFormat.parse(attributes.getNamedItem("startTime").getTextContent());
               Date endTime = m_calendarTimeFormat.parse(attributes.getNamedItem("endTime").getTextContent());

               if (startTime.getTime() >= endTime.getTime())
               {
                  endTime = DateHelper.addDays(endTime, 1);
               }

               exception.addRange(new DateRange(startTime, endTime));
            }
         }
      }
   }
121455
private void writeResourceExtendedAttributes(Project.Resources.Resource xml, Resource mpx)
   {
      Project.Resources.Resource.ExtendedAttribute attrib;
      List<Project.Resources.Resource.ExtendedAttribute> extendedAttributes = xml.getExtendedAttribute();

      for (ResourceField mpxFieldID : getAllResourceExtendedAttributes())
      {
         Object value = mpx.getCachedValue(mpxFieldID);

         if (FieldTypeHelper.valueIsNotDefault(mpxFieldID, value))
         {
            m_extendedAttributesInUse.add(mpxFieldID);

            Integer xmlFieldID = Integer.valueOf(MPPResourceField.getID(mpxFieldID) | MPPResourceField.RESOURCE_FIELD_BASE);

            attrib = m_factory.createProjectResourcesResourceExtendedAttribute();
            extendedAttributes.add(attrib);
            attrib.setFieldID(xmlFieldID.toString());
            attrib.setValue(DatatypeConverter.printExtendedAttribute(this, value, mpxFieldID.getDataType()));
            attrib.setDurationFormat(printExtendedAttributeDurationFormat(value));
         }
      }
   }
927616
private void writeResource(Resource record) throws IOException
   {
      m_buffer.setLength(0);

      //
      // Write the resource record
      //
      int[] fields = m_resourceModel.getModel();

      m_buffer.append(MPXConstants.RESOURCE_RECORD_NUMBER);
      for (int loop = 0; loop < fields.length; loop++)
      {
         int mpxFieldType = fields[loop];
         if (mpxFieldType == -1)
         {
            break;
         }

         ResourceField resourceField = MPXResourceField.getMpxjField(mpxFieldType);
         Object value = record.getCachedValue(resourceField);
         value = formatType(resourceField.getDataType(), value);

         m_buffer.append(m_delimiter);
         m_buffer.append(format(value));
      }

      stripTrailingDelimiters(m_buffer);
      m_buffer.append(MPXConstants.EOL);
      m_writer.write(m_buffer.toString());

      //
      // Write the resource notes
      //
      String notes = record.getNotes();
      if (notes.length() != 0)
      {
         writeNotes(MPXConstants.RESOURCE_NOTES_RECORD_NUMBER, notes);
      }

      //
      // Write the resource calendar
      //
      if (record.getResourceCalendar() != null)
      {
         writeCalendar(record.getResourceCalendar());
      }

      m_eventManager.fireResourceWrittenEvent(record);
   }
1286729
private void writeExceptions(Project.Calendars.Calendar calendar, List<Project.Calendars.Calendar.WeekDays.WeekDay> dayList, List<ProjectCalendarException> exceptions)
   {
      // Always write legacy exception data:
      // Powerproject appears not to recognise new format data at all,
      // and legacy data is ignored in preference to new data post MSP 2003
      writeExceptions9(dayList, exceptions);

      if (m_saveVersion.getValue() > SaveVersion.Project2003.getValue())
      {
         writeExceptions12(calendar, exceptions);
      }
   }
1119007
public static void write(final Hml data, final Writer writer) throws IOException {
        checkNotNull(data);
        checkNotNull(writer);

        try {
            JAXBContext context = JAXBContext.newInstance(Hml.class);
            Marshaller marshaller = context.createMarshaller();
            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
            URL schemaURL = HmlReader.class.getResource("/org/nmdp/ngs/hml/xsd/hml-1.0.1.xsd");
            Schema schema = schemaFactory.newSchema(schemaURL);
            marshaller.setSchema(schema);
            marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
            marshaller.marshal(data, writer);
        }
        catch (JAXBException | SAXException e) {
            e.printStackTrace();
            throw new IOException("could not marshal HML", e);
        }
    }
764806
public void write(boolean skipNonOverrides,
                      boolean withXMLDeclaration,
                      PrintWriter writer) {

        final String indent = "                           ";

        // header
        if (withXMLDeclaration) {
            writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        }
        writer.println("<" + _CONFIG + " xmlns=\"" + BE_SECURITY.uri + "\"");
        writer.println(indent + " xmlns:xsi=\"" + XSI.uri + "\"");
        writer.println(indent + " xsi:schemaLocation=\"" + BE_SECURITY.uri
                + " " + BE_SECURITY1_0.xsdLocation + "\"");

        // default values
        writer.print(indent);
        write(m_defaultConfig, false, skipNonOverrides, writer);
        writer.println(">");

        // fedoraInternalCall-1 and -2
        writeInternalConfig(1,
                            m_internalSSL,
                            m_internalBasicAuth,
                            m_internalUsername,
                            m_internalPassword,
                            m_internalIPList,
                            writer);
        writeInternalConfig(2,
                            Boolean.FALSE,
                            Boolean.FALSE,
                            null,
                            null,
                            m_internalIPList,
                            writer);

        // sDep roles
        Iterator<String> bIter = m_sDepConfigs.keySet().iterator();
        while (bIter.hasNext()) {
            String role = bIter.next();
            ServiceDeploymentRoleConfig bConfig = m_sDepConfigs.get(role);
            write(bConfig, true, skipNonOverrides, writer);
            // per-method roles
            Iterator<String> mIter = bConfig.getMethodConfigs().keySet().iterator();
            while (mIter.hasNext()) {
                String methodName = mIter.next();
                MethodRoleConfig mConfig =
                        bConfig.getMethodConfigs().get(methodName);
                write(mConfig, true, skipNonOverrides, writer);
            }
        }

        // closing element for entire doc
        writer.println("</" + _CONFIG + ">");
    }
1105666
public static void generateJRXML(DynamicReport dr, LayoutManager layoutManager, Map _parameters, String xmlEncoding, OutputStream outputStream) throws JRException {
        JasperReport jr = generateJasperReport(dr, layoutManager, _parameters);
        if (xmlEncoding == null)
            xmlEncoding = DEFAULT_XML_ENCODING;
        JRXmlWriter.writeReport(jr, outputStream, xmlEncoding);
    }
662667
private void throwSaxException(Exception src)
        throws SAXException
    {
        SAXParseException se = new SAXParseException(src.getMessage(), /*(Locator)*/ this, src);
        ExceptionUtil.setInitCause(se, src);
        if (mErrorHandler != null) {
            mErrorHandler.fatalError(se);
        }
        throw se;
    }
1252015
private void processExceptionDays(ProjectCalendar mpxjCalendar, List<net.sf.mpxj.planner.schema.Day> dayList)
   {
      for (ProjectCalendarException mpxjCalendarException : mpxjCalendar.getCalendarExceptions())
      {
         Date rangeStartDay = mpxjCalendarException.getFromDate();
         Date rangeEndDay = mpxjCalendarException.getToDate();
         if (DateHelper.getDayStartDate(rangeStartDay).getTime() == DateHelper.getDayEndDate(rangeEndDay).getTime())
         {
            //
            // Exception covers a single day
            //
            net.sf.mpxj.planner.schema.Day day = m_factory.createDay();
            dayList.add(day);
            day.setType("day-type");
            day.setDate(getDateString(mpxjCalendarException.getFromDate()));
            day.setId(mpxjCalendarException.getWorking() ? "0" : "1");
         }
         else
         {
            //
            // Exception covers a range of days
            //
            Calendar cal = DateHelper.popCalendar(rangeStartDay);

            while (cal.getTime().getTime() < rangeEndDay.getTime())
            {
               net.sf.mpxj.planner.schema.Day day = m_factory.createDay();
               dayList.add(day);
               day.setType("day-type");
               day.setDate(getDateString(cal.getTime()));
               day.setId(mpxjCalendarException.getWorking() ? "0" : "1");
               cal.add(Calendar.DAY_OF_YEAR, 1);
            }
            
            DateHelper.pushCalendar(cal);
         }

         /**
          * @TODO we need to deal with date ranges here
          */
      }
   }
309207
@Override
    public void xmlWriteOn(FormattedWriter writer) throws IOException
    {
        writer.startTag(XML_MESSAGE_STORE);
        writer.indent();
        synchronized (_startLock)
        {
            if (_state == MessageStoreState.STATE_STARTED)
            {
                _rootMembership.xmlWriteItemStreamsOn(writer);
            }
            else
            {
                writer.newLine();
                writer.write(XML_CANNOT_BE_WRITTEN);
            }
        }

        if (null != _itemStorageManager)
        {
            _itemStorageManager.xmlWriteOn(writer);
        }

        if (null != _membershipMap)
        {
            _membershipMap.xmlWriteOn(writer);
        }

        if (null != _persistentMessageStore)
        {
            _persistentMessageStore.xmlWriteOn(writer);
        }

        if (null != _expirer)
        {
            _expirer.xmlWriteOn(writer);
        }

        if (null != _cacheLoader)
        {
            _cacheLoader.xmlWriteOn(writer);
        }

        if (null != _deliveryDelayManager) {
            _deliveryDelayManager.xmlWriteOn(writer);
        }
        writer.outdent();
        writer.newLine();
        writer.endTag(XML_MESSAGE_STORE);
    }
270506
private void addException(ProjectCalendar mpxjCalendar, net.sf.mpxj.ganttproject.schema.Date date)
   {
      String year = date.getYear();
      if (year == null || year.isEmpty())
      {
         // In order to process recurring exceptions using MPXJ, we need a start and end date
         // to constrain the number of dates we generate.
         // May need to pre-process the tasks in order to calculate a start and finish date.
         // TODO: handle recurring exceptions
      }
      else
      {
         Calendar calendar = DateHelper.popCalendar();
         calendar.set(Calendar.YEAR, Integer.parseInt(year));
         calendar.set(Calendar.MONTH, NumberHelper.getInt(date.getMonth()));
         calendar.set(Calendar.DAY_OF_MONTH, NumberHelper.getInt(date.getDate()));
         Date exceptionDate = calendar.getTime();
         DateHelper.pushCalendar(calendar);
         ProjectCalendarException exception = mpxjCalendar.addCalendarException(exceptionDate, exceptionDate);

         // TODO: not sure how NEUTRAL should be handled
         if ("WORKING_DAY".equals(date.getType()))
         {
            exception.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING);
            exception.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON);
         }
      }
   }
1094844
@Override
    public void writeXML(XMLOutput xmlOutput) throws IOException {
        xmlOutput.openCloseTag(
                ELEMENT_NAME,
                new XMLAttributeList().addAttribute("sequence", String.valueOf(sequence))
                .addAttribute("timestamp", String.valueOf(timestamp)).addAttribute("release", releaseName)
                .addAttribute("codeSize", String.valueOf(codeSize))
                .addAttribute("numClasses", String.valueOf(numClasses)));
    }
537476
private void writeResource(Resource mpxjResource, net.sf.mpxj.planner.schema.Resource plannerResource)
   {
      ProjectCalendar resourceCalendar = mpxjResource.getResourceCalendar();
      if (resourceCalendar != null)
      {
         plannerResource.setCalendar(getIntegerString(resourceCalendar.getUniqueID()));
      }

      plannerResource.setEmail(mpxjResource.getEmailAddress());
      plannerResource.setId(getIntegerString(mpxjResource.getUniqueID()));
      plannerResource.setName(getString(mpxjResource.getName()));
      plannerResource.setNote(mpxjResource.getNotes());
      plannerResource.setShortName(mpxjResource.getInitials());
      plannerResource.setType(mpxjResource.getType() == ResourceType.MATERIAL ? "2" : "1");
      //plannerResource.setStdRate();
      //plannerResource.setOvtRate();
      plannerResource.setUnits("0");
      //plannerResource.setProperties();
      m_eventManager.fireResourceWrittenEvent(mpxjResource);
   }
1187546
protected void writeDocumentTrailer(XMLEventWriter writer)
            throws JournalException {
        try {
            putEndDocument(writer);
        } catch (XMLStreamException e) {
            throw new JournalException(e);
        }
    }