001
014
015 package com.liferay.portlet.exportimport.lar;
016
017 import com.liferay.portal.kernel.log.Log;
018 import com.liferay.portal.kernel.log.LogFactoryUtil;
019 import com.liferay.portal.kernel.template.TemplateHandler;
020 import com.liferay.portal.kernel.util.ArrayUtil;
021 import com.liferay.portal.kernel.util.GetterUtil;
022 import com.liferay.portal.kernel.util.MapUtil;
023 import com.liferay.portal.kernel.util.StringPool;
024 import com.liferay.portal.kernel.util.Time;
025 import com.liferay.portal.kernel.util.Validator;
026 import com.liferay.portal.kernel.xml.Document;
027 import com.liferay.portal.kernel.xml.DocumentException;
028 import com.liferay.portal.kernel.xml.Element;
029 import com.liferay.portal.kernel.xml.SAXReaderUtil;
030 import com.liferay.portal.model.Group;
031 import com.liferay.portal.model.Portlet;
032 import com.liferay.portal.service.PortletLocalServiceUtil;
033 import com.liferay.portal.service.PortletPreferencesLocalServiceUtil;
034 import com.liferay.portal.util.PortalUtil;
035 import com.liferay.portal.util.PortletKeys;
036 import com.liferay.portlet.dynamicdatamapping.model.DDMTemplate;
037 import com.liferay.portlet.portletdisplaytemplate.util.PortletDisplayTemplate;
038 import com.liferay.portlet.portletdisplaytemplate.util.PortletDisplayTemplateUtil;
039
040 import java.io.IOException;
041
042 import java.util.ArrayList;
043 import java.util.List;
044 import java.util.Map;
045
046 import javax.portlet.PortletPreferences;
047
048
051 public abstract class BasePortletDataHandler implements PortletDataHandler {
052
053 @Override
054 public PortletPreferences addDefaultData(
055 PortletDataContext portletDataContext, String portletId,
056 PortletPreferences portletPreferences)
057 throws PortletDataException {
058
059 long startTime = 0;
060
061 if (_log.isInfoEnabled()) {
062 _log.info("Adding default data to portlet " + portletId);
063
064 startTime = System.currentTimeMillis();
065 }
066
067 try {
068 return doAddDefaultData(
069 portletDataContext, portletId, portletPreferences);
070 }
071 catch (PortletDataException pde) {
072 throw pde;
073 }
074 catch (Exception e) {
075 throw new PortletDataException(e);
076 }
077 finally {
078 if (_log.isInfoEnabled()) {
079 long duration = System.currentTimeMillis() - startTime;
080
081 _log.info(
082 "Added default data to portlet in " +
083 Time.getDuration(duration));
084 }
085 }
086 }
087
088 @Override
089 public PortletPreferences deleteData(
090 PortletDataContext portletDataContext, String portletId,
091 PortletPreferences portletPreferences)
092 throws PortletDataException {
093
094 long startTime = 0;
095
096 if (_log.isInfoEnabled()) {
097 _log.info("Deleting portlet " + portletId);
098
099 startTime = System.currentTimeMillis();
100 }
101
102 try {
103 return doDeleteData(
104 portletDataContext, portletId, portletPreferences);
105 }
106 catch (PortletDataException pde) {
107 throw pde;
108 }
109 catch (Exception e) {
110 throw new PortletDataException(e);
111 }
112 finally {
113 if (_log.isInfoEnabled()) {
114 long duration = System.currentTimeMillis() - startTime;
115
116 _log.info("Deleted portlet in " + Time.getDuration(duration));
117 }
118 }
119 }
120
121 @Override
122 public String exportData(
123 PortletDataContext portletDataContext, String portletId,
124 PortletPreferences portletPreferences)
125 throws PortletDataException {
126
127 long startTime = 0;
128
129 if (_log.isInfoEnabled()) {
130 _log.info("Exporting portlet " + portletId);
131
132 startTime = System.currentTimeMillis();
133 }
134
135 try {
136 portletDataContext.addDeletionSystemEventStagedModelTypes(
137 getDeletionSystemEventStagedModelTypes());
138
139 for (PortletDataHandlerControl portletDataHandlerControl :
140 getExportControls()) {
141
142 addUncheckedModelAdditionCount(
143 portletDataContext, portletDataHandlerControl);
144 }
145
146 return doExportData(
147 portletDataContext, portletId, portletPreferences);
148 }
149 catch (PortletDataException pde) {
150 throw pde;
151 }
152 catch (Exception e) {
153 throw new PortletDataException(e);
154 }
155 finally {
156 if (_log.isInfoEnabled()) {
157 long duration = System.currentTimeMillis() - startTime;
158
159 _log.info("Exported portlet in " + Time.getDuration(duration));
160 }
161 }
162 }
163
164 @Override
165 public DataLevel getDataLevel() {
166 return _dataLevel;
167 }
168
169 @Override
170 public String[] getDataPortletPreferences() {
171 return _dataPortletPreferences;
172 }
173
174 @Override
175 public StagedModelType[] getDeletionSystemEventStagedModelTypes() {
176 return _deletionSystemEventStagedModelTypes;
177 }
178
179 @Override
180 public PortletDataHandlerControl[] getExportConfigurationControls(
181 long companyId, long groupId, Portlet portlet,
182 boolean privateLayout)
183 throws Exception {
184
185 return getExportConfigurationControls(
186 companyId, groupId, portlet, -1, privateLayout);
187 }
188
189 @Override
190 public PortletDataHandlerControl[] getExportConfigurationControls(
191 long companyId, long groupId, Portlet portlet, long plid,
192 boolean privateLayout)
193 throws Exception {
194
195 List<PortletDataHandlerBoolean> configurationControls =
196 new ArrayList<>();
197
198
199
200 if ((PortletPreferencesLocalServiceUtil.getPortletPreferencesCount(
201 PortletKeys.PREFS_OWNER_ID_DEFAULT,
202 PortletKeys.PREFS_OWNER_TYPE_LAYOUT, plid, portlet, false) >
203 0) ||
204 (PortletPreferencesLocalServiceUtil.getPortletPreferencesCount(
205 groupId, PortletKeys.PREFS_OWNER_TYPE_GROUP,
206 portlet.getRootPortletId(), false) > 0) ||
207 (PortletPreferencesLocalServiceUtil.getPortletPreferencesCount(
208 companyId, PortletKeys.PREFS_OWNER_TYPE_COMPANY,
209 portlet.getRootPortletId(), false) > 0)) {
210
211 PortletDataHandlerControl[] portletDataHandlerControls = null;
212
213 if (isDisplayPortlet()) {
214 portletDataHandlerControls = getExportControls();
215 }
216
217 configurationControls.add(
218 new PortletDataHandlerBoolean(
219 null, PortletDataHandlerKeys.PORTLET_SETUP, "setup",
220 true, false, portletDataHandlerControls, null, null));
221 }
222
223
224
225 if (PortletPreferencesLocalServiceUtil.getPortletPreferencesCount(
226 -1, PortletKeys.PREFS_OWNER_TYPE_ARCHIVED,
227 portlet.getRootPortletId(), false) > 0) {
228
229 configurationControls.add(
230 new PortletDataHandlerBoolean(
231 null, PortletDataHandlerKeys.PORTLET_ARCHIVED_SETUPS,
232 "archived-setups", true, false, null, null, null)
233 );
234 }
235
236
237
238 if ((PortletPreferencesLocalServiceUtil.getPortletPreferencesCount(
239 -1, PortletKeys.PREFS_OWNER_TYPE_USER, plid, portlet, false) >
240 0) ||
241 (PortletPreferencesLocalServiceUtil.getPortletPreferencesCount(
242 groupId, PortletKeys.PREFS_OWNER_TYPE_USER,
243 PortletKeys.PREFS_PLID_SHARED, portlet, false) > 0)) {
244
245 configurationControls.add(
246 new PortletDataHandlerBoolean(
247 null, PortletDataHandlerKeys.PORTLET_USER_PREFERENCES,
248 "user-preferences", true, false, null, null, null));
249 }
250
251 return configurationControls.toArray(
252 new PortletDataHandlerBoolean[configurationControls.size()]);
253 }
254
255 @Override
256 public PortletDataHandlerControl[] getExportControls() {
257 return _exportControls;
258 }
259
260 @Override
261 public PortletDataHandlerControl[] getExportMetadataControls() {
262 return _exportMetadataControls;
263 }
264
265 @Override
266 public long getExportModelCount(ManifestSummary manifestSummary) {
267 return getExportModelCount(manifestSummary, getExportControls());
268 }
269
270 @Override
271 public PortletDataHandlerControl[] getImportConfigurationControls(
272 Portlet portlet, ManifestSummary manifestSummary) {
273
274 String[] configurationPortletOptions =
275 manifestSummary.getConfigurationPortletOptions(
276 portlet.getRootPortletId());
277
278 return getImportConfigurationControls(configurationPortletOptions);
279 }
280
281 @Override
282 public PortletDataHandlerControl[] getImportConfigurationControls(
283 String[] configurationPortletOptions) {
284
285 List<PortletDataHandlerBoolean> configurationControls =
286 new ArrayList<>();
287
288
289
290 if (ArrayUtil.contains(configurationPortletOptions, "setup")) {
291 PortletDataHandlerControl[] portletDataHandlerControls = null;
292
293 if (isDisplayPortlet()) {
294 portletDataHandlerControls = getExportControls();
295 }
296
297 configurationControls.add(
298 new PortletDataHandlerBoolean(
299 null, PortletDataHandlerKeys.PORTLET_SETUP, "setup", true,
300 false, portletDataHandlerControls, null, null));
301 }
302
303
304
305 if (ArrayUtil.contains(
306 configurationPortletOptions, "archived-setups")) {
307
308 configurationControls.add(
309 new PortletDataHandlerBoolean(
310 null, PortletDataHandlerKeys.PORTLET_ARCHIVED_SETUPS,
311 "archived-setups", true, false, null, null, null));
312 }
313
314
315
316 if (ArrayUtil.contains(
317 configurationPortletOptions, "user-preferences")) {
318
319 configurationControls.add(
320 new PortletDataHandlerBoolean(
321 null, PortletDataHandlerKeys.PORTLET_USER_PREFERENCES,
322 "user-preferences", true, false, null, null, null));
323 }
324
325 return configurationControls.toArray(
326 new PortletDataHandlerBoolean[configurationControls.size()]);
327 }
328
329 @Override
330 public PortletDataHandlerControl[] getImportControls() {
331 return _importControls;
332 }
333
334 @Override
335 public PortletDataHandlerControl[] getImportMetadataControls() {
336 return _importMetadataControls;
337 }
338
339 @Override
340 public String getPortletId() {
341 return _portletId;
342 }
343
344 @Override
345 public String getServiceName() {
346 return null;
347 }
348
349 @Override
350 public PortletPreferences importData(
351 PortletDataContext portletDataContext, String portletId,
352 PortletPreferences portletPreferences, String data)
353 throws PortletDataException {
354
355 long startTime = 0;
356
357 if (_log.isInfoEnabled()) {
358 _log.info("Importing portlet " + portletId);
359
360 startTime = System.currentTimeMillis();
361 }
362
363 long sourceGroupId = portletDataContext.getSourceGroupId();
364
365 try {
366 if (Validator.isXml(data)) {
367 addImportDataRootElement(portletDataContext, data);
368 }
369
370 return doImportData(
371 portletDataContext, portletId, portletPreferences, data);
372 }
373 catch (PortletDataException pde) {
374 throw pde;
375 }
376 catch (Exception e) {
377 throw new PortletDataException(e);
378 }
379 finally {
380 portletDataContext.setSourceGroupId(sourceGroupId);
381
382 if (_log.isInfoEnabled()) {
383 long duration = System.currentTimeMillis() - startTime;
384
385 _log.info("Imported portlet in " + Time.getDuration(duration));
386 }
387 }
388 }
389
390 @Override
391 public boolean isDataAlwaysStaged() {
392 return _dataAlwaysStaged;
393 }
394
395 @Override
396 public boolean isDataLocalized() {
397 return _dataLocalized;
398 }
399
400 @Override
401 public boolean isDataPortalLevel() {
402 return _dataLevel.equals(DataLevel.PORTAL);
403 }
404
405 @Override
406 public boolean isDataPortletInstanceLevel() {
407 return _dataLevel.equals(DataLevel.PORTLET_INSTANCE);
408 }
409
410 @Override
411 public boolean isDataSiteLevel() {
412 return _dataLevel.equals(DataLevel.SITE);
413 }
414
415 @Override
416 public boolean isDisplayPortlet() {
417 if (isDataPortletInstanceLevel() &&
418 !ArrayUtil.isEmpty(getDataPortletPreferences())) {
419
420 return true;
421 }
422
423 return false;
424 }
425
426 @Override
427 public boolean isPublishToLiveByDefault() {
428 return _publishToLiveByDefault;
429 }
430
431 @Override
432 public boolean isRollbackOnException() {
433
434
435
436
437
438
439
440 return true;
441 }
442
443 @Override
444 public boolean isSupportsDataStrategyCopyAsNew() {
445 return _supportsDataStrategyCopyAsNew;
446 }
447
448 @Override
449 public void prepareManifestSummary(PortletDataContext portletDataContext)
450 throws PortletDataException {
451
452 prepareManifestSummary(portletDataContext, null);
453 }
454
455 @Override
456 public void prepareManifestSummary(
457 PortletDataContext portletDataContext,
458 PortletPreferences portletPreferences)
459 throws PortletDataException {
460
461 try {
462 doPrepareManifestSummary(portletDataContext, portletPreferences);
463 }
464 catch (PortletDataException pde) {
465 throw pde;
466 }
467 catch (Exception e) {
468 throw new PortletDataException(e);
469 }
470 }
471
472 @Override
473 public PortletPreferences processExportPortletPreferences(
474 PortletDataContext portletDataContext, String portletId,
475 PortletPreferences portletPreferences)
476 throws PortletDataException {
477
478 exportDisplayStyle(portletDataContext, portletId, portletPreferences);
479
480 try {
481 return doProcessExportPortletPreferences(
482 portletDataContext, portletId, portletPreferences);
483 }
484 catch (PortletDataException pde) {
485 throw pde;
486 }
487 catch (Exception e) {
488 throw new PortletDataException(e);
489 }
490 }
491
492 @Override
493 public PortletPreferences processImportPortletPreferences(
494 PortletDataContext portletDataContext, String portletId,
495 PortletPreferences portletPreferences)
496 throws PortletDataException {
497
498 try {
499 importDisplayStyle(
500 portletDataContext, portletId, portletPreferences);
501
502 return doProcessImportPortletPreferences(
503 portletDataContext, portletId, portletPreferences);
504 }
505 catch (PortletDataException pde) {
506 throw pde;
507 }
508 catch (Exception e) {
509 throw new PortletDataException(e);
510 }
511 }
512
513 @Override
514 public void setPortletId(String portletId) {
515 _portletId = portletId;
516 }
517
518 protected Element addExportDataRootElement(
519 PortletDataContext portletDataContext) {
520
521 Document document = SAXReaderUtil.createDocument();
522
523 Class<?> clazz = getClass();
524
525 Element rootElement = document.addElement(clazz.getSimpleName());
526
527 portletDataContext.setExportDataRootElement(rootElement);
528
529 return rootElement;
530 }
531
532 protected Element addImportDataRootElement(
533 PortletDataContext portletDataContext, String data)
534 throws DocumentException {
535
536 Document document = SAXReaderUtil.read(data);
537
538 Element rootElement = document.getRootElement();
539
540 portletDataContext.setImportDataRootElement(rootElement);
541
542 long groupId = GetterUtil.getLong(
543 rootElement.attributeValue("group-id"));
544
545 if (groupId != 0) {
546 portletDataContext.setSourceGroupId(groupId);
547 }
548
549 return rootElement;
550 }
551
552 protected void addUncheckedModelAdditionCount(
553 PortletDataContext portletDataContext,
554 PortletDataHandlerControl portletDataHandlerControl) {
555
556 if (!(portletDataHandlerControl instanceof PortletDataHandlerBoolean)) {
557 return;
558 }
559
560 PortletDataHandlerBoolean portletDataHandlerBoolean =
561 (PortletDataHandlerBoolean)portletDataHandlerControl;
562
563 PortletDataHandlerControl[] childPortletDataHandlerControls =
564 portletDataHandlerBoolean.getChildren();
565
566 if (childPortletDataHandlerControls != null) {
567 for (PortletDataHandlerControl childPortletDataHandlerControl :
568 childPortletDataHandlerControls) {
569
570 addUncheckedModelAdditionCount(
571 portletDataContext, childPortletDataHandlerControl);
572 }
573 }
574
575 if (Validator.isNull(portletDataHandlerControl.getClassName())) {
576 return;
577 }
578
579 boolean checkedControl = GetterUtil.getBoolean(
580 portletDataContext.getBooleanParameter(
581 portletDataHandlerControl.getNamespace(),
582 portletDataHandlerControl.getControlName(), false));
583
584 if (!checkedControl) {
585 ManifestSummary manifestSummary =
586 portletDataContext.getManifestSummary();
587
588 String manifestSummaryKey = ManifestSummary.getManifestSummaryKey(
589 portletDataHandlerControl.getClassName(),
590 portletDataHandlerBoolean.getReferrerClassName());
591
592 manifestSummary.addModelAdditionCount(manifestSummaryKey, 0);
593 }
594 }
595
596 protected PortletPreferences doAddDefaultData(
597 PortletDataContext portletDataContext, String portletId,
598 PortletPreferences portletPreferences)
599 throws Exception {
600
601 return portletPreferences;
602 }
603
604 protected PortletPreferences doDeleteData(
605 PortletDataContext portletDataContext, String portletId,
606 PortletPreferences portletPreferences)
607 throws Exception {
608
609 return portletPreferences;
610 }
611
612 protected String doExportData(
613 PortletDataContext portletDataContext, String portletId,
614 PortletPreferences portletPreferences)
615 throws Exception {
616
617 return null;
618 }
619
620 protected PortletPreferences doImportData(
621 PortletDataContext portletDataContext, String portletId,
622 PortletPreferences portletPreferences, String data)
623 throws Exception {
624
625 return null;
626 }
627
628 protected void doPrepareManifestSummary(
629 PortletDataContext portletDataContext,
630 PortletPreferences portletPreferences)
631 throws Exception {
632 }
633
634 protected PortletPreferences doProcessExportPortletPreferences(
635 PortletDataContext portletDataContext, String portletId,
636 PortletPreferences portletPreferences)
637 throws Exception {
638
639 return portletPreferences;
640 }
641
642 protected PortletPreferences doProcessImportPortletPreferences(
643 PortletDataContext portletDataContext, String portletId,
644 PortletPreferences portletPreferences)
645 throws Exception {
646
647 return portletPreferences;
648 }
649
650 protected void exportDisplayStyle(
651 PortletDataContext portletDataContext, String portletId,
652 PortletPreferences portletPreferences)
653 throws PortletDataException {
654
655 String displayStyle = getDisplayStyle(
656 portletDataContext, portletId, portletPreferences);
657
658 if (Validator.isNull(displayStyle) ||
659 !displayStyle.startsWith(
660 PortletDisplayTemplate.DISPLAY_STYLE_PREFIX)) {
661
662 return;
663 }
664
665 long displayStyleGroupId = getDisplayStyleGroupId(
666 portletDataContext, portletId, portletPreferences);
667
668 long previousScopeGroupId = portletDataContext.getScopeGroupId();
669
670 if (displayStyleGroupId != portletDataContext.getScopeGroupId()) {
671 portletDataContext.setScopeGroupId(displayStyleGroupId);
672 }
673
674 DDMTemplate ddmTemplate =
675 PortletDisplayTemplateUtil.getPortletDisplayTemplateDDMTemplate(
676 portletDataContext.getGroupId(),
677 getClassNameId(portletDataContext, portletId), displayStyle);
678
679 if (ddmTemplate != null) {
680 StagedModelDataHandlerUtil.exportReferenceStagedModel(
681 portletDataContext, portletId, ddmTemplate);
682 }
683
684 portletDataContext.setScopeGroupId(previousScopeGroupId);
685 }
686
687 protected long getClassNameId(
688 PortletDataContext portletDataContext, String portletId) {
689
690 Portlet portlet = PortletLocalServiceUtil.getPortletById(
691 portletDataContext.getCompanyId(), portletId);
692
693 TemplateHandler templateHandler = portlet.getTemplateHandlerInstance();
694
695 if (templateHandler == null) {
696 return 0;
697 }
698
699 String className = templateHandler.getClassName();
700
701 return PortalUtil.getClassNameId(className);
702 }
703
704 protected String getDisplayStyle(
705 PortletDataContext portletDataContext, String portletId,
706 PortletPreferences portletPreferences) {
707
708 try {
709 Portlet portlet = PortletLocalServiceUtil.getPortletById(
710 portletDataContext.getCompanyId(), portletId);
711
712 if (Validator.isNotNull(portlet.getTemplateHandlerClass())) {
713 return portletPreferences.getValue("displayStyle", null);
714 }
715 }
716 catch (Exception e) {
717 }
718
719 return null;
720 }
721
722 protected long getDisplayStyleGroupId(
723 PortletDataContext portletDataContext, String portletId,
724 PortletPreferences portletPreferences) {
725
726 try {
727 Portlet portlet = PortletLocalServiceUtil.getPortletById(
728 portletDataContext.getCompanyId(), portletId);
729
730 if (Validator.isNotNull(portlet.getTemplateHandlerClass())) {
731 return GetterUtil.getLong(
732 portletPreferences.getValue("displayStyleGroupId", null));
733 }
734 }
735 catch (Exception e) {
736 }
737
738 return 0;
739 }
740
741 protected String getExportDataRootElementString(Element rootElement) {
742 if (rootElement == null) {
743 return StringPool.BLANK;
744 }
745
746 try {
747 Document document = rootElement.getDocument();
748
749 return document.formattedString();
750 }
751 catch (IOException ioe) {
752 return StringPool.BLANK;
753 }
754 }
755
756 protected long getExportModelCount(
757 ManifestSummary manifestSummary,
758 PortletDataHandlerControl[] portletDataHandlerControls) {
759
760 long totalModelCount = -1;
761
762 for (PortletDataHandlerControl portletDataHandlerControl :
763 portletDataHandlerControls) {
764
765 long modelCount = manifestSummary.getModelAdditionCount(
766 portletDataHandlerControl.getClassName(),
767 portletDataHandlerControl.getReferrerClassName());
768
769 if (portletDataHandlerControl
770 instanceof PortletDataHandlerBoolean) {
771
772 PortletDataHandlerBoolean portletDataHandlerBoolean =
773 (PortletDataHandlerBoolean)portletDataHandlerControl;
774
775 PortletDataHandlerControl[] childPortletDataHandlerControls =
776 portletDataHandlerBoolean.getChildren();
777
778 if (childPortletDataHandlerControls != null) {
779 long childModelCount = getExportModelCount(
780 manifestSummary, childPortletDataHandlerControls);
781
782 if (childModelCount != -1) {
783 if (modelCount == -1) {
784 modelCount = childModelCount;
785 }
786 else {
787 modelCount += childModelCount;
788 }
789 }
790 }
791 }
792
793 if (modelCount == -1) {
794 continue;
795 }
796
797 if (totalModelCount == -1) {
798 totalModelCount = modelCount;
799 }
800 else {
801 totalModelCount += modelCount;
802 }
803 }
804
805 return totalModelCount;
806 }
807
808 protected void importDisplayStyle(
809 PortletDataContext portletDataContext, String portletId,
810 PortletPreferences portletPreferences)
811 throws Exception {
812
813 String displayStyle = getDisplayStyle(
814 portletDataContext, portletId, portletPreferences);
815
816 if (Validator.isNull(displayStyle) ||
817 !displayStyle.startsWith(
818 PortletDisplayTemplate.DISPLAY_STYLE_PREFIX)) {
819
820 return;
821 }
822
823 StagedModelDataHandlerUtil.importReferenceStagedModels(
824 portletDataContext, DDMTemplate.class);
825
826 long displayStyleGroupId = getDisplayStyleGroupId(
827 portletDataContext, portletId, portletPreferences);
828
829 Map<Long, Long> groupIds =
830 (Map<Long, Long>)portletDataContext.getNewPrimaryKeysMap(
831 Group.class);
832
833 long groupId = MapUtil.getLong(
834 groupIds, displayStyleGroupId, displayStyleGroupId);
835
836 DDMTemplate ddmTemplate =
837 PortletDisplayTemplateUtil.getPortletDisplayTemplateDDMTemplate(
838 groupId, getClassNameId(portletDataContext, portletId),
839 displayStyle);
840
841 if (ddmTemplate != null) {
842 portletPreferences.setValue(
843 "displayStyleGroupId",
844 String.valueOf(ddmTemplate.getGroupId()));
845 }
846 else {
847 portletPreferences.setValue(
848 "displayStyleGroupId", StringPool.BLANK);
849 }
850 }
851
852
855 @Deprecated
856 protected void setAlwaysExportable(boolean alwaysExportable) {
857 }
858
859
862 @Deprecated
863 protected void setAlwaysStaged(boolean alwaysStaged) {
864 }
865
866 protected void setDataAlwaysStaged(boolean dataAlwaysStaged) {
867 _dataAlwaysStaged = dataAlwaysStaged;
868 }
869
870 protected void setDataLevel(DataLevel dataLevel) {
871 _dataLevel = dataLevel;
872 }
873
874 protected void setDataLocalized(boolean dataLocalized) {
875 _dataLocalized = dataLocalized;
876 }
877
878 protected void setDataPortletPreferences(String... dataPortletPreferences) {
879 _dataPortletPreferences = dataPortletPreferences;
880 }
881
882 protected void setDeletionSystemEventStagedModelTypes(
883 StagedModelType... deletionSystemEventStagedModelTypes) {
884
885 _deletionSystemEventStagedModelTypes =
886 deletionSystemEventStagedModelTypes;
887 }
888
889 protected void setExportControls(
890 PortletDataHandlerControl... exportControls) {
891
892 _exportControls = exportControls;
893
894 setImportControls(exportControls);
895 }
896
897 protected void setExportMetadataControls(
898 PortletDataHandlerControl... exportMetadataControls) {
899
900 _exportMetadataControls = exportMetadataControls;
901
902 setImportMetadataControls(exportMetadataControls);
903 }
904
905 protected void setImportControls(
906 PortletDataHandlerControl... importControls) {
907
908 _importControls = importControls;
909 }
910
911 protected void setImportMetadataControls(
912 PortletDataHandlerControl... importMetadataControls) {
913
914 _importMetadataControls = importMetadataControls;
915 }
916
917 protected void setPublishToLiveByDefault(boolean publishToLiveByDefault) {
918 _publishToLiveByDefault = publishToLiveByDefault;
919 }
920
921 protected void setSupportsDataStrategyCopyAsNew(
922 boolean supportsDataStrategyCopyAsNew) {
923
924 _supportsDataStrategyCopyAsNew = supportsDataStrategyCopyAsNew;
925 }
926
927 private static final Log _log = LogFactoryUtil.getLog(
928 BasePortletDataHandler.class);
929
930 private boolean _dataAlwaysStaged;
931 private DataLevel _dataLevel = DataLevel.SITE;
932 private boolean _dataLocalized;
933 private String[] _dataPortletPreferences = StringPool.EMPTY_ARRAY;
934 private StagedModelType[] _deletionSystemEventStagedModelTypes =
935 new StagedModelType[0];
936 private PortletDataHandlerControl[] _exportControls =
937 new PortletDataHandlerControl[0];
938 private PortletDataHandlerControl[] _exportMetadataControls =
939 new PortletDataHandlerControl[0];
940 private PortletDataHandlerControl[] _importControls =
941 new PortletDataHandlerControl[0];
942 private PortletDataHandlerControl[] _importMetadataControls =
943 new PortletDataHandlerControl[0];
944 private String _portletId;
945 private boolean _publishToLiveByDefault;
946 private boolean _supportsDataStrategyCopyAsNew = true;
947
948 }