05-04-2010 11:57 AM
05-04-2010 12:48 PM
The problem lies in the tricky background bit, i.e.:
- determining what is the next available sequence number
- forcing the document to take the name XXXX-TYP-XXXX.ext so that upon downloading, someone gets XXXX-TYP-XXXX.pdf and not "The report I did last week on some project I can't remember the number of".pdfDepends on how you decide on what document takes which project code. If it is user-related, you could tie that to the user (or groups, maybe), so if "joe" generates the new doc, the doc will be TEST-TYP-0001.pdf.
if (doc.parent == "Sales") doc.name = "SALE" + getSalesNextID() + '.pdf'
or something like that. The next tricky issue is about the actual project code (by the way, I am sure somebody out there will say none of this is tricky, it just is for me as my background is more php that java). I have seen that when creating a custom content model, it is possible to add a property constrained by a list of values defined in the model file, However, although this is very useful for many things, it is unfortunately not very dynamic. It seems rather odd to have to update the model file everytime a new project is created. How possible is it to have an interface within Alfresco to create the projects and thus associate the basic information to the projects and pull out the required project number info to populate the combobox in the custom content model?Like I said, it seems to me that you have to set some custom abstract set of properties that you can edit without restarting or anything. Then when you're trying to populate the combobox, get the values from this custom properties.
05-04-2010 01:30 PM
Like I said, it seems to me that you have to set some custom abstract set of properties that you can edit without restarting or anything. Then when you're trying to populate the combobox, get the values from this custom properties.
05-04-2010 02:23 PM
function nameDocument(doc)
{
var docID = companyhome.childByNamePath("Settings").properties["myco:nextID"];
companyhome.childByNamePath("Settings").properties["myco:nextID"] += 1;
var projectcode = functionThatDeterminesTheProjectType();
var department = functionThatGetsDepartmentConstraintsBasedOnProjectCode(projectcode);
…
…
doc.name = projectcode + department + docID + datetimestamp + … + '.pdf';
}
05-04-2010 04:59 PM
05-05-2010 10:53 AM
05-06-2010 07:50 AM
05-10-2010 01:35 PM
<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new Model –>
<model name="myCo:model" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!– Optional meta-data about the model –>
<description>My Company Model</description>
<author></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" />
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys" />
</imports>
<!– Introduction of new namespaces defined by this model –>
<namespaces>
<namespace uri="myCo.model" prefix="myCo" />
</namespaces>
<aspects>
<!– Definition of Settings Aspect: settings –>
<aspect name="myCo:settings">
<title>Settings</title>
<properties>
<property name="myCo:nextId">
<title>Next Id</title>
<type>d:text</type>
<protected>false</protected>
<mandatory>true</mandatory>
<multiple>false</multiple>
</property>
</properties>
</aspect>
</aspects>
</model>
<alfresco-config>
<!– List the custom aspects and content types shown in the business rules Action wizard –>
<config evaluator="string-compare" condition="Action Wizards">
<aspects>
<aspect name="myCo:settings"/>
</aspects>
<config evaluator="aspect-name" condition="my:settings">
<property-sheet>
<separator name="sepCli1" display-label="Settings" component-generator="HeaderSeparatorGenerator"/>
<show-property name="myCo:nextId"/>
</property-sheet>
</config>
</alfresco-config>
var settings = companyhome.childByNamePath("Settings");
var docId = parseInt( settings.properties["myCo:nextId"] );
settings.properties["myCo:nextId"] = docId + 1;
settings.save();
document.properties.name = document.name + "-" + docId;
document.save();
09-06-2014 11:44 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.