mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Publishing:
- channels.post webscript now returns authCallbackUrl in addition to previous data git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29230 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -200,7 +200,7 @@ public class ChannelHelper
|
|||||||
|
|
||||||
private boolean isMimetypeSupported(String mimetype, ChannelType type)
|
private boolean isMimetypeSupported(String mimetype, ChannelType type)
|
||||||
{
|
{
|
||||||
Set<String> supportedMimetypes = type.getSupportedMimetypes();
|
Set<String> supportedMimetypes = type.getSupportedMimeTypes();
|
||||||
if (supportedMimetypes == null || supportedMimetypes.isEmpty())
|
if (supportedMimetypes == null || supportedMimetypes.isEmpty())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@@ -119,7 +119,7 @@ public class MockChannelType extends AbstractChannelType
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getSupportedMimetypes()
|
public Set<String> getSupportedMimeTypes()
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@@ -305,7 +305,7 @@ public class PublishEventActionTest extends AbstractPublishingIntegrationTest
|
|||||||
|
|
||||||
// Set supported type to XML
|
// Set supported type to XML
|
||||||
Set<String> mimeTypes = Collections.singleton(MimetypeMap.MIMETYPE_XML);
|
Set<String> mimeTypes = Collections.singleton(MimetypeMap.MIMETYPE_XML);
|
||||||
when(channelType.getSupportedMimetypes()).thenReturn(mimeTypes);
|
when(channelType.getSupportedMimeTypes()).thenReturn(mimeTypes);
|
||||||
|
|
||||||
// Publish source node but don't call ChannelType.publish().
|
// Publish source node but don't call ChannelType.publish().
|
||||||
publishNode(source);
|
publishNode(source);
|
||||||
@@ -315,7 +315,7 @@ public class PublishEventActionTest extends AbstractPublishingIntegrationTest
|
|||||||
|
|
||||||
// Change supported type to plain text.
|
// Change supported type to plain text.
|
||||||
mimeTypes = Collections.singleton(MimetypeMap.MIMETYPE_TEXT_PLAIN);
|
mimeTypes = Collections.singleton(MimetypeMap.MIMETYPE_TEXT_PLAIN);
|
||||||
when(channelType.getSupportedMimetypes()).thenReturn(mimeTypes);
|
when(channelType.getSupportedMimeTypes()).thenReturn(mimeTypes);
|
||||||
|
|
||||||
// Publish source node
|
// Publish source node
|
||||||
publishNode(source);
|
publishNode(source);
|
||||||
|
@@ -92,7 +92,7 @@ public class FacebookChannelType extends AbstractChannelType
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getSupportedMimetypes()
|
public Set<String> getSupportedMimeTypes()
|
||||||
{
|
{
|
||||||
return Collections.emptySet();
|
return Collections.emptySet();
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,6 @@ public class FacebookChannelType extends AbstractChannelType
|
|||||||
public String getAuthorisationUrl(Channel channel, String callbackUrl)
|
public String getAuthorisationUrl(Channel channel, String callbackUrl)
|
||||||
{
|
{
|
||||||
ParameterCheck.mandatory("channel", channel);
|
ParameterCheck.mandatory("channel", channel);
|
||||||
ParameterCheck.mandatory("callbackUrl", callbackUrl);
|
|
||||||
if (!ID.equals(channel.getChannelType().getId()))
|
if (!ID.equals(channel.getChannelType().getId()))
|
||||||
{
|
{
|
||||||
throw new IllegalArgumentException("Invalid channel type: " + channel.getChannelType().getId());
|
throw new IllegalArgumentException("Invalid channel type: " + channel.getChannelType().getId());
|
||||||
|
@@ -23,7 +23,9 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
import org.alfresco.repo.content.MimetypeMap;
|
||||||
import org.alfresco.repo.publishing.AbstractChannelType;
|
import org.alfresco.repo.publishing.AbstractChannelType;
|
||||||
import org.alfresco.repo.publishing.PublishingModel;
|
import org.alfresco.repo.publishing.PublishingModel;
|
||||||
import org.alfresco.service.cmr.action.Action;
|
import org.alfresco.service.cmr.action.Action;
|
||||||
@@ -43,9 +45,19 @@ import org.springframework.util.MultiValueMap;
|
|||||||
public class FlickrChannelType extends AbstractChannelType
|
public class FlickrChannelType extends AbstractChannelType
|
||||||
{
|
{
|
||||||
public final static String ID = "flickr";
|
public final static String ID = "flickr";
|
||||||
|
private final static Set<String> DEFAULT_SUPPORTED_MIME_TYPES = new TreeSet<String>();
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
DEFAULT_SUPPORTED_MIME_TYPES.add(MimetypeMap.MIMETYPE_IMAGE_GIF);
|
||||||
|
DEFAULT_SUPPORTED_MIME_TYPES.add(MimetypeMap.MIMETYPE_IMAGE_JPEG);
|
||||||
|
DEFAULT_SUPPORTED_MIME_TYPES.add(MimetypeMap.MIMETYPE_IMAGE_PNG);
|
||||||
|
}
|
||||||
|
|
||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
private FlickrPublishingHelper publishingHelper;
|
private FlickrPublishingHelper publishingHelper;
|
||||||
private ActionService actionService;
|
private ActionService actionService;
|
||||||
|
private Set<String> supportedMimeTypes = Collections.unmodifiableSet(DEFAULT_SUPPORTED_MIME_TYPES);
|
||||||
|
|
||||||
public void setNodeService(NodeService nodeService)
|
public void setNodeService(NodeService nodeService)
|
||||||
{
|
{
|
||||||
@@ -62,6 +74,11 @@ public class FlickrChannelType extends AbstractChannelType
|
|||||||
this.actionService = actionService;
|
this.actionService = actionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSupportedMimeTypes(Set<String> mimeTypes)
|
||||||
|
{
|
||||||
|
supportedMimeTypes = Collections.unmodifiableSet(new TreeSet<String>(mimeTypes));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPublish()
|
public boolean canPublish()
|
||||||
{
|
{
|
||||||
@@ -99,9 +116,9 @@ public class FlickrChannelType extends AbstractChannelType
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getSupportedMimetypes()
|
public Set<String> getSupportedMimeTypes()
|
||||||
{
|
{
|
||||||
return Collections.emptySet();
|
return supportedMimeTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -92,7 +92,7 @@ public class SlideShareChannelType extends AbstractChannelType
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getSupportedMimetypes()
|
public Set<String> getSupportedMimeTypes()
|
||||||
{
|
{
|
||||||
return publishingHelper.getAllowedMimeTypes().keySet();
|
return publishingHelper.getAllowedMimeTypes().keySet();
|
||||||
}
|
}
|
||||||
|
@@ -95,7 +95,7 @@ public class TestChannelType1 extends AbstractChannelType
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getSupportedMimetypes()
|
public Set<String> getSupportedMimeTypes()
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@@ -95,7 +95,7 @@ public class TestChannelType2 extends AbstractChannelType
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getSupportedMimetypes()
|
public Set<String> getSupportedMimeTypes()
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@@ -95,7 +95,7 @@ public class TestChannelType3 extends AbstractChannelType
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getSupportedMimetypes()
|
public Set<String> getSupportedMimeTypes()
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@@ -91,7 +91,7 @@ public class TwitterChannelType extends AbstractChannelType
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getSupportedMimetypes()
|
public Set<String> getSupportedMimeTypes()
|
||||||
{
|
{
|
||||||
return Collections.emptySet();
|
return Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
@@ -85,7 +85,7 @@ public class YouTubeChannelType extends AbstractChannelType
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getSupportedMimetypes()
|
public Set<String> getSupportedMimeTypes()
|
||||||
{
|
{
|
||||||
return Collections.emptySet();
|
return Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
@@ -46,7 +46,7 @@ public interface ChannelType
|
|||||||
boolean canUnpublish();
|
boolean canUnpublish();
|
||||||
boolean canPublishStatusUpdates();
|
boolean canPublishStatusUpdates();
|
||||||
|
|
||||||
Set<String> getSupportedMimetypes();
|
Set<String> getSupportedMimeTypes();
|
||||||
Set<QName> getSupportedContentTypes();
|
Set<QName> getSupportedContentTypes();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user