a rule that define in a folder one default document type
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2014 10:09 AM
I don't if it is the most suitable place for this question…
I am eager to know whether is possible to define that in an specific folder, all documents you would add, were of a specific document type by default.
moreover, the question is not only in relation to Explorer or Share interfaces….I am thinking that if those rules work when you are working with webservices or opcenmis.
thanks so much
I am eager to know whether is possible to define that in an specific folder, all documents you would add, were of a specific document type by default.
moreover, the question is not only in relation to Explorer or Share interfaces….I am thinking that if those rules work when you are working with webservices or opcenmis.
thanks so much
Labels:
- Labels:
-
Archive
7 REPLIES 7
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2014 10:53 AM
Yes, you can create a rule on a folder that changes the type when a document is added to that folder. The rule will fire regardless of what method is used to add the document to the folder.
Jeff
Jeff
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2014 11:15 AM
ok, it sounds great
I will put an specific example in order to approach to the issue
folder
rders type document: my
rder an aspect with some metadata : my:title. the aspect is associated to my
rder in the myModel.xml….
if I add a document throw a webservice, api… whatever I would use…. I could send my:title as well????
I ask about this because I understand from you that the type of the 'document is changed', I suppose that it would works but I would want to be sure
thanks so much
P.D I would be very grateful if you know any paper about the rules and how to define somethig like this…. I will try it tomorrow
I will put an specific example in order to approach to the issue
folder



if I add a document throw a webservice, api… whatever I would use…. I could send my:title as well????
I ask about this because I understand from you that the type of the 'document is changed', I suppose that it would works but I would want to be sure
thanks so much
P.D I would be very grateful if you know any paper about the rules and how to define somethig like this…. I will try it tomorrow

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2014 02:55 PM
You can create documents, specify their type, and set properties, including custom properties, all through the API. You do not need a rule to make that possible.
If you need to make sure that a document added to a folder (regardless of how it is added) always is changed to a certain type, that's a good use for a rule.
If you need to make API calls that create documents in a folder and those documents need to be instances of a specific type with values passed in for specific properties, that is all do-able via the API with no need for a rule.
Configuring a rule on a folder to change a type and creating documents via the API are independent of one another.
Jeff
If you need to make sure that a document added to a folder (regardless of how it is added) always is changed to a certain type, that's a good use for a rule.
If you need to make API calls that create documents in a folder and those documents need to be instances of a specific type with values passed in for specific properties, that is all do-able via the API with no need for a rule.
Configuring a rule on a folder to change a type and creating documents via the API are independent of one another.
Jeff
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2014 02:56 AM
yes, I have made a little program in Java with opencmis that upload documents with my:customtupe to a specific folder, and I define the aspect and the metadata….it works fine.
but I will have to do a migration from Documentum to Alfresco, I have a script that upload the documents in a way that you only say the folder, name (and the metadata)… therefore I asked about the rules in the folder…
thanks so much
yours replies are very useful
but I will have to do a migration from Documentum to Alfresco, I have a script that upload the documents in a way that you only say the folder, name (and the metadata)… therefore I asked about the rules in the folder…
thanks so much
yours replies are very useful
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2014 03:54 AM
I have made a rule in the folder myFolder. this rule changes the document type and adds the aspect to all elements you add in this folder….
I have tested it on the Explore and it works fine… when I add a document with other document type Alfresco changes the document type and show me the metadata of the aspect……
But when I send a document from my Java application that doesn't work…
Folder micarpeta = (Folder) session.getObjectByPath("/myFolder");
…
Map<String, Object> contentProperties = new HashMap<String, Object>();
//commet: contentProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:my:customType,P:my:myAspect");
contentProperties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
contentProperties.put(PropertyIds.NAME, name);
contentProperties.put("my:tittle","eclipse");
ContentStream contentStream = new ContentStreamImpl(miFichero.getAbsolutePath(), null, " image/jpeg",new ByteArrayInputStream(bytes));
Document newContent1 = micarpeta.createDocument(contentProperties, contentStream, null);
java.lang.IllegalArgumentException: Property 'my:tittle' is neither an object type property nor an aspect property!
if I remove the comment and I put the specific type it works fine and aspect it works fine
i know that in your own code it wouldn´t be necessary… but I would like to know to understand how it works….
thanks
I have tested it on the Explore and it works fine… when I add a document with other document type Alfresco changes the document type and show me the metadata of the aspect……
But when I send a document from my Java application that doesn't work…
Folder micarpeta = (Folder) session.getObjectByPath("/myFolder");
…
Map<String, Object> contentProperties = new HashMap<String, Object>();
//commet: contentProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:my:customType,P:my:myAspect");
contentProperties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
contentProperties.put(PropertyIds.NAME, name);
contentProperties.put("my:tittle","eclipse");
ContentStream contentStream = new ContentStreamImpl(miFichero.getAbsolutePath(), null, " image/jpeg",new ByteArrayInputStream(bytes));
Document newContent1 = micarpeta.createDocument(contentProperties, contentStream, null);
java.lang.IllegalArgumentException: Property 'my:tittle' is neither an object type property nor an aspect property!
if I remove the comment and I put the specific type it works fine and aspect it works fine
i know that in your own code it wouldn´t be necessary… but I would like to know to understand how it works….
thanks
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2014 03:08 PM
The property "my:tittle" is a custom property, defined either on a custom type or a custom aspect. Therefore you cannot set the property without using the line you have commented out.
Jeff
Jeff

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2014 10:53 AM
Hi,
Yes, this is possible by declaring a rule on the folder and making it execute the action "specialise type".
And yes, whatever interface you declare the rule with, the rule is tied to the content and not the interface. So once your rule is there is will be triggered whatever way the document were added.
Yes, this is possible by declaring a rule on the folder and making it execute the action "specialise type".
And yes, whatever interface you declare the rule with, the rule is tied to the content and not the interface. So once your rule is there is will be triggered whatever way the document were added.
