on 03-26-2009 2:12 PM
Hi Experts i am using KM API's in WebDynpro JAVA to upload file into the Content Management of
Portal EP7.0. Below is the Code Excerpt, which works fine and file gets uploaded.
Problem is when i browse thru portal to path uploaded on KM i see the file ICON stating it a BINARY
file. How can i change the ICON to read correct type.
is there a way when calling the createResource to state that this file is of JPG TYPE or DOC type.
IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();
com.sapportals.portal.security.usermanagement.IUser ep5User =
WPUMFactory .getUserFactory().getEP5User(sapUser);
ResourceContext resourseContext = new ResourceContext(ep5User);
RID pathRID = RID.getRID("/documents/Public Documents/MYDATA"); //Root Directory
IResourceFactory resourseFactory = com.sapportals.wcm.repository.ResourceFactory.getInstance();
ICollection collection = (ICollection)resourseFactory.getResource(pathRID, resourseContext);
}InputStream stream = resource.read(false);
String resourceName = resource.getResourceName();
String resourceExtn = resource.getResourceType().getFileExtension();
com.sapportals.wcm.repository.Content content =
new com.sapportals.wcm.repository.Content( stream,"application/octet-stream",-1,"UTF-16");
com.sapportals.wcm.repository.IResource new_resource =
(com.sapportals.wcm.repository.IResource) collection.createResource(resourceName, null, content);
Greetings
Prashant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Satish,
Thanks for the code excerpt. i already know the file type ,
String resourceExtn = resource.getResourceType().getFileExtension();
My problem is that after uploading the file in KM, file is displayed as Binary type... check below tutorial on PAGE 14, the file has icon binary....not the .DOC icon.
[https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a099a3bd-17ef-2b10-e6ac-9c1ea42af0e9]
what i want to achieve is since i already know the file type i am uploading the new resource created should be exactly of that type. so if i am uploading .DOC file is shuold see new resource as word document type . Thus it boils down to simple question
When creating new resource in KM , whats the way to specify that this is .DOC type resource or .JPEG type resource*
com.sapportals.wcm.repository.IResource new_resource =
(com.sapportals.wcm.repository.IResource) collection.createResource(resourceName, null, content);
Greetings
Prashant
Closed due to further posting requirement
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.