[OFBiz] SVN: r7734 - in trunk/specialized/opentravelsystem: script/org/ofbiz/opentravelsystem servicedef src/org/ofbiz/opentravelsystem webapp/hotelbackend/WEB-INF webapp/hotelbackend/screens
hansbak@svn.ofbiz.org
hansbak at svn.ofbiz.org
Fri Jun 2 02:42:58 CDT 2006
Author: hansbak
Date: 2006-06-02 02:40:15 -0500 (Fri, 02 Jun 2006)
New Revision: 7734
Modified:
trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/PartyServices.xml
trunk/specialized/opentravelsystem/servicedef/services.xml
trunk/specialized/opentravelsystem/src/org/ofbiz/opentravelsystem/otsUtils.java
trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml
trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/Menus.xml
trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/SysAdminForms.xml
trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/SysAdminScreens.xml
Log:
entities of a single shop/hotel up/download and delete working now in the systadmin menu
Modified: trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/PartyServices.xml
===================================================================
--- trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/PartyServices.xml 2006-06-02 04:30:45 UTC (rev 7733)
+++ trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/PartyServices.xml 2006-06-02 07:40:15 UTC (rev 7734)
@@ -638,4 +638,24 @@
</call-service>
</simple-method>
+ <simple-method method-name="createCommunicationEvent" short-description="Create an CommunicationEvent">
+ <entity-one entity-name="PartyAcctgPreference" value-name="partyAcctgPreference" auto-field-map="false" use-cache="true">
+ <field-map field-name="partyId" env-name="parameters.userLogin.partyId"/>
+ </entity-one>
+ <if-not-empty field-name="partyAcctgPreference">
+ <check-permission permission="OPENTRAVELSYSTEM" action="_RW">
+ <alt-permission permission="${parameters.userLogin.partyId}" action="_RW"/>
+ <fail-message message="Security Error: to update you need RW access to "${parameters.partyId}" in the "OPENTRAVELSYSTEM""/>
+ </check-permission>
+ <check-errors/>
+ <sequenced-id-to-env sequence-name="${partyAcctgPreference.invoiceIdPrefix}CommunicationEvent" env-name="nextCommunicationEventId"/>
+ <set field="parameters.communicationEventId" value="${partyAcctgPreference.invoiceIdPrefix}${nextCommunicationEventId}"/>
+ </if-not-empty>
+ <!-- call original ofbiz service with preset communicationEventId -->
+ <set-service-fields service-name="createCommunicationEventOfbiz" map-name="parameters" to-map-name="createCommunicationEvent"/>
+ <call-service service-name="createCommunicationEventOfbiz" in-map-name="createCommunicationEvent">
+ <result-to-result result-name="communicationEventId" service-result-name="communicationEventId"/>
+ </call-service>
+ </simple-method>
+
</simple-methods>
\ No newline at end of file
Modified: trunk/specialized/opentravelsystem/servicedef/services.xml
===================================================================
--- trunk/specialized/opentravelsystem/servicedef/services.xml 2006-06-02 04:30:45 UTC (rev 7733)
+++ trunk/specialized/opentravelsystem/servicedef/services.xml 2006-06-02 07:40:15 UTC (rev 7734)
@@ -478,7 +478,6 @@
<override name="contactListTypeId" optional="false"/>
<override name="contactListName" optional="false"/>
</service>
- <!-- ContactList Services -->
<service name="createContactListOfbiz" default-entity-name="ContactList" engine="simple"
location="org/ofbiz/marketing/contact/ContactListServices.xml" invoke="createContactList" auth="true">
<description>Create a ContactList record</description>
@@ -487,7 +486,19 @@
<override name="contactListTypeId" optional="false"/>
<override name="contactListName" optional="false"/>
</service>
-
+ <service name="createCommunicationEvent" engine="simple"
+ location="org/ofbiz/opentravelsystem/PartyServices.xml" invoke="createCommunicationEvent" auth="true">
+ <description>Create a Communication Event</description>
+ <auto-attributes entity-name="CommunicationEvent" include="nonpk" mode="IN" optional="true"/>
+ <auto-attributes entity-name="CommunicationEvent" include="pk" mode="OUT" optional="false"/>
+ </service>
+ <service name="createCommunicationEventOfbiz" engine="simple"
+ location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="createCommunicationEvent" auth="true">
+ <description>Create a Communication Event</description>
+ <auto-attributes entity-name="CommunicationEvent" include="nonpk" mode="IN" optional="true"/>
+ <auto-attributes entity-name="CommunicationEvent" include="pk" mode="INOUT" optional="true"/>
+ </service>
+
<service name="createGiftCard" engine="simple"
location="org/ofbiz/opentravelsystem/PaymentMethodServices.xml" invoke="createGiftCard" auth="true">
<description>Create GiftCard</description>
Modified: trunk/specialized/opentravelsystem/src/org/ofbiz/opentravelsystem/otsUtils.java
===================================================================
--- trunk/specialized/opentravelsystem/src/org/ofbiz/opentravelsystem/otsUtils.java 2006-06-02 04:30:45 UTC (rev 7733)
+++ trunk/specialized/opentravelsystem/src/org/ofbiz/opentravelsystem/otsUtils.java 2006-06-02 07:40:15 UTC (rev 7734)
@@ -44,37 +44,52 @@
public static long numberWritten = 0;
public static String prefix = null;
public static GenericDelegator delegator = null;
-
+ private static PrintWriter writer = null;
+ private static String output = null;
+ private static Stack stack = new Stack();
+
+ // write an entity to the xml file
+ public static void action(GenericValue entity) {
+ if (output.equals("xml")) {
+ entity.writeXmlText( writer, "");
+ numberWritten++;
+ }
+ if (output.equals("delete")) {
+ stack.push(entity);
+ }
+
+ }
+
// only top entity, no switches
- public static void explode(String topEntityName, String topEntityId, PrintWriter writer) {
- explode(topEntityName, topEntityId, true, null,true, null,true,null,true,null,true,null,true, writer);
+ public static void explode(String topEntityName, String topEntityId) {
+ explode(topEntityName, topEntityId, true, null,true, null,true,null,true,null,true,null,true );
}
// topentity, one child, no switches
- public static void explode(String topEntityName, String topEntityId, String child1EntityName, PrintWriter writer) {
- explode(topEntityName, topEntityId, true, child1EntityName,true, null,true,null,true,null,true,null,true, writer);
+ public static void explode(String topEntityName, String topEntityId, String child1EntityName ) {
+ explode(topEntityName, topEntityId, true, child1EntityName,true, null,true,null,true,null,true,null,true );
}
// topentity, one child, switches
- public static void explode(String topEntityName, String topEntityId, boolean xmlWrite0, String child1EntityName, boolean xmlWrite1, PrintWriter writer) {
- explode(topEntityName, topEntityId, xmlWrite0, child1EntityName, xmlWrite1, null,true,null,true,null,true,null,true, writer);
+ public static void explode(String topEntityName, String topEntityId, boolean xmlWrite0, String child1EntityName, boolean xmlWrite1 ) {
+ explode(topEntityName, topEntityId, xmlWrite0, child1EntityName, xmlWrite1, null,true,null,true,null,true,null,true );
}
// topentity, two children, no switches
- public static void explode(String topEntityName, String topEntityId, String child1EntityName, String child2EntityName, PrintWriter writer) {
- explode(topEntityName, topEntityId, true, child1EntityName, true,child2EntityName, true, null,true,null,true,null,true, writer);
+ public static void explode(String topEntityName, String topEntityId, String child1EntityName, String child2EntityName ) {
+ explode(topEntityName, topEntityId, true, child1EntityName, true,child2EntityName, true, null,true,null,true,null,true );
}
- public static void explode(String topEntityName, String topEntityId, boolean xmlWrite0, String child1EntityName, boolean xmlWrite1, String child2EntityName,boolean xmlWrite2, PrintWriter writer) {
- explode( topEntityName, topEntityId, xmlWrite0, child1EntityName, xmlWrite1,child2EntityName, xmlWrite2, null,true, null,true, null, true,writer);
+ public static void explode(String topEntityName, String topEntityId, boolean xmlWrite0, String child1EntityName, boolean xmlWrite1, String child2EntityName,boolean xmlWrite2 ) {
+ explode( topEntityName, topEntityId, xmlWrite0, child1EntityName, xmlWrite1,child2EntityName, xmlWrite2, null,true, null,true, null, true);
}
- public static void explode(String topEntityName, String topEntityId, String child1EntityName, String child2EntityName,String child3EntityName, PrintWriter writer) {
- explode(topEntityName, topEntityId, true, child1EntityName, true,child2EntityName, true,child3EntityName, true, null, true,null, true, writer);
+ public static void explode(String topEntityName, String topEntityId, String child1EntityName, String child2EntityName,String child3EntityName ) {
+ explode(topEntityName, topEntityId, true, child1EntityName, true,child2EntityName, true,child3EntityName, true, null, true,null, true );
}
- public static void explode(String topEntityName, String topEntityId, boolean xmlWrite0, String child1EntityName, boolean xmlWrite1, String child2EntityName, boolean xmlWrite2, String child3EntityName, boolean xmlWrite3, PrintWriter writer) {
- explode( topEntityName, topEntityId, xmlWrite0, child1EntityName, xmlWrite1, child2EntityName, xmlWrite2,child3EntityName, xmlWrite3, null, true,null, true, writer);
+ public static void explode(String topEntityName, String topEntityId, boolean xmlWrite0, String child1EntityName, boolean xmlWrite1, String child2EntityName, boolean xmlWrite2, String child3EntityName, boolean xmlWrite3 ) {
+ explode( topEntityName, topEntityId, xmlWrite0, child1EntityName, xmlWrite1, child2EntityName, xmlWrite2,child3EntityName, xmlWrite3, null, true,null, true );
}
- public static void explode(String topEntityName, String topEntityId, String child1EntityName, String child2EntityName,String child3EntityName,String child4EntityName, PrintWriter writer ) {
- explode(topEntityName, topEntityId, true, child1EntityName, true,child2EntityName, true,child3EntityName, true, child4EntityName, true, null, true, writer);
+ public static void explode(String topEntityName, String topEntityId, String child1EntityName, String child2EntityName,String child3EntityName,String child4EntityName ) {
+ explode(topEntityName, topEntityId, true, child1EntityName, true,child2EntityName, true,child3EntityName, true, child4EntityName, true, null, true );
}
- public static void explode(String topEntityName, String topEntityId, boolean xmlWrite0, String child1EntityName, boolean xmlWrite1, String child2EntityName, boolean xmlWrite2, String child3EntityName, boolean xmlWrite3, String child4EntityName, boolean xmlWrite4, PrintWriter writer ) {
- explode( topEntityName, topEntityId, xmlWrite0, child1EntityName, xmlWrite1, child2EntityName, xmlWrite2, child3EntityName, xmlWrite3,child4EntityName, xmlWrite4, null, true, writer);
+ public static void explode(String topEntityName, String topEntityId, boolean xmlWrite0, String child1EntityName, boolean xmlWrite1, String child2EntityName, boolean xmlWrite2, String child3EntityName, boolean xmlWrite3, String child4EntityName, boolean xmlWrite4 ) {
+ explode( topEntityName, topEntityId, xmlWrite0, child1EntityName, xmlWrite1, child2EntityName, xmlWrite2, child3EntityName, xmlWrite3,child4EntityName, xmlWrite4, null, true );
}
// all no entityId and no ignore
public static void explode(String topEntityName, String topEntityId,
@@ -82,13 +97,13 @@
String child2EntityName,
String child3EntityName,
String child4EntityName,
- String child5EntityName, PrintWriter writer ) {
+ String child5EntityName ) {
explode(topEntityName, topEntityId, true,
child1EntityName, true,
child2EntityName, true,
child3EntityName, true,
child4EntityName, true,
- child5EntityName, true, writer);
+ child5EntityName, true );
}
// all, no entity id
public static void explode(String topEntityName, String topEntityId, boolean xmlWrite0,
@@ -96,13 +111,13 @@
String child2EntityName, boolean xmlWrite2,
String child3EntityName, boolean xmlWrite3,
String child4EntityName, boolean xmlWrite4,
- String child5EntityName, boolean xmlWrite5, PrintWriter writer) {
+ String child5EntityName, boolean xmlWrite5 ) {
explode(topEntityName, topEntityId, xmlWrite0,
child1EntityName, null, xmlWrite1,
child2EntityName, null, xmlWrite2,
child3EntityName, null, xmlWrite3,
child4EntityName, null, xmlWrite4,
- child5EntityName, null, xmlWrite5, writer);
+ child5EntityName, null, xmlWrite5 );
}
// all, no ignore
public static void explode(String topEntityName, String topEntityId,
@@ -110,13 +125,13 @@
String child2EntityName, String child2EntityId,
String child3EntityName, String child3EntityId,
String child4EntityName, String child4EntityId,
- String child5EntityName, String child5EntityId, PrintWriter writer) {
+ String child5EntityName, String child5EntityId ) {
explode(topEntityName, topEntityId, true,
child1EntityName, null, true,
child2EntityName, null, true,
child3EntityName, null, true,
child4EntityName, null, true,
- child5EntityName, null, true, writer);
+ child5EntityName, null, true );
}
// 4, no ignore
public static void explode(String topEntityName, String topEntityId,
@@ -130,7 +145,7 @@
child2EntityName, child2EntityId, true,
child3EntityName, child3EntityId, true,
child4EntityName, child4EntityId, true,
- null, null, false, writer);
+ null, null, false );
}
/**
@@ -164,7 +179,7 @@
String child2EntityName, String child2EntityId, boolean xmlWrite2,
String child3EntityName, String child3EntityId, boolean xmlWrite3,
String child4EntityName, String child4EntityId, boolean xmlWrite4,
- String child5EntityName, String child5EntityId, boolean xmlWrite5, PrintWriter writer) {
+ String child5EntityName, String child5EntityId, boolean xmlWrite5 ) {
try {
Debug.logInfo("==processing topEntity:" + topEntityName,module);
List topEntityList = delegator.findByLike(topEntityName,UtilMisc.toMap(topEntityId,prefix.concat("%")),UtilMisc.toList(topEntityId));
@@ -172,7 +187,7 @@
Iterator t = topEntityList.iterator();
while(t.hasNext()) {
GenericValue topEntityListItem = (GenericValue) t.next();
- if (xmlWrite0) { topEntityListItem.writeXmlText(writer,""); numberWritten++; }
+ if (xmlWrite0) { action(topEntityListItem); }
if (child1EntityName != null) {
List children1 = null;
if (child1EntityId != null)
@@ -223,27 +238,27 @@
Iterator psr5 = children5.iterator();
while (psr5.hasNext()) {
GenericValue child5 = (GenericValue) psr5.next();
- if (xmlWrite5) { child5.writeXmlText(writer,""); numberWritten++;}
+ if (xmlWrite5) action(child5);
// if (child5EntityName != null) { if (lastChildren != null) lastChildren.addAll(children5); else lastChildren = children5; }
}
}
}
- if (xmlWrite4) { child4.writeXmlText(writer,""); numberWritten++;}
+ if (xmlWrite4) action(child4);
// if (child5EntityName == null) { if (lastChildren != null) lastChildren.addAll(children4); else lastChildren = children4; }
}
}
}
- if (xmlWrite3) { child3.writeXmlText(writer,""); numberWritten++; }
+ if (xmlWrite3) action(child3);
// if (child4EntityName == null) { if (lastChildren != null) lastChildren.addAll(children3); else lastChildren = children3; }
}
}
}
- if (xmlWrite2) { child2.writeXmlText(writer,""); numberWritten++;}
+ if (xmlWrite2) action(child2);
// if (child3EntityName == null) { if (lastChildren != null) lastChildren.addAll(children2); else lastChildren = children2; }
}
}
}
- if (xmlWrite1) { child1.writeXmlText(writer,""); numberWritten++; }
+ if (xmlWrite1) action(child1);
// if (child2EntityName == null) { if (lastChildren != null) lastChildren.addAll(children1); else lastChildren = children1; }
}
}
@@ -253,7 +268,7 @@
} catch (GenericEntityException e) { Debug.logError(e, "Problems exploding" + topEntityName, module);}
}
- public static GenericValue usedOn(GenericValue bottomEntityName, String parent1EntityName, PrintWriter writer) {
+ public static GenericValue usedOn(GenericValue bottomEntityName, String parent1EntityName ) {
GenericValue lastParent = (GenericValue) null;
GenericValue parent = (GenericValue) null;
try { parent = bottomEntityName.getRelatedOne(parent1EntityName);
@@ -286,74 +301,72 @@
*/
public static String unLoad(HttpServletRequest request, HttpServletResponse response) {
delegator = (GenericDelegator) request.getAttribute("delegator");
- String productStoreId = (String) request.getParameter("downloadId");
+ prefix = (String) request.getParameter("downloadId");
+ output = (String) request.getParameter("action");
StringBuffer msgs = new StringBuffer();
-
- // single file
- if(productStoreId == null || productStoreId.length() == 0) {
- request.setAttribute("_ERROR_MESSAGE_", "No productStore defined...");
- return "error";
+
+ String downloadLoc = null;
+ if (output.equals("xml")) {
+ String fileName = new String("specialized/opentravelsystem/webapp/hotelbackend/html/" + prefix + ".xml");
+ downloadLoc = new String("backend/html/" + prefix + ".xml");
+
+ FileOutputStream fos = null;
+ try { fos = new FileOutputStream(fileName);
+ } catch (FileNotFoundException e) {
+ request.setAttribute("_ERROR_MESSAGE_", "File " + fileName + " could not be created");
+ return "error";
+ }
+ OutputStreamWriter osw = null;
+ try { osw = new OutputStreamWriter(fos, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ request.setAttribute("_ERROR_MESSAGE_", "Encoding not supported");
+ return "error";
+ }
+
+ BufferedWriter bw = new BufferedWriter(osw);
+ writer = new PrintWriter(bw);
+ writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+ writer.println("<entity-engine-xml>");
}
- String fileName = new String("specialized/opentravelsystem/webapp/hotelbackend/html/" + productStoreId + ".xml");
- String downloadLoc = new String("backend/html/" + productStoreId + ".xml");
-
- FileOutputStream fos = null;
- try { fos = new FileOutputStream(fileName);
- } catch (FileNotFoundException e) {
- request.setAttribute("_ERROR_MESSAGE_", "File " + fileName + " could not be created");
- return "error";
+ if (output.equals("xml")) {
+ // create party table first without the created/modified by userlogin fields
+ try {
+ List parties = delegator.findByLike("Party", UtilMisc.toMap("partyId", prefix.concat("%")));
+ Iterator t = parties.iterator();
+ while(t.hasNext()) {
+ GenericValue party = (GenericValue) t.next();
+ party.remove("createdByUserLogin");
+ party.remove("lastModifiedByUserLogin");
+ action(party);
+ }
+ } catch (GenericEntityException e) { Debug.logError(e, "Problems parties file", module);}
}
- OutputStreamWriter osw = null;
- try { osw = new OutputStreamWriter(fos, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- request.setAttribute("_ERROR_MESSAGE_", "Encoding not supported");
- return "error";
- }
-
- BufferedWriter bw = new BufferedWriter(osw);
- PrintWriter writer = new PrintWriter(bw);
- writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
- writer.println("<entity-engine-xml>");
- prefix = productStoreId; // all main entities ID's are prefixed with this prefix
-
- // create party table first without the created/modified by userlogin fields
- try {
- List parties = delegator.findByLike("Party", UtilMisc.toMap("partyId", prefix.concat("%")));
- Iterator t = parties.iterator();
- while(t.hasNext()) {
- GenericValue party = (GenericValue) t.next();
- party.remove("createdByUserLogin");
- party.remove("lastModifiedByUserLogin");
- party.writeXmlText(writer,""); numberWritten++;
- }
- } catch (GenericEntityException e) { Debug.logError(e, "Problems parties file", module);}
+ // security
+ explode("SecurityGroup", "groupId" );
+ explode("SecurityGroupPermission", "groupId" );
+ //parties
+ explode("Party", "partyId", "UserLogin" );
+ explode("Party", "partyId", false, "UserLogin", false, "UserLoginSecurityGroup", true );
+ explode("Party", "partyId", false, "PartyGroup", true );
+ explode("Party", "partyId", false, "Person", true );
+ explode("Party", "partyId", false, "PartyRole",true );
- // get all parties
- explode("Party", "partyId",
- "UserLogin",null,
- "UserLoginSecurityGroup", "groupId",
- "SecurityGroupPermission", null,
- "SecurityPermission", "permissionId",
- writer);
- explode("Party", "partyId", false, "PartyGroup", true, writer);
- explode("Party", "partyId", false, "PartyRole",true, writer);
-
// contact mechanisms
- explode("ContactMech", "contactMechId", "PartyContactMech", writer);
- explode("PostalAddress", "contactMechId", writer);
- explode("TelecomNumber", "contactMechId", writer);
+ explode("ContactMech", "contactMechId", "PartyContactMech" );
+ explode("PostalAddress", "contactMechId" );
+ explode("TelecomNumber", "contactMechId" );
// payment methods
- explode("PaymentMethod", "paymentMethodId", writer);
- explode("EftAccount", "paymentMethodId", writer);
- explode("CreditCard", "paymentMethodId", writer);
- explode("GiftCard", "paymentMethodId", writer);
+ explode("PaymentMethod", "paymentMethodId" );
+ explode("EftAccount", "paymentMethodId" );
+ explode("CreditCard", "paymentMethodId" );
+ explode("GiftCard", "paymentMethodId" );
- // specifics for Anet
- if (prefix.equals("anet")) {
+ /* specifics for Anet
+ if (prefix.equals("anet") && output.equals("xml")) {
try {
List cmPartys = delegator.findByLike("PartyContactMech", UtilMisc.toMap("partyId", prefix.concat("%")));
@@ -362,12 +375,12 @@
while(t.hasNext()) {
GenericValue cmParty = (GenericValue) t.next();
GenericValue cm = (GenericValue) delegator.findByPrimaryKey("ContactMech", UtilMisc.toMap("contactMechId", cmParty.getString("contactMechId")));
- if (cm != null) { cm.writeXmlText(writer,"");numberWritten++; }
+ if (cm != null) action(cm);
cm = (GenericValue) delegator.findByPrimaryKey("PostalAddress", UtilMisc.toMap("contactMechId", cmParty.getString("contactMechId")));
- if (cm != null) { cm.writeXmlText(writer,"");numberWritten++; }
+ if (cm != null) action(cm);
cm = (GenericValue) delegator.findByPrimaryKey("TelecomNumber", UtilMisc.toMap("contactMechId", cmParty.getString("contactMechId")));
- if (cm != null) { cm.writeXmlText(writer,"");numberWritten++; }
- cmParty.writeXmlText(writer,"");
+ if (cm != null) action(cm);
+ action(cmParty);
}
}
@@ -377,42 +390,38 @@
while(t.hasNext()) {
GenericValue pm = (GenericValue) t.next();
String pmId = pm.getString("paymentMethodId");
- pm.writeXmlText(writer,"");numberWritten++;
+ action(pm);
GenericValue cc = delegator.findByPrimaryKey("EftAccount",UtilMisc.toMap("paymentMethodId", pmId));
- if (cc != null) {
- cc.writeXmlText(writer,"");numberWritten++;
- }
+ if (cc != null) action(cc);
cc = delegator.findByPrimaryKey("CreditCard",UtilMisc.toMap("paymentMethodId", pmId));
- if (cc != null) {
- cc.writeXmlText(writer,"");numberWritten++;
- }
+ if (cc != null) action(cc);
}
}
GenericValue party = delegator.findByPrimaryKey("Party",UtilMisc.toMap("partyId","BelastingDienst"));
- party.writeXmlText(writer,""); numberWritten++;
+ action(party);
party = delegator.findByPrimaryKey("TaxAuthority",UtilMisc.toMap("taxAuthPartyId","BelastingDienst","taxAuthGeoId", "NLD"));
- party.writeXmlText(writer,""); numberWritten++;
+ action(party);
party = delegator.findByPrimaryKey("PartyGroup",UtilMisc.toMap("partyId","BelastingDienst"));
- party.writeXmlText(writer,""); numberWritten++;
+ action(party);
List roles = delegator.findByAnd("PartyRole",UtilMisc.toMap("partyId", "BelastingDienst"));
if (roles != null && roles.size() > 0) {
Iterator t = roles.iterator();
while(t.hasNext()) {
GenericValue role = (GenericValue) t.next();
- role.writeXmlText(writer,""); numberWritten++;
+ action(role);
}
}
party = delegator.findByPrimaryKey("Party",UtilMisc.toMap("partyId","Stulemeijer"));
- party.writeXmlText(writer,""); numberWritten++;
+ action(party);
party = delegator.findByPrimaryKey("Person",UtilMisc.toMap("partyId","Stulemeijer"));
- party.writeXmlText(writer,""); numberWritten++;
+ action(party);
roles = delegator.findByAnd("PartyRole",UtilMisc.toMap("partyId", "Stulemeijer"));
if (roles != null && roles.size() > 0) {
Iterator t = roles.iterator();
while(t.hasNext()) {
GenericValue role = (GenericValue) t.next();
- role.writeXmlText(writer,""); numberWritten++;
+ action(role);
}
}
pms = delegator.findByAnd("PaymentMethod", UtilMisc.toMap("partyId","Stulemeijer"));
@@ -421,27 +430,23 @@
while(t.hasNext()) {
GenericValue pm = (GenericValue) t.next();
String pmId = pm.getString("paymentMethodId");
- pm.writeXmlText(writer,"");numberWritten++;
+ action(pm);
GenericValue cc = delegator.findByPrimaryKey("EftAccount",UtilMisc.toMap("paymentMethodId", pmId));
- if (cc != null) {
- cc.writeXmlText(writer,"");numberWritten++;
- }
+ if (cc != null) action(cc);
cc = delegator.findByPrimaryKey("CreditCard",UtilMisc.toMap("paymentMethodId", pmId));
- if (cc != null) {
- cc.writeXmlText(writer,"");numberWritten++;
- }
+ if (cc != null) action(cc);
}
}
party = delegator.findByPrimaryKey("Party",UtilMisc.toMap("partyId","Sidin"));
- party.writeXmlText(writer,""); numberWritten++;
+ action(party);
party = delegator.findByPrimaryKey("Person",UtilMisc.toMap("partyId","Sidin"));
- party.writeXmlText(writer,""); numberWritten++;
+ action(party);
roles = delegator.findByAnd("PartyRole",UtilMisc.toMap("partyId", "Sidin"));
if (roles != null && roles.size() > 0) {
Iterator t = roles.iterator();
while(t.hasNext()) {
GenericValue role = (GenericValue) t.next();
- role.writeXmlText(writer,""); numberWritten++;
+ action(role);
}
}
pms = delegator.findByAnd("PaymentMethod", UtilMisc.toMap("partyId","Sidin"));
@@ -450,97 +455,119 @@
while(t.hasNext()) {
GenericValue pm = (GenericValue) t.next();
String pmId = pm.getString("paymentMethodId");
- pm.writeXmlText(writer,"");numberWritten++;
+ action(pm);
GenericValue cc = delegator.findByPrimaryKey("EftAccount",UtilMisc.toMap("paymentMethodId", pmId));
- if (cc != null) {
- cc.writeXmlText(writer,"");numberWritten++;
- }
+ if (cc != null) action(cc);
cc = delegator.findByPrimaryKey("CreditCard",UtilMisc.toMap("paymentMethodId", pmId));
- if (cc != null) {
- cc.writeXmlText(writer,"");numberWritten++;
- }
+ if (cc != null) action(cc);
}
}
} catch (GenericEntityException e) { Debug.logError(e, "Problems reading extra parties for A-NeT", module);}
}
+*/
-
// tax tables
- explode("TaxAuthority","taxAuthPartyId",writer);
- explode("PartyTaxAuthInfo","partyId",writer);
+ explode("TaxAuthority","taxAuthPartyId");
+ explode("PartyTaxAuthInfo","partyId");
- // security
- explode("SecurityGroup", "groupId", "SecurityGroupPermission", writer);
- explode("Party", "partyId", false, "ToPartyRelationship", true, writer);
+ // relationship
+ explode("Party", "partyId", false, "ToPartyRelationship", true );
// store
GenericValue productStore = null;
- try{ productStore =delegator.findByPrimaryKey("ProductStore", UtilMisc.toMap("productStoreId",productStoreId));
+ try{ productStore =delegator.findByPrimaryKey("ProductStore", UtilMisc.toMap("productStoreId", prefix));
} catch (GenericEntityException e) { Debug.logError(e, "Problems reading ProductStore", module);}
if (productStore == null) {
- request.setAttribute("_ERROR_MESSAGE_", "ProductStore " + productStoreId + " not found");
+ request.setAttribute("_ERROR_MESSAGE_", "ProductStore " + prefix + " not found");
return "error"; //productstore not found
}
//get the productstore, related website records id
// get the payment settings
- explode("ProductStore", "productStoreId", "ProductStorePaymentSetting",writer);
- explode("WebSite", "webSiteId", writer);
+ explode("ProductStore", "productStoreId", "ProductStorePaymentSetting");
+ explode("WebSite", "webSiteId" );
// get the email settings
- explode("ProductStore", "productStoreId", false, "ProductStoreEmailSetting",true,writer);
+ explode("ProductStore", "productStoreId", false, "ProductStoreEmailSetting",true);
// get the ProductStoreShipmentMeth
- // explode(productStore, "ProductStoreShipmentMeth",writer); // no direct link...
- explode("ProductStoreShipmentMeth","productStoreId", writer);
+ // explode(productStore, "ProductStoreShipmentMeth"); // no direct link...
+ explode("ProductStoreShipmentMeth","productStoreId" );
// productStore, catalog and categories
- explode("ProdCatalog","prodCatalogId", writer);
- explode("ProductStore", "productStoreId", false,"ProductStoreCatalog",true,writer); //productstore and catalog
- explode("ProductCategory","productCategoryId", "ProdCatalogCategory", writer); // category and relation to catalog
- explode("ProductCategoryRollup","productCategoryId",writer); // category relations
+ explode("ProdCatalog","prodCatalogId" );
+ explode("ProductStore", "productStoreId", false,"ProductStoreCatalog",true); //productstore and catalog
+ explode("ProductCategory","productCategoryId", "ProdCatalogCategory" ); // category and relation to catalog
+ explode("ProductCategoryRollup","productCategoryId"); // category relations
// get all products and prices en link to category and acciciations
- explode("Product","productId", "ProductPrice", writer);
- explode("Product","productId", false, "ProductCategoryMember", true, writer);
- explode("Product","productId", false, "AssocProductAssoc", true, writer);
+ explode("Product","productId", "ProductPrice" );
+ explode("Product","productId", false, "ProductCategoryMember", true );
+ explode("Product","productId", false, "AssocProductAssoc", true );
// product features
- explode("ProductFeatureCategory", "productFeatureCategoryId", "ProductFeature", "ProductFeatureAppl", writer);
+ explode("ProductFeatureCategory", "productFeatureCategoryId", "ProductFeature", "ProductFeatureAppl" );
// get all fixed assets and link to product
- explode("FixedAsset","fixedAssetId", "FixedAssetProduct", writer);
+ explode("FixedAsset","fixedAssetId", "FixedAssetProduct" );
// get all content, resource and electronic text
- explode("Content","contentId",false, "DataResource", true, "ElectronicText", true, writer);
- explode("Content","contentId","FromContentAssoc", writer);
+ explode("DataResource", "dataResourceId");
+ explode("ElectronicText", "dataResourceId");
+ explode("ImageDataResource", "dataResourceId");
+ explode("Content","contentId" );
+ explode("Content","contentId", false,"FromContentAssoc", true );
+ //communication
+ explode("CommunicationEvent","communicationEventId" );
+ explode("CommunicationEvent","communicationEventId", false, "CommEventContentAssoc", true );
+ explode("ContactList","contactListId", "ContactListParty" );
+
// invoices/payments/applications
- explode("PartyAcctgPreference", "partyId", writer);
- explode("CustomTimePeriod", "organizationPartyId", writer);
- explode("Invoice", "invoiceId", "InvoiceItem", writer);
- explode("Invoice", "invoiceId",false, "InvoiceStatus", true, writer);
- explode("Invoice", "invoiceId",false, "InvoiceRole", true, writer);
- explode("Payment", "paymentId", writer);
- explode("Payment", "paymentId", false, "PaymentApplication",true, writer);
+ explode("PartyAcctgPreference", "partyId" );
+ explode("CustomTimePeriod", "organizationPartyId" );
+ explode("Invoice", "invoiceId", "InvoiceItem" );
+ explode("Invoice", "invoiceId",false, "InvoiceStatus", true );
+ explode("Invoice", "invoiceId",false, "InvoiceRole", true );
+ explode("Payment", "paymentId" );
+ explode("Payment", "paymentId", false, "PaymentApplication",true );
- explode("GlAccountOrganization", "organizationPartyId", writer);
- explode("PaymentMethodTypeGlAccount", "organizationPartyId", writer);
- explode("GlAccountTypeDefault", "organizationPartyId", writer);
- explode("PaymentGlAccountTypeMap", "organizationPartyId", writer);
- explode("InvoiceItemTypeGlAccount", "organizationPartyId", writer);
+ explode("GlAccountOrganization", "organizationPartyId" );
+ explode("PaymentMethodTypeGlAccount", "organizationPartyId" );
+ explode("GlAccountTypeDefault", "organizationPartyId" );
+ explode("PaymentGlAccountTypeMap", "organizationPartyId" );
+ explode("InvoiceItemTypeGlAccount", "organizationPartyId" );
// orders (to be completed)
- explode("OrderHeader","orderId", "OrderItem", "orderItemPriceInfo", writer);
- explode("OrderItemBilling","orderId", writer);
+ explode("OrderHeader","orderId", "OrderItem" );
+ explode("OrderHeader","orderId", false, "OrderItem", false, "orderItemPriceInfo", true );
+ explode("OrderItemBilling","orderId");
// sequence value items: SequenceValueItems
- explode("SequenceValueItem","seqName", writer);
+ explode("SequenceValueItem","seqName");
+
+ if (output.equals("xml")) {
+ writer.println("</entity-engine-xml>");
+ writer.close();
+ msgs.append("Unload ended normally, statistics:\n");
+ msgs.append("--Entities written to output file: " + numberWritten + "\n");
+ msgs.append("<a href=/" + downloadLoc + ">--Download your generated file here</a>");
+ if (msgs.length() > 0)
+ request.setAttribute("_EVENT_MESSAGE_", msgs.toString());
+ }
+
+ if ( output.equals("delete")) {
+ GenericValue current = null;
+ try{
+ while(!stack.empty()) {
+ current = (GenericValue) stack.pop();
+ delegator.removeValue(current);
+ numberWritten++;
+ }
+ } catch (GenericEntityException e) { Debug.logError(e, "Problems deleting:" + current, module);}
+ msgs.append("Deletion ended normally, statistics:\n");
+ msgs.append("--Entities deleted: " + numberWritten + "\n");
+ if (msgs.length() > 0)
+ request.setAttribute("_EVENT_MESSAGE_", msgs.toString());
+ }
- writer.println("</entity-engine-xml>");
- writer.close();
- msgs.append("Unload ended normally, statistics:\n");
- msgs.append("--Entities written to output file: " + numberWritten + "\n");
- msgs.append("<a href=/" + downloadLoc+ ">--Download your generated file here</a>");
- if (msgs.length() > 0)
- request.setAttribute("_EVENT_MESSAGE_", msgs.toString());
numberWritten = 0;
return "success";
}
Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml 2006-06-02 04:30:45 UTC (rev 7733)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/WEB-INF/controller.xml 2006-06-02 07:40:15 UTC (rev 7734)
@@ -2698,7 +2698,12 @@
<security https="true" auth="true"/>
<response name="success" type="view" value="SysAdminMain"/>
</request-map>
-
+
+ <request-map uri="requestDelete">
+ <security https="true" auth="true"/>
+ <response name="success" type="view" value="DeleteShop"/>
+ </request-map>
+
<request-map uri="unLoad">
<security https="true" auth="true"/>
<event type="java" path="org.ofbiz.opentravelsystem.otsUtils" invoke="unLoad"/>
@@ -2706,6 +2711,13 @@
<response name="error" type="view" value="SysAdminMain"/>
</request-map>
+ <request-map uri="deleteShop">
+ <security https="true" auth="true"/>
+ <event type="java" path="org.ofbiz.opentravelsystem.otsUtils" invoke="unLoad"/>
+ <response name="success" type="view" value="DeleteShop"/>
+ <response name="error" type="view" value="DeleteShop"/>
+ </request-map>
+
<request-map uri="EntityImport"><security https="true" auth="true"/><response name="success" type="view" value="EntityImport"/><response name="error" type="view" value="EntityImportDir"/></request-map>
<request-map uri="entityImport">
<security https="true" auth="true"/>
@@ -3348,6 +3360,7 @@
<view-map name="AccountActivitiesDetail" type="screen" page="component://accounting/widget/AccountingScreens.xml#AccountActivitiesDetail"/>
<!-- System administrative pages -->
<view-map name="SysAdminMain" type="screen" page="component://opentravelsystem/webapp/hotelbackend/screens/SysAdminScreens.xml#SysAdminMain"/>
+ <view-map name="DeleteShop" type="screen" page="component://opentravelsystem/webapp/hotelbackend/screens/SysAdminScreens.xml#DeleteShop"/>
<view-map name="EntityImport" page="component://webtools/widget/EntityScreens.xml#EntityImport" type="screen"/>
<!-- Accounting administrative pages -->
<view-map name="AdminMain" type="screen" page="component://accounting/widget/AdminScreens.xml#AdminMain"/>
Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/Menus.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/Menus.xml 2006-06-02 04:30:45 UTC (rev 7733)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/Menus.xml 2006-06-02 07:40:15 UTC (rev 7734)
@@ -151,9 +151,9 @@
default-title-style="appButton" default-tooltip-style="tabletext" default-widget-style="appButton"
menu-container-style="appContainer" orientation="horizontal" type="simple">
<!--menu-item name="intro" title="Intro"><link target="intro"/></menu-item-->
+ <menu-item name="upLoad" title="Upload"><link target="entityImport"/></menu-item>
<menu-item name="download" title="Download"><link target="sysAdminMain"/></menu-item>
- <menu-item name="upLoad" title="Upload"><link target="entityImport"/></menu-item>
- <!--menu-item name="webtools" title="Webtools"><link target="/webtools"/></menu-item-->
+ <menu-item name="delete" title="Delete"><link target="requestDelete"/></menu-item>
</menu>
<menu name="dataExchangeTabBar" default-menu-item-name="ContactList" default-selected-style="tabButtonSelected"
default-title-style="tabButton" default-tooltip-style="tabletext" default-widget-style="tabButton"
Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/SysAdminForms.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/SysAdminForms.xml 2006-06-02 04:30:45 UTC (rev 7733)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/SysAdminForms.xml 2006-06-02 07:40:15 UTC (rev 7734)
@@ -4,15 +4,29 @@
<form name="SysAdminMain" type="single" target="unLoad">
-
- <field name="dummy" title=""><display description="select een shop en press submit to download all information"/></field>
- <field name="downloadId">
- <drop-down allow-empty="false">
- <entity-options entity-name="PartyAcctgPreference" description="${invoiceIdPrefix}" key-field-name="partyId"/>
- </drop-down>
+
+ <field name="dummy" title=""><display description="select een shop en press submit to download all information"/></field>
+ <field name="action"><hidden value="xml"/></field>
+ <field name="downloadId">
+ <drop-down allow-empty="false">
+ <entity-options entity-name="PartyAcctgPreference" description="${invoiceIdPrefix}" key-field-name="partyId"/>
+ </drop-down>
</field>
- <field name="submitButton"><submit/></field>
+ <field name="submitButton"><submit/></field>
</form>
-
-
+
+ <form name="DeleteShop" type="single" target="deleteShop">
+
+ <field name="dummy" title=""><display description="select een shop en "/></field>
+ <field name="dummy1" title=""><display description="press submit to DELETE all information"/></field>
+ <field name="action"><hidden value="delete"/></field>
+ <field name="downloadId">
+ <drop-down allow-empty="false">
+ <entity-options entity-name="PartyAcctgPreference" description="${invoiceIdPrefix}" key-field-name="partyId"/>
+ </drop-down>
+ </field>
+ <field name="submitButton"><submit/></field>
+ </form>
+
+
</forms>
\ No newline at end of file
Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/SysAdminScreens.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/SysAdminScreens.xml 2006-06-02 04:30:45 UTC (rev 7733)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/SysAdminScreens.xml 2006-06-02 07:40:15 UTC (rev 7734)
@@ -22,6 +22,9 @@
<screen name="SysAdminMain">
<section>
+ <actions>
+ <set field="headerItem" value="download"/>
+ </actions>
<widgets>
<decorator-screen name="CommonSysAdminDecorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
@@ -32,4 +35,19 @@
</section>
</screen>
+ <screen name="DeleteShop">
+ <section>
+ <actions>
+ <set field="headerItem" value="delete"/>
+ </actions>
+ <widgets>
+ <decorator-screen name="CommonSysAdminDecorator" location="${parameters.mainDecoratorLocation}">
+ <decorator-section name="body">
+ <include-form name="DeleteShop" location="component://opentravelsystem/webapp/hotelbackend/screens/SysAdminForms.xml"/>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ </section>
+ </screen>
+
</screens>
More information about the Svn
mailing list