What's cm:subscribable made for? - alfresco

In the original contentModel.xml file, I see there is an aspect called cm:subscribable :
<aspect name="cm:subscribable">
<associations>
<association name="cm:subscribedBy">
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>cm:person</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
</associations>
</aspect>
I would like to know what it is made for/used to, since I didn't found enough information in the documentation.
Is there an existing function in Alfresco which uses it, or this is just an aspect made "in case" someone wants to developp a suscribable functionnality ?

After digging a little, it looks like it is used when we subscribe/follow an user in share.
Watching the Subscription service and the existing webscripts helped me to understand that.

Related

Upload duplicate files using CMIS API

I want to upload the two file having the same name into Alfresco Repository (I am able to do it into Documentum) but I am getting below exception
Can somebody tell me how can I achieve it as it is my business use case in which the user can upload the document having the same name? Please note that the same is working as expected in the Documentum.
[2/12/20 16:43:03:554 IST] 00000040 SystemErr R org.apache.chemistry.opencmis.commons.exceptions.CmisContentAlreadyExistsException: An object with this name already exists: 01120277 File or folder Book_295_12.xlsx already exists
[2/12/20 16:43:03:555 IST] 00000040 SystemErr R at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:506)
To do this you should override your contentModel.xml:
<type name="cm:folder">
<title>Folder</title>
<parent>cm:cmobject</parent>
<archive>true</archive>
<properties/>
<associations>
<child-association name="cm:contains">
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>sys:base</class>
<mandatory enforced="false">false</mandatory>
<many>true</many>
</target>
<duplicate>false</duplicate>
<propagateTimestamps>true</propagateTimestamps>
</child-association>
</associations>
<overrides/>
<mandatory-aspects/>
</type>
As you can see there is duplicate param in child-association with "false" value. You should change it to "true"
I thing is not good idea duplicate child-association. Is different child-association as a name of property.
If you need a second name, why not adding this property in other type or aspect?
For example:
<type name="mycm:mytype">
<title>Test</title>
<parent>cm:content</parent>
<properties>
<property name="mycm:name">
<title>Common name</title>
<type>d:text</type>
</property>
</properties>
</type>
Now, you can have documents with a same name with mycm:name and you can assigned timestamp to cm:name.

AEM 6.4: Using wildcards in filter definition

I'm facing following issue:
In one of my content project exists the file "filter.xml". It contains following entries:
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/content/sites/de/produktpartner/a/rep:policy" mode="merge" />
...
<filter root="/content/sites/de/produktpartner/z/rep:policy" mode="merge" />
</workspaceFilter>
My question is: To limit the entries in filter.xml can I use wildcards? If so, how?
I tried
<filter root="/content/sites/de/produktpartner/*/rep:policy" mode="merge" />
but it seemed not work.
The root must be a path but you can further specify filters that allow regular expressions.
<filter root="/content/sites" mode="merge" />
<include pattern="/content/sites/[a-z]{2}/produktpartner/(.*)/rep:policy"/>
</filter>
However, managing permissions using CRX packages can be very cumbersome. Check out AEM Permission Management
It's a tool that supports a permission management DSL that makes the whole ordeal a lot easier. I work for the company that developed it and we use it on the vast majority of our projects.
The Access Control Tool for Adobe Experience Manager is another option that has worked for me in the past.

Alfresco: How do I view which associations a item has been made a part of?

I have two custom types: sc:foo and sc:bar.
sc:foo has an association with sc:bar:
<type name="sc:bar">
<title>Bar</title>
<parent>cm:content</parent>
</type>
<type name="sc:foo">
<title>Foo</title>
<parent>cm:content</parent>
<associations>
<association name="sc:someAssociation">
<title>Some Association</title>
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>sc:bar</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
</associations>
</type>
In web-client-config-custom.xml I have the following so that when looking at an sc:foo, I can see which sc:bar's it is assocated with.
<config evaluator="node-type" condition="sc:foo">
<property-sheet>
<show-association name="sc:someAssociation" />
</property-sheet>
</config>
Is there a way for me to look at a sc:bar and see which associations it has been made a part of?
I am using Alfresco Explorer 3.3 Enterprise.
Although NodeService API allows yout to get source nodes from any assoc, the JSF client of Alfresco is not capable of showing them, and since the JSF client is no longer being enhanced this feature will not be added ALFCOM-588.
So, either you implement yourself this feature or also you can follow #vegemite4me advice and keep two associations, in which case you should also implement onDeleteAssociation and onCreateAssociation policies to keep them in sync.
Would two way binding fix your problem ? Not saying that is a nice way.
<type name="sc:bar">
<title>Bar</title>
<parent>cm:content</parent>
<associations>
<association name="sc:someAssociation">
<title>Some Association</title>
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>sc:foo</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
</associations>
</type>
Or you can create new custom panel in document details and show all bars that are associated to foo file, so this information would not be a part of standard form that you are working with.

Alfresco custom action dialog not showing

I created a custom Alfresco action dialog using one of the sample SDK projects
as a base. I kept the sample projects "org.alfresco.sample" package for my java files
and it worked fine.
Then I tried to change the package name to "com.xxxxxx.xxxxx" and it stopped working.
I have checked all of the files in the project to make sure that I have replaced every instance of "org.alfresco.sample" with my new package name.
Can anyone suggest a possible reason for this?
Thanks
I found that when I build the project, it is not building the java files. Can anyone
suggest why it is not building the java files with the new package name?
Thanks
I got the java files build again. But the new actions are still not being used. The new actions use an evaluator but it does not seem to be running. (It would normally write to
the log.)
Here is part of the build.xml:
<project name="Custom Dialog Build File" default="package-amp" basedir=".">
<property name="project.dir" value="."/>
<property name="build.dir" value="${project.dir}/build"/>
<property name="config.dir" value="${project.dir}/config"/>
<property name="jsp.dir" value="${project.dir}/web/jsp"/>
<property name="web.dir" value="${project.dir}/web" />
<property name="package.file.jar" value="${build.dir}/lib/custom-dialog.jar"/>
<property name="package.file.zip" value="${build.dir}/lib/custom-dialog.zip"/>
<property name="amp.file" value="${build.dir}/dist/retailChannels.amp"/>
<path id="class.path">
<dirset dir="${build.dir}" />
<fileset dir="../../lib/server" includes="**/*.jar"/>
</path>
<target name="compile">
<mkdir dir="${build.dir}" />
<javac classpathref="class.path" srcdir="${project.dir}/source" destdir="${build.dir}" />
</target>
<target name="package-jar" depends="increment-build-number">
<delete file="${package.file.jar}" />
<jar destfile="${package.file.jar}">
<fileset dir="${build.dir}">
<exclude name="dist/**" />
<exclude name="lib/**" />
<exclude name="web/**" />
</fileset>
</jar>
</target>
<target name="mkdirs">
<mkdir dir="${build.dir}/dist" />
<mkdir dir="${build.dir}/lib" />
</target>
<target name="clean">
<delete includeemptydirs="true">
<fileset dir="${build.dir}/dist" includes="**/*"/>
</delete>
</target>
<target name="package-amp" depends="clean, mkdirs, package-jar" description="Package the Module" >
<delete file="${amp.file}" />
<zip destfile="${amp.file}" >
<fileset dir="${project.dir}/build" includes="lib/*.jar" />
<fileset dir="${project.dir}/config/alfresco/module/alfresco" includes="*.properties" />
<fileset dir="${project.dir}" includes="config/**/*.*" excludes="**/module.properties" />
<fileset dir="${project.dir}/source">
<include name="web/jsp/**/*.jsp" />
<include name="web/images/**" />
</fileset>
</zip>
</target>
</project>
I just tried going through the maven SDK tutorial that you suggested but I got
this error:
Feb 14, 2014 3:42:48 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: PermGen space
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
Check the build.xml file. Double-check the compile and package-jar tasks (or similar). For example, one or both of these tasks may have a fileset that uses a pattern to include your classes using the package structure, and it may no longer match now that you've changed your package name.
It's hard to tell without seeing your build.xml.
By the way, if you want a more up-to-date example for creating actions in Alfresco, take a look at this tutorial: http://ecmarchitect.com/alfresco-developer-series-tutorials/actions/tutorial/tutorial.html
It uses the Alfresco Maven SDK to package AMPs. The Alfresco Maven SDK is preferred over the old SDK you are using.

Is there a basic, standard .build file for NAnt?

Basically, I'm trying to integrate CruiseControl.NET with NAnt. I've got CC.NET set up, but I'm getting an exception when it tries to build with NAnt.
BUILD FAILED - Could not find a '*.build' file in 'C:\inetpub\MyProject\'
Okay, no big deal, I just have to create a build file. Not sure what that is, but I found one in the HelloWorld example that came with NAnt, it looks like this:
<project name="Hello World" default="run">
<property name="basename" value="HelloWorld"/>
<property name="debug" value="true"/>
<target name="clean">
<delete>
<fileset>
<include name="bin/${basename}-??.exe"/>
<include name="bin/${basename}-??.pdb"/>
</fileset>
</delete>
</target>
<target name="build">
<mkdir dir="bin" />
<csc target="exe" output="bin/${basename}-cs.exe" debug="${debug}">
<sources>
<include name="${basename}.cs"/>
</sources>
</csc>
<jsc target="exe" output="bin/${basename}-js.exe" debug="${debug}">
<sources>
<include name="${basename}.js"/>
</sources>
</jsc>
<vbc target="exe" output="bin/${basename}-vb.exe" debug="${debug}">
<sources>
<include name="${basename}.vb"/>
</sources>
</vbc>
</target>
<target name="run" depends="build">
<exec program="bin/${basename}-cs.exe" basedir="."/>
<exec program="bin/${basename}-js.exe" basedir="."/>
<exec program="bin/${basename}-vb.exe" basedir="."/>
</target>
</project>
There's a lot more content in this file than I was expecting. I tried searching around to find out what everything meant, what was required, etc. But I couldn't find anything.
Is there just a basic and standard file that I could use? All I want to do is simply build my entire application, nothing crazy.
Nant's tasks and attributes are described here: NAnt Help
Task Reference
Also,
A Brief Introduction to NAnt
NAnt Starter Series
This article has a template:
The Anatomy of a NAnt Build File
Plus, previous SO question:
Simple HelloWorld build script

Resources