Code example for Logger

Methods: fine, x 1

0
	 * @return	The String id of the created WorkflowDefinition 
	 * @throws	IOException 
	 * @throws	RepositoryException 
	 */ 
    public String storeWorkflowDefinition(WorkflowDefinition workflow, String path) throws IOException, RepositoryException {
    	log.fine("JCRManager.storeWorkflowDefinition()");
    	try { 
    		if (workflow == null) {
    			return null; 
    		} 
    		this.getSession();
    		log.fine("Checking for existence of WorkflowDefinition node");
    		String _queryString = "//WorkflowDefinition[@id=\"" + workflow.getId() + "\"]";
    		NodeIterator _nodes = this.executeQuery(_queryString);
    		if (_nodes.getSize() > 0) {
    			log.fine("WorkflowDefinition with id = " + workflow.getId() + " already exists.");
    			throw new RuntimeException("WorkflowDefinition with id = " + workflow.getId() + " already exists.");
    		} 
    		path = path.concat("/WorkflowDefinition");
	    	log.fine("Creating Document node for the workflow");
	    	Node _defNode = this.createDocumentNode(path, true);
	    	log.fine("Creating workflow definition node");
	    	// Add the specific node properties from the workflow properties 
	    	log.fine("Adding properties");
	    	if (workflow.getDate() != null) {
	    		Calendar _calendar = Calendar.getInstance();
		    	_calendar.setTime(workflow.getDate());
		    	_defNode.setProperty("date", _calendar);
	    	} 
 
	    	if (workflow.getId() != null)
	    		_defNode.setProperty("id", workflow.getId());
 
	    	if (workflow.getOwner() != null)
	    		_defNode.setProperty("owner", workflow.getOwner());
	    	if (workflow.getVersion() != null)
	    		_defNode.setProperty("version", workflow.getVersion());
	    	if (workflow.getDescription() != null)
	    		_defNode.setProperty("description", workflow.getDescription());
	    	session.save();
    	} finally { 
    		log.fine("logging out session");
    		session.logout();
    	} 
    	return workflow.getId();
    }