本文整理汇总了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);
}
示例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;
}
}
示例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());
}
});
}
}