You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2007/01/21 19:49:02 UTC
svn commit: r498425 [4/4] - in /ofbiz/trunk: ./ framework/entity/fieldtype/
framework/shark/ framework/shark/entitydef/
framework/shark/src/org/enhydra/shark/ framework/shark/src/org/ofbiz/shark/
framework/shark/src/org/ofbiz/shark/audit/ framework/sha...
Modified: ofbiz/trunk/framework/shark/src/org/ofbiz/shark/mapping/EntityParticipantMap.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/shark/src/org/ofbiz/shark/mapping/EntityParticipantMap.java?view=diff&rev=498425&r1=498424&r2=498425
==============================================================================
--- ofbiz/trunk/framework/shark/src/org/ofbiz/shark/mapping/EntityParticipantMap.java (original)
+++ ofbiz/trunk/framework/shark/src/org/ofbiz/shark/mapping/EntityParticipantMap.java Sun Jan 21 10:48:58 2007
@@ -31,10 +31,11 @@
/**
* Shark Participant Map Implementation
*/
+
public class EntityParticipantMap implements ParticipantMap {
public static final String module = EntityParticipantMap.class.getName();
-
+
protected GenericDelegator delegator = null;
protected GenericValue participant = null;
protected boolean newValue = false;
@@ -42,7 +43,7 @@
protected EntityParticipantMap(GenericDelegator delegator, String packageId, String processDefId, String participantId) throws RootException {
this.delegator = delegator;
try {
- this.participant = delegator.findByPrimaryKey("WfParticipantMap", UtilMisc.toMap("packageId", packageId, "processDefId", processDefId, "participantId", participantId));
+ this.participant = delegator.findByPrimaryKey(org.ofbiz.shark.SharkConstants.WfParticipantMap, UtilMisc.toMap(org.ofbiz.shark.SharkConstants.packageId, packageId, org.ofbiz.shark.SharkConstants.processDefId, processDefId, org.ofbiz.shark.SharkConstants.participantId, participantId));
} catch (GenericEntityException e) {
throw new RootException(e);
}
@@ -57,7 +58,7 @@
this.newValue = true;
this.delegator = delegator;
- this.participant = delegator.makeValue("WfParticipantMap", UtilMisc.toMap("participantMapId", delegator.getNextSeqId("WfParticipantMap")));
+ this.participant = delegator.makeValue(org.ofbiz.shark.SharkConstants.WfParticipantMap, UtilMisc.toMap(org.ofbiz.shark.SharkConstants.participantMapId, delegator.getNextSeqId(org.ofbiz.shark.SharkConstants.WfParticipantMap)));
}
public static EntityParticipantMap getInstance(GenericValue participant) {
@@ -84,43 +85,43 @@
}
public void setParticipantId(String participantId) {
- participant.set("participantId", participantId);
+ participant.set(org.ofbiz.shark.SharkConstants.participantId, participantId);
}
public String getParticipantId() {
- return participant.getString("participantId");
+ return participant.getString(org.ofbiz.shark.SharkConstants.participantId);
}
public void setPackageId(String packageId) {
- participant.set("packageId", packageId);
+ participant.set(org.ofbiz.shark.SharkConstants.packageId, packageId);
}
public String getPackageId() {
- return participant.getString("participantId");
+ return participant.getString(org.ofbiz.shark.SharkConstants.participantId);
}
public void setProcessDefinitionId(String processDefId) {
- participant.set("processDefId", processDefId);
+ participant.set(org.ofbiz.shark.SharkConstants.processDefId, processDefId);
}
public String getProcessDefinitionId() {
- return participant.getString("processDefId");
+ return participant.getString(org.ofbiz.shark.SharkConstants.processDefId);
}
public void setUsername(String userName) {
- participant.set("userName", userName);
+ participant.set(org.ofbiz.shark.SharkConstants.userName, userName);
}
public String getUsername() {
- return participant.getString("userName");
+ return participant.getString(org.ofbiz.shark.SharkConstants.userName);
}
public boolean getIsGroupUser() {
- return (participant.getBoolean("isGroupUser") != null ? participant.getBoolean("isGroupUser").booleanValue() : false);
+ return (participant.getBoolean(org.ofbiz.shark.SharkConstants.isGroupUser) != null ? participant.getBoolean(org.ofbiz.shark.SharkConstants.isGroupUser).booleanValue() : false);
}
public void setIsGroupUser(boolean isGroupUser) {
- participant.set("isGroupUser", new Boolean(isGroupUser));
+ participant.set(org.ofbiz.shark.SharkConstants.isGroupUser, new Boolean(isGroupUser));
}
public void store() throws RootException {
Modified: ofbiz/trunk/framework/shark/src/org/ofbiz/shark/mapping/EntityParticipantMappingMgr.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/shark/src/org/ofbiz/shark/mapping/EntityParticipantMappingMgr.java?view=diff&rev=498425&r1=498424&r2=498425
==============================================================================
--- ofbiz/trunk/framework/shark/src/org/ofbiz/shark/mapping/EntityParticipantMappingMgr.java (original)
+++ ofbiz/trunk/framework/shark/src/org/ofbiz/shark/mapping/EntityParticipantMappingMgr.java Sun Jan 21 10:48:58 2007
@@ -39,6 +39,7 @@
/**
* Shark Participant Mappings Implementation
*/
+
public class EntityParticipantMappingMgr implements ParticipantMappingManager {
public static final String module = EntityParticipantMappingMgr.class.getName();
@@ -54,7 +55,7 @@
return true;
}
- public boolean deleteParticipantMapping(ParticipantMappingTransaction mappingTransaction, ParticipantMap participantMap) throws RootException {
+ public boolean deleteParticipantMapping(ParticipantMappingTransaction mappingTransaction, ParticipantMap participantMap) throws RootException {
((EntityParticipantMap) participantMap).remove();
return true;
}
@@ -63,7 +64,7 @@
GenericDelegator delegator = SharkContainer.getDelegator();
List lookupList = null;
try {
- lookupList = delegator.findAll("WfParticipantMap");
+ lookupList = delegator.findAll(org.ofbiz.shark.SharkConstants.WfParticipantMap);
} catch (GenericEntityException e) {
throw new RootException(e);
}
@@ -96,7 +97,7 @@
GenericDelegator delegator = SharkContainer.getDelegator();
List lookupList = null;
try {
- lookupList = delegator.findByAnd("WfParticipantMap", UtilMisc.toMap("packageId", packageId, "processDefId", processDefId, "participantId", participantId));
+ lookupList = delegator.findByAnd(org.ofbiz.shark.SharkConstants.WfParticipantMap, UtilMisc.toMap(org.ofbiz.shark.SharkConstants.packageId, packageId, org.ofbiz.shark.SharkConstants.processDefId, processDefId, org.ofbiz.shark.SharkConstants.participantId, participantId));
} catch (GenericEntityException e) {
throw new RootException(e);
}
@@ -117,7 +118,7 @@
GenericDelegator delegator = SharkContainer.getDelegator();
List lookupList = null;
try {
- lookupList = delegator.findByAnd("WfParticipantMap", UtilMisc.toMap("userName", userName));
+ lookupList = delegator.findByAnd(org.ofbiz.shark.SharkConstants.WfParticipantMap, UtilMisc.toMap(org.ofbiz.shark.SharkConstants.userName, userName));
} catch (GenericEntityException e) {
throw new RootException(e);
}
Modified: ofbiz/trunk/framework/shark/src/org/ofbiz/shark/repository/EntityRepositoryMgr.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/shark/src/org/ofbiz/shark/repository/EntityRepositoryMgr.java?view=diff&rev=498425&r1=498424&r2=498425
==============================================================================
--- ofbiz/trunk/framework/shark/src/org/ofbiz/shark/repository/EntityRepositoryMgr.java (original)
+++ ofbiz/trunk/framework/shark/src/org/ofbiz/shark/repository/EntityRepositoryMgr.java Sun Jan 21 10:48:58 2007
@@ -18,63 +18,52 @@
*******************************************************************************/
package org.ofbiz.shark.repository;
-import java.util.List;
+import java.io.Serializable;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
-import org.ofbiz.shark.transaction.JtaTransaction;
-import org.ofbiz.shark.container.SharkContainer;
+import org.enhydra.shark.api.RepositoryTransaction;
+import org.enhydra.shark.api.RootException;
+import org.enhydra.shark.api.TransactionException;
+import org.enhydra.shark.api.internal.repositorypersistence.RepositoryException;
+import org.enhydra.shark.api.internal.repositorypersistence.RepositoryPersistenceManager;
+import org.enhydra.shark.api.internal.working.CallbackUtilities;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.GenericDelegator;
-import org.ofbiz.entity.GenericValue;
+
import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.entity.condition.EntityConditionList;
import org.ofbiz.entity.condition.EntityExpr;
import org.ofbiz.entity.condition.EntityOperator;
-import org.ofbiz.entity.condition.EntityConditionList;
+
import org.ofbiz.entity.util.EntityUtil;
-import org.ofbiz.base.util.UtilDateTime;
-import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.base.util.StringUtil;
-import org.ofbiz.base.util.Debug;
+import org.ofbiz.shark.container.SharkContainer;
+import org.ofbiz.shark.transaction.JtaTransaction;
+
-import org.enhydra.shark.api.internal.repositorypersistence.RepositoryPersistenceManager;
-import org.enhydra.shark.api.internal.repositorypersistence.RepositoryException;
-import org.enhydra.shark.api.internal.working.CallbackUtilities;
-import org.enhydra.shark.api.RootException;
-import org.enhydra.shark.api.RepositoryTransaction;
-import org.enhydra.shark.api.TransactionException;
public class EntityRepositoryMgr implements RepositoryPersistenceManager {
public static final String module = EntityRepositoryMgr.class.getName();
protected CallbackUtilities callBack = null;
+ private NextVersions nextVersions;
- public void configure(CallbackUtilities callBack) throws RootException {
+ public void configure(CallbackUtilities callBack) throws RootException
+ {
this.callBack = callBack;
+ nextVersions=new NextVersions();
}
-
- public void uploadXPDL(RepositoryTransaction t, String xpdlId, byte[] xpdl) throws RepositoryException {
- Debug.log("XPDL Upload : " + xpdlId, module);
- GenericDelegator delegator = SharkContainer.getDelegator();
- try {
- GenericValue v = delegator.makeValue("WfRepository", null);
- v.set("xpdlId", xpdlId);
- v.set("xpdlVersion", UtilDateTime.nowDateString());
- v.set("isHistorical", "N");
- v.setBytes("xpdlData", xpdl);
- delegator.create(v);
- Debug.log("Created Value - " + v, module);
- } catch (GenericEntityException e) {
- throw new RepositoryException(e);
- }
- }
-
public void updateXPDL(RepositoryTransaction t, String xpdlId, String xpdlVersion, byte[] xpdl) throws RepositoryException {
- Debug.log("XPDL Update : " + xpdlId + "/" + xpdlVersion + " - " + StringUtil.toHexString(xpdl), module);
GenericValue value = this.getXpdlValue(xpdlId, xpdlVersion, false);
if (value != null) {
- value.setBytes("xpdlData", xpdl);
+ value.setBytes(org.ofbiz.shark.SharkConstants.xpdlData, xpdl);
+
try {
value.store();
} catch (GenericEntityException e) {
@@ -85,10 +74,12 @@
public void deleteXPDL(RepositoryTransaction t, String xpdlId, String xpdlVersion) throws RepositoryException {
Debug.log("XPDL Delete : " + xpdlId + "/" + xpdlVersion, module);
+ GenericDelegator delegator = SharkContainer.getDelegator();
GenericValue value = this.getXpdlValue(xpdlId, xpdlVersion, false);
if (value != null) {
try {
value.remove();
+ delegator.removeByAnd(org.ofbiz.shark.SharkConstants.WfRepositoryRef, UtilMisc.toMap(org.ofbiz.shark.SharkConstants.xpdlId, xpdlId));
} catch (GenericEntityException e) {
throw new RepositoryException(e);
}
@@ -97,10 +88,12 @@
public void moveToHistory(RepositoryTransaction t, String xpdlId, String xpdlVersion) throws RepositoryException {
Debug.log("XPDL Move to History : " + xpdlId + "/" + xpdlVersion, module);
+ GenericDelegator delegator = SharkContainer.getDelegator();
GenericValue value = this.getXpdlValue(xpdlId, xpdlVersion, false);
- value.set("isHistorical", "Y");
+ value.set(org.ofbiz.shark.SharkConstants.isHistorical, "Y");
try {
value.store();
+ delegator.removeByAnd(org.ofbiz.shark.SharkConstants.WfRepositoryRef, UtilMisc.toMap(org.ofbiz.shark.SharkConstants.xpdlId, xpdlId));
} catch (GenericEntityException e) {
throw new RepositoryException(e);
}
@@ -122,25 +115,30 @@
Debug.log("XPDL Clear Repository", module);
GenericDelegator delegator = SharkContainer.getDelegator();
try {
- delegator.removeByAnd("WfRepository", null);
+ delegator.removeByAnd(org.ofbiz.shark.SharkConstants.WfRepository, null);
} catch (GenericEntityException e) {
throw new RepositoryException(e);
}
}
- public String getCurrentVersion(RepositoryTransaction t, String xpdlId) throws RepositoryException {
+ public String getCurrentVersion(RepositoryTransaction t, String xpdlId) throws RepositoryException
+ {
Debug.log("XPDL get current version : " + xpdlId, module);
List lookupList = this.getXpdlValues(xpdlId, null, false);
GenericValue value = EntityUtil.getFirst(lookupList);
if (value != null) {
- return value.getString("xpdlVersion");
+ return value.getString(org.ofbiz.shark.SharkConstants.xpdlVersion);
} else {
throw new RepositoryException("XPDL not found in repository!");
}
}
public String getNextVersion(RepositoryTransaction t, String xpdlId) throws RepositoryException {
- return UtilDateTime.nowDateString();
+ try {
+ return nextVersions.getNextVersion(xpdlId);
+ } catch (Exception ex) {
+ throw new RepositoryException(ex);
+ }
}
public byte[] getXPDL(RepositoryTransaction t, String xpdlId) throws RepositoryException {
@@ -148,7 +146,7 @@
List lookupList = this.getXpdlValues(xpdlId, null, false);
GenericValue value = EntityUtil.getFirst(lookupList);
if (value != null) {
- return value.getBytes("xpdlData");
+ return value.getBytes(org.ofbiz.shark.SharkConstants.serializedPkg);
} else {
throw new RepositoryException("XPDL not found in repository!");
}
@@ -158,21 +156,20 @@
Debug.log("XPDL Get : " + xpdlId + "/" + xpdlVersion, module);
GenericValue value = this.getXpdlValue(xpdlId, xpdlVersion, false);
if (value != null) {
- return value.getBytes("xpdlData");
+ return value.getBytes(org.ofbiz.shark.SharkConstants.xpdlData);
} else {
throw new RepositoryException("XPDL not found in repository!");
}
}
public List getXPDLVersions(RepositoryTransaction t, String xpdlId) throws RepositoryException {
- Debug.log("XPDL Get Versions : " + xpdlId, module);
List lookupList = this.getXpdlValues(xpdlId, null, false);
List versionList = new ArrayList();
if (!UtilValidate.isEmpty(lookupList)) {
Iterator i = lookupList.iterator();
while (i.hasNext()) {
GenericValue v = (GenericValue) i.next();
- versionList.add(v.getString("xpdlVersion"));
+ versionList.add(v.getString(org.ofbiz.shark.SharkConstants.xpdlVersion));
}
}
return versionList;
@@ -199,7 +196,7 @@
while (i.hasNext()) {
GenericValue v = (GenericValue) i.next();
Debug.log("Checking - " + v, module);
- String id = v.getString("xpdlId");
+ String id = v.getString(org.ofbiz.shark.SharkConstants.xpdlId);
if (!idList.contains(id)) {
idList.add(id);
}
@@ -208,27 +205,14 @@
return idList;
}
- public void addXPDLReference(RepositoryTransaction t, String referredXPDLId, String referringXPDLId, String referringXPDLVersion) throws RepositoryException {
- Debug.log("Add XPDL Reference", module);
- GenericDelegator delegator = SharkContainer.getDelegator();
- GenericValue ref = delegator.makeValue("WfRepositoryRef", null);
- ref.set("xpdlId", referringXPDLId);
- ref.set("xpdlVersion", referringXPDLVersion);
- ref.set("refXpdlId", referredXPDLId);
- try {
- delegator.create(ref);
- } catch (GenericEntityException e) {
- throw new RepositoryException(e);
- }
- }
-
public List getReferringXPDLIds(RepositoryTransaction t, String referredXPDLId) throws RepositoryException {
Debug.log("Get XPDL Reference IDs", module);
GenericDelegator delegator = SharkContainer.getDelegator();
List referringIds = new ArrayList();
List refs = null;
try {
- refs = delegator.findByAnd("WfRepositoryRef", UtilMisc.toMap("refXpdlId", referredXPDLId));
+ refs = delegator.findByAnd(org.ofbiz.shark.SharkConstants.WfRepositoryRef, UtilMisc.toMap(org.ofbiz.shark.SharkConstants.refXpdlId, referredXPDLId));
+
} catch (GenericEntityException e) {
throw new RepositoryException(e);
}
@@ -236,7 +220,7 @@
Iterator i = refs.iterator();
while (i.hasNext()) {
GenericValue v = (GenericValue) i.next();
- referringIds.add(v.getString("xpdlId"));
+ referringIds.add(v.getString(org.ofbiz.shark.SharkConstants.xpdlId));
}
}
return referringIds;
@@ -248,7 +232,7 @@
List referringVers = new ArrayList();
List refs = null;
try {
- refs = delegator.findByAnd("WfRepositoryRef", UtilMisc.toMap("refXpdlId", referredXPDLId, "xpdlId", referringXPDLId));
+ refs = delegator.findByAnd(org.ofbiz.shark.SharkConstants.WfRepositoryRef, UtilMisc.toMap(org.ofbiz.shark.SharkConstants.refXpdlId, referredXPDLId, org.ofbiz.shark.SharkConstants.xpdlId, referringXPDLId));
} catch (GenericEntityException e) {
throw new RepositoryException(e);
}
@@ -256,7 +240,7 @@
Iterator i = refs.iterator();
while (i.hasNext()) {
GenericValue v = (GenericValue) i.next();
- referringVers.add(v.getString("xpdlVersion"));
+ referringVers.add(v.getString(org.ofbiz.shark.SharkConstants.xpdlVersion));
}
}
return referringVers;
@@ -268,17 +252,24 @@
List referringIds = new ArrayList();
List refs = null;
try {
- refs = delegator.findByAnd("WfRepositoryRef", UtilMisc.toMap("xpdlId", referringXPDLId, "xpdlVersion", referringXPDLVersion));
- } catch (GenericEntityException e) {
+ refs = delegator.findByAnd(org.ofbiz.shark.SharkConstants.WfRepositoryRef, UtilMisc.toMap(org.ofbiz.shark.SharkConstants.xpdlId, referringXPDLId, org.ofbiz.shark.SharkConstants.xpdlVersion, referringXPDLVersion));
+ } catch (GenericEntityException e){
throw new RepositoryException(e);
}
- if (!UtilValidate.isEmpty(refs)) {
- Iterator i = refs.iterator();
- while (i.hasNext()) {
- GenericValue v = (GenericValue) i.next();
- referringIds.add(v.getString("refXpdlId"));
+ try
+ {
+ if (!UtilValidate.isEmpty(refs)) {
+ Iterator i = refs.iterator();
+ while (i.hasNext()) {
+ GenericValue v = (GenericValue) i.next();
+ referringIds.add(v.getString(org.ofbiz.shark.SharkConstants.refXpdlId));
+ }
}
}
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
return referringIds;
}
@@ -290,8 +281,8 @@
GenericDelegator delegator = SharkContainer.getDelegator();
GenericValue xpdl = null;
try {
- xpdl = delegator.findByPrimaryKey("WfRepository", UtilMisc.toMap("xpdlId", xpdlId, "xpdlVersion", xpdlVersion));
- if (!includeHistorical && xpdl.get("isHistorical") != null && xpdl.getString("isHistorical").equalsIgnoreCase("Y")) {
+ xpdl = delegator.findByPrimaryKey(org.ofbiz.shark.SharkConstants.WfRepository, UtilMisc.toMap(org.ofbiz.shark.SharkConstants.xpdlId, xpdlId, org.ofbiz.shark.SharkConstants.xpdlVersion, xpdlVersion));
+ if (!includeHistorical && xpdl.get(org.ofbiz.shark.SharkConstants.isHistorical) != null && xpdl.getString(org.ofbiz.shark.SharkConstants.isHistorical).equalsIgnoreCase("Y")) {
xpdl = null;
}
@@ -305,24 +296,160 @@
GenericDelegator delegator = SharkContainer.getDelegator();
List exprList = new ArrayList();
if (xpdlId != null) {
- exprList.add(new EntityExpr("xpdlId", EntityOperator.EQUALS, xpdlId));
+ exprList.add(new EntityExpr(org.ofbiz.shark.SharkConstants.xpdlId, EntityOperator.EQUALS, xpdlId));
}
if (xpdlVersion != null) {
- exprList.add(new EntityExpr("xpdlVersion", EntityOperator.EQUALS, xpdlVersion));
+ exprList.add(new EntityExpr(org.ofbiz.shark.SharkConstants.xpdlVersion, EntityOperator.EQUALS, xpdlVersion));
}
if (!includeHistory) {
- exprList.add(new EntityExpr("isHistorical", EntityOperator.NOT_EQUAL, "Y"));
+ exprList.add(new EntityExpr(org.ofbiz.shark.SharkConstants.isHistorical, EntityOperator.NOT_EQUAL, "Y"));
}
EntityCondition cond = new EntityConditionList(exprList, EntityOperator.AND);
List lookupList = null;
try {
- lookupList = delegator.findByCondition("WfRepository", cond, null, UtilMisc.toList("-xpdlVersion"));
+ lookupList = delegator.findByCondition(org.ofbiz.shark.SharkConstants.WfRepository, cond, null, UtilMisc.toList("-xpdlVersion"));
} catch (GenericEntityException e) {
throw new RepositoryException(e);
} finally {
Debug.set(Debug.VERBOSE, false);
- }
+ }
return lookupList;
+ }
+
+ public void uploadXPDL(RepositoryTransaction t,
+ String xpdlId,
+ byte[] xpdl,
+ byte[] serializedPkg,
+ long xpdlClassVer) throws RepositoryException
+ {
+ Debug.log("XPDL Upload : " + xpdlId, module);
+ //try{throw new Exception ("XPDL Upload");}catch(Exception e){e.printStackTrace();};
+ String newVersion = null;
+ try {
+ newVersion = nextVersions.updateNextVersion(xpdlId);
+ } catch (Exception e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ GenericDelegator delegator = SharkContainer.getDelegator();
+ try {
+ GenericValue v = delegator.makeValue(org.ofbiz.shark.SharkConstants.WfRepository, null);
+ v.set(org.ofbiz.shark.SharkConstants.xpdlId, xpdlId);
+ v.set(org.ofbiz.shark.SharkConstants.xpdlVersion, newVersion);
+ v.set(org.ofbiz.shark.SharkConstants.isHistorical, "N");
+ v.set(org.ofbiz.shark.SharkConstants.XPDLClassVersion, (new Long (xpdlClassVer)).toString());
+ v.setBytes(org.ofbiz.shark.SharkConstants.serializedPkg,serializedPkg);
+ v.setBytes(org.ofbiz.shark.SharkConstants.xpdlData, xpdl);
+ delegator.create(v);
+ Debug.log("Created Value - " + v, module);
+ } catch (GenericEntityException e) {
+ throw new RepositoryException(e);
+ }
+
+ }
+ public void updateXPDL(RepositoryTransaction t,String xpdlId,String xpdlVersion,byte[] xpdl,byte[] serializedPkg,long xpdlClassVer) throws RepositoryException {
+ GenericValue value = this.getXpdlValue(xpdlId, xpdlVersion, false);
+ if (value != null) {
+ value.setBytes(org.ofbiz.shark.SharkConstants.xpdlData, xpdl);
+ value.setBytes(org.ofbiz.shark.SharkConstants.serializedPkg,serializedPkg);
+ try {
+ value.store();
+ } catch (GenericEntityException e) {
+ throw new RepositoryException(e);
+ }
+ }
+ }
+
+ public byte[] getSerializedXPDLObject(RepositoryTransaction arg0, String arg1, String arg2) throws RepositoryException
+ {
+ Debug.log("XPDL Get : " + arg1, module);
+ List lookupList = this.getXpdlValues(arg1, null, false);
+ GenericValue value = EntityUtil.getFirst(lookupList);
+ if (value != null) {
+ return value.getBytes(org.ofbiz.shark.SharkConstants.serializedPkg);
+ } else {
+ throw new RepositoryException("XPDL not found in repository!");
+ }
+ }
+ public void addXPDLReference(RepositoryTransaction t,
+ String referredXPDLId,
+ String referringXPDLId,
+ String referringXPDLVersion,
+ int referredXPDLNumber) throws RepositoryException
+ {
+ Debug.log("Add XPDL Reference", module);
+ GenericDelegator delegator = SharkContainer.getDelegator();
+ GenericValue ref = delegator.makeValue(org.ofbiz.shark.SharkConstants.WfRepositoryRef, null);
+ ref.set(org.ofbiz.shark.SharkConstants.xpdlId, referringXPDLId);
+ ref.set(org.ofbiz.shark.SharkConstants.xpdlVersion, referringXPDLVersion);
+ ref.set(org.ofbiz.shark.SharkConstants.refXpdlId, referredXPDLId);
+ ref.set(org.ofbiz.shark.SharkConstants.refNumber, (new Long(referredXPDLNumber)).toString());
+ try {
+ delegator.create(ref);
+ } catch (GenericEntityException e) {
+ throw new RepositoryException(e);
+ }
+
+ }
+
+ public long getSerializedXPDLObjectVersion(RepositoryTransaction arg0, String xpdlId, String xpdlVersion) throws RepositoryException
+ {
+ try
+ {
+ return (new Long(getCurrentVersion(null, xpdlId))).longValue();
+ }
+ catch (Exception ex)
+ {
+ throw new RepositoryException(ex);
+ }
+ }
+
+ public byte[] getSerializedXPDLObject(RepositoryTransaction arg0, String xpdlId) throws RepositoryException
+ {
+ try
+ {
+ byte [] b = getXPDL(null, xpdlId);
+ if(b == null)
+ return null;
+ return b;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return null;
+ }
+}
+class NextVersions extends HashMap implements Serializable
+{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private static final String INITIAL_VERSION = "1";
+
+ public synchronized String getNextVersion (String xpdlId)
+ {
+ if (containsKey(xpdlId))
+ {
+ return (String)get(xpdlId);
+ }
+ return INITIAL_VERSION;
+ }
+
+ public synchronized String updateNextVersion (String xpdlId) throws Exception
+ {
+ String curVersion=INITIAL_VERSION;
+ String nextVersion=INITIAL_VERSION;
+ if (containsKey(xpdlId))
+ {
+ curVersion=(String)get(xpdlId);
+ }
+ int nver=Integer.parseInt(curVersion)+1;
+ nextVersion=String.valueOf(nver);
+
+ put(xpdlId,nextVersion);
+ return curVersion;
}
}
Modified: ofbiz/trunk/framework/shark/src/org/ofbiz/shark/requester/AbstractRequester.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/shark/src/org/ofbiz/shark/requester/AbstractRequester.java?view=diff&rev=498425&r1=498424&r2=498425
==============================================================================
--- ofbiz/trunk/framework/shark/src/org/ofbiz/shark/requester/AbstractRequester.java (original)
+++ ofbiz/trunk/framework/shark/src/org/ofbiz/shark/requester/AbstractRequester.java Sun Jan 21 10:48:58 2007
@@ -122,11 +122,11 @@
// these are static values available to the service
wrdMap.put("eventType", event.event_type());
- wrdMap.put("activityId", event.activity_key());
- wrdMap.put("activityName", event.activity_name());
- wrdMap.put("processId", event.process_key());
- wrdMap.put("processName", event.process_name());
- wrdMap.put("processMgrName", event.process_mgr_name());
+ wrdMap.put(org.ofbiz.shark.SharkConstants.activityId, event.activity_key());
+ wrdMap.put(org.ofbiz.shark.SharkConstants.activityName, event.activity_name());
+ wrdMap.put(org.ofbiz.shark.SharkConstants.processId, event.process_key());
+ wrdMap.put(org.ofbiz.shark.SharkConstants.processName, event.process_name());
+ wrdMap.put(org.ofbiz.shark.SharkConstants.processMgrName, event.process_mgr_name());
wrdMap.put("processMgrVersion", event.process_mgr_version());
wrdMap.put("eventTime", event.time_stamp().getTimestamp());
@@ -211,6 +211,11 @@
protected class WfProcessIteratorImpl extends WfProcessIteratorWrapper implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
public WfProcessIteratorImpl(SharkTransaction trans, List performers) throws BaseException {
super(trans, null, performers);
}
@@ -219,4 +224,4 @@
super(null, null, performers);
}
}
-}
+}
Modified: ofbiz/trunk/framework/shark/src/org/ofbiz/shark/requester/LoggingRequester.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/shark/src/org/ofbiz/shark/requester/LoggingRequester.java?view=diff&rev=498425&r1=498424&r2=498425
==============================================================================
--- ofbiz/trunk/framework/shark/src/org/ofbiz/shark/requester/LoggingRequester.java (original)
+++ ofbiz/trunk/framework/shark/src/org/ofbiz/shark/requester/LoggingRequester.java Sun Jan 21 10:48:58 2007
@@ -31,11 +31,23 @@
*/
public class LoggingRequester extends AbstractRequester {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
public static final String module = LoggingRequester.class.getName();
+ static GenericValue gv = null;
+
+
+ public LoggingRequester(){
+ super(gv);
+ }
+
// new requester
public LoggingRequester(GenericValue userLogin) {
super(userLogin);
+ gv = userLogin;
}
// -------------------
@@ -50,3 +62,5 @@
this.receive_event(event);
}
}
+
+
Modified: ofbiz/trunk/framework/shark/src/org/ofbiz/shark/requester/ServiceRequester.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/shark/src/org/ofbiz/shark/requester/ServiceRequester.java?view=diff&rev=498425&r1=498424&r2=498425
==============================================================================
--- ofbiz/trunk/framework/shark/src/org/ofbiz/shark/requester/ServiceRequester.java (original)
+++ ofbiz/trunk/framework/shark/src/org/ofbiz/shark/requester/ServiceRequester.java Sun Jan 21 10:48:58 2007
@@ -21,6 +21,11 @@
import java.util.HashMap;
import java.util.Map;
+import org.enhydra.shark.api.SharkTransaction;
+import org.enhydra.shark.api.client.wfbase.BaseException;
+import org.enhydra.shark.api.client.wfmodel.InvalidPerformer;
+import org.enhydra.shark.api.client.wfmodel.WfEventAudit;
+
import org.ofbiz.base.util.Debug;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.service.DispatchContext;
@@ -29,14 +34,12 @@
import org.ofbiz.service.ModelService;
import org.ofbiz.shark.container.SharkContainer;
-import org.enhydra.shark.api.SharkTransaction;
-import org.enhydra.shark.api.client.wfbase.BaseException;
-import org.enhydra.shark.api.client.wfmodel.InvalidPerformer;
-import org.enhydra.shark.api.client.wfmodel.SourceNotAvailable;
-import org.enhydra.shark.api.client.wfmodel.WfEventAudit;
-
public class ServiceRequester extends AbstractRequester {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
public static final String module = ServiceRequester.class.getName();
public static final int ASYNC = 0;
public static final int SYNC = 1;
@@ -61,6 +64,7 @@
// -------------------
public void receive_event(WfEventAudit event) throws BaseException, InvalidPerformer {
+ Debug.logInfo("Call : ServiceRequester.receive_event(WfEventAudit event)", module);
if (this.getEventType() == null || this.getEventType().equals(event.event_type())) {
try {
this.run(event);
@@ -72,6 +76,7 @@
}
public void receive_event(SharkTransaction trans, WfEventAudit event) throws BaseException, InvalidPerformer {
+ Debug.logInfo("Call : ServiceRequester.receive_event (SharkTransaction trans, WfEventAudit event)", module);
receive_event(event);
}
Modified: ofbiz/trunk/framework/shark/src/org/ofbiz/shark/tool/ServiceEngineAgent.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/shark/src/org/ofbiz/shark/tool/ServiceEngineAgent.java?view=diff&rev=498425&r1=498424&r2=498425
==============================================================================
--- ofbiz/trunk/framework/shark/src/org/ofbiz/shark/tool/ServiceEngineAgent.java (original)
+++ ofbiz/trunk/framework/shark/src/org/ofbiz/shark/tool/ServiceEngineAgent.java Sun Jan 21 10:48:58 2007
@@ -34,11 +34,13 @@
import org.enhydra.shark.api.internal.toolagent.ApplicationNotStarted;
import org.enhydra.shark.api.internal.toolagent.AppParameter;
import org.enhydra.shark.api.SharkTransaction;
+import org.enhydra.shark.xpdl.XPDLConstants;
import org.enhydra.shark.xpdl.elements.ExtendedAttributes;
/**
* Shark Service Engine Agent Tool API
*/
+
public class ServiceEngineAgent extends AbstractToolAgent {
public static final String module = ServiceEngineAgent.class.getName();
@@ -75,13 +77,13 @@
status = APP_STATUS_INVALID;
} else {
status = APP_STATUS_FINISHED;
- }
+ }
}
private void getServiceContext(AppParameter[] params, Map context) {
if (params != null && context != null) {
for (int i = 1; i < params.length; i++) {
- if (params[i].the_mode.equals(AppParameter.MODE_IN) || params[i].the_mode.equals(AppParameter.MODE_INOUT)) {
+ if (params[i].the_mode.equals(XPDLConstants.FORMAL_PARAMETER_MODE_IN) || params[i].the_mode.equals(XPDLConstants.FORMAL_PARAMETER_MODE_INOUT)) {
context.put(params[i].the_formal_name, params[i].the_value);
}
}
@@ -91,7 +93,7 @@
private void getServiceResults(AppParameter[] params, Map result) {
if (params != null && result != null) {
for (int i = 1; i < params.length; i++) {
- if (params[i].the_mode.equals(AppParameter.MODE_OUT) || params[i].the_mode.equals(AppParameter.MODE_INOUT)) {
+ if (params[i].the_mode.equals(XPDLConstants.FORMAL_PARAMETER_MODE_OUT) || params[i].the_mode.equals(XPDLConstants.FORMAL_PARAMETER_MODE_INOUT)) {
params[i].the_value = result.get(params[i].the_formal_name);
}
}
Modified: ofbiz/trunk/framework/shark/src/org/ofbiz/shark/user/GenericUserGroupMgr.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/shark/src/org/ofbiz/shark/user/GenericUserGroupMgr.java?view=diff&rev=498425&r1=498424&r2=498425
==============================================================================
--- ofbiz/trunk/framework/shark/src/org/ofbiz/shark/user/GenericUserGroupMgr.java (original)
+++ ofbiz/trunk/framework/shark/src/org/ofbiz/shark/user/GenericUserGroupMgr.java Sun Jan 21 10:48:58 2007
@@ -52,7 +52,7 @@
List groupNames = new ArrayList();
List groups = null;
try {
- groups = delegator.findAll("SharkGroup");
+ groups = delegator.findAll(org.ofbiz.shark.SharkConstants.SharkGroup);
} catch (GenericEntityException e) {
Debug.logError(e, module);
throw new RootException(e);
@@ -61,7 +61,7 @@
Iterator i = groups.iterator();
while (i.hasNext()) {
GenericValue v = (GenericValue) i.next();
- groupNames.add(v.getString("groupName"));
+ groupNames.add(v.getString(org.ofbiz.shark.SharkConstants.groupName));
}
}
return groupNames;
@@ -72,7 +72,7 @@
List userNames = new ArrayList();
List users = null;
try {
- users = delegator.findAll("SharkUser");
+ users = delegator.findAll(org.ofbiz.shark.SharkConstants.SharkUser);
} catch (GenericEntityException e) {
Debug.logError(e, module);
throw new RootException(e);
@@ -81,7 +81,7 @@
Iterator i = users.iterator();
while (i.hasNext()) {
GenericValue v = (GenericValue) i.next();
- userNames.add(v.getString("userName"));
+ userNames.add(v.getString(org.ofbiz.shark.SharkConstants.userName));
}
}
return userNames;
@@ -92,7 +92,7 @@
List userNames = new ArrayList();
List members = null;
try {
- members = delegator.findByAnd("SharkGroupMember", UtilMisc.toMap("groupName", groupName));
+ members = delegator.findByAnd(org.ofbiz.shark.SharkConstants.SharkGroupMember, UtilMisc.toMap(org.ofbiz.shark.SharkConstants.groupName, groupName));
} catch (GenericEntityException e) {
Debug.logError(e, module);
throw new RootException(e);
@@ -101,7 +101,7 @@
Iterator i = members.iterator();
while (i.hasNext()) {
GenericValue v = (GenericValue) i.next();
- userNames.add(v.getString("userName"));
+ userNames.add(v.getString(org.ofbiz.shark.SharkConstants.userName));
}
}
return userNames;
@@ -128,7 +128,7 @@
List subGroups = new ArrayList();
List rollups = null;
try {
- rollups = delegator.findByAnd("SharkGroupRollup", UtilMisc.toMap("groupName", groupName));
+ rollups = delegator.findByAnd(org.ofbiz.shark.SharkConstants.SharkGroupRollup, UtilMisc.toMap(org.ofbiz.shark.SharkConstants.groupName, groupName));
} catch (GenericEntityException e) {
Debug.logError(e, module);
throw new RootException(e);
@@ -161,9 +161,9 @@
public void createGroup(UserTransaction trans, String groupName, String description) throws RootException {
GenericDelegator delegator = SharkContainer.getDelegator();
- GenericValue group = delegator.makeValue("SharkGroup", null);
- group.set("groupName", groupName);
- group.set("description", description);
+ GenericValue group = delegator.makeValue(org.ofbiz.shark.SharkConstants.SharkGroup, null);
+ group.set(org.ofbiz.shark.SharkConstants.groupName, groupName);
+ group.set(org.ofbiz.shark.SharkConstants.description, description);
try {
delegator.create(group);
} catch (GenericEntityException e) {
@@ -203,7 +203,7 @@
public void updateGroup(UserTransaction trans, String groupName, String description) throws RootException {
GenericValue group = getGroup(groupName);
if (group != null) {
- group.set("description", description);
+ group.set(org.ofbiz.shark.SharkConstants.description, description);
try {
group.store();
} catch (GenericEntityException e) {
@@ -215,9 +215,9 @@
public void addGroupToGroup(UserTransaction trans, String parentGroupName, String groupName) throws RootException {
GenericDelegator delegator = SharkContainer.getDelegator();
- GenericValue rollup = delegator.makeValue("SharkGroupRollup", null);
- rollup.set("parentGroupName", parentGroupName);
- rollup.set("groupName", groupName);
+ GenericValue rollup = delegator.makeValue(org.ofbiz.shark.SharkConstants.SharkGroupRollup, null);
+ rollup.set(org.ofbiz.shark.SharkConstants.parentGroupName, parentGroupName);
+ rollup.set(org.ofbiz.shark.SharkConstants.groupName, groupName);
try {
delegator.create(rollup);
} catch (GenericEntityException e) {
@@ -239,11 +239,11 @@
}
public void removeGroupTree(UserTransaction trans, String s) throws RootException {
- // TODO: Implement Me!
+ Debug.logInfo("Call : removeGroupTree(UserTransaction trans, String s)", module);
}
public void removeUsersFromGroupTree(UserTransaction trans, String s) throws RootException {
- // TODO: Implement Me!
+ Debug.logInfo("Call : void removeUsersFromGroupTree(UserTransaction trans, String s)", module);
}
public void moveGroup(UserTransaction trans, String currentParentGroup, String newParentGroup, String groupName) throws RootException {
@@ -254,16 +254,16 @@
public String getGroupDescription(UserTransaction trans, String groupName) throws RootException {
GenericValue group = getGroup(groupName);
if (group != null) {
- return group.getString("description");
+ return group.getString(org.ofbiz.shark.SharkConstants.description);
}
return null;
}
public void addUserToGroup(UserTransaction trans, String groupName, String username) throws RootException {
GenericDelegator delegator = SharkContainer.getDelegator();
- GenericValue member = delegator.makeValue("SharkGroupMember", null);
- member.set("groupName", groupName);
- member.set("userName", username);
+ GenericValue member = delegator.makeValue(org.ofbiz.shark.SharkConstants.SharkGroupMember, null);
+ member.set(org.ofbiz.shark.SharkConstants.groupName, groupName);
+ member.set(org.ofbiz.shark.SharkConstants.userName, username);
try {
delegator.create(member);
} catch (GenericEntityException e) {
@@ -299,12 +299,12 @@
public void createUser(UserTransaction trans, String groupName, String username, String password, String firstName, String lastName, String email) throws RootException {
GenericDelegator delegator = SharkContainer.getDelegator();
- GenericValue user = delegator.makeValue("SharkUser", null);
- user.set("userName", username);
- user.set("firstName", firstName);
- user.set("lastName", lastName);
- user.set("passwd", password);
- user.set("emailAddress", email);
+ GenericValue user = delegator.makeValue(org.ofbiz.shark.SharkConstants.SharkUser, null);
+ user.set(org.ofbiz.shark.SharkConstants.userName, username);
+ user.set(org.ofbiz.shark.SharkConstants.firstName, firstName);
+ user.set(org.ofbiz.shark.SharkConstants.lastName, lastName);
+ user.set(org.ofbiz.shark.SharkConstants.passwd, password);
+ user.set(org.ofbiz.shark.SharkConstants.emailAddress, email);
try {
delegator.create(user);
} catch (GenericEntityException e) {
@@ -319,9 +319,9 @@
public void updateUser(UserTransaction trans, String username, String firstName, String lastName, String email) throws RootException {
GenericValue user = getUser(username);
if (user != null) {
- user.set("firstName", firstName);
- user.set("lastName", firstName);
- user.set("emailAddress", email);
+ user.set(org.ofbiz.shark.SharkConstants.firstName, firstName);
+ user.set(org.ofbiz.shark.SharkConstants.lastName, firstName);
+ user.set(org.ofbiz.shark.SharkConstants.emailAddress, email);
try {
user.store();
} catch (GenericEntityException e) {
@@ -354,7 +354,7 @@
public void setPassword(UserTransaction trans, String username, String password) throws RootException {
GenericValue user = getUser(username);
if (user != null) {
- user.set("passwd", password);
+ user.set(org.ofbiz.shark.SharkConstants.passwd, password);
try {
user.store();
} catch (GenericEntityException e) {
@@ -367,33 +367,33 @@
public String getUserRealName(UserTransaction trans, String username) throws RootException {
StringBuffer buf = new StringBuffer();
GenericValue user = getUser(username);
- if (!UtilValidate.isEmpty(user.getString("firstName"))) {
- buf.append(user.getString("firstName"));
+ if (!UtilValidate.isEmpty(user.getString(org.ofbiz.shark.SharkConstants.firstName))) {
+ buf.append(user.getString(org.ofbiz.shark.SharkConstants.firstName));
}
- if (!UtilValidate.isEmpty(user.getString("lastName"))) {
+ if (!UtilValidate.isEmpty(user.getString(org.ofbiz.shark.SharkConstants.lastName))) {
if (buf.length() > 0) {
buf.append(" ");
}
- buf.append(user.getString("lastName"));
+ buf.append(user.getString(org.ofbiz.shark.SharkConstants.lastName));
}
return buf.toString();
}
public String getUserFirstName(UserTransaction trans, String username) throws RootException {
GenericValue user = getUser(username);
- return user.getString("firstName");
+ return user.getString(org.ofbiz.shark.SharkConstants.firstName);
}
public String getUserLastName(UserTransaction trans, String username) throws RootException {
GenericValue user = getUser(username);
- return user.getString("lastName");
+ return user.getString(org.ofbiz.shark.SharkConstants.lastName);
}
public String getUserEMailAddress(UserTransaction trans, String username) throws RootException {
GenericValue user = getUser(username);
if (user != null) {
- return user.getString("emailAddress");
+ return user.getString(org.ofbiz.shark.SharkConstants.emailAddress);
}
return null;
}
@@ -402,7 +402,7 @@
GenericDelegator delegator = SharkContainer.getDelegator();
GenericValue value = null;
try {
- value = delegator.findByPrimaryKey("SharkUser", UtilMisc.toMap("userName", username));
+ value = delegator.findByPrimaryKey(org.ofbiz.shark.SharkConstants.SharkUser, UtilMisc.toMap(org.ofbiz.shark.SharkConstants.userName, username));
} catch (GenericEntityException e) {
Debug.logError(e, module);
throw new RootException(e);
@@ -414,7 +414,7 @@
GenericDelegator delegator = SharkContainer.getDelegator();
GenericValue value = null;
try {
- value = delegator.findByPrimaryKey("SharkGroup", UtilMisc.toMap("groupName", groupName));
+ value = delegator.findByPrimaryKey(org.ofbiz.shark.SharkConstants.SharkGroup, UtilMisc.toMap(org.ofbiz.shark.SharkConstants.groupName, groupName));
} catch (GenericEntityException e) {
Debug.logError(e, module);
throw new RootException(e);
@@ -426,7 +426,7 @@
GenericDelegator delegator = SharkContainer.getDelegator();
GenericValue member = null;
try {
- member = delegator.findByPrimaryKey("SharkGroupMember", UtilMisc.toMap("groupName", groupName, "userName", username));
+ member = delegator.findByPrimaryKey(org.ofbiz.shark.SharkConstants.SharkGroupMember, UtilMisc.toMap(org.ofbiz.shark.SharkConstants.groupName, groupName, org.ofbiz.shark.SharkConstants.userName, username));
} catch (GenericEntityException e) {
Debug.logError(e, module);
throw new RootException(e);
@@ -438,7 +438,7 @@
GenericDelegator delegator = SharkContainer.getDelegator();
GenericValue rollup = null;
try {
- rollup = delegator.findByPrimaryKey("SharkGroupRollup", UtilMisc.toMap("parentGroupName", parentGroup, "groupName", group));
+ rollup = delegator.findByPrimaryKey(org.ofbiz.shark.SharkConstants.SharkGroupRollup, UtilMisc.toMap(org.ofbiz.shark.SharkConstants.parentGroupName, parentGroup, org.ofbiz.shark.SharkConstants.groupName, group));
} catch (GenericEntityException e) {
Debug.logError(e, module);
throw new RootException(e);
@@ -446,3 +446,4 @@
return rollup;
}
}
+
Modified: ofbiz/trunk/framework/shark/src/org/ofbiz/shark/user/PartyUserGroupMgr.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/shark/src/org/ofbiz/shark/user/PartyUserGroupMgr.java?view=diff&rev=498425&r1=498424&r2=498425
==============================================================================
--- ofbiz/trunk/framework/shark/src/org/ofbiz/shark/user/PartyUserGroupMgr.java (original)
+++ ofbiz/trunk/framework/shark/src/org/ofbiz/shark/user/PartyUserGroupMgr.java Sun Jan 21 10:48:58 2007
@@ -26,13 +26,13 @@
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.shark.container.SharkContainer;
+import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilMisc;
import org.enhydra.shark.api.internal.usergroup.UserGroupManager;
import org.enhydra.shark.api.internal.working.CallbackUtilities;
import org.enhydra.shark.api.RootException;
import org.enhydra.shark.api.UserTransaction;
-
public class PartyUserGroupMgr implements UserGroupManager {
public static final String module = PartyUserGroupMgr.class.getName();
@@ -45,7 +45,8 @@
}
public List getAllGroupnames(UserTransaction trans) throws RootException {
- return null; // TODO: Implement Me!
+ Debug.logInfo("Call : List getAllGroupnames(UserTransaction trans)",module);
+ return null;
}
public List getAllUsers(UserTransaction trans) throws RootException {
@@ -69,32 +70,32 @@
}
public List getAllUsers(UserTransaction trans, String groupName) throws RootException {
- // TODO: Implement Me!
+ Debug.logInfo("Call : List getAllUsers(UserTransaction trans, String groupName)",module);
return this.getAllUsers(trans);
}
public List getAllUsers(UserTransaction trans, List groupNames) throws RootException {
- // TODO: Implement Me!
+ Debug.logInfo("Call : List getAllUsers(UserTransaction trans, List groupNames)",module);
return null; // TODO: Implement Me!
}
public List getAllImmediateUsers(UserTransaction trans, String groupName) throws RootException {
- // TODO: Implement Me!
+ Debug.logInfo("Call : List getAllImmediateUsers(UserTransaction trans, String groupName)",module);
return this.getAllUsers(trans);
}
public List getAllSubgroups(UserTransaction trans, String groupName) throws RootException {
- // TODO: Implement Me!
+ Debug.logInfo("Call : List getAllSubgroups(UserTransaction trans, String groupName)",module);
return null;
}
public List getAllSubgroups(UserTransaction trans, List groupNames) throws RootException {
- // TODO: Implement Me!
+ Debug.logInfo("Call : List getAllSubgroups(UserTransaction trans, List groupNames)",module);
return null;
}
public List getAllImmediateSubgroups(UserTransaction trans, String groupName) throws RootException {
- // TODO: Implement Me!
+ Debug.logInfo("Call : List getAllImmediateSubgroups(UserTransaction trans, String groupName)",module);
return null;
}
@@ -107,10 +108,12 @@
}
public boolean doesGroupExist(UserTransaction trans, String groupName) throws RootException {
+ Debug.logInfo("Call : doesGroupExist(UserTransaction trans, String groupName)",module);
return false; // TODO: Implement Me!
}
public boolean doesGroupBelongToGroup(UserTransaction trans, String groupName, String subGroupName) throws RootException {
+ Debug.logInfo("Call : boolean doesGroupBelongToGroup(UserTransaction trans, String groupName, String subGroupName)",module);
return false; // TODO: Implement Me!
}
@@ -155,6 +158,7 @@
}
public boolean doesUserBelongToGroup(UserTransaction trans, String groupName, String username) throws RootException {
+ Debug.logInfo("Call : doesUserBelongToGroup(UserTransaction trans, String groupName, String username)",module);
return false; // TODO: Implement Me!
}
Modified: ofbiz/trunk/framework/shark/webapp/shark/WEB-INF/actions/process/processDetailList.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/shark/webapp/shark/WEB-INF/actions/process/processDetailList.bsh?view=diff&rev=498425&r1=498424&r2=498425
==============================================================================
--- ofbiz/trunk/framework/shark/webapp/shark/WEB-INF/actions/process/processDetailList.bsh (original)
+++ ofbiz/trunk/framework/shark/webapp/shark/WEB-INF/actions/process/processDetailList.bsh Sun Jan 21 10:48:58 2007
@@ -15,6 +15,7 @@
*/
import java.util.*;
+import org.ofbiz.shark.container.SharkContainer;
import org.ofbiz.base.util.*;
import org.ofbiz.shark.container.*;
import org.ofbiz.shark.requester.*;
@@ -22,6 +23,7 @@
import org.enhydra.shark.api.client.wfmodel.*;
userLogin = session.getAttribute("userLogin");
+//userLogin = SharkContainer.getAdminUser();
// get the admin tools
admin = SharkContainer.getAdminInterface();
@@ -40,7 +42,13 @@
try {
procId = request.getParameter("start");
proc = exMgr.getProcess(procId);
- proc.start();
+ if(proc != null)
+ {
+ String s = proc.state();
+ if(s!=null)
+ if(!s.startsWith("open"))
+ proc.start();
+ }
} catch (Exception e) {
request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
}
@@ -51,7 +59,13 @@
try {
procId = request.getParameter("suspend");
proc = exMgr.getProcess(procId);
- proc.suspend();
+ if(proc != null)
+ {
+ String s = proc.state();
+ if(s!=null)
+ if(s.startsWith("open"))
+ proc.suspend();
+ }
} catch (Exception e) {
request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
}
@@ -62,7 +76,13 @@
try {
procId = request.getParameter("resume");
proc = exMgr.getProcess(procId);
- proc.resume();
+ if(proc != null)
+ {
+ String s = proc.state();
+ if(s!=null)
+ if(!s.startsWith("close.open.not_running.suspended"))
+ proc.resume();
+ }
} catch (Exception e) {
request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
}
@@ -73,7 +93,13 @@
try {
procId = request.getParameter("abort");
proc = exMgr.getProcess(procId);
- proc.abort();
+ if(proc != null)
+ {
+ String s = proc.state();
+ if(s!=null)
+ if(s.startsWith("open"))
+ proc.abort();
+ }
} catch (Exception e) {
request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
}
@@ -84,7 +110,13 @@
try {
procId = request.getParameter("terminate");
proc = exMgr.getProcess(procId);
- proc.terminate();
+
+ if(proc != null){
+ String s = proc.state();
+ if(s!=null)
+ if(!s.startsWith("close"))
+ proc.terminate();
+ }
} catch (Exception e) {
request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
}
@@ -103,6 +135,24 @@
count = mgr.how_many_process();
procs = mgr.get_sequence_process(count);
context.put("processes", procs);
+ }
+}
+if (request.getParameter("delete") != null) {
+ try
+ {
+ procId = request.getParameter("delete");
+ if(procId != null)
+ {
+ proc = exMgr.getProcess(procId);
+ if(proc!=null){
+ String s = proc.state();
+ if(s!=null)
+ if(s.startsWith("close"))
+ exMgr.deleteClosedProcess(procId);
+ }
+ }
+ } catch (Exception e) {
+ request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
}
}
Modified: ofbiz/trunk/framework/shark/webapp/shark/WEB-INF/actions/process/processHistory.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/shark/webapp/shark/WEB-INF/actions/process/processHistory.bsh?view=diff&rev=498425&r1=498424&r2=498425
==============================================================================
--- ofbiz/trunk/framework/shark/webapp/shark/WEB-INF/actions/process/processHistory.bsh (original)
+++ ofbiz/trunk/framework/shark/webapp/shark/WEB-INF/actions/process/processHistory.bsh Sun Jan 21 10:48:58 2007
@@ -17,11 +17,14 @@
import java.util.*;
import org.ofbiz.base.util.*;
import org.ofbiz.shark.container.*;
+import org.ofbiz.shark.container.SharkContainer;
import org.ofbiz.shark.requester.*;
import org.enhydra.shark.api.client.wfservice.*;
import org.enhydra.shark.api.client.wfmodel.*;
userLogin = session.getAttribute("userLogin");
+//userLogin = SharkContainer.getAdminUser();
+
// get the admin tools
admin = SharkContainer.getAdminInterface();
@@ -37,6 +40,7 @@
// process key
procKey = request.getParameter("process");
+while(true){
if (procKey != null) {
context.put("processKey", procKey);
@@ -46,9 +50,12 @@
// get the history
count = proc.how_many_history();
+ if(count == 0)
+ {break;}
procs = proc.get_sequence_history(count);
context.put("historyList", procs);
+ break;
+}
}
-
// disconnect from the engine
exMgr.disconnect();
Modified: ofbiz/trunk/framework/shark/webapp/shark/WEB-INF/actions/process/processList.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/shark/webapp/shark/WEB-INF/actions/process/processList.bsh?view=diff&rev=498425&r1=498424&r2=498425
==============================================================================
--- ofbiz/trunk/framework/shark/webapp/shark/WEB-INF/actions/process/processList.bsh (original)
+++ ofbiz/trunk/framework/shark/webapp/shark/WEB-INF/actions/process/processList.bsh Sun Jan 21 10:48:58 2007
@@ -35,6 +35,7 @@
// connect to the engine
exMgr.connect(userLogin.getString("userLoginId"), userLogin.getString("currentPassword"), null, null);
+
// enabled state code
context.put("enabledCode", process_mgr_stateType._enabled);
@@ -54,6 +55,14 @@
}
}
+if (request.getParameter("deleteFinished") != null) {
+ try {
+ exMgr.deleteClosedProcesses();
+ } catch (Exception e) {
+ request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
+ }
+}
+
// disable the mgr
if (request.getParameter("disable") != null) {
mgrName = request.getParameter("disable");
@@ -64,6 +73,7 @@
mgr.set_process_mgr_state(disabledType);
}
} catch (Exception e) {
+ e.printStackTrace();
request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
}
}
@@ -85,11 +95,17 @@
// get the process managers
pi = exMgr.get_iterator_processmgr();
if (pi != null) {
+try{
mgrList = new ArrayList();
size = pi.how_many();
mgrs = pi.get_next_n_sequence(size);
Debug.log("Mgrs : " + mgrs.length);
context.put("processMgrs", Arrays.asList(mgrs));
+// throw new Exception();
+ }catch(Exception e)
+ {
+ e.printStackTrace();
+ }
}
Modified: ofbiz/trunk/framework/shark/webapp/shark/WEB-INF/actions/repository/showRepository.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/shark/webapp/shark/WEB-INF/actions/repository/showRepository.bsh?view=diff&rev=498425&r1=498424&r2=498425
==============================================================================
--- ofbiz/trunk/framework/shark/webapp/shark/WEB-INF/actions/repository/showRepository.bsh (original)
+++ ofbiz/trunk/framework/shark/webapp/shark/WEB-INF/actions/repository/showRepository.bsh Sun Jan 21 10:48:58 2007
@@ -77,7 +77,8 @@
if (lst.size() > 0) {
fui = lst.iterator();
while (fui.hasNext()) {
- fi = fui.next();
+ DefaultFileItem fi = fui.next();
+ //String name = SharkContainer.getFileName(fi.getName());
repMgr.uploadPackage(fi.get(), fi.getName());
packageId = repMgr.getPackageId(fi.getName());
pkgMgr.openPackage(fi.getName());
Modified: ofbiz/trunk/framework/shark/webapp/shark/WEB-INF/actions/tasklist/worklist.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/shark/webapp/shark/WEB-INF/actions/tasklist/worklist.bsh?view=diff&rev=498425&r1=498424&r2=498425
==============================================================================
--- ofbiz/trunk/framework/shark/webapp/shark/WEB-INF/actions/tasklist/worklist.bsh (original)
+++ ofbiz/trunk/framework/shark/webapp/shark/WEB-INF/actions/tasklist/worklist.bsh Sun Jan 21 10:48:58 2007
@@ -36,6 +36,7 @@
// connect to the engine
exMgr.connect(userLogin.getString("userLoginId"), userLogin.getString("currentPassword"), null, null);
+
// handle accept/complete
if (request.getParameter("mode") != null) {
String mode = request.getParameter("mode");
@@ -78,5 +79,3 @@
// disconnect from the engine
exMgr.disconnect();
-
-
Modified: ofbiz/trunk/framework/shark/webapp/shark/process/processDetailList.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/shark/webapp/shark/process/processDetailList.ftl?view=diff&rev=498425&r1=498424&r2=498425
==============================================================================
--- ofbiz/trunk/framework/shark/webapp/shark/process/processDetailList.ftl (original)
+++ ofbiz/trunk/framework/shark/webapp/shark/process/processDetailList.ftl Sun Jan 21 10:48:58 2007
@@ -52,8 +52,10 @@
<td> </td>
<#if proc.state() == "open.not_running.not_started">
<td align="center"><a href="<@ofbizUrl>processDetailList?manager=${manager?replace("#", "%23")?if_exists}&start=${proc.key()}</...@ofbizUrl>" class="buttontext">Start</a></td>
+ <td align="center"><a href="<@ofbizUrl>processDetailList?manager=${manager?replace("#", "%23")?if_exists}&delete=${proc.key()}</...@ofbizUrl>" class="buttontext">Delete</a></td>
<#elseif proc.state() == "open.not_running.suspended">
<td align="center"><a href="<@ofbizUrl>processDetailList?manager=${manager?replace("#", "%23")?if_exists}&resume=${proc.key()}</...@ofbizUrl>" class="buttontext">Resume</a></td>
+ <td align="center"><a href="<@ofbizUrl>processDetailList?manager=${manager?replace("#", "%23")?if_exists}&delete=${proc.key()}</...@ofbizUrl>" class="buttontext">Delete</a></td>
<#else>
<td> </td>
</#if>
Modified: ofbiz/trunk/framework/shark/webapp/shark/process/processHistory.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/shark/webapp/shark/process/processHistory.ftl?view=diff&rev=498425&r1=498424&r2=498425
==============================================================================
--- ofbiz/trunk/framework/shark/webapp/shark/process/processHistory.ftl (original)
+++ ofbiz/trunk/framework/shark/webapp/shark/process/processHistory.ftl Sun Jan 21 10:48:58 2007
@@ -32,7 +32,11 @@
<#assign eventType = history.event_type()>
${eventType}
<#if eventType == "processStateChanged">
- [${history.old_state()} -> ${history.new_state()}]
+ <#if (history.old_state())?has_content>
+ [${history.old_state()} -> ${history.new_state()}]
+ <#else>
+ [${"not_started"} -> ${history.new_state()}]
+ </#if>
</#if>
</div>
</td>
Modified: ofbiz/trunk/framework/shark/webapp/shark/process/processList.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/shark/webapp/shark/process/processList.ftl?view=diff&rev=498425&r1=498424&r2=498425
==============================================================================
--- ofbiz/trunk/framework/shark/webapp/shark/process/processList.ftl (original)
+++ ofbiz/trunk/framework/shark/webapp/shark/process/processList.ftl Sun Jan 21 10:48:58 2007
@@ -56,6 +56,8 @@
</tr>
</#list>
</table>
+ <td> </td>
+ <a href="<@o...@ofbizUrl>" class="buttontext">Delete All Finished</a>
<#else>
<div class="tabletext">No loaded processes.</div>
</#if>