本文整理汇总了Java中com.google.refine.model.Project.generateID方法的典型用法代码示例。如果您正苦于以下问题:Java Project.generateID方法的具体用法?Java Project.generateID怎么用?Java Project.generateID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.refine.model.Project
的用法示例。
在下文中一共展示了Project.generateID方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: export
import com.google.refine.model.Project; //导入方法依赖的package包/类
@RequestMapping (method = { GET, POST }, value = { "/"
+ DATASET_URL_ELEMENT + "/annotation/"
+ DIMENSION_URL_ELEMENT
+ "/export"})
@ResponseStatus (OK)
public void export (@PathVariable (DATASET_MAPPING_NAME) final String heatmapId,
@PathVariable (DIMENSION_MAPPING_NAME) final String dimension,
@RequestParam String destId,
HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException,
DatasetNotFoundException, InvalidDimensionTypeException {
Dataset sourceHeatmap = workspace.get (heatmapId);
Dataset destHeatmap = workspace.get (destId);
long sourceProjectId = projectManager.getProjectID (sourceHeatmap.name () + dimension);
if(sourceProjectId<=0){
if(log.isDebugEnabled ())
log.debug ("No "+dimension+"annotations to export for dataset" + heatmapId);
return;
}
long destProjectId = Project.generateID();
Dimension dim =destHeatmap.dimension (Dimension.Type.from (dimension));
projectManager.save(true);
projectManager.copyProject (sourceProjectId, destProjectId, heatmapId, destHeatmap, dim);
}
示例2: importProject
import com.google.refine.model.Project; //导入方法依赖的package包/类
@RequestMapping (method = POST, value = { "/"
+ DATASET_URL_ELEMENT + "/annotation/"
+ DIMENSION_URL_ELEMENT
+ "/import"}, consumes = "multipart/form-data")
@ResponseStatus (OK)
public void importProject (@PathVariable (DATASET_MAPPING_NAME) final String heatmapId,
@PathVariable (DIMENSION_MAPPING_NAME) final String dimension,
@RequestParam ("upload") MultipartFile upload
// MultipartHttpServletRequest req
) throws ServletException,
IOException,
DatasetNotFoundException, InvalidDimensionTypeException {
// MultipartFile upload = req.getFile("upload");
long projectId = Project.generateID();
projectManager.save(true);
projectManager.importProject(projectId, upload.getInputStream(), true);
projectManager.loadProjectMetadata(projectId);
ProjectMetadata pm = projectManager.getProjectMetadata(projectId);
pm.updateModified();
projectManager.save(true);
}
示例3: importAnnotations
import com.google.refine.model.Project; //导入方法依赖的package包/类
private void importAnnotations(File file) throws IOException {
try(FileInputStream fin = new FileInputStream(file)){
long projectId = Project.generateID();
projectManager.save(true);
projectManager.importProject(projectId, fin, true);
projectManager.loadProjectMetadata(projectId);
ProjectMetadata pm = projectManager.getProjectMetadata(projectId);
pm.updateModified();
projectManager.save(true);
}
}
示例4: doPost
import com.google.refine.model.Project; //导入方法依赖的package包/类
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
ProjectManager.getSingleton().setBusy(true);
try {
Properties options = ParsingUtilities.parseUrlParameters(request);
long projectID = Project.generateID();
logger.info("Importing existing project using new ID {}", projectID);
internalImport(request, options, projectID);
ProjectManager.getSingleton().loadProjectMetadata(projectID);
ProjectMetadata pm = ProjectManager.getSingleton().getProjectMetadata(projectID);
if (pm != null) {
if (options.containsKey("project-name")) {
String projectName = options.getProperty("project-name");
if (projectName != null && projectName.length() > 0) {
pm.setName(projectName);
}
}
redirect(response, "/project?project=" + projectID);
} else {
respondWithErrorPage(request, response, "Failed to import project. Reason unknown.", null);
}
} catch (Exception e) {
respondWithErrorPage(request, response, "Failed to import project", e);
} finally {
ProjectManager.getSingleton().setBusy(false);
}
}