to hide custom workflow from another site alfresco share - alfresco

I need to hide custom workflow list for folders/documents present in " MyFiles " and other sites areas.Doing that from "show-site-workflow-modules.xml " with this configuration(code below), hides workflows from "workflows that I have started" also,which is terribly wrong.
<module>
<id>General_Workflow</id>
<description>Applies config based on site id</description>
<evaluator type="site.module.evaluator">
<params>
<sites>.*</sites>
<sitePresets>.*</sitePresets>
<applyForNonSites>true</applyForNonSites>
</params>
</evaluator>
<configurations>
<config evaluator="string-compare" condition="Workflow" replace="true">
<!-- A list of workflow definitions that are NOT displayed in Share -->
<hidden-workflows>
<!-- Hide all Custom workflows -->
<workflow name="customactiviti$xxxx" />
</hidden-workflows>
<!-- A list of workflow tasks that are NOT displayed in Share -->
<hidden-tasks>
<task type="customwf:*" />
</hidden-tasks>
</config>
</configurations>
</module>
<module>
<id>xxx_Conditional_Workflow</id>
<description>Applies config based on site id</description>
<evaluator type="site.module.evaluator">
<params>
<sites>xxx-xxx-xxx</sites>
<applyForNonSites>false</applyForNonSites>
</params>
</evaluator>
<configurations>
<config evaluator="string-compare" condition="Workflow" replace="true">
<!-- A list of workflow definitions that are NOT displayed in Share -->
<hidden-workflows>
<!-- Hide all WCM related workflows -->
<workflow name="activiti$activitiAdhoc" />
<workflow name="activiti$activitiInvitationModerated" />
<workflow name="activiti$activitiInvitationNominated" />
<workflow name="activiti$activitiInvitationNominatedAddDirect" />
<workflow name="activiti$activitiParallelGroupReview" />
<workflow name="activiti$activitiParallelReview" />
<workflow name="activiti$activitiReview" />
<workflow name="activiti$activitiReviewPooled" />
<workflow name="activiti$publishWebContent" />
</hidden-workflows>
<!-- A list of workflow tasks that are NOT displayed in Share -->
<hidden-tasks>
<!-- Hide all WCM related tasks -->
<task type="wcmwf:*" />
</hidden-tasks>
</config>
</configurations>
</module>

Related

Unable to create third index in elastic search for logging using NLog in Asp.net core

Hello Everyone,
I am new to the elk stack and trying to do logging using elastic search. I want to create different index for different different services in api. I am able to create two indexes of different services but can not do the same for third index.
Following is my nconfig file
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="false"
internalLogLevel="Trace" internalLogFile="c:\temp1\nlog-internal.log">
<!-- optional, add some variables
https://github.com/nlog/NLog/wiki/Configuration-file#variables
-->
<variable name="myvar" value="myvalue"/>
<extensions>
<add assembly="NLog.Targets.ElasticSearch"/>
<add assembly="NLog.Web.AspNetCore"/>
</extensions>
<!--
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<targets>
<!--
add your targets here
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
-->
<target xsi:type="File" name="f" fileName="${basedir}/logs/log.txt"
archiveFileName="${basedir}/logs/archives/log.txt"
archiveAboveSize="5242880"
archiveEvery="Day"
archiveNumbering = "Rolling"
maxArchiveFiles="3"
layout="${longdate} ${uppercase:${level}} ${message}" />
<target xsi:type="BufferingWrapper" name="ElasticSearch"
flushTimeout="5000">
<target xsi:type="ElasticSearch" name="elastic" index="aquaparallelapi"
uri="http://localhost:9200"
layout ="API:aquaparallelapi|${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
</target>
<target xsi:type="BufferingWrapper" name="ElasticSearch"
flushTimeout="5000">
<target xsi:type="ElasticSearch" name="elastic1" index="aquaparallelapiprogress"
uri="http://localhost:9200"
layout ="API:aquaparallelapi|${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
</target>
<target xsi:type="BufferingWrapper" name="ElasticSearch"
flushTimeout="5000">
<target xsi:type="ElasticSearch" name="elastic2" index="aquaparallelapitestcase"
uri="http://localhost:9200"
layout ="API:aquaparallelapi|${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
</target>
<!--
Write events to a file with the date in the filename.
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" />
-->
</targets>
<rules>
<!-- add your logging rules here -->
<logger enabled="true" name="*" minlevel="Debug" writeTo="f" />
<logger enabled="true" name="*" minlevel="Debug" writeTo="elastic" />
<logger enabled="true" name="AquaParallelAPI.Controllers.ProgressController" minlevel="Debug" writeTo="elastic1" />
<logger enabled="true" name="AquaParallelAPI.Controllers.TestCaseController" minlevel="Debug" writeTo="elastic2" />
</rules>
</nlog>
As you can see above indexes aquaparallelapi and aquaparallelapiprogress is created and gives the desired result but index aquaparallelapitestcase is not created. When I tried to do
http://localhost:9200/aquaparallelapitestcase
then
{"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index [aquaparallelapitestcase]","resource.type":"index_or_alias","resource.id":"aquaparallelapitestcase","index_uuid":"_na_","index":"aquaparallelapitestcase"}],"type":"index_not_found_exception","reason":"no such index [aquaparallelapitestcase]","resource.type":"index_or_alias","resource.id":"aquaparallelapitestcase","index_uuid":"_na_","index":"aquaparallelapitestcase"},"status":404}
Please let me know where I am wrong?

Unable to change type of document in alfresco share

I have two questions about two Custom Content Types I created called my:whitepaper and my:bc:
When I try to Change Type on a document and I select my:whitepaper custom type it works but not with my:bc.
When I select my:bc It gives me an error message saying: Unable to change type of document 'test.pdf'.
In "Manage Rules" -> "Specialse Type" , I can't see my bc type:
The type of 'test.pdf' document is cm:content:
Here's my :
custom-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.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
<property name="models">
<list>
<value>alfresco/extension/customModel.xml</value>
</list>
</property>
<property name="labels">
<list>
<value>alfresco/extension/custom-model-messages</value>
</list>
</property>
</bean>
</beans>
custom-model-messages.properties:
type.my_whitepaper= piece Comptable
type.my_whitepaper.title= piece Comptable
type.my_whitepaper.property.my_product= Ecriture Comptable
type.my_bc=bc
type.my_bc.title=bc
customModel.xml:
<?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:contentModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- Optional meta-data about the model -->
<description>Example Custom Model</description>
<author>Alfresco Documentation Team</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="http://www.mycompany.com/model/content/1.0" prefix="my" />
</namespaces>
<types>
<!-- Enterprise-wide generic document type -->
<type name="my:doc">
<title>MyCompany Generic Document</title>
<parent>cm:content</parent>
</type>
<type name="my:marketingDoc">
<title>MyCompany Marketing Document</title>
<parent>my:doc</parent>
<properties>
<property name="my:product">
<title>écriture comptable</title>
<type>d:text</type>
</property>
<property name="cm:author">
<title>auteur</title>
<type>d:text</type>
</property>
</properties>
</type>
<type name="my:bc">
<title>Bon de commande</title>
<parent>my:marketingDoc</parent>
</type>
<type name="my:whitepaper">
<title>une piece Comptable</title>
<parent>my:marketingDoc</parent>
</type>
</types>
</model>
share-config-custom.xml:
<types>
<type name="cm:content">
<subtype name="smf:smartFolderTemplate" />
<subtype name="my:whitepaper" />
<subtype name="my:bc" />
</type>
<type name="cm:folder">
</type>
<type name="trx:transferTarget">
<subtype name="trx:fileTransferTarget" />
</type>
</types>
<!-- custom content comptable -->
<config evaluator="model-type" condition="my:whitepaper">
<forms>
<form>
<field-visibility>
<show id="cm:name" />
<show id="my:product" />
<show id="cm:author" />
<show id="cm:title" force="true" />
<show id="cm:description" force="true" />
<!-- <show id="my:relatedDocuments" />-->
</field-visibility>
</form>
</forms>
</config>
<config evaluator="node-type" condition="my:whitepaper">
<forms>
<form>
<field-visibility>
<show id="cm:name" />
<show id="my:product" />
<show id="cm:author" />
<show id="cm:title" force="true" />
<show id="cm:description" force="true" />
<!-- <show id="my:relatedDocuments" /> -->
</field-visibility>
</form>
</forms>
</config>
<!-- custom Bon commande -->
<config evaluator="model-type" condition="my:bc">
<forms>
<form>
<field-visibility>
<show id="cm:name" />
<show id="my:product" />
<show id="cm:author" />
<show id="cm:title" force="true" />
<show id="cm:description" force="true" />
<!-- <show id="my:relatedDocuments" />-->
</field-visibility>
</form>
</forms>
</config>
<config evaluator="node-type" condition="my:bc">
<forms>
<form>
<field-visibility>
<show id="cm:name" />
<show id="my:product" />
<show id="cm:author" />
<show id="cm:title" force="true" />
<show id="cm:description" force="true" />
<!-- <show id="my:relatedDocuments" /> -->
</field-visibility>
</form>
</forms>
</config>
Logs:
The logs : alfresco.log and catalina.out don't show anything.
Browser's Developer tools show this:
I am unable to reproduce this problem in a project generated with SDK 3.0.1, taking all defaults (Repo 5.2.f/Share 5.2.e) with your content model and Share config. I can change cm:content objects to my:bc objects. When configuring rules I can select your custom types in the Specialize Type action, see screenshot, below:.
So, either you have some other stuff added to your config that hasn't been included in the above snippets or you haven't deployed your customizations correctly.
You might want to bootstrap a new project and drop your files in as I have, then run it with the embedded Tomcat to make sure you can change types and configure rules successfully. Then you can compare what is in that project to what you have in your original project to see where you went wrong.

How to edit template-instance of start workflow page in Alfresco Share?

I want to add a upload button the start-workflow page and for that i need to add upload component xml tags as follows in template instance:
<component>
<region-id>html-upload</region-id>
<url>/components/upload/html-upload</url>
</component>
<component>
<region-id>flash-upload</region-id>
<url>/components/upload/flash-upload</url>
</component>
<component>
<region-id>file-upload</region-id>
<url>/components/upload/file-upload</url>
</component>
<component>
<region-id>dnd-upload</region-id>
<url>/components/upload/dnd-upload</url>
</component>
<component>
<region-id>archive-and-download</region-id>
<url>/components/download/archive</url>
</component>
Why you wanted to add a upload button to the start-workflow page alfresco OOTB provides the workflow package you can attach your documents here.
You just need to define it in share config
<config evaluator="string-compare" condition="activiti$submitDocument">
<forms>
<form>
<field-visibility>
<show id="packageItems" />
</field-visibility>
<appearance>
<set id="general" appearance="title" label-id="workflow.set.other" />
<field id="packageItems" set="general" label="Purchase request document">
<control template="/org/alfresco/components/form/controls/workflow/packageitems.ftl">
</control>
</field>
</appearance>
</form>
</forms>
</config>
and you can get all the attached document using javascript
var documents = bpm_package.children;
It was as simple and obvious as it could have been. All you need to do is create a file named start-workflow.xml in the directory src/main/resources/alfresco/web-extension/site-data/template-instances. Then just copy paste the original file and add your components. This isn't enough in itself. You also have to add regions of these components to the template of start-workflow. Again, a simple process. Create a file start-workflow.ftl in the directory src/main/resources/alfresco/web-extension/site-data/templates/org/alfresco. Once again copy paste the original file and add your regions. In my case it was :
<#region id="html-upload" scope="template"/>
<#region id="flash-upload" scope="template"/>
<#region id="file-upload" scope="template"/>
<#region id="dnd-upload" scope="template"/>
<#region id="archive-and-download" scope="template"/>

Alfresco share advanced search

I have some problem. I am create custom model ed:edocumentswith one aspect ed:zagdep it has one property ed:documentRegnum.
I am customize Advanced Search Form and add RegNum field, but it does not search nothing with this field.
What it can be? Why search does not work?
My model code ed-model.xml (tomcat\shared\classes\alfresco\extension)
<?xml version="1.0" encoding="UTF-8"?>
<model name="ed:edocuments" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- 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 -->
<namespaces>
<namespace uri="http://www.alfresco.com/model/edocuments/1.0" prefix="ed"/>
</namespaces>
<aspects>
<!-- Definition of new Content Aspect: Electronic Document -->
<aspect name="ed:zagdep">
<title>Zag Dep</title>
<properties>
<property name="ed:documentRegnum">
<type>d:text</type>
</property>
</properties>
</aspect>
</aspects>
</model>
My model contex file ed-model-contex.xml (tomcat\shared\classes\alfresco\extension)
<?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.ed.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
<property name="models">
<list>
<value>alfresco/extension/ed-model.xml</value>
</list>
</property>
</bean>
</beans>
My share-config-custom.xml(tomcat\shared\classes\alfresco\web-extension)
<alfresco-config>
<!-- Document Library config section -->
<config evaluator="string-compare" condition="DocumentLibrary">
<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="kb:referencable" />
<aspect name="ed:zagdep" />
</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>
<!-- cm:content type (existing nodes) -->
<config evaluator="node-type" condition="cm:content">
<forms>
<!-- Default form configuration used on the document details and edit metadata pages -->
<form>
<field-visibility>
<show id="ed:documentRegnum" />
</field-visibility>
</form>
<!-- Document Library pop-up Edit Metadata form -->
<form id="doclib-simple-metadata">
<field-visibility>
<show id="ed:documentRegnum" />
</field-visibility>
<edit-form template="../documentlibrary/forms/doclib-simple-metadata.ftl" />
</form>
<!-- Document Library Inline Edit form -->
<form id="doclib-inline-edit">
<field-visibility>
<show id="ed:documentRegnum" />
</field-visibility>
</form>
</forms>
</config>
<!-- Advanced search -->
<config replace="true" evaluator="string-compare" condition="AdvancedSearch">
<advanced-search>
<!-- Forms for the advanced search type list -->
<forms>
<form labelId="search.form.label.cm_content" descriptionId="search.form.desc.cm_content">cm:content</form>
<form labelId="search.form.label.cm_folder" descriptionId="search.form.desc.cm_folder">cm:folder</form>
</forms>
</advanced-search>
</config>
<config evaluator="model-type" condition="cm:content">
<forms>
<!-- Search form -->
<form id="search">
<field-visibility>
<show id="cm:name" />
<show id="cm:title" force="true" />
<show id="cm:description" force="true" />
<!-- ed:edocuments -->
<show id="ed:documentRegnum" />
</field-visibility>
<appearance>
<!-- ed:edocuments -->
<field id="ed:documentRegnum" label-id="prop.ed_documentRegnum">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
</alfresco-config>
You just have to add : force="true" on aspect based property.See below code.
<show id="ed:documentRegnum" force="true" />

Error when saving document of custom type in Alfresco Share

I got this exception when trying to save a new document of custom type:
org.alfresco.service.cmr.repository.MalformedNodeRefException: 06010026 Invalid node ref - does not contain forward slash: {node.nodeRef}
Here is how the definition of the custom type looks like:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Definition of new Model -->
<model name="ht:channelmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- 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 -->
<namespaces>
<namespace uri="http://www.someco.com/model/content/1.0" prefix="ht" />
</namespaces>
<types>
<!-- Here comes my type -->
<type name="ht:doc">
<title>Custom Document</title>
<parent>cm:content</parent>
<mandatory-aspects>
<aspect>cm:generalclassifiable</aspect>
</mandatory-aspects>
</type>
</types>
<aspects>
<aspect name="ht:channel">
<title>Content Channel</title>
<properties>
<property name="ht:isWeb">
<type>d:boolean</type>
</property>
</properties>
</aspect>
</aspects>
</model>
and here is how I set the forms for displaying the creation of a new document of my custom type (inside share-config-custom.xml)
<alfresco-config>
<config evaluator="string-compare" condition="DocumentLibrary">
<create-content>
<content id="plain-text" mimetype="text/plain" label="Prompt" itemid="ht:doc" />
</create-content>
<aspects>
<visible>
<aspect name="ht:channel" />
</visible>
<addable>
</addable>
<removeable>
</removeable>
</aspects>
<types>
<type name="cm:content">
<subtype name="ht:doc" />
</type>
</types>
</config>
<config evaluator="model-type" condition="ht:doc">
<forms>
<form>
<field-visibility>
<show id="cm:title" force="true" />
<show id="ht:isWeb" force="true" />
</field-visibility>
<appearance>
<field id="cm:title">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
</alfresco-config>
Is it something wrong with the formatting or am I missing some fields in the type definition?
Thanks
Found the solution on the dedicated Alfresco forum.
Here it is:
<content id="myContent" label="Prompt" type="pagelink" index="1" >
<param name="page">create-content?destination={nodeRef}&itemId=ht:doc&mimeType=text/html</param>
</content>

Resources