cancel
Showing results for 
Search instead for 
Did you mean: 

CheckIn Document's can't preview or view in Share

blacksylo
Champ in-the-making
Champ in-the-making
Hi, I'm using Alfresco Community Edition 5.0, and OpenCmis 0.12.0

I've been uploading documents and viewing them in Share without problems using OpenCmis, but when the content of the document changes in anyway(making updates) there is no preview or view in Share anymore.

Been trying with:


String fileName = filepart.getFilename();
File file = filepart.getFile();
String mimeType = new MimetypesFileTypeMap().getContentType(file);

ObjectId idOfCheckedOutDocument = doc.checkOut();
Document pwc = (Document) session.getObject(idOfCheckedOutDocument);

FileInputStream fis = new FileInputStream(file);
DataInputStream dis = new DataInputStream(fis);
ContentStream cs = session.getObjectFactory().createContentStream(fileName, Long.valueOf(file.length()), mimeType,dis);
ObjectId objectId = pwc.checkIn(false, null, cs, "");

And tried doc.setContentStream() directly, which works but gives the exact same result. The doc gets in someway damaged or something happens that makes Share unable to preview or view the document.

If only the properties are updated using "doc.updateProperties()" then the document is still visible and everythings ok, but the need is to store another version of the document.

Also tried with the same code to create the contentSteam while making the uploads but still no luck.

ContentStream cs = new ContentStreamImpl(
            fileName,
            BigInteger.valueOf(file.length()),
            mimeType,
            dis);

This is really strange, is there something I am not seeing here?

The files are being stored correctly after the checkIn() in Share for Downloads, I mean, even when theres no preview, you can Download it and see the content correclty, its just in the Share viewer after theres a checkIn() or setContentStream();

Thanks for the help!
4 REPLIES 4

bdaniel
Champ in-the-making
Champ in-the-making
I wonder if this is similar to the issue I am facing.  I upload documents via CMIS (PHP client) but the mime type is not set in Alfresco Share.  This results in no preview being available and if I download the image it does not open.  Could you check Share for the mime type of the documents you are uploading?

blacksylo
Champ in-the-making
Champ in-the-making
Hi bdaniel,

Sorry for late response, the problem persist but its no longer important.

I checked the Mime type and its correctly saved.

So no problem when someone downloads the file and opens it.

ememic
Champ in-the-making
Champ in-the-making
I'm facing the same issue at the moment. Files uploaded via CMIS works ok, but preview in share and transformation doesn't work. I'm using the Drupal CMIS API module https://www.drupal.org/project/cmis

Worked alright in alfresco 4 but not in version 5.

blacksylo
Champ in-the-making
Champ in-the-making
It's been a long time, and yet no solution :C.

Im avoiding letting the final users use share, now they download the files from a service or see them in a PDF viewer in JS.

The other day, watching the difference in properties I noticed that when the file is checkedIn, it loses some "aspects" like renderable, I suppose maybe the error is there or something like that, but haven't tested it.