Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.security.NoSuchAlgorithmException;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Formatter;
import java.util.List;

Expand All @@ -19,14 +18,14 @@

public abstract class StoreAppointment extends StoreElement {

static final public int MESSAGE_STATUS_UNKNOWN=0;
static final public int MESSAGE_STATUS_LOCAL=1;
static final public int MESSAGE_STATUS_REQUEST=2;
static final public int MESSAGE_STATUS_RESPONSE_YES=3;
static final public int MESSAGE_STATUS_RESPONSE_MAY=4;
static final public int MESSAGE_STATUS_RESPONSE_NO=5;
public static final int MESSAGE_STATUS_UNKNOWN=0;
public static final int MESSAGE_STATUS_LOCAL=1;
public static final int MESSAGE_STATUS_REQUEST=2;
public static final int MESSAGE_STATUS_RESPONSE_YES=3;
public static final int MESSAGE_STATUS_RESPONSE_MAY=4;
public static final int MESSAGE_STATUS_RESPONSE_NO=5;

static final public String[] MESSAGE_STATUS_TEXT={"Unknown","Local","Request","Resp.Yes","Resp.May","Resp.No"};
public static final String[] MESSAGE_STATUS_TEXT={"Unknown","Local","Request","Resp.Yes","Resp.May","Resp.No"};

protected String uniqId;

Expand Down Expand Up @@ -87,14 +86,14 @@ public String getLogDescription() {
* @throws MailExtractLibException Any unrecoverable extraction exception (access trouble, major format problems...)
* @throws InterruptedException the interrupted exception
*/
abstract public void analyzeAppointment() throws MailExtractLibException, InterruptedException;
public abstract void analyzeAppointment() throws MailExtractLibException, InterruptedException;

/**
* Gets element name used for the csv file name construction.
*
* @return the element name
*/
static public String getElementName() {
public static String getElementName() {
return "appointments";
}

Expand All @@ -103,17 +102,15 @@ static public String getElementName() {
*
* @param ps the dedicated print stream
*/
static public void printGlobalListCSVHeader(PrintStream ps) {
public static void printGlobalListCSVHeader(PrintStream ps) {
ps.println("ID;Subject;Location;From;ToAttendees;CcAttendees;StartTime;EndTime;" +
"MiscNotes;uniqID;SequenceNumber;ModificationTime;Folder;MessageStatus;" +
"isRecurrent;RecurrencePattern;StartRecurrenceTime;EndRecurrenceTime;" +
"ExceptionFromId;ExceptionDate;isDeletion;hasAttachment");
}

/**
* Extract to the contacts list, after initialising it if first contact, and to the contact picture file.
* <p>The picture file is saved in a directory called "Contacts Pictures" and is named using the line number
* listLineId as "contact_id".ext with the extension of the original file.******************************
* Extract to the appointments list and all associated attachements and exceptions
*
* @param writeFlag the write flag
* @param father the father
Expand Down Expand Up @@ -172,6 +169,7 @@ private String normalizeUniqId(String uniqId){
result= formatter.toString();
formatter.close();
} catch (NoSuchAlgorithmException ignored) {
//ignore
}
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,19 @@ public String getEmbeddedMessageScheme() {
}

private String getUniqId() {
String result = appointment.getCleanGlobalObjectId().toString();
if (result == null || result.isEmpty())
String result;
PSTGlobalObjectId id = appointment.getCleanGlobalObjectId();
if (id == null)
result = appointment.getGlobalObjectId().toString();
else {
result=id.toString();
if (result.isEmpty())
result = appointment.getGlobalObjectId().toString();
}
return result;
}

static private String getFrom(PSTAppointment appointment) {
private static String getFrom(PSTAppointment appointment) {
String fromAddr = appointment.getSenderEmailAddress();
String fromName = appointment.getSenderName();
String result = "";
Expand All @@ -160,7 +166,7 @@ static private String getFrom(PSTAppointment appointment) {
return result.trim();
}

static HashMap<String,ZoneId> normalizedZoneIdMap=new HashMap<String,ZoneId>();
static HashMap<String,ZoneId> normalizedZoneIdMap=new HashMap<>();
private ZoneId getNormalizedZoneId(Date date,PSTTimeZone pstTimeZone) throws InterruptedException {
ZoneId result=normalizedZoneIdMap.get(pstTimeZone.getName());
if (result!=null)
Expand Down Expand Up @@ -219,6 +225,7 @@ else if (!html.equals(test))
}
}
} catch (PSTException | IOException | MailExtractLibException ignored) {
//ignore
}
test=HTMLTextExtractor.getInstance().act(html).trim();
if (test.isEmpty())
Expand All @@ -232,18 +239,19 @@ else if (!html.equals(test))
}

private List<StoreAttachment> getAttachments(PSTMessage message) throws InterruptedException {
ArrayList<MicrosoftStoreMessageAttachment> nativeAttachments = new ArrayList<MicrosoftStoreMessageAttachment>(10);
ArrayList<MicrosoftStoreMessageAttachment> nativeAttachments = new ArrayList<>(10);
for (int i = 0; i < message.getNumberOfAttachments(); i++) {
try {
final PSTMessage child = message.getAttachment(i).getEmbeddedPSTMessage();
if (child instanceof PSTAppointment)
continue;
} catch (PSTException | IOException ignored) {
//ignore
}
nativeAttachments.add(new PstStoreMessageAttachment(message, i));
}
if (nativeAttachments.size()==0)
return new ArrayList<StoreAttachment>(0);
if (nativeAttachments.isEmpty())
return new ArrayList<>(0);
return MicrosoftStoreElement.getAttachments(this, nativeAttachments.toArray(new MicrosoftStoreMessageAttachment[0]));
}

Expand Down Expand Up @@ -275,27 +283,23 @@ private StoreAppointment generateDeletionAppointment(ZonedDateTime zdt) {
private String getChangedFrom(PSTAppointmentException exception) {
if (exception.getEmbeddedMessage() == null)
return this.from;
String result = getFrom(exception.getEmbeddedMessage());
return result;
return getFrom(exception.getEmbeddedMessage());
}

private String getChangedToAttendees(PSTAppointmentException exception) {
if (exception.getEmbeddedMessage() == null)
return this.toAttendees;
String result = exception.getEmbeddedMessage().getToAttendees();
return result;
return exception.getEmbeddedMessage().getToAttendees();
}

private String getChangedCCAttendees(PSTAppointmentException exception) {
if (exception.getEmbeddedMessage() == null)
return this.ccAttendees;
String result = exception.getEmbeddedMessage().getCCAttendees();
return result;
return exception.getEmbeddedMessage().getCCAttendees();
}

private ZonedDateTime getChangedZonedDateTime(ZonedDateTime zdt, Date d) {
ZonedDateTime result = ZonedDateTime.ofInstant(d.toInstant(), zdt.getZone());
return result;
return ZonedDateTime.ofInstant(d.toInstant(), zdt.getZone());
}

private StoreAppointment generateExceptionAppointment(ZonedDateTime zdt, PSTAppointmentException exception) throws InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
*/
public class PstStoreFolder extends StoreFolder {

/** Native libpst folder **/
/**
* Native libpst folder
**/
protected PSTFolder pstFolder;

// name and fullName computed from constructors
Expand Down Expand Up @@ -78,12 +80,9 @@ private PstStoreFolder(StoreExtractor storeExtractor, PSTFolder pstFolder, PstSt
/**
* Creates the root folder.
*
* @param storeExtractor
* Operation store extractor
* @param pstFolder
* Root native libpst folder
* @param rootArchiveUnit
* Root ArchiveUnit
* @param storeExtractor Operation store extractor
* @param pstFolder Root native libpst folder
* @param rootArchiveUnit Root ArchiveUnit
* @return the LP store folder
*/
public static PstStoreFolder createRootFolder(PstStoreExtractor storeExtractor, PSTFolder pstFolder,
Expand Down Expand Up @@ -124,22 +123,45 @@ protected void doExtractFolderElements(boolean writeFlag) throws MailExtractLibE
} catch (PSTException e) {
throw new MailExtractLibException("mailextract.pst: can't get messages from folder " + getFullName(), e);
} catch (Exception e) {
logMessageWarning("mailextract.pst: wrongly formatted message " + mes + " in folder " + this.getName(), e);
if (e instanceof InterruptedException)
throw e;
logMessageWarning("mailextract.pst: end folder extraction at message " + mes + " in folder " + this.getName(), e);
error = true;
}
}
while (error);

if (po == null)
break;
message = (PSTMessage) po;
StoreElement extracted;
if (message instanceof PSTContact)
extracted = new PstStoreContact(this, (PSTContact) message);
try {
extracted = new PstStoreContact(this, (PSTContact) message);
extracted.processElement(writeFlag);
} catch (Exception e) {
if (e instanceof InterruptedException)
throw e;
logMessageWarning("mailextract.pst: can't extract contact " + mes, e);
}
else if (message instanceof PSTAppointment)
extracted = new PstStoreAppointment(this, (PSTAppointment) message);
try {
extracted = new PstStoreAppointment(this, (PSTAppointment) message);
extracted.processElement(writeFlag);
} catch (Exception e) {
if (e instanceof InterruptedException)
throw e;
logMessageWarning("mailextract.pst: can't extract appointment " + mes, e);
}
else
extracted = new PstStoreMessage(this, message);
extracted.processElement(writeFlag);
try {
extracted = new PstStoreMessage(this, message);
extracted.processElement(writeFlag);
} catch (Exception e) {
if (e instanceof InterruptedException)
throw e;
logMessageWarning("mailextract.pst: can't extract message " + mes + " in folder " + this.getName(), e);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,17 @@
package fr.gouv.vitam.tools.resip.sedaobjecteditor.components.viewers;

import fr.gouv.vitam.tools.resip.app.ResipGraphicApp;
import fr.gouv.vitam.tools.resip.frame.MainWindow;
import fr.gouv.vitam.tools.resip.frame.UserInteractionDialog;
import fr.gouv.vitam.tools.resip.sedaobjecteditor.components.highlevelcomponents.XMLDataObjectGroupEditorPanel;
import fr.gouv.vitam.tools.resip.threads.ExpandThread;
import fr.gouv.vitam.tools.sedalib.core.*;
import fr.gouv.vitam.tools.sedalib.core.BinaryDataObject;
import fr.gouv.vitam.tools.sedalib.core.DataObject;
import fr.gouv.vitam.tools.sedalib.core.DataObjectGroup;
import fr.gouv.vitam.tools.sedalib.core.PhysicalDataObject;
import fr.gouv.vitam.tools.sedalib.inout.importer.CompressedFileToArchiveTransferImporter;
import fr.gouv.vitam.tools.sedalib.inout.importer.DiskToDataObjectPackageImporter;
import fr.gouv.vitam.tools.sedalib.utils.SEDALibException;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;

/**
* The Class DataObjectListViewer.
Expand Down Expand Up @@ -73,6 +68,7 @@ public DataObjectListViewer(XMLDataObjectGroupEditorPanel container, DefaultList
DataObjectListViewer list = this;

MouseListener ml = new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
int index = list.locationToIndex(e.getPoint());
if (index >= 0) {
Expand All @@ -85,7 +81,7 @@ public void mousePressed(MouseEvent e) {
if (dataObject instanceof BinaryDataObject) {
BinaryDataObject bdo = (BinaryDataObject) dataObject;
if ((bdo.formatIdentification!=null) &&
(CompressedFileToArchiveTransferImporter.isKnownCompressedMimeType(bdo.formatIdentification.getSimpleMetadata("MimeType")))) {
(CompressedFileToArchiveTransferImporter.isKnownCompressedDroidFormat(bdo.formatIdentification.getSimpleMetadata("FormatId")))) {
JPopupMenu popup = new JPopupMenu();
JMenuItem mi;
mi = new JMenuItem("Remplacer par le décompressé");
Expand All @@ -103,6 +99,7 @@ public void mousePressed(MouseEvent e) {
this.addMouseListener(ml);

KeyListener kl = new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if ((e.getKeyCode() == KeyEvent.VK_DELETE) || (e.getKeyCode() == KeyEvent.VK_BACK_SPACE)) {
removeDataObject(list.getSelectedValue());
Expand Down
Loading