01: /*******************************************************************************
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: *******************************************************************************/package org.ofbiz.minilang.method.entityops;
19:
20: import org.w3c.dom.*;
21:
22: import org.ofbiz.minilang.*;
23: import org.ofbiz.minilang.method.*;
24:
25: /**
26: * Creates a java.sql.Date with the current date and puts it in the env
27: */
28: public class NowDateToEnv extends MethodOperation {
29:
30: ContextAccessor envAcsr;
31:
32: public NowDateToEnv(Element element, SimpleMethod simpleMethod) {
33: super (element, simpleMethod);
34: envAcsr = new ContextAccessor(element.getAttribute("env-name"));
35: }
36:
37: public boolean exec(MethodContext methodContext) {
38: envAcsr.put(methodContext, new java.sql.Date(System
39: .currentTimeMillis()));
40: return true;
41: }
42:
43: public String rawString() {
44: // TODO: something more than the empty tag
45: return "<now-date-to-env/>";
46: }
47:
48: public String expandedString(MethodContext methodContext) {
49: // TODO: something more than a stub/dummy
50: return this.rawString();
51: }
52: }
|