Remove trunk directory
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
// ...........................................................................................................
|
||||
// (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;
|
||||
private static final String USER_AGENT = "User-Agent";
|
||||
|
||||
JavaScriptErrorLoggerService() {
|
||||
LogFactory.getLog(JavaScriptErrorLoggerService.class);
|
||||
}
|
||||
//~ Methods ..............................................................................................
|
||||
|
||||
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 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) {
|
||||
// Log error message ...
|
||||
if (severity == ERROR_MESSAGE && logger.isErrorEnabled()) {
|
||||
logger.error(msg);
|
||||
} else if (severity == FATAL_MESSAGE && logger.isFatalEnabled()) {
|
||||
logger.fatal(msg);
|
||||
} else if (logger.isInfoEnabled()) {
|
||||
logger.info(msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
// ...........................................................................................................
|
||||
// (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.MindMapNative;
|
||||
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 chartType,
|
||||
String chartXml, final String editorProperties,boolean saveHistory)
|
||||
throws IOException, WiseMappingException {
|
||||
final MindmapService serservice = getMindmapService();
|
||||
final MindMap mindMap = serservice.getMindmapById(mapId);
|
||||
final User user = this.getUser();
|
||||
|
||||
|
||||
MindMapNative nativeBrowser = mindMap.getNativeBrowser();
|
||||
|
||||
if (nativeBrowser == null) {
|
||||
nativeBrowser = new MindMapNative();
|
||||
}
|
||||
|
||||
if ("SVG".equals(chartType)) {
|
||||
nativeBrowser.setSvgXml(chartXml);
|
||||
nativeBrowser.setVmlXml((byte[]) null);
|
||||
} else {
|
||||
nativeBrowser.setVmlXml(chartXml);
|
||||
nativeBrowser.setSvgXml((byte[]) null);
|
||||
}
|
||||
|
||||
mindMap.setNativeBrowser(nativeBrowser);
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user