use of com.twinsoft.convertigo.engine.admin.util.FileAndProperties in project convertigo by convertigo.
the class Delete method getServiceResult.
protected void getServiceResult(HttpServletRequest request, Document document) throws Exception {
Element rootElement = document.getDocumentElement();
// String classToCreate = ServiceUtils.getRequiredParameter(request, "classToCreate");
synchronized (Engine.CERTIFICATES_PATH) {
FileAndProperties rep = ServiceUtils.startCertificate();
File file = rep.getF();
Properties storesProperties = rep.getP();
String certificateName;
int i = 1;
ArrayList<String> mappingsToDelete = new ArrayList<String>();
while ((certificateName = (String) request.getParameter("certificateName_" + i)) != null) {
Iterator<Object> it = storesProperties.keySet().iterator();
while (it.hasNext()) {
String propertyName = (String) it.next();
String propertyValue = storesProperties.getProperty(propertyName);
if (propertyValue.equals(certificateName)) {
mappingsToDelete.add(propertyName);
}
}
for (int j = 0; j < mappingsToDelete.size(); j++) {
// delete found mappings
ServiceUtils.deleteMapping(storesProperties, mappingsToDelete.get(j), document, rootElement);
}
if (storesProperties.remove(certificateName) != null) {
ServiceUtils.addMessage(document, rootElement, "Certificate " + certificateName + " has successfully been deleted.", "message");
} else
throw new ServiceException("Certificate " + certificateName + " didn't exist");
storesProperties.remove(certificateName + ".type");
storesProperties.remove(certificateName + ".group");
i++;
}
PropertiesUtils.store(storesProperties, file);
}
}
use of com.twinsoft.convertigo.engine.admin.util.FileAndProperties in project convertigo by convertigo.
the class Delete method getServiceResult.
protected void getServiceResult(HttpServletRequest request, Document document) throws Exception {
Element rootElement = document.getDocumentElement();
synchronized (Engine.CERTIFICATES_PATH) {
FileAndProperties rep = ServiceUtils.startCertificate();
File file = rep.getF();
Properties storesProperties = rep.getP();
// String message="";
String link;
int i = 1;
while ((link = (String) request.getParameter("link_" + i)) != null) {
ServiceUtils.deleteMapping(storesProperties, link, document, rootElement);
i++;
}
PropertiesUtils.store(storesProperties, file);
}
}
Aggregations