Search in sources :

Example 6 with PropertyValue

use of org.apache.poi.hsmf.datatypes.PropertyValue in project poi by apache.

the class TestFixedSizedProperties method testClientSubmitTime.

/**
    * Will be based on the ClientSubmit time
    */
@Test
public void testClientSubmitTime() throws Exception {
    // Check via the message date
    Calendar clientSubmitTime = mapiMessageSucceeds.getMessageDate();
    assertEquals("Fri, 22 Jun 2012 18:32:54", messageDateFormat.format(clientSubmitTime.getTime()));
    // Fetch the property value directly
    Map<MAPIProperty, List<PropertyValue>> props = mapiMessageSucceeds.getMainChunks().getProperties();
    List<PropertyValue> pv = props.get(MAPIProperty.CLIENT_SUBMIT_TIME);
    assertNotNull(pv);
    assertEquals(1, pv.size());
    clientSubmitTime = (Calendar) pv.get(0).getValue();
    assertEquals("Fri, 22 Jun 2012 18:32:54", messageDateFormat.format(clientSubmitTime.getTime()));
}
Also used : Calendar(java.util.Calendar) LongPropertyValue(org.apache.poi.hsmf.datatypes.PropertyValue.LongPropertyValue) TimePropertyValue(org.apache.poi.hsmf.datatypes.PropertyValue.TimePropertyValue) ChunkBasedPropertyValue(org.apache.poi.hsmf.datatypes.ChunkBasedPropertyValue) PropertyValue(org.apache.poi.hsmf.datatypes.PropertyValue) List(java.util.List) MAPIProperty(org.apache.poi.hsmf.datatypes.MAPIProperty) Test(org.junit.Test)

Aggregations

PropertyValue (org.apache.poi.hsmf.datatypes.PropertyValue)6 MAPIProperty (org.apache.poi.hsmf.datatypes.MAPIProperty)5 List (java.util.List)3 LongPropertyValue (org.apache.poi.hsmf.datatypes.PropertyValue.LongPropertyValue)3 TimePropertyValue (org.apache.poi.hsmf.datatypes.PropertyValue.TimePropertyValue)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 LinkedList (java.util.LinkedList)2 Matcher (java.util.regex.Matcher)2 Pattern (java.util.regex.Pattern)2 ChunkBasedPropertyValue (org.apache.poi.hsmf.datatypes.ChunkBasedPropertyValue)2 Chunks (org.apache.poi.hsmf.datatypes.Chunks)2 RecipientChunks (org.apache.poi.hsmf.datatypes.RecipientChunks)2 ChunkNotFoundException (org.apache.poi.hsmf.exceptions.ChunkNotFoundException)2 Test (org.junit.Test)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 Charset (java.nio.charset.Charset)1 ArrayList (java.util.ArrayList)1 Calendar (java.util.Calendar)1 HashSet (java.util.HashSet)1