Document Type
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2014 07:14 AM
Due to problems with versions I had to downgrade my Alfresco version to 3.1.2
I was using a newer version of the product to update custom type documents with this code
PostMethod mPost = new PostMethod(urlString);
Part[] parts = {
new FilePart("filedata", filename, fileobj, filetype, null),
new StringPart("filename", filename ),
new StringPart("contenttype", "{bol.model}boletin" ),
//modify this according to where you wanna put your content
new StringPart("siteid", siteid),
new StringPart("containerid", containeridbol)
new StringPart("uploaddirectory", uploaddirectory)
};
mPost.setRequestEntity(new MultipartRequestEntity(parts, mPost.getParams()));
int statusCode1 = client.executeMethod(mPost);
I have defined the model, and I can upload documents of the model manually, but when I execute the post method, ALfresco creates a document of defautl type like this:
Name: 40.pdf
Ref: workspace://SpacesStore/4ceab9c1-d0b6-45a3-8781-45bbe3a000a7
Type: {http://www.alfresco.org/model/content/1.0}content
DBID: 1.015.861
And should create a document like this instead
Name: aaaa.pdf
Ref: workspace://SpacesStore/6d33b3a6-8f4d-40fd-b0cf-1d800a4452e5
Type: {bol.model}boletin
DBID: 1.015.855
How can I do that with Alfresco 3.1.2? I can't find the property needed to upload a document of my type bol:boletin. I have added to the code some lines, but the only thing I can change is the contenttype
new StringPart("Type", "{bol.model}boletin" ),
new StringPart("type", "{bol.model}boletin" ),
new StringPart("contenttype", "{bol.model}boletin" )
CHANGE: {http://www.alfresco.org/model/content/1.0}contentType = {bol.model}boletin
Thanks in advance,
Alberto
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2014 09:04 AM
Part[] parts = {new FilePart("filedata", filename, fileobj, filetype, null),new StringPart("filename", filename ),new StringPart("contenttype", "{bol.model}boletin" ),//modify this according to where you wanna put your contentnew StringPart("siteid", siteid),new StringPart("containerid", containeridbol)new StringPart("uploaddirectory", uploaddirectory),new StringPart("contentType", yourcontenttype)};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2014 05:13 AM
Tried both ways (separatedly and with both instructions at the same time) before and after the siteid, containerid… but no way
new StringPart("contenttype", "{bol.model}boletin" ),
new StringPart("contentType", "{bol.model}boletin")
Any other idea?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2014 05:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2014 05:36 AM
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2014 10:01 AM
I don't have 3.1 enviroment,I don't have what is going on.
you can check "upload.post.js" file which locate in "${TOMCAT_ROOT}/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/repository/upload" ,this file is upload webscript 's controller javascript,it will tell you correct parameter format.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2014 11:04 AM
I wonder if your problem elsewhere? In particular downgrade is likely to cause problems.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2014 03:21 AM
I have 4 custom models, and it happens when I upload a document of any data. It happens in all of them.
The fact is that it does not work properly, and sets the contenttype into the properties but not in the Type (check the images I attach)
The downgrade is because of the client side. I have adapted a working 4.2 code to a new 3.1 environment (it is a fully new environment).
Could it be something that I have to change in Alfresco, some property, some configuration? Perhaps the value set is not correctly written for Alfresco 3.1 (instead of new StringPart("contenttype", "{visor.model}visor" ) or new StringPart("contenttype", "{bol.model}boletin" ) I have to write the type a different way)
If I write new StringPart("contenttype", "whatever I write here" )
The document is created and in the properties I get: {http://www.alfresco.org/model/content/1.0}contentType = whatever I write here
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2014 03:43 AM
3.1 version
var newFile = destNode.createFile(filename);
newFile.properties.contentType = contentType;
newFile.properties.content.write(content);
4.2 version
if (contentType !== null)
{
newFile = destNode.createFile(filename, contentType);
}
else
{
newFile = destNode.createFile(filename);
}
Can I change this directly there, is there any problem? is this method supported in 3.1? If I change it there, is something else needed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2014 05:02 AM
Can't find method org.alfresco.repo.jscript.ScriptNode.createFile(java.lang.String,java.lang.String)
Any ideas?
