07-28-2017 01:14 PM
Hi, i'm try to modify a addon of alfresco for my purpose , so i have created my amps of alfresco and share , seem to work but there is a problem it's make me go nuts, i have a aspect called "key", i make that visible to the user with the "share-config-custom.xml" file, but when i try to add , alfresco return the message "Impossible to update the aspect" without launch any error on the log.
Here the code related to the aspect:
---------------------------------------------------------------------------------
---- Model Context on alfresco "digitalSigningModel.xml"
-----------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!-- Definition of new Model -->
<model name="dgtsgn:digitalSigningmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<description>Digital Signing Content Model</description>
<author>Emmanuel ROUX</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" />
</imports>
<namespaces>
<namespace uri="http://www.alfresco.com/model/digital/signing/1.0" prefix="dgtsgn" />
</namespaces>
<aspects>
<aspect name="dgtsgn:key">
<title>Key</title>
<properties>
<property name="dgtsgn:keyType">
<title>Type</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="dgtsgn:keyAlias">
<title>Alias</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="dgtsgn:keySubject">
<title>Subject</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="dgtsgn:keyFirstValidity">
<title>First day validity</title>
<type>d:date</type>
</property>
<property name="dgtsgn:keyLastValidity">
<title>Last day validity</title>
<type>d:date</type>
</property>
<property name="dgtsgn:keyAlgorithm">
<title>Algorithm</title>
<type>d:text</type>
</property>
<property name="dgtsgn:keyAlert">
<title>Alert</title>
<type>d:text</type>
</property>
<property name="dgtsgn:keyHasAlerted">
<title>Alert</title>
<type>d:boolean</type>
</property>
<property name="dgtsgn:keyCryptSecret">
<title>Secret</title>
<type>d:encrypted</type>
<protected>true</protected>
<default></default>
</property>
</properties>
</aspect>
</aspects>
</model>
---------------------------------------------------------------------------------
---- Model Context on share "share-config.custom"
-----------------------------------------------------------------------------------
<alfresco-config>
.................................................
<!-- Document Library config section -->
<config evaluator="string-compare" condition="DocumentLibrary" replace="true">
<!--
<indicators>
<indicator id="signed-doc" index="10" label="indicator.signed">
<evaluator>evaluator.doclib.indicator.digitalSigning.signedDoc</evaluator>
</indicator>
</indicators>
-->
<!--
<multi-select>
<action type="action-link" id="onActionSign" label="menu.selected-items.sign" />
<action type="action-link" id="onActionSignSimple" label="menu.selected-items.signsimple" />
</multi-select>
-->
<aspects>
<visible>
<aspect name="dgtsgn:signed"/>
<aspect name="dgtsgn:key" />
<aspect name="dgtsgn:image" />
<aspect name="dgtsgnriginalDoc" />
</visible>
<addable> <!-- defaults to visible config -->
</addable>
<removeable> <!-- defaults to visible config -->
</removeable>
</aspects>
</config>
......................................................................................................................
<config evaluator="aspect" condition="dgtsgn:key">
<forms>
<form>
<field-visibility>
<show id="dgtsgn:keyType" for-mode="view"/>
<show id="dgtsgn:keyAlias" for-mode="view"/>
<show id="dgtsgn:keySubject" for-mode="view"/>
<show id="dgtsgn:keyFirstValidity" for-mode="view"/>
<show id="dgtsgn:keyLastValidity" for-mode="view"/>
<show id="dgtsgn:keyAlgorithm" for-mode="view"/>
</field-visibility>
<appearance>
<field id="dgtsgn:keyType" label-id="prop.dgtsgn_keyType" />
<field id="dgtsgn:keyAlias" label-id="prop.dgtsgn_keyAlias" />
<field id="dgtsgn:keySubject" label-id="prop.dgtsgn_keySubject" />
<field id="dgtsgn:keyFirstValidity" label-id="prop.dgtsgn_keyFirstValidity" />
<field id="dgtsgn:keyLastValidity" label-id="prop.dgtsgn_keyLastValidity" />
<field id="dgtsgn:keyAlgorithm" label-id="prop.dgtsgn_keyAlgorithm" />
</appearance>
</form>
</forms>
</config>
....................................................................................................................................
</alfresco-config>
It's seem all right at least on the xml configuration, there is some other file configuration i can consult for this problem?
P.S If you want to try the amp i used for replace on your machine for check the problem the full code is here:
Alfresco AMP Code:DigitalSigning/DigitalSigningAlfresco-SDK at master · p4535992/DigitalSigning · GitHub
Share AMP Code:DigitalSigning/DigitalSigningShare-SDK at master · p4535992/DigitalSigning · GitHub
AMP File for test: DigitalSigning/amp at master · p4535992/DigitalSigning · GitHub
Greetings.
08-01-2017 05:09 AM
When you use the logger.log function you need to configure your Log4J settings in a way that the ScriptLogger output will be included in alfresco.log. Alternatively, you can use logger.warn or logger.error...
07-28-2017 02:47 PM
...didn't have time to Look at it closely but there is at least a mandatory field - is a value set (for default) ?
07-29-2017 07:53 AM
Ty for the response martin, i try to set a default value or set the mandatory to false for the aspect "key" but it' s not that the problem in this case.
07-29-2017 08:34 AM
Mandatory properties can indeed be a problem, but usually only if they are defined as enforced="true". Since they are not in this case, they are "soft mandatory", meaning that they should not prevent application of the aspect if not set, but will result in the node being flagged with the sys:incomplete aspect to indicate at least one mandatory property has not been set.
The default Share actions - like manage aspects - are the most annoying bits of Alfresco in terms of lack of feedback. The backend web script silently swallows any exception that occurs and its error message, and just sets a flag in the response for "unsuccesful". There is no logger statement which you could enable to get details. My advice: Override the aspects.post.json.js and add a logger statement in the catch block to output the message of the exception to the alfresco.log file.
07-31-2017 10:53 AM
Hi Axel try out your solution , i update the code of the catch block (after stop alfresco) with:
catch (e)
{
logger.log("CHECKOUT12:" + e);
logger.log("CHECKOUT13:" + e.stack);
result.success = false;
logger.log("CHECKOUT14:" + e);
logger.log("CHECKOUT15:" + e.stack);
}
but it's doesn't show anything as if it did not load the changes, i just update the jar file with 7zip and make a copy and overwrite of the jar file located on the alfresco webapp (unpack folder).
Anyway the error is definitive here beacuse is the only part where the message success is "false" inistead of "true" here the json response from the post of the aspect:
{
"totalResults": 1,
"overallSuccess": false,
"successCount": 0,
"failureCount": 1,
"results":
[
{
"action": "manageAspects",
"id": "test_nofirma_noprotezione.pdf",
"type": "document",
"nodeRef": "workspace:\/\/SpacesStore\/0b86808c-4d13-4bc7-98bf-ca1b87c64975",
"success": false
}
]
}
what i 'm doing wrong? maybe i need to ovverride directly on the amp with a new javascript file on the path $project/src/main/amp/components/action/aspects.post.json? (not sure if is the right path).
Greetings.
08-01-2017 05:09 AM
When you use the logger.log function you need to configure your Log4J settings in a way that the ScriptLogger output will be included in alfresco.log. Alternatively, you can use logger.warn or logger.error...
08-01-2017 12:18 PM
Ty Axel, i'm very a idiot , now i finally found the error:
"JavaException: org.alfresco.service.namespace.NamespaceException: Namespace prefix dgtsgn is not mapped to a namespace URI"
strange because i set the namespace on my model:
<namespaces>
<namespace uri="http://www.alfresco.com/model/digital/signing/1.0" prefix="dgtsgn" />
</namespaces>
and the other aspects with the same prefix work fine.
Let you know if i solve this issue.
Greetings.
08-02-2017 10:29 AM
For anyone with similar issue , in the end the problem was related to the fact it's seems the method javascript "addAspect" not accept property with type <type>d:encrypted</type> on the aspect you try to add.
Not sure if is a bug of alfresco or if i'm doing wrong something.
Ty to all for help.
08-02-2017 05:38 PM
I'd say that this is not a bug. Properties of type d:encrypted are special and require additional handling to actually create the encrypted value, which is not possible from the JavaScript tier. You can't just set their value to "x" - you have to use the Java API MetadataEncryptor to handle them.
Explore our Alfresco products with the links below. Use labels to filter content by product module.