How to create file upload control in custom content model - alfresco

I create custom model with some textboxes and drop down controls. But I want to create file upload control. How can I do this in alfresco 4.2.f?
Can any one help me please? How can I create file upload in my custom content model??
I created custom model: following is my customModel.xml file
<?xml version="1.0" encoding="UTF-8"?>
<!-- Optional meta-data about the model -->
<description>Custom Model</description>
<author>Admin</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" />
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys" />
</imports>
<namespaces>
<namespace uri="http://www.healthindia.org/model/content/1.0" prefix="my" />
</namespaces>
<constraints>
<constraint name="my:departmentcategory" type="LIST">
<parameter name="allowedValues">
<list>
<value>Dep 1</value>
<value>Dep 2</value>
</list>
</parameter>
</constraint>
<constraint name="my:billcategory" type="LIST">
<parameter name="allowedValues">
<list>
<value>BillType1</value>
<value>BillType2</value>
</list>
</parameter>
</constraint>
</constraints>
<types>
<!-- Definition of new Content Type: Press Release -->
<type name="my:content">
<title>My Post</title>
<parent>cm:content</parent>
<properties>
<property name="my:department">
<title>Department</title>
<type>d:mltext</type>
<multiple>false</multiple>
<index enabled="false">
<atomic>false</atomic>
<stored>false</stored>
<tokenised>false</tokenised>
</index>
<constraints>
<constraint ref="my:departmentcategory" />
</constraints>
</property>
<property name="my:subject">
<title>Subject</title>
<type>d:mltext</type>
</property>
<property name="my:billtype">
<title>Bill Type</title>
<type>d:mltext</type>
<multiple>false</multiple>
<index enabled="false">
<atomic>false</atomic>
<stored>false</stored>
<tokenised>false</tokenised>
</index>
<constraints>
<constraint ref="my:billcategory" />
</constraints>
</property>
<property name="my:billtitle">
<title>Bill Title</title>
<type>d:mltext</type>
</property>
<property name="my:billno">
<title>Bill No</title>
<type>d:mltext</type>
</property>
<!-- <property name="my:category"> <title>Category</title> <type>d:mltext</type>
</property> -->
</properties>
<associations>
<association name="my:files">
<title>Files</title>
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>cm:content</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
</associations>
</type>
<!-- Definition of new Content Type: Press Release -->
<type name="my:housecontent">
<title>House Master</title>
<parent>cm:content</parent>
<properties>
<property name="my:houseid">
<title>House Id</title>
<type>d:mltext</type>
</property>
<property name="my:housename">
<title>House Name</title>
<type>d:mltext</type>
</property>
<!-- <property name="my:category"> <title>Category</title> <type>d:mltext</type>
</property> -->
</properties>
</type>
</types>
In this file I created textboxes and drop down controls, and I want file upload also (like Add Content in alfresco explorer). I don't have any idea about how this can be done.

Related

Spring Security authentication failure page not work

I use spring-security to manage user authentication in my spring-mvc project,but now I found when I typed a wrong username or password and login,it will show a HTTP Status 401,Authentication Failed:Bad credentials page on my web browser listed in the below.However I have configured the authentication-failure-url in my spring-security.xml file,but it doesn't work,I do not know why.
Could anyone can help me?
This is my error page that the browser shown:
This is my spring-security.xml configuration code:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd">
<security:http pattern="/interface/**" security="none"/>
<security:http pattern="/forward.html" security="none"/>
<security:http pattern="/js/**" security="none"/>
<security:http pattern="/css/**" security="none"/>
<security:http pattern="/images/**" security="none"/>
<security:http pattern="/file/**" security="none"/>
<security:http pattern="/favicon.ico" security="none"/>
<security:http pattern="/login**" security="none" />
<security:http auto-config="true" access-denied-page="/accessDenied" use-expressions="true">
<security:intercept-url pattern="/login**" access="isAnonymous()" /> -->
<security:intercept-url pattern="/common/exceptionInfo.jsp" access="isAnonymous()" />
<security:intercept-url pattern="/**" access="isFullyAuthenticated()" />
<security:session-management session-authentication-error-url="/login" invalid-session-url="/login">
<security:concurrency-control session-registry-ref="sessionRegistry" expired-url="/login"/>
</security:session-management>
<security:custom-filter before="CONCURRENT_SESSION_FILTER" ref="concurrencyFilter" />
<security:custom-filter before="FORM_LOGIN_FILTER" ref="authFilter" />
<security:custom-filter before="FILTER_SECURITY_INTERCEPTOR" ref="securityFilter"/>
<security:form-login login-page="/login" authentication-failure-url="/login?failure"
authentication-details-source-ref="customAuthenticationDetailsSource"
authentication-success-handler-ref="customAuthenticationSuccessHandler"/>
<security:logout invalidate-session="true" logout-url="/logout" success-handler-ref="customLogoutSuccessHandler"/>
</security:http>
<security:authentication-manager alias="authenticationManager">
<security:authentication-provider ref="customAuthenticationProvider"/>
</security:authentication-manager>
<bean id="customUserDetailsService" class="com.lucumt.security.CustomUserDetailsService"/>
<bean id="customAuthenticationProvider" class="com.lucumt.security.CustomAuthenticationProvider">
<property name="userDetailsService" ref="customUserDetailsService"/>
</bean>
<bean id="customAuthenticationDetailsSource" class="com.lucumt.security.CustomAuthenticationDetailsSource"/>
<bean id="customAuthenticationSuccessHandler" class="com.lucumt.security.CustomAuthenticationSuccessHandler">
<property name="defaultTargetUrl" value="/home"/>
</bean>
<bean id="customLogoutSuccessHandler" class="com.lucumt.security.CustomLogoutSuccessHandler">
<property name="defaultTargetUrl" value="/login"/>
</bean>
<bean id="securityFilter" class="com.lucumt.security.CustomFilterSecurityInterceptor">
<property name="authenticationManager" ref="authenticationManager"/>
<property name="accessDecisionManager" ref="accessDecisionManager"/>
<property name="securityMetadataSource" ref="securityMetadataSource"/>
</bean>
<bean id="accessDecisionManager" class="com.lucumt.security.CustomAccessDecisionManager"/>
<bean id="securityMetadataSource" class="com.lucumt.security.CustomInvocationSecurityMetadataSource">
<constructor-arg ref="authorityDao"/>
</bean>
<bean id="concurrencyFilter" class="org.springframework.security.web.session.ConcurrentSessionFilter">
<property name="sessionRegistry" ref="sessionRegistry" />
<property name="expiredUrl" value="/login?times" />
</bean>
<bean id="authFilter" class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter">
<property name="sessionAuthenticationStrategy" ref="sessionStrategy" />
<property name="authenticationManager" ref="authenticationManager" />
<property name="authenticationDetailsSource" ref="customAuthenticationDetailsSource"/>
<property name="authenticationSuccessHandler" ref="customAuthenticationSuccessHandler"/>
</bean>
<bean id="sessionStrategy" class="com.lucumt.security.CustomConcurrentSessionControlStrategy">
<constructor-arg ref="sessionRegistry"/>
</bean>
<bean id="authorityDao" class="com.lucumt.dao.impl.AuthorityDaoImpl"/>
<bean id="sessionRegistry" class="org.springframework.security.core.session.SessionRegistryImpl"/>
</beans>
As you can seen,I have configured the authentication-failure-urlas below,but it doesn't work!
<security:form-login login-page="/login" authentication-failure-url="/login?failure"
authentication-details-source-ref="customAuthenticationDetailsSource"
authentication-success-handler-ref="customAuthenticationSuccessHandler"/>
However,if I remove the session-management configuration as below,then the authentication-failure-url will work!
<security:session-management session-authentication-error-url="/login" invalid-session-url="/login">
<security:concurrency-control session-registry-ref="sessionRegistry" expired-url="/login"/>
</security:session-management>
<security:custom-filter before="CONCURRENT_SESSION_FILTER" ref="concurrencyFilter" />
<security:custom-filter before="FORM_LOGIN_FILTER" ref="authFilter" />
The reason why I add session-management is that I want to limit the number of user that can log in at the same time via Java code.
Now that I want to perseve session-management and also want to the authentication-failure-url work,could anyone help me?Thanks in advance!
Place this in your Dispatcher-servlet.xml
<bean
class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="exceptionMappings">
<props>
<prop key="java.lang.Exception">login/login</prop>
</props>
</property>
</bean>
Its Resolve Your Problem completely.

Integrating Spring WebFlow with Thymeleaf

I am developing SpringMVC application using Thymeleaf Templates fragment. I want to add simple flow. This is my project structure and configuration:
My spring-servlet.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">
<!-- Deklaracja pakietów kontrolerów: -->
<context:component-scan base-package="pl.etestownik.controller"
scoped-proxy="targetClass" />
<mvc:annotation-driven
ignore-default-model-on-redirect="true" />
<mvc:default-servlet-handler />
<bean
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="webBindingInitializer">
<bean
class="org.springframework.web.bind.support.ConfigurableWebBindingInitializer" />
</property>
</bean>
<!-- Thymeleaf konfiguracja resolverów: -->
<bean id="templateResolver"
class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">
<property name="prefix" value="/" />
<property name="suffix" value=".html" />
<property name="templateMode" value="HTML5" />
<property name="characterEncoding" value="UTF-8" />
<property name="cacheable" value="false" />
<property name="order" value="0"></property>
</bean>
<!--
<bean id="thymeleafViewResolver" class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
<property name="templateEngine" ref="templateEngine" />
<property name="characterEncoding" value="UTF-8" />
<property name="contentType" value="text/html; charset=UTF-8" />
<property name="order" value="1" />
</bean>
-->
<bean id="thymeleafViewResolver" class="org.thymeleaf.spring4.view.AjaxThymeleafViewResolver">
<property name="viewClass" value="org.thymeleaf.spring4.view.FlowAjaxThymeleafView" />
<property name="templateEngine" ref="templateEngine" />
<property name="order" value="1" />
</bean>
<bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine">
<property name="templateResolver" ref="templateResolver" />
<property name="additionalDialects">
<set>
<bean class="nz.net.ultraq.thymeleaf.LayoutDialect" />
</set>
</property>
</bean>
<import resource="webflow.xml" />
<!-- Spring WebFlow -->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/flows" />
<property name="suffix" value=".html" />
<property name="order" value="2"></property>
</bean>
</beans>
webflow.xml file:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:webflow="http://www.springframework.org/schema/webflow-config"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/webflow-config
http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.4.xsd">
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
<property name="flowRegistry" ref="flowRegistry" />
<property name="order" value="0" />
</bean>
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter">
<property name="flowExecutor" ref="flowExecutor" />
</bean>
<webflow:flow-registry id="flowRegistry"
base-path="/flows" flow-builder-services="flowBuilderServices">
<webflow:flow-location id="addQuiz"
path="/adding-quiz/add-quiz-flow.xml"/>
</webflow:flow-registry>
<webflow:flow-executor id="flowExecutor"
flow-registry="flowRegistry" />
<webflow:flow-builder-services id="flowBuilderServices"
view-factory-creator="mvcViewFactoryCreator" />
<bean id="mvcViewFactoryCreator"
class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
<property name="viewResolvers" ref="thymeleafViewResolver" />
</bean>
</beans>
and add-quiz-flow.xml:
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.4.xsd"
start-state="quizName">
<view-state id="quizName" view="flows/adding-quiz/quizName" >
<transition on="addQuestion" to="quizQuestion" />
</view-state>
<view-state id="quizQuestion" view="flows/adding-quiz/quizQuestion">
<transition on="nextQuestion" to="quizQuestion" />
<transition on="finish" to="finish" />
</view-state>
<end-state id="finish"/> <!-- Jakies "zapisano do bazy, czy cos -->
And now:
Property viewResolvers in mvcViewFactoryCreator bean is set to viewResolver(so it is pointing at InternalResourceViewResolver).My flow works fine, but it is doesn't include thymleaf template fragment,There is only simple pages, without header and footer.
As I read in thymeleaf docs : Integrating Thymeleaf and WebFlow
I am supposed to add thymeleafViewResolver and change property in mvcViewFactoryCreator from
<property name="viewResolvers" ref="viewResolver" />
to
<property name="viewResolvers" ref="thymeleafViewResolver" />
In this configuration whole applcation works fine (templates are included), but when trying to start flow, typing:http://localhost:8070/addQuiz?quizName I'm, getting folowing error:
`org.thymeleaf.exceptions.TemplateInputException: Error resolving template "/adding-quiz/quizName", template might not exist or might not be accessible by any of the configured Template Resolvers`
Do you have any idea, where I'm going wrong?
Ok, it seems that I've handled the problem. There were few mistakes:
Firstly, I've changed
<view-state id="quizName" view="/adding-quiz/quizName">
to
<view-state id="quizName" view="/flows/adding-quiz/quizName">
After that I found a bug in html file. Now, configuration looks working properly.

Alfresco disable full text indexing on specific content model

Using Alfresco 4.2 or 5.0, how do you disable full text indexing on a content-model basis?
Here is an example content model, what do you change specifically (i.e. do not reference the index control aspect without how to actually use it with a content model).
<model name="my:textdoc" xmlns="http://www.alfresco.org/model/dictionary/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<imports>
<import prefix="d" uri="http://www.alfresco.org/model/dictionary/1.0" />
<import prefix="cm" uri="http://www.alfresco.org/model/content/1.0" />
</imports>
<namespaces>
<namespace prefix="my"
uri="http://www.notarealurl.xyz/model/my/1.0" />
</namespaces>
<types>
<type name="my:securetextdoc">
<title>text docs with keyword searching, but not content searching</title>
<parent>cm:content</parent>
<properties>
<property name="my:securekeywords">
<title>custom key word text field</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
</properties>
<mandatory-aspects>
<!-- <aspect>cm:dublincore</aspect> -->
<aspect>cm:versionable</aspect>
</mandatory-aspects>
</type>
</types>
FINAL ANSWER
<model name="my:textdoc" xmlns="http://www.alfresco.org/model/dictionary/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<imports>
<import prefix="d" uri="http://www.alfresco.org/model/dictionary/1.0" />
<import prefix="cm" uri="http://www.alfresco.org/model/content/1.0" />
</imports>
<namespaces>
<namespace prefix="my"
uri="http://www.notarealurl.xyz/model/my/1.0" />
</namespaces>
<types>
<type name="my:securetextdoc">
<title>text docs with keyword searching, but not content searching</title>
<parent>cm:content</parent>
<properties>
<property name="my:securekeywords">
<title>custom key word text field</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
</properties>
<mandatory-aspects>
<!-- <aspect>cm:dublincore</aspect> -->
<aspect>my:doNotIndexContentControl</aspect>
<aspect>cm:versionable</aspect>
</mandatory-aspects>
</type>
</types>
<aspects>
<aspect name="my:doNotIndexContentControl">
<title>Do Not Index Control</title>
<parent>cm:indexControl</parent>
<overrides>
<property name="cm:isIndexed">
<default>true</default>
</property>
<property name="cm:isContentIndexed">
<default>false</default>
</property>
</overrides>
</aspect>
</aspects>
</model>
Important Note: If you get "Source node class has no callback" errors, this is related to changing the content model and then trying to update (likely versionable) existing content. No known workaround, but this is unrelated to index control options.
You can achieve this by defining a new aspect that extends cm:indexControl like so:
<aspect name="my:doNotIndexContentControl">
<title>Do Not Index Control</title>
<parent>cm:indexControl</parent>
<overrides>
<property name="cm:isIndexed">
<default>true</default>
</property>
<property name="cm:isContentIndexed">
<default>false</default>
</property>
</overrides>
</aspect>
Note the overrides. The overridden property, cm:isContentIndexed, with default value set to false is key.
You then add this aspect as mandatory for the types which you do not wish to full text index the content. The full configuration options for cm:indexControl can be found in the documentation http://docs.alfresco.com/4.2/concepts/admin-indexes.html
Also, if you have existing content items that have already been indexed and you want those documents to no longer be indexed, you will need to do a full re-index.
This is covered in the Data Dictionary guide on the Alfresco wiki
All you need to do is all this to your model:
<index enabled="false" />
If you look at something like the Alfresco system model, you'll see several examples of that

can't able to update custom property aspects in alfresco

I’m having problem while adding the aspect to the required folders in Alfresco Share (Alfresco 4.2). When I click Manage Aspects, select the desired aspect then Save, a message pops up saying “Could not update aspects”.
Any help would be much appreciated.
Thank you..
share-config-custom.xml
<aspects>
<!-- Aspects that a user can see -->
<visible>
<aspect name="cm:generalclassifiable" />
<aspect name="cm:complianceable" />
<aspect name="cm:dublincore" />
<aspect name="cm:effectivity" />
<aspect name="cm:summarizable" />
<aspect name="cm:versionable" />
<aspect name="cm:templatable" />
<aspect name="cm:emailed" />
<aspect name="emailserver:aliasable" />
<aspect name="cm:taggable" />
<aspect name="app:inlineeditable" />
<aspect name="gd:googleEditable" />
<aspect name="cm:geographic" />
<aspect name="exif:exif" />
<aspect name="audio:audio" />
<aspect name="cm:indexControl" />
<aspect name="dp:restrictable" />
<aspect name="kb:referencable" />
</visible>
<!-- Aspects that a user can add. Same as "visible" if left empty -->
<addable>
</addable>
<!-- Aspects that a user can remove. Same as "visible" if left empty -->
<removeable>
</removeable>
</aspects>
custom-slingshot-application-context.xml.sample
<bean id="webscripts.kb.resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
<property name="resourceBundles">
<list>
<value>alfresco.messages.knowledgebase</value>
</list>
</property>
</bean>
web-client-config-custom.xml.sample
<config evaluator="aspect-name" condition="kb:referencable">
<property-sheet>
<show-property name="kb:documentRef"/>
</property-sheet>
</config>
<config evaluator="string-compare" condition="Action Wizards">
<aspects>
<aspect name="my:docProps" />
</aspects>
</config>
kb-model.xml
<aspects>
<!-- Definition of new Content Aspect: Knowledge Base Document -->
<aspect name="kb:referencable">
<title>Knowledge Base Referencable</title>
<properties>
<property name="kb:documentRef">
<type>d:text</type>
</property>
</properties>
</aspect>
</aspects>
kb-model-context.xml
<?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.kb.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
<property name="models">
<list>
<value>alfresco/extension/kb-model.xml</value>
</list>
</property>
</bean>
<bean id="extension.kb.resourceBundle" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
<property name="resourceBundles">
<list>
<value>alfresco.messages.knowledgebase</value>
</list>
</property>
</bean>
</beans>
For creating aspect in Alfresco There are three main files which deals with aspects.
1.Model File In which you are defining aspect.
2.Context File(From which you are injecting model file)
3.Adding aspect for visibility in share-config-custom(Or web-client config if alfresco version is <5.0b)
Example of all above are as below.
Model File
<?xml version="1.0" encoding="UTF-8"?>
<model name="model1:ExtensionModel" xmlns="http://www.alfresco.org/model/dictionary/1.0" >
<description>Extension model</description>
<author>Krutik Jayswal</author>
<version>1.0</version>
<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
</imports>
<namespaces>
<namespace uri="http://www.model.com/model/model/1.0" prefix="m1"/>
</namespaces>
<data-types/>
<constraints/>
<aspects>
<aspect name="m1:metadata1">
<title>Meta data 1</title>
<properties>
<property name="m1:Solution">
<title>Solution</title>
<type>d:text</type>
<mandatory>false</mandatory>
<index enabled="true">
<atomic>true</atomic>
<stored>true</stored>
<tokenised>TRUE</tokenised>
</index>
</property>
</properties>
</aspect>
</aspects>
</model>
Context File
<?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" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
<property name="models">
<list>
<value>alfresco/extension/extCustomModel.xml</value><!--This is path till model file.alfresco directory will be inside tomcat/shared classes/**alfresco**-->
</list>
</property>
</bean>
</beans>
Share-Config-Custom
<config evaluator="string-compare" condition="DocumentLibrary">
<aspects>
<visible>
<aspect name="m1:metadata1" />
</visible>
</aspects>
</config>

How to enable cascade delete

I have node has an association as child association with set of another nodes, what i know is once the node deleted the child association will be deleted in a cascading manner.
but i don't see that in my code, i write a recursive function to delete the child and my question how to enable the cascading delete.
My Model.
<description>Security Content Model</description>
<author>MOHAMMED AMR</author>
<version>1.0</version>
<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys" />
<import uri="http://www.alfresco.org/model/user/1.0" prefix="usr"/>
</imports>
<namespaces>
<namespace uri="www.ds.alfresco.security.extension.com" prefix="sec" />
</namespaces>
<constraints>
<constraint name="sec:permissionValue" type="LIST">
<parameter name="allowedValues">
<list>
<value>READ SADER</value>
<value>WRITE SADER</value>
<value>READ WARED</value>
<value>WRITE WARED</value>
</list>
</parameter>
</constraint>
</constraints>
<types>
<type name="sec:organizationSequence">
<title>Organization Sequence</title>
<parent>cm:content</parent>
<mandatory-aspects>
<aspect>sec:sequencable</aspect>
</mandatory-aspects>
</type>
<type name="sec:positionSequence">
<title>Position Sequence</title>
<parent>cm:content</parent>
<mandatory-aspects>
<aspect>sec:sequencable</aspect>
</mandatory-aspects>
</type>
<type name="sec:position">
<title>Position</title>
<parent>cm:content</parent>
<properties>
<property name="sec:positionId">
<title>Position ID</title>
<type>d:text</type>
</property>
<property name="sec:positionName">
<title>Position Name</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="sec:positionDescription">
<title>Position Description</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="sec:parentPositionId">
<title>Position Description</title>
<type>d:int</type>
<default>0</default>
</property>
<property name="sec:permissions">
<title>Position Permission</title>
<type>d:text</type>
<multiple>true</multiple>
<constraints>
<constraint ref="sec:permissionValue" />
</constraints>
</property>
</properties>
<associations>
<child-association name="sec:suborindatesPositions">
<source>
<mandatory>true</mandatory>
<many>false</many>
</source>
<target>
<class>sec:position</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
<duplicate>false</duplicate>
<propagateTimestamps>true</propagateTimestamps>
</child-association>
</associations>
</type>
<type name="sec:organization">
<title>Organization</title>
<parent>cm:content</parent>
<properties>
<property name="sec:organizationId">
<title>Organization ID</title>
<type>d:int</type>
</property>
<property name="sec:organizationName">
<title>Organization Name</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="sec:organizationDescription">
<title>Organization Description</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="sec:rootPosition">
<title>Root Position</title>
<type>d:noderef</type>
</property>
</properties>
</type>
</types>
<aspects>
<aspect name="sec:sequencable">
<title>Capable to have sequence</title>
<parent>cm:content</parent>
<properties>
<property name="sec:sequenceId">
<title>Sequence</title>
<type>d:int</type>
</property>
<property name="sec:sequenceName">
<title>Sequence Name</title>
<type>d:text</type>
</property>
</properties>
</aspect>
<aspect name="sec:positionable">
<title>Capable to have position</title>
<properties>
<property name="sec:primaryPosition">
<title>Primary Position</title>
<type>d:noderef</type>
<multiple>false</multiple>
</property>
<property name="sec:secondaryPositions">
<title>Primary Position</title>
<type>d:noderef</type>
<multiple>true</multiple>
</property>
</properties>
</aspect>
</aspects>

Resources