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


Java Task.getExternalId方法代码示例

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


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

示例1: createSystemTask

import org.ndexbio.model.object.Task; //导入方法依赖的package包/类
public static NdexSystemTask createSystemTask(Task t) throws NdexException {
	switch (t.getTaskType()) {
		case SYS_SOLR_DELETE_NETWORK:
			return new SolrTaskDeleteNetwork(UUID.fromString(t.getResource()),
					(Boolean)t.getAttribute(SolrTaskDeleteNetwork.globalIdxAttr));
		case SYS_SOLR_REBUILD_NETWORK_INDEX:
			return new SolrTaskRebuildNetworkIdx(UUID.fromString(t.getResource()), SolrIndexScope.valueOf((String)t.getAttribute(SolrTaskRebuildNetworkIdx.AttrScope)), 
					  ((Boolean)t.getAttribute(SolrTaskRebuildNetworkIdx.AttrCreateOnly)).booleanValue(),
					  (Set<String>)t.getAttribute("fields"), 
					  NetworkIndexLevel.valueOf((String)t.getAttribute("indexLevel")));
		case SYS_LOAD_NETWORK:
			return new CXNetworkLoadingTask (UUID.fromString(t.getResource()),(String)t.getAttribute("owner"),
					(Boolean)t.getAttribute("isUpdate"), 
					(t.getAttribute("visibility") != null ? VisibilityType.valueOf((String)t.getAttribute("visibility")): null),
					(Set<String>)t.getAttribute("nodeIndexes"));
		default:
			throw new NdexException("Unknow system task: " + t.getExternalId() + " - " + t.getTaskType());
		
	}
}
 
开发者ID:ndexbio,项目名称:ndex-rest,代码行数:21,代码来源:NdexSystemTask.java

示例2: updateTaskStatus

import org.ndexbio.model.object.Task; //导入方法依赖的package包/类
public Task updateTaskStatus(Status status, Task task) throws NdexException {
  	
  	try {
  		
	this.ndexService.setupDatabase();
	TaskDocDAO dao = new TaskDocDAO(this.ndexService._ndexDatabase);
	logger.info("Updating status of tasks " + task.getExternalId() + " from " +
	   task.getStatus() + " to " + status);
	dao.updateTaskStatus(status, task);
	this.ndexService._ndexDatabase.commit();
	return task;
} catch (Exception e) {
	logger.error("Failed to update task satus : " + e.getMessage(), e);
	throw new NdexException("Failed to update status of task: " + task.getExternalId() + " to " + status);
	
}finally {
	this.ndexService.teardownDatabase();
}
  	
  }
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:21,代码来源:NdexTaskService.java

示例3: createUserTask

import org.ndexbio.model.object.Task; //导入方法依赖的package包/类
public static NdexTask createUserTask(Task t) throws NdexException {
	switch (t.getTaskType()) {
	case EXPORT_NETWORK_TO_FILE:
		return new NetworkExportTask(t);
	default:
		throw new NdexException ("Unknow user task: " + t.getExternalId() + " - " + t.getTaskType());		
	}
	
}
 
开发者ID:ndexbio,项目名称:ndex-rest,代码行数:10,代码来源:NdexTask.java

示例4: createTask

import org.ndexbio.model.object.Task; //导入方法依赖的package包/类
public UUID createTask(String accountName, Task newTask) throws ObjectNotFoundException, NdexException {
	
	if (newTask.getExternalId() == null)
		newTask.setExternalId(NdexUUIDFactory.INSTANCE.createNewNDExUUID());
	
	ODocument taskDoc = new ODocument(NdexClasses.Task)
			.fields(NdexClasses.ExternalObj_ID, newTask.getExternalId().toString(),
				NdexClasses.ExternalObj_cTime, newTask.getCreationTime(),
				NdexClasses.ExternalObj_mTime, newTask.getModificationTime(),
				NdexClasses.Task_P_description, newTask.getDescription(),
				NdexClasses.Task_P_status, newTask.getStatus(),
				NdexClasses.Task_P_priority, newTask.getPriority(),
				NdexClasses.Task_P_progress, newTask.getProgress(),
				NdexClasses.Task_P_taskType, newTask.getTaskType(),
				NdexClasses.Task_P_resource, newTask.getResource(),
				NdexClasses.ExternalObj_isDeleted, false,
				NdexClasses.Task_P_startTime, newTask.getStartTime(),
				NdexClasses.Task_P_endTime, newTask.getFinishTime(),
				NdexClasses.Task_P_message, newTask.getMessage());

	if ( newTask.getFormat() != null) 
		taskDoc = taskDoc.field(NdexClasses.Task_P_fileFormat, newTask.getFormat());
	
	if ( newTask.getAttributes() != null ) {
		taskDoc = taskDoc.field(NdexClasses.Task_P_attributes, newTask.getAttributes());
	}
	
	taskDoc = taskDoc.save();
	
	if ( accountName != null) {
		ODocument userDoc = getRecordByAccountName(accountName, NdexClasses.User);
		
		String userUUID = userDoc.field(NdexClasses.ExternalObj_ID);

		taskDoc = taskDoc.field("ownerUUID", userUUID).save();
		
		OrientVertex taskV = graph.getVertex(taskDoc);
		
		OrientVertex userV = this.graph.getVertex(userDoc.reload());
		for	(int retry = 0;	retry <	NdexDatabase.maxRetries;	++retry)	{
			try	{
				taskV.addEdge(NdexClasses.Task_E_owner, userV );

				break;
			} catch(ONeedRetryException	e)	{
				logger.warning("Retry creating task add edge.");
				taskV.reload();
				taskV.getRecord().removeField("out_"+ NdexClasses.Task_E_owner);
				userV.reload();
			}
		}
		newTask.setTaskOwnerId(UUID.fromString(userUUID));
		graph.commit();
		NdexServerQueue.INSTANCE.addUserTask(newTask);
	}
	
	return newTask.getExternalId();
	
}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:60,代码来源:TaskDAO.java


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