Log.error("Cannot retrieve node type. Cause: " + caught.getLocalizedMessage(), caught);
}
public void onSuccess(List<GWTJahiaNodeType> result) {
Map<String, GWTJahiaNodeProperty> props = new HashMap<String, GWTJahiaNodeProperty>(2);
props.put("jcr:title", new GWTJahiaNodeProperty("jcr:title",
new GWTJahiaNodePropertyValue(selectedNode.getDisplayName(),
GWTJahiaNodePropertyType.STRING)));
props.put("j:node", new GWTJahiaNodeProperty("j:node",
new GWTJahiaNodePropertyValue(selectedNode,
GWTJahiaNodePropertyType.WEAKREFERENCE)));
if (result.size() == 1) {
EngineLoader.showCreateEngine(editLinker, targetNode, result.get(0), props,
selectedNode.getName(), false);
} else {
Map<GWTJahiaNodeType, List<GWTJahiaNodeType>> m =
new HashMap<GWTJahiaNodeType, List<GWTJahiaNodeType>>();
m.put(null, result);
new ContentTypeWindow(editLinker, targetNode, m, props, selectedNode.getName(), false)
.show();
}
}
});
} else if (SIMPLEMODULE_TYPE.equals(sourceType)) {
// Item move
GWTJahiaNode selectedNode = sourceNodes.get(0);
status.setData(OPERATION_CALLED, "true");
if ("*".equals(name)) {
service.moveAtEnd(selectedNode.getPath(), parentPath, callback);
} else {
service.move(selectedNode.getPath(), targetPath, callback);
}
} else if (CREATE_CONTENT_SOURCE_TYPE.equals(sourceType)) {
// Item creation
status.setData(OPERATION_CALLED, "true");
if ((sourceNodeType.getItems() == null || sourceNodeType.getItems().size() == 0) &&
(sourceNodeType.getInheritedItems() == null ||
sourceNodeType.getInheritedItems().size() == 0)) {
service.createNode(parentPath, null, sourceNodeType.getName(), null, null,
new ArrayList<GWTJahiaNodeProperty>(), null, new BaseAsyncCallback<GWTJahiaNode>() {
public void onApplicationFailure(Throwable throwable) {
Window.alert("Properties save failed\n\n" + throwable.getLocalizedMessage());
Log.error("failed", throwable);
}
public void onSuccess(GWTJahiaNode o) {
Info.display(Messages.get("label.information", "Information"), Messages.get("message.success", "Node created"));
editLinker.refresh(Linker.REFRESH_MAIN);
}
});
} else {
EngineLoader.showCreateEngine(editLinker, targetNode, sourceNodeType,
new HashMap<String, GWTJahiaNodeProperty>(),
targetPath.substring(targetPath.lastIndexOf("/") + 1), false);
}
} else if (QUERY_SOURCE_TYPE.equals(sourceType)) {
// Item creation
status.setData(OPERATION_CALLED, "true");
if ("*".equals(name)) {
service.saveSearch(searchQuery, parentPath, "jnt_query", false, callback);
} else {
service.saveSearch(searchQuery, parentPath, name, false, callback);
}
}
} else if (SIMPLEMODULE_TYPE.equals(targetType)) {
if (referenceType != null) {
status.setData(OPERATION_CALLED, "true");
final GWTJahiaNode selectedNode = sourceNodes.get(0);
JahiaContentManagementService.App.getInstance()
.getNodeTypes(referenceType, new BaseAsyncCallback<List<GWTJahiaNodeType>>() {
public void onApplicationFailure(Throwable caught) {
Window.alert("Cannot retrieve node type. Cause: " + caught.getLocalizedMessage());
Log.error("Cannot retrieve node type. Cause: " + caught.getLocalizedMessage(), caught);
}
public void onSuccess(List<GWTJahiaNodeType> result) {
Map<String, GWTJahiaNodeProperty> props = new HashMap<String, GWTJahiaNodeProperty>(2);
props.put("jcr:title", new GWTJahiaNodeProperty("jcr:title",
new GWTJahiaNodePropertyValue(selectedNode.getDisplayName(),
GWTJahiaNodePropertyType.STRING)));
props.put("j:node", new GWTJahiaNodeProperty("j:node",
new GWTJahiaNodePropertyValue(selectedNode,
GWTJahiaNodePropertyType.WEAKREFERENCE)));
if (result.size() == 1) {
EngineLoader.showCreateEngine(editLinker, targetNode, result.get(0), props,
selectedNode.getName(), true);