Code example for Logger

Methods: fine, x 1

0
	 * @return	The String id of the created WorkflowExecution 
	 * @throws	IOException 
	 * @throws	RepositoryException 
	 */ 
    public String storeWorkflowExecution(WorkflowExecution workflow) throws IOException, RepositoryException {
    	log.fine("JCRManager.storeWorkflowExecution()");
    	String _retVal = null;
    	try { 
    		this.getSession();
    		// Find the WorfkflowExecution node that will be the parent 
    		log.fine("Locating the parent WorkflowDefinition");
    		String _queryStr = "//WorkflowDefinition[@id=\"" + workflow.getWorkflowId() + "\"]";
    		log.fine("Query:" + _queryStr);
    		NodeIterator _nodes = this.executeQuery(_queryStr);
    		log.fine("Node size = " + _nodes.getSize());
    		if (_nodes.getSize() < 1) {
    			log.fine("WorkflowDefinition with id = " + workflow.getWorkflowId() + " doesn't exists.");
    			throw new RuntimeException("WorkflowDefinition with id = " + workflow.getWorkflowId() + " doesn't exists.");
    		} 
    		Node _defNode = _nodes.nextNode(); 
    		String _path = _defNode.getPath().concat("/WorkflowExecution");
	    	log.fine("Creating Document node for the workflow");
	    	Node _execNode = this.createDocumentNode(_path, true);
	    	// Add mix:referencable to generate an id 
	    	_execNode.addMixin("mix:referenceable");
	    	_retVal = _execNode.getUUID();
	    	log.fine("Creating workflow definition node");
	    	// Add the specific node properties from the workflow properties 
	    	log.fine("Adding properties");
	    	if (workflow.getUser() != null)
	    		_execNode.setProperty("userName", workflow.getUser());
	    	if (workflow.getWorkflowId() != null)
	    		_execNode.setProperty("workflowId", workflow.getWorkflowId());
	    	session.save();
    	} finally { 
    		log.fine("logging out session");
    		session.logout();
    	} 
    	return _retVal;
    }