掲示板
HOWTO Create a DLfolder?
13年前 に Brahim TARNAOUI によって更新されました。
HOWTO Create a DLfolder?
Junior Member 投稿: 64 参加年月日: 10/06/15 最新の投稿
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
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
13年前 に Sandeep Nair によって更新されました。
RE: HOWTO Create a DLfolder?
Liferay Legend 投稿: 1744 参加年月日: 08/11/06 最新の投稿
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);
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);
13年前 に Brahim TARNAOUI によって更新されました。
RE: HOWTO Create a DLfolder?
Junior Member 投稿: 64 参加年月日: 10/06/15 最新の投稿
thx for your post,
how can i use it in a class??
my class is in a portlet other than document_library
how can i use it in a class??
my class is in a portlet other than document_library
13年前 に Sandeep Nair によって更新されました。
RE: HOWTO Create a DLfolder?
Liferay Legend 投稿: 1744 参加年月日: 08/11/06 最新の投稿
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
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
public void processAction(ActionRequest actionRequest,
ActionResponse actionResponse) throws IOException, PortletException {
ServiceContext serviceContext = ServiceContextFactory.getInstance(
DLFolder.class.getName(), actionRequest);
ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
WebKeys.THEME_DISPLAY);
long parentFolderId = 0;
long userId = PortalUtil.getUserId(actionRequest);
String name = ParamUtil.getString(actionRequest,"name"); //pass this from jsp
String description = ParamUtil.getString(actionRequest,"description "); //pass this from jsp
DLFolderLocalServiceUtil.addFolder(userId,
themeDisplay.getScopeGroupId(), parentFolderId, name,
description, serviceContext);
}
13年前 に Brahim TARNAOUI によって更新されました。
RE: HOWTO Create a DLfolder?
Junior Member 投稿: 64 参加年月日: 10/06/15 最新の投稿
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?
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?
13年前 に Sandeep Nair によって更新されました。
RE: HOWTO Create a DLfolder?
Liferay Legend 投稿: 1744 参加年月日: 08/11/06 最新の投稿
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
13年前 に Brahim TARNAOUI によって更新されました。
RE: HOWTO Create a DLfolder?
Junior Member 投稿: 64 参加年月日: 10/06/15 最新の投稿
Hello,
this is my source code of Spring Portlet :
in jsp page, i have this link :
thx in advance
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
13年前 に Brahim TARNAOUI によって更新されました。
RE: HOWTO Create a DLfolder?
Junior Member 投稿: 64 参加年月日: 10/06/15 最新の投稿
hello,
i come to create a DLFolder by this code:
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);
11年前 に mohammad azaruddin によって更新されました。
RE: HOWTO Create a DLfolder?
Expert 投稿: 492 参加年月日: 12/09/17 最新の投稿
Hi
Sandeep
I'm using LR 6.1.1 and Your missing one argument "mountPoint".what will be value of mountPoint
Thanks
Sandeep
I'm using LR 6.1.1 and Your missing one argument "mountPoint".what will be value of mountPoint
Thanks
11年前 に mohammad azaruddin によって更新されました。
RE: HOWTO Create a DLfolder?
Expert 投稿: 492 参加年月日: 12/09/17 最新の投稿
Hi
MountPoint set to true if you want to create seperate resipotary.And default value is false
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
11年前 に Mika Koivisto によって更新されました。
RE: HOWTO Create a DLfolder?
Liferay Legend 投稿: 1519 参加年月日: 06/08/07 最新の投稿
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.
11年前 に mohammad azaruddin によって更新されました。
RE: HOWTO Create a DLfolder?
Expert 投稿: 492 参加年月日: 12/09/17 最新の投稿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);
11年前 に Mika Koivisto によって更新されました。
RE: HOWTO Create a DLfolder?
Liferay Legend 投稿: 1519 参加年月日: 06/08/07 最新の投稿mohammad azaruddin:
hope this is legal way to create dlfolderFolder folder=DLAppServiceUtil.addFolder(themeDisplay.getLayout().getGroupId(), 0L, name, description, serviceContext);
That's much better. For the repositoryId you can also use themeDisplay.getScopeGroupId().
11年前 に mohammad azaruddin によって更新されました。
RE: HOWTO Create a DLfolder?
Expert 投稿: 492 参加年月日: 12/09/17 最新の投稿
Hi
Mika Koivisto
Thank you.and for adding file entry we use same (DLAppServiceUtil).
Rgards
azhar
Mika Koivisto
Thank you.and for adding file entry we use same (DLAppServiceUtil).
Rgards
azhar
11年前 に mohammad azaruddin によって更新されました。
RE: HOWTO Create a DLfolder?
Expert 投稿: 492 参加年月日: 12/09/17 最新の投稿
Hi
Mika Koivisto
I used DLServiceUtil to add folder as well as DLfile
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
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)
11年前 に meera prince によって更新されました。
RE: HOWTO Create a DLfolder?
Liferay Legend 投稿: 1111 参加年月日: 11/02/08 最新の投稿
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
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
11年前 に meera prince によって更新されました。
RE: HOWTO Create a DLfolder?
Liferay Legend 投稿: 1111 参加年月日: 11/02/08 最新の投稿
ok Thank you