Java FileFormat类代码示例(javafileformat类的典型用法代码示例)

本文整理汇总了Java中org.ndexbio.model.object.network.FileFormat的典型用法代码示例。如果您正苦于以下问题:Java FileFormat类的具体用法?Java FileFormat怎么用?Java FileFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Java FileFormat类代码示例(javafileformat类的典型用法代码示例)

FileFormat类属于org.ndexbio.model.object.network包,在下文中一共展示了FileFormat类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getNdexTaskByTaskType

import org.ndexbio.model.object.network.FileFormat; //导入依赖的package包/类
private NdexTask getNdexTaskByTaskType(Task task) throws NdexException{
	
	try {
		if( task.getTaskType() == TaskType.PROCESS_UPLOADED_NETWORK) {
			return new FileUploadTask(task, db);
		}
		if( task.getTaskType() == TaskType.EXPORT_NETWORK_TO_FILE) {
			if ( task.getFormat() == FileFormat.XBEL)
				return new XbelExporterTask(task);
			else if ( task.getFormat() == FileFormat.XGMML) {
				return new XGMMLExporterTask(task);
			} if ( task.getFormat() == FileFormat.BIOPAX) {
				return new BioPAXExporterTask(task);
			} if ( task.getFormat() == FileFormat.CX) {
				return new CXExporterTask(task);
			}
			
			throw new NdexException ("Only XBEL, XGMML, CX and BIOPAX exporters are implemented.");
		}
		throw new NdexException("Task type: " +task.getTaskType() +" is not supported");
	} catch (IllegalArgumentException | SecurityException | NdexException e) {
		e.printStackTrace();
		throw new NdexException ("Error occurred when creating task. " + e.getMessage());
	} 
} 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:26,代码来源:NdexTaskExecutor.java

示例2: getTaskFromDocument

import org.ndexbio.model.object.network.FileFormat; //导入依赖的package包/类
protected static Task getTaskFromDocument(ODocument doc) {
	Task result = new Task();

	Helper.populateExternalObjectFromDoc(result, doc);
   	
	result.setDescription((String)doc.field(NdexClasses.Task_P_description));
	result.setPriority(Priority.valueOf((String)doc.field(NdexClasses.Task_P_priority)));
	result.setProgress((int)doc.field(NdexClasses.Task_P_progress));
	result.setResource((String)doc.field(NdexClasses.Task_P_resource));
	result.setStatus(Status.valueOf((String)doc.field(NdexClasses.Task_P_status)));
	result.setTaskType(TaskType.valueOf((String)doc.field(NdexClasses.Task_P_taskType)));
	
	Object o = doc.field(NdexClasses.Task_P_attributes);
	if ( o != null) {
		Map<String, Object> attr = (Map<String,Object>) o;
		result.setAttributes(attr);
	}
	
	Date d = doc.field(NdexClasses.Task_P_startTime);
	if (d !=null)
		result.setStartTime(new Timestamp(d.getTime()));
	d = doc.field(NdexClasses.Task_P_endTime);
	if ( d!=null)
		result.setFinishTime(new Timestamp(d.getTime()));
	result.setMessage((String)doc.field(NdexClasses.Task_P_message));
	
	ODocument ownerDoc = doc.field("out_"+ NdexClasses.Task_E_owner);
	
	result.setTaskOwnerId(UUID.fromString((String)ownerDoc.field(NdexClasses.ExternalObj_ID)));

	String str = doc.field(NdexClasses.Task_P_fileFormat);
	
	if ( str != null) result.setFormat(FileFormat.valueOf(str));
	
       return result;
} 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:37,代码来源:TaskDocDAO.java

示例3: getNdexTask

import org.ndexbio.model.object.network.FileFormat; //导入依赖的package包/类
private static NdexTask getNdexTask(Task task) throws NdexException{
	
	try {
		switch ( task.getTaskType()) { 
			case PROCESS_UPLOADED_NETWORK: 
				return new FileUploadTask(task, NdexDatabase.getInstance());
			case DOWNLOAD_NAMESPACE_FILES:
				return new AttachNamespacefilesTask(task);
			case EXPORT_NETWORK_TO_FILE: 
				
				if ( task.getFormat() == FileFormat.XBEL)
					return new XbelExporterTask(task);
				else if ( task.getFormat() == FileFormat.XGMML) {
					return new XGMMLExporterTask(task);
				} if ( task.getFormat() == FileFormat.BIOPAX) {
					return new BioPAXExporterTask(task);
				} if ( task.getFormat() == FileFormat.SIF) {
					return new SIFExporterTask(task);
				} if ( task.getFormat() == FileFormat.CX)  {
					return new CXExporterTask(task);
				}
			
				throw new NdexException ("Only XBEL, XGMML, SIF, CX, and BIOPAX exporters are implemented.");
			case CREATE_NETWORK_CACHE: 
				return new AddNetworkToCacheTask(task);
			case DELETE_NETWORK_CACHE:
				return new RemoveNetworkFromCacheTask(task);
			default:
				throw new NdexException("Task type: " +task.getTaskType() +" is not supported");
		}		
	} catch (IllegalArgumentException | SecurityException | NdexException e) {
		e.printStackTrace();
		throw new NdexException ("Error occurred when creating task. " + e.getMessage());
	} 
} 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:36,代码来源:ClientTaskProcessor.java

示例4: getFormat

import org.ndexbio.model.object.network.FileFormat; //导入依赖的package包/类
public FileFormat getFormat() {
	return _format;
} 
开发者ID:ndexbio,项目名称:ndex-object-model,代码行数:4,代码来源:Task.java

示例5: setFormat

import org.ndexbio.model.object.network.FileFormat; //导入依赖的package包/类
public void setFormat(FileFormat format) {
	this._format = format;
} 
开发者ID:ndexbio,项目名称:ndex-object-model,代码行数:4,代码来源:Task.java

示例6: exportNetworks

import org.ndexbio.model.object.network.FileFormat; //导入依赖的package包/类
@POST
@Path("/export")
@Produces("application/json")
   @ApiDoc("Set the system flag specified by ‘parameter’ to ‘value’ for the network with id ‘networkId’. As of " +
        "NDEx v1.2, the only supported parameter is readOnly={true|false}. In 2.0, we added visibility={PUBLIC|PRIVATE}")
public Map<UUID,UUID> exportNetworks(NetworkExportRequest exportRequest)

		throws IllegalArgumentException, NdexException, SQLException, SolrServerException, IOException {
	
	    logger.info("exporting networks");
	    if ( !exportRequest.getNetworkFormat().toLowerCase().equals("cx"))
	    	throw new NdexException("Networks can only be exported in cx fromat in this server.");
	    
	    Map<UUID,UUID> result = new TreeMap<>();
		try (NetworkDAO networkDao = new NetworkDAO()) {
			try (TaskDAO taskdao = new TaskDAO()) {

				for ( UUID networkID : exportRequest.getNetworkIds()) {
					Task t = new Task();
					Timestamp currentTime = new Timestamp(Calendar.getInstance().getTimeInMillis());
					t.setCreationTime(currentTime);
					t.setModificationTime(currentTime);
					t.setStartTime(currentTime);
					t.setFinishTime(currentTime);
					t.setDescription("network export");
					t.setTaskType(TaskType.EXPORT_NETWORK_TO_FILE);
					t.setFormat(FileFormat.CX);
					t.setTaskOwnerId(getLoggedInUserId());
					t.setResource(networkID.toString());
					if (! networkDao.isReadable(networkID, getLoggedInUserId())) {
						t.setStatus(Status.FAILED);
						t.setMessage("Network " + networkID + " is not found for user.");
						//throw new NdexException ("Network " + networkID + " is not found.");
					}	else {
						t.setStatus(Status.QUEUED);
						
						NetworkSummary s = networkDao.getNetworkSummaryById(networkID);
						t.setAttribute("downloadFileName", s.getName());
						t.setAttribute("downloadFileExtension", "CX");
					    

					}
					UUID taskId = taskdao.createTask(t);
					taskdao.commit();
					
					result.put(networkID, taskId);
					
					if ( t.getStatus() == Status.QUEUED)
					NdexServerQueue.INSTANCE.addUserTask(new NetworkExportTask(t));

				}
			}
		}
		
		return result;
	    
} 
开发者ID:ndexbio,项目名称:ndex-rest,代码行数:58,代码来源:NetworkService.java

本文标签属性:

示例:示例志愿表

代码:代码是什么

java:java游戏

FileFormat:FileFormat

上一篇:Java Upgradeable类代码示例(javaupgradeable典型用法代码示例汇总)
下一篇:买米当卡是什么意思(买米当卡是什么意思)(“买米当卡”是什么意思?)

为您推荐