Removed Mini-language elements that were deprecated in a previous release and are no longer used.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1328809 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
-4
@@ -68,10 +68,6 @@ org.ofbiz.minilang.method.entityops.TransactionBegin$TransactionBeginFactory
|
||||
org.ofbiz.minilang.method.entityops.TransactionCommit$TransactionCommitFactory
|
||||
org.ofbiz.minilang.method.entityops.TransactionRollback$TransactionRollbackFactory
|
||||
org.ofbiz.minilang.method.envops.ClearField$ClearFieldFactory
|
||||
org.ofbiz.minilang.method.envops.EnvToEnv$EnvToEnvFactory
|
||||
org.ofbiz.minilang.method.envops.EnvToField$EnvToFieldFactory
|
||||
org.ofbiz.minilang.method.envops.FieldToEnv$FieldToEnvFactory
|
||||
org.ofbiz.minilang.method.envops.FieldToField$FieldToFieldFactory
|
||||
org.ofbiz.minilang.method.envops.FieldToList$FieldToListFactory
|
||||
org.ofbiz.minilang.method.envops.FirstFromList$FirstFromListFactory
|
||||
org.ofbiz.minilang.method.envops.Iterate$IterateFactory
|
||||
|
||||
@@ -1,72 +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.
|
||||
*******************************************************************************/
|
||||
package org.ofbiz.minilang.method.envops;
|
||||
|
||||
import org.ofbiz.minilang.MiniLangException;
|
||||
import org.ofbiz.minilang.SimpleMethod;
|
||||
import org.ofbiz.minilang.method.ContextAccessor;
|
||||
import org.ofbiz.minilang.method.MethodContext;
|
||||
import org.ofbiz.minilang.method.MethodOperation;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Copies an environment field to a map field
|
||||
*/
|
||||
@Deprecated
|
||||
@MethodOperation.DeprecatedOperation("set")
|
||||
public class EnvToEnv extends MethodOperation {
|
||||
|
||||
public static final String module = EnvToEnv.class.getName();
|
||||
|
||||
protected ContextAccessor<Object> envAcsr;
|
||||
protected ContextAccessor<Object> toEnvAcsr;
|
||||
|
||||
public EnvToEnv(Element element, SimpleMethod simpleMethod) throws MiniLangException {
|
||||
super(element, simpleMethod);
|
||||
envAcsr = new ContextAccessor<Object>(element.getAttribute("env-name"));
|
||||
toEnvAcsr = new ContextAccessor<Object>(element.getAttribute("to-env-name"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exec(MethodContext methodContext) throws MiniLangException {
|
||||
toEnvAcsr.put(methodContext, envAcsr.get(methodContext));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String expandedString(MethodContext methodContext) {
|
||||
// TODO: something more than a stub/dummy
|
||||
return this.rawString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String rawString() {
|
||||
return "<env-to-env env-name=\"" + this.envAcsr + "\" to-env-name=\"" + this.toEnvAcsr + "\"/>";
|
||||
}
|
||||
|
||||
public static final class EnvToEnvFactory implements Factory<EnvToEnv> {
|
||||
public EnvToEnv createMethodOperation(Element element, SimpleMethod simpleMethod) throws MiniLangException {
|
||||
return new EnvToEnv(element, simpleMethod);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "env-to-env";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,97 +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.
|
||||
*******************************************************************************/
|
||||
package org.ofbiz.minilang.method.envops;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javolution.util.FastMap;
|
||||
|
||||
import org.w3c.dom.*;
|
||||
import org.ofbiz.base.util.*;
|
||||
import org.ofbiz.minilang.*;
|
||||
import org.ofbiz.minilang.method.*;
|
||||
|
||||
/**
|
||||
* Copies an environment field to a map field
|
||||
*/
|
||||
@Deprecated
|
||||
@MethodOperation.DeprecatedOperation("set")
|
||||
public class EnvToField extends MethodOperation {
|
||||
|
||||
public static final String module = EnvToField.class.getName();
|
||||
|
||||
ContextAccessor<Object> envAcsr;
|
||||
ContextAccessor<Object> fieldAcsr;
|
||||
ContextAccessor<Map<String, Object>> mapAcsr;
|
||||
|
||||
public EnvToField(Element element, SimpleMethod simpleMethod) throws MiniLangException {
|
||||
super(element, simpleMethod);
|
||||
envAcsr = new ContextAccessor<Object>(element.getAttribute("env-name"));
|
||||
mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map-name"));
|
||||
fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
|
||||
// set fieldAcsr to their defualt value of envAcsr if empty
|
||||
if (fieldAcsr.isEmpty()) {
|
||||
fieldAcsr = envAcsr;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exec(MethodContext methodContext) throws MiniLangException {
|
||||
Object envVar = envAcsr.get(methodContext);
|
||||
if (envVar == null) {
|
||||
Debug.logWarning("Environment field not found with name " + envAcsr + ", not copying env field", module);
|
||||
return true;
|
||||
}
|
||||
if (!mapAcsr.isEmpty()) {
|
||||
Map<String, Object> toMap = mapAcsr.get(methodContext);
|
||||
if (toMap == null) {
|
||||
if (Debug.verboseOn())
|
||||
Debug.logVerbose("Map not found with name " + mapAcsr + ", creating new map", module);
|
||||
toMap = FastMap.newInstance();
|
||||
mapAcsr.put(methodContext, toMap);
|
||||
}
|
||||
fieldAcsr.put(toMap, envVar, methodContext);
|
||||
} else {
|
||||
// no to-map, so put in env
|
||||
fieldAcsr.put(methodContext, envVar);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String expandedString(MethodContext methodContext) {
|
||||
// TODO: something more than a stub/dummy
|
||||
return this.rawString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String rawString() {
|
||||
return "<env-to-field env-name=\"" + this.envAcsr + "\" field-name=\"" + this.fieldAcsr + "\" map-name=\"" + this.mapAcsr + "\"/>";
|
||||
}
|
||||
|
||||
public static final class EnvToFieldFactory implements Factory<EnvToField> {
|
||||
public EnvToField createMethodOperation(Element element, SimpleMethod simpleMethod) throws MiniLangException {
|
||||
return new EnvToField(element, simpleMethod);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "env-to-field";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,102 +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.
|
||||
*******************************************************************************/
|
||||
package org.ofbiz.minilang.method.envops;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.minilang.MiniLangException;
|
||||
import org.ofbiz.minilang.SimpleMethod;
|
||||
import org.ofbiz.minilang.method.ContextAccessor;
|
||||
import org.ofbiz.minilang.method.MethodContext;
|
||||
import org.ofbiz.minilang.method.MethodOperation;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Copies a map field to an environment field
|
||||
*/
|
||||
@Deprecated
|
||||
@MethodOperation.DeprecatedOperation("set")
|
||||
public class FieldToEnv extends MethodOperation {
|
||||
|
||||
public static final String module = FieldToEnv.class.getName();
|
||||
|
||||
ContextAccessor<Object> envAcsr;
|
||||
ContextAccessor<Object> fieldAcsr;
|
||||
ContextAccessor<Map<String, ? extends Object>> mapAcsr;
|
||||
|
||||
public FieldToEnv(Element element, SimpleMethod simpleMethod) throws MiniLangException {
|
||||
super(element, simpleMethod);
|
||||
envAcsr = new ContextAccessor<Object>(element.getAttribute("env-name"));
|
||||
mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
|
||||
fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
|
||||
// set fieldAcsr to their defualt value of envAcsr if empty - this is the way it USED to work, so still supporting it, but a parsing error will result
|
||||
if (fieldAcsr.isEmpty()) {
|
||||
fieldAcsr = envAcsr;
|
||||
}
|
||||
// this is the new way that makes more sense, ie the destination should default to the source
|
||||
if (envAcsr.isEmpty()) {
|
||||
envAcsr = fieldAcsr;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exec(MethodContext methodContext) throws MiniLangException {
|
||||
Object fieldVal = null;
|
||||
if (!mapAcsr.isEmpty()) {
|
||||
Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext);
|
||||
if (fromMap == null) {
|
||||
Debug.logWarning("Map not found with name " + mapAcsr + ", not copying field", module);
|
||||
return true;
|
||||
}
|
||||
fieldVal = fieldAcsr.get(fromMap, methodContext);
|
||||
} else {
|
||||
// no map name, try the env
|
||||
fieldVal = fieldAcsr.get(methodContext);
|
||||
}
|
||||
if (fieldVal == null) {
|
||||
if (Debug.verboseOn())
|
||||
Debug.logVerbose("Field value not found with name " + fieldAcsr + " in Map with name " + mapAcsr + ", not copying field", module);
|
||||
return true;
|
||||
}
|
||||
envAcsr.put(methodContext, fieldVal);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String expandedString(MethodContext methodContext) {
|
||||
// TODO: something more than a stub/dummy
|
||||
return this.rawString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String rawString() {
|
||||
return "<field-to-env env-name=\"" + this.envAcsr + "\" field-name=\"" + this.fieldAcsr + "\" map-name=\"" + this.mapAcsr + "\"/>";
|
||||
}
|
||||
|
||||
public static final class FieldToEnvFactory implements Factory<FieldToEnv> {
|
||||
public FieldToEnv createMethodOperation(Element element, SimpleMethod simpleMethod) throws MiniLangException {
|
||||
return new FieldToEnv(element, simpleMethod);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "field-to-env";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,122 +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.
|
||||
*******************************************************************************/
|
||||
package org.ofbiz.minilang.method.envops;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javolution.util.FastMap;
|
||||
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.minilang.MiniLangException;
|
||||
import org.ofbiz.minilang.SimpleMethod;
|
||||
import org.ofbiz.minilang.method.ContextAccessor;
|
||||
import org.ofbiz.minilang.method.MethodContext;
|
||||
import org.ofbiz.minilang.method.MethodOperation;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Copies a map field to a map field
|
||||
*/
|
||||
@Deprecated
|
||||
@MethodOperation.DeprecatedOperation("set")
|
||||
public class FieldToField extends MethodOperation {
|
||||
|
||||
public static final String module = FieldToField.class.getName();
|
||||
|
||||
ContextAccessor<Object> fieldAcsr;
|
||||
ContextAccessor<Map<String, Object>> mapAcsr;
|
||||
ContextAccessor<Object> toFieldAcsr;
|
||||
ContextAccessor<Map<String, Object>> toMapAcsr;
|
||||
|
||||
public FieldToField(Element element, SimpleMethod simpleMethod) throws MiniLangException {
|
||||
super(element, simpleMethod);
|
||||
mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map-name"));
|
||||
fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
|
||||
toMapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("to-map-name"));
|
||||
toFieldAcsr = new ContextAccessor<Object>(element.getAttribute("to-field-name"));
|
||||
// set toMapAcsr and toFieldAcsr to their defualt values of mapAcsr and fieldAcsr if empty
|
||||
if (toMapAcsr.isEmpty()) {
|
||||
toMapAcsr = mapAcsr;
|
||||
}
|
||||
if (toFieldAcsr.isEmpty()) {
|
||||
toFieldAcsr = fieldAcsr;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exec(MethodContext methodContext) throws MiniLangException {
|
||||
Object fieldVal = null;
|
||||
if (!mapAcsr.isEmpty()) {
|
||||
Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext);
|
||||
if (fromMap == null) {
|
||||
if (Debug.infoOn())
|
||||
Debug.logInfo("Map not found with name " + mapAcsr + ", not copying from this map", module);
|
||||
return true;
|
||||
}
|
||||
fieldVal = fieldAcsr.get(fromMap, methodContext);
|
||||
} else {
|
||||
// no map name, try the env
|
||||
fieldVal = fieldAcsr.get(methodContext);
|
||||
}
|
||||
if (fieldVal == null) {
|
||||
if (Debug.verboseOn())
|
||||
Debug.logVerbose("Field value not found with name " + fieldAcsr + " in Map with name " + mapAcsr + ", not copying field", module);
|
||||
return true;
|
||||
}
|
||||
// note that going to an env field will only work if it came from an env
|
||||
// field because if not specified the to-map-name will be set to the map-name
|
||||
// to go from a map field to an env field, use the field-to-env operation
|
||||
Map<String, Object> toMap = null;
|
||||
if (!toMapAcsr.isEmpty()) {
|
||||
toMap = toMapAcsr.get(methodContext);
|
||||
if (toMap == null) {
|
||||
if (Debug.verboseOn())
|
||||
Debug.logVerbose("Map not found with name " + toMapAcsr + ", creating new map", module);
|
||||
toMap = FastMap.newInstance();
|
||||
toMapAcsr.put(methodContext, toMap);
|
||||
}
|
||||
toFieldAcsr.put(toMap, fieldVal, methodContext);
|
||||
} else {
|
||||
// no to-map, so put in env
|
||||
toFieldAcsr.put(methodContext, fieldVal);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String expandedString(MethodContext methodContext) {
|
||||
// TODO: something more than a stub/dummy
|
||||
return this.rawString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String rawString() {
|
||||
return "<field-to-field field-name=\"" + this.fieldAcsr + "\" map-name=\"" + this.mapAcsr + "\" to-field-name=\"" + this.toFieldAcsr + "\" to-map-name=\"" + this.toMapAcsr + "\"/>";
|
||||
}
|
||||
|
||||
public static final class FieldToFieldFactory implements Factory<FieldToField> {
|
||||
public FieldToField createMethodOperation(Element element, SimpleMethod simpleMethod) throws MiniLangException {
|
||||
return new FieldToField(element, simpleMethod);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "field-to-field";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user