org.apache.poi.poifs.filesystem.DirectoryEntry Java Examples

The following examples show how to use org.apache.poi.poifs.filesystem.DirectoryEntry. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MPP8Reader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * This method extracts view data from the MPP file.
 *
 * @throws IOException
 */
private void processViewData() throws IOException
{
   DirectoryEntry dir = (DirectoryEntry) m_viewDir.getEntry("CV_iew");
   FixFix ff = new FixFix(138, new DocumentInputStream(((DocumentEntry) dir.getEntry("FixFix   0"))));
   int items = ff.getItemCount();
   byte[] data;
   View view;

   for (int loop = 0; loop < items; loop++)
   {
      data = ff.getByteArrayValue(loop);
      view = new View8(m_file, data);
      m_file.getViews().add(view);
   }
}
 
Example #2
Source File: MPP9Reader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Read saved view state from an MPP file.
 *
 * @throws IOException
 */
private void processSavedViewState() throws IOException
{
   DirectoryEntry dir = (DirectoryEntry) m_viewDir.getEntry("CEdl");
   VarMeta varMeta = new VarMeta9(new DocumentInputStream(((DocumentEntry) dir.getEntry("VarMeta"))));
   Var2Data varData = new Var2Data(varMeta, new DocumentInputStream(((DocumentEntry) dir.getEntry("Var2Data"))));
   //System.out.println(varMeta);
   //System.out.println(varData);

   InputStream is = m_inputStreamFactory.getInstance(dir, "FixedData");
   byte[] fixedData = new byte[is.available()];
   is.read(fixedData);
   //System.out.println(ByteArrayHelper.hexdump(fixedData, false, 16, ""));

   ViewStateReader reader = new ViewStateReader9();
   reader.process(m_file, varData, fixedData);
}
 
Example #3
Source File: MPP14Reader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * This method extracts and collates resource assignment data.
 *
 * @throws IOException
 */
private void processAssignmentData() throws IOException
{
   FieldMap fieldMap = new FieldMap14(m_file.getProjectProperties(), m_file.getCustomFields());
   fieldMap.createAssignmentFieldMap(m_projectProps);

   FieldMap enterpriseCustomFieldMap = new FieldMap14(m_file.getProjectProperties(), m_file.getCustomFields());
   enterpriseCustomFieldMap.createEnterpriseCustomFieldMap(m_projectProps, AssignmentField.class);

   DirectoryEntry assnDir = (DirectoryEntry) m_projectDir.getEntry("TBkndAssn");
   VarMeta assnVarMeta = new VarMeta12(new DocumentInputStream(((DocumentEntry) assnDir.getEntry("VarMeta"))));
   Var2Data assnVarData = new Var2Data(assnVarMeta, new DocumentInputStream(((DocumentEntry) assnDir.getEntry("Var2Data"))));
   FixedMeta assnFixedMeta = new FixedMeta(new DocumentInputStream(((DocumentEntry) assnDir.getEntry("FixedMeta"))), 34);
   FixedData assnFixedData = new FixedData(110, m_inputStreamFactory.getInstance(assnDir, "FixedData"));
   FixedData assnFixedData2 = new FixedData(48, m_inputStreamFactory.getInstance(assnDir, "Fixed2Data"));
   //FixedMeta assnFixedMeta2 = new FixedMeta(new DocumentInputStream(((DocumentEntry) assnDir.getEntry("Fixed2Meta"))), 53);
   //Props props = new Props14(new DocumentInputStream(((DocumentEntry) assnDir.getEntry("Props"))));

   ResourceAssignmentFactory factory = new ResourceAssignmentFactory();
   factory.process(m_file, fieldMap, enterpriseCustomFieldMap, m_reader.getUseRawTimephasedData(), m_reader.getPreserveNoteFormatting(), assnVarMeta, assnVarData, assnFixedMeta, assnFixedData, assnFixedData2, assnFixedMeta.getItemCount());
}
 
Example #4
Source File: MPP9Reader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Read group definitions.
 *
 * @todo Doesn't work correctly with MPP9 files saved by Propject 2007 and 2010
 * @throws IOException
 */
private void processGroupData() throws IOException
{
   DirectoryEntry dir = (DirectoryEntry) m_viewDir.getEntry("CGrouping");
   //FixedMeta fixedMeta = new FixedMeta(new DocumentInputStream(((DocumentEntry) dir.getEntry("FixedMeta"))), 9);
   FixedData fixedData = new FixedData(110, m_inputStreamFactory.getInstance(dir, "FixedData"));
   VarMeta varMeta = new VarMeta9(new DocumentInputStream(((DocumentEntry) dir.getEntry("VarMeta"))));
   Var2Data varData = new Var2Data(varMeta, new DocumentInputStream(((DocumentEntry) dir.getEntry("Var2Data"))));

   //      System.out.println(fixedMeta);
   //      System.out.println(fixedData);
   //      System.out.println(varMeta);
   //      System.out.println(varData);

   GroupReader reader = new GroupReader9();
   reader.process(m_file, fixedData, varData, m_fontBases);
}
 
Example #5
Source File: MPP14Reader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * This method extracts table data from the MPP file.
 *
 * @throws java.io.IOException
 */
private void processTableData() throws IOException
{
   DirectoryEntry dir = (DirectoryEntry) m_viewDir.getEntry("CTable");

   VarMeta varMeta = new VarMeta12(new DocumentInputStream(((DocumentEntry) dir.getEntry("VarMeta"))));
   Var2Data varData = new Var2Data(varMeta, new DocumentInputStream(((DocumentEntry) dir.getEntry("Var2Data"))));
   FixedData fixedData = new FixedData(230, new DocumentInputStream(((DocumentEntry) dir.getEntry("FixedData"))));
   //System.out.println(varMeta);
   //System.out.println(varData);
   //System.out.println(fixedData);

   TableContainer container = m_file.getTables();
   TableFactory14 factory = new TableFactory14(TABLE_COLUMN_DATA_STANDARD, TABLE_COLUMN_DATA_ENTERPRISE, TABLE_COLUMN_DATA_BASELINE);
   int items = fixedData.getItemCount();
   for (int loop = 0; loop < items; loop++)
   {
      byte[] data = fixedData.getByteArrayValue(loop);
      Table table = factory.createTable(m_file, data, varMeta, varData);
      container.add(table);
      //System.out.println(table);
   }
}
 
Example #6
Source File: MPP14Reader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Read saved view state from an MPP file.
 *
 * @throws IOException
 */
private void processSavedViewState() throws IOException
{
   DirectoryEntry dir = (DirectoryEntry) m_viewDir.getEntry("CEdl");
   VarMeta varMeta = new VarMeta12(new DocumentInputStream(((DocumentEntry) dir.getEntry("VarMeta"))));
   Var2Data varData = new Var2Data(varMeta, new DocumentInputStream(((DocumentEntry) dir.getEntry("Var2Data"))));
   //System.out.println(varMeta);
   //System.out.println(varData);

   InputStream is = new DocumentInputStream(((DocumentEntry) dir.getEntry("FixedData")));
   byte[] fixedData = new byte[is.available()];
   is.read(fixedData);
   is.close();
   //System.out.println(ByteArrayHelper.hexdump(fixedData, false, 16, ""));

   ViewStateReader reader = new ViewStateReader12();
   reader.process(m_file, varData, fixedData);
}
 
Example #7
Source File: MPP14Reader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Read group definitions.
 *
 * @throws IOException
 */
private void processGroupData() throws IOException
{
   DirectoryEntry dir = (DirectoryEntry) m_viewDir.getEntry("CGrouping");
   FixedMeta fixedMeta = new FixedMeta(new DocumentInputStream(((DocumentEntry) dir.getEntry("FixedMeta"))), 10);
   FixedData fixedData = new FixedData(fixedMeta, m_inputStreamFactory.getInstance(dir, "FixedData"));
   VarMeta varMeta = new VarMeta12(new DocumentInputStream(((DocumentEntry) dir.getEntry("VarMeta"))));
   Var2Data varData = new Var2Data(varMeta, new DocumentInputStream(((DocumentEntry) dir.getEntry("Var2Data"))));

   //System.out.println(fixedMeta);
   //System.out.println(fixedData);
   //System.out.println(varMeta);
   //System.out.println(varData);

   GroupReader14 reader = new GroupReader14();
   reader.process(m_file, fixedData, varData, m_fontBases);
}
 
Example #8
Source File: MPP9Reader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Read filter definitions.
 *
 * @todo Doesn't work correctly with MPP9 files saved by Propject 2007 and 2010
 * @throws IOException
 */
private void processFilterData() throws IOException
{
   DirectoryEntry dir = (DirectoryEntry) m_viewDir.getEntry("CFilter");
   //FixedMeta fixedMeta = new FixedMeta(new DocumentInputStream(((DocumentEntry) dir.getEntry("FixedMeta"))), 9);
   //FixedData fixedData = new FixedData(fixedMeta, getEncryptableInputStream(dir, "FixedData"));
   InputStream stream = m_inputStreamFactory.getInstance(dir, "FixedData");
   int blockSize = stream.available() % 115 == 0 ? 115 : 110;
   FixedData fixedData = new FixedData(blockSize, stream, true);
   VarMeta varMeta = new VarMeta9(new DocumentInputStream(((DocumentEntry) dir.getEntry("VarMeta"))));
   Var2Data varData = new Var2Data(varMeta, new DocumentInputStream(((DocumentEntry) dir.getEntry("Var2Data"))));

   //System.out.println(fixedMeta);
   //System.out.println(fixedData);
   //System.out.println(varMeta);
   //System.out.println(varData);

   FilterReader reader = new FilterReader9();
   reader.process(m_file.getProjectProperties(), m_file.getFilters(), fixedData, varData);
}
 
Example #9
Source File: MPP9Reader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * This method extracts table data from the MPP file.
 *
 * @todo This implementation does not deal with MPP9 files saved by later
 * versions of MS Project
 *
 * @throws IOException
 */
private void processTableData() throws IOException
{
   DirectoryEntry dir = (DirectoryEntry) m_viewDir.getEntry("CTable");
   //FixedMeta fixedMeta = new FixedMeta(getEncryptableInputStream(dir, "FixedMeta"), 9);
   InputStream stream = m_inputStreamFactory.getInstance(dir, "FixedData");
   int blockSize = stream.available() % 115 == 0 ? 115 : 110;
   FixedData fixedData = new FixedData(blockSize, stream);
   VarMeta varMeta = new VarMeta9(new DocumentInputStream(((DocumentEntry) dir.getEntry("VarMeta"))));
   Var2Data varData = new Var2Data(varMeta, new DocumentInputStream(((DocumentEntry) dir.getEntry("Var2Data"))));

   TableContainer container = m_file.getTables();
   TableFactory factory = new TableFactory(TABLE_COLUMN_DATA_STANDARD, TABLE_COLUMN_DATA_ENTERPRISE, TABLE_COLUMN_DATA_BASELINE);
   int items = fixedData.getItemCount();
   for (int loop = 0; loop < items; loop++)
   {
      byte[] data = fixedData.getByteArrayValue(loop);
      Table table = factory.createTable(m_file, data, varMeta, varData);
      container.add(table);
      //System.out.println(table);
   }
}
 
Example #10
Source File: MPP12Reader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * This method extracts and collates resource assignment data.
 *
 * @throws IOException
 */
private void processAssignmentData() throws IOException
{
   FieldMap fieldMap = new FieldMap12(m_file.getProjectProperties(), m_file.getCustomFields());
   fieldMap.createAssignmentFieldMap(m_projectProps);

   FieldMap enterpriseCustomFieldMap = new FieldMap12(m_file.getProjectProperties(), m_file.getCustomFields());
   enterpriseCustomFieldMap.createEnterpriseCustomFieldMap(m_projectProps, AssignmentField.class);

   DirectoryEntry assnDir = (DirectoryEntry) m_projectDir.getEntry("TBkndAssn");
   VarMeta assnVarMeta = new VarMeta12(new DocumentInputStream(((DocumentEntry) assnDir.getEntry("VarMeta"))));
   Var2Data assnVarData = new Var2Data(assnVarMeta, new DocumentInputStream(((DocumentEntry) assnDir.getEntry("Var2Data"))));
   FixedMeta assnFixedMeta = new FixedMeta(new DocumentInputStream(((DocumentEntry) assnDir.getEntry("FixedMeta"))), 34);
   // MSP 20007 seems to write 142 byte blocks, MSP 2010 writes 110 byte blocks
   // We need to identify any cases where the meta data count does not correctly identify the block size
   FixedData assnFixedData = new FixedData(assnFixedMeta, m_inputStreamFactory.getInstance(assnDir, "FixedData"));
   FixedData assnFixedData2 = new FixedData(48, m_inputStreamFactory.getInstance(assnDir, "Fixed2Data"));
   ResourceAssignmentFactory factory = new ResourceAssignmentFactory();
   factory.process(m_file, fieldMap, enterpriseCustomFieldMap, m_reader.getUseRawTimephasedData(), m_reader.getPreserveNoteFormatting(), assnVarMeta, assnVarData, assnFixedMeta, assnFixedData, assnFixedData2, assnFixedMeta.getAdjustedItemCount());
}
 
Example #11
Source File: MPP9Reader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * This method extracts and collates resource assignment data.
 *
 * @throws IOException
 */
private void processAssignmentData() throws IOException
{
   FieldMap fieldMap = new FieldMap9(m_file.getProjectProperties(), m_file.getCustomFields());
   fieldMap.createAssignmentFieldMap(m_projectProps);

   DirectoryEntry assnDir = (DirectoryEntry) m_projectDir.getEntry("TBkndAssn");
   VarMeta assnVarMeta = new VarMeta9(new DocumentInputStream(((DocumentEntry) assnDir.getEntry("VarMeta"))));
   Var2Data assnVarData = new Var2Data(assnVarMeta, new DocumentInputStream(((DocumentEntry) assnDir.getEntry("Var2Data"))));

   FixedMeta assnFixedMeta = new FixedMeta(new DocumentInputStream(((DocumentEntry) assnDir.getEntry("FixedMeta"))), 34);
   FixedData assnFixedData = new FixedData(142, m_inputStreamFactory.getInstance(assnDir, "FixedData"));
   if (assnFixedData.getItemCount() != assnFixedMeta.getAdjustedItemCount())
   {
      assnFixedData = new FixedData(assnFixedMeta, m_inputStreamFactory.getInstance(assnDir, "FixedData"));
   }

   ResourceAssignmentFactory factory = new ResourceAssignmentFactory();
   factory.process(m_file, fieldMap, null, m_reader.getUseRawTimephasedData(), m_reader.getPreserveNoteFormatting(), assnVarMeta, assnVarData, assnFixedMeta, assnFixedData, null, assnFixedMeta.getAdjustedItemCount());
}
 
Example #12
Source File: MPP12Reader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * This method extracts table data from the MPP file.
 *
 * @throws java.io.IOException
 */
private void processTableData() throws IOException
{
   DirectoryEntry dir = (DirectoryEntry) m_viewDir.getEntry("CTable");

   VarMeta varMeta = new VarMeta12(new DocumentInputStream(((DocumentEntry) dir.getEntry("VarMeta"))));
   Var2Data varData = new Var2Data(varMeta, new DocumentInputStream(((DocumentEntry) dir.getEntry("Var2Data"))));
   FixedData fixedData = new FixedData(230, new DocumentInputStream(((DocumentEntry) dir.getEntry("FixedData"))));
   //System.out.println(varMeta);
   //System.out.println(varData);
   //System.out.println(fixedData);

   TableContainer container = m_file.getTables();
   TableFactory factory = new TableFactory(TABLE_COLUMN_DATA_STANDARD, TABLE_COLUMN_DATA_ENTERPRISE, TABLE_COLUMN_DATA_BASELINE);
   int items = fixedData.getItemCount();
   for (int loop = 0; loop < items; loop++)
   {
      byte[] data = fixedData.getByteArrayValue(loop);
      Table table = factory.createTable(m_file, data, varMeta, varData);
      container.add(table);
      //System.out.println(table);
   }
}
 
Example #13
Source File: MPP12Reader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Read filter definitions.
 *
 * @throws IOException
 */
private void processFilterData() throws IOException
{
   DirectoryEntry dir = (DirectoryEntry) m_viewDir.getEntry("CFilter");
   FixedMeta fixedMeta = new FixedMeta(new DocumentInputStream(((DocumentEntry) dir.getEntry("FixedMeta"))), 10);
   FixedData fixedData = new FixedData(fixedMeta, m_inputStreamFactory.getInstance(dir, "FixedData"));
   VarMeta varMeta = new VarMeta12(new DocumentInputStream(((DocumentEntry) dir.getEntry("VarMeta"))));
   Var2Data varData = new Var2Data(varMeta, new DocumentInputStream(((DocumentEntry) dir.getEntry("Var2Data"))));

   //System.out.println(fixedMeta);
   //System.out.println(fixedData);
   //System.out.println(varMeta);
   //System.out.println(varData);

   FilterReader reader = new FilterReader12();
   reader.process(m_file.getProjectProperties(), m_file.getFilters(), fixedData, varData);
}
 
Example #14
Source File: MPP12Reader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Read saved view state from an MPP file.
 *
 * @throws IOException
 */
private void processSavedViewState() throws IOException
{
   DirectoryEntry dir = (DirectoryEntry) m_viewDir.getEntry("CEdl");
   VarMeta varMeta = new VarMeta12(new DocumentInputStream(((DocumentEntry) dir.getEntry("VarMeta"))));
   Var2Data varData = new Var2Data(varMeta, new DocumentInputStream(((DocumentEntry) dir.getEntry("Var2Data"))));
   //System.out.println(varMeta);
   //System.out.println(varData);

   InputStream is = new DocumentInputStream(((DocumentEntry) dir.getEntry("FixedData")));
   byte[] fixedData = new byte[is.available()];
   is.read(fixedData);
   is.close();
   //System.out.println(ByteArrayHelper.hexdump(fixedData, false, 16, ""));

   ViewStateReader reader = new ViewStateReader12();
   reader.process(m_file, varData, fixedData);
}
 
Example #15
Source File: DataSpaceMapUtils.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public static void addDefaultDataSpace(DirectoryEntry dir) throws IOException {
    DataSpaceMapEntry dsme = new DataSpaceMapEntry(
            new int[]{ 0 }
          , new String[]{ Decryptor.DEFAULT_POIFS_ENTRY }
          , "StrongEncryptionDataSpace"
      );
      DataSpaceMap dsm = new DataSpaceMap(new DataSpaceMapEntry[]{dsme});
      createEncryptionEntry(dir, "\u0006DataSpaces/DataSpaceMap", dsm);

      DataSpaceDefinition dsd = new DataSpaceDefinition(new String[]{ "StrongEncryptionTransform" });
      createEncryptionEntry(dir, "\u0006DataSpaces/DataSpaceInfo/StrongEncryptionDataSpace", dsd);

      TransformInfoHeader tih = new TransformInfoHeader(
            1
          , "{FF9A3F03-56EF-4613-BDD5-5A41C1D07246}"
          , "Microsoft.Container.EncryptionTransform"
          , 1, 0, 1, 0, 1, 0
      );
      IRMDSTransformInfo irm = new IRMDSTransformInfo(tih, 0, null);
      createEncryptionEntry(dir, "\u0006DataSpaces/TransformInfo/StrongEncryptionTransform/\u0006Primary", irm);
      
      DataSpaceVersionInfo dsvi = new DataSpaceVersionInfo("Microsoft.Container.DataSpaces", 1, 0, 1, 0, 1, 0);
      createEncryptionEntry(dir, "\u0006DataSpaces/Version", dsvi);
}
 
Example #16
Source File: MPP12Reader.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Read group definitions.
 *
 * @todo Doesn't work correctly with MPP12 files saved by Project 2007 and 2010
 * @throws IOException
 */
private void processGroupData() throws IOException
{
   DirectoryEntry dir = (DirectoryEntry) m_viewDir.getEntry("CGrouping");
   FixedMeta fixedMeta = new FixedMeta(new DocumentInputStream(((DocumentEntry) dir.getEntry("FixedMeta"))), 10);
   FixedData fixedData = new FixedData(fixedMeta, m_inputStreamFactory.getInstance(dir, "FixedData"));
   VarMeta varMeta = new VarMeta12(new DocumentInputStream(((DocumentEntry) dir.getEntry("VarMeta"))));
   Var2Data varData = new Var2Data(varMeta, new DocumentInputStream(((DocumentEntry) dir.getEntry("Var2Data"))));

   //      System.out.println(fixedMeta);
   //      System.out.println(fixedData);
   //      System.out.println(varMeta);
   //      System.out.println(varData);

   GroupReader reader = new GroupReader12();
   reader.process(m_file, fixedData, varData, m_fontBases);
}
 
Example #17
Source File: MPP8Reader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * This method is used to process an MPP8 file. This is the file format
 * used by Project 98.
 *
 * @param reader parent file reader
 * @param file Parent MPX file
 * @param root Root of the POI file system.
 * @throws MPXJException
 * @throws IOException
 */
@Override public void process(MPPReader reader, ProjectFile file, DirectoryEntry root) throws MPXJException, IOException
{
   try
   {
      populateMemberData(reader, file, root);
      processProjectProperties();

      if (!reader.getReadPropertiesOnly())
      {
         processCalendarData();
         processResourceData();
         processTaskData();
         processConstraintData();
         processAssignmentData();

         if (reader.getReadPresentationData())
         {
            processViewPropertyData();
            processViewData();
            processTableData();
         }
      }
   }

   finally
   {
      clearMemberData();
   }
}
 
Example #18
Source File: MPP14Reader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * This method extracts view data from the MPP file.
 *
 * @throws java.io.IOException
 */
private void processViewData() throws IOException
{
   DirectoryEntry dir = (DirectoryEntry) m_viewDir.getEntry("CV_iew");
   VarMeta viewVarMeta = new VarMeta12(new DocumentInputStream(((DocumentEntry) dir.getEntry("VarMeta"))));
   Var2Data viewVarData = new Var2Data(viewVarMeta, new DocumentInputStream(((DocumentEntry) dir.getEntry("Var2Data"))));
   FixedMeta fixedMeta = new FixedMeta(new DocumentInputStream(((DocumentEntry) dir.getEntry("FixedMeta"))), 10);
   FixedData fixedData = new FixedData(138, m_inputStreamFactory.getInstance(dir, "FixedData"));

   int items = fixedMeta.getAdjustedItemCount();
   View view;
   ViewFactory factory = new ViewFactory14();

   int lastOffset = -1;
   for (int loop = 0; loop < items; loop++)
   {
      byte[] fm = fixedMeta.getByteArrayValue(loop);
      int offset = MPPUtility.getShort(fm, 4);
      if (offset > lastOffset)
      {
         byte[] fd = fixedData.getByteArrayValue(fixedData.getIndexFromOffset(offset));
         if (fd != null)
         {
            view = factory.createView(m_file, fm, fd, viewVarData, m_fontBases);
            m_file.getViews().add(view);
         }
         lastOffset = offset;
      }
   }
}
 
Example #19
Source File: MPP9Reader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Read data link definitions.
 */
private void processDataLinks() throws IOException
{
   DirectoryEntry dir = (DirectoryEntry) m_viewDir.getEntry("CEdl");
   FixedMeta fixedMeta = new FixedMeta(new DocumentInputStream(((DocumentEntry) dir.getEntry("FixedMeta"))), 10);
   FixedData fixedData = new FixedData(fixedMeta, m_inputStreamFactory.getInstance(dir, "FixedData"));
   VarMeta varMeta = new VarMeta9(new DocumentInputStream(((DocumentEntry) dir.getEntry("VarMeta"))));
   Var2Data varData = new Var2Data(varMeta, new DocumentInputStream(((DocumentEntry) dir.getEntry("Var2Data"))));

   DataLinkFactory factory = new DataLinkFactory(m_file, fixedData, varData);
   factory.process();
}
 
Example #20
Source File: MPP9Reader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * This method extracts view data from the MPP file.
 *
 * @throws IOException
 */
private void processViewData() throws IOException
{
   DirectoryEntry dir = (DirectoryEntry) m_viewDir.getEntry("CV_iew");
   VarMeta viewVarMeta = new VarMeta9(new DocumentInputStream(((DocumentEntry) dir.getEntry("VarMeta"))));
   Var2Data viewVarData = new Var2Data(viewVarMeta, new DocumentInputStream(((DocumentEntry) dir.getEntry("Var2Data"))));
   FixedMeta fixedMeta = new FixedMeta(new DocumentInputStream(((DocumentEntry) dir.getEntry("FixedMeta"))), 10);
   FixedData fixedData = new FixedData(122, m_inputStreamFactory.getInstance(dir, "FixedData"));

   int items = fixedMeta.getAdjustedItemCount();
   View view;
   ViewFactory factory = new ViewFactory9();

   int lastOffset = -1;
   for (int loop = 0; loop < items; loop++)
   {
      byte[] fm = fixedMeta.getByteArrayValue(loop);
      int offset = MPPUtility.getShort(fm, 4);
      if (offset > lastOffset)
      {
         byte[] fd = fixedData.getByteArrayValue(fixedData.getIndexFromOffset(offset));
         if (fd != null)
         {
            view = factory.createView(m_file, fm, fd, viewVarData, m_fontBases);
            m_file.getViews().add(view);
            //System.out.print(view);
         }
         lastOffset = offset;
      }
   }
}
 
Example #21
Source File: PoiTreeModel.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override public int getIndexOfChild(Object parent, Object child)
{
   int result = -1;
   if (parent instanceof DirectoryEntry)
   {
      List<Entry> entries = getChildNodes((DirectoryEntry) parent);
      result = entries.indexOf(child);
   }

   return result;
}
 
Example #22
Source File: MPP8Reader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Populate member data used by the rest of the reader.
 *
 * @param reader parent file reader
 * @param file parent MPP file
 * @param root Root of the POI file system.
 */
private void populateMemberData(MPPReader reader, ProjectFile file, DirectoryEntry root) throws IOException
{
   m_reader = reader;
   m_root = root;
   m_file = file;
   m_eventManager = file.getEventManager();

   m_calendarMap = new HashMap<>();
   m_projectDir = (DirectoryEntry) root.getEntry("   1");
   m_viewDir = (DirectoryEntry) root.getEntry("   2");

   m_file.getProjectProperties().setMppFileType(Integer.valueOf(8));
}
 
Example #23
Source File: MPP14Reader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * This method is used to process an MPP14 file. This is the file format
 * used by Project 14.
 *
 * @param reader parent file reader
 * @param file parent MPP file
 * @param root Root of the POI file system.
 */
@Override public void process(MPPReader reader, ProjectFile file, DirectoryEntry root) throws MPXJException, IOException
{
   try
   {
      populateMemberData(reader, file, root);
      processProjectProperties();

      if (!reader.getReadPropertiesOnly())
      {
         processSubProjectData();
         processGraphicalIndicators();
         processCustomValueLists();
         processCalendarData();
         processResourceData();
         processTaskData();
         processConstraintData();
         processAssignmentData();
         postProcessTasks();
         processDataLinks();

         if (reader.getReadPresentationData())
         {
            processViewPropertyData();
            processTableData();
            processViewData();
            processFilterData();
            processGroupData();
            processSavedViewState();
         }
      }
   }

   finally
   {
      clearMemberData();
   }
}
 
Example #24
Source File: MPP14Reader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * This method extracts and collates the value list information
 * for custom column value lists.
 * @throws IOException
 */
private void processCustomValueLists() throws IOException
{
   DirectoryEntry taskDir = (DirectoryEntry) m_projectDir.getEntry("TBkndTask");
   if (taskDir.hasEntry("Props"))
   {
      Props taskProps = new Props14(m_inputStreamFactory.getInstance(taskDir, "Props"));

      CustomFieldValueReader14 reader = new CustomFieldValueReader14(m_file.getProjectProperties(), m_file.getCustomFields(), m_outlineCodeVarMeta, m_outlineCodeVarData, m_outlineCodeFixedData, m_outlineCodeFixedData2, taskProps);
      reader.process();
   }
}
 
Example #25
Source File: MPP12Reader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Read data link definitions.
 */
private void processDataLinks() throws IOException
{
   DirectoryEntry dir = (DirectoryEntry) m_viewDir.getEntry("CEdl");
   FixedMeta fixedMeta = new FixedMeta(new DocumentInputStream(((DocumentEntry) dir.getEntry("FixedMeta"))), 11);
   FixedData fixedData = new FixedData(fixedMeta, m_inputStreamFactory.getInstance(dir, "FixedData"));
   VarMeta varMeta = new VarMeta12(new DocumentInputStream(((DocumentEntry) dir.getEntry("VarMeta"))));
   Var2Data varData = new Var2Data(varMeta, new DocumentInputStream(((DocumentEntry) dir.getEntry("Var2Data"))));

   DataLinkFactory factory = new DataLinkFactory(m_file, fixedData, varData);
   factory.process();
}
 
Example #26
Source File: MPP14Reader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Read data link definitions.
 */
private void processDataLinks() throws IOException
{
   DirectoryEntry dir = (DirectoryEntry) m_viewDir.getEntry("CEdl");
   FixedMeta fixedMeta = new FixedMeta(new DocumentInputStream(((DocumentEntry) dir.getEntry("FixedMeta"))), 11);
   FixedData fixedData = new FixedData(fixedMeta, m_inputStreamFactory.getInstance(dir, "FixedData"));
   VarMeta varMeta = new VarMeta12(new DocumentInputStream(((DocumentEntry) dir.getEntry("VarMeta"))));
   Var2Data varData = new Var2Data(varMeta, new DocumentInputStream(((DocumentEntry) dir.getEntry("Var2Data"))));

   DataLinkFactory factory = new DataLinkFactory(m_file, fixedData, varData);
   factory.process();
}
 
Example #27
Source File: MPP12Reader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * This method is used to process an MPP12 file. This is the file format
 * used by Project 12.
 *
 * @param reader parent file reader
 * @param file parent MPP file
 * @param root Root of the POI file system.
 */
@Override public void process(MPPReader reader, ProjectFile file, DirectoryEntry root) throws MPXJException, IOException
{
   try
   {
      populateMemberData(reader, file, root);
      processProjectProperties();

      if (!reader.getReadPropertiesOnly())
      {
         processSubProjectData();
         processGraphicalIndicators();
         processCustomValueLists();
         processCalendarData();
         processResourceData();
         processTaskData();
         processConstraintData();
         processAssignmentData();
         postProcessTasks();
         processDataLinks();

         if (reader.getReadPresentationData())
         {
            processViewPropertyData();
            processTableData();
            processViewData();
            processFilterData();
            processGroupData();
            processSavedViewState();
         }
      }
   }

   finally
   {
      clearMemberData();
   }
}
 
Example #28
Source File: MPP12Reader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * This method extracts and collates the value list information
 * for custom column value lists.
 */
private void processCustomValueLists() throws IOException
{
   DirectoryEntry taskDir = (DirectoryEntry) m_projectDir.getEntry("TBkndTask");
   Props taskProps = new Props12(m_inputStreamFactory.getInstance(taskDir, "Props"));

   CustomFieldValueReader12 reader = new CustomFieldValueReader12(m_file.getProjectProperties(), m_file.getCustomFields(), m_outlineCodeVarMeta, m_outlineCodeVarData, m_outlineCodeFixedData, m_outlineCodeFixedData2, taskProps);
   reader.process();
}
 
Example #29
Source File: MPP12Reader.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * This method extracts view data from the MPP file.
 *
 * @throws java.io.IOException
 */
private void processViewData() throws IOException
{
   DirectoryEntry dir = (DirectoryEntry) m_viewDir.getEntry("CV_iew");
   VarMeta viewVarMeta = new VarMeta12(new DocumentInputStream(((DocumentEntry) dir.getEntry("VarMeta"))));
   Var2Data viewVarData = new Var2Data(viewVarMeta, new DocumentInputStream(((DocumentEntry) dir.getEntry("Var2Data"))));
   FixedMeta fixedMeta = new FixedMeta(new DocumentInputStream(((DocumentEntry) dir.getEntry("FixedMeta"))), 10);
   FixedData fixedData = new FixedData(138, m_inputStreamFactory.getInstance(dir, "FixedData"));

   int items = fixedMeta.getAdjustedItemCount();
   View view;
   ViewFactory factory = new ViewFactory12();

   int lastOffset = -1;
   for (int loop = 0; loop < items; loop++)
   {
      byte[] fm = fixedMeta.getByteArrayValue(loop);
      int offset = MPPUtility.getShort(fm, 4);
      if (offset > lastOffset)
      {
         byte[] fd = fixedData.getByteArrayValue(fixedData.getIndexFromOffset(offset));
         if (fd != null)
         {
            view = factory.createView(m_file, fm, fd, viewVarData, m_fontBases);
            m_file.getViews().add(view);
         }
         lastOffset = offset;
      }
   }
}
 
Example #30
Source File: CIFSContentComparator.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
private boolean isContentIdentical(POIFSFileSystem fs1, POIFSFileSystem fs2, Collection<String> excludes) throws IOException
{
    DirectoryEntry de1 = fs1.getRoot();
    DirectoryEntry de2 = fs2.getRoot();

    FilteringDirectoryNode fs1Filtered = new FilteringDirectoryNode(de1, excludes);
    FilteringDirectoryNode fs2Filtered = new FilteringDirectoryNode(de2, excludes);

    boolean retVal = EntryUtils.areDirectoriesIdentical(fs1Filtered, fs2Filtered);
    if(logger.isDebugEnabled())
    {
        logger.debug("returning equal="+ retVal);
    }
    return retVal;
}