Publishing:

- Added initial icons to each of the supported channel types along with API (foundation and REST) to access them.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29249 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Brian Remmington
2011-07-21 12:39:18 +00:00
parent f07faf00b0
commit e16e19e2c5
14 changed files with 53 additions and 0 deletions

View File

@@ -87,6 +87,7 @@
<property name="nodeService" ref="NodeService" /> <property name="nodeService" ref="NodeService" />
<property name="behaviourFilter" ref="policyBehaviourFilter" /> <property name="behaviourFilter" ref="policyBehaviourFilter" />
<property name="urlShortener" ref="urlShortener" /> <property name="urlShortener" ref="urlShortener" />
<property name="dictionaryService" ref="DictionaryService" />
</bean> </bean>
<bean id="publishingObjectFactory" class="org.alfresco.repo.publishing.PublishingObjectFactory"> <bean id="publishingObjectFactory" class="org.alfresco.repo.publishing.PublishingObjectFactory">

View File

@@ -38,6 +38,8 @@ import org.alfresco.service.cmr.transfer.NodeFinder;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.util.ParameterCheck; import org.alfresco.util.ParameterCheck;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
/** /**
* @author Nick Smith * @author Nick Smith
@@ -175,4 +177,29 @@ public abstract class AbstractChannelType implements ChannelType, InitializingBe
} }
return result; return result;
} }
public Resource getIcon16()
{
return getIcon("16");
}
public Resource getIcon32()
{
return getIcon("32");
}
protected Resource getIcon(String sizeSuffix)
{
String className = this.getClass().getCanonicalName();
className = className.replaceAll("\\.", "\\/");
StringBuilder iconPath = new StringBuilder(className);
iconPath.append(sizeSuffix).append('.').append(getIconFileExtension());
Resource resource = new ClassPathResource(iconPath.toString());
return resource.exists() ? resource : null;
}
public String getIconFileExtension()
{
return "png";
}
} }

View File

@@ -34,6 +34,7 @@ import java.util.Set;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.policy.BehaviourFilter; import org.alfresco.repo.policy.BehaviourFilter;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.publishing.NodeSnapshot; import org.alfresco.service.cmr.publishing.NodeSnapshot;
import org.alfresco.service.cmr.publishing.PublishingEvent; import org.alfresco.service.cmr.publishing.PublishingEvent;
import org.alfresco.service.cmr.publishing.PublishingPackageEntry; import org.alfresco.service.cmr.publishing.PublishingPackageEntry;
@@ -62,6 +63,7 @@ public class PublishingEventProcessor
private NodeService nodeService; private NodeService nodeService;
private BehaviourFilter behaviourFilter; private BehaviourFilter behaviourFilter;
private UrlShortener urlShortener; private UrlShortener urlShortener;
private DictionaryService dictionaryService;
public void processEventNode(NodeRef eventNode) public void processEventNode(NodeRef eventNode)
{ {
@@ -223,6 +225,13 @@ public class PublishingEventProcessor
Map<QName, Serializable> publishProps = nodeService.getProperties(publishedNode); Map<QName, Serializable> publishProps = nodeService.getProperties(publishedNode);
Set<QName> propsToRemove = new HashSet<QName>(publishProps.keySet()); Set<QName> propsToRemove = new HashSet<QName>(publishProps.keySet());
propsToRemove.removeAll(snapshotProps.keySet()); propsToRemove.removeAll(snapshotProps.keySet());
//We want to retain the published asset id and URL in the updated node...
snapshotProps.put(PublishingModel.PROP_ASSET_ID, nodeService.getProperty(publishedNode,
PublishingModel.PROP_ASSET_ID));
snapshotProps.put(PublishingModel.PROP_ASSET_URL, nodeService.getProperty(publishedNode,
PublishingModel.PROP_ASSET_URL));
for (QName propertyToRemove : propsToRemove) for (QName propertyToRemove : propsToRemove)
{ {
nodeService.removeProperty(publishedNode, propertyToRemove); nodeService.removeProperty(publishedNode, propertyToRemove);
@@ -238,6 +247,12 @@ public class PublishingEventProcessor
Set<QName> aspectsToRemove = nodeService.getAspects(publishedNode); Set<QName> aspectsToRemove = nodeService.getAspects(publishedNode);
aspectsToRemove.removeAll(newAspects); aspectsToRemove.removeAll(newAspects);
aspectsToRemove.remove(ASPECT_PUBLISHED); aspectsToRemove.remove(ASPECT_PUBLISHED);
aspectsToRemove.remove(PublishingModel.ASPECT_ASSET);
for (QName publishedAssetAspect : dictionaryService.getSubAspects(PublishingModel.ASPECT_ASSET, true))
{
aspectsToRemove.remove(publishedAssetAspect);
}
for (QName aspectToRemove : aspectsToRemove) for (QName aspectToRemove : aspectsToRemove)
{ {
nodeService.removeAspect(publishedNode, aspectToRemove); nodeService.removeAspect(publishedNode, aspectToRemove);
@@ -327,4 +342,9 @@ public class PublishingEventProcessor
{ {
this.urlShortener = urlShortener; this.urlShortener = urlShortener;
} }
public void setDictionaryService(DictionaryService dictionaryService)
{
this.dictionaryService = dictionaryService;
}
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -27,6 +27,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.transfer.NodeFilter; import org.alfresco.service.cmr.transfer.NodeFilter;
import org.alfresco.service.cmr.transfer.NodeFinder; import org.alfresco.service.cmr.transfer.NodeFinder;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.springframework.core.io.Resource;
/** /**
* @author Brian * @author Brian
@@ -59,4 +60,8 @@ public interface ChannelType
String getAuthorisationUrl(Channel channel, String callbackUrl); String getAuthorisationUrl(Channel channel, String callbackUrl);
boolean acceptAuthorisationCallback(Channel channel, Map<String, String[]> callbackHeaders, Map<String, String[]> callbackParams); boolean acceptAuthorisationCallback(Channel channel, Map<String, String[]> callbackHeaders, Map<String, String[]> callbackParams);
String getIconFileExtension();
Resource getIcon16();
Resource getIcon32();
} }