当前位置: 首页>>代码示例>>Java>>正文


Java Project.getId方法代码示例

本文整理汇总了Java中de.espirit.firstspirit.access.project.Project.getId方法的典型用法代码示例。如果您正苦于以下问题:Java Project.getId方法的具体用法?Java Project.getId怎么用?Java Project.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在de.espirit.firstspirit.access.project.Project的用法示例。


在下文中一共展示了Project.getId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import de.espirit.firstspirit.access.project.Project; //导入方法依赖的package包/类
@Override
public ContentCreatorAddressResult execute(ContentCreatorAddressParameters parameters) {
    final Connection connection = parameters.getConnection();
    final Project project = connection.getProjectByName(parameters.getProjectName());
    final long projectId = project.getId();
    final Locale locale = Optional.ofNullable(parameters.getLocale()).orElse(project.getMasterLanguage().getLocale());
    final String language = locale.getLanguage();
    final String contentCreatorUrl =
        connection.getServerConfiguration().getUrl() + "fs5webedit_" + projectId + "/?locale=" + language + "&project=" + projectId;
    return new ContentCreatorAddressResult(contentCreatorUrl);
}
 
开发者ID:e-Spirit,项目名称:FSTestTools,代码行数:12,代码来源:ContentCreatorAddressCommand.java

示例2: performExport

import de.espirit.firstspirit.access.project.Project; //导入方法依赖的package包/类
/**
 * Perform the actual export.
 * Sub-tasks are:
 * Check if project is available and activated, start project export, download project export to the filesystem.
 *
 * @param serverConnection        A connected connection to the FirstSpirit server.
 * @param projectExportParameters ProjectExportParameters containing information about the project to export
 * @return true if the export performed without any errors, false otherwise.
 */
protected boolean performExport(ServerConnection serverConnection, ProjectExportParameters projectExportParameters) {
    final String projectName = projectExportParameters.getProjectName();
    final Project fsProject = serverConnection.getProjectByName(projectName);

    if(fsProject != null) {
        if(!fsProject.isActive()) {
            if(projectExportParameters.isFsForceProjectActivation()) {
                if(!activateProjectByForce(serverConnection, fsProject)) {
                    LOGGER.error("Project could not be activated.");
                    return false;
                }
            } else {
                LOGGER.error("Project is deactivated. Please set --fsForceProjectActivation to activate the project.");
                return false;
            }
        }

        // Project must be active at this point
        final ExportManager exportManager = serverConnection.getManager(ExportManager.class);
        final ExportParameters exportParameters = new ExportParameters(
                fsProject.getId(),
                projectName
        );

        final ServerActionHandle<ExportProgress, Boolean> exportHandle = exportManager.startExport(exportParameters);
        final List<ExportFile> exportFiles = waitUntilExportFinished(exportHandle);

        return downloadExportFilesToFileSystem(projectExportParameters.getProjectExportPath(), exportManager, exportFiles);
    } else {
        LOGGER.error("Project '" + projectName + "' not found on server.");
        return false;
    }
}
 
开发者ID:e-Spirit,项目名称:FSDevTools,代码行数:43,代码来源:ProjectExporter.java

示例3: activateServices

import de.espirit.firstspirit.access.project.Project; //导入方法依赖的package包/类
/**
 * Method for activating auto start of services of a given module
 * @param connection A {@link Connection} to the server
 * @param parameters
 * @param descriptor the module descriptor
 */
private static void activateServices(final Connection connection, ModuleInstallationParameters parameters, ModuleDescriptor descriptor) {
    ProjectStorage projectStorage = connection.getService(AdminService.class).getProjectStorage();

    Project project = projectStorage.getProject(parameters.getProjectName());
    if(project == null) {
        throw new IllegalArgumentException("Project " + parameters.getProjectName() + " not found!");
    }
    long projectId = project.getId();
    LOGGER.info("ModuleInstaller activateServices ...");

    ModuleAdminAgent moduleAdminAgent = connection.getBroker().requireSpecialist(ModuleAdminAgent.TYPE);
    String moduleName = descriptor.getModuleName();
    Optional<ModuleDescriptor> moduleDescriptor = moduleAdminAgent.getModules().stream().filter(it -> it.getName().equals(moduleName)).findFirst();

    if(!moduleDescriptor.isPresent()) {
        LOGGER.info("ModuleDescriptor not present!");
    }

    final ComponentDescriptor[] componentDescriptors = descriptor.getComponents();
    if (componentDescriptors == null) {
        LOGGER.error("No components found for module: {}", moduleName);
    } else {
        Arrays.stream(componentDescriptors).filter(it -> it.getType().equals(SERVICE)).forEach(serviceDescriptor -> {
            LOGGER.info("Found service " + serviceDescriptor.getName());
            File configuration = parameters.getServiceConfigurations().get(serviceDescriptor.getName());
            if(configuration != null) {
                createConfigurationFile(SERVICE, connection, serviceDescriptor, configuration, moduleName, projectId, null);
                setAutostartAndRestartService(moduleAdminAgent, serviceDescriptor);
            } else {
                LOGGER.info("No configuration found for service " + serviceDescriptor.getName());
            }
        });
    }
}
 
开发者ID:e-Spirit,项目名称:FSDevTools,代码行数:41,代码来源:ModuleInstaller.java


注:本文中的de.espirit.firstspirit.access.project.Project.getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。