Commit 3ab81bc5 authored by skummer's avatar skummer

ZP-273 #comment added ConfigContentParameters to IChanges, modified...

ZP-273 #comment added ConfigContentParameters to IChanges, modified DiffBackend and all derived implementations, passing contentparameters also to ChangeMessage, DeleteMessage and SetReadFlag #time 2h 30m

git-svn-id: https://z-push.org/svn/z-push/trunk@1558 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 33d61e2a
...@@ -251,6 +251,26 @@ class ImportChangesCombined implements IImportChanges { ...@@ -251,6 +251,26 @@ class ImportChangesCombined implements IImportChanges {
ZLog::Write(LOGLEVEL_DEBUG, 'ImportChangesCombined->Config() success'); ZLog::Write(LOGLEVEL_DEBUG, 'ImportChangesCombined->Config() success');
} }
/**
* Configures additional parameters used for content synchronization
*
* @param ContentParameters $contentparameters
*
* @access public
* @return boolean
* @throws StatusException
*/
public function ConfigContentParameters($contentparameters) {
ZLog::Write(LOGLEVEL_DEBUG, "ImportChangesCombined->ConfigContentParameters()");
if (!$this->icc) {
ZLog::Write(LOGLEVEL_ERROR, "ImportChangesCombined->ConfigContentParameters() icc not configured");
return false;
}
$this->icc->ConfigContentParameters($contentparameters);
ZLog::Write(LOGLEVEL_DEBUG, "ImportChangesCombined->ConfigContentParameters() success");
}
/** /**
* Reads and returns the current state * Reads and returns the current state
* *
......
...@@ -1104,36 +1104,50 @@ class BackendIMAP extends BackendDiff { ...@@ -1104,36 +1104,50 @@ class BackendIMAP extends BackendDiff {
* Called when a message has been changed on the mobile. * Called when a message has been changed on the mobile.
* This functionality is not available for emails. * This functionality is not available for emails.
* *
* @param string $folderid id of the folder * @param string $folderid id of the folder
* @param string $id id of the message * @param string $id id of the message
* @param SyncXXX $message the SyncObject containing a message * @param SyncXXX $message the SyncObject containing a message
* @param ContentParameters $contentParameters
* *
* @access public * @access public
* @return array same return value as StatMessage() * @return array same return value as StatMessage()
* @throws StatusException could throw specific SYNC_STATUS_* exceptions * @throws StatusException could throw specific SYNC_STATUS_* exceptions
*/ */
public function ChangeMessage($folderid, $id, $message) { public function ChangeMessage($folderid, $id, $message, $contentParameters) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->ChangeMessage('%s','%s','%s')", $folderid, $id, get_class($message))); ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->ChangeMessage('%s','%s','%s')", $folderid, $id, get_class($message)));
// TODO recheck implementation // TODO recheck implementation
// TODO this could throw several StatusExceptions like e.g. SYNC_STATUS_OBJECTNOTFOUND, SYNC_STATUS_SYNCCANNOTBECOMPLETED // TODO this could throw several StatusExceptions like e.g. SYNC_STATUS_OBJECTNOTFOUND, SYNC_STATUS_SYNCCANNOTBECOMPLETED
// TODO SyncInterval check + ContentParameters
// see https://jira.zarafa.com/browse/ZP-258 for details
// before changing the message, it should be checked if the message is in the SyncInterval
// to determine the cutoffdate use Utils::GetCutOffDate($contentparameters->GetFilterType());
// if the message is not in the interval an StatusException with code SYNC_STATUS_SYNCCANNOTBECOMPLETED should be thrown
return false; return false;
} }
/** /**
* Changes the 'read' flag of a message on disk * Changes the 'read' flag of a message on disk
* *
* @param string $folderid id of the folder * @param string $folderid id of the folder
* @param string $id id of the message * @param string $id id of the message
* @param int $flags read flag of the message * @param int $flags read flag of the message
* @param ContentParameters $contentParameters
* *
* @access public * @access public
* @return boolean status of the operation * @return boolean status of the operation
* @throws StatusException could throw specific SYNC_STATUS_* exceptions * @throws StatusException could throw specific SYNC_STATUS_* exceptions
*/ */
public function SetReadFlag($folderid, $id, $flags) { public function SetReadFlag($folderid, $id, $flags, $contentParameters) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->SetReadFlag('%s','%s','%s')", $folderid, $id, $flags)); ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->SetReadFlag('%s','%s','%s')", $folderid, $id, $flags));
$folderImapid = $this->getImapIdFromFolderId($folderid); $folderImapid = $this->getImapIdFromFolderId($folderid);
// TODO SyncInterval check + ContentParameters
// see https://jira.zarafa.com/browse/ZP-258 for details
// before setting the read flag, it should be checked if the message is in the SyncInterval
// to determine the cutoffdate use Utils::GetCutOffDate($contentparameters->GetFilterType());
// if the message is not in the interval an StatusException with code SYNC_STATUS_OBJECTNOTFOUND should be thrown
$this->imap_reopenFolder($folderImapid); $this->imap_reopenFolder($folderImapid);
if ($flags == 0) { if ($flags == 0) {
...@@ -1150,17 +1164,24 @@ class BackendIMAP extends BackendDiff { ...@@ -1150,17 +1164,24 @@ class BackendIMAP extends BackendDiff {
/** /**
* Called when the user has requested to delete (really delete) a message * Called when the user has requested to delete (really delete) a message
* *
* @param string $folderid id of the folder * @param string $folderid id of the folder
* @param string $id id of the message * @param string $id id of the message
* @param ContentParameters $contentParameters
* *
* @access public * @access public
* @return boolean status of the operation * @return boolean status of the operation
* @throws StatusException could throw specific SYNC_STATUS_* exceptions * @throws StatusException could throw specific SYNC_STATUS_* exceptions
*/ */
public function DeleteMessage($folderid, $id) { public function DeleteMessage($folderid, $id, $contentParameters) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->DeleteMessage('%s','%s')", $folderid, $id)); ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->DeleteMessage('%s','%s')", $folderid, $id));
$folderImapid = $this->getImapIdFromFolderId($folderid); $folderImapid = $this->getImapIdFromFolderId($folderid);
// TODO SyncInterval check + ContentParameters
// see https://jira.zarafa.com/browse/ZP-258 for details
// before deleting the message, it should be checked if the message is in the SyncInterval
// to determine the cutoffdate use Utils::GetCutOffDate($contentparameters->GetFilterType());
// if the message is not in the interval an StatusException with code SYNC_STATUS_OBJECTNOTFOUND should be thrown
$this->imap_reopenFolder($folderImapid); $this->imap_reopenFolder($folderImapid);
$s1 = @imap_delete ($this->mbox, $id, FT_UID); $s1 = @imap_delete ($this->mbox, $id, FT_UID);
$s11 = @imap_setflag_full($this->mbox, $id, "\\Deleted", FT_UID); $s11 = @imap_setflag_full($this->mbox, $id, "\\Deleted", FT_UID);
...@@ -1174,19 +1195,25 @@ class BackendIMAP extends BackendDiff { ...@@ -1174,19 +1195,25 @@ class BackendIMAP extends BackendDiff {
/** /**
* Called when the user moves an item on the PDA from one folder to another * Called when the user moves an item on the PDA from one folder to another
* *
* @param string $folderid id of the source folder * @param string $folderid id of the source folder
* @param string $id id of the message * @param string $id id of the message
* @param string $newfolderid id of the destination folder * @param string $newfolderid id of the destination folder
* @param ContentParameters $contentParameters
* *
* @access public * @access public
* @return boolean status of the operation * @return boolean status of the operation
* @throws StatusException could throw specific SYNC_MOVEITEMSSTATUS_* exceptions * @throws StatusException could throw specific SYNC_MOVEITEMSSTATUS_* exceptions
*/ */
public function MoveMessage($folderid, $id, $newfolderid) { public function MoveMessage($folderid, $id, $newfolderid, $contentParameters) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->MoveMessage('%s','%s','%s')", $folderid, $id, $newfolderid)); ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->MoveMessage('%s','%s','%s')", $folderid, $id, $newfolderid));
$folderImapid = $this->getImapIdFromFolderId($folderid); $folderImapid = $this->getImapIdFromFolderId($folderid);
$newfolderImapid = $this->getImapIdFromFolderId($newfolderid); $newfolderImapid = $this->getImapIdFromFolderId($newfolderid);
// TODO SyncInterval check + ContentParameters
// see https://jira.zarafa.com/browse/ZP-258 for details
// before moving the message, it should be checked if the message is in the SyncInterval
// to determine the cutoffdate use Utils::GetCutOffDate($contentparameters->GetFilterType());
// if the message is not in the interval an StatusException with code SYNC_MOVEITEMSSTATUS_INVALIDSOURCEID should be thrown
$this->imap_reopenFolder($folderImapid); $this->imap_reopenFolder($folderImapid);
......
...@@ -474,33 +474,46 @@ class BackendMaildir extends BackendDiff { ...@@ -474,33 +474,46 @@ class BackendMaildir extends BackendDiff {
* Called when a message has been changed on the mobile. * Called when a message has been changed on the mobile.
* This functionality is not available for emails. * This functionality is not available for emails.
* *
* @param string $folderid id of the folder * @param string $folderid id of the folder
* @param string $id id of the message * @param string $id id of the message
* @param SyncXXX $message the SyncObject containing a message * @param SyncXXX $message the SyncObject containing a message
* @param ContentParameters $contentParameters
* *
* @access public * @access public
* @return array same return value as StatMessage() * @return array same return value as StatMessage()
* @throws StatusException could throw specific SYNC_STATUS_* exceptions * @throws StatusException could throw specific SYNC_STATUS_* exceptions
*/ */
public function ChangeMessage($folderid, $id, $message) { public function ChangeMessage($folderid, $id, $message, $contentParameters) {
// TODO SyncInterval check + ContentParameters
// see https://jira.zarafa.com/browse/ZP-258 for details
// before changing the message, it should be checked if the message is in the SyncInterval
// to determine the cutoffdate use Utils::GetCutOffDate($contentparameters->GetFilterType());
// if the message is not in the interval an StatusException with code SYNC_STATUS_SYNCCANNOTBECOMPLETED should be thrown
return false; return false;
} }
/** /**
* Changes the 'read' flag of a message on disk * Changes the 'read' flag of a message on disk
* *
* @param string $folderid id of the folder * @param string $folderid id of the folder
* @param string $id id of the message * @param string $id id of the message
* @param int $flags read flag of the message * @param int $flags read flag of the message
* @param ContentParameters $contentParameters
* *
* @access public * @access public
* @return boolean status of the operation * @return boolean status of the operation
* @throws StatusException could throw specific SYNC_STATUS_* exceptions * @throws StatusException could throw specific SYNC_STATUS_* exceptions
*/ */
public function SetReadFlag($folderid, $id, $flags) { public function SetReadFlag($folderid, $id, $flags, $contentParameters) {
if($folderid != 'root') if($folderid != 'root')
return false; return false;
// TODO SyncInterval check + ContentParameters
// see https://jira.zarafa.com/browse/ZP-258 for details
// before setting the read flag, it should be checked if the message is in the SyncInterval
// to determine the cutoffdate use Utils::GetCutOffDate($contentparameters->GetFilterType());
// if the message is not in the interval an StatusException with code SYNC_STATUS_OBJECTNOTFOUND should be thrown
$fn = $this->findMessage($id); $fn = $this->findMessage($id);
if(!$fn) if(!$fn)
...@@ -528,17 +541,24 @@ class BackendMaildir extends BackendDiff { ...@@ -528,17 +541,24 @@ class BackendMaildir extends BackendDiff {
/** /**
* Called when the user has requested to delete (really delete) a message * Called when the user has requested to delete (really delete) a message
* *
* @param string $folderid id of the folder * @param string $folderid id of the folder
* @param string $id id of the message * @param string $id id of the message
* @param ContentParameters $contentParameters
* *
* @access public * @access public
* @return boolean status of the operation * @return boolean status of the operation
* @throws StatusException could throw specific SYNC_STATUS_* exceptions * @throws StatusException could throw specific SYNC_STATUS_* exceptions
*/ */
public function DeleteMessage($folderid, $id) { public function DeleteMessage($folderid, $id, $contentParameters) {
if($folderid != 'root') if($folderid != 'root')
return false; return false;
// TODO SyncInterval check + ContentParameters
// see https://jira.zarafa.com/browse/ZP-258 for details
// before deleting the message, it should be checked if the message is in the SyncInterval
// to determine the cutoffdate use Utils::GetCutOffDate($contentparameters->GetFilterType());
// if the message is not in the interval an StatusException with code SYNC_STATUS_OBJECTNOTFOUND should be thrown
$fn = $this->findMessage($id); $fn = $this->findMessage($id);
if(!$fn) if(!$fn)
...@@ -555,15 +575,16 @@ class BackendMaildir extends BackendDiff { ...@@ -555,15 +575,16 @@ class BackendMaildir extends BackendDiff {
* Called when the user moves an item on the PDA from one folder to another * Called when the user moves an item on the PDA from one folder to another
* not implemented * not implemented
* *
* @param string $folderid id of the source folder * @param string $folderid id of the source folder
* @param string $id id of the message * @param string $id id of the message
* @param string $newfolderid id of the destination folder * @param string $newfolderid id of the destination folder
* @param ContentParameters $contentParameters
* *
* @access public * @access public
* @return boolean status of the operation * @return boolean status of the operation
* @throws StatusException could throw specific SYNC_MOVEITEMSSTATUS_* exceptions * @throws StatusException could throw specific SYNC_MOVEITEMSSTATUS_* exceptions
*/ */
public function MoveMessage($folderid, $id, $newfolderid) { public function MoveMessage($folderid, $id, $newfolderid, $contentParameters) {
return false; return false;
} }
......
...@@ -491,15 +491,16 @@ class BackendVCardDir extends BackendDiff { ...@@ -491,15 +491,16 @@ class BackendVCardDir extends BackendDiff {
* Called when a message has been changed on the mobile. * Called when a message has been changed on the mobile.
* This functionality is not available for emails. * This functionality is not available for emails.
* *
* @param string $folderid id of the folder * @param string $folderid id of the folder
* @param string $id id of the message * @param string $id id of the message
* @param SyncXXX $message the SyncObject containing a message * @param SyncXXX $message the SyncObject containing a message
* @param ContentParameters $contentParameters
* *
* @access public * @access public
* @return array same return value as StatMessage() * @return array same return value as StatMessage()
* @throws StatusException could throw specific SYNC_STATUS_* exceptions * @throws StatusException could throw specific SYNC_STATUS_* exceptions
*/ */
public function ChangeMessage($folderid, $id, $message) { public function ChangeMessage($folderid, $id, $message, $contentParameters) {
ZLog::Write(LOGLEVEL_DEBUG, 'VCDir::ChangeMessage('.$folderid.', '.$id.', ..)'); ZLog::Write(LOGLEVEL_DEBUG, 'VCDir::ChangeMessage('.$folderid.', '.$id.', ..)');
$mapping = array( $mapping = array(
'fileas' => 'FN', 'fileas' => 'FN',
...@@ -579,29 +580,31 @@ class BackendVCardDir extends BackendDiff { ...@@ -579,29 +580,31 @@ class BackendVCardDir extends BackendDiff {
/** /**
* Changes the 'read' flag of a message on disk * Changes the 'read' flag of a message on disk
* *
* @param string $folderid id of the folder * @param string $folderid id of the folder
* @param string $id id of the message * @param string $id id of the message
* @param int $flags read flag of the message * @param int $flags read flag of the message
* @param ContentParameters $contentParameters
* *
* @access public * @access public
* @return boolean status of the operation * @return boolean status of the operation
* @throws StatusException could throw specific SYNC_STATUS_* exceptions * @throws StatusException could throw specific SYNC_STATUS_* exceptions
*/ */
public function SetReadFlag($folderid, $id, $flags) { public function SetReadFlag($folderid, $id, $flags, $contentParameters) {
return false; return false;
} }
/** /**
* Called when the user has requested to delete (really delete) a message * Called when the user has requested to delete (really delete) a message
* *
* @param string $folderid id of the folder * @param string $folderid id of the folder
* @param string $id id of the message * @param string $id id of the message
* @param ContentParameters $contentParameters
* *
* @access public * @access public
* @return boolean status of the operation * @return boolean status of the operation
* @throws StatusException could throw specific SYNC_STATUS_* exceptions * @throws StatusException could throw specific SYNC_STATUS_* exceptions
*/ */
public function DeleteMessage($folderid, $id) { public function DeleteMessage($folderid, $id, $contentParameters) {
return unlink($this->getPath() . '/' . $id); return unlink($this->getPath() . '/' . $id);
} }
...@@ -609,15 +612,16 @@ class BackendVCardDir extends BackendDiff { ...@@ -609,15 +612,16 @@ class BackendVCardDir extends BackendDiff {
* Called when the user moves an item on the PDA from one folder to another * Called when the user moves an item on the PDA from one folder to another
* not implemented * not implemented
* *
* @param string $folderid id of the source folder * @param string $folderid id of the source folder
* @param string $id id of the message * @param string $id id of the message
* @param string $newfolderid id of the destination folder * @param string $newfolderid id of the destination folder
* @param ContentParameters $contentParameters
* *
* @access public * @access public
* @return boolean status of the operation * @return boolean status of the operation
* @throws StatusException could throw specific SYNC_MOVEITEMSSTATUS_* exceptions * @throws StatusException could throw specific SYNC_MOVEITEMSSTATUS_* exceptions
*/ */
public function MoveMessage($folderid, $id, $newfolderid) { public function MoveMessage($folderid, $id, $newfolderid, $contentParameters) {
return false; return false;
} }
......
...@@ -69,6 +69,7 @@ class ImportChangesStream implements IImportChanges { ...@@ -69,6 +69,7 @@ class ImportChangesStream implements IImportChanges {
* Implement interface - never used * Implement interface - never used
*/ */
public function Config($state, $flags = 0) { return true; } public function Config($state, $flags = 0) { return true; }
public function ConfigContentParameters($contentparameters) { return true; }
public function GetState() { return false;} public function GetState() { return false;}
public function LoadConflicts($contentparameters, $state) { return true; } public function LoadConflicts($contentparameters, $state) { return true; }
......
...@@ -305,15 +305,16 @@ abstract class BackendDiff extends Backend { ...@@ -305,15 +305,16 @@ abstract class BackendDiff extends Backend {
* This method will never be called on E-mail items as it's not 'possible' to change e-mail items. It's only * This method will never be called on E-mail items as it's not 'possible' to change e-mail items. It's only
* possible to set them as 'read' or 'unread'. * possible to set them as 'read' or 'unread'.
* *
* @param string $folderid id of the folder * @param string $folderid id of the folder
* @param string $id id of the message * @param string $id id of the message
* @param SyncXXX $message the SyncObject containing a message * @param SyncXXX $message the SyncObject containing a message
* @param ContentParameters $contentParameters
* *
* @access public * @access public
* @return array same return value as StatMessage() * @return array same return value as StatMessage()
* @throws StatusException could throw specific SYNC_STATUS_* exceptions * @throws StatusException could throw specific SYNC_STATUS_* exceptions
*/ */
public abstract function ChangeMessage($folderid, $id, $message); public abstract function ChangeMessage($folderid, $id, $message, $contentParameters);
/** /**
* Changes the 'read' flag of a message on disk. The $flags * Changes the 'read' flag of a message on disk. The $flags
...@@ -323,15 +324,16 @@ abstract class BackendDiff extends Backend { ...@@ -323,15 +324,16 @@ abstract class BackendDiff extends Backend {
* change 'mod', simply setting the message to 'read' on the mobile will trigger * change 'mod', simply setting the message to 'read' on the mobile will trigger
* a full resync of the item from the server. * a full resync of the item from the server.
* *
* @param string $folderid id of the folder * @param string $folderid id of the folder
* @param string $id id of the message * @param string $id id of the message
* @param int $flags read flag of the message * @param int $flags read flag of the message
* @param ContentParameters $contentParameters
* *
* @access public * @access public
* @return boolean status of the operation * @return boolean status of the operation
* @throws StatusException could throw specific SYNC_STATUS_* exceptions * @throws StatusException could throw specific SYNC_STATUS_* exceptions
*/ */
public abstract function SetReadFlag($folderid, $id, $flags); public abstract function SetReadFlag($folderid, $id, $flags, $contentParameters);
/** /**
* Called when the user has requested to delete (really delete) a message. Usually * Called when the user has requested to delete (really delete) a message. Usually
...@@ -340,14 +342,15 @@ abstract class BackendDiff extends Backend { ...@@ -340,14 +342,15 @@ abstract class BackendDiff extends Backend {
* as it will be seen as a 'new' item. This means that if this method is not implemented, it's possible to * as it will be seen as a 'new' item. This means that if this method is not implemented, it's possible to
* delete messages on the PDA, but as soon as a sync is done, the item will be resynched to the mobile * delete messages on the PDA, but as soon as a sync is done, the item will be resynched to the mobile
* *
* @param string $folderid id of the folder * @param string $folderid id of the folder
* @param string $id id of the message * @param string $id id of the message
* @param ContentParameters $contentParameters
* *
* @access public * @access public
* @return boolean status of the operation * @return boolean status of the operation
* @throws StatusException could throw specific SYNC_STATUS_* exceptions * @throws StatusException could throw specific SYNC_STATUS_* exceptions
*/ */
public abstract function DeleteMessage($folderid, $id); public abstract function DeleteMessage($folderid, $id, $contentParameters);
/** /**
* Called when the user moves an item on the PDA from one folder to another. Whatever is needed * Called when the user moves an item on the PDA from one folder to another. Whatever is needed
...@@ -355,15 +358,16 @@ abstract class BackendDiff extends Backend { ...@@ -355,15 +358,16 @@ abstract class BackendDiff extends Backend {
* should show the items to have a new parent. This means that it will disappear from GetMessageList() * should show the items to have a new parent. This means that it will disappear from GetMessageList()
* of the sourcefolder and the destination folder will show the new message * of the sourcefolder and the destination folder will show the new message
* *
* @param string $folderid id of the source folder * @param string $folderid id of the source folder
* @param string $id id of the message * @param string $id id of the message
* @param string $newfolderid id of the destination folder * @param string $newfolderid id of the destination folder
* @param ContentParameters $contentParameters
* *
* @access public * @access public
* @return boolean status of the operation * @return boolean status of the operation
* @throws StatusException could throw specific SYNC_MOVEITEMSSTATUS_* exceptions * @throws StatusException could throw specific SYNC_MOVEITEMSSTATUS_* exceptions
*/ */
public abstract function MoveMessage($folderid, $id, $newfolderid); public abstract function MoveMessage($folderid, $id, $newfolderid, $contentParameters);
} }
?> ?>
\ No newline at end of file
...@@ -52,6 +52,8 @@ class DiffState implements IChanges { ...@@ -52,6 +52,8 @@ class DiffState implements IChanges {
protected $syncstate; protected $syncstate;
protected $backend; protected $backend;
protected $flags; protected $flags;
protected $contentparameters;
protected $cutoffdate;
/** /**
* Initializes the state * Initializes the state
...@@ -75,6 +77,20 @@ class DiffState implements IChanges { ...@@ -75,6 +77,20 @@ class DiffState implements IChanges {
return true; return true;
} }
/**
* Configures additional parameters used for content synchronization
*
* @param ContentParameters $contentparameters
*
* @access public
* @return boolean
* @throws StatusException
*/
public function ConfigContentParameters($contentparameters) {
$this->contentparameters = $contentparameters;
$this->cutoffdate = Utils::GetCutOffDate($contentparameters->GetFilterType());
}
/** /**
* Returns state * Returns state
* *
......
...@@ -45,8 +45,6 @@ ...@@ -45,8 +45,6 @@
class ExportChangesDiff extends DiffState implements IExportChanges{ class ExportChangesDiff extends DiffState implements IExportChanges{
private $importer; private $importer;
private $folderid; private $folderid;
private $contentparameters;
private $cutoffdate;
private $changes; private $changes;
private $step; private $step;
...@@ -64,20 +62,6 @@ class ExportChangesDiff extends DiffState implements IExportChanges{ ...@@ -64,20 +62,6 @@ class ExportChangesDiff extends DiffState implements IExportChanges{
$this->folderid = $folderid; $this->folderid = $folderid;
} }
/**
* Configures additional parameters used for content synchronization
*
* @param ContentParameters $contentparameters
*
* @access public
* @return boolean
* @throws StatusException
*/
public function ConfigContentParameters($contentparameters) {
$this->contentparameters = $contentparameters;
$this->cutoffdate = Utils::GetCutOffDate($contentparameters->GetFilterType());
}
/** /**
* Sets the importer the exporter will sent it's changes to * Sets the importer the exporter will sent it's changes to
* and initializes the Exporter * and initializes the Exporter
......
...@@ -107,7 +107,7 @@ class ImportChangesDiff extends DiffState implements IImportChanges { ...@@ -107,7 +107,7 @@ class ImportChangesDiff extends DiffState implements IImportChanges {
throw new StatusException(sprintf("ImportChangesDiff->ImportMessageChange('%s','%s'): Conflict detected. Data from PIM will be dropped! Server overwrites PIM. User is informed.", $id, get_class($message)), SYNC_STATUS_CONFLICTCLIENTSERVEROBJECT, null, LOGLEVEL_INFO); throw new StatusException(sprintf("ImportChangesDiff->ImportMessageChange('%s','%s'): Conflict detected. Data from PIM will be dropped! Server overwrites PIM. User is informed.", $id, get_class($message)), SYNC_STATUS_CONFLICTCLIENTSERVEROBJECT, null, LOGLEVEL_INFO);
} }
$stat = $this->backend->ChangeMessage($this->folderid, $id, $message); $stat = $this->backend->ChangeMessage($this->folderid, $id, $message, $this->contentparameters);
if(!is_array($stat)) if(!is_array($stat))
throw new StatusException(sprintf("ImportChangesDiff->ImportMessageChange('%s','%s'): unknown error in backend", $id, get_class($message)), SYNC_STATUS_SYNCCANNOTBECOMPLETED); throw new StatusException(sprintf("ImportChangesDiff->ImportMessageChange('%s','%s'): unknown error in backend", $id, get_class($message)), SYNC_STATUS_SYNCCANNOTBECOMPLETED);
...@@ -148,7 +148,7 @@ class ImportChangesDiff extends DiffState implements IImportChanges { ...@@ -148,7 +148,7 @@ class ImportChangesDiff extends DiffState implements IImportChanges {
return false; return false;
} }
$stat = $this->backend->DeleteMessage($this->folderid, $id); $stat = $this->backend->DeleteMessage($this->folderid, $id, $this->contentparameters);
if(!$stat) if(!$stat)
throw new StatusException(sprintf("ImportChangesDiff->ImportMessageDeletion('%s'): Unknown error in backend", $id), SYNC_STATUS_OBJECTNOTFOUND); throw new StatusException(sprintf("ImportChangesDiff->ImportMessageDeletion('%s'): Unknown error in backend", $id), SYNC_STATUS_OBJECTNOTFOUND);
...@@ -177,7 +177,7 @@ class ImportChangesDiff extends DiffState implements IImportChanges { ...@@ -177,7 +177,7 @@ class ImportChangesDiff extends DiffState implements IImportChanges {
$change["flags"] = $flags; $change["flags"] = $flags;
$this->updateState("flags", $change); $this->updateState("flags", $change);
$stat = $this->backend->SetReadFlag($this->folderid, $id, $flags); $stat = $this->backend->SetReadFlag($this->folderid, $id, $flags, $this->contentparameters);
if (!$stat) if (!$stat)
throw new StatusException(sprintf("ImportChangesDiff->ImportMessageReadFlag('%s','%s'): Error, unable retrieve message from backend", $id, $flags), SYNC_STATUS_OBJECTNOTFOUND); throw new StatusException(sprintf("ImportChangesDiff->ImportMessageReadFlag('%s','%s'): Error, unable retrieve message from backend", $id, $flags), SYNC_STATUS_OBJECTNOTFOUND);
...@@ -199,7 +199,7 @@ class ImportChangesDiff extends DiffState implements IImportChanges { ...@@ -199,7 +199,7 @@ class ImportChangesDiff extends DiffState implements IImportChanges {
if ($this->folderid == SYNC_FOLDER_TYPE_DUMMY || $newfolder == SYNC_FOLDER_TYPE_DUMMY) if ($this->folderid == SYNC_FOLDER_TYPE_DUMMY || $newfolder == SYNC_FOLDER_TYPE_DUMMY)
throw new StatusException(sprintf("ImportChangesDiff->ImportMessageMove('%s'): can not be done on a dummy folder", $id), SYNC_MOVEITEMSSTATUS_CANNOTMOVE); throw new StatusException(sprintf("ImportChangesDiff->ImportMessageMove('%s'): can not be done on a dummy folder", $id), SYNC_MOVEITEMSSTATUS_CANNOTMOVE);
return $this->backend->MoveMessage($this->folderid, $id, $newfolder); return $this->backend->MoveMessage($this->folderid, $id, $newfolder, $this->contentparameters);
} }
......
...@@ -63,6 +63,17 @@ interface IChanges { ...@@ -63,6 +63,17 @@ interface IChanges {
*/ */
public function Config($state, $flags = 0); public function Config($state, $flags = 0);
/**
* Configures additional parameters used for content synchronization
*
* @param ContentParameters $contentparameters
*
* @access public
* @return boolean
* @throws StatusException
*/
public function ConfigContentParameters($contentparameters);
/** /**
* Reads and returns the current state * Reads and returns the current state
* *
......
...@@ -44,17 +44,6 @@ ...@@ -44,17 +44,6 @@
************************************************/ ************************************************/
interface IExportChanges extends IChanges { interface IExportChanges extends IChanges {
/**
* Configures additional parameters used for content synchronization
*
* @param ContentParameters $contentparameters
*
* @access public
* @return boolean
* @throws StatusException
*/
public function ConfigContentParameters($contentparameters);
/** /**
* Sets the importer where the exporter will sent its changes to * Sets the importer where the exporter will sent its changes to
* This exporter should also be ready to accept calls after this * This exporter should also be ready to accept calls after this
......
...@@ -1008,12 +1008,8 @@ class Sync extends RequestProcessor { ...@@ -1008,12 +1008,8 @@ class Sync extends RequestProcessor {
else else
$this->importer->Config($sc->GetParameter($spa, "state"), $spa->GetConflict()); $this->importer->Config($sc->GetParameter($spa, "state"), $spa->GetConflict());
// the CPO is also needed by the importer to check if imported changes // the CPO is also needed by the importer to check if imported changes are inside the sync window - see ZP-258
// are inside the sync window - see ZP-258 $this->importer->ConfigContentParameters($spa->GetCPO());
// TODO ConfigContentParameters needs to be defined in IImportChanges and all implementing importers/backends
// this is currently only supported by the Zarafa Backend
if (method_exists($this->importer, "ConfigContentParameters"))
$this->importer->ConfigContentParameters($spa->GetCPO());
} }
catch (StatusException $stex) { catch (StatusException $stex) {
$status = $stex->getCode(); $status = $stex->getCode();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment