1
22
23 package com.liferay.portlet.tags.service.impl;
24
25 import com.liferay.portal.PortalException;
26 import com.liferay.portal.SystemException;
27 import com.liferay.portal.kernel.dao.orm.QueryUtil;
28 import com.liferay.portal.kernel.search.BooleanClauseOccur;
29 import com.liferay.portal.kernel.search.BooleanQuery;
30 import com.liferay.portal.kernel.search.BooleanQueryFactoryUtil;
31 import com.liferay.portal.kernel.search.Document;
32 import com.liferay.portal.kernel.search.Field;
33 import com.liferay.portal.kernel.search.Hits;
34 import com.liferay.portal.kernel.search.SearchEngineUtil;
35 import com.liferay.portal.kernel.search.TermQuery;
36 import com.liferay.portal.kernel.search.TermQueryFactoryUtil;
37 import com.liferay.portal.kernel.util.GetterUtil;
38 import com.liferay.portal.kernel.util.InstancePool;
39 import com.liferay.portal.kernel.util.ListUtil;
40 import com.liferay.portal.kernel.util.StringPool;
41 import com.liferay.portal.kernel.util.StringUtil;
42 import com.liferay.portal.kernel.util.Validator;
43 import com.liferay.portal.model.User;
44 import com.liferay.portal.util.PortalInstances;
45 import com.liferay.portal.util.PortalUtil;
46 import com.liferay.portal.util.PortletKeys;
47 import com.liferay.portal.util.PropsValues;
48 import com.liferay.portlet.blogs.model.BlogsEntry;
49 import com.liferay.portlet.bookmarks.model.BookmarksEntry;
50 import com.liferay.portlet.documentlibrary.model.DLFileEntry;
51 import com.liferay.portlet.imagegallery.model.IGImage;
52 import com.liferay.portlet.journal.model.JournalArticle;
53 import com.liferay.portlet.messageboards.model.MBMessage;
54 import com.liferay.portlet.tags.model.TagsAsset;
55 import com.liferay.portlet.tags.model.TagsAssetDisplay;
56 import com.liferay.portlet.tags.model.TagsAssetType;
57 import com.liferay.portlet.tags.model.TagsEntry;
58 import com.liferay.portlet.tags.service.base.TagsAssetLocalServiceBaseImpl;
59 import com.liferay.portlet.tags.util.TagsAssetValidator;
60 import com.liferay.portlet.tags.util.TagsUtil;
61 import com.liferay.portlet.wiki.model.WikiPage;
62
63 import java.util.ArrayList;
64 import java.util.Date;
65 import java.util.List;
66
67 import org.apache.commons.logging.Log;
68 import org.apache.commons.logging.LogFactory;
69
70
76 public class TagsAssetLocalServiceImpl extends TagsAssetLocalServiceBaseImpl {
77
78 public void deleteAsset(long assetId)
79 throws PortalException, SystemException {
80
81 TagsAsset asset = tagsAssetPersistence.findByPrimaryKey(assetId);
82
83 deleteAsset(asset);
84 }
85
86 public void deleteAsset(String className, long classPK)
87 throws SystemException {
88
89 long classNameId = PortalUtil.getClassNameId(className);
90
91 TagsAsset asset = tagsAssetPersistence.fetchByC_C(classNameId, classPK);
92
93 if (asset != null) {
94 deleteAsset(asset);
95 }
96 }
97
98 public void deleteAsset(TagsAsset asset) throws SystemException {
99 tagsAssetPersistence.remove(asset);
100 }
101
102 public TagsAsset getAsset(long assetId)
103 throws PortalException, SystemException {
104
105 return tagsAssetPersistence.findByPrimaryKey(assetId);
106 }
107
108 public TagsAsset getAsset(String className, long classPK)
109 throws PortalException, SystemException {
110
111 long classNameId = PortalUtil.getClassNameId(className);
112
113 return tagsAssetPersistence.findByC_C(classNameId, classPK);
114 }
115
116 public TagsAssetType[] getAssetTypes(String languageId) {
117 TagsAssetType[] assetTypes =
118 new TagsAssetType[TagsUtil.ASSET_TYPE_CLASS_NAMES.length];
119
120 for (int i = 0; i < TagsUtil.ASSET_TYPE_CLASS_NAMES.length; i++) {
121 assetTypes[i] = getAssetType(
122 TagsUtil.ASSET_TYPE_CLASS_NAMES[i], languageId);
123 }
124
125 return assetTypes;
126 }
127
128 public List<TagsAsset> getAssets(
129 long[] entryIds, long[] notEntryIds, boolean andOperator,
130 boolean excludeZeroViewCount, int start, int end)
131 throws SystemException {
132
133 return getAssets(
134 0, new long[0], entryIds, notEntryIds, andOperator,
135 excludeZeroViewCount, null, null, start, end);
136 }
137
138 public List<TagsAsset> getAssets(
139 long groupId, long[] classNameIds, long[] entryIds,
140 long[] notEntryIds, boolean andOperator,
141 boolean excludeZeroViewCount, int start, int end)
142 throws SystemException {
143
144 return getAssets(
145 groupId, classNameIds, entryIds, notEntryIds, andOperator,
146 excludeZeroViewCount, null, null, start, end);
147 }
148
149 public List<TagsAsset> getAssets(
150 long[] entryIds, long[] notEntryIds, boolean andOperator,
151 boolean excludeZeroViewCount, Date publishDate, Date expirationDate,
152 int start, int end)
153 throws SystemException {
154
155 return getAssets(
156 0, new long[0], entryIds, notEntryIds, andOperator,
157 excludeZeroViewCount, publishDate, expirationDate, start, end);
158 }
159
160 public List<TagsAsset> getAssets(
161 long groupId, long[] classNameIds, long[] entryIds,
162 long[] notEntryIds, boolean andOperator,
163 boolean excludeZeroViewCount, Date publishDate, Date expirationDate,
164 int start, int end)
165 throws SystemException {
166
167 if ((entryIds.length == 0) && (notEntryIds.length == 0)) {
168 return tagsAssetFinder.findAssets(
169 groupId, classNameIds, null, null, null, null,
170 excludeZeroViewCount, publishDate, expirationDate, start, end);
171 }
172 else if (andOperator) {
173 return tagsAssetFinder.findByAndEntryIds(
174 groupId, classNameIds, entryIds, notEntryIds, null, null, null,
175 null, excludeZeroViewCount, publishDate, expirationDate, start,
176 end);
177 }
178 else {
179 return tagsAssetFinder.findByOrEntryIds(
180 groupId, classNameIds, entryIds, notEntryIds, null, null, null,
181 null, excludeZeroViewCount, publishDate, expirationDate, start,
182 end);
183 }
184 }
185
186 public List<TagsAsset> getAssets(
187 long[] entryIds, long[] notEntryIds, boolean andOperator,
188 String orderByCol1, String orderByCol2, String orderByType1,
189 String orderByType2, boolean excludeZeroViewCount, Date publishDate,
190 Date expirationDate, int start, int end)
191 throws SystemException {
192
193 return getAssets(
194 0, new long[0], entryIds, notEntryIds, andOperator,
195 excludeZeroViewCount, publishDate, expirationDate, start, end);
196 }
197
198 public List<TagsAsset> getAssets(
199 long groupId, long[] classNameIds, long[] entryIds,
200 long[] notEntryIds, boolean andOperator, String orderByCol1,
201 String orderByCol2, String orderByType1, String orderByType2,
202 boolean excludeZeroViewCount, Date publishDate, Date expirationDate,
203 int start, int end)
204 throws SystemException {
205
206 if ((entryIds.length == 0) && (notEntryIds.length == 0)) {
207 return tagsAssetFinder.findAssets(
208 groupId, classNameIds, orderByCol1, orderByCol2, orderByType1,
209 orderByType2, excludeZeroViewCount, publishDate, expirationDate,
210 start, end);
211 }
212 else if (andOperator) {
213 return tagsAssetFinder.findByAndEntryIds(
214 groupId, classNameIds, entryIds, notEntryIds, orderByCol1,
215 orderByCol2, orderByType1, orderByType2, excludeZeroViewCount,
216 publishDate, expirationDate, start, end);
217 }
218 else {
219 return tagsAssetFinder.findByOrEntryIds(
220 groupId, classNameIds, entryIds, notEntryIds, orderByCol1,
221 orderByCol2, orderByType1, orderByType2, excludeZeroViewCount,
222 publishDate, expirationDate, start, end);
223 }
224 }
225
226 public int getAssetsCount(
227 long[] entryIds, long[] notEntryIds, boolean andOperator,
228 boolean excludeZeroViewCount)
229 throws SystemException {
230
231 return getAssetsCount(
232 0, new long[0], entryIds, notEntryIds, andOperator,
233 excludeZeroViewCount, null, null);
234 }
235
236 public int getAssetsCount(
237 long groupId, long[] entryIds, long[] notEntryIds,
238 boolean andOperator, boolean excludeZeroViewCount)
239 throws SystemException {
240
241 return getAssetsCount(
242 groupId, new long[0], entryIds, notEntryIds, andOperator,
243 excludeZeroViewCount, null, null);
244 }
245
246 public int getAssetsCount(
247 long[] entryIds, long[] notEntryIds, boolean andOperator,
248 boolean excludeZeroViewCount, Date publishDate, Date expirationDate)
249 throws SystemException {
250
251 return getAssetsCount(
252 0, new long[0], entryIds, notEntryIds, andOperator,
253 excludeZeroViewCount, publishDate, expirationDate);
254 }
255
256 public int getAssetsCount(
257 long groupId, long[] classNameIds, long[] entryIds,
258 long[] notEntryIds, boolean andOperator,
259 boolean excludeZeroViewCount, Date publishDate, Date expirationDate)
260 throws SystemException {
261
262 if ((entryIds.length == 0) && (notEntryIds.length == 0)) {
263 return tagsAssetFinder.countAssets(
264 groupId, classNameIds, excludeZeroViewCount, publishDate,
265 expirationDate);
266 }
267 else if (andOperator) {
268 return tagsAssetFinder.countByAndEntryIds(
269 groupId, classNameIds, entryIds, notEntryIds,
270 excludeZeroViewCount, publishDate, expirationDate);
271 }
272 else {
273 return tagsAssetFinder.countByOrEntryIds(
274 groupId, classNameIds, entryIds, notEntryIds,
275 excludeZeroViewCount, publishDate, expirationDate);
276 }
277 }
278
279 public TagsAssetDisplay[] getCompanyAssetDisplays(
280 long companyId, int start, int end, String languageId)
281 throws SystemException {
282
283 return getAssetDisplays(
284 getCompanyAssets(companyId, start, end), languageId);
285 }
286
287 public List<TagsAsset> getCompanyAssets(long companyId, int start, int end)
288 throws SystemException {
289
290 return tagsAssetPersistence.findByCompanyId(companyId, start, end);
291 }
292
293 public int getCompanyAssetsCount(long companyId) throws SystemException {
294 return tagsAssetPersistence.countByCompanyId(companyId);
295 }
296
297 public List<TagsAsset> getTopViewedAssets(
298 String className, boolean asc, int start, int end)
299 throws SystemException {
300
301 return getTopViewedAssets(new String[] {className}, asc, start, end);
302 }
303
304 public List<TagsAsset> getTopViewedAssets(
305 String[] className, boolean asc, int start, int end)
306 throws SystemException {
307
308 long[] classNameIds = new long[className.length];
309
310 for (int i = 0; i < className.length; i++) {
311 classNameIds[i] = PortalUtil.getClassNameId(className[i]);
312 }
313
314 return tagsAssetFinder.findByViewCount(classNameIds, asc, start, end);
315 }
316
317 public TagsAsset incrementViewCounter(String className, long classPK)
318 throws SystemException {
319
320 if (classPK <= 0) {
321 return null;
322 }
323
324 long classNameId = PortalUtil.getClassNameId(className);
325
326 TagsAsset asset = tagsAssetPersistence.fetchByC_C(classNameId, classPK);
327
328 if (asset != null) {
329 asset.setViewCount(asset.getViewCount() + 1);
330
331 tagsAssetPersistence.update(asset, false);
332 }
333
334 return asset;
335 }
336
337 public Hits search(
338 long companyId, String portletId, String keywords, int start,
339 int end)
340 throws SystemException {
341
342 try {
343 BooleanQuery contextQuery = BooleanQueryFactoryUtil.create();
344
345 if (Validator.isNotNull(portletId)) {
346 contextQuery.addRequiredTerm(Field.PORTLET_ID, portletId);
347 }
348 else {
349 BooleanQuery portletIdsQuery = BooleanQueryFactoryUtil.create();
350
351 for (String assetTypePortletId :
352 TagsUtil.ASSET_TYPE_PORTLET_IDS) {
353
354 TermQuery termQuery = TermQueryFactoryUtil.create(
355 Field.PORTLET_ID, assetTypePortletId);
356
357 portletIdsQuery.add(termQuery, BooleanClauseOccur.SHOULD);
358 }
359
360 contextQuery.add(portletIdsQuery, BooleanClauseOccur.MUST);
361 }
362
363 BooleanQuery searchQuery = BooleanQueryFactoryUtil.create();
364
365 if (Validator.isNotNull(keywords)) {
366 searchQuery.addTerm(Field.TITLE, keywords);
367 searchQuery.addTerm(Field.CONTENT, keywords);
368 searchQuery.addTerm(Field.DESCRIPTION, keywords);
369 searchQuery.addTerm(Field.PROPERTIES, keywords);
370 searchQuery.addTerm(Field.TAGS_ENTRIES, keywords);
371 }
372
373 BooleanQuery fullQuery = BooleanQueryFactoryUtil.create();
374
375 fullQuery.add(contextQuery, BooleanClauseOccur.MUST);
376
377 if (searchQuery.clauses().size() > 0) {
378 fullQuery.add(searchQuery, BooleanClauseOccur.MUST);
379 }
380
381 return SearchEngineUtil.search(companyId, fullQuery, start, end);
382 }
383 catch (Exception e) {
384 throw new SystemException(e);
385 }
386 }
387
388 public TagsAssetDisplay[] searchAssetDisplays(
389 long companyId, String portletId, String keywords,
390 String languageId, int start, int end)
391 throws SystemException {
392
393 List<TagsAsset> assets = new ArrayList<TagsAsset>();
394
395 Hits hits = search(companyId, portletId, keywords, start, end);
396
397 List<Document> hitsList = hits.toList();
398
399 for (Document doc : hitsList) {
400 try {
401 TagsAsset asset = getAsset(doc);
402
403 if (asset != null) {
404 assets.add(asset);
405 }
406 }
407 catch (Exception e) {
408 if (_log.isWarnEnabled()) {
409 _log.warn(e);
410 }
411 }
412 }
413
414 return getAssetDisplays(assets, languageId);
415 }
416
417 public int searchAssetDisplaysCount(
418 long companyId, String portletId, String keywords,
419 String languageId)
420 throws SystemException {
421
422 Hits hits = search(
423 companyId, portletId, keywords, QueryUtil.ALL_POS,
424 QueryUtil.ALL_POS);
425
426 return hits.getLength();
427 }
428
429 public TagsAsset updateAsset(
430 long userId, long groupId, String className, long classPK,
431 String[] entryNames)
432 throws PortalException, SystemException {
433
434 return updateAsset(
435 userId, groupId, className, classPK, entryNames, null, null, null,
436 null, null, null, null, null, null, 0, 0, null);
437 }
438
439 public TagsAsset updateAsset(
440 long userId, long groupId, String className, long classPK,
441 String[] entryNames, Date startDate, Date endDate, Date publishDate,
442 Date expirationDate, String mimeType, String title,
443 String description, String summary, String url, int height,
444 int width, Integer priority)
445 throws PortalException, SystemException {
446
447 return updateAsset(
448 userId, groupId, className, classPK, entryNames, startDate,
449 endDate, publishDate, expirationDate, mimeType, title, description,
450 summary, url, height, width, priority, true);
451 }
452
453 public TagsAsset updateAsset(
454 long userId, long groupId, String className, long classPK,
455 String[] entryNames, Date startDate, Date endDate, Date publishDate,
456 Date expirationDate, String mimeType, String title,
457 String description, String summary, String url, int height,
458 int width, Integer priority, boolean sync)
459 throws PortalException, SystemException {
460
461
463 User user = userPersistence.findByPrimaryKey(userId);
464 long classNameId = PortalUtil.getClassNameId(className);
465
466 if (entryNames == null) {
467 entryNames = new String[0];
468 }
469
470 title = StringUtil.shorten(title, 300, StringPool.BLANK);
471 Date now = new Date();
472
473 validate(className, entryNames);
474
475 TagsAsset asset = tagsAssetPersistence.fetchByC_C(classNameId, classPK);
476
477 if (asset == null) {
478 long assetId = counterLocalService.increment();
479
480 asset = tagsAssetPersistence.create(assetId);
481
482 asset.setCompanyId(user.getCompanyId());
483 asset.setUserId(user.getUserId());
484 asset.setUserName(user.getFullName());
485 asset.setCreateDate(now);
486 asset.setClassNameId(classNameId);
487 asset.setClassPK(classPK);
488 asset.setPublishDate(publishDate);
489 asset.setExpirationDate(expirationDate);
490
491 if (priority == null) {
492 asset.setPriority(0);
493 }
494
495 asset.setViewCount(0);
496 }
497
498 asset.setGroupId(groupId);
499 asset.setModifiedDate(now);
500 asset.setStartDate(startDate);
501 asset.setEndDate(endDate);
502 asset.setPublishDate(publishDate);
503 asset.setExpirationDate(expirationDate);
504 asset.setMimeType(mimeType);
505 asset.setTitle(title);
506 asset.setDescription(description);
507 asset.setSummary(summary);
508 asset.setUrl(url);
509 asset.setHeight(height);
510 asset.setWidth(width);
511
512 if (priority != null) {
513 asset.setPriority(priority.intValue());
514 }
515
516 tagsAssetPersistence.update(asset, false);
517
518
520 List<TagsEntry> entries = new ArrayList<TagsEntry>(entryNames.length);
521
522 for (int i = 0; i < entryNames.length; i++) {
523 String name = entryNames[i].trim().toLowerCase();
524
525 TagsEntry entry = tagsEntryPersistence.fetchByC_N(
526 user.getCompanyId(), name);
527
528 if (entry == null) {
529 entry = tagsEntryLocalService.addEntry(
530 user.getUserId(), entryNames[i],
531 TagsEntryLocalServiceImpl.DEFAULT_PROPERTIES);
532 }
533
534 entries.add(entry);
535 }
536
537 tagsAssetPersistence.setTagsEntries(asset.getAssetId(), entries);
538
539
541 if (!sync) {
542 return asset;
543 }
544
545 if (className.equals(BlogsEntry.class.getName())) {
546 BlogsEntry entry = blogsEntryPersistence.findByPrimaryKey(classPK);
547
548 entry.setTitle(title);
549
550 blogsEntryPersistence.update(entry, false);
551 }
552 else if (className.equals(BookmarksEntry.class.getName())) {
553 BookmarksEntry entry = bookmarksEntryPersistence.findByPrimaryKey(
554 classPK);
555
556 entry.setName(title);
557 entry.setComments(description);
558 entry.setUrl(url);
559
560 bookmarksEntryPersistence.update(entry, false);
561 }
562 else if (className.equals(DLFileEntry.class.getName())) {
563 DLFileEntry fileEntry = dlFileEntryPersistence.findByPrimaryKey(
564 classPK);
565
566 fileEntry.setTitle(title);
567 fileEntry.setDescription(description);
568
569 dlFileEntryPersistence.update(fileEntry, false);
570 }
571 else if (className.equals(JournalArticle.class.getName())) {
572 JournalArticle article = journalArticlePersistence.findByPrimaryKey(
573 classPK);
574
575 article.setTitle(title);
576 article.setDescription(description);
577
578 journalArticlePersistence.update(article, false);
579 }
580 else if (className.equals(MBMessage.class.getName())) {
581 MBMessage message = mbMessagePersistence.findByPrimaryKey(classPK);
582
583 message.setSubject(title);
584
585 mbMessagePersistence.update(message, false);
586 }
587 else if (className.equals(WikiPage.class.getName())) {
588 WikiPage page = wikiPagePersistence.findByPrimaryKey(classPK);
589
590 page.setTitle(title);
591
592 wikiPagePersistence.update(page, false);
593 }
594
595 return asset;
596 }
597
598 public void validate(String className, String[] entryNames)
599 throws PortalException {
600
601 TagsAssetValidator validator = (TagsAssetValidator)InstancePool.get(
602 PropsValues.TAGS_ASSET_VALIDATOR);
603
604 validator.validate(className, entryNames);
605 }
606
607 protected TagsAsset getAsset(Document doc)
608 throws PortalException, SystemException {
609
610 String portletId = GetterUtil.getString(doc.get(Field.PORTLET_ID));
611
612 if (portletId.equals(PortletKeys.BLOGS)) {
613 long entryId = GetterUtil.getLong(doc.get(Field.ENTRY_CLASS_PK));
614
615 long classNameId = PortalUtil.getClassNameId(
616 BlogsEntry.class.getName());
617 long classPK = entryId;
618
619 return tagsAssetPersistence.findByC_C(classNameId, classPK);
620 }
621 else if (portletId.equals(PortletKeys.BOOKMARKS)) {
622 long entryId = GetterUtil.getLong(doc.get(Field.ENTRY_CLASS_PK));
623
624 long classNameId = PortalUtil.getClassNameId(
625 BookmarksEntry.class.getName());
626 long classPK = entryId;
627
628 return tagsAssetPersistence.findByC_C(classNameId, classPK);
629 }
630 else if (portletId.equals(PortletKeys.DOCUMENT_LIBRARY)) {
631 long folderId = GetterUtil.getLong(doc.get("repositoryId"));
632 String name = doc.get("path");
633
634 DLFileEntry fileEntry = dlFileEntryLocalService.getFileEntry(
635 folderId, name);
636
637 long classNameId = PortalUtil.getClassNameId(
638 DLFileEntry.class.getName());
639 long classPK = fileEntry.getFileEntryId();
640
641 return tagsAssetPersistence.findByC_C(classNameId, classPK);
642 }
643 else if (portletId.equals(PortletKeys.IMAGE_GALLERY)) {
644 long imageId = GetterUtil.getLong(doc.get(Field.ENTRY_CLASS_PK));
645
646 long classNameId = PortalUtil.getClassNameId(
647 IGImage.class.getName());
648 long classPK = imageId;
649
650 return tagsAssetPersistence.findByC_C(classNameId, classPK);
651 }
652 else if (portletId.equals(PortletKeys.JOURNAL)) {
653 long groupId = GetterUtil.getLong(doc.get(Field.GROUP_ID));
654 String articleId = doc.get(Field.ENTRY_CLASS_PK);
655
657 long articleResourcePrimKey =
658 journalArticleResourceLocalService.getArticleResourcePrimKey(
659 groupId, articleId);
660
661 long classNameId = PortalUtil.getClassNameId(
662 JournalArticle.class.getName());
663 long classPK = articleResourcePrimKey;
664
665 return tagsAssetPersistence.findByC_C(classNameId, classPK);
666 }
667 else if (portletId.equals(PortletKeys.MESSAGE_BOARDS)) {
668 long messageId = GetterUtil.getLong(doc.get(Field.ENTRY_CLASS_PK));
669
670 long classNameId = PortalUtil.getClassNameId(
671 MBMessage.class.getName());
672 long classPK = messageId;
673
674 return tagsAssetPersistence.findByC_C(classNameId, classPK);
675 }
676 else if (portletId.equals(PortletKeys.WIKI)) {
677 long nodeId = GetterUtil.getLong(doc.get(Field.ENTRY_CLASS_PK));
678 String title = doc.get(Field.TITLE);
679
680 long pageResourcePrimKey =
681 wikiPageResourceLocalService.getPageResourcePrimKey(
682 nodeId, title);
683
684 long classNameId = PortalUtil.getClassNameId(
685 WikiPage.class.getName());
686 long classPK = pageResourcePrimKey;
687
688 return tagsAssetPersistence.findByC_C(classNameId, classPK);
689 }
690
691 return null;
692 }
693
694 protected TagsAssetDisplay[] getAssetDisplays(
695 List<TagsAsset> assets, String languageId)
696 throws SystemException {
697
698 TagsAssetDisplay[] assetDisplays = new TagsAssetDisplay[assets.size()];
699
700 for (int i = 0; i < assets.size(); i++) {
701 TagsAsset asset = assets.get(i);
702
703 String className = PortalUtil.getClassName(asset.getClassNameId());
704 String portletId = PortalUtil.getClassNamePortletId(className);
705 String portletTitle = PortalUtil.getPortletTitle(
706 portletId, asset.getCompanyId(), languageId);
707
708 List<TagsEntry> tagsEntriesList =
709 tagsAssetPersistence.getTagsEntries(asset.getAssetId());
710
711 String tagsEntries = ListUtil.toString(
712 tagsEntriesList, "name", ", ");
713
714 TagsAssetDisplay assetDisplay = new TagsAssetDisplay();
715
716 assetDisplay.setAssetId(asset.getAssetId());
717 assetDisplay.setCompanyId(asset.getCompanyId());
718 assetDisplay.setUserId(asset.getUserId());
719 assetDisplay.setUserName(asset.getUserName());
720 assetDisplay.setCreateDate(asset.getCreateDate());
721 assetDisplay.setModifiedDate(asset.getModifiedDate());
722 assetDisplay.setClassNameId(asset.getClassNameId());
723 assetDisplay.setClassName(className);
724 assetDisplay.setClassPK(asset.getClassPK());
725 assetDisplay.setPortletId(portletId);
726 assetDisplay.setPortletTitle(portletTitle);
727 assetDisplay.setStartDate(asset.getStartDate());
728 assetDisplay.setEndDate(asset.getEndDate());
729 assetDisplay.setPublishDate(asset.getPublishDate());
730 assetDisplay.setExpirationDate(asset.getExpirationDate());
731 assetDisplay.setMimeType(asset.getMimeType());
732 assetDisplay.setTitle(asset.getTitle());
733 assetDisplay.setDescription(asset.getDescription());
734 assetDisplay.setSummary(asset.getSummary());
735 assetDisplay.setUrl(asset.getUrl());
736 assetDisplay.setHeight(asset.getHeight());
737 assetDisplay.setWidth(asset.getWidth());
738 assetDisplay.setPriority(asset.getPriority());
739 assetDisplay.setViewCount(asset.getViewCount());
740 assetDisplay.setTagsEntries(tagsEntries);
741
742 assetDisplays[i] = assetDisplay;
743 }
744
745 return assetDisplays;
746 }
747
748 protected TagsAssetType getAssetType(String className, String languageId) {
749 long companyId = PortalInstances.getDefaultCompanyId();
750
751 long classNameId = PortalUtil.getClassNameId(className);
752
753 String portletId = PortalUtil.getClassNamePortletId(className);
754 String portletTitle = PortalUtil.getPortletTitle(
755 portletId, companyId, languageId);
756
757 TagsAssetType assetType = new TagsAssetType();
758
759 assetType.setClassNameId(classNameId);
760 assetType.setClassName(className);
761 assetType.setPortletId(portletId);
762 assetType.setPortletTitle(portletTitle);
763
764 return assetType;
765 }
766
767 private static Log _log =
768 LogFactory.getLog(TagsAssetLocalServiceImpl.class);
769
770 }