- Add missing changes.

This commit is contained in:
Paulo Gustavo Veiga 2012-02-21 15:37:15 -03:00
parent fb3f9946ae
commit 7b6cae0fd2
8 changed files with 310 additions and 328 deletions

View File

@ -94,7 +94,7 @@
<filelist dir="${basedir}/src/main/javascript/" <filelist dir="${basedir}/src/main/javascript/"
files="XMLMindmapSerializerFactory.js"/> files="XMLMindmapSerializerFactory.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="PersistenceManager.js"/> <filelist dir="${basedir}/src/main/javascript/" files="PersistenceManager.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="DwrPersistenceManager.js"/> <filelist dir="${basedir}/src/main/javascript/" files="RestPersistenceManager.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="LocalStorageManager.js"/> <filelist dir="${basedir}/src/main/javascript/" files="LocalStorageManager.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="EditorProperties.js"/> <filelist dir="${basedir}/src/main/javascript/" files="EditorProperties.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="IconGroup.js"/> <filelist dir="${basedir}/src/main/javascript/" files="IconGroup.js"/>

View File

@ -16,66 +16,40 @@
* limitations under the License. * limitations under the License.
*/ */
mindplot.DwrPersitenceManager = new Class({ mindplot.RESTPersistenceManager = new Class({
Extends:mindplot.PersistenceManager, Extends:mindplot.PersistenceManager,
initialize: function() { initialize: function(saveUrl) {
this.parent(); this.parent();
$assert(saveUrl, "saveUrl can not be null");
this.saveUrl = saveUrl;
}, },
saveMapXml : function(mapId, mapXml, pref, saveHistory, events) { saveMapXml : function(mapId, mapXml, pref, saveHistory, events) {
window.MapEditorService.saveMap(mapId, mapXml, pref, saveHistory, {
callback:function(response) {
if (response.msgCode != "OK") {
events.onError(response);
} else {
events.onSuccess(response);
}
},
errorHandler:function(message) { var data = {
events.onError(message); id:mapId,
}, xml: mapXml,
verb:"POST", properties: pref
async: true };
}
)
},
loadMapDom : function(mapId) { var request = new Request({
$assert(mapId, "mapId can not be null"); url:this.saveUrl + mapId,
throw "This must be implemented"; method: 'put',
onSuccess:function(responseText, responseXML) {
events.onSuccess();
// var result = {r:null}; },
// window.MapEditorService.loadMap(mapId, { onException:function(headerName, value) {
// callback:function(response) { events.onError();
// },
// if (response.msgCode == "OK") { onFailure:function(xhr) {
// // Explorer Hack with local files ... events.onError();
// var xmlContent = response.content; },
// var domDocument = core.Utils.createDocumentFromText(xmlContent); headers: {"Content-Type":"application/json","Accept":"application/json"},
// var serializer = mindplot.XMLMindmapSerializerFactory.getSerializerFromDocument(domDocument); emulation:false,
// var mindmap = serializer.loadFromDom(domDocument); urlEncoded:false
// mindmap.setId(mapId); });
// request.put(JSON.encode(data));
// result.r = mindmap;
// } else {
// // Handle error message ...
// var msg = response.msgDetails;
// var monitor = core.ToolbarNotifier.getInstance();
// monitor.logFatal("We're sorry, an error has occurred and we can't load your map. Please try again in a few minutes.");
//// wLogger.error(msg);
// }
// },
// verb:"GET",
// async: false,
// errorHandler:function(msg) {
// var monitor = core.ToolbarNotifier.getInstance();
// monitor.logFatal("We're sorry, an error has occurred and we can't load your map. Please try again in a few minutes.");
//// wLogger.error(msg);
// }
// });
//
// return result.r;
} }
} }
); );

View File

@ -59,7 +59,7 @@ mindplot.widget.IMenu = new Class({
onError: function() { onError: function() {
if (saveHistory) { if (saveHistory) {
saveElem.setStyle('cursor', 'pointer'); saveElem.setStyle('cursor', 'pointer');
$notify("Save could not be completed. Try latter"); $notify("Save could not be completed. Try latter.");
} }
} }
}); });

View File

@ -40,7 +40,12 @@ function buildDesigner(options) {
// Configure default persistence manager ... // Configure default persistence manager ...
var persistence; var persistence;
if (options.persistenceManager) { if (options.persistenceManager) {
if(options.persistenceManager instanceof String) {
persistence = eval("new " + options.persistenceManager + "()"); persistence = eval("new " + options.persistenceManager + "()");
}
else {
persistence = options.persistenceManager;
}
} else { } else {
persistence = new mindplot.LocalStorageManager(); persistence = new mindplot.LocalStorageManager();

View File

@ -18,11 +18,9 @@
package com.wisemapping.model; package com.wisemapping.model;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable; import java.io.Serializable;
import java.util.*; import java.util.*;
@XmlRootElement(name = "user")
public class User public class User
extends Collaborator extends Collaborator
implements Serializable { implements Serializable {

View File

@ -17,12 +17,12 @@ public class AuthenticationProvider implements org.springframework.security.auth
private PasswordEncoder encoder; private PasswordEncoder encoder;
@Override @Override()
public Authentication authenticate(@NotNull final Authentication auth) throws AuthenticationException { public Authentication authenticate(@NotNull final Authentication auth) throws AuthenticationException {
// All your user authentication needs // All your user authentication needs
final String email = auth.getName(); final String email = auth.getName();
final User user = userManager.getUserBy(email); final User user = userManager.getUserBy(email);
final String credentials = (String) auth.getCredentials(); final String credentials = (String) auth.getCredentials();
if (user == null || credentials == null || !encoder.isPasswordValid(user.getPassword(), credentials, null)) { if (user == null || credentials == null || !encoder.isPasswordValid(user.getPassword(), credentials, null)) {

View File

@ -2,6 +2,7 @@ package com.wisemapping.test.model;
import com.wisemapping.rest.model.RestMindmap; import com.wisemapping.rest.model.RestMindmap;
import com.wisemapping.rest.model.RestUser;
import org.codehaus.jackson.map.DeserializationConfig; import org.codehaus.jackson.map.DeserializationConfig;
import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.ObjectMapper;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -13,10 +14,14 @@ public class JsonTest {
@Test @Test
void deserialize() throws IOException { void deserialize() throws IOException {
String json = "{\"id\":\"1\",\"xml\":\"<map name=\\\"1\\\" version=\\\"tango\\\"><topic central=\\\"true\\\" text=\\\"ss\\\" id=\\\"1\\\"/></map>\",\"properties\":\"{\\\"zoom\\\":0.85}\"}"; String mapJson = "{\"id\":\"1\",\"xml\":\"<map name=\\\"1\\\" version=\\\"tango\\\"><topic central=\\\"true\\\" text=\\\"ss\\\" id=\\\"1\\\"/></map>\",\"properties\":\"{\\\"zoom\\\":0.85}\"}";
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
final RestMindmap restMindmap = mapper.readValue(json, RestMindmap.class); final RestMindmap restMindmap = mapper.readValue(mapJson, RestMindmap.class);
String userJson = "{\"username\":\"admin\",\"email\":\"admin@wisemapping.org\",\"tags\":[],\"creationDate\":1329706800000,\"firstname\":\"Wise\",\"lastname\":\"test\",\"password\":\"test\"}";
final RestUser restUser = mapper.readValue(userJson, RestUser.class);
} }
} }