Thread safety of javascript based web script
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2014 07:17 AM
Created the following web script to assign a unique identifier through aspects for each uploaded document :
docID = parseInt(space.properties["my:uniId"]);
NewDocID = docID + 1;
space.properties["my:uniId"] = NewDocID;
space.save();
document.properties["my:uniId"] = NewDocID;
document.save();
The above web script is assigned to space as a rule to apply for each upload.
Is the above web script is thread safe(If multiple users try to upload documents simultaneously using Alfresco Web Service API or through Alfresco Explorer, the above unique identifier will take care of concurrency?)
docID = parseInt(space.properties["my:uniId"]);
NewDocID = docID + 1;
space.properties["my:uniId"] = NewDocID;
space.save();
document.properties["my:uniId"] = NewDocID;
document.save();
The above web script is assigned to space as a rule to apply for each upload.
Is the above web script is thread safe(If multiple users try to upload documents simultaneously using Alfresco Web Service API or through Alfresco Explorer, the above unique identifier will take care of concurrency?)
Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2014 08:54 AM
There's a chance it might work. However I suggest you test and see what happens. Sequence generation probably needs another approach since its deceptively tricky.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2014 09:27 AM
Thanks for the information.
Could you please suggest what is the best approach for sequence generation.
Could you please suggest what is the best approach for sequence generation.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2014 12:52 PM
Please let me know what is the equivalent REST API for the below authentication scenario as we have some issues with login ticket generated by SOAP API(Exception is - org.apache.ws.security.WSSecurityException: The security token could not be authenticated or authorized):
WebServiceFactory.setEndpointAddress(soapapi);
try {
AuthenticationUtils.startSession(userid, password);
// AuthenticationUtils.startSession("admin", "admin");
} catch (AuthenticationFault authenticationFault) {
authenticationFault.printStackTrace();
}
WebServiceFactory.setEndpointAddress(soapapi);
try {
AuthenticationUtils.startSession(userid, password);
// AuthenticationUtils.startSession("admin", "admin");
} catch (AuthenticationFault authenticationFault) {
authenticationFault.printStackTrace();
}
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2014 11:46 PM
please use
/alfresco/service/api/login
