class SoapDocumentService extends AbstractService implements DocumentService {

	@Override
	public long upload(String sid, Long docId, Long folderId, boolean release, String filename, String language,
			DataHandler content) throws Exception {
		validateSession(sid);

		if (docId != null) {
			checkout(sid, docId);
			checkin(sid, docId, "", filename, release, content);
			return docId;
		} else {
			WSDocument doc = new WSDocument();
			doc.setFileName(filename);
			doc.setFolderId(folderId);
			if (StringUtils.isEmpty(language))
				doc.setLanguage("en");
			else
				doc.setLanguage(language);

			return create(sid, doc, content).getId();
		}

	}

}