Java 类com.liferay.portal.kernel.util.MapUtil 实例源码

项目:ch-inofix-timetracker    文件:TaskRecordExportController.java   
protected PortletDataContext getPortletDataContext(ExportImportConfiguration exportImportConfiguration)
        throws PortalException {

    Map<String, Serializable> settingsMap = exportImportConfiguration.getSettingsMap();

    long companyId = MapUtil.getLong(settingsMap, "companyId");
    long sourceGroupId = MapUtil.getLong(settingsMap, "sourceGroupId");
    String portletId = MapUtil.getString(settingsMap, "portletId");
    Map<String, String[]> parameterMap = (Map<String, String[]>) settingsMap.get("parameterMap");
    DateRange dateRange = ExportImportDateUtil.getDateRange(exportImportConfiguration);

    ZipWriter zipWriter = ExportImportHelperUtil.getPortletZipWriter(portletId);

    PortletDataContext portletDataContext = PortletDataContextFactoryUtil.createExportPortletDataContext(companyId,
            sourceGroupId, parameterMap, dateRange.getStartDate(), dateRange.getEndDate(), zipWriter);

    portletDataContext.setPortletId(portletId);

    return portletDataContext;
}
项目:ch-inofix-contact-manager    文件:ContactExportController.java   
protected PortletDataContext getPortletDataContext(ExportImportConfiguration exportImportConfiguration)
        throws PortalException {

    Map<String, Serializable> settingsMap = exportImportConfiguration.getSettingsMap();

    long companyId = MapUtil.getLong(settingsMap, "companyId");
    long sourceGroupId = MapUtil.getLong(settingsMap, "sourceGroupId");
    String portletId = MapUtil.getString(settingsMap, "portletId");
    Map<String, String[]> parameterMap = (Map<String, String[]>) settingsMap.get("parameterMap");
    DateRange dateRange = ExportImportDateUtil.getDateRange(exportImportConfiguration);

    ZipWriter zipWriter = ExportImportHelperUtil.getPortletZipWriter(portletId);

    PortletDataContext portletDataContext = PortletDataContextFactoryUtil.createExportPortletDataContext(
           companyId, sourceGroupId, parameterMap, dateRange.getStartDate(), dateRange.getEndDate(),
            zipWriter);
    portletDataContext.setPortletId(portletId);

    return portletDataContext;
}
项目:ch-inofix-data-manager    文件:MeasurementExportController.java   
protected PortletDataContext getPortletDataContext(ExportImportConfiguration exportImportConfiguration)
        throws PortalException {

    Map<String, Serializable> settingsMap = exportImportConfiguration.getSettingsMap();

    // String fileName = MapUtil.getString(settingsMap, "fileName");

    long sourcePlid = MapUtil.getLong(settingsMap, "sourcePlid");
    long sourceGroupId = MapUtil.getLong(settingsMap, "sourceGroupId");
    String portletId = MapUtil.getString(settingsMap, "portletId");
    Map<String, String[]> parameterMap = (Map<String, String[]>) settingsMap.get("parameterMap");
    DateRange dateRange = ExportImportDateUtil.getDateRange(exportImportConfiguration);

    Layout layout = _layoutLocalService.getLayout(sourcePlid);
    ZipWriter zipWriter = ExportImportHelperUtil.getPortletZipWriter(portletId);

    PortletDataContext portletDataContext = PortletDataContextFactoryUtil.createExportPortletDataContext(
            layout.getCompanyId(), sourceGroupId, parameterMap, dateRange.getStartDate(), dateRange.getEndDate(),
            zipWriter);

    portletDataContext.setOldPlid(sourcePlid);
    portletDataContext.setPlid(sourcePlid);
    portletDataContext.setPortletId(portletId);

    return portletDataContext;
}
项目:ch-inofix-data-manager    文件:MeasurementServiceImpl.java   
@Override
public long importMeasurementsInBackground(
        ExportImportConfiguration exportImportConfiguration,
        InputStream inputStream, String extension) throws PortalException {

    Map<String, Serializable> settingsMap = exportImportConfiguration
            .getSettingsMap();

    long targetGroupId = MapUtil.getLong(settingsMap, "targetGroupId");

    DataManagerPortletPermission.check(getPermissionChecker(),
            targetGroupId, MeasurementActionKeys.IMPORT_MEASUREMENTS);

    return measurementLocalService.importMeasurementsInBackground(
            getUserId(), exportImportConfiguration, inputStream, extension);
}
项目:ch-inofix-timetracker    文件:ExportImportBackgroundTaskDisplay.java   
public ExportImportBackgroundTaskDisplay(BackgroundTask backgroundTask) {
    super(backgroundTask);

    Map<String, Serializable> taskContextMap = backgroundTask.getTaskContextMap();

    _cmd = MapUtil.getString(taskContextMap, Constants.CMD);
    _percentage = PERCENTAGE_NONE;

    if (backgroundTaskStatus == null) {
        _allProgressBarCountersTotal = 0;
        _currentProgressBarCountersTotal = 0;
        _phase = null;
        _stagedModelName = null;
        _stagedModelType = null;

        return;
    }

    long allModelAdditionCountersTotal = getBackgroundTaskStatusAttributeLong("allModelAdditionCountersTotal");
    long allPortletAdditionCounter = getBackgroundTaskStatusAttributeLong("allPortletAdditionCounter");

    _allProgressBarCountersTotal = allModelAdditionCountersTotal + allPortletAdditionCounter;

    long currentModelAdditionCountersTotal = getBackgroundTaskStatusAttributeLong(
            "currentModelAdditionCountersTotal");
    long currentPortletAdditionCounter = getBackgroundTaskStatusAttributeLong("currentPortletAdditionCounter");

    _currentProgressBarCountersTotal = currentModelAdditionCountersTotal + currentPortletAdditionCounter;

    _phase = getBackgroundTaskStatusAttributeString("phase");
    _stagedModelName = getBackgroundTaskStatusAttributeString("stagedModelName");
    _stagedModelType = getBackgroundTaskStatusAttributeString("stagedModelType");
}
项目:ch-inofix-timetracker    文件:ExportImportBackgroundTaskDisplay.java   
@Override
protected Map<String, Object> getTemplateVars() {
    Map<String, Object> templateVars = new HashMap<>();

    templateVars.put("exported", MapUtil.getBoolean(backgroundTask.getTaskContextMap(), "exported"));
    templateVars.put("validated", MapUtil.getBoolean(backgroundTask.getTaskContextMap(), "validated"));

    templateVars.put("htmlUtil", HtmlUtil.getHtml());

    return templateVars;
}
项目:ch-inofix-timetracker    文件:TaskRecordServiceImpl.java   
@Override
public long importTaskRecordsInBackground(ExportImportConfiguration exportImportConfiguration,
        InputStream inputStream, String extension) throws PortalException {

    Map<String, Serializable> settingsMap = exportImportConfiguration.getSettingsMap();

    long targetGroupId = MapUtil.getLong(settingsMap, "targetGroupId");

    TimetrackerPortletPermission.check(getPermissionChecker(), targetGroupId,
            TimetrackerActionKeys.IMPORT_TASK_RECORDS);

    return taskRecordLocalService.importTaskRecordsInBackground(getUserId(), exportImportConfiguration,
            inputStream, extension);
}
项目:ch-inofix-contact-manager    文件:ExportImportBackgroundTaskDisplay.java   
public ExportImportBackgroundTaskDisplay(BackgroundTask backgroundTask) {
    super(backgroundTask);

    Map<String, Serializable> taskContextMap = backgroundTask.getTaskContextMap();

    _cmd = MapUtil.getString(taskContextMap, Constants.CMD);
    _percentage = PERCENTAGE_NONE;

    if (backgroundTaskStatus == null) {
        _allProgressBarCountersTotal = 0;
        _currentProgressBarCountersTotal = 0;
        _phase = null;
        _stagedModelName = null;
        _stagedModelType = null;

        return;
    }

    long allModelAdditionCountersTotal = getBackgroundTaskStatusAttributeLong("allModelAdditionCountersTotal");
    long allPortletAdditionCounter = getBackgroundTaskStatusAttributeLong("allPortletAdditionCounter");

    _allProgressBarCountersTotal = allModelAdditionCountersTotal + allPortletAdditionCounter;

    long currentModelAdditionCountersTotal = getBackgroundTaskStatusAttributeLong(
            "currentModelAdditionCountersTotal");
    long currentPortletAdditionCounter = getBackgroundTaskStatusAttributeLong("currentPortletAdditionCounter");

    _currentProgressBarCountersTotal = currentModelAdditionCountersTotal + currentPortletAdditionCounter;

    _phase = getBackgroundTaskStatusAttributeString("phase");
    _stagedModelName = getBackgroundTaskStatusAttributeString("stagedModelName");
    _stagedModelType = getBackgroundTaskStatusAttributeString("stagedModelType");
}
项目:ch-inofix-contact-manager    文件:ExportImportBackgroundTaskDisplay.java   
@Override
protected Map<String, Object> getTemplateVars() {
    Map<String, Object> templateVars = new HashMap<>();

    templateVars.put("exported", MapUtil.getBoolean(backgroundTask.getTaskContextMap(), "exported"));
    templateVars.put("validated", MapUtil.getBoolean(backgroundTask.getTaskContextMap(), "validated"));

    templateVars.put("htmlUtil", HtmlUtil.getHtml());

    return templateVars;
}
项目:ch-inofix-contact-manager    文件:ContactServiceImpl.java   
@Override
public long importContactsInBackground(ExportImportConfiguration exportImportConfiguration, InputStream inputStream,
        String extension) throws PortalException {

    Map<String, Serializable> settingsMap = exportImportConfiguration.getSettingsMap();

    long sourceGroupId = MapUtil.getLong(settingsMap, "sourceGroupId");
    // long targetGroupId = MapUtil.getLong(settingsMap, "targetGroupId");

    ContactManagerPortletPermission.check(getPermissionChecker(), sourceGroupId,
            ContactManagerActionKeys.IMPORT_CONTACTS);

    return contactLocalService.importContactsInBackground(getUserId(), exportImportConfiguration, inputStream,
            extension);
}
项目:ch-inofix-data-manager    文件:ExportImportBackgroundTaskDisplay.java   
public ExportImportBackgroundTaskDisplay(BackgroundTask backgroundTask) {
    super(backgroundTask);

    Map<String, Serializable> taskContextMap = backgroundTask.getTaskContextMap();

    _cmd = MapUtil.getString(taskContextMap, Constants.CMD);
    _percentage = PERCENTAGE_NONE;

    if (backgroundTaskStatus == null) {
        _allProgressBarCountersTotal = 0;
        _currentProgressBarCountersTotal = 0;
        _phase = null;
        _stagedModelName = null;
        _stagedModelType = null;

        return;
    }

    long allModelAdditionCountersTotal = getBackgroundTaskStatusAttributeLong("allModelAdditionCountersTotal");
    long allPortletAdditionCounter = getBackgroundTaskStatusAttributeLong("allPortletAdditionCounter");

    _allProgressBarCountersTotal = allModelAdditionCountersTotal + allPortletAdditionCounter;

    long currentModelAdditionCountersTotal = getBackgroundTaskStatusAttributeLong(
            "currentModelAdditionCountersTotal");
    long currentPortletAdditionCounter = getBackgroundTaskStatusAttributeLong("currentPortletAdditionCounter");

    _currentProgressBarCountersTotal = currentModelAdditionCountersTotal + currentPortletAdditionCounter;

    _phase = getBackgroundTaskStatusAttributeString("phase");
    _stagedModelName = getBackgroundTaskStatusAttributeString("stagedModelName");
    _stagedModelType = getBackgroundTaskStatusAttributeString("stagedModelType");
}
项目:ch-inofix-data-manager    文件:ExportImportBackgroundTaskDisplay.java   
@Override
protected Map<String, Object> getTemplateVars() {
    Map<String, Object> templateVars = new HashMap<>();

    templateVars.put("exported", MapUtil.getBoolean(backgroundTask.getTaskContextMap(), "exported"));
    templateVars.put("validated", MapUtil.getBoolean(backgroundTask.getTaskContextMap(), "validated"));

    templateVars.put("htmlUtil", HtmlUtil.getHtml());

    return templateVars;
}
项目:edemocracia    文件:LayoutImporter.java   
protected void importJournalArticle(
        PortletDataContext portletDataContext, Layout layout,
        Element layoutElement)
    throws Exception {

    UnicodeProperties typeSettingsProperties =
        layout.getTypeSettingsProperties();

    String articleId = typeSettingsProperties.getProperty(
        "article-id", StringPool.BLANK);

    if (Validator.isNull(articleId)) {
        return;
    }

    JournalPortletDataHandlerImpl.importReferencedData(
        portletDataContext, layoutElement);

    Element structureElement = layoutElement.element("structure");

    if (structureElement != null) {
        JournalPortletDataHandlerImpl.importStructure(
            portletDataContext, structureElement);
    }

    Element templateElement = layoutElement.element("template");

    if (templateElement != null) {
        JournalPortletDataHandlerImpl.importTemplate(
            portletDataContext, templateElement);
    }

    Element articleElement = layoutElement.element("article");

    if (articleElement != null) {
        JournalPortletDataHandlerImpl.importArticle(
            portletDataContext, articleElement);
    }

    Map<String, String> articleIds =
        (Map<String, String>)portletDataContext.getNewPrimaryKeysMap(
            JournalArticle.class + ".articleId");

    articleId = MapUtil.getString(articleIds, articleId, articleId);

    typeSettingsProperties.setProperty("article-id", articleId);

    JournalContentSearchLocalServiceUtil.updateContentSearch(
        portletDataContext.getScopeGroupId(), layout.isPrivateLayout(),
        layout.getLayoutId(), StringPool.BLANK, articleId, true);
}
项目:jukebox-portlet    文件:AlbumStagedModelDataHandler.java   
@Override
protected void doImportStagedModel(
        PortletDataContext portletDataContext, Album album)
    throws Exception {

    long userId = portletDataContext.getUserId(album.getUserUuid());

    ServiceContext serviceContext = portletDataContext.createServiceContext(
        album);

    String artistPath = ExportImportPathUtil.getModelPath(
        portletDataContext, Artist.class.getName(), album.getArtistId());

    Artist artist = (Artist)portletDataContext.getZipEntryAsObject(
        artistPath);

    if (artist != null) {
        StagedModelDataHandlerUtil.importReferenceStagedModel(
            portletDataContext, album, Artist.class, album.getArtistId());
    }

    Map<Long, Long> artistIds =
        (Map<Long, Long>)portletDataContext.getNewPrimaryKeysMap(
            Artist.class);

    long artistId = MapUtil.getLong(
        artistIds, album.getArtistId(), album.getArtistId());

    Album importedAlbum = null;

    if (portletDataContext.isDataStrategyMirror()) {
        Album existingAlbum =
            AlbumLocalServiceUtil.fetchAlbumByUuidAndGroupId(
                album.getUuid(), portletDataContext.getScopeGroupId());

        if (existingAlbum == null) {
            serviceContext.setUuid(album.getUuid());

            importedAlbum = AlbumLocalServiceUtil.addAlbum(
                userId, artistId, album.getName(), album.getYear(), null,
                serviceContext);
        }
        else {
            importedAlbum = AlbumLocalServiceUtil.updateAlbum(
                userId, existingAlbum.getAlbumId(), artistId,
                album.getName(), album.getYear(), null, serviceContext);
        }
    }
    else {
        importedAlbum = AlbumLocalServiceUtil.addAlbum(
            userId, artistId, album.getName(), album.getYear(), null,
            serviceContext);
    }

    Element albumElement =
        portletDataContext.getImportDataStagedModelElement(album);

    List<Element> attachmentElements =
        portletDataContext.getReferenceDataElements(
            albumElement, FileEntry.class,
            PortletDataContext.REFERENCE_TYPE_WEAK);

    for (Element attachmentElement : attachmentElements) {
        String path = attachmentElement.attributeValue("path");

        FileEntry fileEntry =
            (FileEntry)portletDataContext.getZipEntryAsObject(path);

        importedAlbum = AlbumLocalServiceUtil.updateAlbum(
            userId, importedAlbum.getAlbumId(), importedAlbum.getArtistId(),
            importedAlbum.getName(), importedAlbum.getYear(),
            fileEntry.getContentStream(), serviceContext);
    }

    portletDataContext.importClassedModel(album, importedAlbum);
}
项目:jukebox    文件:AlbumStagedModelDataHandler.java   
@Override
protected void doImportStagedModel(
        PortletDataContext portletDataContext, Album album)
    throws Exception {

    long userId = portletDataContext.getUserId(album.getUserUuid());

    ServiceContext serviceContext = portletDataContext.createServiceContext(
        album);

    String artistPath = ExportImportPathUtil.getModelPath(
        portletDataContext, Artist.class.getName(), album.getArtistId());

    Artist artist = (Artist)portletDataContext.getZipEntryAsObject(
        artistPath);

    if (artist != null) {
        StagedModelDataHandlerUtil.importReferenceStagedModel(
            portletDataContext, album, Artist.class, album.getArtistId());
    }

    Map<Long, Long> artistIds =
        (Map<Long, Long>)portletDataContext.getNewPrimaryKeysMap(
            Artist.class);

    long artistId = MapUtil.getLong(
        artistIds, album.getArtistId(), album.getArtistId());

    Album importedAlbum = null;

    if (portletDataContext.isDataStrategyMirror()) {
        Album existingAlbum =
            AlbumLocalServiceUtil.fetchAlbumByUuidAndGroupId(
                album.getUuid(), portletDataContext.getScopeGroupId());

        if (existingAlbum == null) {
            serviceContext.setUuid(album.getUuid());

            importedAlbum = AlbumLocalServiceUtil.addAlbum(
                userId, artistId, album.getName(), album.getYear(), null,
                serviceContext);
        }
        else {
            importedAlbum = AlbumLocalServiceUtil.updateAlbum(
                userId, existingAlbum.getAlbumId(), artistId,
                album.getName(), album.getYear(), null, serviceContext);
        }
    }
    else {
        importedAlbum = AlbumLocalServiceUtil.addAlbum(
            userId, artistId, album.getName(), album.getYear(), null,
            serviceContext);
    }

    Element albumElement =
        portletDataContext.getImportDataStagedModelElement(album);

    List<Element> attachmentElements =
        portletDataContext.getReferenceDataElements(
            albumElement, FileEntry.class,
            PortletDataContext.REFERENCE_TYPE_WEAK);

    for (Element attachmentElement : attachmentElements) {
        String path = attachmentElement.attributeValue("path");

        FileEntry fileEntry =
            (FileEntry)portletDataContext.getZipEntryAsObject(path);

        importedAlbum = AlbumLocalServiceUtil.updateAlbum(
            userId, importedAlbum.getAlbumId(), importedAlbum.getArtistId(),
            importedAlbum.getName(), importedAlbum.getYear(),
            fileEntry.getContentStream(), serviceContext);
    }

    portletDataContext.importClassedModel(album, importedAlbum);
}
项目:ch-inofix-timetracker    文件:BaseExportImportBackgroundTaskExecutor.java   
protected ExportImportConfiguration getExportImportConfiguration(BackgroundTask backgroundTask) {

        Map<String, Serializable> taskContextMap = backgroundTask.getTaskContextMap();

        long exportImportConfigurationId = MapUtil.getLong(taskContextMap, "exportImportConfigurationId");

        return ExportImportConfigurationLocalServiceUtil.fetchExportImportConfiguration(exportImportConfigurationId);
    }
项目:ch-inofix-contact-manager    文件:BaseExportImportBackgroundTaskExecutor.java   
protected ExportImportConfiguration getExportImportConfiguration(BackgroundTask backgroundTask) {

       Map<String, Serializable> taskContextMap = backgroundTask.getTaskContextMap();

       long exportImportConfigurationId = MapUtil.getLong(taskContextMap, "exportImportConfigurationId");

       return ExportImportConfigurationLocalServiceUtil.fetchExportImportConfiguration(exportImportConfigurationId);
   }
项目:ch-inofix-data-manager    文件:BaseExportImportBackgroundTaskExecutor.java   
protected ExportImportConfiguration getExportImportConfiguration(BackgroundTask backgroundTask) {

       Map<String, Serializable> taskContextMap = backgroundTask.getTaskContextMap();

       long exportImportConfigurationId = MapUtil.getLong(taskContextMap, "exportImportConfigurationId");

       return ExportImportConfigurationLocalServiceUtil.fetchExportImportConfiguration(exportImportConfigurationId);
   }