Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Markus Feindler
Document Library Service - Parameter questions - repositoryid?
August 20, 2009 11:51 AM
Answer

Markus Feindler

Rank: New Member

Posts: 8

Join Date: August 20, 2009

Recent Posts

Hello guys,

I have got a huge problem in understanding the document library service (DLService).
I just want to add a File to a certain library via addFile:

1
2static void     addFile(long companyId, java.lang.String portletId, long groupId, long repositoryId, java.lang.String fileName, java.lang.String properties, java.lang.String[] tagsEntries, java.io.File file)


What the hell is the repositoryid? I cannot find any information about it (thanks to the non existing doc!)
Where is the targetfolder specified?

I have got every parameter information but the repositoryid. Could it be, that the repositoryid, is the FolderName? But that would be strange, because there is another method "addDirectory" (if I remember right) which also needs a repositoryid as a parameter.

EDIT:
Whats with the properties??


Thanks for help!

Bye
Thomas
Alexander Boldt
RE: Document Library Service - Parameter questions - repositoryid?
February 9, 2011 6:58 AM
Answer

Alexander Boldt

Rank: New Member

Posts: 12

Join Date: January 6, 2011

Recent Posts

if you still have this problem:

found this in DLFileEntryImpl

1public static long getRepositoryId(long groupId, long folderId) {
2        if (folderId == DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
3            return groupId;
4        }
5        else {
6            return folderId;
7        }
8    }


So RepoID is the folderId or groupID
DLFolderConstants.DEFAULT_PARENT_FOLDER_ID -> 0L, this should be the case if it is the root folder.

In addition found that in
DLFolderImpl
1public boolean isRoot() {
2        if (getParentFolderId() == DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
3            return true;
4        }
5        else {
6            return false;
7        }
8    }


bye, alex
Alexander Boldt
RE: Document Library Service - Parameter questions - repositoryid?
February 9, 2011 7:38 AM
Answer

Alexander Boldt

Rank: New Member

Posts: 12

Join Date: January 6, 2011

Recent Posts

now something about properties.

Look @DLFileEntryLocalServiceImpl
1dlLocalService.addFile(
2            user.getCompanyId(), PortletKeys.DOCUMENT_LIBRARY,
3            fileEntry.getGroupId(), fileEntry.getRepositoryId(), name, false,
4            fileEntryId, fileEntry.getLuceneProperties(),
5            fileEntry.getModifiedDate(), serviceContext, is);


Properties -> fileEntry.getLuceneProperties()
now look @DLFileEntryImpl and you find what is properties.
Tom Mahy
RE: Document Library Service - Parameter questions - repositoryid?
December 18, 2012 3:13 AM
Answer

Tom Mahy

Rank: Junior Member

Posts: 38

Join Date: May 2, 2012

Recent Posts

Ive tried this and i get an error:
Caused by: com.liferay.portal.NoSuchGroupException: No Group exists with the key {companyId=0, classNameId=10008, classPK=0}

1SearchContext searchContext = new SearchContext();
2ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
3Group group = GroupLocalServiceUtil.getGroup(themeDisplay.getScopeGroupId());
4Hits hits = DLAppServiceUtil.search(group.getGroupId(), searchContext);


What am i doing wrong ?