- Added extension sample project to contain extenstion samples and used to test extension capabilities

- Added contentHits sample aspect that, when applied, counts the number of times a node of content is read and updated.
- Fix to web service sample
- Prevented onContentRead policy being fired when content is updated.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2287 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2006-02-02 16:37:36 +00:00
parent 21eab8566f
commit 2af1438c2e
4 changed files with 7 additions and 127 deletions

View File

@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Custom Model -->
<!-- Note: This model is pre-configured to load at startup of the Repository. So, all custom -->
<!-- types and aspects added here will automatically be registered -->
<model name="custom:customModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- Optional meta-data about the model -->
<description>Custom Model</description>
<author></author>
<version>1.0</version>
<imports>
<!-- Import Alfresco Dictionary Definitions -->
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
</imports>
<!-- Introduction of new namespaces defined by this model -->
<!-- NOTE: The following namespace custom.model should be changed to reflect your own namespace -->
<namespaces>
<namespace uri="custom.model" prefix="custom"/>
</namespaces>
</model>

View File

@@ -1,79 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Definition of new Model -->
<!-- The important part here is the name - Note: the use of the my: namespace
which is defined further on in the document -->
<model name="my:mynewmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- Optional meta-data about the model -->
<description>Example custom Model</description>
<author></author>
<version>1.0</version>
<!-- Imports are required to allow references to definitions in other models -->
<imports>
<!-- Import Alfresco Dictionary Definitions -->
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
</imports>
<!-- Introduction of new namespaces defined by this model -->
<!-- NOTE: The following namespace my.new.model should be changed to reflect your own namespace -->
<namespaces>
<namespace uri="my.new.model" prefix="my"/>
</namespaces>
<types>
<!-- Definition of new Content Type: Standard Operating Procedure -->
<type name="my:sop">
<title>Standard Operating Procedure</title>
<parent>cm:content</parent>
<properties>
<property name="my:publishedDate">
<type>d:datetime</type>
</property>
<property name="my:authorisedBy">
<type>d:text</type>
</property>
</properties>
<associations>
<association name="my:signOff">
<target>
<class>cm:content</class>
<mandatory>false</mandatory>
<many>false</many>
</target>
</association>
<child-association name="my:processSteps">
<target>
<class>cm:content</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</child-association>
</associations>
</type>
</types>
<!-- Definition of new Content Aspect: Image Classification -->
<aspects>
<aspect name="my:imageClassification">
<title>Image Classfication</title>
<properties>
<property name="my:width">
<type>d:int</type>
</property>
<property name="my:height">
<type>d:int</type>
</property>
<property name="my:resolution">
<type>d:int</type>
</property>
</properties>
</aspect>
</aspects>
</model>

View File

@@ -1,18 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<!-- Registration of new models -->
<bean id="extension.dictionaryBootstrap" class="org.alfresco.repo.dictionary.DictionaryBootstrap" init-method="bootstrap" depends-on="dictionaryBootstrap">
<property name="dictionaryDAO"><ref bean="dictionaryDAO"/></property>
<property name="models">
<list>
<value>alfresco/extension/exampleModel.xml</value>
<value>alfresco/extension/customModel.xml</value>
</list>
</property>
</bean>
</beans>

View File

@@ -233,6 +233,11 @@ public class RoutingContentService implements ContentService
}
public ContentReader getReader(NodeRef nodeRef, QName propertyQName)
{
return getReader(nodeRef, propertyQName, true);
}
private ContentReader getReader(NodeRef nodeRef, QName propertyQName, boolean fireContentReadPolicy)
{
// ensure that the node property is of type content
PropertyDefinition contentPropDef = dictionaryService.getProperty(propertyQName);
@@ -263,7 +268,7 @@ public class RoutingContentService implements ContentService
reader.setEncoding(contentData.getEncoding());
// Fire the content read policy
if (reader != null)
if (reader != null && fireContentReadPolicy == true)
{
// Fire the content update policy
Set<QName> types = new HashSet<QName>(this.nodeService.getAspects(nodeRef));
@@ -280,7 +285,7 @@ public class RoutingContentService implements ContentService
public ContentWriter getWriter(NodeRef nodeRef, QName propertyQName, boolean update)
{
// check for an existing URL - the get of the reader will perform type checking
ContentReader existingContentReader = getReader(nodeRef, propertyQName);
ContentReader existingContentReader = getReader(nodeRef, propertyQName, false);
// TODO: Choose the store to write to at runtime