/** * Check in file * * @param soapRequest Vti soap request ({@link VtiSoapRequest}) * @param soapResponse Vti soap response ({@link VtiSoapResponse}) */ public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception { if (logger.isDebugEnabled()) logger.debug("Soap Method with name " + getName() + " is started."); // mapping xml namespace to prefix SimpleNamespaceContext nc = new SimpleNamespaceContext(); nc.addNamespace(prefix, namespace); nc.addNamespace(soapUriPrefix, soapUri); String host = getHost(soapRequest); String context = soapRequest.getAlfrescoContextName(); // getting pageUrl parameter from request XPath xpath = new Dom4jXPath(buildXPath(prefix, "/CheckInFile/pageUrl")); xpath.setNamespaceContext(nc); Element docE = (Element) xpath.selectSingleNode(soapRequest.getDocument().getRootElement()); if (docE == null || docE.getTextTrim().length() == 0) { throw new VtiSoapException("pageUrl must be supplied", 0x82000001l); } String docPath = URLDecoder.decode(docE.getTextTrim(), "UTF-8"); if (docPath.indexOf(host) == -1 || docPath.indexOf(context) == -1) { throw new VtiSoapException("Invalid URI: The format of the URI could not be determined", -1); } docPath = docPath.substring(host.length() + context.length()); // Get the comment xpath = new Dom4jXPath(buildXPath(prefix, "/CheckInFile/comment")); xpath.setNamespaceContext(nc); String comment = ((Element) xpath.selectSingleNode(soapRequest.getDocument().getRootElement())) .getTextTrim(); // Get the checkin type xpath = new Dom4jXPath(buildXPath(prefix, "/CheckInFile/CheckinType")); xpath.setNamespaceContext(nc); Element typeE = (Element) xpath.selectSingleNode(soapRequest.getDocument().getRootElement()); VersionType type = VersionType.MAJOR; if (typeE != null && typeE.getTextTrim().length() > 0) { String typeS = typeE.getTextTrim(); if ("0".equals(typeS)) { type = VersionType.MINOR; } else if ("1".equals(typeS)) { type = VersionType.MAJOR; } else if ("2".equals(typeS)) { type = VersionType.MAJOR; } else { throw new VtiSoapException("Invalid Checkin Type '" + typeS + "' received", -1); } } // Good to go if (logger.isDebugEnabled()) { logger.debug("item parameter for this request: " + docPath); } NodeRef originalNode; boolean lockAfterSucess = true; // Do not lock original node if we work with Office 2008/2011 for Mac if (VtiUtils.isMacClientRequest(soapRequest)) { lockAfterSucess = false; } try { originalNode = handler.checkInDocument(docPath, type, comment, lockAfterSucess); } catch (FileNotFoundException fnfe) { throw new VtiSoapException("File not found", -1, fnfe); } // creating soap response Element responseElement = soapResponse.getDocument().addElement("CheckInFileResponse", namespace); Element result = responseElement.addElement("CheckInFileResult"); result.setText(originalNode != null ? "true" : "false"); soapResponse.setContentType("text/xml"); if (logger.isDebugEnabled()) { logger.debug("Soap Method with name " + getName() + " is finished."); } }