Converted the remaining framework bsh scripts to groovy
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@688450 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
+19
-19
@@ -32,30 +32,30 @@ import org.ofbiz.entity.model.ModelViewEntity.ModelAlias;
|
||||
import javolution.util.FastList;
|
||||
import javolution.util.FastMap;
|
||||
|
||||
String starSchemaName = parameters.get("starSchemaName");
|
||||
starSchemaName = parameters.starSchemaName;
|
||||
|
||||
List starSchemaFields = FastList.newInstance();
|
||||
if (UtilValidate.isNotEmpty(starSchemaName)) {
|
||||
ModelReader reader = delegator.getModelReader();
|
||||
ModelEntity starSchema = reader.getModelEntity(starSchemaName);
|
||||
if (UtilValidate.isNotEmpty(starSchema)) {
|
||||
Iterator fieldsIt = starSchema.getAliasesIterator();
|
||||
while (fieldsIt != null && fieldsIt.hasNext()) {
|
||||
ModelAlias field = (ModelAlias)fieldsIt.next();
|
||||
Map fieldMap = FastMap.newInstance();
|
||||
fieldMap.put("name", field.getName());
|
||||
String description = field.getDescription();
|
||||
if (UtilValidate.isEmpty(description)) {
|
||||
ModelEntity aliasedEntity = starSchema.getAliasedEntity(field.getEntityAlias(), reader);
|
||||
if (aliasedEntity != null) {
|
||||
ModelField aliasedField = starSchema.getAliasedField(aliasedEntity, field.getField(), reader);
|
||||
starSchemaFields = FastList.newInstance();
|
||||
if (starSchemaName) {
|
||||
reader = delegator.getModelReader();
|
||||
starSchema = reader.getModelEntity(starSchemaName);
|
||||
if (starSchema) {
|
||||
fieldsIt = starSchema.getAliasesIterator();
|
||||
while (fieldsIt.hasNext()) {
|
||||
field = fieldsIt.next();
|
||||
fieldMap = FastMap.newInstance();
|
||||
fieldMap.name = field.getName();
|
||||
description = field.getDescription();
|
||||
if (!description) {
|
||||
aliasedEntity = starSchema.getAliasedEntity(field.getEntityAlias(), reader);
|
||||
if (aliasedEntity) {
|
||||
aliasedField = starSchema.getAliasedField(aliasedEntity, field.getField(), reader);
|
||||
description = aliasedField.getDescription();
|
||||
}
|
||||
}
|
||||
fieldMap.put("description", description);
|
||||
fieldMap.description = description;
|
||||
starSchemaFields.add(fieldMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
context.put("starSchemaName", starSchemaName);
|
||||
context.put("starSchemaFields", starSchemaFields);
|
||||
context.starSchemaName = starSchemaName;
|
||||
context.starSchemaFields = starSchemaFields;
|
||||
+11
-11
@@ -29,24 +29,24 @@ import org.ofbiz.entity.model.ModelViewEntity;
|
||||
import javolution.util.FastList;
|
||||
import javolution.util.FastMap;
|
||||
|
||||
ModelReader reader = delegator.getModelReader();
|
||||
Collection ec = reader.getEntityNames();
|
||||
TreeSet entities = new TreeSet(ec);
|
||||
Iterator entitiesIt = entities.iterator();
|
||||
reader = delegator.getModelReader();
|
||||
ec = reader.getEntityNames();
|
||||
entities = new TreeSet(ec);
|
||||
entitiesIt = entities.iterator();
|
||||
|
||||
List starSchemas = FastList.newInstance();
|
||||
|
||||
while (entitiesIt != null && entitiesIt.hasNext()) {
|
||||
ModelEntity entity = reader.getModelEntity((String)entitiesIt.next());
|
||||
String packageName = entity.getPackageName();
|
||||
while (entitiesIt.hasNext()) {
|
||||
entity = reader.getModelEntity(entitiesIt.next());
|
||||
packageName = entity.getPackageName();
|
||||
if (!packageName.contains("starschema")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Map entityMap = FastMap.newInstance();
|
||||
entityMap.put("name", entity.getEntityName());
|
||||
entityMap.put("title", entity.getTitle());
|
||||
entityMap = FastMap.newInstance();
|
||||
entityMap.name = entity.getEntityName();
|
||||
entityMap.title = entity.getTitle();
|
||||
|
||||
starSchemas.add(entityMap);
|
||||
}
|
||||
context.put("starSchemas", starSchemas);
|
||||
context.starSchemas = starSchemas;
|
||||
+5
-6
@@ -32,13 +32,12 @@ import org.ofbiz.entity.model.ModelViewEntity.ModelAlias;
|
||||
import javolution.util.FastList;
|
||||
import javolution.util.FastMap;
|
||||
|
||||
String starSchemaName = parameters.get("starSchemaName");
|
||||
String[] selectedFields = request.getParameterValues("selectedField");
|
||||
context.put("columnNames", selectedFields);
|
||||
starSchemaName = parameters.starSchemaName;
|
||||
selectedFields = parameters.selectedField as Set;
|
||||
context.columnNames = selectedFields;
|
||||
|
||||
List conditionList = null;
|
||||
EntityConditionList condition = null;
|
||||
selectFields = UtilMisc.toSetArray(selectedFields);
|
||||
List orderByFields = null;
|
||||
EntityFindOptions findOptions = null;
|
||||
|
||||
@@ -52,6 +51,6 @@ orderByFields = null;
|
||||
findOptions = new EntityFindOptions();
|
||||
findOptions.setDistinct(false);
|
||||
|
||||
records = delegator.findList(starSchemaName, condition, selectFields, orderByFields, findOptions, false);
|
||||
records = delegator.findList(starSchemaName, condition, selectedFields, orderByFields, findOptions, false);
|
||||
|
||||
context.put("records", records);
|
||||
context.records = records;
|
||||
@@ -24,7 +24,7 @@ under the License.
|
||||
<form name="selectStarSchema" title="" type="single" target="ReportBuilderSelectStarSchemaFields"
|
||||
header-row-style="header-row" default-table-style="basic-table">
|
||||
<actions>
|
||||
<script location="component://bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemas.bsh"/>
|
||||
<script location="component://bi/webapp/bi/WEB-INF/actions/reportbuilder/GetStarSchemas.groovy"/>
|
||||
</actions>
|
||||
<field name="starSchemaName" title="${uiLabelMap.BusinessIntelligenceReportBuilderSelectTheStarSchemaReport}">
|
||||
<drop-down allow-empty="false">
|
||||
|
||||
@@ -71,7 +71,7 @@ under the License.
|
||||
<actions>
|
||||
<set field="titleProperty" value="BusinessIntelligenceReportBuilderSelectStarSchemaFields"/>
|
||||
<set field="headerItem" value="reportbuilder"/>
|
||||
<script location="component://bi/webapp/bi/WEB-INF/actions/reportbuilder/getStarSchemaFields.bsh"/>
|
||||
<script location="component://bi/webapp/bi/WEB-INF/actions/reportbuilder/GetStarSchemaFields.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
@@ -102,7 +102,7 @@ under the License.
|
||||
<actions>
|
||||
<set field="titleProperty" value="BusinessIntelligenceReportBuilderRenderStarSchemaReport"/>
|
||||
<set field="headerItem" value="reportbuilder"/>
|
||||
<script location="component://bi/webapp/bi/WEB-INF/actions/reportbuilder/runStarSchemaQuery.bsh"/>
|
||||
<script location="component://bi/webapp/bi/WEB-INF/actions/reportbuilder/RunStarSchemaQuery.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
import org.ofbiz.service.ServiceUtil;
|
||||
import org.ofbiz.base.util.Debug;
|
||||
|
||||
Debug.logInfo("-=-=-=- TEST BSH SERVICE -=-=-=-", "");
|
||||
Debug.logInfo("-=-=-=- TEST GROOVY SERVICE -=-=-=-", "");
|
||||
result = ServiceUtil.returnSuccess();
|
||||
if (context.message != null) {
|
||||
if (context.message) {
|
||||
message = context.message;
|
||||
result.successMessage = "Got message [" + message + "] and finished fine";
|
||||
result.successMessage = "Got message [$message] and finished fine";
|
||||
result.result = message;
|
||||
Debug.logInfo("----- Message is: " + message + " -----", "");
|
||||
Debug.logInfo("----- Message is: $message -----", "");
|
||||
} else {
|
||||
result.successMessage = "Got no message but finished fine anyway";
|
||||
result.result = "[no message received]";
|
||||
|
||||
+5
-5
@@ -28,14 +28,14 @@ import org.ofbiz.base.util.StringUtil;
|
||||
import org.ofbiz.base.util.UtilValidate;
|
||||
|
||||
andExprs = FastList.newInstance();
|
||||
fieldValue = request.getParameter(fieldName);
|
||||
if (UtilValidate.isNotEmpty(fieldValue)) {
|
||||
fieldValue = parameters[fieldName];
|
||||
if (fieldValue) {
|
||||
andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue(fieldName)),
|
||||
EntityOperator.LIKE, "%" + fieldValue.toUpperCase() + "%"));
|
||||
}
|
||||
|
||||
if (andExprs.size() > 0) {
|
||||
if (andExprs) {
|
||||
entityConditionList = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
|
||||
List autocompleteOptions = delegator.findList(entityName, entityConditionList, new TreeSet(StringUtil.toList(selectFields)), StringUtil.toList(sortByFields), null, false);
|
||||
context.put("autocompleteOptions", autocompleteOptions);
|
||||
autocompleteOptions = delegator.findList(entityName, entityConditionList, StringUtil.toList(selectFields) as Set, StringUtil.toList(sortByFields), null, false);
|
||||
context.autocompleteOptions = autocompleteOptions;
|
||||
}
|
||||
@@ -100,7 +100,7 @@ under the License.
|
||||
<set field="fieldName" from-field="parameters.fieldName"/>
|
||||
<set field="selectFields" from-field="parameters.selectFields"/>
|
||||
<set field="sortByFields" from-field="parameters.sortByFields"/>
|
||||
<script location="component://common/webcommon/WEB-INF/actions/includes/findAutocompleteOptions.bsh"/>
|
||||
<script location="component://common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy"/>
|
||||
-->
|
||||
</actions>
|
||||
<widgets>
|
||||
|
||||
+16
-17
@@ -22,41 +22,40 @@ import org.ofbiz.webtools.artifactinfo.*;
|
||||
import org.ofbiz.base.util.*;
|
||||
import javolution.util.FastList;
|
||||
|
||||
name = parameters.get("name");
|
||||
location = parameters.get("location");
|
||||
type = parameters.get("type");
|
||||
uniqueId = parameters.get("uniqueId");
|
||||
name = parameters.name;
|
||||
location = parameters.location;
|
||||
type = parameters.type;
|
||||
uniqueId = parameters.uniqueId;
|
||||
|
||||
aif = ArtifactInfoFactory.getArtifactInfoFactory(delegator.getDelegatorName());
|
||||
context.put("aif", aif);
|
||||
|
||||
context.aif = aif;
|
||||
artifactInfo = null;
|
||||
if ("search".equals(parameters.get("findType"))) {
|
||||
if ("search".equals(parameters.findType)) {
|
||||
artifactInfoSet = aif.getAllArtifactInfosByNamePartial(name, type);
|
||||
if (artifactInfoSet.size() == 1) {
|
||||
artifactInfo = artifactInfoSet.iterator().next();
|
||||
context.put("artifactInfo", artifactInfo);
|
||||
artifactInfo = artifactInfoSet[0];
|
||||
context.artifactInfo = artifactInfo;
|
||||
} else {
|
||||
context.put("artifactInfoSet", new TreeSet(artifactInfoSet));
|
||||
context.artifactInfoSet = new TreeSet(artifactInfoSet);
|
||||
}
|
||||
} else {
|
||||
if (UtilValidate.isNotEmpty(name)) {
|
||||
if (name) {
|
||||
artifactInfo = aif.getArtifactInfoByNameAndType(name, location, type);
|
||||
context.put("artifactInfo", artifactInfo);
|
||||
} else if (UtilValidate.isNotEmpty(uniqueId)) {
|
||||
context.artifactInfo = artifactInfo;
|
||||
} else if (uniqueId) {
|
||||
artifactInfo = aif.getArtifactInfoByUniqueIdAndType(uniqueId, type);
|
||||
context.put("artifactInfo", artifactInfo);
|
||||
context.artifactInfo = artifactInfo;
|
||||
}
|
||||
}
|
||||
|
||||
if (artifactInfo != null) {
|
||||
if (artifactInfo) {
|
||||
// add to the recently viewed list
|
||||
recentArtifactInfoList = session.getAttribute("recentArtifactInfoList");
|
||||
if (recentArtifactInfoList == null) {
|
||||
if (!recentArtifactInfoLis) {
|
||||
recentArtifactInfoList = FastList.newInstance();
|
||||
session.setAttribute("recentArtifactInfoList", recentArtifactInfoList);
|
||||
}
|
||||
if (recentArtifactInfoList.size() > 0 && recentArtifactInfoList.get(0).equals(artifactInfo)) {
|
||||
if (recentArtifactInfoList && recentArtifactInfoList.get(0).equals(artifactInfo)) {
|
||||
// hmmm, I guess do nothing if it's already there
|
||||
} else {
|
||||
recentArtifactInfoList.add(0, artifactInfo);
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import org.ofbiz.base.util.cache.UtilCache;
|
||||
import org.ofbiz.base.util.cache.CacheLine;
|
||||
import org.ofbiz.base.util.UtilFormatOut;
|
||||
import org.ofbiz.security.Security;
|
||||
|
||||
cacheName = parameters.UTIL_CACHE_NAME;
|
||||
context.cacheName = cacheName;
|
||||
|
||||
if (cacheName) {
|
||||
utilCache = UtilCache.findCache(cacheName);
|
||||
if (utilCache) {
|
||||
cache = [:];
|
||||
|
||||
cache.cacheName = utilCache.getName();
|
||||
cache.cacheSize = UtilFormatOut.formatQuantity(utilCache.size());
|
||||
cache.hitCount = UtilFormatOut.formatQuantity(utilCache.getHitCount());
|
||||
cache.missCountTot = UtilFormatOut.formatQuantity(utilCache.getMissCountTotal());
|
||||
cache.missCountNotFound = UtilFormatOut.formatQuantity(utilCache.getMissCountNotFound());
|
||||
cache.missCountExpired = UtilFormatOut.formatQuantity(utilCache.getMissCountExpired());
|
||||
cache.missCountSoftRef = UtilFormatOut.formatQuantity(utilCache.getMissCountSoftRef());
|
||||
cache.removeHitCount = UtilFormatOut.formatQuantity(utilCache.getRemoveHitCount());
|
||||
cache.removeMissCount = UtilFormatOut.formatQuantity(utilCache.getRemoveMissCount());
|
||||
cache.maxSize = UtilFormatOut.formatQuantity(utilCache.getMaxSize());
|
||||
cache.expireTime = UtilFormatOut.formatQuantity(utilCache.getExpireTime());
|
||||
cache.useSoftReference = utilCache.getUseSoftReference().toString();
|
||||
cache.useFileSystemStore = utilCache.getUseFileSystemStore().toString();
|
||||
|
||||
exp = utilCache.getExpireTime();
|
||||
hrs = Math.floor(exp / (60 * 60 * 1000));
|
||||
exp = exp % (60 * 60 * 1000);
|
||||
mins = Math.floor(exp / (60 * 1000));
|
||||
exp = exp % (60 * 1000);
|
||||
secs = exp / 1000;
|
||||
cache.hrs = hrs;
|
||||
cache.mins = mins;
|
||||
cache.secs = UtilFormatOut.formatPrice(secs);
|
||||
|
||||
context.cache = cache;
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import org.ofbiz.base.util.cache.UtilCache;
|
||||
import org.ofbiz.base.util.UtilFormatOut;
|
||||
import org.ofbiz.security.Security;
|
||||
|
||||
context.hasUtilCacheEdit = security.hasEntityPermission("UTIL_CACHE", "_EDIT", session);
|
||||
|
||||
rt = Runtime.getRuntime();
|
||||
context.memory = UtilFormatOut.formatQuantity(rt.totalMemory());
|
||||
context.freeMemory = UtilFormatOut.formatQuantity(rt.freeMemory());
|
||||
context.usedMemory = UtilFormatOut.formatQuantity((rt.totalMemory() - rt.freeMemory()));
|
||||
context.maxMemory = UtilFormatOut.formatQuantity(rt.maxMemory());
|
||||
|
||||
cacheList = [];
|
||||
names = new TreeSet(UtilCache.utilCacheTable.keySet());
|
||||
names.each { cacheName ->
|
||||
utilCache = UtilCache.findCache(cacheName);
|
||||
cache = [:];
|
||||
|
||||
cache.cacheName = utilCache.getName();
|
||||
cache.cacheSize = UtilFormatOut.formatQuantity(utilCache.size());
|
||||
cache.hitCount = UtilFormatOut.formatQuantity(utilCache.getHitCount());
|
||||
cache.missCountTot = UtilFormatOut.formatQuantity(utilCache.getMissCountTotal());
|
||||
cache.missCountNotFound = UtilFormatOut.formatQuantity(utilCache.getMissCountNotFound());
|
||||
cache.missCountExpired = UtilFormatOut.formatQuantity(utilCache.getMissCountExpired());
|
||||
cache.missCountSoftRef = UtilFormatOut.formatQuantity(utilCache.getMissCountSoftRef());
|
||||
cache.removeHitCount = UtilFormatOut.formatQuantity(utilCache.getRemoveHitCount());
|
||||
cache.removeMissCount = UtilFormatOut.formatQuantity(utilCache.getRemoveMissCount());
|
||||
cache.maxSize = UtilFormatOut.formatQuantity(utilCache.getMaxSize());
|
||||
cache.expireTime = UtilFormatOut.formatQuantity(utilCache.getExpireTime());
|
||||
cache.useSoftReference = utilCache.getUseSoftReference().toString();
|
||||
cache.useFileSystemStore = utilCache.getUseFileSystemStore().toString();
|
||||
|
||||
cacheList.add(cache);
|
||||
}
|
||||
context.cacheList = cacheList;
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import org.ofbiz.base.util.cache.UtilCache;
|
||||
import org.ofbiz.base.util.cache.CacheLine;
|
||||
import org.ofbiz.base.util.UtilFormatOut;
|
||||
import org.ofbiz.security.Security;
|
||||
|
||||
context.hasUtilCacheEdit = security.hasEntityPermission("UTIL_CACHE", "_EDIT", session);
|
||||
|
||||
cacheName = parameters.UTIL_CACHE_NAME;
|
||||
context.cacheName = cacheName;
|
||||
context.now = (new Date()).toString();
|
||||
|
||||
totalSize = 0;
|
||||
|
||||
cacheElementsList = [];
|
||||
if (cacheName) {
|
||||
utilCache = UtilCache.findCache(cacheName);
|
||||
if (utilCache) {
|
||||
int keyNum = 0;
|
||||
utilCache.cacheLineTable.keySet().each { key ->
|
||||
cacheElement = [:];
|
||||
line = utilCache.cacheLineTable.get(key);
|
||||
expireTime = "";
|
||||
if (line?.loadTime > 0) {
|
||||
expireTime = (new Date(line.loadTime + utilCache.getExpireTime())).toString();
|
||||
}
|
||||
lineSize = line.getSizeInBytes();
|
||||
totalSize += lineSize;
|
||||
|
||||
cacheElement.elementKey = key;
|
||||
cacheElement.expireTime = expireTime;
|
||||
cacheElement.lineSize = UtilFormatOut.formatQuantity(lineSize);
|
||||
cacheElement.keyNum = keyNum;
|
||||
|
||||
cacheElementsList.add(cacheElement);
|
||||
|
||||
keyNum++;
|
||||
}
|
||||
}
|
||||
}
|
||||
context.totalSize = UtilFormatOut.formatQuantity(totalSize);
|
||||
context.cacheElementsList = cacheElementsList;
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import org.ofbiz.base.util.cache.UtilCache;
|
||||
import org.ofbiz.base.util.cache.CacheLine;
|
||||
import org.ofbiz.base.util.UtilFormatOut;
|
||||
import org.ofbiz.security.Security;
|
||||
|
||||
String cacheName = request.getParameter("UTIL_CACHE_NAME");
|
||||
context.put("cacheName", cacheName);
|
||||
|
||||
if (cacheName != null) {
|
||||
UtilCache utilCache = UtilCache.findCache(cacheName);
|
||||
if (utilCache != null) {
|
||||
Map cache = new HashMap();
|
||||
|
||||
cache.put("cacheName", utilCache.getName());
|
||||
cache.put("cacheSize", UtilFormatOut.formatQuantity(utilCache.size()));
|
||||
cache.put("hitCount", UtilFormatOut.formatQuantity(utilCache.getHitCount()));
|
||||
cache.put("missCountTot", UtilFormatOut.formatQuantity(utilCache.getMissCountTotal()));
|
||||
cache.put("missCountNotFound", UtilFormatOut.formatQuantity(utilCache.getMissCountNotFound()));
|
||||
cache.put("missCountExpired", UtilFormatOut.formatQuantity(utilCache.getMissCountExpired()));
|
||||
cache.put("missCountSoftRef", UtilFormatOut.formatQuantity(utilCache.getMissCountSoftRef()));
|
||||
cache.put("removeHitCount", UtilFormatOut.formatQuantity(utilCache.getRemoveHitCount()));
|
||||
cache.put("removeMissCount", UtilFormatOut.formatQuantity(utilCache.getRemoveMissCount()));
|
||||
cache.put("maxSize", UtilFormatOut.formatQuantity(utilCache.getMaxSize()));
|
||||
cache.put("expireTime", UtilFormatOut.formatQuantity(utilCache.getExpireTime()));
|
||||
cache.put("useSoftReference", (new Boolean(utilCache.getUseSoftReference())).toString());
|
||||
cache.put("useFileSystemStore", (new Boolean(utilCache.getUseFileSystemStore())).toString());
|
||||
|
||||
long exp = utilCache.getExpireTime();
|
||||
long hrs = exp/(60*60*1000);
|
||||
exp = exp%(60*60*1000);
|
||||
long mins = exp/(60*1000);
|
||||
exp = exp%(60*1000);
|
||||
double secs = (double)exp/(1000.0);
|
||||
cache.put("hrs", UtilFormatOut.formatQuantity(hrs));
|
||||
cache.put("mins", UtilFormatOut.formatQuantity(mins));
|
||||
cache.put("secs", UtilFormatOut.formatPrice(secs));
|
||||
|
||||
context.put("cache", cache);
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import org.ofbiz.base.util.cache.UtilCache;
|
||||
import org.ofbiz.base.util.UtilFormatOut;
|
||||
import org.ofbiz.security.Security;
|
||||
|
||||
security = request.getAttribute("security");
|
||||
|
||||
if(security.hasEntityPermission("UTIL_CACHE", "_EDIT", session)) {
|
||||
context.put("hasUtilCacheEdit", Boolean.TRUE);
|
||||
}
|
||||
else {
|
||||
context.put("hasUtilCacheEdit", Boolean.FALSE);
|
||||
}
|
||||
|
||||
Runtime rt = Runtime.getRuntime();
|
||||
context.put("memory", UtilFormatOut.formatQuantity(rt.totalMemory()));
|
||||
context.put("freeMemory", UtilFormatOut.formatQuantity(rt.freeMemory()));
|
||||
context.put("usedMemory", UtilFormatOut.formatQuantity((rt.totalMemory() - rt.freeMemory())));
|
||||
context.put("maxMemory", UtilFormatOut.formatQuantity(rt.maxMemory()));
|
||||
|
||||
List cacheList = new ArrayList();
|
||||
TreeSet names = new TreeSet(UtilCache.utilCacheTable.keySet());
|
||||
Iterator nameIter = names.iterator();
|
||||
if(nameIter != null && nameIter.hasNext()) {
|
||||
while(nameIter.hasNext()) {
|
||||
String cacheName = (String)nameIter.next();
|
||||
UtilCache utilCache = UtilCache.findCache(cacheName);
|
||||
Map cache = new HashMap();
|
||||
|
||||
cache.put("cacheName", utilCache.getName());
|
||||
cache.put("cacheSize", UtilFormatOut.formatQuantity(utilCache.size()));
|
||||
cache.put("hitCount", UtilFormatOut.formatQuantity(utilCache.getHitCount()));
|
||||
cache.put("missCountTot", UtilFormatOut.formatQuantity(utilCache.getMissCountTotal()));
|
||||
cache.put("missCountNotFound", UtilFormatOut.formatQuantity(utilCache.getMissCountNotFound()));
|
||||
cache.put("missCountExpired", UtilFormatOut.formatQuantity(utilCache.getMissCountExpired()));
|
||||
cache.put("missCountSoftRef", UtilFormatOut.formatQuantity(utilCache.getMissCountSoftRef()));
|
||||
cache.put("removeHitCount", UtilFormatOut.formatQuantity(utilCache.getRemoveHitCount()));
|
||||
cache.put("removeMissCount", UtilFormatOut.formatQuantity(utilCache.getRemoveMissCount()));
|
||||
cache.put("maxSize", UtilFormatOut.formatQuantity(utilCache.getMaxSize()));
|
||||
cache.put("expireTime", UtilFormatOut.formatQuantity(utilCache.getExpireTime()));
|
||||
cache.put("useSoftReference", (new Boolean(utilCache.getUseSoftReference())).toString());
|
||||
cache.put("useFileSystemStore", (new Boolean(utilCache.getUseFileSystemStore())).toString());
|
||||
|
||||
cacheList.add(cache);
|
||||
}
|
||||
}
|
||||
context.put("cacheList", cacheList);
|
||||
-70
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import org.ofbiz.base.util.cache.UtilCache;
|
||||
import org.ofbiz.base.util.cache.CacheLine;
|
||||
import org.ofbiz.base.util.UtilFormatOut;
|
||||
import org.ofbiz.security.Security;
|
||||
|
||||
security = request.getAttribute("security");
|
||||
|
||||
if(security.hasEntityPermission("UTIL_CACHE", "_EDIT", session)) {
|
||||
context.put("hasUtilCacheEdit", Boolean.TRUE);
|
||||
}
|
||||
else {
|
||||
context.put("hasUtilCacheEdit", Boolean.FALSE);
|
||||
}
|
||||
|
||||
String cacheName = request.getParameter("UTIL_CACHE_NAME");
|
||||
context.put("cacheName", cacheName);
|
||||
context.put("now", (new Date()).toString());
|
||||
|
||||
long totalSize = 0;
|
||||
|
||||
List cacheElementsList = new ArrayList();
|
||||
if (cacheName != null) {
|
||||
UtilCache utilCache = UtilCache.findCache(cacheName);
|
||||
if (utilCache != null) {
|
||||
Iterator iter = utilCache.cacheLineTable.keySet().iterator();
|
||||
if(iter != null && iter.hasNext()) {
|
||||
int keyNum = 0;
|
||||
while(iter.hasNext()) {
|
||||
Map cacheElement = new HashMap();
|
||||
Object key = iter.next();
|
||||
CacheLine line = (CacheLine) utilCache.cacheLineTable.get(key);
|
||||
String expireTime = "";
|
||||
if(line != null && line.loadTime > 0) {
|
||||
expireTime = (new Date(line.loadTime + utilCache.getExpireTime())).toString();
|
||||
}
|
||||
long lineSize = line.getSizeInBytes();
|
||||
totalSize += lineSize;
|
||||
|
||||
cacheElement.put("elementKey", key);
|
||||
cacheElement.put("expireTime", expireTime);
|
||||
cacheElement.put("lineSize", UtilFormatOut.formatQuantity(lineSize));
|
||||
cacheElement.put("keyNum", keyNum);
|
||||
|
||||
cacheElementsList.add(cacheElement);
|
||||
|
||||
keyNum++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
context.put("totalSize", UtilFormatOut.formatQuantity(totalSize));
|
||||
context.put("cacheElementsList", cacheElementsList);
|
||||
@@ -1,144 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import org.ofbiz.entity.GenericDelegator;
|
||||
import org.ofbiz.security.Security;
|
||||
import org.ofbiz.entity.jdbc.DatabaseUtil;
|
||||
import org.ofbiz.entity.model.ModelEntity;
|
||||
|
||||
delegator = request.getAttribute("delegator");
|
||||
security = request.getAttribute("security");
|
||||
|
||||
String controlPath = (String)request.getAttribute("_CONTROL_PATH_");
|
||||
|
||||
if (security.hasPermission("ENTITY_MAINT", session)) {
|
||||
boolean addMissing = "true".equals(request.getParameter("addMissing"));
|
||||
boolean checkFkIdx = "true".equals(request.getParameter("checkFkIdx"));
|
||||
boolean checkFks = "true".equals(request.getParameter("checkFks"));
|
||||
boolean checkPks = "true".equals(request.getParameter("checkPks"));
|
||||
boolean repair = "true".equals(request.getParameter("repair"));
|
||||
String option = request.getParameter("option");
|
||||
String groupName = request.getParameter("groupName");
|
||||
String entityName = request.getParameter("entityName");
|
||||
|
||||
Iterator miter = null;
|
||||
if (groupName != null && groupName.length() > 0) {
|
||||
String helperName = delegator.getGroupHelperName(groupName);
|
||||
|
||||
List messages = new LinkedList();
|
||||
//GenericHelper helper = GenericHelperFactory.getHelper(helperName);
|
||||
DatabaseUtil dbUtil = new DatabaseUtil(helperName);
|
||||
Map modelEntities = delegator.getModelEntityMapByGroup(groupName);
|
||||
Set modelEntityNames = new TreeSet(modelEntities.keySet());
|
||||
|
||||
if ("checkupdatetables".equals(option)) {
|
||||
List fieldsToRepair = null;
|
||||
if (repair) {
|
||||
fieldsToRepair = new ArrayList();
|
||||
}
|
||||
dbUtil.checkDb(modelEntities, fieldsToRepair, messages, checkPks, checkFks, checkFkIdx, addMissing);
|
||||
if (fieldsToRepair != null && fieldsToRepair.size() > 0) {
|
||||
dbUtil.repairColumnSizeChanges(modelEntities, fieldsToRepair, messages);
|
||||
}
|
||||
} else if ("removetables".equals(option)) {
|
||||
Iterator modelEntityNameIter = modelEntityNames.iterator();
|
||||
while (modelEntityNameIter.hasNext()) {
|
||||
String modelEntityName = (String) modelEntityNameIter.next();
|
||||
ModelEntity modelEntity = (ModelEntity) modelEntities.get(modelEntityName);
|
||||
dbUtil.deleteTable(modelEntity, messages);
|
||||
}
|
||||
} else if ("removetable".equals(option)) {
|
||||
ModelEntity modelEntity = (ModelEntity) modelEntities.get(entityName);
|
||||
dbUtil.deleteTable(modelEntity, messages);
|
||||
} else if ("removepks".equals(option)) {
|
||||
Iterator modelEntityNameIter = modelEntityNames.iterator();
|
||||
while (modelEntityNameIter.hasNext()) {
|
||||
String modelEntityName = (String) modelEntityNameIter.next();
|
||||
ModelEntity modelEntity = (ModelEntity) modelEntities.get(modelEntityName);
|
||||
dbUtil.deletePrimaryKey(modelEntity, messages);
|
||||
}
|
||||
} else if ("removepk".equals(option)) {
|
||||
ModelEntity modelEntity = (ModelEntity) modelEntities.get(entityName);
|
||||
dbUtil.deletePrimaryKey(modelEntity, messages);
|
||||
} else if ("createpks".equals(option)) {
|
||||
Iterator modelEntityNameIter = modelEntityNames.iterator();
|
||||
while (modelEntityNameIter.hasNext()) {
|
||||
String modelEntityName = (String) modelEntityNameIter.next();
|
||||
ModelEntity modelEntity = (ModelEntity) modelEntities.get(modelEntityName);
|
||||
dbUtil.createPrimaryKey(modelEntity, messages);
|
||||
}
|
||||
} else if ("createpk".equals(option)) {
|
||||
ModelEntity modelEntity = (ModelEntity) modelEntities.get(entityName);
|
||||
dbUtil.createPrimaryKey(modelEntity, messages);
|
||||
} else if ("createfkidxs".equals(option)) {
|
||||
Iterator modelEntityNameIter = modelEntityNames.iterator();
|
||||
while (modelEntityNameIter.hasNext()) {
|
||||
String modelEntityName = (String) modelEntityNameIter.next();
|
||||
ModelEntity modelEntity = (ModelEntity) modelEntities.get(modelEntityName);
|
||||
dbUtil.createForeignKeyIndices(modelEntity, messages);
|
||||
}
|
||||
} else if ("removefkidxs".equals(option)) {
|
||||
Iterator modelEntityNameIter = modelEntityNames.iterator();
|
||||
while (modelEntityNameIter.hasNext()) {
|
||||
String modelEntityName = (String) modelEntityNameIter.next();
|
||||
ModelEntity modelEntity = (ModelEntity) modelEntities.get(modelEntityName);
|
||||
dbUtil.deleteForeignKeyIndices(modelEntity, messages);
|
||||
}
|
||||
} else if ("createfks".equals(option)) {
|
||||
Iterator modelEntityNameIter = modelEntityNames.iterator();
|
||||
while (modelEntityNameIter.hasNext()) {
|
||||
String modelEntityName = (String) modelEntityNameIter.next();
|
||||
ModelEntity modelEntity = (ModelEntity) modelEntities.get(modelEntityName);
|
||||
dbUtil.createForeignKeys(modelEntity, modelEntities, messages);
|
||||
}
|
||||
} else if ("removefks".equals(option)) {
|
||||
Iterator modelEntityNameIter = modelEntityNames.iterator();
|
||||
while (modelEntityNameIter.hasNext()) {
|
||||
String modelEntityName = (String) modelEntityNameIter.next();
|
||||
ModelEntity modelEntity = (ModelEntity) modelEntities.get(modelEntityName);
|
||||
dbUtil.deleteForeignKeys(modelEntity, modelEntities, messages);
|
||||
}
|
||||
} else if ("createidx".equals(option)) {
|
||||
Iterator modelEntityNameIter = modelEntityNames.iterator();
|
||||
while (modelEntityNameIter.hasNext()) {
|
||||
String modelEntityName = (String) modelEntityNameIter.next();
|
||||
ModelEntity modelEntity = (ModelEntity) modelEntities.get(modelEntityName);
|
||||
dbUtil.createDeclaredIndices(modelEntity, messages);
|
||||
}
|
||||
} else if ("removeidx".equals(option)) {
|
||||
Iterator modelEntityNameIter = modelEntityNames.iterator();
|
||||
while (modelEntityNameIter.hasNext()) {
|
||||
String modelEntityName = (String) modelEntityNameIter.next();
|
||||
ModelEntity modelEntity = (ModelEntity) modelEntities.get(modelEntityName);
|
||||
dbUtil.deleteDeclaredIndices(modelEntity, messages);
|
||||
}
|
||||
} else if ("updateCharsetCollate".equals(option)) {
|
||||
Iterator modelEntityNameIter = modelEntityNames.iterator();
|
||||
while (modelEntityNameIter.hasNext()) {
|
||||
String modelEntityName = (String) modelEntityNameIter.next();
|
||||
ModelEntity modelEntity = (ModelEntity) modelEntities.get(modelEntityName);
|
||||
dbUtil.updateCharacterSetAndCollation(modelEntity, messages);
|
||||
}
|
||||
}
|
||||
miter = messages.iterator();
|
||||
context.put("miters", miter);
|
||||
}
|
||||
context.put("encodeURLCheckDb", response.encodeURL(controlPath + "/view/checkdb"));
|
||||
context.put("groupName", (groupName != null) ? groupName : "org.ofbiz");
|
||||
context.put("entityName", (entityName != null) ? entityName : "");
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import org.ofbiz.entity.GenericDelegator;
|
||||
import org.ofbiz.security.Security;
|
||||
import org.ofbiz.entity.jdbc.DatabaseUtil;
|
||||
import org.ofbiz.entity.model.ModelEntity;
|
||||
|
||||
controlPath = parameters._CONTROL_PATH_;
|
||||
|
||||
if (security.hasPermission("ENTITY_MAINT", session)) {
|
||||
addMissing = "true".equals(parameters.addMissing);
|
||||
checkFkIdx = "true".equals(parameters.checkFkIdx);
|
||||
checkFks = "true".equals(parameters.checkFks);
|
||||
checkPks = "true".equals(parameters.checkPks);
|
||||
repair = "true".equals(parameters.repair);
|
||||
option = parameters.option;
|
||||
groupName = parameters.groupName;
|
||||
entityName = parameters.entityName;
|
||||
|
||||
if (groupName) {
|
||||
helperName = delegator.getGroupHelperName(groupName);
|
||||
|
||||
messages = [];
|
||||
//helper = GenericHelperFactory.getHelper(helperName);
|
||||
dbUtil = new DatabaseUtil(helperName);
|
||||
modelEntities = delegator.getModelEntityMapByGroup(groupName);
|
||||
modelEntityNames = new TreeSet(modelEntities.keySet());
|
||||
|
||||
if ("checkupdatetables".equals(option)) {
|
||||
fieldsToRepair = null;
|
||||
if (repair) {
|
||||
fieldsToRepair = [];
|
||||
}
|
||||
dbUtil.checkDb(modelEntities, fieldsToRepair, messages, checkPks, checkFks, checkFkIdx, addMissing);
|
||||
if (fieldsToRepair) {
|
||||
dbUtil.repairColumnSizeChanges(modelEntities, fieldsToRepair, messages);
|
||||
}
|
||||
} else if ("removetables".equals(option)) {
|
||||
modelEntityNames.each { modelEntityName ->
|
||||
modelEntity = modelEntities[modelEntityName];
|
||||
dbUtil.deleteTable(modelEntity, messages);
|
||||
}
|
||||
} else if ("removetable".equals(option)) {
|
||||
modelEntity = modelEntities[entityName];
|
||||
dbUtil.deleteTable(modelEntity, messages);
|
||||
} else if ("removepks".equals(option)) {
|
||||
modelEntityNames.each { modelEntityName ->
|
||||
modelEntity = modelEntities[modelEntityName];
|
||||
dbUtil.deletePrimaryKey(modelEntity, messages);
|
||||
}
|
||||
} else if ("removepk".equals(option)) {
|
||||
modelEntity = modelEntities[entityName];
|
||||
dbUtil.deletePrimaryKey(modelEntity, messages);
|
||||
} else if ("createpks".equals(option)) {
|
||||
modelEntityNames.each { modelEntityName ->
|
||||
modelEntity = modelEntities[modelEntityName];
|
||||
dbUtil.createPrimaryKey(modelEntity, messages);
|
||||
}
|
||||
} else if ("createpk".equals(option)) {
|
||||
modelEntity = modelEntities[entityName];
|
||||
dbUtil.createPrimaryKey(modelEntity, messages);
|
||||
} else if ("createfkidxs".equals(option)) {
|
||||
modelEntityNames.each { modelEntityName ->
|
||||
modelEntity = modelEntities[modelEntityName];
|
||||
dbUtil.createForeignKeyIndices(modelEntity, messages);
|
||||
}
|
||||
} else if ("removefkidxs".equals(option)) {
|
||||
modelEntityNames.each { modelEntityName ->
|
||||
modelEntity = modelEntities[modelEntityName];
|
||||
dbUtil.deleteForeignKeyIndices(modelEntity, messages);
|
||||
}
|
||||
} else if ("createfks".equals(option)) {
|
||||
modelEntityNames.each { modelEntityName ->
|
||||
modelEntity = modelEntities[modelEntityName];
|
||||
dbUtil.createForeignKeys(modelEntity, modelEntities, messages);
|
||||
}
|
||||
} else if ("removefks".equals(option)) {
|
||||
modelEntityNames.each { modelEntityName ->
|
||||
modelEntity = modelEntities[modelEntityName];
|
||||
dbUtil.deleteForeignKeys(modelEntity, modelEntities, messages);
|
||||
}
|
||||
} else if ("createidx".equals(option)) {
|
||||
modelEntityNames.each { modelEntityName ->
|
||||
modelEntity = modelEntities[modelEntityName];
|
||||
dbUtil.createDeclaredIndices(modelEntity, messages);
|
||||
}
|
||||
} else if ("removeidx".equals(option)) {
|
||||
modelEntityNames.each { modelEntityName ->
|
||||
modelEntity = modelEntities[modelEntityName];
|
||||
dbUtil.deleteDeclaredIndices(modelEntity, messages);
|
||||
}
|
||||
} else if ("updateCharsetCollate".equals(option)) {
|
||||
modelEntityNames.each { modelEntityName ->
|
||||
modelEntity = modelEntities[modelEntityName];
|
||||
dbUtil.updateCharacterSetAndCollation(modelEntity, messages);
|
||||
}
|
||||
}
|
||||
miter = messages.iterator();
|
||||
context.miters = miter;
|
||||
}
|
||||
context.encodeURLCheckDb = response.encodeURL(controlPath + "/view/checkdb");
|
||||
context.groupName = groupName ?: "org.ofbiz";
|
||||
context.entityName = entityName ?: "";
|
||||
}
|
||||
+23
-32
@@ -25,64 +25,55 @@ import org.ofbiz.entity.model.ModelReader;
|
||||
import org.ofbiz.entity.model.ModelEntity;
|
||||
import org.ofbiz.entity.model.ModelViewEntity;
|
||||
|
||||
delegator = request.getAttribute("delegator");
|
||||
mgr = delegator.getModelGroupReader();
|
||||
entityGroups = mgr.getGroupNames(delegator.getDelegatorName()).iterator();
|
||||
|
||||
ModelGroupReader mgr = delegator.getModelGroupReader();
|
||||
Iterator groupMapIt = mgr.getGroupNames(delegator.getDelegatorName()).iterator();
|
||||
List entityGroups = FastList.newInstance();
|
||||
filterByGroupName = parameters.filterByGroupName;
|
||||
context.filterByGroupName = filterByGroupName;
|
||||
|
||||
while (groupMapIt.hasNext()) {
|
||||
entityGroups.add(groupMapIt.next());
|
||||
}
|
||||
|
||||
filterByGroupName = parameters.get("filterByGroupName");
|
||||
context.put("filterByGroupName", filterByGroupName);
|
||||
|
||||
ModelReader reader = delegator.getModelReader();
|
||||
Collection ec = reader.getEntityNames();
|
||||
TreeSet entities = new TreeSet(ec);
|
||||
Iterator classNamesIterator = entities.iterator();
|
||||
reader = delegator.getModelReader();
|
||||
entities = new TreeSet(reader.getEntityNames());
|
||||
|
||||
int colSize = entities.size()/3 + 1;
|
||||
int kIdx = 0;
|
||||
List entitiesList = new ArrayList();
|
||||
while (classNamesIterator != null && classNamesIterator.hasNext()) {
|
||||
ModelEntity entity = reader.getModelEntity((String)classNamesIterator.next());
|
||||
entitiesList = [];
|
||||
entities.each { entityName ->
|
||||
entity = reader.getModelEntity(entityName);
|
||||
|
||||
if (UtilValidate.isNotEmpty(filterByGroupName) && !filterByGroupName.equals(delegator.getEntityGroupName(entity.getEntityName()))) {
|
||||
continue;
|
||||
if (filterByGroupName && !filterByGroupName.equals(delegator.getEntityGroupName(entity.getEntityName()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
String viewEntity = "N";
|
||||
viewEntity = "N";
|
||||
if (entity instanceof ModelViewEntity) {
|
||||
viewEntity = "Y";
|
||||
}
|
||||
|
||||
String entityPermissionView = "N";
|
||||
entityPermissionView = "N";
|
||||
if (security.hasEntityPermission("ENTITY_DATA", "_VIEW", session) || security.hasEntityPermission(entity.getPlainTableName(), "_VIEW", session)) {
|
||||
entityPermissionView = "Y";
|
||||
}
|
||||
|
||||
String entityPermissionCreate = "N";
|
||||
entityPermissionCreate = "N";
|
||||
if (security.hasEntityPermission("ENTITY_DATA", "_CREATE", session) || security.hasEntityPermission(entity.getPlainTableName(), "_CREATE", session)) {
|
||||
entityPermissionCreate = "Y";
|
||||
}
|
||||
|
||||
String changeColumn = "N";
|
||||
changeColumn = "N";
|
||||
kIdx++;
|
||||
if (kIdx >= colSize) {
|
||||
colSize += colSize;
|
||||
changeColumn = "Y";
|
||||
}
|
||||
|
||||
Map entityMap = new HashMap();
|
||||
entityMap.put("entityName", entity.getEntityName());
|
||||
entityMap.put("entityPermissionView", entityPermissionView);
|
||||
entityMap.put("entityPermissionCreate", entityPermissionCreate);
|
||||
entityMap.put("viewEntity", viewEntity);
|
||||
entityMap.put("changeColumn", changeColumn);
|
||||
entityMap = [:];
|
||||
entityMap.entityName = entity.getEntityName();
|
||||
entityMap.entityPermissionView = entityPermissionView;
|
||||
entityMap.entityPermissionCreate = entityPermissionCreate;
|
||||
entityMap.viewEntity = viewEntity;
|
||||
entityMap.changeColumn = changeColumn;
|
||||
|
||||
entitiesList.add(entityMap);
|
||||
}
|
||||
context.put("entityGroups", entityGroups);
|
||||
context.put("entitiesList", entitiesList);
|
||||
context.entityGroups = entityGroups;
|
||||
context.entitiesList = entitiesList;
|
||||
@@ -1,251 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
import org.ofbiz.base.util.cache.UtilCache;
|
||||
import org.ofbiz.base.util.UtilValidate;
|
||||
import org.ofbiz.security.*;
|
||||
import org.ofbiz.entity.*;
|
||||
import org.ofbiz.base.util.*;
|
||||
|
||||
DecimalFormat decimalFormat = new DecimalFormat("#,##0.#######");
|
||||
|
||||
if (security.hasPermission("ENTITY_MAINT", session)) {
|
||||
double startTime, totalTime, callsPerSecond;
|
||||
int calls;
|
||||
List performanceList = new ArrayList();
|
||||
|
||||
calls = 1000;
|
||||
startTime = (double) System.currentTimeMillis();
|
||||
for (int i=0; i < calls; i++) {
|
||||
GenericValue dummy = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", "GZ-1000"));
|
||||
}
|
||||
totalTime = (double) System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = (double) calls / (totalTime/1000);
|
||||
|
||||
Map perfRow = new HashMap();
|
||||
perfRow.put("operation", "findByPrimaryKey");
|
||||
perfRow.put("entity", "Large:Product");
|
||||
perfRow.put("calls", decimalFormat.format(calls));
|
||||
perfRow.put("seconds", decimalFormat.format(totalTime/1000));
|
||||
perfRow.put("secsPerCall", decimalFormat.format(1/callsPerSecond));
|
||||
perfRow.put("callsPerSecond", decimalFormat.format(callsPerSecond));
|
||||
performanceList.add(perfRow);
|
||||
|
||||
calls = 10000;
|
||||
startTime = (double) System.currentTimeMillis();
|
||||
for (int i=0; i < calls; i++) {
|
||||
GenericValue dummy = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", "GZ-1000"));
|
||||
}
|
||||
totalTime = (double) System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = (double) calls / (totalTime/1000);
|
||||
|
||||
perfRow = new HashMap();
|
||||
perfRow.put("operation", "findByPrimaryKeyCache");
|
||||
perfRow.put("entity", "Large:Product");
|
||||
perfRow.put("calls", decimalFormat.format(calls));
|
||||
perfRow.put("seconds", decimalFormat.format(totalTime/1000));
|
||||
perfRow.put("secsPerCall", decimalFormat.format(1/callsPerSecond));
|
||||
perfRow.put("callsPerSecond", decimalFormat.format(callsPerSecond));
|
||||
performanceList.add(perfRow);
|
||||
|
||||
calls = 1000;
|
||||
startTime = (double) System.currentTimeMillis();
|
||||
for (int i=0; i < calls; i++) {
|
||||
GenericValue dummy = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId", "_NA_"));
|
||||
}
|
||||
totalTime = (double) System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = (double) calls / (totalTime/1000);
|
||||
|
||||
perfRow = new HashMap();
|
||||
perfRow.put("operation", "findByPrimaryKey");
|
||||
perfRow.put("entity", "Small:Party");
|
||||
perfRow.put("calls", decimalFormat.format(calls));
|
||||
perfRow.put("seconds", decimalFormat.format(totalTime/1000));
|
||||
perfRow.put("secsPerCall", decimalFormat.format(1/callsPerSecond));
|
||||
perfRow.put("callsPerSecond", decimalFormat.format(callsPerSecond));
|
||||
performanceList.add(perfRow);
|
||||
|
||||
calls = 10000;
|
||||
startTime = (double) System.currentTimeMillis();
|
||||
for (int i=0; i < calls; i++) {
|
||||
GenericValue dummy = delegator.findByPrimaryKeyCache("Party", UtilMisc.toMap("partyId", "_NA_"));
|
||||
}
|
||||
totalTime = (double) System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = (double) calls / (totalTime/1000);
|
||||
|
||||
perfRow = new HashMap();
|
||||
perfRow.put("operation", "findByPrimaryKeyCache");
|
||||
perfRow.put("entity", "Small:Party");
|
||||
perfRow.put("calls", decimalFormat.format(calls));
|
||||
perfRow.put("seconds", decimalFormat.format(totalTime/1000));
|
||||
perfRow.put("secsPerCall", decimalFormat.format(1/callsPerSecond));
|
||||
perfRow.put("callsPerSecond", decimalFormat.format(callsPerSecond));
|
||||
performanceList.add(perfRow);
|
||||
|
||||
List createTestList = new ArrayList();
|
||||
calls = 1000;
|
||||
startTime = (double) System.currentTimeMillis();
|
||||
for (int i=0; i < calls; i++) {
|
||||
GenericValue dummy = delegator.makeValue("Product", UtilMisc.toMap("autoCreateKeywords", "N", "description", "Initial Description", "internalName", "Auto-Test Name", "productId", "_~WRITE_TEST~_" + i));
|
||||
createTestList.add(dummy);
|
||||
delegator.create(dummy);
|
||||
}
|
||||
totalTime = (double) System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = (double) calls / (totalTime/1000);
|
||||
|
||||
perfRow = new HashMap();
|
||||
perfRow.put("operation", "create");
|
||||
perfRow.put("entity", "Large:Product");
|
||||
perfRow.put("calls", decimalFormat.format(calls));
|
||||
perfRow.put("seconds", decimalFormat.format(totalTime/1000));
|
||||
perfRow.put("secsPerCall", decimalFormat.format(1/callsPerSecond));
|
||||
perfRow.put("callsPerSecond", decimalFormat.format(callsPerSecond));
|
||||
performanceList.add(perfRow);
|
||||
|
||||
calls = 1000;
|
||||
startTime = (double) System.currentTimeMillis();
|
||||
for (int i=0; i < calls; i++) {
|
||||
GenericValue dummy = (GenericValue) createTestList.get(i);
|
||||
dummy.set("description", "This was a test from the performace BSH");
|
||||
dummy.store();
|
||||
}
|
||||
totalTime = (double) System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = (double) calls / (totalTime/1000);
|
||||
|
||||
perfRow = new HashMap();
|
||||
perfRow.put("operation", "update");
|
||||
perfRow.put("entity", "Large:Product");
|
||||
perfRow.put("calls", decimalFormat.format(calls));
|
||||
perfRow.put("seconds", decimalFormat.format(totalTime/1000));
|
||||
perfRow.put("secsPerCall", decimalFormat.format(1/callsPerSecond));
|
||||
perfRow.put("callsPerSecond", decimalFormat.format(callsPerSecond));
|
||||
performanceList.add(perfRow);
|
||||
|
||||
calls = 1000;
|
||||
startTime = (double) System.currentTimeMillis();
|
||||
for (int i=0; i < calls; i++) {
|
||||
GenericValue dummy = (GenericValue) createTestList.get(i);
|
||||
dummy.remove();
|
||||
}
|
||||
totalTime = (double) System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = (double) calls / (totalTime/1000);
|
||||
|
||||
perfRow = new HashMap();
|
||||
perfRow.put("operation", "remove");
|
||||
perfRow.put("entity", "Large:Product");
|
||||
perfRow.put("calls", decimalFormat.format(calls));
|
||||
perfRow.put("seconds", decimalFormat.format(totalTime/1000));
|
||||
perfRow.put("secsPerCall", decimalFormat.format(1/callsPerSecond));
|
||||
perfRow.put("callsPerSecond", decimalFormat.format(callsPerSecond));
|
||||
performanceList.add(perfRow);
|
||||
|
||||
calls = 100000;
|
||||
startTime = (double) System.currentTimeMillis();
|
||||
for (int i=0; i < calls; i++) {
|
||||
Map ptyMap = new HashMap();
|
||||
ptyMap.put("partyId", "_NA_");
|
||||
}
|
||||
totalTime = (double) System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = (double) calls / (totalTime/1000);
|
||||
|
||||
perfRow = new HashMap();
|
||||
perfRow.put("operation", "new HashMap");
|
||||
perfRow.put("entity", "N/A");
|
||||
perfRow.put("calls", decimalFormat.format(calls));
|
||||
perfRow.put("seconds", decimalFormat.format(totalTime/1000));
|
||||
perfRow.put("secsPerCall", decimalFormat.format(1/callsPerSecond));
|
||||
perfRow.put("callsPerSecond", decimalFormat.format(callsPerSecond));
|
||||
performanceList.add(perfRow);
|
||||
|
||||
calls = 100000;
|
||||
startTime = (double) System.currentTimeMillis();
|
||||
for (int i=0; i < calls; i++) {
|
||||
Map ptyMap = UtilMisc.toMap("partyId", "_NA_");
|
||||
}
|
||||
totalTime = (double) System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = (double) calls / (totalTime/1000);
|
||||
|
||||
perfRow = new HashMap();
|
||||
perfRow.put("operation", "UtilMisc.toMap");
|
||||
perfRow.put("entity", "N/A");
|
||||
perfRow.put("calls", decimalFormat.format(calls));
|
||||
perfRow.put("seconds", decimalFormat.format(totalTime/1000));
|
||||
perfRow.put("secsPerCall", decimalFormat.format(1/callsPerSecond));
|
||||
perfRow.put("callsPerSecond", decimalFormat.format(callsPerSecond));
|
||||
performanceList.add(perfRow);
|
||||
|
||||
UtilCache utilCache = new UtilCache("test-cache", 0,0, false);
|
||||
utilCache.put("testName", "testValue");
|
||||
calls = 1000000;
|
||||
startTime = (double) System.currentTimeMillis();
|
||||
for (int i=0; i < calls; i++) {
|
||||
utilCache.get("testName");
|
||||
}
|
||||
totalTime = (double) System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = (double) calls / (totalTime/1000);
|
||||
|
||||
perfRow = new HashMap();
|
||||
perfRow.put("operation", "UtilCache.get(String) - basic settings");
|
||||
perfRow.put("entity", "N/A");
|
||||
perfRow.put("calls", decimalFormat.format(calls));
|
||||
perfRow.put("seconds", decimalFormat.format(totalTime/1000));
|
||||
perfRow.put("secsPerCall", decimalFormat.format(1/callsPerSecond));
|
||||
perfRow.put("callsPerSecond", decimalFormat.format(callsPerSecond));
|
||||
performanceList.add(perfRow);
|
||||
|
||||
GenericPK testPk = delegator.makePK("Party", UtilMisc.toMap("partyId", "_NA_"));
|
||||
utilCache.put(testPk, "testValue");
|
||||
calls = 1000000;
|
||||
startTime = (double) System.currentTimeMillis();
|
||||
for (int i=0; i < calls; i++) {
|
||||
utilCache.get(testPk);
|
||||
}
|
||||
totalTime = (double) System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = (double) calls / (totalTime/1000);
|
||||
|
||||
perfRow = new HashMap();
|
||||
perfRow.put("operation", "UtilCache.get(GenericPK) - basic settings");
|
||||
perfRow.put("entity", "N/A");
|
||||
perfRow.put("calls", decimalFormat.format(calls));
|
||||
perfRow.put("seconds", decimalFormat.format(totalTime/1000));
|
||||
perfRow.put("secsPerCall", decimalFormat.format(1/callsPerSecond));
|
||||
perfRow.put("callsPerSecond", decimalFormat.format(callsPerSecond));
|
||||
performanceList.add(perfRow);
|
||||
|
||||
calls = 1000000;
|
||||
startTime = (double) System.currentTimeMillis();
|
||||
for (int i=0; i < calls; i++) {
|
||||
utilCache.put(testPk, "testValue");
|
||||
}
|
||||
totalTime = (double) System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = (double) calls / (totalTime/1000);
|
||||
|
||||
perfRow = new HashMap();
|
||||
perfRow.put("operation", "UtilCache.put(GenericPK) - basic settings");
|
||||
perfRow.put("entity", "N/A");
|
||||
perfRow.put("calls", decimalFormat.format(calls));
|
||||
perfRow.put("seconds", decimalFormat.format(totalTime/1000));
|
||||
perfRow.put("secsPerCall", decimalFormat.format(1/callsPerSecond));
|
||||
perfRow.put("callsPerSecond", decimalFormat.format(callsPerSecond));
|
||||
performanceList.add(perfRow);
|
||||
|
||||
context.put("performanceList", performanceList);
|
||||
}
|
||||
+249
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
import org.ofbiz.base.util.cache.UtilCache;
|
||||
import org.ofbiz.base.util.UtilValidate;
|
||||
import org.ofbiz.security.*;
|
||||
import org.ofbiz.entity.*;
|
||||
import org.ofbiz.base.util.*;
|
||||
|
||||
DecimalFormat decimalFormat = new DecimalFormat("#,##0.#######");
|
||||
|
||||
if (security.hasPermission("ENTITY_MAINT", session)) {
|
||||
performanceList = [];
|
||||
|
||||
calls = 1000;
|
||||
startTime = System.currentTimeMillis();
|
||||
for (int i = 0; i < calls; i++) {
|
||||
dummy = delegator.findByPrimaryKey("Product", [productId : "GZ-1000"]);
|
||||
}
|
||||
totalTime = System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = calls / (totalTime/1000);
|
||||
|
||||
perfRow = [:];
|
||||
perfRow.operation = "findByPrimaryKey";
|
||||
perfRow.entity = "Large:Product";
|
||||
perfRow.calls = decimalFormat.format(calls);
|
||||
perfRow.seconds = decimalFormat.format(totalTime / 1000);
|
||||
perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
|
||||
perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
|
||||
performanceList.add(perfRow);
|
||||
|
||||
calls = 10000;
|
||||
startTime = System.currentTimeMillis();
|
||||
for (int i = 0; i < calls; i++) {
|
||||
dummy = delegator.findByPrimaryKeyCache("Product", [productId : "GZ-1000"]);
|
||||
}
|
||||
totalTime = System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = calls / (totalTime / 1000);
|
||||
|
||||
perfRow = [:];
|
||||
perfRow.operation = "findByPrimaryKeyCache";
|
||||
perfRow.entity = "Large:Product";
|
||||
perfRow.calls = decimalFormat.format(calls);
|
||||
perfRow.seconds = decimalFormat.format(totalTime / 1000);
|
||||
perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
|
||||
perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
|
||||
performanceList.add(perfRow);
|
||||
|
||||
calls = 1000;
|
||||
startTime = System.currentTimeMillis();
|
||||
for (int i = 0; i < calls; i++) {
|
||||
dummy = delegator.findByPrimaryKey("Party", [partyId : "_NA_"]);
|
||||
}
|
||||
totalTime = System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = calls / (totalTime / 1000);
|
||||
|
||||
perfRow = [:];
|
||||
perfRow.operation = "findByPrimaryKey";
|
||||
perfRow.entity = "Small:Party";
|
||||
perfRow.calls = decimalFormat.format(calls);
|
||||
perfRow.seconds = decimalFormat.format(totalTime / 1000);
|
||||
perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
|
||||
perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
|
||||
performanceList.add(perfRow);
|
||||
|
||||
calls = 10000;
|
||||
startTime = System.currentTimeMillis();
|
||||
for (int i=0; i < calls; i++) {
|
||||
dummy = delegator.findByPrimaryKeyCache("Party", [partyId : "_NA_"]);
|
||||
}
|
||||
totalTime = System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = calls / (totalTime / 1000);
|
||||
|
||||
perfRow = [:];
|
||||
perfRow.operation = "findByPrimaryKeyCache";
|
||||
perfRow.entity = "Small:Party";
|
||||
perfRow.calls = decimalFormat.format(calls);
|
||||
perfRow.seconds = decimalFormat.format(totalTime / 1000);
|
||||
perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
|
||||
perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
|
||||
performanceList.add(perfRow);
|
||||
|
||||
createTestList = [];
|
||||
calls = 1000;
|
||||
startTime = System.currentTimeMillis();
|
||||
for (int i = 0; i < calls; i++) {
|
||||
dummy = delegator.makeValue("Product", [autoCreateKeywords : "N", description : "Initial Description", internalName : "Auto-Test Name", productId : "_~WRITE_TEST~_" + i]);
|
||||
createTestList.add(dummy);
|
||||
delegator.create(dummy);
|
||||
}
|
||||
totalTime = System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = calls / (totalTime / 1000);
|
||||
|
||||
perfRow = [:];
|
||||
perfRow.operation = "create";
|
||||
perfRow.entity = "Large:Product";
|
||||
perfRow.calls = decimalFormat.format(calls);
|
||||
perfRow.seconds = decimalFormat.format(totalTime / 1000);
|
||||
perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
|
||||
perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
|
||||
performanceList.add(perfRow);
|
||||
|
||||
calls = 1000;
|
||||
startTime = System.currentTimeMillis();
|
||||
for (int i = 0; i < calls; i++) {
|
||||
dummy = createTestList.get(i);
|
||||
dummy.description = "This was a test from the performance groovy script";
|
||||
dummy.store();
|
||||
}
|
||||
totalTime = System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = calls / (totalTime / 1000);
|
||||
|
||||
perfRow = [:];
|
||||
perfRow.operation = "update";
|
||||
perfRow.entity = "Large:Product";
|
||||
perfRow.calls = decimalFormat.format(calls);
|
||||
perfRow.seconds = decimalFormat.format(totalTime / 1000);
|
||||
perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
|
||||
perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
|
||||
performanceList.add(perfRow);
|
||||
|
||||
calls = 1000;
|
||||
startTime = System.currentTimeMillis();
|
||||
for (int i = 0; i < calls; i++) {
|
||||
dummy = createTestList.get(i);
|
||||
dummy.remove();
|
||||
}
|
||||
totalTime = System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = (double) calls / (totalTime / 1000);
|
||||
|
||||
perfRow = [:];
|
||||
perfRow.operation = "remove";
|
||||
perfRow.entity = "Large:Product";
|
||||
perfRow.calls = decimalFormat.format(calls);
|
||||
perfRow.seconds = decimalFormat.format(totalTime / 1000);
|
||||
perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
|
||||
perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
|
||||
performanceList.add(perfRow);
|
||||
|
||||
calls = 100000;
|
||||
startTime = System.currentTimeMillis();
|
||||
for (int i = 0; i < calls; i++) {
|
||||
ptyMap = [:];
|
||||
ptyMap.partyId = "_NA_";
|
||||
}
|
||||
totalTime = System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = calls / (totalTime / 1000);
|
||||
|
||||
perfRow = [:];
|
||||
perfRow.operation = "new HashMap";
|
||||
perfRow.entity = "N/A";
|
||||
perfRow.calls = decimalFormat.format(calls);
|
||||
perfRow.seconds = decimalFormat.format(totalTime / 1000);
|
||||
perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
|
||||
perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
|
||||
performanceList.add(perfRow);
|
||||
|
||||
calls = 100000;
|
||||
startTime = System.currentTimeMillis();
|
||||
for (int i = 0; i < calls; i++) {
|
||||
ptyMap = UtilMisc.toMap("partyId", "_NA_");
|
||||
}
|
||||
totalTime = System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = calls / (totalTime / 1000);
|
||||
|
||||
perfRow = [:];
|
||||
perfRow.operation = "UtilMisc.toMap";
|
||||
perfRow.entity = "N/A";
|
||||
perfRow.calls = decimalFormat.format(calls);
|
||||
perfRow.seconds = decimalFormat.format(totalTime / 1000);
|
||||
perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
|
||||
perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
|
||||
performanceList.add(perfRow);
|
||||
|
||||
utilCache = new UtilCache("test-cache", 0, 0, false);
|
||||
utilCache.put("testName", "testValue");
|
||||
calls = 1000000;
|
||||
startTime = System.currentTimeMillis();
|
||||
for (int i = 0; i < calls; i++) {
|
||||
utilCache.get("testName");
|
||||
}
|
||||
totalTime = System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = calls / (totalTime / 1000);
|
||||
|
||||
perfRow = [:];
|
||||
perfRow.operation = "UtilCache.get(String) - basic settings";
|
||||
perfRow.entity = "N/A";
|
||||
perfRow.calls = decimalFormat.format(calls);
|
||||
perfRow.seconds = decimalFormat.format(totalTime / 1000);
|
||||
perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
|
||||
perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
|
||||
performanceList.add(perfRow);
|
||||
|
||||
testPk = delegator.makePK("Party", [partyId : "_NA_"]);
|
||||
utilCache.put(testPk, "testValue");
|
||||
calls = 1000000;
|
||||
startTime = System.currentTimeMillis();
|
||||
for (int i = 0; i < calls; i++) {
|
||||
utilCache.get(testPk);
|
||||
}
|
||||
totalTime = System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = calls / (totalTime/1000);
|
||||
|
||||
perfRow = [:];
|
||||
perfRow.operation = "UtilCache.get(GenericPK) - basic settings";
|
||||
perfRow.entity = "N/A";
|
||||
perfRow.calls = decimalFormat.format(calls);
|
||||
perfRow.seconds = decimalFormat.format(totalTime / 1000);
|
||||
perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
|
||||
perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
|
||||
performanceList.add(perfRow);
|
||||
|
||||
calls = 1000000;
|
||||
startTime = System.currentTimeMillis();
|
||||
for (int i = 0; i < calls; i++) {
|
||||
utilCache.put(testPk, "testValue");
|
||||
}
|
||||
totalTime = System.currentTimeMillis() - startTime;
|
||||
callsPerSecond = calls / (totalTime / 1000);
|
||||
|
||||
perfRow = [:];
|
||||
perfRow.operation = "UtilCache.put(GenericPK) - basic settings";
|
||||
perfRow.entity = "N/A";
|
||||
perfRow.calls = decimalFormat.format(calls);
|
||||
perfRow.seconds = decimalFormat.format(totalTime / 1000);
|
||||
perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
|
||||
perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
|
||||
performanceList.add(perfRow);
|
||||
|
||||
context.performanceList = performanceList;
|
||||
}
|
||||
+13
-13
@@ -16,18 +16,18 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
String controlPath = (String)request.getAttribute("_CONTROL_PATH_");
|
||||
String list = controlPath + "/view/entityref_list";
|
||||
String main = controlPath + "/view/entityref_main";
|
||||
String search = (String)request.getParameter("search");
|
||||
String forstatic = (String)request.getParameter("forstatic");
|
||||
controlPath = parameters._CONTROL_PATH_;
|
||||
list = "$controlPath/view/entityref_list";
|
||||
main = "$controlPath/view/entityref_main";
|
||||
search = parameters.search;
|
||||
forstatic = parameters.forstatic;
|
||||
|
||||
if (search != null) {
|
||||
list = list + "?search=" + search;
|
||||
main = main + "?search=" + search;
|
||||
} else if (forstatic != null) {
|
||||
list = list + "?forstatic=" + forstatic;
|
||||
main = main + "?forstatic=" + forstatic;
|
||||
if (search) {
|
||||
list = "$list?search=$search";
|
||||
main = "$main?search=$search";
|
||||
} else if (forstatic) {
|
||||
list = "$list?forstatic=$forstatic";
|
||||
main = "$main?forstatic=$forstatic";
|
||||
}
|
||||
context.put("encodeUrlList", response.encodeURL(list));
|
||||
context.put("encodeUrlMain", response.encodeURL(main));
|
||||
context.encodeUrlList = response.encodeURL(list);
|
||||
context.encodeUrlMain = response.encodeURL(main);
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import org.ofbiz.entity.GenericDelegator;
|
||||
import org.ofbiz.security.Security;
|
||||
import org.ofbiz.entity.model.ModelReader;
|
||||
import org.ofbiz.entity.model.ModelEntity;
|
||||
|
||||
delegator = request.getAttribute("delegator");
|
||||
security = request.getAttribute("security");
|
||||
|
||||
String controlPath = (String)request.getAttribute("_CONTROL_PATH_");
|
||||
context.put("controlPath", controlPath);
|
||||
|
||||
if (security.hasPermission("ENTITY_MAINT", session)) {
|
||||
boolean forstatic = "true".equals(request.getParameter("forstatic"));
|
||||
context.put("forstatic", forstatic);
|
||||
|
||||
ModelReader reader = delegator.getModelReader();
|
||||
Collection ec = reader.getEntityNames();
|
||||
TreeSet entities = new TreeSet(ec);
|
||||
search = (String) request.getParameter("search");
|
||||
|
||||
TreeSet packageNames = new TreeSet();
|
||||
Iterator ecIter = ec.iterator();
|
||||
while(ecIter.hasNext()) {
|
||||
String eName = (String)ecIter.next();
|
||||
ModelEntity ent = reader.getModelEntity(eName);
|
||||
packageNames.add(ent.getPackageName());
|
||||
}
|
||||
context.put("packageNames", packageNames);
|
||||
|
||||
List entitiesList = new ArrayList();
|
||||
Iterator i = entities.iterator();
|
||||
while (i.hasNext()) {
|
||||
Map entityMap = new HashMap();
|
||||
|
||||
Object o = i.next();
|
||||
String entityName = (String)o;
|
||||
if (search == null || entityName.toLowerCase().indexOf(search.toLowerCase()) != -1 ) {
|
||||
String url = (search == null) ? "" : "?search=" + search;
|
||||
entityMap.put("url", url);
|
||||
}
|
||||
entityMap.put("entityName", entityName);
|
||||
|
||||
entitiesList.add(entityMap);
|
||||
}
|
||||
context.put("entitiesList", entitiesList);
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import org.ofbiz.entity.GenericDelegator;
|
||||
import org.ofbiz.security.Security;
|
||||
import org.ofbiz.entity.model.ModelReader;
|
||||
import org.ofbiz.entity.model.ModelEntity;
|
||||
|
||||
controlPath = parameters._CONTROL_PATH_;
|
||||
context.controlPath = controlPath;
|
||||
|
||||
if (security.hasPermission("ENTITY_MAINT", session)) {
|
||||
forstatic = "true".equals(parameters.forstatic);
|
||||
context.forstatic = forstatic;
|
||||
|
||||
reader = delegator.getModelReader();
|
||||
ec = reader.getEntityNames();
|
||||
entities = new TreeSet(ec);
|
||||
search = parameters.search;
|
||||
|
||||
packageNames = new TreeSet();
|
||||
ec.each { eName ->
|
||||
ent = reader.getModelEntity(eName);
|
||||
packageNames.add(ent.getPackageName());
|
||||
}
|
||||
context.packageNames = packageNames;
|
||||
|
||||
entitiesList = [];
|
||||
entities.each { entityName ->
|
||||
entityMap = [:];
|
||||
if (!search || entityName.toLowerCase().indexOf(search.toLowerCase()) != -1 ) {
|
||||
url = search ? "?search=$search" : "";
|
||||
entityMap.url = url;
|
||||
}
|
||||
entityMap.entityName = entityName;
|
||||
|
||||
entitiesList.add(entityMap);
|
||||
}
|
||||
context.entitiesList = entitiesList;
|
||||
}
|
||||
+23
-30
@@ -26,39 +26,34 @@ import java.util.Iterator;
|
||||
import org.ofbiz.entity.*;
|
||||
import org.ofbiz.entity.model.ModelGroupReader;
|
||||
|
||||
String resultMessage = "";
|
||||
ResultSet rs = null;
|
||||
ArrayList columns = new ArrayList();
|
||||
ArrayList records = new ArrayList();
|
||||
ArrayList groups = new ArrayList();
|
||||
ModelGroupReader mgr = delegator.getModelGroupReader();
|
||||
Iterator groupMapIt = mgr.getGroupNames(delegator.getDelegatorName()).iterator();
|
||||
resultMessage = "";
|
||||
rs = null;
|
||||
columns = [];
|
||||
records = [];
|
||||
mgr = delegator.getModelGroupReader();
|
||||
groups = mgr.getGroupNames(delegator.getDelegatorName());
|
||||
|
||||
while (groupMapIt.hasNext()) {
|
||||
groups.add(groupMapIt.next());
|
||||
}
|
||||
|
||||
if (sqlCommand != null && sqlCommand.length() > 0 && selGroup != null && selGroup.length() > 0) {
|
||||
String helperName = delegator.getGroupHelperName(selGroup);
|
||||
SQLProcessor du = new SQLProcessor(helperName);
|
||||
if (sqlCommand && selGroup) {
|
||||
helperName = delegator.getGroupHelperName(selGroup);
|
||||
du = new SQLProcessor(helperName);
|
||||
try {
|
||||
if (sqlCommand.toUpperCase().startsWith("SELECT")) {
|
||||
rs = du.executeQuery(sqlCommand);
|
||||
if (rs != null) {
|
||||
ResultSetMetaData rsmd = rs.getMetaData();
|
||||
int numberOfColumns = rsmd.getColumnCount();
|
||||
for (int i = 1; i <= numberOfColumns; i++) {
|
||||
if (rs) {
|
||||
rsmd = rs.getMetaData();
|
||||
numberOfColumns = rsmd.getColumnCount();
|
||||
for (i = 1; i <= numberOfColumns; i++) {
|
||||
columns.add(rsmd.getColumnName(i));
|
||||
}
|
||||
boolean rowLimitReached = false;
|
||||
rowLimitReached = false;
|
||||
while (rs.next()) {
|
||||
if (records.size() >= rowLimit) {
|
||||
resultMessage = "Returned top " + rowLimit + " rows.";
|
||||
resultMessage = "Returned top $rowLimit rows.";
|
||||
rowLimitReached = true;
|
||||
break;
|
||||
}
|
||||
ArrayList record = new ArrayList();
|
||||
for (int i = 1; i <= numberOfColumns; i++) {
|
||||
record = [];
|
||||
for (i = 1; i <= numberOfColumns; i++) {
|
||||
record.add(rs.getObject(i));
|
||||
}
|
||||
records.add(record);
|
||||
@@ -68,16 +63,14 @@ if (sqlCommand != null && sqlCommand.length() > 0 && selGroup != null && selGrou
|
||||
}
|
||||
} else {
|
||||
du.prepareStatement(sqlCommand);
|
||||
int numOfaffectedRows = du.executeUpdate();
|
||||
resultMessage = "Affected " + numOfaffectedRows + " rows.";
|
||||
numOfAffectedRows = du.executeUpdate();
|
||||
resultMessage = "Affected $numOfAffectedRows rows.";
|
||||
}
|
||||
} catch(Exception exc) {
|
||||
resultMessage = exc.getMessage();
|
||||
}
|
||||
}
|
||||
context.put("groups", groups);
|
||||
context.put("resultMessage", resultMessage);
|
||||
context.put("columns", columns);
|
||||
context.put("records", records);
|
||||
|
||||
|
||||
context.groups = groups;
|
||||
context.resultMessage = resultMessage;
|
||||
context.columns = columns;
|
||||
context.records = records;
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import org.ofbiz.entity.GenericDelegator;
|
||||
import org.ofbiz.security.Security;
|
||||
import org.ofbiz.entity.model.ModelReader;
|
||||
import org.ofbiz.entity.model.ModelEntity;
|
||||
import org.ofbiz.entity.model.ModelRelation;
|
||||
import org.ofbiz.entity.model.ModelKeyMap;
|
||||
|
||||
delegator = request.getAttribute("delegator");
|
||||
security = request.getAttribute("security");
|
||||
|
||||
String entityName = request.getParameter("entityName");
|
||||
context.put("entityName", entityName);
|
||||
|
||||
ModelReader reader = delegator.getModelReader();
|
||||
ModelEntity modelEntity = reader.getModelEntity(entityName);
|
||||
|
||||
context.put("plainTableName", modelEntity.getPlainTableName());
|
||||
|
||||
boolean hasViewPermission = security.hasEntityPermission("ENTITY_DATA", "_VIEW", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_VIEW", session);
|
||||
context.put("hasViewPermission", hasViewPermission);
|
||||
|
||||
List relations = new ArrayList();
|
||||
for (Iterator rit = modelEntity.getRelationsIterator(); rit.hasNext();) {
|
||||
Map mapRelation = new HashMap();
|
||||
|
||||
ModelRelation modelRelation = (ModelRelation) rit.next();
|
||||
List relFields = new ArrayList();
|
||||
for (Iterator kit = modelRelation.getKeyMapsIterator(); kit.hasNext(); ) {
|
||||
Map mapFields = new HashMap();
|
||||
ModelKeyMap keyMap = (ModelKeyMap) kit.next();
|
||||
mapFields.put("fieldName", keyMap.getFieldName());
|
||||
mapFields.put("relFieldName", keyMap.getRelFieldName());
|
||||
|
||||
relFields.add(mapFields);
|
||||
}
|
||||
mapRelation.put("relFields", relFields);
|
||||
mapRelation.put("title", modelRelation.getTitle());
|
||||
mapRelation.put("relEntityName", modelRelation.getRelEntityName());
|
||||
mapRelation.put("type", modelRelation.getType());
|
||||
mapRelation.put("fkName", modelRelation.getFkName());
|
||||
|
||||
relations.add(mapRelation);
|
||||
}
|
||||
context.put("relations", relations);
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import org.ofbiz.entity.GenericDelegator;
|
||||
import org.ofbiz.security.Security;
|
||||
import org.ofbiz.entity.model.ModelReader;
|
||||
import org.ofbiz.entity.model.ModelEntity;
|
||||
import org.ofbiz.entity.model.ModelRelation;
|
||||
import org.ofbiz.entity.model.ModelKeyMap;
|
||||
|
||||
entityName = parameters.entityName;
|
||||
context.entityName = entityName;
|
||||
|
||||
reader = delegator.getModelReader();
|
||||
modelEntity = reader.getModelEntity(entityName);
|
||||
|
||||
context.plainTableName = modelEntity.getPlainTableName();
|
||||
|
||||
hasViewPermission = security.hasEntityPermission("ENTITY_DATA", "_VIEW", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_VIEW", session);
|
||||
context.hasViewPermission = hasViewPermission;
|
||||
|
||||
relations = [];
|
||||
for (rit = modelEntity.getRelationsIterator(); rit.hasNext();) {
|
||||
mapRelation = [:];
|
||||
|
||||
modelRelation = rit.next();
|
||||
relFields = [];
|
||||
for (kit = modelRelation.getKeyMapsIterator(); kit.hasNext();) {
|
||||
mapFields = [:];
|
||||
keyMap = kit.next();
|
||||
mapFields.fieldName = keyMap.getFieldName();
|
||||
mapFields.relFieldName = keyMap.getRelFieldName();
|
||||
|
||||
relFields.add(mapFields);
|
||||
}
|
||||
mapRelation.relFields = relFields;
|
||||
mapRelation.title = modelRelation.getTitle();
|
||||
mapRelation.relEntityName = modelRelation.getRelEntityName();
|
||||
mapRelation.type = modelRelation.getType();
|
||||
mapRelation.fkName = modelRelation.getFkName();
|
||||
|
||||
relations.add(mapRelation);
|
||||
}
|
||||
context.relations = relations;
|
||||
@@ -0,0 +1,332 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import org.w3c.dom.*;
|
||||
import org.ofbiz.security.*;
|
||||
import org.ofbiz.entity.*;
|
||||
import org.ofbiz.base.util.*;
|
||||
import org.ofbiz.webapp.pseudotag.*;
|
||||
import org.ofbiz.entity.model.*;
|
||||
import org.ofbiz.entity.util.*;
|
||||
import org.ofbiz.entity.transaction.*;
|
||||
import org.ofbiz.entity.condition.*;
|
||||
|
||||
outpath = parameters.outpath;
|
||||
filename = parameters.filename;
|
||||
maxRecStr = parameters.maxrecords;
|
||||
entitySyncId = parameters.entitySyncId;
|
||||
passedEntityNames = parameters.entityName instanceof Collection ? parameters.entityName as TreeSet : [parameters.entityName] as TreeSet;
|
||||
entityFrom = parameters.entityFrom;
|
||||
entityThru = parameters.entityThru;
|
||||
|
||||
// get the max records per file setting and convert to a int
|
||||
maxRecordsPerFile = 0;
|
||||
if (maxRecStr) {
|
||||
try {
|
||||
maxRecordsPerFile = Integer.parseInt(maxRecStr);
|
||||
}
|
||||
catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
preConfiguredSetName = parameters.preConfiguredSetName;
|
||||
if ("Product1".equals(preConfiguredSetName)) {
|
||||
passedEntityNames = new LinkedHashSet();
|
||||
passedEntityNames.add("DataResource");
|
||||
passedEntityNames.add("Facility");
|
||||
passedEntityNames.add("ProdCatalog");
|
||||
passedEntityNames.add("Product");
|
||||
passedEntityNames.add("ProductCategory");
|
||||
passedEntityNames.add("ProductFeatureCategory");
|
||||
passedEntityNames.add("ProductFeatureType");
|
||||
passedEntityNames.add("ProductPriceRule");
|
||||
passedEntityNames.add("ProductPromo");
|
||||
} else if ("Product2".equals(preConfiguredSetName)) {
|
||||
passedEntityNames = new LinkedHashSet();
|
||||
passedEntityNames.add("Content");
|
||||
passedEntityNames.add("ElectronicText");
|
||||
passedEntityNames.add("FacilityLocation");
|
||||
passedEntityNames.add("ProdCatalogCategory");
|
||||
passedEntityNames.add("ProdCatalogRole");
|
||||
passedEntityNames.add("ProductAssoc");
|
||||
passedEntityNames.add("ProductAttribute");
|
||||
passedEntityNames.add("ProductCategoryMember");
|
||||
passedEntityNames.add("ProductCategoryRollup");
|
||||
passedEntityNames.add("ProductFacility");
|
||||
passedEntityNames.add("ProductFeature");
|
||||
passedEntityNames.add("ProductFeatureCategoryAppl");
|
||||
passedEntityNames.add("ProductKeyword");
|
||||
passedEntityNames.add("ProductPrice");
|
||||
passedEntityNames.add("ProductPriceAction");
|
||||
passedEntityNames.add("ProductPriceCond");
|
||||
passedEntityNames.add("ProductPromoCode");
|
||||
passedEntityNames.add("ProductPromoCategory");
|
||||
passedEntityNames.add("ProductPromoProduct");
|
||||
passedEntityNames.add("ProductPromoRule");
|
||||
} else if ("Product3".equals(preConfiguredSetName)) {
|
||||
passedEntityNames = new LinkedHashSet();
|
||||
passedEntityNames.add("ProdCatalogInvFacility");
|
||||
passedEntityNames.add("ProductContent");
|
||||
passedEntityNames.add("ProductFacilityLocation");
|
||||
passedEntityNames.add("ProductFeatureAppl");
|
||||
passedEntityNames.add("ProductFeatureDataResource");
|
||||
passedEntityNames.add("ProductFeatureGroup");
|
||||
passedEntityNames.add("ProductPriceChange");
|
||||
passedEntityNames.add("ProductPromoAction");
|
||||
passedEntityNames.add("ProductPromoCodeEmail");
|
||||
passedEntityNames.add("ProductPromoCodeParty");
|
||||
passedEntityNames.add("ProductPromoCond");
|
||||
} else if ("Product4".equals(preConfiguredSetName)) {
|
||||
passedEntityNames = new LinkedHashSet();
|
||||
passedEntityNames.add("InventoryItem");
|
||||
passedEntityNames.add("ProductFeatureCatGrpAppl");
|
||||
passedEntityNames.add("ProductFeatureGroupAppl");
|
||||
} else if ("CatalogExport".equals(preConfiguredSetName)) {
|
||||
passedEntityNames = new LinkedHashSet();
|
||||
passedEntityNames.add("ProdCatalogCategoryType");
|
||||
passedEntityNames.add("ProdCatalog");
|
||||
passedEntityNames.add("ProductCategoryType");
|
||||
passedEntityNames.add("ProductCategory");
|
||||
passedEntityNames.add("ProductCategoryRollup");
|
||||
passedEntityNames.add("ProdCatalogCategory");
|
||||
passedEntityNames.add("ProductFeatureType");
|
||||
passedEntityNames.add("ProductFeatureCategory");
|
||||
|
||||
passedEntityNames.add("DataResource");
|
||||
passedEntityNames.add("Content");
|
||||
passedEntityNames.add("ElectronicText");
|
||||
|
||||
passedEntityNames.add("ProductType");
|
||||
passedEntityNames.add("Product");
|
||||
passedEntityNames.add("ProductAttribute");
|
||||
passedEntityNames.add("GoodIdentificationType");
|
||||
passedEntityNames.add("GoodIdentification");
|
||||
passedEntityNames.add("ProductPriceType");
|
||||
passedEntityNames.add("ProductPrice");
|
||||
|
||||
passedEntityNames.add("ProductPriceRule");
|
||||
passedEntityNames.add("ProductPriceCond");
|
||||
passedEntityNames.add("ProductPriceAction");
|
||||
//passedEntityNames.add("ProductPriceChange");
|
||||
|
||||
passedEntityNames.add("ProductPromo");
|
||||
passedEntityNames.add("ProductPromoCode");
|
||||
passedEntityNames.add("ProductPromoCategory");
|
||||
passedEntityNames.add("ProductPromoProduct");
|
||||
passedEntityNames.add("ProductPromoRule");
|
||||
passedEntityNames.add("ProductPromoAction");
|
||||
passedEntityNames.add("ProductPromoCodeEmail");
|
||||
passedEntityNames.add("ProductPromoCodeParty");
|
||||
passedEntityNames.add("ProductPromoCond");
|
||||
|
||||
passedEntityNames.add("ProductCategoryMember");
|
||||
passedEntityNames.add("ProductAssoc");
|
||||
passedEntityNames.add("ProductContent");
|
||||
|
||||
passedEntityNames.add("ProductFeature");
|
||||
passedEntityNames.add("ProductFeatureCategoryAppl");
|
||||
passedEntityNames.add("ProductFeatureAppl");
|
||||
passedEntityNames.add("ProductFeatureDataResource");
|
||||
passedEntityNames.add("ProductFeatureGroup");
|
||||
passedEntityNames.add("ProductFeatureCatGrpAppl");
|
||||
passedEntityNames.add("ProductFeatureGroupAppl");
|
||||
|
||||
//passedEntityNames.add("ProductKeyword");
|
||||
}
|
||||
|
||||
if (entitySyncId) {
|
||||
passedEntityNames = org.ofbiz.entityext.synchronization.EntitySyncContext.getEntitySyncModelNamesToUse(dispatcher, entitySyncId);
|
||||
}
|
||||
checkAll = "true".equals(parameters.checkAll);
|
||||
tobrowser = parameters.tobrowser != null;
|
||||
context.tobrowser = tobrowser;
|
||||
|
||||
entityFromCond = null;
|
||||
entityThruCond = null;
|
||||
entityDateCond = null;
|
||||
if (entityFrom) {
|
||||
entityFromCond = EntityCondition.makeCondition("lastUpdatedTxStamp", EntityComparisonOperator.GREATER_THAN, entityFrom);
|
||||
}
|
||||
if (entityThru) {
|
||||
entityThruCond = EntityCondition.makeCondition("lastUpdatedTxStamp", EntityComparisonOperator.LESS_THAN, entityThru);
|
||||
}
|
||||
if (entityFromCond && entityThruCond) {
|
||||
entityDateCond = EntityCondition.makeCondition(entityFromCond, EntityJoinOperator.AND, entityThruCond);
|
||||
} else if (entityFromCond) {
|
||||
entityDateCond = entityFromCond;
|
||||
} else if (entityThruCond) {
|
||||
entityDateCond = entityThruCond;
|
||||
}
|
||||
|
||||
reader = delegator.getModelReader();
|
||||
entityNames = reader.getEntityNames() as TreeSet;
|
||||
context.entityNames = entityNames;
|
||||
|
||||
if (tobrowser) {
|
||||
session.setAttribute("xmlrawdump_entitylist", passedEntityNames);
|
||||
session.setAttribute("entityDateCond", entityDateCond);
|
||||
} else {
|
||||
efo = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true);
|
||||
numberOfEntities = passedEntityNames?.size() ?: 0;
|
||||
context.numberOfEntities = numberOfEntities;
|
||||
numberWritten = 0;
|
||||
|
||||
// single file
|
||||
if(filename && numberOfEntities) {
|
||||
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF-8")));
|
||||
writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||
writer.println("<entity-engine-xml>");
|
||||
|
||||
passedEntityNames.each { curEntityName ->
|
||||
if (entityFrom) {
|
||||
curModelEntity = reader.getModelEntity(curEntityName);
|
||||
if (curModelEntity instanceof ModelViewEntity) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
beganTransaction = TransactionUtil.begin(3600);
|
||||
try {
|
||||
me = reader.getModelEntity(curEntityName);
|
||||
if (me.getNoAutoStamp()) {
|
||||
values = delegator.find(curEntityName, null, null, null, me.getPkFieldNames(), efo);
|
||||
} else {
|
||||
values = delegator.find(curEntityName, entityDateCond, null, null, UtilMisc.toList("-createdTxStamp"), efo);
|
||||
}
|
||||
|
||||
curNumberWritten = 0;
|
||||
values.each { value ->
|
||||
value.writeXmlText(writer, "");
|
||||
numberWritten++;
|
||||
curNumberWritten++;
|
||||
if (curNumberWritten % 500 == 0 || curNumberWritten == 1) {
|
||||
Debug.log("Records written [$curEntityName]: $curNumberWritten Total: $numberWritten");
|
||||
}
|
||||
}
|
||||
values.close();
|
||||
Debug.log("Wrote [$curNumberWritten] from entity : $curEntityName");
|
||||
TransactionUtil.commit(beganTransaction);
|
||||
} catch (Exception e) {
|
||||
errMsg = "Error reading data for XML export:";
|
||||
Debug.logError(e, errMsg, "JSP");
|
||||
TransactionUtil.rollback(beganTransaction, errMsg, e);
|
||||
}
|
||||
}
|
||||
writer.println("</entity-engine-xml>");
|
||||
writer.close();
|
||||
Debug.log("Total records written from all entities: $numberWritten");
|
||||
context.numberWritten = numberWritten;
|
||||
}
|
||||
|
||||
// multiple files in a directory
|
||||
results = [];
|
||||
fileNumber = 1;
|
||||
context.results = results;
|
||||
if (outpath) {
|
||||
outdir = new File(outpath);
|
||||
if(!outdir.exists()){
|
||||
outdir.mkdir();
|
||||
}
|
||||
if (outdir.isDirectory() && outdir.canWrite()) {
|
||||
passedEntityNames.each { curEntityName ->
|
||||
numberWritten = 0;
|
||||
fileName = preConfiguredSetName ? UtilFormatOut.formatPaddedNumber((long) fileNumber, 3) + "_" : "";
|
||||
fileName = fileName + curEntityName;
|
||||
|
||||
values = null;
|
||||
beganTransaction = false;
|
||||
try {
|
||||
beganTransaction = TransactionUtil.begin(3600);
|
||||
|
||||
me = delegator.getModelEntity(curEntityName);
|
||||
if (me instanceof ModelViewEntity) {
|
||||
results.add("[$fileNumber] [vvv] $curEntityName skipping view entity");
|
||||
return;
|
||||
}
|
||||
if (me.getNoAutoStamp()) {
|
||||
values = delegator.find(curEntityName, null, null, null, me.getPkFieldNames(), efo);
|
||||
} else {
|
||||
values = delegator.find(curEntityName, entityDateCond, null, null, me.getPkFieldNames(), efo);
|
||||
}
|
||||
isFirst = true;
|
||||
writer = null;
|
||||
fileSplitNumber = 1;
|
||||
values.each { value ->
|
||||
//Don't bother writing the file if there's nothing
|
||||
//to put into it
|
||||
if (isFirst) {
|
||||
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(outdir, fileName +".xml")), "UTF-8")));
|
||||
writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||
writer.println("<entity-engine-xml>");
|
||||
isFirst = false;
|
||||
}
|
||||
value.writeXmlText(writer, "");
|
||||
numberWritten++;
|
||||
|
||||
// split into small files
|
||||
if (maxRecordsPerFile > 0 && (numberWritten % maxRecordsPerFile == 0)) {
|
||||
fileSplitNumber++;
|
||||
// close the file
|
||||
writer.println("</entity-engine-xml>");
|
||||
writer.close();
|
||||
|
||||
// create a new file
|
||||
splitNumStr = UtilFormatOut.formatPaddedNumber((long) fileSplitNumber, 3);
|
||||
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(outdir, fileName + "_" + splitNumStr +".xml")), "UTF-8")));
|
||||
writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||
writer.println("<entity-engine-xml>");
|
||||
}
|
||||
|
||||
if (numberWritten % 500 == 0 || numberWritten == 1) {
|
||||
Debug.log("Records written [$curEntityName]: $numberWritten");
|
||||
}
|
||||
|
||||
}
|
||||
if (writer) {
|
||||
writer.println("</entity-engine-xml>");
|
||||
writer.close();
|
||||
String thisResult = "[$fileNumber] [$numberWritten] $curEntityName wrote $numberWritten records";
|
||||
Debug.log(thisResult);
|
||||
results.add(thisResult);
|
||||
} else {
|
||||
thisResult = "[$fileNumber] [---] $curEntityName has no records, not writing file";
|
||||
Debug.log(thisResult);
|
||||
results.add(thisResult);
|
||||
}
|
||||
values.close();
|
||||
} catch (Exception ex) {
|
||||
if (values != null) {
|
||||
values.close();
|
||||
}
|
||||
thisResult = "[$fileNumber] [xxx] Error when writing $curEntityName: $ex";
|
||||
Debug.log(thisResult);
|
||||
results.add(thisResult);
|
||||
TransactionUtil.rollback(beganTransaction, thisResult, ex);
|
||||
} finally {
|
||||
// only commit the transaction if we started one... this will throw an exception if it fails
|
||||
TransactionUtil.commit(beganTransaction);
|
||||
}
|
||||
fileNumber++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,352 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import org.w3c.dom.*;
|
||||
import org.ofbiz.security.*;
|
||||
import org.ofbiz.entity.*;
|
||||
import org.ofbiz.base.util.*;
|
||||
import org.ofbiz.webapp.pseudotag.*;
|
||||
import org.ofbiz.entity.model.*;
|
||||
import org.ofbiz.entity.util.*;
|
||||
import org.ofbiz.entity.transaction.*;
|
||||
import org.ofbiz.entity.condition.*;
|
||||
|
||||
String outpath = request.getParameter("outpath");
|
||||
String filename = request.getParameter("filename");
|
||||
String maxRecStr = request.getParameter("maxrecords");
|
||||
String entitySyncId = request.getParameter("entitySyncId");
|
||||
String[] entityName = request.getParameterValues("entityName");
|
||||
String entityFrom = request.getParameter("entityFrom");
|
||||
String entityThru = request.getParameter("entityThru");
|
||||
|
||||
// get the max records per file setting and convert to a int
|
||||
int maxRecordsPerFile = 0;
|
||||
if (UtilValidate.isNotEmpty(maxRecStr)) {
|
||||
try {
|
||||
maxRecordsPerFile = Integer.parseInt(maxRecStr);
|
||||
}
|
||||
catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
Set passedEntityNames = new TreeSet();
|
||||
if (entityName != null && entityName.length > 0) {
|
||||
for(int inc=0; inc<entityName.length; inc++) {
|
||||
passedEntityNames.add(entityName[inc]);
|
||||
}
|
||||
}
|
||||
|
||||
String preConfiguredSetName = request.getParameter("preConfiguredSetName");
|
||||
if ("Product1".equals(preConfiguredSetName)) {
|
||||
passedEntityNames = new LinkedHashSet();
|
||||
passedEntityNames.add("DataResource");
|
||||
passedEntityNames.add("Facility");
|
||||
passedEntityNames.add("ProdCatalog");
|
||||
passedEntityNames.add("Product");
|
||||
passedEntityNames.add("ProductCategory");
|
||||
passedEntityNames.add("ProductFeatureCategory");
|
||||
passedEntityNames.add("ProductFeatureType");
|
||||
passedEntityNames.add("ProductPriceRule");
|
||||
passedEntityNames.add("ProductPromo");
|
||||
} else if ("Product2".equals(preConfiguredSetName)) {
|
||||
passedEntityNames = new LinkedHashSet();
|
||||
passedEntityNames.add("Content");
|
||||
passedEntityNames.add("ElectronicText");
|
||||
passedEntityNames.add("FacilityLocation");
|
||||
passedEntityNames.add("ProdCatalogCategory");
|
||||
passedEntityNames.add("ProdCatalogRole");
|
||||
passedEntityNames.add("ProductAssoc");
|
||||
passedEntityNames.add("ProductAttribute");
|
||||
passedEntityNames.add("ProductCategoryMember");
|
||||
passedEntityNames.add("ProductCategoryRollup");
|
||||
passedEntityNames.add("ProductFacility");
|
||||
passedEntityNames.add("ProductFeature");
|
||||
passedEntityNames.add("ProductFeatureCategoryAppl");
|
||||
passedEntityNames.add("ProductKeyword");
|
||||
passedEntityNames.add("ProductPrice");
|
||||
passedEntityNames.add("ProductPriceAction");
|
||||
passedEntityNames.add("ProductPriceCond");
|
||||
passedEntityNames.add("ProductPromoCode");
|
||||
passedEntityNames.add("ProductPromoCategory");
|
||||
passedEntityNames.add("ProductPromoProduct");
|
||||
passedEntityNames.add("ProductPromoRule");
|
||||
} else if ("Product3".equals(preConfiguredSetName)) {
|
||||
passedEntityNames = new LinkedHashSet();
|
||||
passedEntityNames.add("ProdCatalogInvFacility");
|
||||
passedEntityNames.add("ProductContent");
|
||||
passedEntityNames.add("ProductFacilityLocation");
|
||||
passedEntityNames.add("ProductFeatureAppl");
|
||||
passedEntityNames.add("ProductFeatureDataResource");
|
||||
passedEntityNames.add("ProductFeatureGroup");
|
||||
passedEntityNames.add("ProductPriceChange");
|
||||
passedEntityNames.add("ProductPromoAction");
|
||||
passedEntityNames.add("ProductPromoCodeEmail");
|
||||
passedEntityNames.add("ProductPromoCodeParty");
|
||||
passedEntityNames.add("ProductPromoCond");
|
||||
} else if ("Product4".equals(preConfiguredSetName)) {
|
||||
passedEntityNames = new LinkedHashSet();
|
||||
passedEntityNames.add("InventoryItem");
|
||||
passedEntityNames.add("ProductFeatureCatGrpAppl");
|
||||
passedEntityNames.add("ProductFeatureGroupAppl");
|
||||
} else if ("CatalogExport".equals(preConfiguredSetName)) {
|
||||
passedEntityNames = new LinkedHashSet();
|
||||
passedEntityNames.add("ProdCatalogCategoryType");
|
||||
passedEntityNames.add("ProdCatalog");
|
||||
passedEntityNames.add("ProductCategoryType");
|
||||
passedEntityNames.add("ProductCategory");
|
||||
passedEntityNames.add("ProductCategoryRollup");
|
||||
passedEntityNames.add("ProdCatalogCategory");
|
||||
passedEntityNames.add("ProductFeatureType");
|
||||
passedEntityNames.add("ProductFeatureCategory");
|
||||
|
||||
passedEntityNames.add("DataResource");
|
||||
passedEntityNames.add("Content");
|
||||
passedEntityNames.add("ElectronicText");
|
||||
|
||||
passedEntityNames.add("ProductType");
|
||||
passedEntityNames.add("Product");
|
||||
passedEntityNames.add("ProductAttribute");
|
||||
passedEntityNames.add("GoodIdentificationType");
|
||||
passedEntityNames.add("GoodIdentification");
|
||||
passedEntityNames.add("ProductPriceType");
|
||||
passedEntityNames.add("ProductPrice");
|
||||
|
||||
passedEntityNames.add("ProductPriceRule");
|
||||
passedEntityNames.add("ProductPriceCond");
|
||||
passedEntityNames.add("ProductPriceAction");
|
||||
//passedEntityNames.add("ProductPriceChange");
|
||||
|
||||
passedEntityNames.add("ProductPromo");
|
||||
passedEntityNames.add("ProductPromoCode");
|
||||
passedEntityNames.add("ProductPromoCategory");
|
||||
passedEntityNames.add("ProductPromoProduct");
|
||||
passedEntityNames.add("ProductPromoRule");
|
||||
passedEntityNames.add("ProductPromoAction");
|
||||
passedEntityNames.add("ProductPromoCodeEmail");
|
||||
passedEntityNames.add("ProductPromoCodeParty");
|
||||
passedEntityNames.add("ProductPromoCond");
|
||||
|
||||
passedEntityNames.add("ProductCategoryMember");
|
||||
passedEntityNames.add("ProductAssoc");
|
||||
passedEntityNames.add("ProductContent");
|
||||
|
||||
passedEntityNames.add("ProductFeature");
|
||||
passedEntityNames.add("ProductFeatureCategoryAppl");
|
||||
passedEntityNames.add("ProductFeatureAppl");
|
||||
passedEntityNames.add("ProductFeatureDataResource");
|
||||
passedEntityNames.add("ProductFeatureGroup");
|
||||
passedEntityNames.add("ProductFeatureCatGrpAppl");
|
||||
passedEntityNames.add("ProductFeatureGroupAppl");
|
||||
|
||||
//passedEntityNames.add("ProductKeyword");
|
||||
}
|
||||
|
||||
if (UtilValidate.isNotEmpty(entitySyncId)) {
|
||||
passedEntityNames = org.ofbiz.entityext.synchronization.EntitySyncContext.getEntitySyncModelNamesToUse(dispatcher, entitySyncId);
|
||||
}
|
||||
boolean checkAll = "true".equals(request.getParameter("checkAll"));
|
||||
boolean tobrowser = request.getParameter("tobrowser")!=null?true:false;
|
||||
context.put("tobrowser", tobrowser);
|
||||
|
||||
EntityExpr entityFromCond = null;
|
||||
EntityExpr entityThruCond = null;
|
||||
EntityExpr entityDateCond = null;
|
||||
if (UtilValidate.isNotEmpty(entityFrom)) {
|
||||
entityFromCond = EntityCondition.makeCondition("lastUpdatedTxStamp", EntityComparisonOperator.GREATER_THAN, entityFrom);
|
||||
}
|
||||
if (UtilValidate.isNotEmpty(entityThru)) {
|
||||
entityThruCond = EntityCondition.makeCondition("lastUpdatedTxStamp", EntityComparisonOperator.LESS_THAN, entityThru);
|
||||
}
|
||||
if ((entityFromCond!=null) && (entityThruCond!=null)) {
|
||||
entityDateCond = EntityCondition.makeCondition(entityFromCond, EntityJoinOperator.AND, entityThruCond);
|
||||
} else if(entityFromCond!=null) {
|
||||
entityDateCond = entityFromCond;
|
||||
} else if(entityThruCond!=null) {
|
||||
entityDateCond = entityThruCond;
|
||||
}
|
||||
|
||||
ModelReader reader = delegator.getModelReader();
|
||||
Collection ec = reader.getEntityNames();
|
||||
TreeSet entityNames = new TreeSet(ec);
|
||||
context.put("entityNames", entityNames);
|
||||
|
||||
if (tobrowser) {
|
||||
session.setAttribute("xmlrawdump_entitylist", entityName);
|
||||
session.setAttribute("entityDateCond", entityDateCond);
|
||||
} else {
|
||||
EntityFindOptions efo = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true);
|
||||
ModelReader reader = delegator.getModelReader();
|
||||
Collection ec = reader.getEntityNames();
|
||||
TreeSet entityNames = new TreeSet(ec);
|
||||
context.put("entityNames", entityNames);
|
||||
int numberOfEntities = passedEntityNames.size();
|
||||
context.put("numberOfEntities", Integer.toString(numberOfEntities));
|
||||
long numberWritten = 0;
|
||||
|
||||
// single file
|
||||
if(filename != null && filename.length() > 0 && numberOfEntities > 0) {
|
||||
PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF-8")));
|
||||
writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||
writer.println("<entity-engine-xml>");
|
||||
|
||||
Iterator i = passedEntityNames.iterator();
|
||||
while(i.hasNext()) {
|
||||
String curEntityName = (String) i.next();
|
||||
if (UtilValidate.isNotEmpty(entityFrom)) {
|
||||
curModelEntity = reader.getModelEntity(curEntityName);
|
||||
if (curModelEntity instanceof ModelViewEntity) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
boolean beganTransaction = TransactionUtil.begin(3600);
|
||||
try {
|
||||
ModelEntity me = reader.getModelEntity(curEntityName);
|
||||
EntityListIterator values = null;
|
||||
if (me.getNoAutoStamp() == true) {
|
||||
values = delegator.find(curEntityName, null, null, null, me.getPkFieldNames(), efo);
|
||||
} else {
|
||||
values = delegator.find(curEntityName, entityDateCond, null, null, UtilMisc.toList("-createdTxStamp"), efo);
|
||||
}
|
||||
|
||||
GenericValue value = null;
|
||||
long curNumberWritten = 0;
|
||||
while ((value = (GenericValue) values.next()) != null) {
|
||||
value.writeXmlText(writer, "");
|
||||
numberWritten++;
|
||||
curNumberWritten++;
|
||||
if (curNumberWritten % 500 == 0 || curNumberWritten == 1) {
|
||||
Debug.log("Records written [" + curEntityName + "]: " + curNumberWritten + " Total: " + numberWritten);
|
||||
}
|
||||
}
|
||||
values.close();
|
||||
Debug.log("Wrote [" + curNumberWritten + "] from entity : " + curEntityName);
|
||||
TransactionUtil.commit(beganTransaction);
|
||||
} catch (Exception e) {
|
||||
String errMsg = "Error reading data for XML export:";
|
||||
Debug.logError(e, errMsg, "JSP");
|
||||
TransactionUtil.rollback(beganTransaction, errMsg, e);
|
||||
}
|
||||
}
|
||||
writer.println("</entity-engine-xml>");
|
||||
writer.close();
|
||||
Debug.log("Total records written from all entities: " + numberWritten);
|
||||
context.put("numberWritten", Long.toString(numberWritten));
|
||||
}
|
||||
|
||||
// multiple files in a directory
|
||||
Collection results = new ArrayList();
|
||||
int fileNumber = 1;
|
||||
context.put("results", results);
|
||||
if (outpath != null){
|
||||
File outdir = new File(outpath);
|
||||
if(!outdir.exists()){
|
||||
outdir.mkdir();
|
||||
}
|
||||
if(outdir.isDirectory() && outdir.canWrite()) {
|
||||
Iterator i= passedEntityNames.iterator();
|
||||
|
||||
while(i.hasNext()) {
|
||||
numberWritten = 0;
|
||||
String curEntityName = (String)i.next();
|
||||
String fileName = preConfiguredSetName != null ? UtilFormatOut.formatPaddedNumber((long) fileNumber, 3) + "_" : "";
|
||||
fileName = fileName + curEntityName;
|
||||
|
||||
EntityListIterator values = null;
|
||||
boolean beganTransaction = false;
|
||||
try{
|
||||
beganTransaction = TransactionUtil.begin(3600);
|
||||
|
||||
ModelEntity me = delegator.getModelEntity(curEntityName);
|
||||
if (me instanceof ModelViewEntity) {
|
||||
results.add("["+fileNumber +"] [vvv] " + curEntityName + " skipping view entity");
|
||||
continue;
|
||||
}
|
||||
if (me.getNoAutoStamp() == true) {
|
||||
values = delegator.find(curEntityName, null, null, null, me.getPkFieldNames(), efo);
|
||||
} else {
|
||||
values = delegator.find(curEntityName, entityDateCond, null, null, me.getPkFieldNames(), efo);
|
||||
}
|
||||
boolean isFirst = true;
|
||||
PrintWriter writer = null;
|
||||
int fileSplitNumber = 1;
|
||||
GenericValue value = null;
|
||||
while ((value = (GenericValue) values.next()) != null) {
|
||||
//Don't bother writing the file if there's nothing
|
||||
//to put into it
|
||||
if (isFirst) {
|
||||
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(outdir, fileName +".xml")), "UTF-8")));
|
||||
writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||
writer.println("<entity-engine-xml>");
|
||||
isFirst = false;
|
||||
}
|
||||
value.writeXmlText(writer, "");
|
||||
numberWritten++;
|
||||
|
||||
// split into small files
|
||||
if ((maxRecordsPerFile > 0) && (numberWritten % maxRecordsPerFile == 0)) {
|
||||
fileSplitNumber++;
|
||||
// close the file
|
||||
writer.println("</entity-engine-xml>");
|
||||
writer.close();
|
||||
|
||||
// create a new file
|
||||
String splitNumStr = UtilFormatOut.formatPaddedNumber((long) fileSplitNumber, 3);
|
||||
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(outdir, fileName + "_" + splitNumStr +".xml")), "UTF-8")));
|
||||
writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||
writer.println("<entity-engine-xml>");
|
||||
}
|
||||
|
||||
if (numberWritten % 500 == 0 || numberWritten == 1) {
|
||||
Debug.log("Records written [" + curEntityName + "]: " + numberWritten);
|
||||
}
|
||||
|
||||
}
|
||||
if (writer != null) {
|
||||
writer.println("</entity-engine-xml>");
|
||||
writer.close();
|
||||
String thisResult = "["+fileNumber +"] [" + numberWritten + "] " + curEntityName + " wrote " + numberWritten + " records";
|
||||
Debug.log(thisResult);
|
||||
results.add(thisResult);
|
||||
} else {
|
||||
String thisResult = "["+fileNumber +"] [---] " + curEntityName + " has no records, not writing file";
|
||||
Debug.log(thisResult);
|
||||
results.add(thisResult);
|
||||
}
|
||||
values.close();
|
||||
} catch (Exception ex) {
|
||||
if (values != null) {
|
||||
values.close();
|
||||
}
|
||||
String thisResult = "["+fileNumber +"] [xxx] Error when writing " + curEntityName + ": " + ex;
|
||||
Debug.log(thisResult);
|
||||
results.add(thisResult);
|
||||
TransactionUtil.rollback(beganTransaction, thisResult, ex);
|
||||
} finally {
|
||||
// only commit the transaction if we started one... this will throw an exception if it fails
|
||||
TransactionUtil.commit(beganTransaction);
|
||||
}
|
||||
fileNumber++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.spi.LoggerRepository;
|
||||
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.base.util.UtilMisc;
|
||||
import org.ofbiz.entity.util.EntityUtil;
|
||||
|
||||
|
||||
Logger rootLogger = Logger.getRootLogger();
|
||||
LoggerRepository loggerRepository = rootLogger.getLoggerRepository();
|
||||
|
||||
List loggerList = UtilMisc.toListArray(new Object[0]);
|
||||
for (Enumeration enumeration = loggerRepository.getCurrentLoggers(); enumeration.hasMoreElements() ;) {
|
||||
Logger logger = (Logger) enumeration.nextElement();
|
||||
|
||||
if (logger.getLevel() != null) {
|
||||
Map loggerMap = UtilMisc.toMap("name", logger.getName(), "level", logger.getLevel(), "additivity", logger.getAdditivity() ? "Y" : "N", "logger", logger);
|
||||
loggerList.add(loggerMap);
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(loggerList, new Comparator() {
|
||||
int compare(Object l1, Object l2) {
|
||||
Map loggerMap1 = (Map) l1;
|
||||
Map loggerMap2 = (Map) l2;
|
||||
String name1 = (String)l1.get("name");
|
||||
String name2 = (String)l2.get("name");
|
||||
return name1.compareTo(name2);
|
||||
}
|
||||
});
|
||||
|
||||
loggerList.add(0, UtilMisc.toMap("name", rootLogger.getName(), "level", rootLogger.getLevel(), "additivity", rootLogger.getAdditivity() ? "Y" : "N", "logger", rootLogger));
|
||||
context.put("loggerList", loggerList);
|
||||
|
||||
context.put("defaultLogger", UtilMisc.toMap("name", "org.ofbiz.", "level", "INFO", "additivity", "Y"));
|
||||
context.put("activeDebugLevel", UtilMisc.toMap(new String[] {"fatal", Debug.fatalOn() ? "Y" : "N",
|
||||
"error", Debug.errorOn() ? "Y" : "N",
|
||||
"warning", Debug.warningOn() ? "Y" : "N",
|
||||
"important", Debug.importantOn() ? "Y" : "N",
|
||||
"info", Debug.infoOn() ? "Y" : "N",
|
||||
"timing", Debug.timingOn() ? "Y" : "N",
|
||||
"verbose", Debug.verboseOn() ? "Y" : "N"}));
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.spi.LoggerRepository;
|
||||
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.base.util.UtilMisc;
|
||||
import org.ofbiz.entity.util.EntityUtil;
|
||||
|
||||
|
||||
rootLogger = Logger.getRootLogger();
|
||||
loggerRepository = rootLogger.getLoggerRepository();
|
||||
|
||||
loggerList = [];
|
||||
for (Enumeration enumeration = loggerRepository.getCurrentLoggers(); enumeration.hasMoreElements();) {
|
||||
logger = enumeration.nextElement();
|
||||
|
||||
if (logger.getLevel() != null) {
|
||||
loggerMap = [name : logger.getName(), level : logger.getLevel(), additivity : logger.getAdditivity() ? "Y" : "N", logger : logger];
|
||||
loggerList.add(loggerMap);
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(loggerList, [compare: {l1, l2 -> l1.name.compareTo(l2.name)}] as Comparator);
|
||||
|
||||
loggerList.add(0, [name : rootLogger.getName(), level : rootLogger.getLevel(), additivity : rootLogger.getAdditivity() ? "Y" : "N", logger : rootLogger]);
|
||||
context.loggerList = loggerList;
|
||||
|
||||
context.defaultLogger = [name : "org.ofbiz.", level : "INFO", additivity : "Y"];
|
||||
context.activeDebugLevel = [fatal : Debug.fatalOn() ? "Y" : "N",
|
||||
error : Debug.errorOn() ? "Y" : "N",
|
||||
warning : Debug.warningOn() ? "Y" : "N",
|
||||
important : Debug.importantOn() ? "Y" : "N",
|
||||
info : Debug.infoOn() ? "Y" : "N",
|
||||
timing : Debug.timingOn() ? "Y" : "N",
|
||||
verbose : Debug.verboseOn() ? "Y" : "N"];
|
||||
+3
-3
@@ -19,10 +19,10 @@
|
||||
|
||||
import org.ofbiz.base.util.FileUtil;
|
||||
|
||||
StringBuffer sb = null;
|
||||
sb = null;
|
||||
try {
|
||||
sb = FileUtil.readTextFile(logFileName, true);
|
||||
} catch(Exception exc) {}
|
||||
if (sb != null) {
|
||||
context.put("logFileContent", sb.toString());
|
||||
if (sb) {
|
||||
context.logFileContent = sb.toString();
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
import java.net.*;
|
||||
import org.ofbiz.security.*;
|
||||
import org.ofbiz.entity.*;
|
||||
import org.ofbiz.base.util.*;
|
||||
|
||||
String findOrganizationPartyId = request.getParameter("findOrganizationPartyId");
|
||||
if (UtilValidate.isNotEmpty(findOrganizationPartyId)) {
|
||||
context.put("findOrganizationPartyId", findOrganizationPartyId);
|
||||
}
|
||||
|
||||
String currentCustomTimePeriodId = request.getParameter("currentCustomTimePeriodId");
|
||||
if (UtilValidate.isNotEmpty(currentCustomTimePeriodId)) {
|
||||
context.put("currentCustomTimePeriodId", currentCustomTimePeriodId);
|
||||
}
|
||||
|
||||
GenericValue currentCustomTimePeriod = currentCustomTimePeriodId == null ? null : delegator.findByPrimaryKey("CustomTimePeriod", UtilMisc.toMap("customTimePeriodId", currentCustomTimePeriodId));
|
||||
if (currentCustomTimePeriod != null) {
|
||||
context.put("currentCustomTimePeriod", currentCustomTimePeriod);
|
||||
}
|
||||
|
||||
GenericValue currentPeriodType = currentCustomTimePeriod == null ? null : currentCustomTimePeriod.getRelatedOneCache("PeriodType");
|
||||
if (currentPeriodType != null) {
|
||||
context.put("currentPeriodType", currentPeriodType);
|
||||
}
|
||||
|
||||
Map findMap = UtilMisc.toMap("organizationPartyId", findOrganizationPartyId);
|
||||
if (UtilValidate.isNotEmpty(currentCustomTimePeriodId)) {
|
||||
findMap.put("parentPeriodId", currentCustomTimePeriodId);
|
||||
}
|
||||
|
||||
List customTimePeriods = delegator.findByAnd("CustomTimePeriod", findMap,
|
||||
UtilMisc.toList("periodTypeId", "periodNum", "fromDate"));
|
||||
if (customTimePeriods != null) {
|
||||
context.put("customTimePeriods", customTimePeriods);
|
||||
}
|
||||
|
||||
List allCustomTimePeriods = delegator.findList("CustomTimePeriod", null, null, UtilMisc.toList("organizationPartyId", "parentPeriodId", "periodTypeId", "periodNum", "fromDate"), null, false);
|
||||
if (allCustomTimePeriods != null) {
|
||||
context.put("allCustomTimePeriods", allCustomTimePeriods);
|
||||
}
|
||||
|
||||
List periodTypes = delegator.findList("PeriodType", null, null, UtilMisc.toList("description"), null, true);
|
||||
if (periodTypes != null) {
|
||||
context.put("periodTypes", periodTypes);
|
||||
}
|
||||
|
||||
String newPeriodTypeId = "FISCAL_YEAR";
|
||||
if (currentCustomTimePeriod != null && "FISCAL_YEAR".equals(currentCustomTimePeriod.getString("periodTypeId"))) {
|
||||
newPeriodTypeId = "FISCAL_QUARTER";
|
||||
}
|
||||
if (currentCustomTimePeriod != null && "FISCAL_QUARTER".equals(currentCustomTimePeriod.getString("periodTypeId"))) {
|
||||
newPeriodTypeId = "FISCAL_MONTH";
|
||||
}
|
||||
if (currentCustomTimePeriod != null && "FISCAL_MONTH".equals(currentCustomTimePeriod.getString("periodTypeId"))) {
|
||||
newPeriodTypeId = "FISCAL_WEEK";
|
||||
}
|
||||
if (currentCustomTimePeriod != null && "FISCAL_BIWEEK".equals(currentCustomTimePeriod.getString("periodTypeId"))) {
|
||||
newPeriodTypeId = "FISCAL_WEEK";
|
||||
}
|
||||
if (currentCustomTimePeriod != null && "FISCAL_WEEK".equals(currentCustomTimePeriod.getString("periodTypeId"))) {
|
||||
newPeriodTypeId = "";
|
||||
}
|
||||
|
||||
context.put("newPeriodTypeId", newPeriodTypeId);
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
import java.net.*;
|
||||
import org.ofbiz.security.*;
|
||||
import org.ofbiz.entity.*;
|
||||
import org.ofbiz.base.util.*;
|
||||
|
||||
findOrganizationPartyId = parameters.findOrganizationPartyId;
|
||||
if (findOrganizationPartyId) {
|
||||
context.findOrganizationPartyId = findOrganizationPartyId;
|
||||
}
|
||||
|
||||
currentCustomTimePeriodId = parameters.currentCustomTimePeriodId;
|
||||
if (currentCustomTimePeriodId) {
|
||||
context.currentCustomTimePeriodId = currentCustomTimePeriodId;
|
||||
}
|
||||
|
||||
currentCustomTimePeriod = currentCustomTimePeriodId ? delegator.findByPrimaryKey("CustomTimePeriod", [customTimePeriodId : currentCustomTimePeriodId]) : null;
|
||||
if (currentCustomTimePeriod) {
|
||||
context.currentCustomTimePeriod = currentCustomTimePeriod;
|
||||
}
|
||||
|
||||
currentPeriodType = currentCustomTimePeriod ? currentCustomTimePeriod.getRelatedOneCache("PeriodType") : null;
|
||||
if (currentPeriodType) {
|
||||
context.currentPeriodType = currentPeriodType;
|
||||
}
|
||||
|
||||
findMap = [organizationPartyId : findOrganizationPartyId];
|
||||
if (currentCustomTimePeriodId) {
|
||||
findMap.parentPeriodId = currentCustomTimePeriodId;
|
||||
}
|
||||
|
||||
customTimePeriods = delegator.findByAnd("CustomTimePeriod", findMap, ["periodTypeId", "periodNum", "fromDate"]);
|
||||
context.customTimePeriods = customTimePeriods;
|
||||
|
||||
allCustomTimePeriods = delegator.findList("CustomTimePeriod", null, null, ["organizationPartyId", "parentPeriodId", "periodTypeId", "periodNum", "fromDate"], null, false);
|
||||
context.allCustomTimePeriods = allCustomTimePeriods;
|
||||
|
||||
periodTypes = delegator.findList("PeriodType", null, null, ["description"], null, true);
|
||||
context.periodTypes = periodTypes;
|
||||
|
||||
newPeriodTypeId = "FISCAL_YEAR";
|
||||
if ("FISCAL_YEAR".equals(currentCustomTimePeriod?.periodTypeId)) {
|
||||
newPeriodTypeId = "FISCAL_QUARTER";
|
||||
}
|
||||
if ("FISCAL_QUARTER".equals(currentCustomTimePeriod?.periodTypeId)) {
|
||||
newPeriodTypeId = "FISCAL_MONTH";
|
||||
}
|
||||
if ("FISCAL_MONTH".equals(currentCustomTimePeriod?.periodTypeId)) {
|
||||
newPeriodTypeId = "FISCAL_WEEK";
|
||||
}
|
||||
if ("FISCAL_BIWEEK".equals(currentCustomTimePeriod?.periodTypeId)) {
|
||||
newPeriodTypeId = "FISCAL_WEEK";
|
||||
}
|
||||
if ("FISCAL_WEEK".equals(currentCustomTimePeriod?.periodTypeId)) {
|
||||
newPeriodTypeId = "";
|
||||
}
|
||||
|
||||
context.newPeriodTypeId = newPeriodTypeId;
|
||||
@@ -0,0 +1,540 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
import javax.wsdl.WSDLException;
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.base.util.UtilXml;
|
||||
import org.ofbiz.base.util.UtilProperties;
|
||||
import org.ofbiz.service.eca.ServiceEcaUtil;
|
||||
import org.ofbiz.service.ModelPermGroup;
|
||||
import org.ofbiz.service.ModelPermission;
|
||||
import org.ofbiz.base.util.UtilHttp;
|
||||
import org.ofbiz.base.util.UtilProperties;
|
||||
|
||||
List getEcaListForService(String selectedService){
|
||||
ecaMap = org.ofbiz.service.eca.ServiceEcaUtil.getServiceEventMap(selectedService);
|
||||
|
||||
if (!ecaMap) return null;
|
||||
|
||||
//ecaMap is a HashMap so get keyset & iterate
|
||||
ecaMapList = [];
|
||||
|
||||
ecaMap.each { ecaKey, ecaValue ->
|
||||
ecaValue.each { curRule ->
|
||||
curRuleMap = [:];
|
||||
|
||||
curRuleMap.ruleKey = ecaKey;
|
||||
|
||||
curRuleClass = curRule.getClass();
|
||||
|
||||
//event name for rule
|
||||
eventName = curRuleClass.getDeclaredField("eventName");
|
||||
eventName.setAccessible(true);
|
||||
eventNameVal = eventName.get(curRule);
|
||||
if (eventNameVal) {
|
||||
curRuleMap.eventName = eventNameVal as String;
|
||||
}
|
||||
eventName.setAccessible(false);
|
||||
|
||||
//runOnError
|
||||
runOnError = curRuleClass.getDeclaredField("runOnError");
|
||||
runOnError.setAccessible(true);
|
||||
runOnErrorVal = runOnError.get(curRule);
|
||||
if (runOnErrorVal) {
|
||||
curRuleMap.runOnError = runOnErrorVal as String;
|
||||
}
|
||||
runOnError.setAccessible(false);
|
||||
|
||||
//runOnFailure
|
||||
runOnFailure = curRuleClass.getDeclaredField("runOnFailure");
|
||||
runOnFailure.setAccessible(true);
|
||||
runOnFailureVal = runOnFailure.get(curRule);
|
||||
if (runOnFailureVal) {
|
||||
curRuleMap.runOnFailure = runOnFailureVal as String;
|
||||
}
|
||||
runOnFailure.setAccessible(false);
|
||||
|
||||
//extract actions
|
||||
actions = curRuleClass.getDeclaredField("actionsAndSets");
|
||||
actions.setAccessible(true);
|
||||
actionsVal = actions.get(curRule);
|
||||
if (actionsVal) {
|
||||
actionsList = new ArrayList(actionsVal.size());
|
||||
actionsVal.each { curAction ->
|
||||
actionMap = [:];
|
||||
actionClass = curAction.getClass();
|
||||
|
||||
//eventName
|
||||
eventName = actionClass.getDeclaredField("eventName");
|
||||
eventName.setAccessible(true);
|
||||
eventNameVal = eventName.get(curAction);
|
||||
if (eventNameVal) {
|
||||
actionMap.eventName = eventNameVal as String;
|
||||
}
|
||||
eventName.setAccessible(false);
|
||||
|
||||
//ignoreError
|
||||
ignoreError = actionClass.getDeclaredField("ignoreError");
|
||||
ignoreError.setAccessible(true);
|
||||
ignoreErrorVal = ignoreError.get(curAction);
|
||||
if (ignoreErrorVal) {
|
||||
actionMap.ignoreError = ignoreErrorVal as String;
|
||||
}
|
||||
ignoreError.setAccessible(false);
|
||||
|
||||
//ignoreFailure
|
||||
ignoreFailure = actionClass.getDeclaredField("ignoreFailure");
|
||||
ignoreFailure.setAccessible(true);
|
||||
ignoreFailureVal = ignoreFailure.get(curAction);
|
||||
if (ignoreFailureVal) {
|
||||
actionMap.ignoreFailure = ignoreFailureVal as String;
|
||||
}
|
||||
ignoreFailure.setAccessible(false);
|
||||
|
||||
//persist
|
||||
persist = actionClass.getDeclaredField("persist");
|
||||
persist.setAccessible(true);
|
||||
persistVal = persist.get(curAction);
|
||||
if (persistVal) {
|
||||
actionMap.persist = persistVal as String;
|
||||
}
|
||||
persist.setAccessible(false);
|
||||
|
||||
//resultMapName
|
||||
resultMapName = actionClass.getDeclaredField("resultMapName");
|
||||
resultMapName.setAccessible(true);
|
||||
resultMapNameVal = resultMapName.get(curAction);
|
||||
if (resultMapNameVal) {
|
||||
actionMap.resultMapName = resultMapNameVal as String;
|
||||
}
|
||||
resultMapName.setAccessible(false);
|
||||
|
||||
//resultToContext
|
||||
resultToContext = actionClass.getDeclaredField("resultToContext");
|
||||
resultToContext.setAccessible(true);
|
||||
resultToContextVal = resultToContext.get(curAction);
|
||||
if (resultToContextVal) {
|
||||
actionMap.resultToContext = resultToContextVal as String;
|
||||
}
|
||||
resultToContext.setAccessible(false);
|
||||
|
||||
//resultToResult
|
||||
resultToResult = actionClass.getDeclaredField("resultToResult");
|
||||
resultToResult.setAccessible(true);
|
||||
resultToResultVal = resultToResult.get(curAction);
|
||||
if (resultToResultVal) {
|
||||
actionMap.resultToResult = resultToResultVal as String;
|
||||
}
|
||||
resultToResult.setAccessible(false);
|
||||
|
||||
//serviceMode
|
||||
serviceMode = actionClass.getDeclaredField("serviceMode");
|
||||
serviceMode.setAccessible(true);
|
||||
serviceModeVal = serviceMode.get(curAction);
|
||||
if (serviceModeVal) {
|
||||
actionMap.serviceMode = serviceModeVal as String;
|
||||
}
|
||||
serviceMode.setAccessible(false);
|
||||
|
||||
//serviceName
|
||||
serviceName = actionClass.getDeclaredField("serviceName");
|
||||
serviceName.setAccessible(true);
|
||||
serviceNameVal = serviceName.get(curAction);
|
||||
if (serviceNameVal) {
|
||||
actionMap.serviceName = serviceNameVal as String;
|
||||
}
|
||||
serviceName.setAccessible(false);
|
||||
|
||||
actionsList.add(actionMap);
|
||||
}
|
||||
|
||||
curRuleMap.actions = actionsList;
|
||||
}
|
||||
actions.setAccessible(true);
|
||||
|
||||
//extract conditions
|
||||
conditions = curRuleClass.getDeclaredField("conditions");
|
||||
conditions.setAccessible(true);
|
||||
conditionsVal = conditions.get(curRule);
|
||||
if (conditionsVal) {
|
||||
curRuleMap.conditions = runOnFailureVal as String;
|
||||
condList = new ArrayList(conditionsVal.size());
|
||||
conditionsVal.each { condVal ->
|
||||
condValClass = condVal.getClass();
|
||||
condMap = [:];
|
||||
|
||||
//compareType
|
||||
compareType = condValClass.getDeclaredField("compareType");
|
||||
compareType.setAccessible(true);
|
||||
compareTypeVal = compareType.get(condVal);
|
||||
if (compareTypeVal) {
|
||||
condMap.compareType = compareTypeVal as String;
|
||||
}
|
||||
compareType.setAccessible(false);
|
||||
|
||||
//conditionService
|
||||
conditionService = condValClass.getDeclaredField("conditionService");
|
||||
conditionService.setAccessible(true);
|
||||
conditionServiceVal = conditionService.get(condVal);
|
||||
if (conditionServiceVal) {
|
||||
condMap.conditionService = conditionServiceVal as String;
|
||||
}
|
||||
conditionService.setAccessible(false);
|
||||
|
||||
//format
|
||||
format = condValClass.getDeclaredField("format");
|
||||
format.setAccessible(true);
|
||||
formatVal = format.get(condVal);
|
||||
if (formatVal) {
|
||||
condMap.format = formatVal as String;
|
||||
}
|
||||
format.setAccessible(false);
|
||||
|
||||
//isConstant
|
||||
isConstant = condValClass.getDeclaredField("isConstant");
|
||||
isConstant.setAccessible(true);
|
||||
isConstantVal = isConstant.get(condVal);
|
||||
if (isConstantVal) {
|
||||
condMap.isConstant = isConstantVal as String;
|
||||
}
|
||||
isConstant.setAccessible(false);
|
||||
|
||||
//isService
|
||||
isService = condValClass.getDeclaredField("isService");
|
||||
isService.setAccessible(true);
|
||||
isServiceVal = isService.get(condVal);
|
||||
if (isServiceVal) {
|
||||
condMap.isService = isServiceVal as String;
|
||||
}
|
||||
isService.setAccessible(false);
|
||||
|
||||
//lhsMapName
|
||||
lhsMapName = condValClass.getDeclaredField("lhsMapName");
|
||||
lhsMapName.setAccessible(true);
|
||||
lhsMapNameVal = lhsMapName.get(condVal);
|
||||
if (lhsMapNameVal) {
|
||||
condMap.lhsMapName = lhsMapNameVal as String;
|
||||
}
|
||||
lhsMapName.setAccessible(false);
|
||||
|
||||
//lhsValueName
|
||||
lhsValueName = condValClass.getDeclaredField("lhsValueName");
|
||||
lhsValueName.setAccessible(true);
|
||||
lhsValueNameVal = lhsValueName.get(condVal);
|
||||
if (lhsValueNameVal){
|
||||
condMap.lhsValueName = lhsValueNameVal as String;
|
||||
}
|
||||
lhsValueName.setAccessible(false);
|
||||
|
||||
//operator
|
||||
operator = condValClass.getDeclaredField("operator");
|
||||
operator.setAccessible(true);
|
||||
operatorVal = operator.get(condVal);
|
||||
if (operatorVal) {
|
||||
condMap.operator = operatorVal as String;
|
||||
}
|
||||
operator.setAccessible(false);
|
||||
|
||||
//rhsMapName
|
||||
rhsMapName = condValClass.getDeclaredField("rhsMapName");
|
||||
rhsMapName.setAccessible(true);
|
||||
rhsMapNameVal = rhsMapName.get(condVal);
|
||||
if (rhsMapNameVal){
|
||||
condMap.rhsMapName = rhsMapNameVal as String;
|
||||
}
|
||||
rhsMapName.setAccessible(false);
|
||||
|
||||
//rhsValueName
|
||||
rhsValueName = condValClass.getDeclaredField("rhsValueName");
|
||||
rhsValueName.setAccessible(true);
|
||||
rhsValueNameVal = rhsValueName.get(condVal);
|
||||
if (rhsValueNameVal){
|
||||
condMap.rhsValueName = rhsValueNameVal as String;
|
||||
}
|
||||
rhsValueName.setAccessible(false);
|
||||
|
||||
condList.add(condMap);
|
||||
}
|
||||
curRuleMap.conditions = condList;
|
||||
}
|
||||
conditions.setAccessible(false);
|
||||
|
||||
ecaMapList.add(curRuleMap);
|
||||
}
|
||||
}
|
||||
return ecaMapList;
|
||||
}
|
||||
|
||||
|
||||
/*Local Dispatchers
|
||||
accounting, content, ecommerce, manufacturing, marketing, ordermgr, partymgr, catalog, facility, workeffort, example, WFDispatcher, webtools, order, wholesale, salesrep, hotelbackend, community
|
||||
*/
|
||||
//Ashish: Don't know how to get list of available dispatchers, so hardcoded. Add to this list if I missed some.
|
||||
dispArrList = ["accounting",
|
||||
"content",
|
||||
"ecommerce",
|
||||
"manufacturing",
|
||||
"marketing",
|
||||
"order",
|
||||
"partymgr",
|
||||
"catalog",
|
||||
"facility",
|
||||
"workeffort",
|
||||
"example",
|
||||
"WFDispatcher",
|
||||
"webtools",
|
||||
"wholesale",
|
||||
"salesrep",
|
||||
"hotelbackend",
|
||||
"community"];
|
||||
Collections.sort(dispArrList);
|
||||
context.dispArrList = dispArrList;
|
||||
|
||||
uiLabelMap = UtilProperties.getResourceBundleMap("WebtoolsUiLabels", locale);
|
||||
uiLabelMap.addBottomResourceBundle("CommonUiLabels");
|
||||
|
||||
selDisp = parameters.selDisp ?: "partymgr";
|
||||
|
||||
curLocalDispatcher = dispatcher.getLocalDispatcher(selDisp, delegator);
|
||||
curDispatchContext = curLocalDispatcher.getDispatchContext();
|
||||
context.dispatcherName = curLocalDispatcher.getName();
|
||||
|
||||
selectedService = parameters.sel_service_name;
|
||||
|
||||
if (selectedService) {
|
||||
curServiceMap = [:];
|
||||
|
||||
curServiceMap.serviceName = selectedService;
|
||||
curServiceModel = curDispatchContext.getModelService(selectedService);
|
||||
curServiceMap.description = curServiceModel.description;
|
||||
|
||||
if (curServiceModel) {
|
||||
|
||||
engineName = curServiceModel.engineName ?: "NA";
|
||||
defaultEntityName = curServiceModel.defaultEntityName ?: "NA";
|
||||
export = curServiceModel.export ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse;
|
||||
permissionGroups = curServiceModel.permissionGroups ?: "NA";
|
||||
implServices = curServiceModel.implServices ?: "NA";
|
||||
overrideParameters = curServiceModel.overrideParameters;
|
||||
useTrans = curServiceModel.useTransaction ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse;
|
||||
maxRetry = curServiceModel.maxRetry;
|
||||
|
||||
//Test for ECA's
|
||||
ecaMapList = getEcaListForService(selectedService);
|
||||
if (ecaMapList) {
|
||||
context.ecaMapList = ecaMapList;
|
||||
}
|
||||
//End Test for ECA's
|
||||
|
||||
invoke = curServiceModel.invoke ?: "NA";
|
||||
location = curServiceModel.location ?: "NA";
|
||||
requireNewTransaction = curServiceModel.requireNewTransaction ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse;
|
||||
|
||||
curServiceMap.engineName = engineName;
|
||||
curServiceMap.defaultEntityName = defaultEntityName;
|
||||
curServiceMap.invoke = invoke;
|
||||
curServiceMap.location = location;
|
||||
curServiceMap.requireNewTransaction = requireNewTransaction;
|
||||
curServiceMap.export = export;
|
||||
|
||||
if(permissionGroups && !permissionGroups.equals("NA")){
|
||||
permList = new ArrayList(permissionGroups.size());
|
||||
permissionGroups.each { curPerm -> //This is a ModelPermGroup
|
||||
curPerm.permissions.each { curPermObj ->
|
||||
permObj = [:];
|
||||
permObj.action = curPermObj.action;
|
||||
permType = curPermObj.permissionType;
|
||||
if (permType == 1) {
|
||||
permType = "Simple Permission";
|
||||
} else if (permType == 2) {
|
||||
permType = "Entity Permission";
|
||||
} else if (permType == 3) {
|
||||
permType = "Role Member";
|
||||
}
|
||||
permObj.permType = permType;
|
||||
permObj.nameOrRole = curPermObj.nameOrRole;
|
||||
permList.add(permObj);
|
||||
}
|
||||
}
|
||||
curServiceMap.permissionGroups = permList;
|
||||
} else {
|
||||
curServiceMap.permissionGroups = permissionGroups;
|
||||
}
|
||||
|
||||
curServiceMap.implServices = implServices;
|
||||
curServiceMap.useTrans = useTrans;
|
||||
curServiceMap.maxRetry = maxRetry;
|
||||
|
||||
allParamsList = new ArrayList(3);
|
||||
|
||||
inParams = curServiceModel.getInParamNames();
|
||||
inParamsList = new ArrayList(inParams.size());
|
||||
imParams.each { paramName ->
|
||||
curParam = curServiceModel.getParam(paramName);
|
||||
curInParam = [:];
|
||||
curInParam.entityName = curParam.entityName;
|
||||
curInParam.fieldName = curParam.fieldName;
|
||||
curInParam.internal = curParam.internal ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse;
|
||||
curInParam.mode = curParam.mode;
|
||||
curInParam.name = curParam.name;
|
||||
curInParam.optional = curParam.optional ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse;
|
||||
curInParam.type = curParam.type;
|
||||
inParamsList.add(curInParam);
|
||||
}
|
||||
inParamMap = [:];
|
||||
inParamMap.title = uiLabelMap.WebtoolsInParameters;
|
||||
inParamMap.paramList = inParamsList;
|
||||
allParamsList.add(inParamMap);
|
||||
|
||||
outParams = curServiceModel.getOutParamNames();
|
||||
outParamsList = new ArrayList(outParams.size());
|
||||
outParams.each { paramName ->
|
||||
curParam = curServiceModel.getParam(paramName);
|
||||
curOutParam = [:];
|
||||
curOutParam.entityName = curParam.entityName;
|
||||
curOutParam.fieldName = curParam.fieldName;
|
||||
curOutParam.internal = curParam.internal ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse;
|
||||
curOutParam.mode = curParam.mode;
|
||||
curOutParam.name = curParam.name;
|
||||
curOutParam.optional = curParam.optional ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse;
|
||||
curOutParam.type = curParam.type;
|
||||
outParamsList.add(curOutParam);
|
||||
}
|
||||
outParamMap = [:];
|
||||
outParamMap.title = uiLabelMap.get("WebtoolsOutParameters");
|
||||
outParamMap.paramList = outParamsList;
|
||||
allParamsList.add(outParamMap);
|
||||
|
||||
if (overrideParameters) {
|
||||
ovrPrmList = new ArrayList(overrideParameters.size());
|
||||
overrideParameters.each { curParam ->
|
||||
curOvrPrm = [:];
|
||||
curOvrPrm.entityName = curParam.entityName;
|
||||
curOvrPrm.fieldName = curParam.fieldName;
|
||||
curOvrPrm.internal = curParam.internal ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse;
|
||||
curOvrPrm.mode = curParam.mode;
|
||||
curOvrPrm.name = curParam.name;
|
||||
curOvrPrm.optional = curParam.optional ? uiLabelMap.CommonTrue : uiLabelMap.CommonFalse;
|
||||
curOvrPrm.type = curParam.type;
|
||||
ovrPrmList.add(curOvrPrm);
|
||||
}
|
||||
ovrParamMap = [:];
|
||||
ovrParamMap.title = "Override parameters";
|
||||
ovrParamMap.paramList = ovrPrmList;
|
||||
allParamsList.add(ovrParamMap);
|
||||
}
|
||||
curServiceMap.allParamsList = allParamsList;
|
||||
}
|
||||
|
||||
showWsdl = parameters.show_wsdl;
|
||||
|
||||
if(showWsdl?.equals("true")) {
|
||||
try {
|
||||
wsdl = curServiceModel.toWSDL("http://${request.getServerName()}:${UtilProperties.getPropertyValue("url.properties", "port.http", "80")}${parameters._CONTROL_PATH_}/SOAPService");
|
||||
curServiceMap.wsdl = UtilXml.writeXmlDocument(wsdl);
|
||||
} catch (WSDLException ex) {
|
||||
curServiceMap.wsdl = ex.getLocalizedMessage();
|
||||
}
|
||||
context.showWsdl = true;
|
||||
}
|
||||
context.selectedServiceMap = curServiceMap;
|
||||
}
|
||||
|
||||
|
||||
if (!selectedService) {
|
||||
|
||||
//get constraints if any
|
||||
constraint = parameters.constraint;
|
||||
|
||||
serviceNames = curDispatchContext.getAllServiceNames();
|
||||
serviceNamesAlphaList = new ArrayList(26);
|
||||
servicesList = new ArrayList(serviceNames.size());
|
||||
servicesFoundCount = 0;
|
||||
serviceNames.each { serviceName ->
|
||||
//add first char of service name to list
|
||||
if(serviceName){
|
||||
serviceCharAt1 = serviceName[0];
|
||||
if (!serviceNamesAlphaList.contains(serviceCharAt1)) {
|
||||
serviceNamesAlphaList.add(serviceCharAt1);
|
||||
}
|
||||
}
|
||||
|
||||
//create basic service def
|
||||
curServiceMap = [:];
|
||||
curServiceMap.serviceName = serviceName;
|
||||
curServiceModel = curDispatchContext.getModelService(serviceName);
|
||||
|
||||
canIncludeService = true;
|
||||
if (constraint && curServiceModel) {
|
||||
consArr = constraint.split("@");
|
||||
constraintName = consArr[0];
|
||||
constraintVal = consArr[1];
|
||||
|
||||
if (constraintName.equals("engine_name")) {
|
||||
canIncludeService = curServiceModel.engineName.equals(constraintVal);
|
||||
if (constraintVal.equals("NA")) {
|
||||
canIncludeService = curServiceModel.engineName ? false : true;
|
||||
}
|
||||
}
|
||||
|
||||
if (canIncludeService && constraintName.equals("default_entity_name")) {
|
||||
canIncludeService = curServiceModel.defaultEntityName.equals(constraintVal);
|
||||
if(constraintVal.equals("NA")){
|
||||
canIncludeService = curServiceModel.defaultEntityName ? false : true;
|
||||
}
|
||||
}
|
||||
|
||||
if (canIncludeService && constraintName.equals("location")) {
|
||||
canIncludeService = curServiceModel.location.equals(constraintVal);
|
||||
if (constraintVal.equals("NA")) {
|
||||
canIncludeService = curServiceModel.location ? false : true;
|
||||
}
|
||||
}
|
||||
|
||||
if (canIncludeService && constraintName.equals("alpha")) {
|
||||
canIncludeService = (serviceName.charAt(0)+"").equals(constraintVal);
|
||||
if (constraintVal.equals("NA")) {
|
||||
canIncludeService = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (curServiceModel != null && canIncludeService) {
|
||||
engineName = curServiceModel.engineName ?: "NA";
|
||||
defaultEntityName = curServiceModel.defaultEntityName ?: "NA";
|
||||
invoke = curServiceModel.invoke ?: "NA";
|
||||
location = curServiceModel.location ?: "NA";
|
||||
requireNewTransaction = curServiceModel.requireNewTransaction;
|
||||
|
||||
curServiceMap.engineName = engineName;
|
||||
curServiceMap.defaultEntityName = defaultEntityName;
|
||||
curServiceMap.invoke = invoke;
|
||||
curServiceMap.location = location;
|
||||
curServiceMap.requireNewTransaction = requireNewTransaction;
|
||||
|
||||
servicesList.add(curServiceMap);
|
||||
servicesFoundCount++;
|
||||
}
|
||||
}
|
||||
|
||||
context.servicesList = servicesList;
|
||||
context.serviceNamesAlphaList = serviceNamesAlphaList;
|
||||
context.servicesFoundCount = servicesFoundCount;
|
||||
}
|
||||
+25
-26
@@ -35,48 +35,47 @@ import org.ofbiz.service.RunningService;
|
||||
import org.ofbiz.service.engine.GenericEngine;
|
||||
import org.ofbiz.service.config.ServiceConfigUtil;
|
||||
|
||||
Map savedSyncResult = null;
|
||||
if( null!=session.getAttribute("_SAVED_SYNC_RESULT_") ){
|
||||
savedSyncResult = (Map)session.getAttribute("_SAVED_SYNC_RESULT_");
|
||||
savedSyncResult = null;
|
||||
if (session.getAttribute("_SAVED_SYNC_RESULT_") != null) {
|
||||
savedSyncResult = session.getAttribute("_SAVED_SYNC_RESULT_");
|
||||
}
|
||||
|
||||
String serviceName = request.getParameter("SERVICE_NAME");
|
||||
context.put("POOL_NAME", ServiceConfigUtil.getSendPool());
|
||||
serviceName = parameters.SERVICE_NAME;
|
||||
context.POOL_NAME = ServiceConfigUtil.getSendPool();
|
||||
|
||||
List scheduleOptions = new ArrayList();
|
||||
List serviceParameters = new ArrayList();
|
||||
Enumeration e = request.getParameterNames();
|
||||
scheduleOptions = [];
|
||||
serviceParameters = [];
|
||||
e = request.getParameterNames();
|
||||
while (e.hasMoreElements()) {
|
||||
String paramName = (String) e.nextElement();
|
||||
String paramValue = request.getParameter(paramName);
|
||||
scheduleOptions.add(UtilMisc.toMap("name", paramName, "value", paramValue));
|
||||
paramName = e.nextElement();
|
||||
paramValue = parameters[paramName];
|
||||
scheduleOptions.add([name : paramName, value : paramValue]);
|
||||
}
|
||||
|
||||
context.put("scheduleOptions", scheduleOptions);
|
||||
context.scheduleOptions = scheduleOptions;
|
||||
|
||||
if (UtilValidate.isNotEmpty(serviceName)) {
|
||||
DispatchContext dctx = dispatcher.getDispatchContext();
|
||||
ModelService model = null;
|
||||
if (serviceName) {
|
||||
dctx = dispatcher.getDispatchContext();
|
||||
model = null;
|
||||
try {
|
||||
model = dctx.getModelService(serviceName);
|
||||
} catch(Exception exc) {
|
||||
context.put("errorMessageList", UtilMisc.toList(exc.getMessage()));
|
||||
context.errorMessageList = [exc.getMessage()];
|
||||
}
|
||||
if (model != null) {
|
||||
Iterator params = model.getInParamNames().iterator();
|
||||
while (params.hasNext()) {
|
||||
ModelParam par = model.getParam((String) params.next());
|
||||
model.getInParamNames().each { paramName ->
|
||||
par = model.getParam(paramName);
|
||||
if (par.internal) {
|
||||
continue;
|
||||
return;
|
||||
}
|
||||
Map serviceParam = null;
|
||||
if(null != savedSyncResult && null != savedSyncResult.get(par.name)){
|
||||
serviceParam = UtilMisc.toMap("name", par.name, "type", par.type, "optional", (par.optional? "Y": "N"), "defaultValue", par.defaultValue, "value", savedSyncResult.get(par.name).toString());
|
||||
}else{
|
||||
serviceParam = UtilMisc.toMap("name", par.name, "type", par.type, "optional", (par.optional? "Y": "N"), "defaultValue", par.defaultValue);
|
||||
serviceParam = null;
|
||||
if (savedSyncResult?.get(par.name)) {
|
||||
serviceParam = [name : par.name, type : par.type, optional : par.optional ? "Y" : "N", defaultValue : par.defaultValue, value : savedSyncResult.get(par.name)];
|
||||
} else {
|
||||
serviceParam = [name : par.name, type : par.type, optional : par.optional ? "Y" : "N", defaultValue : par.defaultValue];
|
||||
}
|
||||
serviceParameters.add(serviceParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
context.put("serviceParameters", serviceParameters);
|
||||
context.serviceParameters = serviceParameters;
|
||||
+16
-20
@@ -32,34 +32,30 @@ import org.ofbiz.webapp.event.CoreEvents;
|
||||
import javolution.util.FastList;
|
||||
import javolution.util.FastMap;
|
||||
|
||||
if(null!=session.getAttribute("_RUN_SYNC_RESULT_")){
|
||||
List serviceResultList = FastList.newInstance();
|
||||
Map serviceResult = (Map)session.getAttribute("_RUN_SYNC_RESULT_");
|
||||
if (session.getAttribute("_RUN_SYNC_RESULT_")) {
|
||||
serviceResultList = FastList.newInstance();
|
||||
serviceResult = session.getAttribute("_RUN_SYNC_RESULT_");
|
||||
|
||||
if(request.getParameter("servicePath")!=null && !request.getParameter("servicePath").equals("")){
|
||||
String servicePath = request.getParameter("servicePath");
|
||||
if (parameters.servicePath) {
|
||||
servicePath = parameters.servicePath;
|
||||
newServiceResult = CoreEvents.getObjectFromServicePath(servicePath, serviceResult);
|
||||
if(null!=newServiceResult && newServiceResult instanceof Map)
|
||||
if (newServiceResult && newServiceResult instanceof Map) {
|
||||
serviceResult = newServiceResult;
|
||||
context.put("servicePath", servicePath);
|
||||
}
|
||||
context.servicePath = servicePath;
|
||||
}
|
||||
|
||||
Set serviceResultSet = serviceResult.keySet();
|
||||
Iterator serviceResultItr = serviceResultSet.iterator();
|
||||
while(serviceResultItr.hasNext()){
|
||||
String key = serviceResultItr.next();
|
||||
Map valueMap = UtilMisc.toMap("key", key, "value", (null==serviceResult.get(key))?"null":serviceResult.get(key).toString());
|
||||
if(serviceResult.get(key) instanceof GenericEntity ||
|
||||
serviceResult.get(key) instanceof HashMap ||
|
||||
serviceResult.get(key) instanceof Collection){
|
||||
valueMap.put("hasChild", "Y");
|
||||
}else{
|
||||
valueMap.put("hasChild", "N");
|
||||
|
||||
serviceResult.each { key, value ->
|
||||
valueMap = [key : key, value : value.toString()];
|
||||
if (value instanceof Map || value instanceof Collection) {
|
||||
valueMap.hasChild = "Y";
|
||||
} else {
|
||||
valueMap.hasChild = "N";
|
||||
}
|
||||
serviceResultList.add(valueMap);
|
||||
}
|
||||
|
||||
context.put("serviceResultList", serviceResultList);
|
||||
context.serviceResultList = serviceResultList;
|
||||
}
|
||||
|
||||
|
||||
+11
-18
@@ -30,26 +30,19 @@ import org.ofbiz.service.engine.GenericEngine;
|
||||
import org.ofbiz.base.util.UtilHttp;
|
||||
import org.ofbiz.base.util.UtilProperties;
|
||||
|
||||
locale = UtilHttp.getLocale(request);
|
||||
request.setAttribute("locale",locale);
|
||||
uiLabelMap = UtilProperties.getResourceBundleMap("WebtoolsUiLabels", locale);
|
||||
uiLabelMap.addBottomResourceBundle("CommonUiLabels");
|
||||
|
||||
Map log = ServiceDispatcher.getServiceLogMap();
|
||||
List serviceList = new ArrayList();
|
||||
if (log != null) {
|
||||
Iterator i = log.keySet().iterator();
|
||||
while (i.hasNext()) {
|
||||
Map service = new HashMap();
|
||||
RunningService rs = (RunningService) i.next();
|
||||
log = ServiceDispatcher.getServiceLogMap();
|
||||
serviceList = [];
|
||||
log.each { rs, value ->
|
||||
service = [:];
|
||||
service.serviceName = rs.getModelService().name;
|
||||
service.localName = rs.getLocalName();
|
||||
service.startTime = rs.getStartStamp();
|
||||
service.endTime = rs.getEndStamp();
|
||||
service.modeStr = rs.getMode() == GenericEngine.SYNC_MODE ? uiLabelMap.WebtoolsSync : uiLabelMap.WebtoolsAsync;
|
||||
|
||||
service.put("serviceName", rs.getModelService().name);
|
||||
service.put("localName", rs.getLocalName());
|
||||
service.put("startTime", rs.getStartStamp());
|
||||
service.put("endTime", rs.getEndStamp());
|
||||
service.put("modeStr", (rs.getMode() == GenericEngine.SYNC_MODE? uiLabelMap.get("WebtoolsSync") : uiLabelMap.get("WebtoolsAsync")));
|
||||
|
||||
serviceList.add(service);
|
||||
}
|
||||
serviceList.add(service);
|
||||
}
|
||||
context.put("services", serviceList);
|
||||
context.services = serviceList;
|
||||
+14
-21
@@ -31,36 +31,29 @@ import org.ofbiz.service.engine.GenericEngine;
|
||||
import org.ofbiz.base.util.UtilHttp;
|
||||
import org.ofbiz.base.util.UtilProperties;
|
||||
|
||||
locale = UtilHttp.getLocale(request);
|
||||
request.setAttribute("locale",locale);
|
||||
uiLabelMap = UtilProperties.getResourceBundleMap("WebtoolsUiLabels", locale);
|
||||
uiLabelMap.addBottomResourceBundle("CommonUiLabels");
|
||||
|
||||
List threads = new ArrayList();
|
||||
List jobs = dispatcher.getJobManager().processList();
|
||||
if (jobs != null) {
|
||||
Iterator i = jobs.iterator();
|
||||
while (i.hasNext()) {
|
||||
Map job = (Map) i.next();
|
||||
String status = uiLabelMap.get("WebtoolsStatusInvalid");
|
||||
int state = ((Integer) job.get("status")).intValue();
|
||||
switch (state) {
|
||||
case 0 : status = uiLabelMap.get("WebtoolsStatusSleeping"); break;
|
||||
case 1 : status = uiLabelMap.get("WebtoolsStatusRunning"); break;
|
||||
case -1: status = uiLabelMap.get("WebtoolsStatusShuttingDown"); break;
|
||||
default: status = uiLabelMap.get("WebtoolsStatusInvalid"); break;
|
||||
}
|
||||
job.put("status", status);
|
||||
threads.add(job);
|
||||
threads = [];
|
||||
jobs = dispatcher.getJobManager().processList();
|
||||
jobs.each { job ->
|
||||
state = job.status;
|
||||
switch (state) {
|
||||
case 0 : status = uiLabelMap.WebtoolsStatusSleeping; break;
|
||||
case 1 : status = uiLabelMap.WebtoolsStatusRunning; break;
|
||||
case -1: status = uiLabelMap.WebtoolsStatusShuttingDown; break;
|
||||
default: status = uiLabelMap.WebtoolsStatusInvalid; break;
|
||||
}
|
||||
job.status = status;
|
||||
threads.add(job);
|
||||
}
|
||||
context.put("threads", threads);
|
||||
context.threads = threads;
|
||||
|
||||
// Some stuff for general threads on the server
|
||||
currentThread = Thread.currentThread();
|
||||
currentThreadGroup = currentThread.getThreadGroup();
|
||||
topThreadGroup = currentThreadGroup;
|
||||
while (topThreadGroup.getParent() != null) {
|
||||
while (topThreadGroup.getParent()) {
|
||||
topThreadGroup = topThreadGroup.getParent();
|
||||
}
|
||||
|
||||
@@ -68,4 +61,4 @@ Thread[] allThreadArray = new Thread[1000];
|
||||
topThreadGroup.enumerate(allThreadArray);
|
||||
allThreadList = Arrays.asList(allThreadArray);
|
||||
|
||||
context.put("allThreadList", allThreadList);
|
||||
context.allThreadList = allThreadList;
|
||||
@@ -1,597 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
import javax.wsdl.WSDLException;
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.base.util.UtilXml;
|
||||
import org.ofbiz.base.util.UtilProperties;
|
||||
import org.ofbiz.service.eca.ServiceEcaUtil;
|
||||
import org.ofbiz.service.ModelPermGroup;
|
||||
import org.ofbiz.service.ModelPermission;
|
||||
import org.ofbiz.base.util.UtilHttp;
|
||||
import org.ofbiz.base.util.UtilProperties;
|
||||
|
||||
getEcaListForService(String selectedService){
|
||||
ecaMap = org.ofbiz.service.eca.ServiceEcaUtil.getServiceEventMap(selectedService);
|
||||
|
||||
if(ecaMap == null) return null;
|
||||
|
||||
//ecaMap is a HashMap so get keyset & iterate
|
||||
ecaMapList = new java.util.ArrayList();
|
||||
|
||||
ecaMapIter = ecaMap.keySet().iterator();
|
||||
while(ecaMapIter.hasNext()){
|
||||
curRuleKey = ecaMapIter.next(); //get key in ecaMap
|
||||
|
||||
curRuleListIter = ecaMap.get(curRuleKey).iterator(); // get rule object from ecaMap using above key
|
||||
|
||||
while(curRuleListIter.hasNext()){
|
||||
curRule = curRuleListIter.next();
|
||||
curRuleMap = new java.util.HashMap();
|
||||
|
||||
curRuleMap.put("ruleKey", curRuleKey);
|
||||
|
||||
curRuleClass = curRule.getClass();
|
||||
|
||||
//event name for rule
|
||||
eventName = curRuleClass.getDeclaredField("eventName");
|
||||
eventName.setAccessible(true);
|
||||
eventNameVal = eventName.get(curRule);
|
||||
if(eventNameVal != null){
|
||||
curRuleMap.put("eventName", eventNameVal+"");
|
||||
}
|
||||
eventName.setAccessible(false);
|
||||
|
||||
//runOnError
|
||||
runOnError = curRuleClass.getDeclaredField("runOnError");
|
||||
runOnError.setAccessible(true);
|
||||
runOnErrorVal = runOnError.get(curRule);
|
||||
if(runOnErrorVal != null){
|
||||
curRuleMap.put("runOnError", runOnErrorVal+"");
|
||||
}
|
||||
runOnError.setAccessible(false);
|
||||
|
||||
//runOnFailure
|
||||
runOnFailure = curRuleClass.getDeclaredField("runOnFailure");
|
||||
runOnFailure.setAccessible(true);
|
||||
runOnFailureVal = runOnFailure.get(curRule);
|
||||
if(runOnFailureVal != null){
|
||||
curRuleMap.put("runOnFailure", runOnFailureVal+"");
|
||||
}
|
||||
runOnFailure.setAccessible(false);
|
||||
|
||||
//extract actions
|
||||
actions = curRuleClass.getDeclaredField("actionsAndSets");
|
||||
actions.setAccessible(true);
|
||||
actionsVal = actions.get(curRule);
|
||||
if(actionsVal != null){
|
||||
actionsList = new ArrayList(actionsVal.size());
|
||||
actionsIter = actionsVal.iterator();
|
||||
while(actionsVal != null && actionsIter.hasNext()){
|
||||
curAction = actionsIter.next();
|
||||
actionMap = new HashMap();
|
||||
actionClass = curAction.getClass();
|
||||
|
||||
//eventName
|
||||
eventName = actionClass.getDeclaredField("eventName");
|
||||
eventName.setAccessible(true);
|
||||
eventNameVal = eventName.get(curAction);
|
||||
if(eventNameVal != null){
|
||||
actionMap.put("eventName", eventNameVal+"");
|
||||
}
|
||||
eventName.setAccessible(false);
|
||||
|
||||
//ignoreError
|
||||
ignoreError = actionClass.getDeclaredField("ignoreError");
|
||||
ignoreError.setAccessible(true);
|
||||
ignoreErrorVal = ignoreError.get(curAction);
|
||||
if(ignoreErrorVal != null){
|
||||
actionMap.put("ignoreError", ignoreErrorVal+"");
|
||||
}
|
||||
ignoreError.setAccessible(false);
|
||||
|
||||
//ignoreFailure
|
||||
ignoreFailure = actionClass.getDeclaredField("ignoreFailure");
|
||||
ignoreFailure.setAccessible(true);
|
||||
ignoreFailureVal = ignoreFailure.get(curAction);
|
||||
if(ignoreFailureVal != null){
|
||||
actionMap.put("ignoreFailure", ignoreFailureVal+"");
|
||||
}
|
||||
ignoreFailure.setAccessible(false);
|
||||
|
||||
//persist
|
||||
persist = actionClass.getDeclaredField("persist");
|
||||
persist.setAccessible(true);
|
||||
persistVal = persist.get(curAction);
|
||||
if(persistVal != null){
|
||||
actionMap.put("persist", persistVal+"");
|
||||
}
|
||||
persist.setAccessible(false);
|
||||
|
||||
//resultMapName
|
||||
resultMapName = actionClass.getDeclaredField("resultMapName");
|
||||
resultMapName.setAccessible(true);
|
||||
resultMapNameVal = resultMapName.get(curAction);
|
||||
if(resultMapNameVal != null && resultMapNameVal.length() > 0){
|
||||
actionMap.put("resultMapName", resultMapNameVal+"");
|
||||
}
|
||||
resultMapName.setAccessible(false);
|
||||
|
||||
//resultToContext
|
||||
resultToContext = actionClass.getDeclaredField("resultToContext");
|
||||
resultToContext.setAccessible(true);
|
||||
resultToContextVal = resultToContext.get(curAction);
|
||||
if(resultToContextVal != null){
|
||||
actionMap.put("resultToContext", resultToContextVal+"");
|
||||
}
|
||||
resultToContext.setAccessible(false);
|
||||
|
||||
//resultToResult
|
||||
resultToResult = actionClass.getDeclaredField("resultToResult");
|
||||
resultToResult.setAccessible(true);
|
||||
resultToResultVal = resultToResult.get(curAction);
|
||||
if(resultToResultVal != null){
|
||||
actionMap.put("resultToResult", resultToResultVal+"");
|
||||
}
|
||||
resultToResult.setAccessible(false);
|
||||
|
||||
//serviceMode
|
||||
serviceMode = actionClass.getDeclaredField("serviceMode");
|
||||
serviceMode.setAccessible(true);
|
||||
serviceModeVal = serviceMode.get(curAction);
|
||||
if(serviceModeVal != null){
|
||||
actionMap.put("serviceMode", serviceModeVal+"");
|
||||
}
|
||||
serviceMode.setAccessible(false);
|
||||
|
||||
//serviceName
|
||||
serviceName = actionClass.getDeclaredField("serviceName");
|
||||
serviceName.setAccessible(true);
|
||||
serviceNameVal = serviceName.get(curAction);
|
||||
if(serviceNameVal != null){
|
||||
actionMap.put("serviceName", serviceNameVal+"");
|
||||
}
|
||||
serviceName.setAccessible(false);
|
||||
|
||||
actionsList.add(actionMap);
|
||||
}
|
||||
|
||||
curRuleMap.put("actions", actionsList);
|
||||
}
|
||||
actions.setAccessible(true);
|
||||
|
||||
//extract conditions
|
||||
conditions = curRuleClass.getDeclaredField("conditions");
|
||||
conditions.setAccessible(true);
|
||||
conditionsVal = conditions.get(curRule);
|
||||
if(conditionsVal != null){
|
||||
curRuleMap.put("conditions", runOnFailureVal+"");
|
||||
condIter = conditionsVal.iterator();
|
||||
condList = new ArrayList(conditionsVal.size());
|
||||
while(condIter.hasNext()){
|
||||
condVal = condIter.next();
|
||||
condValClass = condVal.getClass();
|
||||
condMap = new HashMap();
|
||||
|
||||
//compareType
|
||||
compareType = condValClass.getDeclaredField("compareType");
|
||||
compareType.setAccessible(true);
|
||||
compareTypeVal = compareType.get(condVal);
|
||||
if(compareTypeVal != null && compareTypeVal.length() > 0){
|
||||
condMap.put("compareType", compareTypeVal+"");
|
||||
}
|
||||
compareType.setAccessible(false);
|
||||
|
||||
//conditionService
|
||||
conditionService = condValClass.getDeclaredField("conditionService");
|
||||
conditionService.setAccessible(true);
|
||||
conditionServiceVal = conditionService.get(condVal);
|
||||
if(conditionServiceVal != null && conditionServiceVal.length() > 0){
|
||||
condMap.put("conditionService", conditionServiceVal+"");
|
||||
}
|
||||
conditionService.setAccessible(false);
|
||||
|
||||
//format
|
||||
format = condValClass.getDeclaredField("format");
|
||||
format.setAccessible(true);
|
||||
formatVal = format.get(condVal);
|
||||
if(formatVal != null && formatVal.length() > 0){
|
||||
condMap.put("format", formatVal+"");
|
||||
}
|
||||
format.setAccessible(false);
|
||||
|
||||
//isConstant
|
||||
isConstant = condValClass.getDeclaredField("isConstant");
|
||||
isConstant.setAccessible(true);
|
||||
isConstantVal = isConstant.get(condVal);
|
||||
if(isConstantVal != null){
|
||||
condMap.put("isConstant", isConstantVal+"");
|
||||
}
|
||||
isConstant.setAccessible(false);
|
||||
|
||||
//isService
|
||||
isService = condValClass.getDeclaredField("isService");
|
||||
isService.setAccessible(true);
|
||||
isServiceVal = isService.get(condVal);
|
||||
if(isServiceVal != null){
|
||||
condMap.put("isService", isServiceVal+"");
|
||||
}
|
||||
isService.setAccessible(false);
|
||||
|
||||
//lhsMapName
|
||||
lhsMapName = condValClass.getDeclaredField("lhsMapName");
|
||||
lhsMapName.setAccessible(true);
|
||||
lhsMapNameVal = lhsMapName.get(condVal);
|
||||
if(lhsMapNameVal != null && lhsMapNameVal.length() > 0){
|
||||
condMap.put("lhsMapName", lhsMapNameVal+"");
|
||||
}
|
||||
lhsMapName.setAccessible(false);
|
||||
|
||||
//lhsValueName
|
||||
lhsValueName = condValClass.getDeclaredField("lhsValueName");
|
||||
lhsValueName.setAccessible(true);
|
||||
lhsValueNameVal = lhsValueName.get(condVal);
|
||||
if(lhsValueNameVal != null && lhsValueNameVal.length() > 0){
|
||||
condMap.put("lhsValueName", lhsValueNameVal+"");
|
||||
}
|
||||
lhsValueName.setAccessible(false);
|
||||
|
||||
//operator
|
||||
operator = condValClass.getDeclaredField("operator");
|
||||
operator.setAccessible(true);
|
||||
operatorVal = operator.get(condVal);
|
||||
if(operatorVal != null && operatorVal.length() > 0 ){
|
||||
condMap.put("operator", operatorVal+"");
|
||||
}
|
||||
operator.setAccessible(false);
|
||||
|
||||
//rhsMapName
|
||||
rhsMapName = condValClass.getDeclaredField("rhsMapName");
|
||||
rhsMapName.setAccessible(true);
|
||||
rhsMapNameVal = rhsMapName.get(condVal);
|
||||
if(rhsMapNameVal != null && rhsMapNameVal.length() > 0){
|
||||
condMap.put("rhsMapName", rhsMapNameVal+"");
|
||||
}
|
||||
rhsMapName.setAccessible(false);
|
||||
|
||||
//rhsValueName
|
||||
rhsValueName = condValClass.getDeclaredField("rhsValueName");
|
||||
rhsValueName.setAccessible(true);
|
||||
rhsValueNameVal = rhsValueName.get(condVal);
|
||||
if(rhsValueNameVal != null && rhsValueNameVal.length() > 0){
|
||||
condMap.put("rhsValueName", rhsValueNameVal+"");
|
||||
}
|
||||
rhsValueName.setAccessible(false);
|
||||
|
||||
condList.add(condMap);
|
||||
}
|
||||
curRuleMap.put("conditions", condList);
|
||||
}
|
||||
conditions.setAccessible(false);
|
||||
|
||||
ecaMapList.add(curRuleMap);
|
||||
}
|
||||
}
|
||||
return ecaMapList;
|
||||
}
|
||||
|
||||
|
||||
/*Local Dispatchers
|
||||
accounting, content, ecommerce, manufacturing, marketing, ordermgr, partymgr, catalog, facility, workeffort, example, WFDispatcher, webtools, order, wholesale, salesrep, hotelbackend, community
|
||||
*/
|
||||
//Ashish: Don't know how to get list of available dispatchers, so hardcoded. Add to this list if I missed some.
|
||||
dispArrList = new ArrayList();
|
||||
dispArrList.add("accounting");
|
||||
dispArrList.add("content");
|
||||
dispArrList.add("ecommerce");
|
||||
dispArrList.add("manufacturing");
|
||||
dispArrList.add("marketing");
|
||||
dispArrList.add("order");
|
||||
dispArrList.add("partymgr");
|
||||
dispArrList.add("catalog");
|
||||
dispArrList.add("facility");
|
||||
dispArrList.add("workeffort");
|
||||
dispArrList.add("example");
|
||||
dispArrList.add("WFDispatcher");
|
||||
dispArrList.add("webtools");
|
||||
dispArrList.add("wholesale");
|
||||
dispArrList.add("salesrep");
|
||||
dispArrList.add("hotelbackend");
|
||||
dispArrList.add("community");
|
||||
Collections.sort(dispArrList);
|
||||
context.put("dispArrList", dispArrList);
|
||||
|
||||
locale = UtilHttp.getLocale(request);
|
||||
request.setAttribute("locale",locale);
|
||||
uiLabelMap = UtilProperties.getResourceBundleMap("WebtoolsUiLabels", locale);
|
||||
uiLabelMap.addBottomResourceBundle("CommonUiLabels");
|
||||
|
||||
selDisp = request.getParameter("selDisp");
|
||||
selDisp = selDisp == null || selDisp.length() == 0 ? request.getAttribute("selDisp") : selDisp;
|
||||
//default disptacher is partymgr
|
||||
selDisp = selDisp == null || selDisp.length() == 0 ? "partymgr" : selDisp;
|
||||
|
||||
curDispatcher = request.getAttribute("dispatcher");
|
||||
curLocalDispatcher = curDispatcher.getLocalDispatcher(selDisp, request.getAttribute("delegator"));
|
||||
curDispatchContext = curLocalDispatcher.getDispatchContext();
|
||||
context.put("dispatcherName", curLocalDispatcher.getName());
|
||||
|
||||
selectedService = request.getParameter("sel_service_name");
|
||||
if(selectedService == null || selectedService.length() == 0){
|
||||
selectedService = request.getAttribute("sel_service_name");
|
||||
}
|
||||
|
||||
if(selectedService != null && selectedService.length() > 0){
|
||||
HashMap curServiceMap = new HashMap();
|
||||
|
||||
curServiceMap.put("serviceName", selectedService);
|
||||
curServiceModel = curDispatchContext.getModelService(selectedService);
|
||||
curServiceMap.put("description", curServiceModel.description);
|
||||
|
||||
if(curServiceModel != null){
|
||||
|
||||
engineName = curServiceModel.engineName;
|
||||
defaultEntityName = curServiceModel.defaultEntityName;
|
||||
export = curServiceModel.export ? uiLabelMap.get("CommonTrue") : uiLabelMap.get("CommonFalse");
|
||||
permissionGroups = curServiceModel.permissionGroups;
|
||||
implServices = curServiceModel.implServices;
|
||||
overrideParameters = curServiceModel.overrideParameters;
|
||||
useTrans = curServiceModel.useTransaction ? uiLabelMap.get("CommonTrue") : uiLabelMap.get("CommonFalse");
|
||||
maxRetry = curServiceModel.maxRetry;
|
||||
|
||||
//Test for ECA's
|
||||
ecaMapList = getEcaListForService(selectedService);
|
||||
if(ecaMapList != null){
|
||||
context.put("ecaMapList", ecaMapList);
|
||||
}
|
||||
//End Test for ECA's
|
||||
|
||||
invoke = curServiceModel.invoke;
|
||||
location = curServiceModel.location;
|
||||
requireNewTransaction = curServiceModel.requireNewTransaction ? uiLabelMap.get("CommonTrue") : uiLabelMap.get("CommonFalse");
|
||||
engineName = engineName != null && engineName.length() > 0 ? engineName : "NA";
|
||||
defaultEntityName = defaultEntityName != null && defaultEntityName.length() > 0 ? defaultEntityName : "NA";
|
||||
invoke = invoke != null && invoke.length() > 0 ? invoke : "NA";
|
||||
location = location != null && location.length() > 0 ? location : "NA";
|
||||
permissionGroups = permissionGroups != null && permissionGroups.size() > 0 ? permissionGroups : "NA";
|
||||
implServices = implServices != null && implServices.size() > 0 ? implServices : "NA";
|
||||
|
||||
curServiceMap.put("engineName", engineName);
|
||||
curServiceMap.put("defaultEntityName", defaultEntityName);
|
||||
curServiceMap.put("invoke", invoke);
|
||||
curServiceMap.put("location", location);
|
||||
curServiceMap.put("requireNewTransaction", requireNewTransaction);
|
||||
curServiceMap.put("export", export);
|
||||
|
||||
if(permissionGroups != null && !permissionGroups.equals("NA") && permissionGroups.size() > 0){
|
||||
permIter = permissionGroups.iterator();
|
||||
permList = new ArrayList(permissionGroups.size());
|
||||
while(permIter.hasNext()){
|
||||
curPerm = (ModelPermGroup)permIter.next();//This is a ModelPermGroup
|
||||
curIter = curPerm.permissions.size() > 0 ? curPerm.permissions.iterator() : null;
|
||||
while(curIter != null && curIter.hasNext()){
|
||||
curPermObj = curIter.next();
|
||||
permObj = new HashMap();
|
||||
permObj.put("action" , curPermObj.action);
|
||||
permType = curPermObj.permissionType;
|
||||
if(permType == 1){
|
||||
permType = "Simple Permission";
|
||||
}else if(permType == 2){
|
||||
permType = "Entity Permission";
|
||||
}else if(permType == 3){
|
||||
permType = "Role Member";
|
||||
}
|
||||
permObj.put("permType" , permType);
|
||||
permObj.put("nameOrRole" , curPermObj.nameOrRole);
|
||||
permList.add(permObj);
|
||||
}
|
||||
}
|
||||
curServiceMap.put("permissionGroups", permList);
|
||||
}else{
|
||||
curServiceMap.put("permissionGroups", permissionGroups);
|
||||
}
|
||||
|
||||
curServiceMap.put("implServices", implServices);
|
||||
curServiceMap.put("useTrans", useTrans);
|
||||
curServiceMap.put("maxRetry", maxRetry);
|
||||
|
||||
allParamsList = new ArrayList(3);
|
||||
|
||||
inParams = curServiceModel.getInParamNames();
|
||||
if(inParams != null){
|
||||
inParamsList = new ArrayList(inParams.size());
|
||||
inParamsIter = inParams.iterator();
|
||||
while(inParamsIter.hasNext()){
|
||||
curParam = curServiceModel.getParam(inParamsIter.next());
|
||||
curInParam = new HashMap();
|
||||
curInParam.put("entityName", curParam.entityName);
|
||||
curInParam.put("fieldName", curParam.fieldName);
|
||||
curInParam.put("internal", curParam.internal ? uiLabelMap.get("CommonTrue") : uiLabelMap.get("CommonFalse"));
|
||||
curInParam.put("mode", curParam.mode);
|
||||
curInParam.put("name", curParam.name);
|
||||
curInParam.put("optional", curParam.optional ? uiLabelMap.get("CommonTrue") : uiLabelMap.get("CommonFalse"));
|
||||
curInParam.put("type", curParam.type);
|
||||
inParamsList.add(curInParam);
|
||||
}
|
||||
inParamMap = new HashMap();
|
||||
inParamMap.put("title", uiLabelMap.get("WebtoolsInParameters"));
|
||||
inParamMap.put("paramList", inParamsList);
|
||||
allParamsList.add(inParamMap);
|
||||
}
|
||||
|
||||
outParams = curServiceModel.getOutParamNames();
|
||||
if(outParams != null){
|
||||
outParamsList = new ArrayList(outParams.size());
|
||||
outParamsIter = outParams.iterator();
|
||||
while(outParamsIter.hasNext()){
|
||||
curParam = curServiceModel.getParam(outParamsIter.next());
|
||||
curOutParam = new HashMap();
|
||||
curOutParam.put("entityName", curParam.entityName);
|
||||
curOutParam.put("fieldName", curParam.fieldName);
|
||||
curOutParam.put("internal", curParam.internal ? uiLabelMap.get("CommonTrue") : uiLabelMap.get("CommonFalse"));
|
||||
curOutParam.put("mode", curParam.mode);
|
||||
curOutParam.put("name", curParam.name);
|
||||
curOutParam.put("optional", curParam.optional ? uiLabelMap.get("CommonTrue") : uiLabelMap.get("CommonFalse"));
|
||||
curOutParam.put("type", curParam.type);
|
||||
outParamsList.add(curOutParam);
|
||||
}
|
||||
outParamMap = new HashMap();
|
||||
outParamMap.put("title", uiLabelMap.get("WebtoolsOutParameters"));
|
||||
outParamMap.put("paramList", outParamsList);
|
||||
allParamsList.add(outParamMap);
|
||||
}
|
||||
|
||||
if(overrideParameters != null && overrideParameters.size() > 0){
|
||||
ovrPrmList = new ArrayList(overrideParameters.size());
|
||||
ovrPrmIter = overrideParameters.iterator();
|
||||
while(ovrPrmIter.hasNext()){
|
||||
curParam = ovrPrmIter.next();
|
||||
curOvrPrm = new HashMap();
|
||||
curOvrPrm.put("entityName", curParam.entityName);
|
||||
curOvrPrm.put("fieldName", curParam.fieldName);
|
||||
curOvrPrm.put("internal", curParam.internal ? uiLabelMap.get("CommonTrue") : uiLabelMap.get("CommonFalse"));
|
||||
curOvrPrm.put("mode", curParam.mode);
|
||||
curOvrPrm.put("name", curParam.name);
|
||||
curOvrPrm.put("optional", curParam.optional ? uiLabelMap.get("CommonTrue") : uiLabelMap.get("CommonFalse"));
|
||||
curOvrPrm.put("type", curParam.type);
|
||||
ovrPrmList.add(curOvrPrm);
|
||||
}
|
||||
ovrParamMap = new HashMap();
|
||||
ovrParamMap.put("title", "Override parameters");
|
||||
ovrParamMap.put("paramList", ovrPrmList);
|
||||
allParamsList.add(ovrParamMap);
|
||||
}
|
||||
curServiceMap.put("allParamsList", allParamsList);
|
||||
}
|
||||
|
||||
showWsdl = request.getParameter("show_wsdl");
|
||||
if(showWsdl == null || showWsdl.length() == 0){
|
||||
showWsdl = request.getAttribute("show_wsdl");
|
||||
}
|
||||
|
||||
if(showWsdl != null && showWsdl.equals("true")) {
|
||||
try {
|
||||
wsdl = curServiceModel.toWSDL("http://" + request.getServerName() + ":" + UtilProperties.getPropertyValue("url.properties", "port.http", "80") + (String) request.getAttribute("_CONTROL_PATH_") + "/SOAPService");
|
||||
curServiceMap.put("wsdl", UtilXml.writeXmlDocument(wsdl));
|
||||
} catch (WSDLException ex) {
|
||||
curServiceMap.put("wsdl", ex.getLocalizedMessage());
|
||||
}
|
||||
context.put("showWsdl", Boolean.TRUE);
|
||||
}
|
||||
context.put("selectedServiceMap", curServiceMap);
|
||||
}
|
||||
|
||||
|
||||
if(selectedService == null || selectedService.length() == 0){
|
||||
|
||||
//get constraints if any
|
||||
constraint = request.getParameter("constraint");
|
||||
if(constraint == null || constraint.length() == 0){
|
||||
constraint = request.getAttribute("constraint");
|
||||
}
|
||||
|
||||
|
||||
serviceNames = curDispatchContext.getAllServiceNames();
|
||||
serviceNamesAlphaList = new ArrayList(26);
|
||||
servicesIter = serviceNames.iterator();
|
||||
servicesList = new ArrayList(serviceNames.size());
|
||||
servicesFoundCount = 0;
|
||||
while(servicesIter.hasNext()){
|
||||
serviceName = servicesIter.next();
|
||||
|
||||
//add first char of service name to list
|
||||
if(serviceName.length() > 0){
|
||||
serviceCharAt1 = serviceName.charAt(0);
|
||||
if(!serviceNamesAlphaList.contains(serviceCharAt1)){
|
||||
serviceNamesAlphaList.add(serviceCharAt1);
|
||||
}
|
||||
}
|
||||
|
||||
//create basic service def
|
||||
HashMap curServiceMap = new HashMap();
|
||||
curServiceMap.put("serviceName", serviceName);
|
||||
curServiceModel = curDispatchContext.getModelService(serviceName);
|
||||
|
||||
canIncludeService = true;
|
||||
if(constraint != null && constraint.length() > 0 && curServiceModel != null){
|
||||
consArr = constraint.split("@");
|
||||
constraintName = consArr[0];
|
||||
constraintVal = consArr[1];
|
||||
|
||||
if(canIncludeService && constraintName.equals("engine_name")){
|
||||
canIncludeService = curServiceModel.engineName.equals(constraintVal);
|
||||
if(constraintVal.equals("NA")){
|
||||
canIncludeService =
|
||||
curServiceModel.engineName == null ||curServiceModel.engineName.equals("");
|
||||
}
|
||||
}
|
||||
|
||||
if(canIncludeService && constraintName.equals("default_entity_name")){
|
||||
canIncludeService = curServiceModel.defaultEntityName.equals(constraintVal);
|
||||
if(constraintVal.equals("NA")){
|
||||
canIncludeService =
|
||||
curServiceModel.defaultEntityName == null ||curServiceModel.defaultEntityName.equals("");
|
||||
}
|
||||
}
|
||||
|
||||
if(canIncludeService && constraintName.equals("location")){
|
||||
canIncludeService = curServiceModel.location.equals(constraintVal);
|
||||
if(constraintVal.equals("NA")){
|
||||
canIncludeService =
|
||||
curServiceModel.location == null ||curServiceModel.location.equals("");
|
||||
}
|
||||
}
|
||||
|
||||
if(canIncludeService && constraintName.equals("alpha")){
|
||||
canIncludeService = (serviceName.charAt(0)+"").equals(constraintVal);
|
||||
if(constraintVal.equals("NA")){
|
||||
canIncludeService = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(curServiceModel != null && canIncludeService){
|
||||
engineName = curServiceModel.engineName;
|
||||
defaultEntityName = curServiceModel.defaultEntityName;
|
||||
invoke = curServiceModel.invoke;
|
||||
location = curServiceModel.location;
|
||||
requireNewTransaction = curServiceModel.requireNewTransaction;
|
||||
|
||||
engineName = engineName != null && engineName.length() > 0 ? engineName : "NA";
|
||||
defaultEntityName = defaultEntityName != null && defaultEntityName.length() > 0 ? defaultEntityName : "NA";
|
||||
invoke = invoke != null && invoke.length() > 0 ? invoke : "NA";
|
||||
location = location != null && location.length() > 0 ? location : "NA";
|
||||
|
||||
curServiceMap.put("engineName", engineName);
|
||||
curServiceMap.put("defaultEntityName", defaultEntityName);
|
||||
curServiceMap.put("invoke", invoke);
|
||||
curServiceMap.put("location", location);
|
||||
curServiceMap.put("requireNewTransaction", requireNewTransaction);
|
||||
|
||||
servicesList.add(curServiceMap);
|
||||
servicesFoundCount++;
|
||||
}
|
||||
}
|
||||
|
||||
context.put("servicesList", servicesList);
|
||||
context.put("serviceNamesAlphaList", serviceNamesAlphaList);
|
||||
context.put("servicesFoundCount", servicesFoundCount);
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.ofbiz.base.util.UtilFormatOut;
|
||||
import org.ofbiz.base.util.UtilMisc;
|
||||
import org.ofbiz.base.util.UtilValidate;
|
||||
import org.ofbiz.security.Security;
|
||||
import org.ofbiz.webapp.stats.*;
|
||||
|
||||
String id = request.getParameter("statsId");
|
||||
String typeStr = request.getParameter("type");
|
||||
int type = -1;
|
||||
try {
|
||||
type = Integer.parseInt(typeStr);
|
||||
} catch (NumberFormatException e) {
|
||||
type = -1;
|
||||
}
|
||||
|
||||
LinkedList binList = null;
|
||||
if (type == ServerHitBin.REQUEST) {
|
||||
binList = (LinkedList) ServerHitBin.requestHistory.get(id);
|
||||
} else if (type == ServerHitBin.EVENT) {
|
||||
binList = (LinkedList) ServerHitBin.eventHistory.get(id);
|
||||
} else if (type == ServerHitBin.VIEW) {
|
||||
binList = (LinkedList) ServerHitBin.viewHistory.get(id);
|
||||
}
|
||||
|
||||
if (binList != null) {
|
||||
Iterator iterator = binList.iterator();
|
||||
if(iterator!=null && iterator.hasNext()){
|
||||
List requestList = new ArrayList();
|
||||
while(iterator.hasNext()){
|
||||
Map requestIdMap = new HashMap();
|
||||
ServerHitBin bin = (ServerHitBin) iterator.next();
|
||||
if (bin != null) {
|
||||
requestIdMap.put("requestId", bin.getId());
|
||||
requestIdMap.put("requestType", bin.getType());
|
||||
requestIdMap.put("startTime", bin.getStartTimeString());
|
||||
requestIdMap.put("endTime", bin.getEndTimeString());
|
||||
requestIdMap.put("lengthMins", UtilFormatOut.formatQuantity(bin.getBinLengthMinutes()));
|
||||
requestIdMap.put("numberHits", UtilFormatOut.formatQuantity(bin.getNumberHits()));
|
||||
requestIdMap.put("minTime", UtilFormatOut.formatQuantity(bin.getMinTimeSeconds()));
|
||||
requestIdMap.put("avgTime", UtilFormatOut.formatQuantity(bin.getAvgTimeSeconds()));
|
||||
requestIdMap.put("maxTime", UtilFormatOut.formatQuantity(bin.getMaxTimeSeconds()));
|
||||
requestIdMap.put("hitsPerMin", UtilFormatOut.formatQuantity(bin.getHitsPerMinute()));
|
||||
requestList.add(requestIdMap);
|
||||
}
|
||||
}
|
||||
context.put("requestList", requestList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.ofbiz.base.util.*;
|
||||
import org.ofbiz.security.Security;
|
||||
import org.ofbiz.webapp.stats.*;
|
||||
|
||||
id = parameters.statsId;
|
||||
typeStr = parameters.type;
|
||||
type = -1;
|
||||
try {
|
||||
type = Integer.valueOf(typeStr);
|
||||
} catch (NumberFormatException e) {}
|
||||
|
||||
binList = null;
|
||||
if (type == ServerHitBin.REQUEST) {
|
||||
binList = ServerHitBin.requestHistory.get(id);
|
||||
} else if (type == ServerHitBin.EVENT) {
|
||||
binList = ServerHitBin.eventHistory.get(id);
|
||||
} else if (type == ServerHitBin.VIEW) {
|
||||
binList = ServerHitBin.viewHistory.get(id);
|
||||
}
|
||||
|
||||
if (binList) {
|
||||
requestList = [];
|
||||
binList.each { bin ->
|
||||
requestIdMap = [:];
|
||||
if (bin != null) {
|
||||
requestIdMap.requestId = bin.getId();
|
||||
requestIdMap.requestType = bin.getType();
|
||||
requestIdMap.startTime = bin.getStartTimeString();
|
||||
requestIdMap.endTime = bin.getEndTimeString();
|
||||
requestIdMap.lengthMins = UtilFormatOut.formatQuantity(bin.getBinLengthMinutes());
|
||||
requestIdMap.numberHits = UtilFormatOut.formatQuantity(bin.getNumberHits());
|
||||
requestIdMap.minTime = UtilFormatOut.formatQuantity(bin.getMinTimeSeconds());
|
||||
requestIdMap.avgTime = UtilFormatOut.formatQuantity(bin.getAvgTimeSeconds());
|
||||
requestIdMap.maxTime = UtilFormatOut.formatQuantity(bin.getMaxTimeSeconds());
|
||||
requestIdMap.hitsPerMin = UtilFormatOut.formatQuantity(bin.getHitsPerMinute());
|
||||
requestList.add(requestIdMap);
|
||||
}
|
||||
}
|
||||
context.requestList = requestList;
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.ofbiz.base.util.UtilFormatOut;
|
||||
import org.ofbiz.base.util.UtilMisc;
|
||||
import org.ofbiz.base.util.UtilValidate;
|
||||
import org.ofbiz.security.Security;
|
||||
import org.ofbiz.webapp.stats.*;
|
||||
import javolution.util.FastList;
|
||||
import javolution.util.FastMap;
|
||||
|
||||
String clearBins = request.getParameter("clear");
|
||||
if (UtilValidate.isNotEmpty(clearBins) && "true".equals(clearBins)) {
|
||||
ServerHitBin.requestSinceStarted.clear();
|
||||
ServerHitBin.eventSinceStarted.clear();
|
||||
ServerHitBin.viewSinceStarted.clear();
|
||||
}
|
||||
|
||||
// Requests
|
||||
Iterator iterator = UtilMisc.toIterator(new TreeSet(ServerHitBin.requestSinceStarted.keySet()));
|
||||
if(iterator != null && iterator.hasNext()){
|
||||
List requestList = FastList.newInstance();
|
||||
while(iterator.hasNext()){
|
||||
Map requestIdMap = FastMap.newInstance();
|
||||
String statsId = (String)iterator.next();
|
||||
ServerHitBin bin = (ServerHitBin) ServerHitBin.requestSinceStarted.get(statsId);
|
||||
if (bin != null) {
|
||||
requestIdMap.put("requestId", bin.getId());
|
||||
requestIdMap.put("requestType", bin.getType());
|
||||
requestIdMap.put("startTime", bin.getStartTimeString());
|
||||
requestIdMap.put("endTime", bin.getEndTimeString());
|
||||
requestIdMap.put("lengthMins", UtilFormatOut.formatQuantity(bin.getBinLengthMinutes()));
|
||||
requestIdMap.put("numberHits", UtilFormatOut.formatQuantity(bin.getNumberHits()));
|
||||
requestIdMap.put("minTime", UtilFormatOut.formatQuantity(bin.getMinTimeSeconds()));
|
||||
requestIdMap.put("avgTime", UtilFormatOut.formatQuantity(bin.getAvgTimeSeconds()));
|
||||
requestIdMap.put("maxTime", UtilFormatOut.formatQuantity(bin.getMaxTimeSeconds()));
|
||||
requestIdMap.put("hitsPerMin", UtilFormatOut.formatQuantity(bin.getHitsPerMinute()));
|
||||
requestList.add(requestIdMap);
|
||||
}
|
||||
}
|
||||
context.put("requestList", requestList);
|
||||
}
|
||||
|
||||
// Events
|
||||
iterator = UtilMisc.toIterator(new TreeSet(ServerHitBin.eventSinceStarted.keySet()));
|
||||
if(iterator != null && iterator.hasNext()){
|
||||
List eventList = FastList.newInstance();
|
||||
while(iterator.hasNext()){
|
||||
Map requestIdMap = FastMap.newInstance();
|
||||
String statsId = (String)iterator.next();
|
||||
ServerHitBin bin = (ServerHitBin) ServerHitBin.requestSinceStarted.get(statsId);
|
||||
if (bin != null) {
|
||||
requestIdMap.put("requestId", bin.getId());
|
||||
requestIdMap.put("requestType", bin.getType());
|
||||
requestIdMap.put("startTime", bin.getStartTimeString());
|
||||
requestIdMap.put("endTime", bin.getEndTimeString());
|
||||
requestIdMap.put("lengthMins", UtilFormatOut.formatQuantity(bin.getBinLengthMinutes()));
|
||||
requestIdMap.put("numberHits", UtilFormatOut.formatQuantity(bin.getNumberHits()));
|
||||
requestIdMap.put("minTime", UtilFormatOut.formatQuantity(bin.getMinTimeSeconds()));
|
||||
requestIdMap.put("avgTime", UtilFormatOut.formatQuantity(bin.getAvgTimeSeconds()));
|
||||
requestIdMap.put("maxTime", UtilFormatOut.formatQuantity(bin.getMaxTimeSeconds()));
|
||||
requestIdMap.put("hitsPerMin", UtilFormatOut.formatQuantity(bin.getHitsPerMinute()));
|
||||
eventList.add(requestIdMap);
|
||||
}
|
||||
}
|
||||
context.put("eventList", eventList);
|
||||
}
|
||||
|
||||
// Views
|
||||
iterator = UtilMisc.toIterator(new TreeSet(ServerHitBin.viewSinceStarted.keySet()));
|
||||
if(iterator != null && iterator.hasNext()){
|
||||
List viewList = FastList.newInstance();
|
||||
while(iterator.hasNext()){
|
||||
Map requestIdMap = FastMap.newInstance();
|
||||
String statsId = (String)iterator.next();
|
||||
ServerHitBin bin = (ServerHitBin) ServerHitBin.requestSinceStarted.get(statsId);
|
||||
if (bin != null) {
|
||||
requestIdMap.put("requestId", bin.getId());
|
||||
requestIdMap.put("requestType", bin.getType());
|
||||
requestIdMap.put("startTime", bin.getStartTimeString());
|
||||
requestIdMap.put("endTime", bin.getEndTimeString());
|
||||
requestIdMap.put("lengthMins", UtilFormatOut.formatQuantity(bin.getBinLengthMinutes()));
|
||||
requestIdMap.put("numberHits", UtilFormatOut.formatQuantity(bin.getNumberHits()));
|
||||
requestIdMap.put("minTime", UtilFormatOut.formatQuantity(bin.getMinTimeSeconds()));
|
||||
requestIdMap.put("avgTime", UtilFormatOut.formatQuantity(bin.getAvgTimeSeconds()));
|
||||
requestIdMap.put("maxTime", UtilFormatOut.formatQuantity(bin.getMaxTimeSeconds()));
|
||||
requestIdMap.put("hitsPerMin", UtilFormatOut.formatQuantity(bin.getHitsPerMinute()));
|
||||
viewList.add(requestIdMap);
|
||||
}
|
||||
}
|
||||
context.put("viewList", viewList);
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.ofbiz.base.util.UtilFormatOut;
|
||||
import org.ofbiz.base.util.UtilMisc;
|
||||
import org.ofbiz.base.util.UtilValidate;
|
||||
import org.ofbiz.security.Security;
|
||||
import org.ofbiz.webapp.stats.*;
|
||||
import javolution.util.FastList;
|
||||
import javolution.util.FastMap;
|
||||
|
||||
clearBins = parameters.clear;
|
||||
if ("true".equals(clearBins)) {
|
||||
ServerHitBin.requestSinceStarted.clear();
|
||||
ServerHitBin.eventSinceStarted.clear();
|
||||
ServerHitBin.viewSinceStarted.clear();
|
||||
}
|
||||
|
||||
// Requests
|
||||
iterator = UtilMisc.toIterator(new TreeSet(ServerHitBin.requestSinceStarted.keySet()));
|
||||
requestList = FastList.newInstance();
|
||||
while (iterator.hasNext()) {
|
||||
requestIdMap = FastMap.newInstance();
|
||||
statsId = iterator.next();
|
||||
bin = ServerHitBin.requestSinceStarted.get(statsId);
|
||||
if (bin) {
|
||||
requestIdMap.requestId = bin.getId();
|
||||
requestIdMap.requestType = bin.getType();
|
||||
requestIdMap.startTime = bin.getStartTimeString();
|
||||
requestIdMap.endTime = bin.getEndTimeString();
|
||||
requestIdMap.lengthMins = UtilFormatOut.formatQuantity(bin.getBinLengthMinutes());
|
||||
requestIdMap.numberHits = UtilFormatOut.formatQuantity(bin.getNumberHits());
|
||||
requestIdMap.minTime = UtilFormatOut.formatQuantity(bin.getMinTimeSeconds());
|
||||
requestIdMap.avgTime = UtilFormatOut.formatQuantity(bin.getAvgTimeSeconds());
|
||||
requestIdMap.maxTime = UtilFormatOut.formatQuantity(bin.getMaxTimeSeconds());
|
||||
requestIdMap.hitsPerMin = UtilFormatOut.formatQuantity(bin.getHitsPerMinute());
|
||||
requestList.add(requestIdMap);
|
||||
}
|
||||
}
|
||||
context.requestList = requestList;
|
||||
|
||||
// Events
|
||||
iterator = UtilMisc.toIterator(new TreeSet(ServerHitBin.eventSinceStarted.keySet()));
|
||||
eventList = FastList.newInstance();
|
||||
while (iterator.hasNext()) {
|
||||
requestIdMap = FastMap.newInstance();
|
||||
statsId = iterator.next();
|
||||
bin = ServerHitBin.requestSinceStarted.get(statsId);
|
||||
if (bin) {
|
||||
requestIdMap.requestId = bin.getId();
|
||||
requestIdMap.requestType = bin.getType();
|
||||
requestIdMap.startTime = bin.getStartTimeString();
|
||||
requestIdMap.endTime = bin.getEndTimeString();
|
||||
requestIdMap.lengthMins = UtilFormatOut.formatQuantity(bin.getBinLengthMinutes());
|
||||
requestIdMap.numberHits = UtilFormatOut.formatQuantity(bin.getNumberHits());
|
||||
requestIdMap.minTime = UtilFormatOut.formatQuantity(bin.getMinTimeSeconds());
|
||||
requestIdMap.avgTime = UtilFormatOut.formatQuantity(bin.getAvgTimeSeconds());
|
||||
requestIdMap.maxTime = UtilFormatOut.formatQuantity(bin.getMaxTimeSeconds());
|
||||
requestIdMap.hitsPerMin = UtilFormatOut.formatQuantity(bin.getHitsPerMinute());
|
||||
eventList.add(requestIdMap);
|
||||
}
|
||||
}
|
||||
context.eventList = eventList;
|
||||
|
||||
|
||||
// Views
|
||||
iterator = UtilMisc.toIterator(new TreeSet(ServerHitBin.viewSinceStarted.keySet()));
|
||||
viewList = FastList.newInstance();
|
||||
while (iterator.hasNext()) {
|
||||
requestIdMap = FastMap.newInstance();
|
||||
statsId = iterator.next();
|
||||
bin = ServerHitBin.requestSinceStarted.get(statsId);
|
||||
if (bin) {
|
||||
requestIdMap.requestId = bin.getId();
|
||||
requestIdMap.requestType = bin.getType();
|
||||
requestIdMap.startTime = bin.getStartTimeString();
|
||||
requestIdMap.endTime = bin.getEndTimeString();
|
||||
requestIdMap.lengthMins = UtilFormatOut.formatQuantity(bin.getBinLengthMinutes());
|
||||
requestIdMap.numberHits = UtilFormatOut.formatQuantity(bin.getNumberHits());
|
||||
requestIdMap.minTime = UtilFormatOut.formatQuantity(bin.getMinTimeSeconds());
|
||||
requestIdMap.avgTime = UtilFormatOut.formatQuantity(bin.getAvgTimeSeconds());
|
||||
requestIdMap.maxTime = UtilFormatOut.formatQuantity(bin.getMaxTimeSeconds());
|
||||
requestIdMap.hitsPerMin = UtilFormatOut.formatQuantity(bin.getHitsPerMinute());
|
||||
viewList.add(requestIdMap);
|
||||
}
|
||||
}
|
||||
context.viewList = viewList;
|
||||
+18
-21
@@ -28,47 +28,44 @@ import org.ofbiz.entity.util.*;
|
||||
import org.ofbiz.entity.condition.*;
|
||||
import org.ofbiz.entity.transaction.*;
|
||||
|
||||
List messages = new LinkedList();
|
||||
|
||||
String xpdlLoc = request.getParameter("XPDL_LOCATION");
|
||||
boolean xpdlIsUrl = request.getParameter("XPDL_IS_URL")!=null?true:false;
|
||||
boolean xpdlImport = request.getParameter("XPDL_IMPORT")!=null?true:false;
|
||||
messages = [];
|
||||
|
||||
xpdlLoc = parameters.XPDL_LOCATION;
|
||||
xpdlIsUrl = parameters.XPDL_IS_URL != null;
|
||||
xpdlImport = parameters.XPDL_IMPORT != null;
|
||||
|
||||
URL xpdlUrl = null;
|
||||
try {
|
||||
xpdlUrl = xpdlIsUrl?new URL(xpdlLoc):UtilURL.fromFilename(xpdlLoc);
|
||||
}
|
||||
catch (java.net.MalformedURLException e) {
|
||||
xpdlUrl = xpdlIsUrl ? new URL(xpdlLoc) : UtilURL.fromFilename(xpdlLoc);
|
||||
} catch (java.net.MalformedURLException e) {
|
||||
messages.add(e.getMessage());
|
||||
messages.add(e.toString());
|
||||
Debug.log(e);
|
||||
}
|
||||
if (xpdlUrl == null) {
|
||||
if (!xpdlUrl) {
|
||||
messages.add("Could not find file/URL: " + xpdlLoc);
|
||||
}
|
||||
|
||||
List toBeStored = null;
|
||||
|
||||
toBeStored = null;
|
||||
try {
|
||||
if (xpdlUrl != null) {
|
||||
if (xpdlUrl) {
|
||||
toBeStored = XpdlReader.readXpdl(xpdlUrl, delegator);
|
||||
context.put("toBeStored", toBeStored);
|
||||
context.toBeStored = toBeStored;
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
messages.add(e.getMessage());
|
||||
messages.add(e.toString());
|
||||
Debug.log(e);
|
||||
}
|
||||
|
||||
if (toBeStored != null && xpdlImport) {
|
||||
boolean beganTransaction = false;
|
||||
|
||||
if (toBeStored && xpdlImport) {
|
||||
beganTransaction = false;
|
||||
try {
|
||||
beganTransaction = TransactionUtil.begin();
|
||||
delegator.storeAll(toBeStored);
|
||||
TransactionUtil.commit(beganTransaction);
|
||||
messages.add("Wrote/Updated " + toBeStored.size() + " toBeStored objects to the data source.");
|
||||
}
|
||||
catch (GenericEntityException e) {
|
||||
} catch (GenericEntityException e) {
|
||||
TransactionUtil.rollback(beganTransaction, "Error storing data from XPDL file", e);
|
||||
messages.add(e.getMessage());
|
||||
messages.add(e.toString());
|
||||
@@ -76,4 +73,4 @@ if (toBeStored != null && xpdlImport) {
|
||||
}
|
||||
}
|
||||
|
||||
context.put("messages", messages);
|
||||
context.messages = messages;
|
||||
+15
-14
@@ -27,19 +27,20 @@ import org.ofbiz.entity.util.*;
|
||||
import org.ofbiz.workflow.definition.*;
|
||||
import org.ofbiz.workflow.*;
|
||||
|
||||
String workflow = request.getParameter("workflow");
|
||||
GenericValue workflowDef = null;
|
||||
if (workflow == null) {
|
||||
List runningProcesses = delegator.findByAnd("WorkEffort", UtilMisc.toMap("workEffortTypeId", "WORK_FLOW", "currentStatusId", "WF_RUNNING"));
|
||||
if (runningProcesses != null)
|
||||
context.put("runningProcesses", runningProcesses);
|
||||
workflow = parameters.workflow;
|
||||
workflowDef = null;
|
||||
if (!workflow) {
|
||||
runningProcesses = delegator.findByAnd("WorkEffort", [workEffortTypeId : "WORK_FLOW", currentStatusId : "WF_RUNNING"]);
|
||||
if (runningProcesses) {
|
||||
context.runningProcesses = runningProcesses;
|
||||
}
|
||||
} else {
|
||||
workflowDef = delegator.findByPrimaryKey("WorkEffort", UtilMisc.toMap("workEffortId", workflow));
|
||||
if (workflowDef != null) {
|
||||
context.put("workflow", workflowDef);
|
||||
List activities = delegator.findByAnd("WorkEffort", UtilMisc.toMap("workEffortParentId", workflow));
|
||||
if (activities != null) {
|
||||
context.put("activities", activities);
|
||||
}
|
||||
}
|
||||
workflowDef = delegator.findByPrimaryKey("WorkEffort", [workEffortId : workflow]);
|
||||
if (workflowDef) {
|
||||
context.workflow = workflowDef;
|
||||
activities = delegator.findByAnd("WorkEffort", [workEffortParentId : workflow]);
|
||||
if (activities) {
|
||||
context.activities = activities;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ under the License.
|
||||
<form name="ArtifactInfoByNameAndType" method="post" action="<@ofbizUrl>ArtifactInfo</@ofbizUrl>" class="basic-form">
|
||||
<div>Name: <input type="text" name="name" value="${parameters.name?if_exists}" size="40"/></div>
|
||||
<div>Location: <input type="text" name="location" value="${parameters.location?if_exists}" size="60"/></div>
|
||||
<div>
|
||||
<div>Type:
|
||||
<select name="type">
|
||||
<option>entity</option>
|
||||
<option>service</option>
|
||||
|
||||
@@ -17,11 +17,11 @@ specific language governing permissions and limitations
|
||||
under the License.
|
||||
--%><%@ page import="java.io.*, java.util.*, java.net.*, org.w3c.dom.*, org.ofbiz.security.*, org.ofbiz.entity.*, org.ofbiz.entity.condition.*, org.ofbiz.entity.util.*, org.ofbiz.base.util.*, org.ofbiz.entity.model.*, org.ofbiz.entity.transaction.*" %><%@ taglib uri="ofbizTags" prefix="ofbiz" %><jsp:useBean id="security" type="org.ofbiz.security.Security" scope="request" /><jsp:useBean id="delegator" type="org.ofbiz.entity.GenericDelegator" scope="request" /><%
|
||||
if(security.hasPermission("ENTITY_MAINT", session)) {
|
||||
String[] entityName = (String[]) session.getAttribute("xmlrawdump_entitylist");
|
||||
TreeSet passedEntityNames = (TreeSet) session.getAttribute("xmlrawdump_entitylist");
|
||||
session.removeAttribute("xmlrawdump_entitylist");
|
||||
EntityExpr entityDateCond = (EntityExpr) session.getAttribute("entityDateCond");
|
||||
session.removeAttribute("entityDateCond");
|
||||
if (entityName != null) {
|
||||
if (passedEntityNames != null) {
|
||||
|
||||
ModelReader reader = delegator.getModelReader();
|
||||
Collection ec = reader.getEntityNames();
|
||||
@@ -33,12 +33,7 @@ under the License.
|
||||
response.setContentType("text/xml; charset=UTF-8");
|
||||
//UtilXml.writeXmlDocument(, document);
|
||||
|
||||
if(entityName != null && entityName.length > 0) {
|
||||
TreeSet passedEntityNames = new TreeSet();
|
||||
for(int inc=0; inc<entityName.length; inc++) {
|
||||
passedEntityNames.add(entityName[inc]);
|
||||
}
|
||||
|
||||
if(passedEntityNames.size() > 0) {
|
||||
numberOfEntities = passedEntityNames.size();
|
||||
|
||||
PrintWriter writer = null;
|
||||
|
||||
@@ -28,7 +28,7 @@ under the License.
|
||||
<actions>
|
||||
<set field="titleProperty" value="WebtoolsArtifactInfo"/>
|
||||
<set field="headerItem" value="ArtifactInfo"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
|
||||
@@ -26,7 +26,7 @@ under the License.
|
||||
<set field="titleProperty" value="WebtoolsServiceReference"/>
|
||||
<set field="appButtonItem" value="service"/>
|
||||
<property-map resource="PartyUiLabels" map-name="uiLabelMap" global="true"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/service/availableservices.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/service/AvailableServices.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
|
||||
@@ -25,7 +25,7 @@ under the License.
|
||||
<actions>
|
||||
<set field="headerItem" value="cache"/>
|
||||
<set field="titleProperty" value="PageTitleFindUtilCache"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/cache/findUtilCache.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCache.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
@@ -56,7 +56,7 @@ under the License.
|
||||
<actions>
|
||||
<set field="headerItem" value="cache"/>
|
||||
<set field="titleProperty" value="PageTitleFindUtilCacheElements"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/cache/findUtilCacheElements.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCacheElements.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
@@ -87,7 +87,7 @@ under the License.
|
||||
<actions>
|
||||
<set field="headerItem" value="cache"/>
|
||||
<set field="titleProperty" value="PageTitleEditUtilCache"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/cache/editUtilCache.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/cache/EditUtilCache.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
|
||||
@@ -33,7 +33,7 @@ under the License.
|
||||
<set field="rowLimit" from-field="parameters.rowLimit" type="Integer"/>
|
||||
<set field="parameters.TRANSACTION_TIMEOUT" value="7200"/>
|
||||
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/EntitySQLProcessor.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/EntitySQLProcessor.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
@@ -207,7 +207,7 @@ under the License.
|
||||
</condition>
|
||||
<actions>
|
||||
<set field="titleProperty" value="WebtoolsEntityDataMaintenance"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/EntityMaint.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/EntityMaint.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
@@ -277,7 +277,7 @@ under the License.
|
||||
<if-has-permission permission="ENTITY_MAINT"/>
|
||||
</condition>
|
||||
<actions>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/ViewRelations.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/ViewRelations.groovy"/>
|
||||
<property-map resource="WebtoolsUiLabels" map-name="uiLabelMap"/>
|
||||
<set field="title" value="${uiLabelMap.WebtoolsRelations}: ${entityName}"/>
|
||||
</actions>
|
||||
@@ -303,7 +303,7 @@ under the License.
|
||||
<actions>
|
||||
<property-map resource="WebtoolsUiLabels" map-name="uiLabelMap" global="true"/>
|
||||
<set field="titleProperty" value="WebtoolsEntityReferenceChart"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/EntityRef.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/EntityRef.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<section>
|
||||
@@ -357,7 +357,7 @@ under the License.
|
||||
<actions>
|
||||
<property-map resource="WebtoolsUiLabels" map-name="uiLabelMap" global="true"/>
|
||||
<set field="titleProperty" value="WebtoolsEntityReference"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/EntityRefList.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/EntityRefList.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<section>
|
||||
@@ -419,7 +419,7 @@ under the License.
|
||||
<actions>
|
||||
<property-map resource="WebtoolsUiLabels" map-name="uiLabelMap" global="true"/>
|
||||
<set field="titleProperty" value="WebtoolsCheckUpdateDatabase"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/CheckDb.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/CheckDb.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
@@ -453,7 +453,7 @@ under the License.
|
||||
<actions>
|
||||
<set field="headerItem" value="main"/>
|
||||
<set field="titleProperty" value="WebtoolsPerformanceTests"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/EntityPerformanceTest.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/EntityPerformanceTest.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
@@ -472,7 +472,7 @@ under the License.
|
||||
<property-map resource="WebtoolsUiLabels" map-name="uiLabelMap" global="true"/>
|
||||
<set field="headerItem" value="main"/>
|
||||
<set field="titleProperty" value="PageTitleEntityExport"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/xmldsdump.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/XmlDsDump.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
|
||||
@@ -51,7 +51,7 @@ under the License.
|
||||
<actions>
|
||||
<set field="titleProperty" value="PageTitleLogConfiguration"/>
|
||||
<set field="logMenuItem" value="logConfiguration"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/log/LogConfiguration.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/log/LogConfiguration.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="log-decorator">
|
||||
@@ -112,7 +112,7 @@ under the License.
|
||||
<!-- TODO: the following command is not really working (and the default value is always used);
|
||||
my guess is that the base/config/debug.properties file is not found in the classpath -->
|
||||
<property-to-field resource="debug" property="log4j.appender.css.File" field="logFileName" default="runtime/logs/ofbiz.html" no-locale="true"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/log/LogView.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/log/LogView.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="log-decorator">
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<actions>
|
||||
<set field="headerItem" value="main"/>
|
||||
<set field="titleProperty" value="WebtoolsEditCustomTimePeriods"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/period/EditCustomTimePeriod.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/period/EditCustomTimePeriod.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
@@ -75,7 +75,7 @@
|
||||
<actions>
|
||||
<set field="headerItem" value="main"/>
|
||||
<set field="titleProperty" value="WebtoolsReadXPDLFile"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/workflow/readxpdl.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/workflow/ReadXpdl.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
@@ -109,7 +109,7 @@
|
||||
<actions>
|
||||
<set field="headerItem" value="main"/>
|
||||
<set field="titleProperty" value="WebtoolsActiveWorkflowMonitor"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/workflow/workflowMonitor.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/workflow/WorkflowMonitor.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
|
||||
@@ -57,7 +57,7 @@ under the License.
|
||||
<actions>
|
||||
<set field="titleProperty" value="PageTitleServiceList"/>
|
||||
<set field="tabButtonItem" value="ServiceList"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/service/services.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/service/Services.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="CommonServiceDecorator">
|
||||
@@ -112,7 +112,7 @@ under the License.
|
||||
<actions>
|
||||
<set field="titleProperty" value="PageTitleThreadList"/>
|
||||
<set field="tabButtonItem" value="ThreadList"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/service/threads.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/service/Threads.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="CommonServiceDecorator">
|
||||
@@ -130,7 +130,7 @@ under the License.
|
||||
<actions>
|
||||
<set field="titleProperty" value="PageTitleScheduleJob"/>
|
||||
<set field="tabButtonItem" value="ScheduleJob"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/service/scheduleJob.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/service/ScheduleJob.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="CommonServiceDecorator">
|
||||
@@ -160,7 +160,7 @@ under the License.
|
||||
<actions>
|
||||
<set field="titleProperty" value="PageTitleRunService"/>
|
||||
<set field="tabButtonItem" value="RunService"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/service/scheduleJob.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/service/ScheduleJob.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="CommonServiceDecorator">
|
||||
@@ -183,7 +183,7 @@ under the License.
|
||||
<actions>
|
||||
<set field="titleProperty" value="PageTitleScheduleJob"/>
|
||||
<set field="tabButtonItem" value="ScheduleJob"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/service/scheduleJob.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/service/ScheduleJob.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="CommonServiceDecorator">
|
||||
@@ -209,7 +209,7 @@ under the License.
|
||||
<set field="titleProperty" value="PageTitleScheduleJob"/>
|
||||
<set field="headerItem" value="services"/>
|
||||
<set field="tabButtonItem" value="ScheduleJob"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/service/scheduleJob.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/service/ScheduleJob.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
@@ -235,7 +235,7 @@ under the License.
|
||||
<set field="titleProperty" value="PageTitleScheduleJob"/>
|
||||
<set field="headerItem" value="services"/>
|
||||
<set field="tabButtonItem" value="ScheduleJob"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/service/serviceResult.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/service/ServiceResult.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
|
||||
@@ -26,7 +26,7 @@ under the License.
|
||||
<actions>
|
||||
<set field="titleProperty" value="WebtoolsStatsMainPageTitle"/>
|
||||
<set field="headerItem" value="stats"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/stats/StatsSinceStart.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/stats/StatsSinceStart.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
@@ -51,7 +51,7 @@ under the License.
|
||||
<actions>
|
||||
<set field="titleProperty" value="WebtoolsStatsMainPageTitle"/>
|
||||
<set field="headerItem" value="stats"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/stats/StatBinsHistory.bsh"/>
|
||||
<script location="component://webtools/webapp/webtools/WEB-INF/actions/stats/StatBinsHistory.groovy"/>
|
||||
</actions>
|
||||
<widgets>
|
||||
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
|
||||
|
||||
Reference in New Issue
Block a user