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>
Related
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.
I am using spring , hibernate and maven for building my project and face this error .
javax.persistence.TransactionRequiredException: no transaction is in progress
<jpa:repositories base-package="com.sam.repository" />
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="evaluationSystemUnit"/>
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="true" />
</bean>
</property>
<property name="jpaPropertyMap">
<map>
<entry key="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
<entry key="hibernate.hbm2ddl.auto" value="none" />
<entry key="hibernate.format_sql" value="true" />
</map>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/sems?autoReconnect=true&characterEncoding=UTF-8" />
<property name="username" value="root" />
<property name="password" value="" />
</bean>
i found the solution.
in my servlet-config.xml , i should write
<context:component-scan base-package="com.sam.controller"/>
instead of
<context:component-scan base-package="com.sam"/>
and in my jpaContext.xml , i should write
<context:component-scan base-package="com.sam"/>
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>
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.
Let me know how to initialize tiles from dispatcher and application context and if any changes required in web.xml,
this is my tiles.xml
<definition name="contact" extends="mainLayout">
<put-attribute name="title" value="Contact Manager" />
<put-attribute name="body" value="/WEB-INF/jsp/contact.jsp" />
</definition>
</tiles-definitions>
in application context i have used
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tiles.xml</value>
</list>
</property>
</bean>
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="requestContextAttribute" value="requestContext"/>
<property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView"/>
</bean>
and dispatcher looks like this
<bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>
indexController</prop>-->
newController
<bean class="org.springframework.web.servlet.view.tiles2.TilesConfigurer" id="tilesConfigurer">
<property name="definitions">
<list>
<value>WEB-INF/tiles.xml</value>
</list>
</property>
</bean>
<bean class="org.springframework.web.servlet.view.UrlBasedViewResolver" id="viewResolver">
<property name="viewClass">
<value>
org.springframework.web.servlet.view.tiles2.TilesView
</value>
</property>
In Dispatcher-Servlet
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tiles.xml</value>
</list>
</property>
</bean>
In web.xml use this code
<listener>
<listener-class>org.apache.tiles.web.startup.simple.SimpleTilesListener</listener-class>
</listener>
rest is not required for spring-tiles application, tiles.xml is depended on your requirement