extractErrorDetailsFromResponse(ClientHttpResponse response) throws IOException {
+ return null;
+ }
+}
diff --git a/source/java/org/alfresco/repo/publishing/flickr/springsocial/api/impl/FlickrTemplate.java b/source/java/org/alfresco/repo/publishing/flickr/springsocial/api/impl/FlickrTemplate.java
new file mode 100644
index 0000000000..5bb53cf314
--- /dev/null
+++ b/source/java/org/alfresco/repo/publishing/flickr/springsocial/api/impl/FlickrTemplate.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.alfresco.repo.publishing.flickr.springsocial.api.impl;
+
+import java.net.URI;
+import java.util.List;
+
+import org.alfresco.repo.publishing.flickr.springsocial.api.Flickr;
+import org.alfresco.repo.publishing.flickr.springsocial.api.MediaOperations;
+import org.springframework.http.client.ClientHttpRequestFactory;
+import org.springframework.http.converter.ByteArrayHttpMessageConverter;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.social.NotAuthorizedException;
+import org.springframework.social.oauth1.AbstractOAuth1ApiBinding;
+import org.springframework.social.support.ClientHttpRequestFactorySelector;
+import org.springframework.social.support.URIBuilder;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+
+/**
+ * This is the central class for interacting with Facebook.
+ *
+ * There are some operations, such as searching, that do not require OAuth
+ * authentication. In those cases, you may use a {@link FlickrTemplate} that is
+ * created through the default constructor and without any OAuth details.
+ * Attempts to perform secured operations through such an instance, however,
+ * will result in {@link NotAuthorizedException} being thrown.
+ *
+ * @author Craig Walls
+ */
+public class FlickrTemplate extends AbstractOAuth1ApiBinding implements Flickr {
+ private final String REST_ENDPOINT = "http://api.flickr.com/services/rest/";
+ private String consumerKey;
+
+ private MediaOperations mediaOperations;
+
+ /**
+ * Create a new instance of FacebookTemplate.
+ * This constructor creates a new FacebookTemplate able to perform unauthenticated operations against Facebook's Graph API.
+ * Some operations do not require OAuth authentication.
+ * For example, retrieving a specified user's profile or feed does not require authentication (although the data returned will be limited to what is publicly available).
+ * A FacebookTemplate created with this constructor will support those operations.
+ * Those operations requiring authentication will throw {@link NotAuthorizedException}.
+ */
+ public FlickrTemplate() {
+ initialize();
+ }
+
+ /**
+ * Create a new instance of FacebookTemplate.
+ * This constructor creates the FacebookTemplate using a given access token.
+ * @param accessToken An access token given by Facebook after a successful OAuth 2 authentication (or through Facebook's JS library).
+ */
+ public FlickrTemplate(String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret) {
+ super(consumerKey, consumerSecret, accessToken, accessTokenSecret);
+ this.consumerKey = consumerKey;
+ initialize();
+ }
+
+ private void initSubApis() {
+ mediaOperations = new MediaTemplate(consumerKey, getRestTemplate(), isAuthorized());
+ }
+
+ @Override
+ public void setRequestFactory(ClientHttpRequestFactory requestFactory) {
+ // Wrap the request factory with a BufferingClientHttpRequestFactory so that the error handler can do repeat reads on the response.getBody()
+ super.setRequestFactory(ClientHttpRequestFactorySelector.bufferRequests(requestFactory));
+ }
+
+ public MediaOperations mediaOperations() {
+ return mediaOperations;
+ }
+
+ @Override
+ protected List> getMessageConverters() {
+ List> messageConverters = super.getMessageConverters();
+ messageConverters.add(new ByteArrayHttpMessageConverter());
+ return messageConverters;
+ }
+
+ // private helpers
+ private void initialize() {
+ getRestTemplate().setErrorHandler(new FlickrErrorHandler());
+ // Wrap the request factory with a BufferingClientHttpRequestFactory so that the error handler can do repeat reads on the response.getBody()
+ super.setRequestFactory(ClientHttpRequestFactorySelector.bufferRequests(getRestTemplate().getRequestFactory()));
+ initSubApis();
+ }
+
+ @Override
+ public boolean test()
+ {
+ MultiValueMap params = new LinkedMultiValueMap();
+ params.add("api_key", consumerKey);
+ params.add("format", "json");
+ params.add("method", "flickr.test.login");
+ params.add("nojsoncallback", "1");
+ URI uri = URIBuilder.fromUri(REST_ENDPOINT).queryParams(params).build();
+ getRestTemplate().getForObject(uri, String.class);
+ return true;
+ }
+}
diff --git a/source/java/org/alfresco/repo/publishing/flickr/springsocial/api/impl/MediaTemplate.java b/source/java/org/alfresco/repo/publishing/flickr/springsocial/api/impl/MediaTemplate.java
new file mode 100644
index 0000000000..238fdfaf26
--- /dev/null
+++ b/source/java/org/alfresco/repo/publishing/flickr/springsocial/api/impl/MediaTemplate.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2011 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.alfresco.repo.publishing.flickr.springsocial.api.impl;
+
+import java.net.URI;
+
+import org.alfresco.repo.publishing.flickr.springsocial.api.MediaOperations;
+import org.alfresco.repo.publishing.flickr.springsocial.api.PhotoMetadata;
+import org.alfresco.repo.publishing.flickr.springsocial.api.impl.AbstractFlickrOperations;
+import org.springframework.core.io.Resource;
+import org.springframework.social.support.URIBuilder;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestTemplate;
+
+class MediaTemplate extends AbstractFlickrOperations implements MediaOperations
+{
+ private final RestTemplate restTemplate;
+ private String consumerKey;
+
+ public MediaTemplate(String consumerKey, RestTemplate restTemplate, boolean isAuthorizedForUser)
+ {
+ super(isAuthorizedForUser);
+ this.restTemplate = restTemplate;
+ this.consumerKey = consumerKey;
+ }
+
+ public String postPhoto(Resource photo, PhotoMetadata metadata)
+ {
+ requireAuthorization();
+ MultiValueMap parts = new LinkedMultiValueMap();
+ parts.set("api_key", consumerKey);
+ if (metadata.getDescription() != null)
+ parts.set("description", metadata.getDescription());
+ parts.set("photo", photo);
+ if (metadata.getTitle() != null)
+ parts.set("title", metadata.getTitle());
+ URI uri = URIBuilder.fromUri("http://api.flickr.com/services/upload/").build();
+ String response = restTemplate.postForObject(uri, parts, String.class);
+ return (String) response;
+ }
+
+ @Override
+ public PhotoMetadata createPhotoMetadata()
+ {
+ return new PhotoMetadataImpl();
+ }
+}
diff --git a/source/java/org/alfresco/repo/publishing/flickr/springsocial/api/impl/PhotoMetadataImpl.java b/source/java/org/alfresco/repo/publishing/flickr/springsocial/api/impl/PhotoMetadataImpl.java
new file mode 100644
index 0000000000..bbbffc21d1
--- /dev/null
+++ b/source/java/org/alfresco/repo/publishing/flickr/springsocial/api/impl/PhotoMetadataImpl.java
@@ -0,0 +1,29 @@
+package org.alfresco.repo.publishing.flickr.springsocial.api.impl;
+
+import org.alfresco.repo.publishing.flickr.springsocial.api.PhotoMetadata;
+
+public class PhotoMetadataImpl implements PhotoMetadata
+{
+ private String title;
+ private String description;
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public void setTitle(String title)
+ {
+ this.title = title;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+}
diff --git a/source/java/org/alfresco/repo/publishing/flickr/springsocial/api/impl/UserTemplate.java b/source/java/org/alfresco/repo/publishing/flickr/springsocial/api/impl/UserTemplate.java
new file mode 100644
index 0000000000..5c27899844
--- /dev/null
+++ b/source/java/org/alfresco/repo/publishing/flickr/springsocial/api/impl/UserTemplate.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2011 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.alfresco.repo.publishing.flickr.springsocial.api.impl;
+
+import org.alfresco.repo.publishing.flickr.springsocial.api.UserOperations;
+
+class UserTemplate extends AbstractFlickrOperations implements UserOperations {
+
+ public UserTemplate(boolean isAuthorized)
+ {
+ super(isAuthorized);
+ }
+
+}
diff --git a/source/java/org/alfresco/repo/publishing/flickr/springsocial/connect/FlickrAdapter.java b/source/java/org/alfresco/repo/publishing/flickr/springsocial/connect/FlickrAdapter.java
new file mode 100644
index 0000000000..21068b2e6a
--- /dev/null
+++ b/source/java/org/alfresco/repo/publishing/flickr/springsocial/connect/FlickrAdapter.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2011 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.alfresco.repo.publishing.flickr.springsocial.connect;
+
+import org.alfresco.repo.publishing.flickr.springsocial.api.Flickr;
+import org.springframework.social.ApiException;
+import org.springframework.social.connect.ApiAdapter;
+import org.springframework.social.connect.ConnectionValues;
+import org.springframework.social.connect.UserProfile;
+import org.springframework.social.connect.UserProfileBuilder;
+
+/**
+ * Facebook ApiAdapter implementation.
+ *
+ * @author Keith Donald
+ */
+public class FlickrAdapter implements ApiAdapter
+{
+
+ public boolean test(Flickr flickr)
+ {
+ try
+ {
+ flickr.test();
+ return true;
+ }
+ catch (ApiException e)
+ {
+ return false;
+ }
+ }
+
+ public void setConnectionValues(Flickr facebook, ConnectionValues values)
+ {
+ }
+
+ public UserProfile fetchUserProfile(Flickr facebook)
+ {
+ return new UserProfileBuilder().setName("Brian").setFirstName("Brian").setLastName(
+ "Brian").setEmail("Brian").setUsername("Brian").build();
+ }
+
+ public void updateStatus(Flickr facebook, String message)
+ {
+ }
+
+}
diff --git a/source/java/org/alfresco/repo/publishing/flickr/springsocial/connect/FlickrConnectionFactory.java b/source/java/org/alfresco/repo/publishing/flickr/springsocial/connect/FlickrConnectionFactory.java
new file mode 100644
index 0000000000..973dceaeae
--- /dev/null
+++ b/source/java/org/alfresco/repo/publishing/flickr/springsocial/connect/FlickrConnectionFactory.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2011 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.alfresco.repo.publishing.flickr.springsocial.connect;
+
+import org.alfresco.repo.publishing.flickr.springsocial.api.Flickr;
+import org.alfresco.repo.publishing.flickr.springsocial.connect.FlickrAdapter;
+import org.springframework.social.connect.support.OAuth1ConnectionFactory;
+
+public class FlickrConnectionFactory extends OAuth1ConnectionFactory {
+
+ public FlickrConnectionFactory(String consumerKey, String consumerSecret) {
+ super("flickr", new FlickrServiceProvider(consumerKey, consumerSecret), new FlickrAdapter());
+ }
+
+}
diff --git a/source/java/org/alfresco/repo/publishing/flickr/springsocial/connect/FlickrServiceProvider.java b/source/java/org/alfresco/repo/publishing/flickr/springsocial/connect/FlickrServiceProvider.java
new file mode 100644
index 0000000000..394eea4aca
--- /dev/null
+++ b/source/java/org/alfresco/repo/publishing/flickr/springsocial/connect/FlickrServiceProvider.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.alfresco.repo.publishing.flickr.springsocial.connect;
+
+import org.alfresco.repo.publishing.flickr.springsocial.api.Flickr;
+import org.alfresco.repo.publishing.flickr.springsocial.api.impl.FlickrTemplate;
+import org.springframework.social.oauth1.AbstractOAuth1ServiceProvider;
+import org.springframework.social.oauth1.OAuth1Template;
+
+public class FlickrServiceProvider extends AbstractOAuth1ServiceProvider {
+
+ public FlickrServiceProvider(String consumerKey, String consumerSecret) {
+ super(consumerKey, consumerSecret, new OAuth1Template(consumerKey, consumerSecret,
+ "http://www.flickr.com/services/oauth/request_token",
+ "http://www.flickr.com/services/oauth/authorize",
+ "http://www.flickr.com/services/oauth/access_token"));
+ }
+
+ public Flickr getApi(String accessToken, String secret) {
+ return new FlickrTemplate(getConsumerKey(), getConsumerSecret(), accessToken, secret);
+ }
+
+}
\ No newline at end of file
diff --git a/source/java/org/alfresco/repo/publishing/flickr/springsocial/connect/package-info.java b/source/java/org/alfresco/repo/publishing/flickr/springsocial/connect/package-info.java
new file mode 100644
index 0000000000..a1b3625e99
--- /dev/null
+++ b/source/java/org/alfresco/repo/publishing/flickr/springsocial/connect/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Flickr service provider connection repository and API adapter implementations.
+ */
+package org.alfresco.repo.publishing.flickr.springsocial.connect;
diff --git a/source/java/org/alfresco/repo/publishing/slideshare/SlideShareChannelType.java b/source/java/org/alfresco/repo/publishing/slideshare/SlideShareChannelType.java
index db2d8ffa0f..cc5bdb0669 100644
--- a/source/java/org/alfresco/repo/publishing/slideshare/SlideShareChannelType.java
+++ b/source/java/org/alfresco/repo/publishing/slideshare/SlideShareChannelType.java
@@ -22,9 +22,7 @@ import java.io.Serializable;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
-import java.util.TreeSet;
-import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.publishing.AbstractChannelType;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ActionService;
@@ -36,28 +34,11 @@ import org.alfresco.service.namespace.QName;
public class SlideShareChannelType extends AbstractChannelType
{
public final static String ID = "slideshare";
- private final static Set DEFAULT_MIME_TYPES = new TreeSet();
private NodeService nodeService;
private ActionService actionService;
- private Set permittedMimeTypes = Collections.unmodifiableSet(DEFAULT_MIME_TYPES);
-
- static
- {
- DEFAULT_MIME_TYPES.add(MimetypeMap.MIMETYPE_PPT);
- DEFAULT_MIME_TYPES.add(MimetypeMap.MIMETYPE_PDF);
- DEFAULT_MIME_TYPES.add(MimetypeMap.MIMETYPE_OPENDOCUMENT_PRESENTATION);
- DEFAULT_MIME_TYPES.add(MimetypeMap.MIMETYPE_OPENXML_PRESENTATION);
- DEFAULT_MIME_TYPES.add(MimetypeMap.MIMETYPE_IWORK_KEYNOTE);
- DEFAULT_MIME_TYPES.add(MimetypeMap.MIMETYPE_IWORK_PAGES);
- DEFAULT_MIME_TYPES.add(MimetypeMap.MIMETYPE_TEXT_PLAIN);
- DEFAULT_MIME_TYPES.add(MimetypeMap.MIMETYPE_OPENDOCUMENT_TEXT);
- DEFAULT_MIME_TYPES.add(MimetypeMap.MIMETYPE_TEXT_CSV);
- DEFAULT_MIME_TYPES.add(MimetypeMap.MIMETYPE_EXCEL);
- DEFAULT_MIME_TYPES.add(MimetypeMap.MIMETYPE_OPENXML_WORDPROCESSING);
- DEFAULT_MIME_TYPES.add(MimetypeMap.MIMETYPE_OPENDOCUMENT_SPREADSHEET);
- }
-
+ private SlideSharePublishingHelper publishingHelper;
+
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
@@ -68,13 +49,9 @@ public class SlideShareChannelType extends AbstractChannelType
this.actionService = actionService;
}
- public void setPermittedMimeTypes(Set permittedMimeTypes)
+ public void setPublishingHelper(SlideSharePublishingHelper publishingHelper)
{
- if (permittedMimeTypes == null)
- {
- permittedMimeTypes = Collections.emptySet();
- }
- this.permittedMimeTypes = Collections.unmodifiableSet(permittedMimeTypes);
+ this.publishingHelper = publishingHelper;
}
@Override
@@ -116,7 +93,7 @@ public class SlideShareChannelType extends AbstractChannelType
@Override
public Set getSupportedMimetypes()
{
- return permittedMimeTypes;
+ return publishingHelper.getAllowedMimeTypes().keySet();
}
@Override
diff --git a/source/java/org/alfresco/repo/publishing/slideshare/SlideSharePublishAction.java b/source/java/org/alfresco/repo/publishing/slideshare/SlideSharePublishAction.java
index a8020d03e0..6aec28dfdc 100644
--- a/source/java/org/alfresco/repo/publishing/slideshare/SlideSharePublishAction.java
+++ b/source/java/org/alfresco/repo/publishing/slideshare/SlideSharePublishAction.java
@@ -24,7 +24,6 @@ import java.util.List;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
-import org.alfresco.repo.content.filestore.FileContentReader;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.repository.ContentReader;
@@ -38,6 +37,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.benfante.jslideshare.SlideShareAPI;
+import com.benfante.jslideshare.messages.Slideshow;
public class SlideSharePublishAction extends ActionExecuterAbstractBase
{
@@ -84,20 +84,19 @@ public class SlideSharePublishAction extends ActionExecuterAbstractBase
if (reader.exists())
{
File contentFile;
+ String mime = reader.getMimetype();
+
+ String extension = slideShareHelper.getAllowedMimeTypes().get(mime);
+ if (extension == null) extension = "";
+
boolean deleteContentFileOnCompletion = false;
- if (FileContentReader.class.isAssignableFrom(reader.getClass()))
- {
- //Grab the content straight from the content store if we can...
- contentFile = ((FileContentReader)reader).getFile();
- }
- else
- {
- //...otherwise copy it to a temp file and use the copy...
- File tempDir = TempFileProvider.getLongLifeTempDir("slideshare");
- contentFile = TempFileProvider.createTempFile("slideshare", "", tempDir);
- reader.getContent(contentFile);
- deleteContentFileOnCompletion = true;
- }
+
+ //SlideShare seems to work entirely off file extension, so we always copy onto the
+ //file system and upload from there.
+ File tempDir = TempFileProvider.getLongLifeTempDir("slideshare");
+ contentFile = TempFileProvider.createTempFile("slideshare", extension, tempDir);
+ reader.getContent(contentFile);
+ deleteContentFileOnCompletion = true;
String name = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
String title = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_TITLE);
@@ -121,8 +120,17 @@ public class SlideSharePublishAction extends ActionExecuterAbstractBase
String assetId = api.uploadSlideshow(usernamePassword.getFirst(), usernamePassword.getSecond(), title,
contentFile, description, tags.toString(), false, false, false, false, false);
-// String url = api.getSlideshow(assetId).getPermalink();
+
String url = null;
+ Slideshow slides = api.getSlideshow(assetId);
+ if (slides != null)
+ {
+ url = slides.getPermalink();
+ if (log.isInfoEnabled())
+ {
+ log.info("SlideShare has provided a URL for asset " + assetId + ": " + url);
+ }
+ }
if (log.isInfoEnabled())
{
log.info("File " + name + " has been published to SlideShare with id " + assetId + " at URL " + url);
diff --git a/source/java/org/alfresco/repo/publishing/slideshare/SlideSharePublishingHelper.java b/source/java/org/alfresco/repo/publishing/slideshare/SlideSharePublishingHelper.java
index ad1c1e6aa8..f0283688e8 100644
--- a/source/java/org/alfresco/repo/publishing/slideshare/SlideSharePublishingHelper.java
+++ b/source/java/org/alfresco/repo/publishing/slideshare/SlideSharePublishingHelper.java
@@ -18,6 +18,11 @@
*/
package org.alfresco.repo.publishing.slideshare;
+import java.util.Collections;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.publishing.PublishingModel;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
@@ -28,6 +33,24 @@ import com.benfante.jslideshare.SlideShareConnector;
public class SlideSharePublishingHelper
{
+ private final static Map DEFAULT_MIME_TYPES = new TreeMap();
+ static
+ {
+ DEFAULT_MIME_TYPES.put(MimetypeMap.MIMETYPE_PPT, ".ppt");
+ DEFAULT_MIME_TYPES.put(MimetypeMap.MIMETYPE_PDF, ".pdf");
+ DEFAULT_MIME_TYPES.put(MimetypeMap.MIMETYPE_OPENDOCUMENT_PRESENTATION, ".odp");
+ DEFAULT_MIME_TYPES.put(MimetypeMap.MIMETYPE_OPENXML_PRESENTATION, ".pptx");
+ DEFAULT_MIME_TYPES.put(MimetypeMap.MIMETYPE_IWORK_KEYNOTE, "");
+ DEFAULT_MIME_TYPES.put(MimetypeMap.MIMETYPE_IWORK_PAGES, "");
+ DEFAULT_MIME_TYPES.put(MimetypeMap.MIMETYPE_TEXT_PLAIN, ".txt");
+ DEFAULT_MIME_TYPES.put(MimetypeMap.MIMETYPE_OPENDOCUMENT_TEXT, ".odt");
+ DEFAULT_MIME_TYPES.put(MimetypeMap.MIMETYPE_TEXT_CSV, ".csv");
+ DEFAULT_MIME_TYPES.put(MimetypeMap.MIMETYPE_EXCEL, ".xls");
+ DEFAULT_MIME_TYPES.put(MimetypeMap.MIMETYPE_OPENXML_WORDPROCESSING, ".docx");
+ DEFAULT_MIME_TYPES.put(MimetypeMap.MIMETYPE_OPENDOCUMENT_SPREADSHEET, ".ods");
+ }
+
+ private Map allowedMimeTypes = Collections.unmodifiableMap(DEFAULT_MIME_TYPES);
private NodeService nodeService;
private SlideShareConnector slideshareConnector;
@@ -41,6 +64,16 @@ public class SlideSharePublishingHelper
this.slideshareConnector = slideshareConnector;
}
+ public Map getAllowedMimeTypes()
+ {
+ return allowedMimeTypes;
+ }
+
+ public void setAllowedMimeTypes(Map allowedMimeTypes)
+ {
+ this.allowedMimeTypes = Collections.unmodifiableMap(allowedMimeTypes);
+ }
+
public SlideShareAPI getSlideShareApi()
{
return createApiObject();
diff --git a/source/java/org/alfresco/repo/urlshortening/BitlyUrlShortenerImpl.java b/source/java/org/alfresco/repo/urlshortening/BitlyUrlShortenerImpl.java
index f5e321af74..d3cf3d4fea 100644
--- a/source/java/org/alfresco/repo/urlshortening/BitlyUrlShortenerImpl.java
+++ b/source/java/org/alfresco/repo/urlshortening/BitlyUrlShortenerImpl.java
@@ -17,7 +17,7 @@ public class BitlyUrlShortenerImpl implements UrlShortener
{
private static final Log log = LogFactory.getLog(BitlyUrlShortenerImpl.class);
- private int urlLength;
+ private int urlLength = 20;
private String username;
private String apiKey = "R_ca15c6c89e9b25ccd170bafd209a0d4f";
private HttpClient httpClient;
diff --git a/source/java/org/alfresco/service/cmr/publishing/channels/ChannelService.java b/source/java/org/alfresco/service/cmr/publishing/channels/ChannelService.java
index 8015ef1dce..ef7b72cc46 100644
--- a/source/java/org/alfresco/service/cmr/publishing/channels/ChannelService.java
+++ b/source/java/org/alfresco/service/cmr/publishing/channels/ChannelService.java
@@ -64,11 +64,10 @@ public interface ChannelService
Channel createChannel(String siteId, String channelTypeId, String name, Map properties);
/**
- * Remove the channel with the specified name on the specified Share site.
- * @param siteId The identifier of the Share site that contains the channel to be deleted.
- * @param channelName The name of the channel that is to be deleted.
+ * Remove the specified channel.
+ * @param channel The channel to delete.
*/
- void deleteChannel(String siteId, String channelName);
+ void deleteChannel(Channel channel);
/**
* Rename the specified channel