Revision: 1084
Author:
tbc...@gmail.com
Date: Fri Jun 28 15:36:49 2013
Log: Source creation on Web Browser and XML write v1 @mhk_families
http://code.google.com/p/mhk/source/detail?r=1084
Added:
/branches/mhk_families/idb/etc/template/new/create_source.vm
/branches/mhk_families/idb/lib/json-simple-1.1.1.jar
/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/parser/SaveWebSource.java
/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/servlet/CreateSource.java
/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/servlet/SaveSource.java
Modified:
/branches/mhk_families/idb/etc/template/new/header.vm
/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/resources/MHKStrings.properties
/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/resources/MHKStrings_pt.properties
/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/servlet/CentralServlet.java
=======================================
--- /dev/null
+++ /branches/mhk_families/idb/etc/template/new/create_source.vm Fri Jun 28
15:36:49 2013
@@ -0,0 +1,304 @@
+#set ( $title = "$mhks.get('createSource')")
+
+#set ( $help = "createSource")
+
+#parse("new/head.vm")
+
+
+<script>
+ var count_persons=1;
+ var count_relations=1;
+ var count_attributes=1;
+
+ var source=new Object();
+ var persons=new Array();
+ var relations=new Array();
+ var attributes=new Array();
+
+ function removePerson(row){
+
+ var box=confirm("Deleting this person will remove all attributes and
relations associated! Are you sure you want to continue?");
+
+ if (box==false){
+ return;
+ }
+
+ ##get person id
+ var i=row.parentNode.parentNode.rowIndex;
+ var
id=document.getElementById('persons_table').rows[i].cells[0].innerHTML;
+
+ ##remove person from table
+ document.getElementById('persons_table').deleteRow(i);
+
+ ##remove person from array
+ for (var j=0;j<persons.length;j++){
+ if(persons[j].id==id){
+ persons.splice(j,1);
+ break;
+ }
+ }
+
+ ##remove relations from table
+ var size=document.getElementById('relations_table').rows.length;
+ var rows=document.getElementById('relations_table').rows;
+ var reduce_lines=0;
+ for (var j=1;j<size-reduce_lines;j++){
+ if(rows[j].cells[3].innerHTML==id || rows[j].cells[4].innerHTML==id){
+ document.getElementById('relations_table').deleteRow(j);
+ reduce_lines++;
+ j--;
+ }
+ }
+
+ ##remove relations from this person from array
+ for (var j=0;j<relations.length;j++){
+ if(relations[j].origin==id || relations[j].destination==id){
+ relations.splice(j,1);
+ }
+ }
+
+ ##remove attributes from table
+ size=document.getElementById('attributes_table').rows.length;
+ rows=document.getElementById('attributes_table').rows;
+ reduce_lines=0;
+ for (var j=1;j<size-reduce_lines;j++){
+ if(rows[j].cells[3].innerHTML==id){
+ document.getElementById('attributes_table').deleteRow(j);
+ reduce_lines++;
+ j--;
+ }
+ }
+
+ ##remove attibutes from this person from array
+ for (var j=0;j<attributes.length;j++){
+ if(attributes[j].person_id==id || attributes[j].person_id==id){
+ attributes.splice(j,1);
+ }
+ }
+
+ }
+ function removeRelation(row){
+ ##get relation id
+ var i=row.parentNode.parentNode.rowIndex;
+ var
id=document.getElementById('relations_table').rows[i].cells[0].innerHTML;
+
+ ##remove relation from table
+ document.getElementById('relations_table').deleteRow(i);
+
+ ##remove relation from array
+ for (var j=0;j<relations.length;j++){
+ if(relations[j].id==id){
+ relations.splice(j,1);
+ break;
+ }
+ }
+ }
+ function removeAttrib(row){
+ ##get attribute id
+ var i=row.parentNode.parentNode.rowIndex;
+ var
id=document.getElementById('attributes_table').rows[i].cells[0].innerHTML;
+
+ ##remove attribute from table
+ document.getElementById('attributes_table').deleteRow(i);
+
+ ##remove attribute from array
+ for (var j=0;j<attributes.length;j++){
+ if(attributes[j].id==id){
+ attributes.splice(j,1);
+ break;
+ }
+ }
+ }
+
+ function printPersonsTable(){
+ var person=new Object();
+
person.name=document.getElementById("person_name").value;
+ person.sex=document.getElementById("person_sex").value;
+ person.observation=document.getElementById("person_observation").value;
+
person.id=count_persons;
+ persons.push(person);
+
+ var table = document.getElementById("persons_table");
+ var row=table.insertRow(1);
+
+ var id=row.insertCell(0);
+ id.innerHTML=
person.id;
+
+ var name=row.insertCell(1);
+ name.innerHTML=
person.name;
+
+ var sex=row.insertCell(2);
+ sex.innerHTML=person.sex;
+
+ var observation=row.insertCell(3);
+ observation.innerHTML=person.observation;
+
+ var button=row.insertCell(4);
+ button.innerHTML="<input type='button' value='Remove Person'
onClick='removePerson(this)'>";
+
+ count_persons++;
+ }
+
+ function printRelationsTable(){
+ var relation=new Object();
+ relation.origin=document.getElementById("origin_id").value;
+ relation.destination=document.getElementById("destination_id").value;
+ relation.type=document.getElementById("relation_type").value;
+ relation.value=document.getElementById("relation_value").value;
+
relation.observation=document.getElementById("relation_observation").value;
+
relation.id=count_relations;
+ relations.push(relation);
+
+ var table = document.getElementById("relations_table");
+ var row=table.insertRow(1);
+
+ var id=row.insertCell(0);
+ id.innerHTML=
relation.id;
+
+ var type=row.insertCell(1);
+ type.innerHTML=relation.type;
+
+ var value=row.insertCell(2);
+ value.innerHTML=relation.value;
+
+ var origin=row.insertCell(3);
+ origin.innerHTML=relation.origin;
+
+ var destination=row.insertCell(4);
+ destination.innerHTML=relation.destination;
+
+ var observation=row.insertCell(5);
+ observation.innerHTML=relation.observation;
+
+ var button=row.insertCell(6);
+ button.innerHTML="<input type='button' value='Remove Relation'
onClick='removeRelation(this)'>";
+
+ count_relations++;
+ }
+
+ function printAttributesTable(){
+ var attribute=new Object();
+
attribute.name=document.getElementById("attribute_name").value;
+ attribute.value=document.getElementById("attribute_value").value;
+ attribute.person_id=document.getElementById("person_id").value;
+
attribute.observation=document.getElementById("attribute_observation").value;
+
attribute.id=count_attributes;
+ attributes.push(attribute);
+
+ var table = document.getElementById("attributes_table");
+ var row=table.insertRow(1);
+
+ var id=row.insertCell(0);
+ id.innerHTML=
attribute.id;
+
+ var name=row.insertCell(1);
+ name.innerHTML=
attribute.name;
+
+ var value=row.insertCell(2);
+ value.innerHTML=attribute.value;
+
+ var person_id=row.insertCell(3);
+ person_id.innerHTML=attribute.person_id;
+
+ var observation=row.insertCell(4);
+ observation.innerHTML=attribute.observation;
+
+ var button=row.insertCell(5);
+ button.innerHTML="<input type='button' value='Remove Attribute'
onClick='removeAttrib(this)'>";
+ count_attributes++;
+ }
+
+ function submitForm() {
+
+
source.name=document.getElementById("source_name").value;
+
+ if(
source.name==""){
+ alert("You need to define at least the source name to save.");
+ return;
+ }
+
+ source.type=document.getElementById("source_type").value;
+ source.observation=document.getElementById("source_observation").value;
+
+ ##IF SOURCE NAME NOT DEFINED RETURN
+
+ var jsonDataObject = new Object();
+ jsonDataObject.source = source;
+ jsonDataObject.persons = persons;
+ jsonDataObject.attributes = attributes;
+ jsonDataObject.relations = relations;
+
+ ##turn the jsonData object into a string so it can be passed to the
servlet
+ var jsonData = JSON.stringify(jsonDataObject);
+ var xmlhttp;
+
+ if (window.XMLHttpRequest){
+ ## code for IE7+, Firefox, Chrome, Opera, Safari
+ xmlhttp=new XMLHttpRequest();
+ }
+ else{
+ ## code for IE6, IE5
+ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
+ }
+
+
xmlhttp.open("POST","${uri}?dbname=$!dbname&action=save_source&script=create_source.vm",true);
+
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+ xmlhttp.send('json='+encodeURIComponent(jsonData));
+ }
+</script>
+
+</head>
+
+<body>
+#parse("new/header.vm")
+
+<div id="main">
+
+ <h2>$mhks.get("createSource") »</h2>
+ <form action="">
+ Source Name*: <input type="text" id="source_name"><br>
+ Source Type: <input type="text" id="source_type">Source Description:
<input type="text" id="source_observation"><br>
+
+ <h3>Persons »</h3>
+ <table id="persons_table">
+ <tr>
+ <td>Person Id</td>
+ <td>Person Name</td>
+ <td>Person Sex</td>
+ <td>Person Observation</td>
+ </tr>
+ </table>
+ Person Name: <input type="text" id="person_name">Person Sex: <input
type="text" id="person_sex">Person Observation: <input type="text"
id="person_observation"><input type="button" value="Add Person"
onClick="printPersonsTable()"><br>
+
+ <h3>Attributes »</h3>
+ <table id="attributes_table">
+ <tr>
+ <td>Attribute Id</td>
+ <td>Attribute Name</td>
+ <td>Attribute Value</td>
+ <td>Person Id</td>
+ <td>Attribute Observation</td>
+ </tr>
+ </table>
+ Attribute Name: <input type="text" id="attribute_name">Attribute Value:
<input type="text" id="attribute_value">Person Id: <input type="text"
id="person_id">Attribute Observation: <input type="text"
id="attribute_observation"><input type="button" value="Add Attribute"
onClick="printAttributesTable()"><br>
+
+ <h3>Relations »</h3>
+ <table id="relations_table">
+ <tr>
+ <td>Relation Id</td>
+ <td>Relation Type</td>
+ <td>Relation Value</td>
+ <td>Relation Origin</td>
+ <td>Relation Destination</td>
+ <td>Relation Observation</td>
+ </tr>
+ </table>
+ Relation Type: <input type="text" id="relation_type">Relation Value:
<input type="text" id="relation_value">Origin Id: <input type="text"
id="origin_id">Destination Id: <input type="text"
id="destination_id">Relation Observation: <input type="text"
id="relation_observation"><input type="button" value="Add Relation"
onClick="printRelationsTable()"><br>
+
+ <input type="button" value="Save" onclick="submitForm()">
+ </form>
+</div>
+
+#parse("new/footer.vm")
+</body>
+</html>
=======================================
--- /dev/null
+++ /branches/mhk_families/idb/lib/json-simple-1.1.1.jar Fri Jun 28
15:36:49 2013
Binary file, no diff available.
=======================================
--- /dev/null
+++
/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/parser/SaveWebSource.java
Fri Jun 28 15:36:49 2013
@@ -0,0 +1,913 @@
+/** SaveWebSource.java
+// idb
+//
+// Created by Tiago Ceia on Jun 20 2013.
+*/
+package pt.uc.cisuc.jrc.mhk.parser;
+import org.json.simple.*;
+import org.jdom2.Document;
+import org.jdom2.Element;
+import org.jdom2.output.Format;
+import org.jdom2.output.XMLOutputter;
+import java.io.FileWriter;
+import java.io.IOException;
+
+public class SaveWebSource {
+ private Element root;
+ private int count_attributes;
+ //private int count_person_ocur;
+ private int count_relations;
+ private int count_individuals;
+ //private int count_events;
+ private String filename;
+
+ public SaveWebSource() {}
+
+ public void start(String path, JSONObject jsonData){
+ count_attributes=1;
+ count_relations=1;
+ count_individuals=1;
+ //count_events=1;
+ //count_person_ocur=1;
+
+ //XML root
+ root = new Element("KLEIO");
+ root.setAttribute("STRUCTURE","WEBSOURCE");
+ root.setAttribute("SOURCE",path);
+
+
+
+
+ //Write XML classes
+ Element define_class;
+ define_class=getSourceClass();
+ root.addContent(define_class);
+
+ define_class=getIndividualClass();
+ root.addContent(define_class);
+
+ define_class=getAttributeClass();
+ root.addContent(define_class);
+
+ define_class=getRelationClass();
+ root.addContent(define_class);
+
+// define_class=getEventClass();
+// root.addContent(define_class);
+// writeRpt("[GedcomParser] Writing Event class...\n");
+
+ createXML(jsonData);
+
+ Document doc = new Document(root);
+ XMLOutputter xmlOutput = new XMLOutputter();
+
+ // display nice nice
+ xmlOutput.setFormat(Format.getPrettyFormat());
+ try {
+ xmlOutput.output(doc, new FileWriter(path+"\\"+this.filename+".xml"));
+ System.out.println("FILE SAVED!");
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ private void createXML(JSONObject jsonData){
+ JSONObject source_obj = (JSONObject) jsonData.get("source");
+ JSONArray persons_array = (JSONArray) jsonData.get("persons");
+ JSONArray relations_array = (JSONArray) jsonData.get("relations");
+ JSONArray attributes_array = (JSONArray)
jsonData.get("attributes");
+
+ this.filename=(String)source_obj.get("name");
+
+ writeSource(source_obj);
+ writeIndividuals(persons_array);
+ writeAttributes(attributes_array);
+ writeRelations(relations_array);
+ }
+
+ private void writeSource(JSONObject source_obj){
+ String sourceId="WEBSOURCE-"+this.filename;
+ Element source=new Element("GROUP");
+ source.setAttribute("ID",sourceId);
+ source.setAttribute("NAME","web_fonte");
+ source.setAttribute("CLASS","source");
+
+ Element s,core;
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","id");
+ s.setAttribute("CLASS","id");
+ core=new Element("core");
+ core.addContent(sourceId);
+ s.addContent(core);
+ source.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","groupname");
+ s.setAttribute("CLASS","groupname");
+ core=new Element("core");
+ core.addContent("web_source");
+ s.addContent(core);
+ source.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","inside");
+ s.setAttribute("CLASS","inside");
+ core=new Element("core");
+ core.addContent("root");
+ s.addContent(core);
+ source.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","class");
+ s.setAttribute("CLASS","class");
+ core=new Element("core");
+ core.addContent("source");
+ s.addContent(core);
+ source.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","kleiofile");
+ s.setAttribute("CLASS","kleiofile");
+ core=new Element("core");
+ core.addContent(this.filename);
+ s.addContent(core);
+ source.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","type");
+ s.setAttribute("CLASS","type");
+ core=new Element("core");
+ core.addContent("WebSource");
+ s.addContent(core);
+ source.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","obs");
+ s.setAttribute("CLASS","obs");
+ core=new Element("core");
+ core.addContent((String)source_obj.get("observation"));
+ s.addContent(core);
+ source.addContent(s);
+
+ root.addContent(source);
+ }
+
+ private void writeIndividuals(JSONArray individuals){
+ for (int i=0;i<individuals.size();i++){
+ JSONObject person = (JSONObject)individuals.get(i);
+ String
individualId="WEBSOURCE-"+this.filename+"-person-"+count_individuals;
+ Element individual=new Element("GROUP");
+ Element s,core;
+ individual.setAttribute("ID",individualId);
+ individual.setAttribute("NAME","n");
+ individual.setAttribute("CLASS","person");
+ individual.setAttribute("GROUP","n");
+ individual.setAttribute("LEVEL","0");
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","id");
+ s.setAttribute("CLASS","id");
+ core=new Element("core");
+ core.addContent(individualId);
+ s.addContent(core);
+ individual.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","groupname");
+ s.setAttribute("CLASS","groupname");
+ core=new Element("core");
+ core.addContent("n");
+ s.addContent(core);
+ individual.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","inside");
+ s.setAttribute("CLASS","inside");
+ core=new Element("core");
+ core.addContent(this.filename);
+ s.addContent(core);
+ individual.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","class");
+ s.setAttribute("CLASS","class");
+ core=new Element("core");
+ core.addContent("person");
+ s.addContent(core);
+ individual.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","level");
+ s.setAttribute("CLASS","level");
+ core=new Element("core");
+ core.addContent("0");
+ s.addContent(core);
+ individual.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","nome");
+ s.setAttribute("CLASS","name");
+ core=new Element("core");
+ core.addContent((String)person.get("name"));
+ s.addContent(core);
+ individual.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","sex");
+ s.setAttribute("CLASS","sex");
+ core=new Element("core");
+ core.addContent((String)person.get("sex"));
+ s.addContent(core);
+ individual.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","obs");
+ s.setAttribute("CLASS","obs");
+ core=new Element("core");
+ core.addContent((String)person.get("observation"));
+ s.addContent(core);
+ individual.addContent(s);
+
+ root.addContent(individual);
+ writeSameAsRelation(individualId);
+ count_individuals++;
+ }
+ }
+
+ private void writeAttributes(JSONArray attributes){
+ for (int i=0;i<attributes.size();i++){
+ JSONObject attribute_obj = (JSONObject)attributes.get(i);
+ Element attribute=new Element("GROUP");
+ String
attributeId="WEBSOURCE-"+this.filename+"-attribute-"+count_attributes;
+ String
individualId="WEBSOURCE-"+this.filename+"-person-"+(String)attribute_obj.get("person_id");
+ attribute.setAttribute("ID",attributeId);
+ attribute.setAttribute("NAME","ls");
+ attribute.setAttribute("CLASS","attribute");
+
+ Element s,core;
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","id");
+ s.setAttribute("CLASS","id");
+ core=new Element("core");
+ core.addContent(attributeId);
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","groupname");
+ s.setAttribute("CLASS","groupname");
+ core=new Element("core");
+ core.addContent("ls");
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","inside");
+ s.setAttribute("CLASS","inside");
+ core=new Element("core");
+ core.addContent(individualId);
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","class");
+ s.setAttribute("CLASS","class");
+ core=new Element("core");
+ core.addContent("attribute");
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","entity");
+ s.setAttribute("CLASS","entity");
+ core=new Element("core");
+ core.addContent(individualId);
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","tipo");
+ s.setAttribute("CLASS","type");
+ core=new Element("core");
+ core.addContent((String)attribute_obj.get("name"));
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","valor");
+ s.setAttribute("CLASS","value");
+ core=new Element("core");
+ core.addContent((String)attribute_obj.get("value"));
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","obs");
+ s.setAttribute("CLASS","obs");
+ core=new Element("core");
+ core.addContent((String)attribute_obj.get("observation"));
+ s.addContent(core);
+ attribute.addContent(s);
+
+ root.addContent(attribute);
+ count_attributes++;
+ }
+ }
+
+ private void writeRelations(JSONArray relations){
+
+ for(int i=0;i<relations.size();i++){
+ JSONObject relation_obj = (JSONObject)relations.get(i);
+ Element attribute=new Element("GROUP");
+ String
relationId="WEBSOURCE-"+this.filename+"-relation-"+count_relations;
+ String
individualId="WEBSOURCE-"+this.filename+"-person-"+(String)relation_obj.get("origin");
+ String
destinationId="WEBSOURCE-"+this.filename+"-person-"+(String)relation_obj.get("destination");
+ attribute.setAttribute("ID",relationId);
+ attribute.setAttribute("NAME","relation");
+ attribute.setAttribute("CLASS","relation");
+
+ Element s,core;
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","groupname");
+ s.setAttribute("CLASS","groupname");
+ core=new Element("core");
+ core.addContent("relation");
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","inside");
+ s.setAttribute("CLASS","inside");
+ core=new Element("core");
+ core.addContent(individualId);
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","class");
+ s.setAttribute("CLASS","class");
+ core=new Element("core");
+ core.addContent("relation");
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","tipo");
+ s.setAttribute("CLASS","type");
+ core=new Element("core");
+ core.addContent((String)relation_obj.get("type"));
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","destname");
+ s.setAttribute("CLASS","destname");
+ core=new Element("core");
+ core.addContent("individual");
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","origin");
+ s.setAttribute("CLASS","origin");
+ core=new Element("core");
+ core.addContent(individualId);
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","destination");
+ s.setAttribute("CLASS","destination");
+ core=new Element("core");
+ core.addContent(destinationId);
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","id");
+ s.setAttribute("CLASS","id");
+ core=new Element("core");
+ core.addContent(relationId);
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","value");
+ s.setAttribute("CLASS","value");
+ core=new Element("core");
+ core.addContent((String)relation_obj.get("value"));
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","obs");
+ s.setAttribute("CLASS","ons");
+ core=new Element("core");
+ core.addContent((String)relation_obj.get("observation"));
+ s.addContent(core);
+ attribute.addContent(s);
+
+ root.addContent(attribute);
+ count_relations++;
+ }
+ }
+
+ private void writeSameAsRelation(String individualId){
+ Element attribute=new Element("RELATION");
+ String
relationId="WEBSOURCE-"+this.filename+"-relation-"+count_relations;
+ attribute.setAttribute("ID",relationId);
+ attribute.setAttribute("ORG",individualId);
+ attribute.setAttribute("DEST",individualId);
+ attribute.setAttribute("TYPE","META");
+ attribute.setAttribute("VALUE","same_as");
+
+ root.addContent(attribute);
+
+ attribute=new Element("GROUP");
+ relationId="GEDCOM-"+this.filename+"-relation-"+count_relations;
+ attribute.setAttribute("ID",relationId);
+ attribute.setAttribute("NAME","relation");
+ attribute.setAttribute("CLASS","relation");
+
+ Element s=new Element("ELEMENT");
+ s.setAttribute("NAME","groupname");
+ s.setAttribute("CLASS","groupname");
+ Element core=new Element("core");
+ core.addContent("relation");
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","inside");
+ s.setAttribute("CLASS","inside");
+ core=new Element("core");
+ core.addContent(individualId);
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","class");
+ s.setAttribute("CLASS","class");
+ core=new Element("core");
+ core.addContent("relation");
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","tipo");
+ s.setAttribute("CLASS","type");
+ core=new Element("core");
+ core.addContent("identification");
+ s.addContent(core);
+ attribute.addContent(s);
+
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","destname");
+ s.setAttribute("CLASS","destname");
+ core=new Element("core");
+ core.addContent("N/A");
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","origin");
+ s.setAttribute("CLASS","origin");
+ core=new Element("core");
+ core.addContent(individualId);
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","destination");
+ s.setAttribute("CLASS","destination");
+ core=new Element("core");
+ core.addContent(individualId);
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","id");
+ s.setAttribute("CLASS","id");
+ core=new Element("core");
+ core.addContent(relationId);
+ s.addContent(core);
+ attribute.addContent(s);
+
+ s=new Element("ELEMENT");
+ s.setAttribute("NAME","value");
+ s.setAttribute("CLASS","value");
+ core=new Element("core");
+ core.addContent("same as");
+ s.addContent(core);
+ attribute.addContent(s);
+
+ count_relations++;
+ root.addContent(attribute);
+ }
+
+ /**Writes the definition of the Source class on the XML outputter
+ *
+ */
+ private Element getSourceClass(){
+ Element element=new Element("CLASS");
+ element.setAttribute("NAME","source");
+ element.setAttribute("SUPER","entity");
+ element.setAttribute("TABLE","sources");
+ element.setAttribute("GROUP","gedcom_fonte");
+
+ Element attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","id");
+ attribute.setAttribute("COLUMN","id");
+ attribute.setAttribute("CLASS","id");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","64");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","1");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","date");
+ attribute.setAttribute("COLUMN","the_date");
+ attribute.setAttribute("CLASS","date");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","24");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","type");
+ attribute.setAttribute("COLUMN","the_type");
+ attribute.setAttribute("CLASS","type");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","32");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","value");
+ attribute.setAttribute("COLUMN","the_value");
+ attribute.setAttribute("CLASS","value");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","254");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","loc");
+ attribute.setAttribute("COLUMN","loc");
+ attribute.setAttribute("CLASS","loc");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","64");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","ref");
+ attribute.setAttribute("COLUMN","ref");
+ attribute.setAttribute("CLASS","ref");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","64");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","kleiofile");
+ attribute.setAttribute("COLUMN","kleiofile");
+ attribute.setAttribute("CLASS","kleiofile");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","512");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","obs");
+ attribute.setAttribute("COLUMN","obs");
+ attribute.setAttribute("CLASS","obs");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","1024");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+ return element;
+ }
+
+ /** Writes definition of the Individual class on the XML outputter
+ *
+ */
+ private Element getIndividualClass(){
+ Element element=new Element("CLASS");
+ element.setAttribute("NAME","person");
+ element.setAttribute("SUPER","entity");
+ element.setAttribute("TABLE","persons");
+ element.setAttribute("GROUP","n");
+
+ Element attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","id");
+ attribute.setAttribute("COLUMN","id");
+ attribute.setAttribute("CLASS","id");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","64");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","1");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","name");
+ attribute.setAttribute("COLUMN","name");
+ attribute.setAttribute("CLASS","name");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","64");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","sex");
+ attribute.setAttribute("COLUMN","sex");
+ attribute.setAttribute("CLASS","sex");
+ attribute.setAttribute("TYPE","char");
+ attribute.setAttribute("SIZE","1");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","obs");
+ attribute.setAttribute("COLUMN","obs");
+ attribute.setAttribute("CLASS","obs");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","1024");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+ return element;
+ }
+
+ /** Writes definition of the Attribute class on the XML outputter
+ *
+ */
+ private Element getAttributeClass(){
+ Element element=new Element("CLASS");
+ element.setAttribute("NAME","attribute");
+ element.setAttribute("SUPER","entity");
+ element.setAttribute("TABLE","attributes");
+ element.setAttribute("GROUP","ls");
+
+ Element attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","id");
+ attribute.setAttribute("COLUMN","id");
+ attribute.setAttribute("CLASS","id");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","64");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","1");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","entity");
+ attribute.setAttribute("COLUMN","entity");
+ attribute.setAttribute("CLASS","entity");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","64");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","date");
+ attribute.setAttribute("COLUMN","the_date");
+ attribute.setAttribute("CLASS","date");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","24");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","type");
+ attribute.setAttribute("COLUMN","the_type");
+ attribute.setAttribute("CLASS","type");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","32");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","value");
+ attribute.setAttribute("COLUMN","the_value");
+ attribute.setAttribute("CLASS","value");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","254");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","obs");
+ attribute.setAttribute("COLUMN","obs");
+ attribute.setAttribute("CLASS","obs");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","1024");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+ return element;
+ }
+
+ /** Writes definition of the Relation class on the XML outputter
+ *
+ */
+ private Element getRelationClass(){
+ Element element=new Element("CLASS");
+ element.setAttribute("NAME","relation");
+ element.setAttribute("SUPER","entity");
+ element.setAttribute("TABLE","relations");
+ element.setAttribute("GROUP","relation");
+
+ Element attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","id");
+ attribute.setAttribute("COLUMN","id");
+ attribute.setAttribute("CLASS","id");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","64");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","1");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","date");
+ attribute.setAttribute("COLUMN","the_date");
+ attribute.setAttribute("CLASS","date");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","24");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","origin");
+ attribute.setAttribute("COLUMN","origin");
+ attribute.setAttribute("CLASS","origin");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","64");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","destination");
+ attribute.setAttribute("COLUMN","destination");
+ attribute.setAttribute("CLASS","destination");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","64");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","type");
+ attribute.setAttribute("COLUMN","the_type");
+ attribute.setAttribute("CLASS","type");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","32");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","value");
+ attribute.setAttribute("COLUMN","the_value");
+ attribute.setAttribute("CLASS","value");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","254");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","obs");
+ attribute.setAttribute("COLUMN","obs");
+ attribute.setAttribute("CLASS","obs");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","1024");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+ return element;
+ }
+
+ /** Writes definition of the Event class on the XML outputter
+ *
+ */
+ private Element getEventClass(){
+ Element element=new Element("CLASS");
+ element.setAttribute("NAME","act");
+ element.setAttribute("TABLE","acts");
+ element.setAttribute("GROUP","act");
+
+ Element attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","id");
+ attribute.setAttribute("COLUMN","id");
+ attribute.setAttribute("CLASS","id");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","64");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","1");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","date");
+ attribute.setAttribute("COLUMN","the_date");
+ attribute.setAttribute("CLASS","date");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","24");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","type");
+ attribute.setAttribute("COLUMN","the_type");
+ attribute.setAttribute("CLASS","type");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","32");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","loc");
+ attribute.setAttribute("COLUMN","loc");
+ attribute.setAttribute("CLASS","loc");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","64");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","ref");
+ attribute.setAttribute("COLUMN","ref");
+ attribute.setAttribute("CLASS","ref");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","32");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+
+ attribute=new Element("ATTRIBUTE");
+ attribute.setAttribute("NAME","obs");
+ attribute.setAttribute("COLUMN","obs");
+ attribute.setAttribute("CLASS","obs");
+ attribute.setAttribute("TYPE","varchar");
+ attribute.setAttribute("SIZE","1024");
+ attribute.setAttribute("PRECISION","0");
+ attribute.setAttribute("PKEY","0");
+
+ element.addContent(attribute);
+ return element;
+ }
+}
=======================================
--- /dev/null
+++
/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/servlet/CreateSource.java
Fri Jun 28 15:36:49 2013
@@ -0,0 +1,32 @@
+package pt.uc.cisuc.jrc.mhk.servlet;
+/*
+ *
+ * CreateSource ===========
+ *
+ * CreateSource.java, 2013/05/20 Tiago Ceia
+ */
+import org.apache.velocity.context.Context;
+import pt.uc.cisuc.jrc.mhk.rch.DBSystem;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+
+public class CreateSource extends Command {
+ /** Name of the Template */
+ public static final String SOURCE = "create_source.vm";
+
+ public CreateSource(ServletContext con, HttpServletRequest req,
HttpServletResponse resp) {
+ super(con, req, resp);
+ }
+
+ public String exec(Context ctx) {
+ System.out.println("CREATESOURCE");
+
+
+
+
ctx.put("bgthread",request.getSession().getAttribute("background.thread"));
+ return SOURCE;
+ }
+}
=======================================
--- /dev/null
+++ /branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/servlet/SaveSource.java
Fri Jun 28 15:36:49 2013
@@ -0,0 +1,69 @@
+package pt.uc.cisuc.jrc.mhk.servlet;
+/*
+ *
+ * SaveSource ===========
+ *
+ * SaveSource.java, 2013/05/20 Tiago Ceia
+ */
+import org.apache.velocity.context.Context;
+import pt.uc.cisuc.jrc.mhk.rch.DBSystem;
+import pt.uc.cisuc.jrc.mhk.parser.SaveWebSource;
+
+import org.json.simple.*;
+import java.io.File;
+
+
+import java.util.Vector;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+public class SaveSource extends Command {
+ /** Name of the Template */
+ public static final String SOURCE = "create_source.vm";
+
+ public SaveSource(ServletContext con, HttpServletRequest req,
HttpServletResponse resp) {
+ super(con, req, resp);
+ }
+
+ public String exec(Context ctx) {
+ System.out.println("SAVESOURCE");
+ String json = (String)request.getParameter("json");
+ //System.out.println(json);
+ JSONObject jsonData = (JSONObject) JSONValue.parse(json);
+
+ System.out.println("[SaveSource.exec] Getting the session.");
+ HttpSession session = request.getSession();
+ System.out.println("[SaveSource.exec] checking the user.");
+ String userID = (String) session.getAttribute("userID");
+ if (userID == null) { // check if there is a default user
+ System.out.println("[SaveSource.exec] No user. Trying default
user.");
+ userID = (String) context.getAttribute("mhk.user.default");
+ if (userID != null) {
+ System.out.println("[SaveSource.exec] Default user used.");
+ session.setAttribute("userID", userID);
+ }
+ }
+
+ String bd = (String) context.getAttribute("mhk.sources.base.dir."
+ userID);
+
+ if (bd == null) bd = ".";
+ System.out.println("[SaveWebSource.exec] directory: " + bd);
+
+ String currentdir = (String) request.getParameter("currentdir");
+ if (currentdir == null) currentdir = bd;
+ // this is a security check to prevent a malicious request to see
files outside mhk.sources.base.dir
+ if ( !currentdir.startsWith(bd) ) currentdir = bd;
+
+ if (request.getParameter("subdir") != null)
+ currentdir = currentdir + File.separator +
request.getParameter("subdir");
+
+ SaveWebSource ws=new SaveWebSource();
+ ws.start(currentdir,jsonData);
+
+
ctx.put("bgthread",request.getSession().getAttribute("background.thread"));
+ return SOURCE;
+ }
+}
=======================================
--- /branches/mhk_families/idb/etc/template/new/header.vm Sat Nov 19
05:10:12 2011
+++ /branches/mhk_families/idb/etc/template/new/header.vm Fri Jun 28
15:36:49 2013
@@ -76,6 +76,9 @@
#if($level>2 && $adminuser.equals("$user"))
<li><a HREF=$resp.encodeURL("${uri}?dbname=$!dbname&action=show_system")
title="Database Statistics and internal System
information">$mhks.get("system")</a></li>
#end
+ #if($level>2 && $adminuser.equals("$user"))
+ <li><a
HREF=$resp.encodeURL("${uri}?dbname=$!dbname&action=create_source")
title="Create a new source">$mhks.get("createSource")</a></li>
+ #end
#if($level)
<li><A
HREF=$resp.encodeURL("${uri}?dbname=$!dbname&action=exec&script=help.vm")>$mhks.get("help")</a></li>
#end
=======================================
---
/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/resources/MHKStrings.properties
Thu Jun 6 14:02:11 2013
+++
/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/resources/MHKStrings.properties
Fri Jun 28 15:36:49 2013
Binary file, no diff available.
=======================================
---
/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/resources/MHKStrings_pt.properties
Thu Jun 6 14:02:11 2013
+++
/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/resources/MHKStrings_pt.properties
Fri Jun 28 15:36:49 2013
Binary file, no diff available.
=======================================
---
/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/servlet/CentralServlet.java
Thu Jun 6 14:02:11 2013
+++
/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/servlet/CentralServlet.java
Fri Jun 28 15:36:49 2013
@@ -1168,6 +1168,12 @@
} else if (name.equalsIgnoreCase("show_system") && level > 2 &&
adminUser.equals(user)) {
c = new ShowSystem(appcontext, req, resp);
template = c.exec(context);
+ } else if (name.equalsIgnoreCase("create_source") && level > 2 &&
adminUser.equals(user)) {
+ c = new CreateSource(appcontext, req, resp);
+ template = c.exec(context);
+ } else if (name.equalsIgnoreCase("save_source") && level > 2 &&
adminUser.equals(user)) {
+ c = new SaveSource(appcontext, req, resp);
+ template = c.exec(context);
} else if (name.equalsIgnoreCase("show")) {
c = new ShowEntity(appcontext, req, resp);
template = c.exec(context);