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
index 5bb53cf314..65500db573 100644
--- 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
@@ -1,17 +1,20 @@
/*
- * Copyright 2010 the original author or authors.
+ * Copyright (C) 2005-2011 Alfresco Software Limited.
*
- * 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
+ * This file is part of Alfresco
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
*
- * 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.
+ * 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 .
*/
package org.alfresco.repo.publishing.flickr.springsocial.api.impl;
@@ -31,7 +34,9 @@ import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
/**
- * This is the central class for interacting with Facebook.
+ *
+ * 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
@@ -39,65 +44,81 @@ import org.springframework.util.MultiValueMap;
* 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 {
+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();
- }
+ private MediaOperations mediaOperations;
- /**
- * 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();
- }
+ /**
+ * 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();
+ }
- 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));
- }
+ /**
+ * 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();
+ }
- 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();
- }
+ 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()
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
index 238fdfaf26..19ed0c0c95 100644
--- 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
@@ -1,17 +1,20 @@
/*
- * Copyright 2011 the original author or authors.
+ * Copyright (C) 2005-2011 Alfresco Software Limited.
*
- * 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
+ * This file is part of Alfresco
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
*
- * 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.
+ * 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 .
*/
package org.alfresco.repo.publishing.flickr.springsocial.api.impl;
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
index bbbffc21d1..61ad04d708 100644
--- 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
@@ -1,3 +1,21 @@
+/*
+ * 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 .
+ */
package org.alfresco.repo.publishing.flickr.springsocial.api.impl;
import org.alfresco.repo.publishing.flickr.springsocial.api.PhotoMetadata;
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
index 5c27899844..7f797d6611 100644
--- 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
@@ -1,23 +1,27 @@
/*
- * Copyright 2011 the original author or authors.
+ * Copyright (C) 2005-2011 Alfresco Software Limited.
*
- * 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
+ * This file is part of Alfresco
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
*
- * 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.
+ * 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 .
*/
package org.alfresco.repo.publishing.flickr.springsocial.api.impl;
import org.alfresco.repo.publishing.flickr.springsocial.api.UserOperations;
-class UserTemplate extends AbstractFlickrOperations implements UserOperations {
+class UserTemplate extends AbstractFlickrOperations implements UserOperations
+{
public UserTemplate(boolean 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
index 21068b2e6a..593eb7e071 100644
--- a/source/java/org/alfresco/repo/publishing/flickr/springsocial/connect/FlickrAdapter.java
+++ b/source/java/org/alfresco/repo/publishing/flickr/springsocial/connect/FlickrAdapter.java
@@ -1,17 +1,20 @@
/*
- * Copyright 2011 the original author or authors.
+ * Copyright (C) 2005-2011 Alfresco Software Limited.
*
- * 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
+ * This file is part of Alfresco
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
*
- * 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.
+ * 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 .
*/
package org.alfresco.repo.publishing.flickr.springsocial.connect;
@@ -22,11 +25,6 @@ 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
{
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
index 973dceaeae..7a07ed6f1c 100644
--- a/source/java/org/alfresco/repo/publishing/flickr/springsocial/connect/FlickrConnectionFactory.java
+++ b/source/java/org/alfresco/repo/publishing/flickr/springsocial/connect/FlickrConnectionFactory.java
@@ -1,17 +1,20 @@
/*
- * Copyright 2011 the original author or authors.
+ * Copyright (C) 2005-2011 Alfresco Software Limited.
*
- * 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
+ * This file is part of Alfresco
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
*
- * 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.
+ * 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 .
*/
package org.alfresco.repo.publishing.flickr.springsocial.connect;
@@ -19,10 +22,12 @@ 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 class FlickrConnectionFactory extends OAuth1ConnectionFactory
+{
- public FlickrConnectionFactory(String consumerKey, String consumerSecret) {
- super("flickr", new FlickrServiceProvider(consumerKey, consumerSecret), new FlickrAdapter());
- }
+ 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
index 394eea4aca..258e562f4b 100644
--- a/source/java/org/alfresco/repo/publishing/flickr/springsocial/connect/FlickrServiceProvider.java
+++ b/source/java/org/alfresco/repo/publishing/flickr/springsocial/connect/FlickrServiceProvider.java
@@ -1,17 +1,20 @@
/*
- * Copyright 2010 the original author or authors.
+ * Copyright (C) 2005-2011 Alfresco Software Limited.
*
- * 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
+ * This file is part of Alfresco
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
*
- * 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.
+ * 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 .
*/
package org.alfresco.repo.publishing.flickr.springsocial.connect;
@@ -20,17 +23,19 @@ 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 class FlickrServiceProvider extends AbstractOAuth1ServiceProvider
+{
- public FlickrServiceProvider(String consumerKey, String consumerSecret) {
+ 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/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);
+ }
- 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/slideshare/SlideShareChannelType.java b/source/java/org/alfresco/repo/publishing/slideshare/SlideShareChannelType.java
index cc5bdb0669..a5bfecc434 100644
--- a/source/java/org/alfresco/repo/publishing/slideshare/SlideShareChannelType.java
+++ b/source/java/org/alfresco/repo/publishing/slideshare/SlideShareChannelType.java
@@ -24,6 +24,7 @@ import java.util.Map;
import java.util.Set;
import org.alfresco.repo.publishing.AbstractChannelType;
+import org.alfresco.repo.publishing.PublishingModel;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ActionService;
import org.alfresco.service.cmr.publishing.channels.Channel;
@@ -121,7 +122,7 @@ public class SlideShareChannelType extends AbstractChannelType
String url = null;
if (node != null && nodeService.exists(node) && nodeService.hasAspect(node, SlideSharePublishingModel.ASPECT_ASSET))
{
- url = (String)nodeService.getProperty(node, SlideSharePublishingModel.PROP_ASSET_URL);
+ url = (String)nodeService.getProperty(node, PublishingModel.PROP_ASSET_URL);
}
return url;
}
diff --git a/source/java/org/alfresco/repo/publishing/slideshare/SlideSharePublishAction.java b/source/java/org/alfresco/repo/publishing/slideshare/SlideSharePublishAction.java
index 6aec28dfdc..2524d1e45b 100644
--- a/source/java/org/alfresco/repo/publishing/slideshare/SlideSharePublishAction.java
+++ b/source/java/org/alfresco/repo/publishing/slideshare/SlideSharePublishAction.java
@@ -24,6 +24,7 @@ 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.publishing.PublishingModel;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.repository.ContentReader;
@@ -135,8 +136,9 @@ public class SlideSharePublishAction extends ActionExecuterAbstractBase
{
log.info("File " + name + " has been published to SlideShare with id " + assetId + " at URL " + url);
}
- nodeService.setProperty(nodeRef, SlideSharePublishingModel.PROP_ASSET_ID, assetId);
- nodeService.setProperty(nodeRef, SlideSharePublishingModel.PROP_ASSET_URL, url);
+ nodeService.addAspect(nodeRef, SlideSharePublishingModel.ASPECT_ASSET, null);
+ nodeService.setProperty(nodeRef, PublishingModel.PROP_ASSET_ID, assetId);
+ nodeService.setProperty(nodeRef, PublishingModel.PROP_ASSET_URL, url);
if (deleteContentFileOnCompletion)
{
diff --git a/source/java/org/alfresco/repo/publishing/slideshare/SlideSharePublishingModel.java b/source/java/org/alfresco/repo/publishing/slideshare/SlideSharePublishingModel.java
index 3705493ef7..2260023afa 100644
--- a/source/java/org/alfresco/repo/publishing/slideshare/SlideSharePublishingModel.java
+++ b/source/java/org/alfresco/repo/publishing/slideshare/SlideSharePublishingModel.java
@@ -35,6 +35,4 @@ public interface SlideSharePublishingModel
public static final QName ASPECT_DELIVERY_CHANNEL = QName.createQName(NAMESPACE, "DeliveryChannelAspect");
public static final QName ASPECT_ASSET = QName.createQName(NAMESPACE, "AssetAspect");
- public static final QName PROP_ASSET_ID = QName.createQName(NAMESPACE, "assetId");
- public static final QName PROP_ASSET_URL = QName.createQName(NAMESPACE, "assetUrl");
}
diff --git a/source/java/org/alfresco/repo/publishing/slideshare/SlideShareTest.java b/source/java/org/alfresco/repo/publishing/slideshare/SlideShareTest.java
index de0e86b7f9..e878a2bccb 100644
--- a/source/java/org/alfresco/repo/publishing/slideshare/SlideShareTest.java
+++ b/source/java/org/alfresco/repo/publishing/slideshare/SlideShareTest.java
@@ -134,10 +134,10 @@ public class SlideShareTest extends BaseSpringTest
actionService.executeAction(publishAction, node);
Map props = nodeService.getProperties(node);
Assert.assertTrue(nodeService.hasAspect(node, SlideSharePublishingModel.ASPECT_ASSET));
- Assert.assertNotNull(props.get(SlideSharePublishingModel.PROP_ASSET_ID));
+ Assert.assertNotNull(props.get(PublishingModel.PROP_ASSET_ID));
// Assert.assertNotNull(props.get(SlideSharePublishingModel.PROP_ASSET_URL));
- System.out.println("SlideShare id: " + props.get(SlideSharePublishingModel.PROP_ASSET_ID));
+ System.out.println("SlideShare id: " + props.get(PublishingModel.PROP_ASSET_ID));
// Action unpublishAction = actionService.createAction(SlideShareUnpublishAction.NAME);
// actionService.executeAction(unpublishAction, node);
diff --git a/source/java/org/alfresco/repo/publishing/youtube/YouTubeChannelType.java b/source/java/org/alfresco/repo/publishing/youtube/YouTubeChannelType.java
index 615fc2a9c3..71eebc1c8a 100644
--- a/source/java/org/alfresco/repo/publishing/youtube/YouTubeChannelType.java
+++ b/source/java/org/alfresco/repo/publishing/youtube/YouTubeChannelType.java
@@ -24,6 +24,7 @@ import java.util.Map;
import java.util.Set;
import org.alfresco.repo.publishing.AbstractChannelType;
+import org.alfresco.repo.publishing.PublishingModel;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ActionService;
import org.alfresco.service.cmr.publishing.channels.Channel;
@@ -113,9 +114,9 @@ public class YouTubeChannelType extends AbstractChannelType
public String getNodeUrl(NodeRef node)
{
String url = null;
- if (node != null && nodeService.exists(node) && nodeService.hasAspect(node, YouTubePublishingModel.ASPECT_ASSET))
+ if (node != null && nodeService.exists(node) && nodeService.hasAspect(node, PublishingModel.ASPECT_ASSET))
{
- url = (String)nodeService.getProperty(node, YouTubePublishingModel.PROP_PLAYER_URL);
+ url = (String)nodeService.getProperty(node, PublishingModel.PROP_ASSET_URL);
}
return url;
}
diff --git a/source/java/org/alfresco/repo/publishing/youtube/YouTubePublishAction.java b/source/java/org/alfresco/repo/publishing/youtube/YouTubePublishAction.java
index fcbc57e663..c8593be0f0 100644
--- a/source/java/org/alfresco/repo/publishing/youtube/YouTubePublishAction.java
+++ b/source/java/org/alfresco/repo/publishing/youtube/YouTubePublishAction.java
@@ -27,6 +27,7 @@ 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.repo.publishing.PublishingModel;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.repository.ContentReader;
@@ -183,8 +184,9 @@ public class YouTubePublishAction extends ActionExecuterAbstractBase
log.debug("YouTube content URL is " + contentUrl);
log.debug("YouTube video player URL is " + playerUrl);
}
- nodeService.setProperty(nodeRef, YouTubePublishingModel.PROP_ASSET_ID, videoId);
- nodeService.setProperty(nodeRef, YouTubePublishingModel.PROP_PLAYER_URL, playerUrl);
+ nodeService.addAspect(nodeRef, YouTubePublishingModel.ASPECT_ASSET, null);
+ nodeService.setProperty(nodeRef, PublishingModel.PROP_ASSET_ID, videoId);
+ nodeService.setProperty(nodeRef, PublishingModel.PROP_ASSET_URL, playerUrl);
break;
case CLIENT_ERROR:
log.error("Video content failed to upload: " + videoName);
diff --git a/source/java/org/alfresco/repo/publishing/youtube/YouTubePublishingModel.java b/source/java/org/alfresco/repo/publishing/youtube/YouTubePublishingModel.java
index 8fc0f64438..783b880c65 100644
--- a/source/java/org/alfresco/repo/publishing/youtube/YouTubePublishingModel.java
+++ b/source/java/org/alfresco/repo/publishing/youtube/YouTubePublishingModel.java
@@ -35,6 +35,4 @@ public interface YouTubePublishingModel
public static final QName ASPECT_DELIVERY_CHANNEL = QName.createQName(NAMESPACE, "DeliveryChannelAspect");
public static final QName ASPECT_ASSET = QName.createQName(NAMESPACE, "AssetAspect");
- public static final QName PROP_ASSET_ID = QName.createQName(NAMESPACE, "assetId");
- public static final QName PROP_PLAYER_URL = QName.createQName(NAMESPACE, "playerUrl");
}
diff --git a/source/java/org/alfresco/repo/publishing/youtube/YouTubeTest.java b/source/java/org/alfresco/repo/publishing/youtube/YouTubeTest.java
index c4d370660a..597e9c1f17 100644
--- a/source/java/org/alfresco/repo/publishing/youtube/YouTubeTest.java
+++ b/source/java/org/alfresco/repo/publishing/youtube/YouTubeTest.java
@@ -47,13 +47,8 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.util.BaseSpringTest;
import org.alfresco.util.GUID;
import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author Brian
@@ -90,6 +85,11 @@ public class YouTubeTest extends BaseSpringTest
docLib = siteService.createContainer(siteId, SiteService.DOCUMENT_LIBRARY, ContentModel.TYPE_FOLDER, null);
}
+ public void onTearDown()
+ {
+ siteService.deleteSite(siteId);
+ }
+
public void testBlank()
{
@@ -133,17 +133,17 @@ public class YouTubeTest extends BaseSpringTest
actionService.executeAction(publishAction, vidNode);
Map props = nodeService.getProperties(vidNode);
Assert.assertTrue(nodeService.hasAspect(vidNode, YouTubePublishingModel.ASPECT_ASSET));
- Assert.assertNotNull(props.get(YouTubePublishingModel.PROP_ASSET_ID));
- Assert.assertNotNull(props.get(YouTubePublishingModel.PROP_PLAYER_URL));
+ Assert.assertNotNull(props.get(PublishingModel.PROP_ASSET_ID));
+ Assert.assertNotNull(props.get(PublishingModel.PROP_ASSET_URL));
- System.out.println("YouTube video: " + props.get(YouTubePublishingModel.PROP_ASSET_ID));
+ System.out.println("YouTube video: " + props.get(PublishingModel.PROP_ASSET_ID));
Action unpublishAction = actionService.createAction(YouTubeUnpublishAction.NAME);
actionService.executeAction(unpublishAction, vidNode);
props = nodeService.getProperties(vidNode);
Assert.assertFalse(nodeService.hasAspect(vidNode, YouTubePublishingModel.ASPECT_ASSET));
- Assert.assertNull(props.get(YouTubePublishingModel.PROP_ASSET_ID));
- Assert.assertNull(props.get(YouTubePublishingModel.PROP_PLAYER_URL));
+ Assert.assertNull(props.get(PublishingModel.PROP_ASSET_ID));
+ Assert.assertNull(props.get(PublishingModel.PROP_ASSET_URL));
return null;
}
});
diff --git a/source/java/org/alfresco/repo/publishing/youtube/YouTubeUnpublishAction.java b/source/java/org/alfresco/repo/publishing/youtube/YouTubeUnpublishAction.java
index 18a82e9d9e..f7f5b51a8c 100644
--- a/source/java/org/alfresco/repo/publishing/youtube/YouTubeUnpublishAction.java
+++ b/source/java/org/alfresco/repo/publishing/youtube/YouTubeUnpublishAction.java
@@ -25,6 +25,7 @@ import java.util.List;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
+import org.alfresco.repo.publishing.PublishingModel;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -64,7 +65,7 @@ public class YouTubeUnpublishAction extends ActionExecuterAbstractBase
{
removeVideo(service, actionedUponNodeRef);
}
- catch(Exception ex)
+ catch (Exception ex)
{
log.error("Failed to remove asset from YouTube", ex);
throw new AlfrescoRuntimeException("exception.publishing.youtube.unpublishFailed", ex);
@@ -72,15 +73,19 @@ public class YouTubeUnpublishAction extends ActionExecuterAbstractBase
}
}
- private void removeVideo(YouTubeService service, NodeRef nodeRef) throws MalformedURLException, IOException, ServiceException
+ private void removeVideo(YouTubeService service, NodeRef nodeRef) throws MalformedURLException, IOException,
+ ServiceException
{
- String youtubeId = (String) nodeService.getProperty(nodeRef, YouTubePublishingModel.PROP_ASSET_ID);
- if (youtubeId != null)
+ if (nodeService.hasAspect(nodeRef, YouTubePublishingModel.ASPECT_ASSET))
{
- String videoEntryUrl = "https://gdata.youtube.com/feeds/api/users/default/uploads/" + youtubeId;
- VideoEntry videoEntry = service.getEntry(new URL(videoEntryUrl), VideoEntry.class);
- videoEntry.delete();
- nodeService.removeAspect(nodeRef, YouTubePublishingModel.ASPECT_ASSET);
+ String youtubeId = (String) nodeService.getProperty(nodeRef, PublishingModel.PROP_ASSET_ID);
+ if (youtubeId != null)
+ {
+ String videoEntryUrl = "https://gdata.youtube.com/feeds/api/users/default/uploads/" + youtubeId;
+ VideoEntry videoEntry = service.getEntry(new URL(videoEntryUrl), VideoEntry.class);
+ videoEntry.delete();
+ nodeService.removeAspect(nodeRef, YouTubePublishingModel.ASPECT_ASSET);
+ }
}
}