Alfresco Custom Content Type not showing - maven

I have been trying to follow this tutorial about Alfresco custom content types
http://ecmarchitect.com/alfresco-developer-series-tutorials/content/tutorial/tutorial.html#localizing-strings-for-custom-content-models.
However, when I get to the 'Test your changes' step and I go to manage rules, I can't manage to get the custom types created (sc_doc and sc_whitepaper) in the dropdown list.
My share-config-custom.xml:
<!-- Share configuration related to this particular Share module extension, such as:
- Doclib action config
- Form config
- Aspect and Type config
Note. Any configuration related to the whole Share.war webapp
(i.e. not specific to this share extension) should be
placed in the environment specific config:
alfresco/tomcat/shared/classes/alfresco/web-extension/share-config-custom.xml file
-->
<alfresco-config>
<!-- Document Library config section -->
<config evaluator="string-compare" condition="DocumentLibrary">
<aspects>
<!-- Aspects that a user can see -->
<visible>
<aspect name="sc:webable" />
<aspect name="sc:productRelated" />
</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>
</config>
<config evaluator="node-type" condition="DocumentLibrary">
<types>
<type name="cm:content">
<subtype name="sc:doc" />
<subtype name="sc:whitepaper" />
</type>
<type name="sc:doc">
<subtype name="sc:whitepaper" />
</type>
</types>
</config>
</alfresco-config>
PS: Do I have to re-run 'mvn install' after every change I make in the .xml using Eclipse?
Any help will be much appreciated!

I know i am posting this answer bit late
and my solution is bit poor, But it works for me :)
I hope it will also work for you.
Strange thing is i am following same tutorial and at the time of 'Test your changes' stage not able to see my custom types on the server.
so to make it working in my share project i have changed place of
share-config-custom.xml
from src/main/resources/META-INF to src/main/amp/config/alfresco/web-extension
and restart alfresco and now able to view my custom types in type list on server.
plz post your answer if you have make done this by any other way :)
thank you.

I am not sure which kind of project you have created from maven artifacts.
Repository AMP archetype
All-In-One (AIO) archetype
Share AMP archetype
Here you can see list of all maven commands.
If you are not using local maven repository then you can go for "mvn package" to generate new AMP files and then deploy them manually on alfresco server.

Related

NetBeans 12.4 - Spring Boot Maven project, debug all test

In a Spring Boot Maven project I have tests with JUnit 5.
Within a test class (annotated with #SpringBootTest) I can select
Test File
Debug Test File
Run Focused Test Method
Debug Focused Test Method
On the project itself (Files window) I can select
Test
which runs all tests.
Is there a way to debug all tests?
So to speak I would expect a selection on the project like Debug Test besides Test.
The reason is, that some errors appear only when I run all tests. But when I run or debug just the erroneous test method or even the whole test class, the errors don't appear.
Sorry I haven't found a more GUI-friendly way yet (and verified only on Netbeans 12.3), but:
a) If you already have a nbactions.xml:
Add the following to the <actions/> element:
<action>
<actionName>CUSTOM-Debug-all-tests</actionName> <!-- should be unique for this project -->
<displayName>Debug All Tests</displayName> <!-- will be displayed in context menu -->
<packagings>
<packaging>*</packaging> <!-- according to your needs, taken from pre-configured action -->
</packagings>
<goals> <!-- according to your needs, taken from pre-configured action -->
<goal>process-test-classes</goal>
<goal>surefire:test</goal>
</goals>
<properties> <!-- according to your needs, taken from pre-configured action -->
<forkMode>once</forkMode>
<maven.surefire.debug>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}
</maven.surefire.debug>
<jpda.listen>true</jpda.listen>
</properties>
</action>
(Of course you can modify & adjust it to your needs, but this works for a quickstart (maven) project. Also interesting: "Debug integration test" action!)
Then you can execute it from "Project context menu>Run Maven>Debug All Tests"!
b) If You don't have an nbactions.xml (in your project) yet:
Just modify one of the pre-configured "Actions" (preferably "Debug (Integration) Test") from the "Actions" menu of "Project Properties", this (hitting "OK") will generate the according file at your project root. Then you can make it (maven-) executable as described above (a).(There must/should also be a way to run these Actions without modifying nbactions.xml at least by implementing a custom plugin....but haven't found the action/menu/tab yet:))
There is no need to modify the XML file directly, just
choose the Actions category in Project Properties
choose Configuration (<default config>, or dev (Profile), or...)
click Add Custom button
enter Action Name
fill the fields Execute Goals, Set Properties, etc.
If <default config> is choosen from Configuration, NetBeans will create a file nbactions.xml, otherwise if for example dev (Profile) is choosen a file nbactions-dev.xml is created, and so on.
The custom action is available in the context menue under Run Maven opened on pom.xml

Relationship between solution configuration, publish profile, and web.config transforms

I have the following setup in a Visual Studio 2013 ASP.NET Web API 2 project.
Web.Develop.config web transform to set an app settings key value
Web.Release.config web transform to remove an app settings key
Develop.pubxml to map to the Web.Develop.config transform
Release.pubxml to map to the Web.Release.config transform
Details for each are found below.
<!-- Web.Develop.config (Web Config Transform) -->
<appSettings>
<add key="ReportInputPath"
value="DevelopPath"
xdt:Transform="SetAttributes"
xdt:Locator="Match(key)" />
</appSettings>
<!-- Web.Release.config (Web Config Transform) -->
<appSettings xdt:Transform="Remove" />
<!-- **Develop.pubxml (Publish Profile) -->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>x64</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>True</ExcludeApp_Data>
<publishUrl>Path</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles
<ExcludeFilesFromDeployment>packages.config</ExcludeFilesFromDeployment>
</PropertyGroup>
</Project>
<!-- Release.pubxml (Publish Profile) -->
<!-- Contents are identical to Develop.pubxml.
This is used to target the Web.Release.Config transform. -->
Whenever I publish the application via the Release publish profile my <appSettings/> element is successfully removed. However, <appSettings/> element is removed when the Develop publish profile is run as well.
What I want to understand is:
Why is the <appSettings/> element being removed when I run the Develop publish profile instead of setting the ReportInputPath value?
And what are the relationships between the between solution/project configurations, publish profiles, and web.config transforms?
The answer to why the <appSettings/> element is being removed when the Develop publish profile is run is because two transformations are run in the following order.
Web.Release.config. This is run because the configuration target in the Develop.pubxml file is the Release build configuration.
Web.Develop.config. This is run because the name of the publish profile (Develop) matches the name of the transform file.
What is happening is the the first transformation removes the <appSettings/> element. The second transformation attempts to set the key value in that element, but cannot find it, so it silently fails.
I was able to confirm this by searching through the console output. When the Develop transformation was run there was a warning that the desired element could not be found.
Example (shortened for clarity)
> TransformXml: Applying Transform File: C:\...\MyProject\Web.Develop.config
> C:\...\MyProject\Web.Develop.config(6,4): Warning : No element in the source document matches '/configuration/appSettings'
> TransformXml: Not executing SetAttributes (transform line 9, 10)
The Profile specific web.config transforms and transform preview article by Sayed Ibrahim Hashimi was very helpful in identifying this was the issue.
As far as the relationship between the build configuration, publish profiles, and web.config transform go my current understanding is this.
Publish profiles have (among other things) a configuration target
Publish profiles first run the transformation that maps to the their specified configuration target name if one exists
Publish profiles then run the transformation that maps to their publish profile name if one exists
The key here being that two web.config transformations may be run.

Maven resources plugin conflict

I have a complex pom hierarchy structure. Some of them have a resource plugin configuration that copies resources to the target artifact.
The issue I'm facing is that when I add a new resource configuration to a low level pom, the existing resource plugin configuration on its parent poms stop working.
I'm really not sure if what I'm trying to achieve is possible or not because I couldn't find any documentation about it. If it's possible, I don't know if there is any restriction to it..
I hope Some of you guys can give me a hint on this..
Thanks in advance.
Check this from the pom reference
You can control how child POMs inherit configuration from parent POMs
by adding attributes to the children of the configuration element. The
attributes are combine.children and combine.self. Use these attributes
in a child POM to control how Maven combines plugin configuration from
the parent with the explicit configuration in the child.
Here is the child configuration with illustrations of the two
attributes:
<configuration>
<items combine.children="append">
<!-- combine.children="merge" is the default -->
<item>child-1</item>
</items>
<properties combine.self="override">
<!-- combine.self="merge" is the default -->
<childKey>child</childKey>
</properties>
</configuration>
or if you want a more detailed explanation read this post
Basically, you need to merge the parent and the child configuration of the maven-resource-plugin
The Maven documentation isn't very clear on which POM elements merge and which do not, so a while ago I created some test POMs and played with them a bit. In my tests with Maven 3.0.x, any resource (or testResource) elements in child POMs fully overwrite anything provided by the parent, the elements are not merged. I found that I had to duplicate all of the parent resource config if I needed to add a resource config element in the child.
#Hilikus' answer is the correct way to do it for plugin configuration, so if it's the maven-resource-plugin configuration that needs to change, follow those directions.

Where to place the I18N message properties for a custom (cm:storeSelector) aspect in Alfresco Share?

I enabled the cm:storeSelector aspect in Alfresco Share 4.1.x, as described in the "Alfresco Administrator Guide" (pg. 281).
I tried adding these messages
aspect.cm_storeSelector=Store Selector
cm_storeSelector=Store Selector
both under
/shared/classes/alfresco/messages/slingshot.properties
and
/shared/classes/alfresco/extension/webclient.properties
This is my share-config-custom.xml:
<alfresco-config>
<!-- cm:content type (existing nodes) -->
<config evaluator="node-type" condition="cm:content">
<forms>
<!-- Default form configuration for the cm:content type -->
<form>
<field-visibility>
<show id="cm:storeName" />
</field-visibility>
</form>
</forms>
</config>
<!-- Document Library config section -->
<config evaluator="string-compare" condition="DocumentLibrary">
<!--
Used by the "Manage Aspects" action
For custom aspects, remember to also add the relevant i18n string(s)
cm_myaspect=My Aspect
-->
<aspects>
<!-- Aspects that a user can see -->
<visible>
<aspect name="cm:storeSelector">
<title>Store Selector</title>
</aspect>
</visible>
</aspects>
</config>
</alfresco-config>
Problem is: the aspect name does not show in the Alfresco Share UI ("Manage Aspects" Dialog) - instead it only shows the string aspect.cm_storeSelector on the right hand side:
while it shows fine on Alfresco Explorer:
I am wondering where to place the I18N strings correctly for Alfresco Share.
Just putting the messages into (a custom) alfresco repository message bundle should be enough to make the translations appear "everywhere" - in share as well.
The key is to follow the name mapping convention.
Have a look at alfresco/WEB-INF/classes/alfresco/messages/content-model.properties
where it reads:
cm_contentmodel.aspect.cm_titled.title=Titled
cm_contentmodel.aspect.cm_titled.description=Titled
which corresponds to alfresco/WEB-INF/classes/alfresco/model/contentModel.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!-- xsi:schemaLocation="http://www.alfresco.org/model/dictionary/1.0 modelSchema.xsd" -->
<model name="cm:contentmodel"
...
<aspect name="cm:titled">
A similar mapping convention applies to properties, types and associations as well. Examples of those can be found across those three files as well.

Spring & static content ( css, js)

I want to create simple app, that would use css and js. But I can't reach that static content... I've found some solutions, but I wasn't able to modify them for my solution :(
Would be anybody please so kind and could show some explicit solution (where to add/modify something and what exactly to add/modify) ?
my app structure in navigator:
http://i.nahraj.to/f/gNc.jpg
Content of web.xml and servlet-context.xml http://pastebin.com/fVcNZPst
I'm running my app on tomcat server.
The home.jsp page is correct, because when I rewrite it to home.html and open it via web browser, it shows correctly. I would really appreciate any help.
There are a few issues in your structure:
a. You have put <resources mapping="/resources/**" location="/resources/" /> for mapping your resources, this would map anything with uri starting with /resources/ to locations under your webapp, in your structure that would be src/main/webapp/resources, you however don't have that folder.
b. If you want your files from webapp/css, webapp/img, webapp/js to be available either you can move them into src/main/webapp/resources folder and access them with say /resources/js/test.js uri or just put this entry into your servlet-context.xml file also - <mvc:default-servlet-handler /> - if you are interested I have provided more details here

Resources