掲示板
How to access a folder in DL via VM template.
11年前 に Mike Perico によって更新されました。
How to access a folder in DL via VM template.
Junior Member 投稿: 25 参加年月日: 12/08/23 最新の投稿
I have created a folder in the document library off of root - "MyFolder".
I have been trying to access it with no luck so far. This shouldn't be so hard. This is the code I am using to just access the folder:
#set ( $DLFolderLocalService=$serviceLocator.findService("com.liferay.portlet.documentlibrary.service.DLFolderLocalService"))
#set ( $myFolder = $DLFolderLocalService.getFolder(16348) )
Folder Name: $myFolder.getName() <br/>
But instead I get $myFolder.getName printed out literally.
Any help on how to access this folder and it's contents?
I have been trying to access it with no luck so far. This shouldn't be so hard. This is the code I am using to just access the folder:
#set ( $DLFolderLocalService=$serviceLocator.findService("com.liferay.portlet.documentlibrary.service.DLFolderLocalService"))
#set ( $myFolder = $DLFolderLocalService.getFolder(16348) )
Folder Name: $myFolder.getName() <br/>
But instead I get $myFolder.getName printed out literally.
Any help on how to access this folder and it's contents?
11年前 に David H Nebinger によって更新されました。
RE: How to access a folder in DL via VM template.
Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
I believe if $myFolder resolves to null, Velocity will treat it as inline text rather than as a reference to resolve.
Since you don't get a failure on an NPE on the second #set, I'm guessing the service was found but it returned null for myFolder.
In the com.liferay.portal.bean.VelocityBeanHandler class, if a bean (in this case your DLFolderLocalService instance) throws an exception, it is swallowed up and a null is returned.
The key here is figuring out why your call to getFolder(16348) is failing.
Since you don't get a failure on an NPE on the second #set, I'm guessing the service was found but it returned null for myFolder.
In the com.liferay.portal.bean.VelocityBeanHandler class, if a bean (in this case your DLFolderLocalService instance) throws an exception, it is swallowed up and a null is returned.
The key here is figuring out why your call to getFolder(16348) is failing.
11年前 に Mike Perico によって更新されました。
RE: How to access a folder in DL via VM template.
Junior Member 投稿: 25 参加年月日: 12/08/23 最新の投稿
Thanks for the reply.
I found that folder id by looking at the URL in the control panel. Is that not the correct way to get the folder id? I don't the id displayed any where else, but I think making sure I have the correct folder id is the first step.
When I hover over the folder in the DL I get this:
http://localhost:8080/group/control_panel/manage?p_p_id=20&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view&doAsGroupId=14209&refererPlid=16323&_20_struts_action=%2Fdocument_library%2Fview&_20_viewEntries=true&_20_viewFolders=true&_20_folderId=16348
I am choosing the correct folderId, yes?
mike
I found that folder id by looking at the URL in the control panel. Is that not the correct way to get the folder id? I don't the id displayed any where else, but I think making sure I have the correct folder id is the first step.
When I hover over the folder in the DL I get this:
http://localhost:8080/group/control_panel/manage?p_p_id=20&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view&doAsGroupId=14209&refererPlid=16323&_20_struts_action=%2Fdocument_library%2Fview&_20_viewEntries=true&_20_viewFolders=true&_20_folderId=16348
I am choosing the correct folderId, yes?
mike
11年前 に David H Nebinger によって更新されました。
RE: How to access a folder in DL via VM template.
Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
Looks like the right one, but you have to remember that what is going on at the portlet level may be different than just calling getFolder(16348)...
If you try a similar sort of thing in a JSP page, there you should see whatever exception is probably getting thrown from the call, and that will lead you toward the solution...
If you try a similar sort of thing in a JSP page, there you should see whatever exception is probably getting thrown from the call, and that will lead you toward the solution...
11年前 に Mike Perico によって更新されました。
RE: How to access a folder in DL via VM template.
Junior Member 投稿: 25 参加年月日: 12/08/23 最新の投稿
ok...
One more thing, where would I find the source for the asset publisher or Document and Media portlets?
One more thing, where would I find the source for the asset publisher or Document and Media portlets?
11年前 に David H Nebinger によって更新されました。
RE: How to access a folder in DL via VM template.
Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
They're part of Liferay and would be available in the source download.
11年前 に Hitoshi Ozawa によって更新されました。
RE: How to access a folder in DL via VM template.
Liferay Legend 投稿: 7942 参加年月日: 10/03/24 最新の投稿One more thing, where would I find the source for the asset publisher or Document and Media portlets?
Just download liferay's source code.
jsp files are in respective folders in portal-web\docroot\html\portlet
Java codes are in
portal-service\src\com\liferay\portlet
and
\portal-impl\src\com\liferay\portlet
11年前 に Hitoshi Ozawa によって更新されました。
RE: How to access a folder in DL via VM template.
Liferay Legend 投稿: 7942 参加年月日: 10/03/24 最新の投稿I found that folder id by looking at the URL in the control panel. Is that not the correct way to get the folder id?
To find the id value, I usually just look in the database table. If you're using the default database, it's kind of difficult to view it online so I usually setup a mysql.