|
From: <to...@us...> - 2008-01-11 01:32:37
|
Revision: 98
http://xoperator.svn.sourceforge.net/xoperator/?rev=98&view=rev
Author: tomatop
Date: 2008-01-10 17:32:32 -0800 (Thu, 10 Jan 2008)
Log Message:
-----------
drop templates fixed [1863959]
Modified Paths:
--------------
trunk/xOperator/src/net/sf/xoperator/configuration/SerialisingPersister.java
trunk/xOperator/src/net/sf/xoperator/ui/UIDelegate.java
trunk/xOperator/src/net/sf/xoperator/ui/txt/RemoveAimlTemplate.java
Modified: trunk/xOperator/src/net/sf/xoperator/configuration/SerialisingPersister.java
===================================================================
--- trunk/xOperator/src/net/sf/xoperator/configuration/SerialisingPersister.java 2008-01-07 22:23:40 UTC (rev 97)
+++ trunk/xOperator/src/net/sf/xoperator/configuration/SerialisingPersister.java 2008-01-11 01:32:32 UTC (rev 98)
@@ -92,8 +92,11 @@
configs.put(main.getClass().getCanonicalName() + main.getName(),
main);
- configs.put(proxy.getClass().getCanonicalName() + proxy.getName(),
- proxy);
+ if(proxy!=null){
+ configs.put(proxy.getClass().getCanonicalName() + proxy.getName(),
+ proxy);
+ }
+
// create an intial aiml configuration object
UIAimlConfiguration aiconf = new UIAimlConfiguration();
@@ -275,19 +278,21 @@
String filepath = userFolder.getAbsolutePath() + FILE_SEPARATOR
+ AIML_FOLDER + FILE_SEPARATOR + TEMPLATE_FOLDER
+ FILE_SEPARATOR + USER_TEMPLATE_NAME;
- Document doc = new SAXBuilder().build(filepath);
+// Document doc = new SAXBuilder().build(filepath);
+ Document doc = new Document();
+ doc.setRootElement(new Element("aiml"));
for (AIMLTemplate template : aimlconf.values()) {
if (!template.isPersistet()) {
- if (template.isObsolete()) {
- // delete it
- Element todelete = locateCategoryElementByPattern(doc,
- template.getPattern());
- if (todelete != null) {
- todelete.detach();
- }
-
- }
+// if (template.isObsolete()) {
+// // delete it
+// Element todelete = locateCategoryElementByPattern(doc,
+// template.getPattern());
+// if (todelete != null) {
+// todelete.detach();
+// }
+//
+// }
if (!template.isObsolete()) {
// delete it
Element toupdate = locateCategoryElementByPattern(doc,
@@ -305,16 +310,18 @@
cat.addContent(new Element("template") //.addContent("The result of your query is: ")
.addContent(ext));
ext.setAttribute("param", template.getQuery());
+
doc.getRootElement().addContent(cat);
}
// write it
- new XMLOutputter(Format.getPrettyFormat()).output(doc,
- new FileOutputStream(filepath));
+
change = true;
template.setPersistet(true);
}
}
+ new XMLOutputter(Format.getPrettyFormat()).output(doc,
+ new FileOutputStream(filepath));
} catch (JDOMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Modified: trunk/xOperator/src/net/sf/xoperator/ui/UIDelegate.java
===================================================================
--- trunk/xOperator/src/net/sf/xoperator/ui/UIDelegate.java 2008-01-07 22:23:40 UTC (rev 97)
+++ trunk/xOperator/src/net/sf/xoperator/ui/UIDelegate.java 2008-01-11 01:32:32 UTC (rev 98)
@@ -45,6 +45,7 @@
Message message = (Message) context.blackboard().read(new KindOfFilter(Message.class));
//checks if the interactor can handle this
String messageBody = message.getBody().trim();
+
if (this.interact!=null && this.interact.isInteraction(messageBody)) {
Modified: trunk/xOperator/src/net/sf/xoperator/ui/txt/RemoveAimlTemplate.java
===================================================================
--- trunk/xOperator/src/net/sf/xoperator/ui/txt/RemoveAimlTemplate.java 2008-01-07 22:23:40 UTC (rev 97)
+++ trunk/xOperator/src/net/sf/xoperator/ui/txt/RemoveAimlTemplate.java 2008-01-11 01:32:32 UTC (rev 98)
@@ -30,7 +30,7 @@
@Override
public List<Object> performInternal(String call, NoPlanBlackBoardControl control,
Interactor interactor) {
- String pattern = call.split("\"")[1].toUpperCase();
+ String pattern = call.split(" ")[2].toUpperCase();
Set<?> aimltemps = control.getConfigurationContext().blackboard()
.readAll(new KindOfFilter(AIMLTemplate.class));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|