Ejemplo n.º 1
0
 /**
  * Create or update a snippet. If the snippet doesn't exist it will be created.
  *
  * @param sessionKey the session key
  * @param name name of the snippet
  * @param contents the contents of the snippet
  * @return the snippet
  * @xmlrpc.doc Will create a snippet with the given name and contents if it doesn't exist. If it
  *     does exist, the existing snippet will be updated.
  * @xmlrpc.param #param("string", "sessionKey")
  * @xmlrpc.param #param("string", "name")
  * @xmlrpc.param #param("string", "contents")
  * @xmlrpc.returntype $SnippetSerializer
  */
 public CobblerSnippet createOrUpdate(String sessionKey, String name, String contents) {
   User loggedInUser = getLoggedInUser(sessionKey);
   verifyKSAdmin(loggedInUser);
   CobblerSnippet snip = CobblerSnippet.loadEditableIfExists(name, loggedInUser.getOrg());
   return CobblerSnippet.createOrUpdate(snip == null, name, contents, loggedInUser.getOrg());
 }