001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
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.util.ArrayUtil;
020    import com.liferay.portal.kernel.util.GetterUtil;
021    import com.liferay.portal.kernel.util.StringPool;
022    import com.liferay.portal.kernel.util.Time;
023    import com.liferay.portal.kernel.util.Validator;
024    import com.liferay.portal.kernel.xml.Document;
025    import com.liferay.portal.kernel.xml.DocumentException;
026    import com.liferay.portal.kernel.xml.Element;
027    import com.liferay.portal.kernel.xml.SAXReaderUtil;
028    import com.liferay.portal.model.Portlet;
029    import com.liferay.portal.service.PortletPreferencesLocalServiceUtil;
030    import com.liferay.portal.util.PortletKeys;
031    
032    import java.io.IOException;
033    
034    import java.util.ArrayList;
035    import java.util.List;
036    
037    import javax.portlet.PortletPreferences;
038    
039    /**
040     * @author Brian Wing Shun Chan
041     */
042    public abstract class BasePortletDataHandler implements PortletDataHandler {
043    
044            @Override
045            public PortletPreferences addDefaultData(
046                            PortletDataContext portletDataContext, String portletId,
047                            PortletPreferences portletPreferences)
048                    throws PortletDataException {
049    
050                    long startTime = 0;
051    
052                    if (_log.isInfoEnabled()) {
053                            _log.info("Adding default data to portlet " + portletId);
054    
055                            startTime = System.currentTimeMillis();
056                    }
057    
058                    try {
059                            return doAddDefaultData(
060                                    portletDataContext, portletId, portletPreferences);
061                    }
062                    catch (PortletDataException pde) {
063                            throw pde;
064                    }
065                    catch (Exception e) {
066                            throw new PortletDataException(e);
067                    }
068                    finally {
069                            if (_log.isInfoEnabled()) {
070                                    long duration = System.currentTimeMillis() - startTime;
071    
072                                    _log.info(
073                                            "Added default data to portlet in " +
074                                                    Time.getDuration(duration));
075                            }
076                    }
077            }
078    
079            @Override
080            public PortletPreferences deleteData(
081                            PortletDataContext portletDataContext, String portletId,
082                            PortletPreferences portletPreferences)
083                    throws PortletDataException {
084    
085                    long startTime = 0;
086    
087                    if (_log.isInfoEnabled()) {
088                            _log.info("Deleting portlet " + portletId);
089    
090                            startTime = System.currentTimeMillis();
091                    }
092    
093                    try {
094                            return doDeleteData(
095                                    portletDataContext, portletId, portletPreferences);
096                    }
097                    catch (PortletDataException pde) {
098                            throw pde;
099                    }
100                    catch (Exception e) {
101                            throw new PortletDataException(e);
102                    }
103                    finally {
104                            if (_log.isInfoEnabled()) {
105                                    long duration = System.currentTimeMillis() - startTime;
106    
107                                    _log.info("Deleted portlet in " + Time.getDuration(duration));
108                            }
109                    }
110            }
111    
112            @Override
113            public String exportData(
114                            PortletDataContext portletDataContext, String portletId,
115                            PortletPreferences portletPreferences)
116                    throws PortletDataException {
117    
118                    long startTime = 0;
119    
120                    if (_log.isInfoEnabled()) {
121                            _log.info("Exporting portlet " + portletId);
122    
123                            startTime = System.currentTimeMillis();
124                    }
125    
126                    try {
127                            portletDataContext.addDeletionSystemEventStagedModelTypes(
128                                    getDeletionSystemEventStagedModelTypes());
129    
130                            for (PortletDataHandlerControl portletDataHandlerControl :
131                                            getExportControls()) {
132    
133                                    addUncheckedModelAdditionCount(
134                                            portletDataContext, portletDataHandlerControl);
135                            }
136    
137                            return doExportData(
138                                    portletDataContext, portletId, portletPreferences);
139                    }
140                    catch (PortletDataException pde) {
141                            throw pde;
142                    }
143                    catch (Exception e) {
144                            throw new PortletDataException(e);
145                    }
146                    finally {
147                            if (_log.isInfoEnabled()) {
148                                    long duration = System.currentTimeMillis() - startTime;
149    
150                                    _log.info("Exported portlet in " + Time.getDuration(duration));
151                            }
152                    }
153            }
154    
155            @Override
156            public DataLevel getDataLevel() {
157                    return _dataLevel;
158            }
159    
160            @Override
161            public String[] getDataPortletPreferences() {
162                    return _dataPortletPreferences;
163            }
164    
165            @Override
166            public StagedModelType[] getDeletionSystemEventStagedModelTypes() {
167                    return _deletionSystemEventStagedModelTypes;
168            }
169    
170            @Override
171            public PortletDataHandlerControl[] getExportConfigurationControls(
172                            long companyId, long groupId, Portlet portlet,
173                            boolean privateLayout)
174                    throws Exception {
175    
176                    return getExportConfigurationControls(
177                            companyId, groupId, portlet, -1, privateLayout);
178            }
179    
180            @Override
181            public PortletDataHandlerControl[] getExportConfigurationControls(
182                            long companyId, long groupId, Portlet portlet, long plid,
183                            boolean privateLayout)
184                    throws Exception {
185    
186                    List<PortletDataHandlerBoolean> configurationControls =
187                            new ArrayList<>();
188    
189                    // Setup
190    
191                    if ((PortletPreferencesLocalServiceUtil.getPortletPreferencesCount(
192                                    PortletKeys.PREFS_OWNER_ID_DEFAULT,
193                                    PortletKeys.PREFS_OWNER_TYPE_LAYOUT, plid, portlet, false) >
194                                            0) ||
195                            (PortletPreferencesLocalServiceUtil.getPortletPreferencesCount(
196                                    groupId, PortletKeys.PREFS_OWNER_TYPE_GROUP,
197                                    portlet.getRootPortletId(), false) > 0) ||
198                            (PortletPreferencesLocalServiceUtil.getPortletPreferencesCount(
199                                    companyId, PortletKeys.PREFS_OWNER_TYPE_COMPANY,
200                                    portlet.getRootPortletId(), false) > 0)) {
201    
202                                    PortletDataHandlerControl[] portletDataHandlerControls = null;
203    
204                                    if (isDisplayPortlet()) {
205                                            portletDataHandlerControls = getExportControls();
206                                    }
207    
208                                    configurationControls.add(
209                                            new PortletDataHandlerBoolean(
210                                                    null, PortletDataHandlerKeys.PORTLET_SETUP, "setup",
211                                                    true, false, portletDataHandlerControls, null, null));
212                    }
213    
214                    // Archived setups
215    
216                    if (PortletPreferencesLocalServiceUtil.getPortletPreferencesCount(
217                                    -1, PortletKeys.PREFS_OWNER_TYPE_ARCHIVED,
218                                    portlet.getRootPortletId(), false) > 0) {
219    
220                            configurationControls.add(
221                                    new PortletDataHandlerBoolean(
222                                            null, PortletDataHandlerKeys.PORTLET_ARCHIVED_SETUPS,
223                                            "archived-setups", true, false, null, null, null)
224                            );
225                    }
226    
227                    // User preferences
228    
229                    if ((PortletPreferencesLocalServiceUtil.getPortletPreferencesCount(
230                                    -1, PortletKeys.PREFS_OWNER_TYPE_USER, plid, portlet, false) >
231                                            0) ||
232                            (PortletPreferencesLocalServiceUtil.getPortletPreferencesCount(
233                                    groupId, PortletKeys.PREFS_OWNER_TYPE_USER,
234                                    PortletKeys.PREFS_PLID_SHARED, portlet, false) > 0)) {
235    
236                            configurationControls.add(
237                                    new PortletDataHandlerBoolean(
238                                            null, PortletDataHandlerKeys.PORTLET_USER_PREFERENCES,
239                                            "user-preferences", true, false, null, null, null));
240                    }
241    
242                    return configurationControls.toArray(
243                            new PortletDataHandlerBoolean[configurationControls.size()]);
244            }
245    
246            @Override
247            public PortletDataHandlerControl[] getExportControls() {
248                    return _exportControls;
249            }
250    
251            @Override
252            public PortletDataHandlerControl[] getExportMetadataControls() {
253                    return _exportMetadataControls;
254            }
255    
256            @Override
257            public long getExportModelCount(ManifestSummary manifestSummary) {
258                    return getExportModelCount(manifestSummary, getExportControls());
259            }
260    
261            @Override
262            public PortletDataHandlerControl[] getImportConfigurationControls(
263                    Portlet portlet, ManifestSummary manifestSummary) {
264    
265                    String[] configurationPortletOptions =
266                            manifestSummary.getConfigurationPortletOptions(
267                                    portlet.getRootPortletId());
268    
269                    return getImportConfigurationControls(configurationPortletOptions);
270            }
271    
272            @Override
273            public PortletDataHandlerControl[] getImportConfigurationControls(
274                    String[] configurationPortletOptions) {
275    
276                    List<PortletDataHandlerBoolean> configurationControls =
277                            new ArrayList<>();
278    
279                    // Setup
280    
281                    if (ArrayUtil.contains(configurationPortletOptions, "setup")) {
282                            PortletDataHandlerControl[] portletDataHandlerControls = null;
283    
284                            if (isDisplayPortlet()) {
285                                    portletDataHandlerControls = getExportControls();
286                            }
287    
288                            configurationControls.add(
289                                    new PortletDataHandlerBoolean(
290                                            null, PortletDataHandlerKeys.PORTLET_SETUP, "setup", true,
291                                            false, portletDataHandlerControls, null, null));
292                    }
293    
294                    // Archived setups
295    
296                    if (ArrayUtil.contains(
297                                    configurationPortletOptions, "archived-setups")) {
298    
299                            configurationControls.add(
300                                    new PortletDataHandlerBoolean(
301                                            null, PortletDataHandlerKeys.PORTLET_ARCHIVED_SETUPS,
302                                            "archived-setups", true, false, null, null, null));
303                    }
304    
305                    // User preferences
306    
307                    if (ArrayUtil.contains(
308                                    configurationPortletOptions, "user-preferences")) {
309    
310                            configurationControls.add(
311                                    new PortletDataHandlerBoolean(
312                                            null, PortletDataHandlerKeys.PORTLET_USER_PREFERENCES,
313                                            "user-preferences", true, false, null, null, null));
314                    }
315    
316                    return configurationControls.toArray(
317                            new PortletDataHandlerBoolean[configurationControls.size()]);
318            }
319    
320            @Override
321            public PortletDataHandlerControl[] getImportControls() {
322                    return _importControls;
323            }
324    
325            @Override
326            public PortletDataHandlerControl[] getImportMetadataControls() {
327                    return _importMetadataControls;
328            }
329    
330            @Override
331            public String getPortletId() {
332                    return _portletId;
333            }
334    
335            @Override
336            public int getRank() {
337                    return _rank;
338            }
339    
340            @Override
341            public String getServiceName() {
342                    return null;
343            }
344    
345            @Override
346            public PortletPreferences importData(
347                            PortletDataContext portletDataContext, String portletId,
348                            PortletPreferences portletPreferences, String data)
349                    throws PortletDataException {
350    
351                    long startTime = 0;
352    
353                    if (_log.isInfoEnabled()) {
354                            _log.info("Importing portlet " + portletId);
355    
356                            startTime = System.currentTimeMillis();
357                    }
358    
359                    long sourceGroupId = portletDataContext.getSourceGroupId();
360    
361                    try {
362                            if (Validator.isXml(data)) {
363                                    addImportDataRootElement(portletDataContext, data);
364                            }
365    
366                            return doImportData(
367                                    portletDataContext, portletId, portletPreferences, data);
368                    }
369                    catch (PortletDataException pde) {
370                            throw pde;
371                    }
372                    catch (Exception e) {
373                            throw new PortletDataException(e);
374                    }
375                    finally {
376                            portletDataContext.setSourceGroupId(sourceGroupId);
377    
378                            if (_log.isInfoEnabled()) {
379                                    long duration = System.currentTimeMillis() - startTime;
380    
381                                    _log.info("Imported portlet in " + Time.getDuration(duration));
382                            }
383                    }
384            }
385    
386            @Override
387            public boolean isDataAlwaysStaged() {
388                    return _dataAlwaysStaged;
389            }
390    
391            @Override
392            public boolean isDataLocalized() {
393                    return _dataLocalized;
394            }
395    
396            @Override
397            public boolean isDataPortalLevel() {
398                    return _dataLevel.equals(DataLevel.PORTAL);
399            }
400    
401            @Override
402            public boolean isDataPortletInstanceLevel() {
403                    return _dataLevel.equals(DataLevel.PORTLET_INSTANCE);
404            }
405    
406            @Override
407            public boolean isDataSiteLevel() {
408                    return _dataLevel.equals(DataLevel.SITE);
409            }
410    
411            @Override
412            public boolean isDisplayPortlet() {
413                    if (isDataPortletInstanceLevel() &&
414                            !ArrayUtil.isEmpty(getDataPortletPreferences())) {
415    
416                            return true;
417                    }
418    
419                    return false;
420            }
421    
422            @Override
423            public boolean isPublishToLiveByDefault() {
424                    return _publishToLiveByDefault;
425            }
426    
427            @Override
428            public boolean isRollbackOnException() {
429    
430                    // For now, we are going to throw an exception if one portlet data
431                    // handler has an exception to ensure that the transaction is rolled
432                    // back for data integrity. We may decide that this is not the best
433                    // behavior in the future because a bad plugin could prevent deletion of
434                    // groups.
435    
436                    return true;
437            }
438    
439            @Override
440            public boolean isSupportsDataStrategyCopyAsNew() {
441                    return _supportsDataStrategyCopyAsNew;
442            }
443    
444            @Override
445            public void prepareManifestSummary(PortletDataContext portletDataContext)
446                    throws PortletDataException {
447    
448                    prepareManifestSummary(portletDataContext, null);
449            }
450    
451            @Override
452            public void prepareManifestSummary(
453                            PortletDataContext portletDataContext,
454                            PortletPreferences portletPreferences)
455                    throws PortletDataException {
456    
457                    try {
458                            doPrepareManifestSummary(portletDataContext, portletPreferences);
459                    }
460                    catch (PortletDataException pde) {
461                            throw pde;
462                    }
463                    catch (Exception e) {
464                            throw new PortletDataException(e);
465                    }
466            }
467    
468            @Override
469            public PortletPreferences processExportPortletPreferences(
470                            PortletDataContext portletDataContext, String portletId,
471                            PortletPreferences portletPreferences)
472                    throws PortletDataException {
473    
474                    try {
475                            return doProcessExportPortletPreferences(
476                                    portletDataContext, portletId, portletPreferences);
477                    }
478                    catch (PortletDataException pde) {
479                            throw pde;
480                    }
481                    catch (Exception e) {
482                            throw new PortletDataException(e);
483                    }
484            }
485    
486            @Override
487            public PortletPreferences processImportPortletPreferences(
488                            PortletDataContext portletDataContext, String portletId,
489                            PortletPreferences portletPreferences)
490                    throws PortletDataException {
491    
492                    try {
493                            return doProcessImportPortletPreferences(
494                                    portletDataContext, portletId, portletPreferences);
495                    }
496                    catch (PortletDataException pde) {
497                            throw pde;
498                    }
499                    catch (Exception e) {
500                            throw new PortletDataException(e);
501                    }
502            }
503    
504            @Override
505            public void setPortletId(String portletId) {
506                    _portletId = portletId;
507            }
508    
509            @Override
510            public void setRank(int rank) {
511                    _rank = rank;
512            }
513    
514            protected Element addExportDataRootElement(
515                    PortletDataContext portletDataContext) {
516    
517                    Document document = SAXReaderUtil.createDocument();
518    
519                    Class<?> clazz = getClass();
520    
521                    Element rootElement = document.addElement(clazz.getSimpleName());
522    
523                    portletDataContext.setExportDataRootElement(rootElement);
524    
525                    return rootElement;
526            }
527    
528            protected Element addImportDataRootElement(
529                            PortletDataContext portletDataContext, String data)
530                    throws DocumentException {
531    
532                    Document document = SAXReaderUtil.read(data);
533    
534                    Element rootElement = document.getRootElement();
535    
536                    portletDataContext.setImportDataRootElement(rootElement);
537    
538                    long groupId = GetterUtil.getLong(
539                            rootElement.attributeValue("group-id"));
540    
541                    if (groupId != 0) {
542                            portletDataContext.setSourceGroupId(groupId);
543                    }
544    
545                    return rootElement;
546            }
547    
548            protected void addUncheckedModelAdditionCount(
549                    PortletDataContext portletDataContext,
550                    PortletDataHandlerControl portletDataHandlerControl) {
551    
552                    if (!(portletDataHandlerControl instanceof PortletDataHandlerBoolean)) {
553                            return;
554                    }
555    
556                    PortletDataHandlerBoolean portletDataHandlerBoolean =
557                            (PortletDataHandlerBoolean)portletDataHandlerControl;
558    
559                    PortletDataHandlerControl[] childPortletDataHandlerControls =
560                            portletDataHandlerBoolean.getChildren();
561    
562                    if (childPortletDataHandlerControls != null) {
563                            for (PortletDataHandlerControl childPortletDataHandlerControl :
564                                            childPortletDataHandlerControls) {
565    
566                                    addUncheckedModelAdditionCount(
567                                            portletDataContext, childPortletDataHandlerControl);
568                            }
569                    }
570    
571                    if (Validator.isNull(portletDataHandlerControl.getClassName())) {
572                            return;
573                    }
574    
575                    boolean checkedControl = GetterUtil.getBoolean(
576                            portletDataContext.getBooleanParameter(
577                                    portletDataHandlerControl.getNamespace(),
578                                    portletDataHandlerControl.getControlName(), false));
579    
580                    if (!checkedControl) {
581                            ManifestSummary manifestSummary =
582                                    portletDataContext.getManifestSummary();
583    
584                            StagedModelType stagedModelType = new StagedModelType(
585                                    portletDataHandlerControl.getClassName(),
586                                    portletDataHandlerBoolean.getReferrerClassName());
587    
588                            String manifestSummaryKey = ManifestSummary.getManifestSummaryKey(
589                                    stagedModelType);
590    
591                            manifestSummary.addModelAdditionCount(manifestSummaryKey, 0);
592                    }
593            }
594    
595            protected PortletPreferences doAddDefaultData(
596                            PortletDataContext portletDataContext, String portletId,
597                            PortletPreferences portletPreferences)
598                    throws Exception {
599    
600                    return portletPreferences;
601            }
602    
603            protected PortletPreferences doDeleteData(
604                            PortletDataContext portletDataContext, String portletId,
605                            PortletPreferences portletPreferences)
606                    throws Exception {
607    
608                    return portletPreferences;
609            }
610    
611            protected String doExportData(
612                            PortletDataContext portletDataContext, String portletId,
613                            PortletPreferences portletPreferences)
614                    throws Exception {
615    
616                    return null;
617            }
618    
619            protected PortletPreferences doImportData(
620                            PortletDataContext portletDataContext, String portletId,
621                            PortletPreferences portletPreferences, String data)
622                    throws Exception {
623    
624                    return null;
625            }
626    
627            protected void doPrepareManifestSummary(
628                            PortletDataContext portletDataContext,
629                            PortletPreferences portletPreferences)
630                    throws Exception {
631            }
632    
633            protected PortletPreferences doProcessExportPortletPreferences(
634                            PortletDataContext portletDataContext, String portletId,
635                            PortletPreferences portletPreferences)
636                    throws Exception {
637    
638                    return portletPreferences;
639            }
640    
641            protected PortletPreferences doProcessImportPortletPreferences(
642                            PortletDataContext portletDataContext, String portletId,
643                            PortletPreferences portletPreferences)
644                    throws Exception {
645    
646                    return portletPreferences;
647            }
648    
649            protected String getExportDataRootElementString(Element rootElement) {
650                    if (rootElement == null) {
651                            return StringPool.BLANK;
652                    }
653    
654                    try {
655                            Document document = rootElement.getDocument();
656    
657                            return document.formattedString();
658                    }
659                    catch (IOException ioe) {
660                            return StringPool.BLANK;
661                    }
662            }
663    
664            protected long getExportModelCount(
665                    ManifestSummary manifestSummary,
666                    PortletDataHandlerControl[] portletDataHandlerControls) {
667    
668                    long totalModelCount = -1;
669    
670                    for (PortletDataHandlerControl portletDataHandlerControl :
671                                    portletDataHandlerControls) {
672    
673                            StagedModelType stagedModelType = new StagedModelType(
674                                    portletDataHandlerControl.getClassName(),
675                                    portletDataHandlerControl.getReferrerClassName());
676    
677                            long modelAdditionCount = manifestSummary.getModelAdditionCount(
678                                    stagedModelType);
679    
680                            if (portletDataHandlerControl
681                                            instanceof PortletDataHandlerBoolean) {
682    
683                                    PortletDataHandlerBoolean portletDataHandlerBoolean =
684                                            (PortletDataHandlerBoolean)portletDataHandlerControl;
685    
686                                    PortletDataHandlerControl[] childPortletDataHandlerControls =
687                                            portletDataHandlerBoolean.getChildren();
688    
689                                    if (childPortletDataHandlerControls != null) {
690                                            long childModelCount = getExportModelCount(
691                                                    manifestSummary, childPortletDataHandlerControls);
692    
693                                            if (childModelCount != -1) {
694                                                    if (modelAdditionCount == -1) {
695                                                            modelAdditionCount = childModelCount;
696                                                    }
697                                                    else {
698                                                            modelAdditionCount += childModelCount;
699                                                    }
700                                            }
701                                    }
702                            }
703    
704                            if (modelAdditionCount == -1) {
705                                    continue;
706                            }
707    
708                            if (totalModelCount == -1) {
709                                    totalModelCount = modelAdditionCount;
710                            }
711                            else {
712                                    totalModelCount += modelAdditionCount;
713                            }
714                    }
715    
716                    return totalModelCount;
717            }
718    
719            /**
720             * @deprecated As of 6.2.0
721             */
722            @Deprecated
723            protected void setAlwaysExportable(boolean alwaysExportable) {
724            }
725    
726            /**
727             * @deprecated As of 6.2.0
728             */
729            @Deprecated
730            protected void setAlwaysStaged(boolean alwaysStaged) {
731            }
732    
733            protected void setDataAlwaysStaged(boolean dataAlwaysStaged) {
734                    _dataAlwaysStaged = dataAlwaysStaged;
735            }
736    
737            protected void setDataLevel(DataLevel dataLevel) {
738                    _dataLevel = dataLevel;
739            }
740    
741            protected void setDataLocalized(boolean dataLocalized) {
742                    _dataLocalized = dataLocalized;
743            }
744    
745            protected void setDataPortletPreferences(String... dataPortletPreferences) {
746                    _dataPortletPreferences = dataPortletPreferences;
747            }
748    
749            protected void setDeletionSystemEventStagedModelTypes(
750                    StagedModelType... deletionSystemEventStagedModelTypes) {
751    
752                    _deletionSystemEventStagedModelTypes =
753                            deletionSystemEventStagedModelTypes;
754            }
755    
756            protected void setExportControls(
757                    PortletDataHandlerControl... exportControls) {
758    
759                    _exportControls = exportControls;
760    
761                    setImportControls(exportControls);
762            }
763    
764            protected void setExportMetadataControls(
765                    PortletDataHandlerControl... exportMetadataControls) {
766    
767                    _exportMetadataControls = exportMetadataControls;
768    
769                    setImportMetadataControls(exportMetadataControls);
770            }
771    
772            protected void setImportControls(
773                    PortletDataHandlerControl... importControls) {
774    
775                    _importControls = importControls;
776            }
777    
778            protected void setImportMetadataControls(
779                    PortletDataHandlerControl... importMetadataControls) {
780    
781                    _importMetadataControls = importMetadataControls;
782            }
783    
784            protected void setPublishToLiveByDefault(boolean publishToLiveByDefault) {
785                    _publishToLiveByDefault = publishToLiveByDefault;
786            }
787    
788            protected void setSupportsDataStrategyCopyAsNew(
789                    boolean supportsDataStrategyCopyAsNew) {
790    
791                    _supportsDataStrategyCopyAsNew = supportsDataStrategyCopyAsNew;
792            }
793    
794            private static final Log _log = LogFactoryUtil.getLog(
795                    BasePortletDataHandler.class);
796    
797            private boolean _dataAlwaysStaged;
798            private DataLevel _dataLevel = DataLevel.SITE;
799            private boolean _dataLocalized;
800            private String[] _dataPortletPreferences = StringPool.EMPTY_ARRAY;
801            private StagedModelType[] _deletionSystemEventStagedModelTypes =
802                    new StagedModelType[0];
803            private PortletDataHandlerControl[] _exportControls =
804                    new PortletDataHandlerControl[0];
805            private PortletDataHandlerControl[] _exportMetadataControls =
806                    new PortletDataHandlerControl[0];
807            private PortletDataHandlerControl[] _importControls =
808                    new PortletDataHandlerControl[0];
809            private PortletDataHandlerControl[] _importMetadataControls =
810                    new PortletDataHandlerControl[0];
811            private String _portletId;
812            private boolean _publishToLiveByDefault;
813            private int _rank = 100;
814            private boolean _supportsDataStrategyCopyAsNew = true;
815    
816    }