Files
alfresco-community-repo/source/java/org/alfresco/repo/publishing/flickr/FlickrUnpublishAction.java
Brian Remmington 7ceaf0a9b0 Merged BRANCHES/DEV/BRIAN/PUBLISHING to HEAD:
29482: Publishing:
   - Added support for LinkedIn status updates
 29486: Social Publishing UI Updates, including:
   - Dialogue: Complete UI rework
   - Publishing History: display of unpublish event support
   - Created Alfresco.util.toggleClass function
 29491: Publishing:
   - Added correct list of supported MIME types the the YouTube channel type
 29493: Publishing:
   - Added video/mp4 to YouTube supported MIME types
 29496: ChannelsGet now filters out channels that are not authorised. Added a space before the node URL on status updates. Extended unit tests to check behaviour for non-Admin users.
 29513: Adds specific http client libraries to prevent the mac falling back to it's buggy default implementation (which, e.g. doesn't send Content-Length headers if the content length is zero). Required for Flickr support (their publish API requires both a content length header and zero length content. It returns a 411 error using the default Mac libs).
 29534: Fixed PublishingEventsGet REST method. ChannelService getChannels() methods now support filtering by publish permissions.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29542 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2011-08-04 08:26:41 +00:00

79 lines
3.0 KiB
Java

/*
* Copyright (C) 2005-2011 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/>.
*/
package org.alfresco.repo.publishing.flickr;
import java.util.List;
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
import org.alfresco.repo.publishing.PublishingModel;
import org.alfresco.repo.publishing.flickr.springsocial.api.Flickr;
import org.alfresco.repo.publishing.flickr.springsocial.api.MediaOperations;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.tagging.TaggingService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.social.connect.Connection;
public class FlickrUnpublishAction extends ActionExecuterAbstractBase
{
private final static Log log = LogFactory.getLog(FlickrUnpublishAction.class);
public static final String NAME = "unpublish_flickr";
private NodeService nodeService;
private FlickrPublishingHelper flickrHelper;
public void setFlickrHelper(FlickrPublishingHelper helper)
{
this.flickrHelper = helper;
}
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
@Override
protected void executeImpl(Action action, NodeRef nodeRef)
{
if (nodeService.hasAspect(nodeRef, FlickrPublishingModel.ASPECT_ASSET))
{
String assetId = (String) nodeService.getProperty(nodeRef, PublishingModel.PROP_ASSET_ID);
if (assetId != null)
{
Connection<Flickr> connection = flickrHelper.getConnectionForPublishNode(nodeRef);
MediaOperations mediaOps = connection.getApi().mediaOperations();
mediaOps.deletePhoto(assetId);
nodeService.removeAspect(nodeRef, FlickrPublishingModel.ASPECT_ASSET);
nodeService.removeAspect(nodeRef, PublishingModel.ASPECT_ASSET);
}
}
}
@Override
protected void addParameterDefinitions(List<ParameterDefinition> paramList)
{
//Deliberately empty
}
}