Upload duplicate files using CMIS API - alfresco

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.

Related

integration between bmc remedy and serviceNow using wso2

we would like to integrate incident module between BMC Remedy and ServiceNow ITSM applications using ESB-WSO2, need assistance on this to achieve this integration.
Use case: Service now has to create incident then WSO2 will consume the request and process then processed request will be send to Remedy. This is nothing but a e-bonding or you can call it as ticket replication.
Any help would be much appreciated
Here is a sample API for you. Supposing that you have already installed ServiceNow connector.
You can call it from Postman using GET or browser, http://{yourWso2EiServer}:8280/serviceNow/test
After testing you can change method to POST and try to send different messages using POSTMAN. Then you will have to evaluate properties from a message, using like"expression"="json-eval($.tablename)" instead of "value"= in you Property mediators and your message must be an application/json and contain this field, like
{"tablename":"incident"....
<api xmlns="http://ws.apache.org/ns/synapse" name="ServiceNowApi" context="/serviceNow" version-type="context">
<resource methods="GET" uri-template="/test" outSequence="" faultSequence="">
<inSequence>
<property name="tablename" value="incident" description="here you can set your request variables with constants for test or read it from request using json-evalng "/>
<property name="sysparmDisplayValue" value="true"/>
<property name="sysparmFields" value="short_description,number,sys_id"/>
<property name="sysparmView" value="short_description,number,sys_id"/>
<property name="number" value="12345678"/>
<property name="shortDescription" value="Testing integration using ServiceNow connector"/>
<property name="active" value="true"/>
<property name="approval" value="owner"/>
<property name="category" value="inquery"/>
<property name="contactType" value="phone"/>
<servicenow.init>
<serviceNowInstanceURL>dev85868.service-now.com</serviceNowInstanceURL>
<username>rest_test</username>
<password>12345678</password>
</servicenow.init>
<servicenow.postRecord>
<tableName>{$ctx:tableName}</tableName>
<sysparmDisplayValue>{$ctx:sysparmDisplayValue}</sysparmDisplayValue>
<sysparmFields>{$ctx:sysparmFields}</sysparmFields>
<sysparmView>{$ctx:sysparmView}</sysparmView>
<sysparmExcludeReferenceLink>{$ctx:sysparmExcludeReferenceLink}</sysparmExcludeReferenceLink>
<sysparmInputDisplayValue>{$ctx:sysparmInputDisplayValue}</sysparmInputDisplayValue>
<number>{$ctx:number}</number>
<shortDescription>{$ctx:shortDescription}</shortDescription>
<active>{$ctx:active}</active>
<approval>{$ctx:approval}</approval>
<category>{$ctx:category}</category>
<contactType>{$ctx:contactType}</contactType>
<apiColumns>{$ctx:apiColumns}</apiColumns>
</servicenow.postRecord>
</respond>
</inSequence>
</inSequence>
</resource>
</api>

How to stop node from logging node.conf during startup

How do I stop the node from printing the node.conf in the logs?
I understand we can change the logging level since the node.conf is printed at INFO level, but I want to avoid that as much as possible since I still want some other information that is at INFO level to be printed out.
The contents of node.conf are printed at INFO level by the net.corda.node.services.config.ConfigHelper class. To prevent the contents of node.conf from being printed to the logs, you'd have to specify a custom logging configuration so that for the net.corda.node.services.config.ConfigHelper class, only messages at WARN or above should be printed to the logs.
The process for providing a custom Log4J2 logging configuration file for your node is documented here. You need to:
Create the custom logging file (e.g. test.xml)
Point your node to the custom logging file when starting the node (e.g. java -Dlog4j.configurationFile=test.xml -jar corda.jar)
Here's an example test.xml that prevents the contents of node.conf being printed to the logs:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
<Properties>
<Property name="log-path">logs</Property>
<Property name="log-name">node-${hostName}</Property>
<Property name="archive">${log-path}/archive</Property>
</Properties>
<Appenders>
<Console name="Console-Appender" target="SYSTEM_OUT">
<PatternLayout pattern="%highlight{%level{length=1} %d{HH:mm:ss} %T %c{1}.%M - %msg%n}{INFO=white,WARN=red,FATAL=bright red blink}"/>
</Console>
<RollingFile name="RollingFile-Appender"
fileName="${log-path}/${log-name}.log"
filePattern="${archive}/${log-name}.%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout pattern="[%-5level] %d{ISO8601}{GMT+0} [%t] %c{1} - %msg%n"/>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="10MB"/>
</Policies>
<DefaultRolloverStrategy min="1" max="10">
<Delete basePath="${archive}" maxDepth="1">
<IfFileName glob="${log-name}*.log.gz"/>
<IfLastModified age="60d">
<IfAny>
<IfAccumulatedFileSize exceeds="10 GB"/>
</IfAny>
</IfLastModified>
</Delete>
</DefaultRolloverStrategy>
</RollingFile>
</Appenders>
<Loggers>
<Root level="error">
<AppenderRef ref="Console-Appender"/>
<AppenderRef ref="RollingFile-Appender"/>
</Root>
<Logger name="net.corda" level="error" additivity="false">
<AppenderRef ref="Console-Appender"/>
<AppenderRef ref="RollingFile-Appender"/>
</Logger>
<Logger name="net.corda.node.services.config.ConfigHelper" level="warn" additivity="false">
<AppenderRef ref="RollingFile-Appender"/>
</Logger>
</Loggers>
</Configuration>
Note the final Logger block. We specify that any messages from net.corda.node.services.config.ConfigHelper (e.g. the contents of node.conf) should only be printed if they are at level WARN or above.
#Joel is there any way to point all the nodes to one custom logging file? I.e, when executing runnodes.jar, could you pass a single logfile as a paramater, i.e:
java -jar -Dlog4j.configurationFile=/Users/username/Desktop/Prototype/config/dev/log4j2.xml runnodes.jar
This doesn't seem to work... so curious.

Cannot find Persistence provider from persistence.xml [duplicate]

This question already has answers here:
No Persistence provider for EntityManager named
(32 answers)
Closed 4 years ago.
When I run my project, it threw exeption like this:
Request processing failed; nested exception is javax.persistence.PersistenceException: No Persistence provider for EntityManager named "LessonJPAPU"
My persistence.xml is like this:
<persistence-unit name="LessonJPAPU" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>com.javatpoint.beans.Emp</class>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/users"/>
<property name="javax.persistence.jdbc.user" value="postgres"/>
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"/>
<property name="javax.persistence.jdbc.password" value=""/>
</properties>
</persistence-unit>
What's wrong?
Make sure that your persistence.xml is in src/main/resources/META-INF folder and that folder is not excluded form classpath.

What's cm:subscribable made for?

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.

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.

Resources