Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
blob: d1866f4e1162a08d106585614eb67c6b0023bb1d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*******************************************************************************
 * Copyright (c) 2000, 2006 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * IBM Corporation - initial API and implementation
 * yyyymmdd bug      Email and other contact information
 * -------- -------- -----------------------------------------------------------
 * 20060612   145433 gilberta@ca.ibm.com - Gilbert Andrews
 *******************************************************************************/

package org.eclipse.jst.ws.internal.consumption.sampleapp.codegen;

import java.util.Vector;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jst.ws.internal.consumption.codegen.bean.TypeVisitor;
import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.AttributeElementType;
import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.DataType;
import org.eclipse.jst.ws.internal.consumption.datamodel.beanmodel.TypeFactory;
import org.eclipse.wst.ws.internal.datamodel.BasicElement;

/**
* Objects of this class represent a ResultFileAttributeGenerator.
* */
public class ResultFileAttributeGenerator extends ResultFileHelp2Generator 
{

  // Copyright
  public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002.";

   
  private Vector fSetterVector; 

  /**
  * Constructor.
  * @param buffer StringBuffer object that this code generator writes to 
  */
  public ResultFileAttributeGenerator (StringBuffer buffer)
  {
      super(buffer);
      
  }
  
  /**
  * Setter vector
  */
  public Vector getSetterVector()
  {
      return fSetterVector;
  }
  

  /**
  * Visit Method generates code for this Visitor
  * @param Parameter parameter code will be generated 
  */
  public IStatus visit (Object object)
  {
     AttributeElementType attributeElementType = (AttributeElementType)object;
     if(attributeElementType.getSetterMethod() == null) return Status.OK_STATUS;
     BasicElement element = (BasicElement)object;
     if(attributeElementType.getTypeElement().isSimple() || TypeFactory.recognizedBean(attributeElementType.getTypeElement().getName())){      
        //start the codegen
        //ask the datatype for its request line, it may need mark up or not.
        //ie For the simple types we need the mark up
        //for the dom element we cant use it.
        DataType dataType = TypeFactory.createType(attributeElementType.getTypeElement().getName(),element.getMUID());
        setTypeOwnerId(idName(element.getName())); 
        fbuffer.append(dataType.getRequestCode(element.getMUID(),getTypeOwnerId()));
                
     }
     
     TypeVisitor typeVisitor = new TypeVisitor();
     ResultFileTypeGenerator resultFileTypeGenerator = new ResultFileTypeGenerator(fbuffer);
     resultFileTypeGenerator.setNumberFactory(getNumberFactory());
     resultFileTypeGenerator.setTypeOwnerId(getTypeOwnerId());
     
     typeVisitor.run(attributeElementType,resultFileTypeGenerator);
     setNumberFactory(resultFileTypeGenerator.getNumberFactory());
     Vector setterInputs = resultFileTypeGenerator.getResidentVector(); 
     putResidentVector(attributeElementType.getSetterSignature((String)setterInputs.firstElement()));
     
     return Status.OK_STATUS;
  }   

  
  
}

Back to the top