Skip to content
Snippets Groups Projects
Commit db03fbe5 authored by Nicole Merkle's avatar Nicole Merkle
Browse files

This was implemented: If service is already installed, installation process...

This was implemented: If service is already installed, installation process show to user a message, that it is already installed and breaks up the installation.
parent 876ffa5b
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,7 @@ import org.universAAL.middleware.deploymanager.uapp.model.Feature;
import org.universAAL.middleware.deploymanager.uapp.model.Part.PartRequirements;
import org.universAAL.middleware.deploymanager.uapp.model.ReqType;
import org.universAAL.ucc.model.usrv.AalUsrv;
import org.universAAL.ucc.model.usrv.AalUsrv.Srv;
import org.universAAL.ucc.model.usrv.ApplicationType;
import org.universAAL.middleware.deploymanager.uapp.model.Part;
import org.universAAL.middleware.managers.api.InstallationResults;
......@@ -534,6 +535,7 @@ public class FrontendImpl implements IFrontend {
System.err.println("Size of APP-List "+appsList.size());
aal.setUaapList(appsList);
parseConfiguration(serviceId + "_temp", appsList, licenseList, aal);
return appsList;
}
......@@ -623,6 +625,10 @@ public class FrontendImpl implements IFrontend {
}
System.err.println("SET LicenseWindow");
boolean isAlreadyInstalled = Activator.getMgmt().isServiceId(aal.getServiceId());
if(!isAlreadyInstalled) {
LicenceWindow lw = null;
for(UAPP installingApp : aal.getUaapList()) {
try {
......@@ -631,6 +637,11 @@ public class FrontendImpl implements IFrontend {
e.printStackTrace();
}
new UsrvInfoController(aal, lw, UccUI.getInstance());
}
} else {
NoConfigurationWindow ncw = new NoConfigurationWindow(bundle.getString("srv.already.exists"));
UccUI.getInstance().getMainWindow().addWindow(ncw);
return null;
}
}
return aal;
......
......@@ -2,6 +2,9 @@ package org.universAAL.ucc.service.api;
import java.util.List;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public interface IServiceManagement {
public String getInstalledServices();
......@@ -11,4 +14,6 @@ public interface IServiceManagement {
public List<String> getInstalledApps(String serviceId);
public void addUserIDToMenuEntry(String serviceId, String appId);
public boolean isServiceId(String serviceId);
}
......@@ -55,6 +55,15 @@ public class Model implements IServiceModel {
.newDocumentBuilder().newDocument();
Element appRoot = doc.createElement("services");
doc.appendChild(appRoot);
//My changes
Element serv = doc.createElement("service");
serv.setAttribute("serviceId", "");
appRoot.appendChild(serv);
Element app = doc.createElement("application");
serv.appendChild(app);
Element menu = doc.createElement("menuEntry");
serv.appendChild(menu);
//My changes
try {
TransformerFactory
.newInstance()
......
......@@ -101,6 +101,15 @@ public class ServiceManagment implements IServiceManagement {
+ serviceId);
return null;
}
public boolean isServiceId(String serviceId) {
if(new File(Model.SERVICEFILENAME).exists()) {
Document doc = Model.getSrvDocument();
Element ser = getService(serviceId, doc);
if(ser != null)
return true;
} return false;
}
/**
* get the list of appIds that are installed for a service
......@@ -113,11 +122,13 @@ public class ServiceManagment implements IServiceManagement {
List<String> list = new ArrayList<String>();
Document doc = Model.getSrvDocument();
Element serviceEl = getService(serviceId, doc);
if(serviceEl != null) {
NodeList nodeList = serviceEl.getElementsByTagName("application");
for (int i = 0; i < nodeList.getLength(); i++) {
Element element = (Element) nodeList.item(i);
list.add(element.getAttribute("appId"));
}
}
return list;
} else {
......@@ -125,6 +136,8 @@ public class ServiceManagment implements IServiceManagement {
}
}
/**
* set userID value for the MenuEntry
*/
......
......@@ -55,14 +55,16 @@ public class DeinstallWindow extends Window implements Window.CloseListener {
Container beanContainer = new BeanItemContainer<AppItem>(AppItem.class);
for(RegisteredService item : srv) {
for(String app: item.getAppId()) {
AppItem ai = new AppItem();
ai.setServiceId(item.getServiceId());
ai.setAppId(app);
ai.setMenuName(item.getMenuName());
ai.setUserID(item.getUserID());
ai.setProvider(item.getProvider());
beanContainer.addItem(ai);
if(!item.getServiceId().equals("")) {
for(String app: item.getAppId()) {
AppItem ai = new AppItem();
ai.setServiceId(item.getServiceId());
ai.setAppId(app);
ai.setMenuName(item.getMenuName());
ai.setUserID(item.getUserID());
ai.setProvider(item.getProvider());
beanContainer.addItem(ai);
}
}
}
list.setContainerDataSource(beanContainer);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment