掲示板
How to get the AssetEntry for a DLFileEntry or BlogEntry?
12年前 に Cameron McBride によって更新されました。
How to get the AssetEntry for a DLFileEntry or BlogEntry?
Expert 投稿: 269 参加年月日: 11/02/08 最新の投稿List<dlfileentry> files = DLFileEntryLocalServiceUtil.getDLFileEntries(0, DLFileEntryLocalServiceUtil.getDLFileEntriesCount());
for (DLFileEntry file : files) {
AssetEntry asset = AssetEntryLocalServiceUtil.getAssetEntry(file.getFileEntryId());
}</dlfileentry>
That will throw an error because the the entry id of the file is not the same as what is in the asset entry.
List<assetentry> assets = AssetEntryLocalServiceUtil.getAssetEntries(0, AssetEntryLocalServiceUtil.getAssetEntriesCount());
for (AssetEntry asset : assets) {
System.out.println("# " + asset.getEntryId() + " - " + asset.getClassName() + " - " + asset.getTitle() + " - " + asset.getViewCount());
}</assetentry>
That will print all the assets and you can see that your file is in there. How can you get the asset entry id from the file?
12年前 に Cameron McBride によって更新されました。
RE: How to get the AssetEntry for a DLFileEntry or BlogEntry?
Expert 投稿: 269 参加年月日: 11/02/08 最新の投稿
Got it. Hopefully this helps someone someday...
AssetEntry asset = AssetEntryLocalServiceUtil.getEntry(DLFileEntry.class.getName(), file.getPrimaryKey());
9年前 に JL Gonzalez によって更新されました。
RE: How to get the AssetEntry for a DLFileEntry or BlogEntry?
New Member 投稿: 10 参加年月日: 13/05/29 最新の投稿
It did, many thanks ;)
8年前 に Paige L によって更新されました。
RE: How to get the AssetEntry for a DLFileEntry or BlogEntry?
Junior Member 投稿: 42 参加年月日: 14/11/11 最新の投稿
Thank you thank you thank you. Going to see if it works for me now, but even if it doesn't, I highly respect you as someone who reports back solutions even when you don't have, helping the confused from four years in the future. Thank you.
8年前 に Paige L によって更新されました。
RE: How to get the AssetEntry for a DLFileEntry or BlogEntry?
Junior Member 投稿: 42 参加年月日: 14/11/11 最新の投稿
I'm still getting the error (No AssetEntry exists with the key {classNameId=10011, classPK=975773}) but I'll respond back if I find a way to fix it