@@ -0,0 +1,1099 @@
+package org.opentosca.csarrepo.service;%0A%0Aimport java.net.URI;%0Aimport java.net.URISyntaxException;%0A%0Aimport org.opentosca.csarrepo.exception.PersistenceException;%0Aimport org.opentosca.csarrepo.model.WineryServer;%0Aimport org.opentosca.csarrepo.model.repository.WineryServerRepository;%0A%0Apublic class CreateWineryServerService extends AbstractService %7B%0A%0A%09public CreateWineryServerService(long userId, String name, String uri) %7B%0A%09%09super(userId);%0A%0A%09%09// validate the name%0A%09%09name.trim();%0A%09%09if (name.isEmpty() %7C%7C name.length() %3E 255) %7B%0A%09%09%09this.addError(%22nameLengthError%22);%0A%09%09%7D%0A%0A%09%09// validate uri%0A%09%09try %7B%0A%09%09%09URI address = new URI(uri);%0A%09%09%09if (!super.hasErrors()) %7B%0A%09%09%09%09// no errors save%0A%09%09%09%09WineryServer ws = new WineryServer();%0A%09%09%09%09ws.setName(name);%0A%09%09%09%09ws.setAddress(address);%0A%09%09%09%09WineryServerRepository repo = new WineryServerRepository();%0A%09%09%09%09try %7B%0A%09%09%09%09%09repo.save(ws);%0A%09%09%09%09%7D catch (PersistenceException e) %7B%0A%09%09%09%09%09this.addError(%22savingWineryFailed%22);%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D catch (URISyntaxException e1) %7B%0A%09%09%09this.addError(%22invalidURIError%22);%0A%09%09%7D%0A%09%7D%0A%0A%09public boolean getResult() %7B%0A%09%09return !super.hasErrors();%0A%09%7D%0A%7D%0A

add CreateWineryServerService, refs #199