Last active
July 16, 2016 16:48
-
-
Save jottley/acc8825e7465f5704f0bd0ea3ab6735e to your computer and use it in GitHub Desktop.
Is Dropbox Node In Sync?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright (C) 2005-2015 Alfresco Software Limited. | |
* | |
* This file is part of Alfresco | |
* | |
* Alfresco is free software: you can redistribute it and/or modify it under the | |
* terms of the GNU Lesser General Public License as published by the Free | |
* Software Foundation, either version 3 of the License, or (at your option) any | |
* later version. | |
* | |
* Alfresco is distributed in the hope that it will be useful, but WITHOUT ANY | |
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | |
* details. | |
* | |
* You should have received a copy of the GNU Lesser General Public License | |
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. | |
*/ | |
/** | |
* @author Jared Ottley <jared.ottley@alfresco.com> | |
*/ | |
@Deprecated | |
private boolean isNodeInSync(NodeRef nodeRef) | |
{ | |
boolean inSync = false; | |
if (isSynced(nodeRef)) | |
{ | |
Metadata metadata = getMetadata(nodeRef); | |
Map<QName, Serializable> persistedMetadata = getPersistedMetadata(nodeRef); | |
if (((Date)persistedMetadata.get(ContentModel.PROP_MODIFIED)).compareTo(metadata.getModified()) == 0) | |
{ | |
inSync = true; | |
} | |
elseif (((String)persistedMetadata.get(DropboxConstants.Model.PROP_REV)).equals(metadata.getRev())) | |
{ | |
inSync = true; | |
} | |
if (nodeService.getType(nodeRef).equals(ContentModel.TYPE_FOLDER)) | |
{ | |
if (!((String)persistedMetadata.get(DropboxConstants.Model.PROP_HASH)).equals(metadata.getHash())) | |
{ | |
inSync = false; | |
} | |
} | |
} | |
return inSync; | |
} | |
@Deprecated | |
private boolean isNodeInSync(final NodeRef nodeRef, String userAuthority) | |
{ | |
boolean inSync = false; | |
inSync = AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Boolean>() | |
{ | |
@Override | |
public Boolean doWork() | |
throws Exception | |
{ | |
return deletePersistedMetadata(nodeRef); | |
} | |
}, userAuthority); | |
return inSync; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment