Update to HSQLDB driver

Remove DWR
Remove native SVG tables
Add new REST services for persistence.
This commit is contained in:
Paulo Gustavo Veiga
2012-02-21 14:22:43 -03:00
parent 89f7fd8d3c
commit fb3f9946ae
58 changed files with 419 additions and 624 deletions

View File

@@ -1,58 +0,0 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.dwr;
import com.wisemapping.service.MindmapService;
import com.wisemapping.service.UserService;
import com.wisemapping.model.User;
import com.wisemapping.security.Utils;
import org.directwebremoting.WebContextFactory;
import org.directwebremoting.WebContext;
import javax.servlet.http.HttpServletRequest;
abstract public class BaseDwrService {
private MindmapService mindmapService;
private UserService userService;
public MindmapService getMindmapService() {
return mindmapService;
}
public void setMindmapService(MindmapService mindmapService) {
this.mindmapService = mindmapService;
}
public UserService getUserService() {
return userService;
}
public void setUserService(UserService userService) {
this.userService = userService;
}
public User getUser() {
WebContext ctx = WebContextFactory.get();
final HttpServletRequest request = ctx.getHttpServletRequest();
return Utils.getUser(request);
}
}

View File

@@ -16,30 +16,15 @@
* limitations under the License.
*/
// ...........................................................................................................
// (C) Copyright 1996/2007 Fuego Inc. All Rights Reserved
// THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Fuego Inc.
// The copyright notice above does not evidence any actual or intended
// publication of such source code.
//
// Last changed on 2007-08-01 19:08:20 (-0300), by: imanzano. $Revision$
// ...........................................................................................................
package com.wisemapping.dwr;
import java.io.IOException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.directwebremoting.WebContext;
import org.directwebremoting.WebContextFactory;
import com.wisemapping.model.User;
import javax.servlet.http.HttpServletRequest;
public class JavaScriptErrorLoggerService
extends BaseDwrService {
{
final Log logger = LogFactory.getLog(JavaScriptErrorLoggerService.class);
private static final int ERROR_MESSAGE = 3;
private static final int FATAL_MESSAGE = 4;
@@ -53,27 +38,24 @@ public class JavaScriptErrorLoggerService
public void logError(final int severity, final String logMsg)
throws IOException {
final User user = getUser();
final WebContext ctx = WebContextFactory.get();
final HttpServletRequest request = ctx.getHttpServletRequest();
// final User user = getUser();
final String userAgent = request.getHeader(USER_AGENT);
synchronized (logger) {
// Log user info ...
if (user != null) {
log(severity, "UserId:" + user.getId() + ", UserEmail:" + user.getEmail());
} else {
log(severity, "Anonymous user");
}
// Log browser details ...
log(severity, "Browser:" + userAgent);
// Log error message ...
log(severity, logMsg);
}
// final String userAgent = request.getHeader(USER_AGENT);
// synchronized (logger) {
// // Log user info ...
// if (user != null) {
// log(severity, "UserId:" + user.getId() + ", UserEmail:" + user.getEmail());
// } else {
// log(severity, "Anonymous user");
// }
//
// // Log browser details ...
// log(severity, "Browser:" + userAgent);
//
// // Log error message ...
// log(severity, logMsg);
// }
}
void log(final int severity, final String msg) {

View File

@@ -1,77 +0,0 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// ...........................................................................................................
// (C) Copyright 1996/2007 Fuego Inc. All Rights Reserved
// THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Fuego Inc.
// The copyright notice above does not evidence any actual or intended
// publication of such source code.
//
// Last changed on 2007-08-01 19:08:21 (-0300), by: imanzano. $Revision$
// ...........................................................................................................
package com.wisemapping.dwr;
import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import com.wisemapping.model.MindMap;
import com.wisemapping.model.User;
import com.wisemapping.service.MindmapService;
import com.wisemapping.exceptions.WiseMappingException;
public class MapEditorService
extends BaseDwrService {
//~ Methods ..............................................................................................
public ResponseMessage draftMap(final int mapId, final String nativeXml) {
final ResponseMessage response = new ResponseMessage();
response.setMsgCode(ResponseMessage.Code.OK.name());
response.setMsgDetails("Map Saved Successfully");
return response;
}
public ResponseMessage saveMap(final int mapId, final String nativeXml,
final String editorProperties,boolean saveHistory)
throws IOException, WiseMappingException {
final MindmapService serservice = getMindmapService();
final MindMap mindMap = serservice.getMindmapById(mapId);
final User user = this.getUser();
mindMap.setProperties(editorProperties);
final Calendar now = Calendar.getInstance();
mindMap.setLastModificationTime(now);
mindMap.setLastModifierUser(user.getUsername());
final Calendar lastModification = Calendar.getInstance();
lastModification.setTime(new Date());
mindMap.setLastModificationTime(lastModification);
mindMap.setNativeXml(nativeXml);
serservice.updateMindmap(mindMap,saveHistory);
final ResponseMessage response = new ResponseMessage();
response.setMsgCode(ResponseMessage.Code.OK.name());
response.setMsgDetails("Map Saved Successfully");
return response;
}
}

View File

@@ -1,66 +0,0 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.dwr;
public class ResponseMessage {
private ResponseMessage.Code msgCode;
private String msgDetails;
private String content;
private String contentType;
public ResponseMessage() {
this.contentType = "text/xml;charset=UTF-8";
}
public String getMsgCode() {
return msgCode.name();
}
public void setMsgCode(String msgCode) {
this.msgCode = Code.valueOf(msgCode);
}
public String getMsgDetails() {
return msgDetails;
}
public void setMsgDetails(String msgDetails) {
this.msgDetails = msgDetails;
}
public enum Code {
OK, ERROR
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
}