Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Brahim TARNAOUI
HOWTO Create a DLfolder?
17 dicembre 2010 8.51
Risposta

Brahim TARNAOUI

Punteggio: Junior Member

Messaggi: 64

Data di Iscrizione: 15 giugno 2010

Messaggi recenti

hello,

i'm looking for code to create a DLfolder for the document_library portlet.
NB:the DLFolder will be create from another portlet not document_library portlet and i will show it when i listing the folder in document_library portlet.

i need your help
thx in advance
Sandeep Nair
RE: HOWTO Create a DLfolder?
17 dicembre 2010 8.57
Risposta

Sandeep Nair

Punteggio: Liferay Legend

Messaggi: 1692

Data di Iscrizione: 5 novembre 2008

Messaggi recenti

DLFolderLocalServiceUtil.addFolder(userId,
themeDisplay.getScopeGroupId(), parentFolderId, name,
description, serviceContext)
Use the above method with following parameters

parentFolderId will be 0
name name of folder
description
userid one who creates
ServiceContext serviceContext = ServiceContextFactory.getInstance(
DLFolder.class.getName(), actionRequest);

ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
WebKeys.THEME_DISPLAY);
Brahim TARNAOUI
RE: HOWTO Create a DLfolder?
17 dicembre 2010 8.58
Risposta

Brahim TARNAOUI

Punteggio: Junior Member

Messaggi: 64

Data di Iscrizione: 15 giugno 2010

Messaggi recenti

thx for your post,
how can i use it in a class??
my class is in a portlet other than document_library
Sandeep Nair
RE: HOWTO Create a DLfolder?
17 dicembre 2010 9.07
Risposta

Sandeep Nair

Punteggio: Liferay Legend

Messaggi: 1692

Data di Iscrizione: 5 novembre 2008

Messaggi recenti

Yes directly use in the portlet which i assume would ask user to give name and description

Use lifecyle method of portlet processAction to process the request, retrieve the parameters. At the end of the day ur portlets processAction would look something like the following

 1public void processAction(ActionRequest actionRequest,
 2            ActionResponse actionResponse) throws IOException, PortletException {
 3
 4ServiceContext serviceContext = ServiceContextFactory.getInstance(
 5DLFolder.class.getName(), actionRequest);
 6ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
 7WebKeys.THEME_DISPLAY);         
 8long parentFolderId = 0;
 9long userId = PortalUtil.getUserId(actionRequest);
10String name = ParamUtil.getString(actionRequest,"name"); //pass this from jsp
11String description = ParamUtil.getString(actionRequest,"description "); //pass this from jsp
12
13DLFolderLocalServiceUtil.addFolder(userId,
14themeDisplay.getScopeGroupId(), parentFolderId, name,
15description, serviceContext);
16}
Brahim TARNAOUI
RE: HOWTO Create a DLfolder?
17 dicembre 2010 9.59
Risposta

Brahim TARNAOUI

Punteggio: Junior Member

Messaggi: 64

Data di Iscrizione: 15 giugno 2010

Messaggi recenti

Hello,

i use your code, but it crash this Exception:
java.lang.RuntimeException: Unable to get the portlet request from org.springframework.web.portlet.multipart.DefaultMultipartActionRequest

have you a solution please?
Sandeep Nair
RE: HOWTO Create a DLfolder?
18 dicembre 2010 7.43
Risposta

Sandeep Nair

Punteggio: Liferay Legend

Messaggi: 1692

Data di Iscrizione: 5 novembre 2008

Messaggi recenti

Can you show whats in ur jsp and Portlet class. I was assuming u were using MVCPortlet or GenericPortlet but u seem to be using Spring portlet
Brahim TARNAOUI
RE: HOWTO Create a DLfolder?
19 dicembre 2010 9.04
Risposta

Brahim TARNAOUI

Punteggio: Junior Member

Messaggi: 64

Data di Iscrizione: 15 giugno 2010

Messaggi recenti

Hello,
this is my source code of Spring Portlet :
@RequestMapping(params="action=AddClient") // action phase
public void submitAddFormationForm(ActionRequest actionRequest, ActionResponse response,
@ModelAttribute("client") Patient patient, BindingResult result, Model model,
PortletRequest portletRequest, RenderRequest renderRequest) {
if (actionRequest.getParameter("_cancel") != null) {
}else if (actionRequest.getParameter("_add") != null) {
clientValidator.validate(client, result);
if (result.hasErrors()) {
response.setRenderParameter("action", "AddClient");
}else {
Date date = new Date();
long id = date.getTime();
id = id%1000000;
client.setClientId(id);
client.setFolderId(id);
client.setCreateDate(date);
client.setModifiedDate(date);

client = (Client) clientService.save(client);

try {
ServiceContext serviceContext = ServiceContextFactory.getInstance(DLFolder.class.getName(), renderRequest);
ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

long parentFolderId = 0;
long userId = PortalUtil.getUserId(portletRequest);
String folderName = "Name of FOlder";
String description = "Description Of Folder";

DLFolderLocalServiceUtil.addFolder(userId,themeDisplay.getScopeGroupId(), parentFolderId, folderName,description, serviceContext);
} catch (PortalException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}
}
}



in jsp page, i have this link :

<portlet:defineObjects />
<portlet:actionURL var="AddPatientUrl">
<portlet:param name="action" value="AddPatient"/>
</portlet:actionURL>

<a href ="<%=AddPatientURL %>">Add Patient</a>



thx in advance
Brahim TARNAOUI
RE: HOWTO Create a DLfolder?
20 dicembre 2010 2.43
Risposta

Brahim TARNAOUI

Punteggio: Junior Member

Messaggi: 64

Data di Iscrizione: 15 giugno 2010

Messaggi recenti

hello,
i come to create a DLFolder by this code:


DLFolder folder = DLFolderLocalServiceUtil.createDLFolder(id);
folder.setName(folderName);
folder.setParentFolderId(0);
folder.setDescription("folder test");
folder.setGroupId(groupId);
folder.setCompanyId(companyId);
folder.setUserId(userId);
folder.setCreateDate(date);
folder.setModifiedDate(date);
folder.setLastPostDate(date);

DLFolderLocalServiceUtil.addDLFolder(folder);
mohammad azaruddin
RE: HOWTO Create a DLfolder?
7 marzo 2013 1.55
Risposta

mohammad azaruddin

Punteggio: Expert

Messaggi: 438

Data di Iscrizione: 17 settembre 2012

Messaggi recenti

Hi
Sandeep
I'm using LR 6.1.1 and Your missing one argument "mountPoint".what will be value of mountPoint
Thanks
mohammad azaruddin
RE: HOWTO Create a DLfolder?
7 marzo 2013 4.54
Risposta

mohammad azaruddin

Punteggio: Expert

Messaggi: 438

Data di Iscrizione: 17 settembre 2012

Messaggi recenti

Hi
MountPoint set to true if you want to create seperate resipotary.And default value is false

hope this is correct...correct me if i'm wrong
Mika Koivisto
RE: HOWTO Create a DLfolder?
7 marzo 2013 14.20
Risposta

Mika Koivisto

LIFERAY STAFF

Punteggio: Liferay Legend

Messaggi: 1499

Data di Iscrizione: 7 agosto 2006

Messaggi recenti

Don't use DLFolder directly in 6.1. It's internal implementation for LiferayRepository and should not be messed with. Everything should go through DLAppServiceUtil.
mohammad azaruddin
RE: HOWTO Create a DLfolder?
7 marzo 2013 21.24
Risposta

mohammad azaruddin

Punteggio: Expert

Messaggi: 438

Data di Iscrizione: 17 settembre 2012

Messaggi recenti

Mika Koivisto:
Don't use DLFolder directly in 6.1. It's internal implementation for LiferayRepository and should not be messed with. Everything should go through DLAppServiceUtil.


Hi Mika Koivisto

hope this is legal way to create dlfolder
Folder folder=DLAppServiceUtil.addFolder(themeDisplay.getLayout().getGroupId(), 0L, name, description, serviceContext);
Meera Prince
RE: HOWTO Create a DLfolder?
7 marzo 2013 21.54
Risposta

Meera Prince

Punteggio: Liferay Master

Messaggi: 814

Data di Iscrizione: 8 febbraio 2011

Messaggi recenti

HI
long id=long =CounterLocalServiceUtil.increment();
DLFolder folder = DLFolderLocalServiceUtil.createDLFolder(id);
folder.setName(folderName);
folder.setParentFolderId(0);
folder.setDescription("folder test");
folder.setGroupId(groupId);
folder.setCompanyId(companyId);
folder.setUserId(userId);
folder.setCreateDate(date);
folder.setModifiedDate(date);
folder.setLastPostDate(date);
DLFolderLocalServiceUtil.addDLFolder(folder);

http://www.liferaysavvy.com/2013/02/best-way-to-add-data-to-life-ray-tables.html

Regards,

Meera Prince

http://www.liferaysavvy.com
Meera Prince
RE: HOWTO Create a DLfolder?
8 marzo 2013 0.18
Risposta

Meera Prince

Punteggio: Liferay Master

Messaggi: 814

Data di Iscrizione: 8 febbraio 2011

Messaggi recenti

ok Thank you
Mika Koivisto
RE: HOWTO Create a DLfolder?
8 marzo 2013 18.14
Risposta

Mika Koivisto

LIFERAY STAFF

Punteggio: Liferay Legend

Messaggi: 1499

Data di Iscrizione: 7 agosto 2006

Messaggi recenti

mohammad azaruddin:

hope this is legal way to create dlfolder
Folder folder=DLAppServiceUtil.addFolder(themeDisplay.getLayout().getGroupId(), 0L, name, description, serviceContext);


That's much better. For the repositoryId you can also use themeDisplay.getScopeGroupId().
mohammad azaruddin
RE: HOWTO Create a DLfolder?
14 marzo 2013 5.22
Risposta

mohammad azaruddin

Punteggio: Expert

Messaggi: 438

Data di Iscrizione: 17 settembre 2012

Messaggi recenti

Hi
Mika Koivisto

Thank you.and for adding file entry we use same (DLAppServiceUtil).emoticon
Rgards
azhar
mohammad azaruddin
RE: HOWTO Create a DLfolder?
14 marzo 2013 7.16
Risposta

mohammad azaruddin

Punteggio: Expert

Messaggi: 438

Data di Iscrizione: 17 settembre 2012

Messaggi recenti

Hi
Mika Koivisto

I used DLServiceUtil to add folder as well as DLfile
Folder dlFolder = DLAppServiceUtil.addFolder(themeDisplay.getScopeGroupId(), 0L, name, Description, serviceContext);

DLAppServiceUtil.addFileEntry(repositoryIds, folderId, sourceFileName, MimeTypesUtil.getContentType(file), sourceFileName, sourceFileName, StringPool.BLANK, null, size, serviceContext);


And what is the use of ChangeLog and InputStream.I'm Just passing null value for that.


can we pass this as InputStream inputStream=uploadPortletRequest.getInputStream();

And i'm unable to download the file.file is stored as 0kb size..and i'm getting this error

13:52:18,785 ERROR [ImageProcessor:219] java.lang.ArrayIndexOutOfBoundsException: 0
java.lang.ArrayIndexOutOfBoundsException: 0
at com.sun.media.jai.codecimpl.PNMCodec.isFormatRecognized(PNMCodec.java:152)
at com.liferay.portal.image.ImageProcessorImpl.read(ImageProcessorImpl.java:195)
at com.liferay.portal.kernel.image.ImageProcessorUtil.read(ImageProcessorUtil.java:67)
at com.liferay.portlet.documentlibrary.util.ImageProcessor._generateImages(ImageProcessor.java:172)
at com.liferay.portlet.documentlibrary.util.ImageProcessor.generateImages(ImageProcessor.java:63)
at com.liferay.portlet.documentlibrary.messaging.ImageProcessorMessageListener.doReceive(ImageProcessorMessageListener.java:31)
at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:25)
at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:65)
at com.liferay.portal.kernel.messaging.SerialDestination$1.run(SerialDestination.java:101)
at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:669)
at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:580)
at java.lang.Thread.run(Thread.java:619)