Sample Code - dmardemo.java
Could you help me understand this sentence in SQL?
"CREATE VIEW " + outputDataURI + " AS " +
"SELECT D." + caseId + ", " +
"CAST(MULTISET( " +
" SELECT DM_Nested_Numerical(SUBSTR(C." + originalColumn + ", 1, 30), has_it) " +
" FROM " + inputDataURI + " C " +
" WHERE C." + caseId + " = D." + caseId +
" ) AS DM_Nested_Numericals) " + newNestedColumn + " " +
"FROM " + inputDataURI + " D";
where:
outputDataURI = SALES_TRANS_CUST_AR_V
caseID = CUST_ID
originalColumn = PROD_NAME
inputDataURI = SALES_TRANS_CUST_V
newNestedColumn = CUSTPRODS
Best Regards,
Luis
When I execute this SQL sentence, it creates the view 'normally'. However, when I try to see the data, nothing appears in the column CUSTPRODS. Is there anyone who had this problem before?
Thanks
Luis
Similar Messages
-
When I ran the sample code(WebLogicContextExample.java)
Hi:
when I ran the sample code(c:\weblogic\examples\jndi\WebLogicContextExample.java) occuring some errors.
Any Body can help me. Thx a lot!
Anny Chen
Here's error message:
C:\weblogic>java examples.jndi.WebLogicContextExample
WebGain Java! JustInTime Compiler Version 4.00.002(x) for JDK 1.2
Copyright (C) 2000 WebGain, Inc.
null
java.lang.NoSuchMethodError: java.lang.NoSuchMethodException: getNameInNamespace
at weblogic.jndi.toolkit.BasicWLContext_WLStub.ensureInitialized(BasicWL
Context_WLStub.java:127)
at weblogic.jndi.toolkit.BasicWLContext_WLStub.<init>(BasicWLContext_WLS
tub.java:146)
at java.lang.reflect.Constructor.newInstance(Native Method)
at weblogic.common.internal.ClassTableEntry.newInstance(ClassTableEntry.
java:86)
at weblogic.common.internal.WLObjectInputStreamBase.readLeftover(WLObjec
tInputStreamBase.java:248)
at weblogic.common.internal.WLObjectInputStreamBase.readObjectBody(WLObj
ectInputStreamBase.java:202)
at weblogic.common.internal.WLObjectInputStreamBase.readObject(WLObjectI
nputStreamBase.java:949)
at weblogic.common.internal.WLObjectInputStreamBase.readObjectWL(WLObjec
tInputStreamBase.java:308)
at weblogic.jndi.toolkit.WLContextStub.readExternal(WLContextStub.java:7
9)
at weblogic.common.internal.WLObjectInputStreamBase.readPublicSerializab
le(WLObjectInputStreamBase.java:269)
at weblogic.common.internal.WLObjectInputStreamBase.readLeftover(WLObjec
tInputStreamBase.java:254)
at weblogic.common.internal.WLObjectInputStreamBase.readObjectBody(WLObj
ectInputStreamBase.java:202)
at weblogic.common.internal.WLObjectInputStreamBase.readObject(WLObjectI
nputStreamBase.java:949)
at weblogic.common.internal.WLObjectInputStreamBase.readObjectWL(WLObjec
tInputStreamBase.java:308)
at weblogic.rmi.extensions.AbstractInputStream2.readObject(AbstractInput
Stream2.java:25)
at weblogic.jndi.internal.RemoteContextFactoryImpl_WLStub.getContext(Rem
oteContextFactoryImpl_WLStub.java:99)
at weblogic.jndi.WLInitialContextFactoryDelegate.newRemoteContext(WLInit
ialContextFactoryDelegate.java:316)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialCon
textFactoryDelegate.java:242)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLIni
tialContextFactoryDelegate.java, Compiled Code)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLIni
tialContextFactoryDelegate.java:148)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialCont
extFactory.java:123)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:7
71)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:169
at javax.naming.InitialContext.<init>(InitialContext.java:146)
at examples.jndi.WebLogicContextExample.main(WebLogicContextExample.java
:107)
Initial context created
Subcontext 'example' created
Bound 'Example String created at 2000/1/3 下午 05:48:18' to 'example.one' for th
e first time.
Example finished successfully.This is very likely a CLASSPATH issue. Make sure weblogicaux.jar is
at the head of your CLASSPATH.
Mike
"pamal" <[email protected]> wrote in message
news:[email protected]...
I just installed 5.1 with sp2 and have the same problem. Anyone know
about this one?
Anny Chen wrote:
Hi:
when I ran the sample
code(c:\weblogic\examples\jndi\WebLogicContextExample.java) occuring some
errors.
Any Body can help me. Thx a lot!
Anny Chen
Here's error message:
C:\weblogic>java examples.jndi.WebLogicContextExample
WebGain Java! JustInTime Compiler Version 4.00.002(x) for JDK 1.2
Copyright (C) 2000 WebGain, Inc.
null
java.lang.NoSuchMethodError: java.lang.NoSuchMethodException:getNameInNamespace
>>
atweblogic.jndi.toolkit.BasicWLContext_WLStub.ensureInitialized(BasicWL
Context_WLStub.java:127)
atweblogic.jndi.toolkit.BasicWLContext_WLStub.<init>(BasicWLContext_WLS
tub.java:146)
at java.lang.reflect.Constructor.newInstance(Native Method)
atweblogic.common.internal.ClassTableEntry.newInstance(ClassTableEntry.
java:86)
atweblogic.common.internal.WLObjectInputStreamBase.readLeftover(WLObjec
tInputStreamBase.java:248)
atweblogic.common.internal.WLObjectInputStreamBase.readObjectBody(WLObj
ectInputStreamBase.java:202)
atweblogic.common.internal.WLObjectInputStreamBase.readObject(WLObjectI
nputStreamBase.java:949)
atweblogic.common.internal.WLObjectInputStreamBase.readObjectWL(WLObjec
tInputStreamBase.java:308)
atweblogic.jndi.toolkit.WLContextStub.readExternal(WLContextStub.java:7
9)
atweblogic.common.internal.WLObjectInputStreamBase.readPublicSerializab
le(WLObjectInputStreamBase.java:269)
atweblogic.common.internal.WLObjectInputStreamBase.readLeftover(WLObjec
tInputStreamBase.java:254)
atweblogic.common.internal.WLObjectInputStreamBase.readObjectBody(WLObj
ectInputStreamBase.java:202)
atweblogic.common.internal.WLObjectInputStreamBase.readObject(WLObjectI
nputStreamBase.java:949)
atweblogic.common.internal.WLObjectInputStreamBase.readObjectWL(WLObjec
tInputStreamBase.java:308)
atweblogic.rmi.extensions.AbstractInputStream2.readObject(AbstractInput
Stream2.java:25)
atweblogic.jndi.internal.RemoteContextFactoryImpl_WLStub.getContext(Rem
oteContextFactoryImpl_WLStub.java:99)
atweblogic.jndi.WLInitialContextFactoryDelegate.newRemoteContext(WLInit
ialContextFactoryDelegate.java:316)
atweblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialCon
textFactoryDelegate.java:242)
atweblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLIni
tialContextFactoryDelegate.java, Compiled Code)
atweblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLIni
tialContextFactoryDelegate.java:148)
atweblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialCont
extFactory.java:123)
atjavax.naming.spi.NamingManager.getInitialContext(NamingManager.java:7
71)
atjavax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:169
at javax.naming.InitialContext.<init>(InitialContext.java:146)
atexamples.jndi.WebLogicContextExample.main(WebLogicContextExample.java
:107)
Initial context created
Subcontext 'example' created
Bound 'Example String created at 2000/1/3 下午 05:48:18' to'example.one' for th
e first time.
Example finished successfully. -
Sample code - webdynpro java Handheld.
Dear all,
I am new to webdynpro java handheld.
I need sample code for
1. how to get a value from context element.
2. how set a value in a context element.
3. how to create a context and bind.
and any sample tutorial available with create,update,retrieval, delete operations.
I have modeled a data object in DOE with all operation (c,u,r.d).
present i am trying develop a handheld application for the object.
I have created query,and costume operations in services component.
But i am unable use the service component (becuse lake of coding knowledge)
please help me
lakshman balanaguHi,
Please go thorugh the following document for the sample code you had asked for.
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/40fcc34f-af0e-2e10-41b3-f1f60bcb5a7f?quicklink=index&overridelayout=true
There are code snippets mentioned here.
You will get answers for your queries there in the documents.
Hope this helps.
Thanks,
Lakshmi -
Hi All,
I am looking for a sample code to just to connect with Business Catalyst eCommerce API. My aim is to simply retirieve the list of the products and update them.
It would be really helpful, if anyone please provide me a sample code in JAVA, just to connect with the API.
Thanks
Anipublic static void main(String[] args) throws RemoteException, MalformedURLException {
String endpoint = "https://CC.sys.com/CatalystWebS1ervice/CatalystEcommerceWebservice.asmx?WSDL"; // endpoint url can be found under Site Settings -> API -> click on eCommerce and copy the URL on the browser here.
CatalystEcommerceWebserviceSoapProxy sq = new CatalystEcommerceWebserviceSoapProxy(endpoint);
Products[] prod = new Products[2];
prod = sq.product_ListRetrieve(Username , Password, SiteID, CatalogueID);
System.out.println(prod[1].getDescription()); -
Tips on how to write efficient java code for java mapping
hi
I do not have much knowledge in Java
Can anybody tell me some tips on how to write efficient and optimised java code to be used in java mapping
Thanks,
Loveenahi D'za,
JAVA in xi
A very important place where you will use JAVA in XI is while doing your Mapping. There will be cases when JAVA MAPPING is the best solution to go for. There are 2 types of Parsers available for JAVA Mapping. DOM Parser and SAX parser. Just got through the following links to understand more on Java Mapping and the APIs available.http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/parsers/package-summary.html http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Document.html http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/package-frame.html /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii
JAVA mapping -
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii /people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping /people/amol.joshi2/blog/2006/03/10/think-objects-when-creating-java-mappings /people/sameer.shadab/blog/2005/09/29/testing-abap-mapping
sample code for java mapping
Re: Example code DOM PARSER API -
http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/package-frame.html DOM --- /people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs tutorial sax and dom
For a tutorial on the methods of SAX and DOM http://java.sun.com/webservices/docs/1.1/tutorial/doc/
SAX AND dom PARSER ( BY thorsten) -
example /people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs java mapping example ( testing and debugging) /people/stefan.grube/blog/2006/10/23/testing-and-debugging-java-mapping-in-developer-studio
regards
biplab
Use a Good Subject Line, One Question Per Posting - Award Points -
Hi,Can anyone help me to get Essbase API's sample code for Java.Thanks in advance.Mahesh
When you install Essbase Deployment Services (formerly Essbase Enterprise Services), which is the container for the Java API, a sample directory get installed that has about 30 sample Java classes covering a wide variety of JAPI functionality.Tim TowApplied OLAP, Inc
-
Need Sample Code for Vendor creation using JAVA API
Hi,
I have a scenario like Vendor creation using <b>Java API</b>.
1.I have Vendors (Main) Table.
2.I have <b>look up</b> tables like Account Group.
3.Also <b>Qualifier table</b>(Phone numbers) too.
Could you please give me the sample code which helps me to create Vendor records using Java API?
<b>I need Code samples which should cover all of the above scenario.</b>
<b>Marks will be given for the relevent answers.</b>
Best Regards
PK DevarajHi Devraj,
I hope the below code might solve all your problem:-
//Adding Qualified field
//Creating empty record in Qualifed table
//Adding No Qualifiers
Record qualified_record = RecordFactory.createEmptyRecord(new TableId(<TableId>));
try {
qualified_record.setFieldValue(new FieldId(<fieldId of NoQualifier), new StringValue(<StringValue>));//Adding No Qualifier
catch (IllegalArgumentException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
catch (MdmValueTypeException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
//Creating Record in Qualified table
CreateRecordCommand create_command = new CreateRecordCommand(connections);
create_command.setSession(sessionId);
create_command.setRecord(qualified_record);
try
create_command.execute();
catch(Exception e)
System.out.println(e.toString());
RecordId record_id = create_command.getRecord().getId();
//Adding the new record to Qualifed Lookup value and setting the Yes Qualifiers
QualifiedLookupValue lookup_value = new QualifiedLookupValue();
int link = lookup_value.createQualifiedLink(new QualifiedLinkValue(record_id));
//Adding Yes Qualifiers
lookup_value.setQualifierFieldValue(0 , new FieldId(<FieldID of Yes Qualifier>) , new StringValue(<StringValue>));
//Now adding LookUP values
//Fetch the RecordID of the value selected by user using the following function
public RecordId getRecordID(ConnectionPool connections , String sessionID , String value , String Fieldid , String tableid)
ResultDefinition rsd = new ResultDefinition(new TableId(tableid));
rsd.addSelectField(new FieldId(Fieldid));
StringValue [] val = new StringValue[1];
val[0] = new StringValue(value);
RetrieveRecordsByValueCommand val_command = new RetrieveRecordsByValueCommand(connections);
val_command.setSession(sessionID);
val_command.setResultDefinition(rsd);
val_command.setFieldId(new FieldId(Fieldid));
val_command.setFieldValues(val);
try
val_command.execute();
catch(Exception e)
RecordResultSet result_set = val_command.getRecords();
RecordId id = null;
if(result_set.getCount()>0)
for(int i = 0 ; i < result_set.getCount() ; i++)
id = result_set.getRecord(i).getId();
return id;
//Finally creating the record in Main table
com.sap.mdm.data.Record empty_record = RecordFactory.createEmptyRecord(new TableId("T1"));
try {
empty_record.setFieldValue(new FieldId(<FieldId of text field in Main table>),new StringValue(<StringValue>));
empty_record.setFieldValue(new FieldId(<FieldId of lookup field in Main table>), new LookupValue(<RecordID of the value retrieved using the above getRecordID function>));
empty_record.setFieldValue(new FieldId(<FieldId of Qualified field in Main table>), new QualifiedLookupValue(<lookup_value>));//QualifiedLookUp value Retrieved above
} catch (IllegalArgumentException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (MdmValueTypeException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
//Actually creating the record in Main table
CreateRecordCommand create_main_command = new CreateRecordCommand(connections);
create_main_command.setSession(sessionId);
create_main_command.setRecord(empty_record);
try
create_main_command.execute();
catch(Exception e)
System.out.println(e.toString());
Thanks
Namrata -
HI all,
I want to learn how java mapping can be done in XI.
I have created a javaMapping class implements StreamTransformation .
I am not getting what code should be written in execute method. I have included all the jar files required.
Please can anyone give me a sample code that should be written in execute method for a simple Message mapping.
I presume we use jaxp Api for that,but I am not getting the exact way to proceed further.
Thanks
YomeshThanks Anad And Shridhar,
I am able to do java mapping now.Actually I was not understanding how the input schema will be read and converted into output schema. Now I got that the DefaultHandler class's methods like startDocument EndDocument ,startElement and EndElement takes care of this. We have to just implement these methods and they are called automatically when corresponding tags are read.
Thank You verymuch for your help,
Yomesh -
Can u please send me a sample code to upload and download a file using java
Hi,
Please can u send me a sample code to upload a file and to download the same file from a remote server using a java servlets. The file should be read byte by byte.
Message was edited by:
user461713Hi, Thank u.
Sorry, I forgot to attach a code. Here it is.
Actually i need to upload a file to a remote server and download it from a server to my machine. I'm trying it using servlets and using tomcat5.0 as a servlet container. Here i'm sening a code used to upload a file. Let me know whether it works. Only few lines are here.
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.lang.Object;
import java.util.*;
import java.lang.String;
import com.oreilly.servlet.MultipartRequest;
public class FileUpload extends HttpServlet{
public void doPost(HttpServletRequest req, HttpServletResponse res)throws
ServletException, IOException{
MultipartRequest multi=new MultipartRequest(req);
String file="file1";
byte[] b=file.getBytes();
InputStream in=null;
BufferedInputStream bis=null;
FileWriter fw=null;
try{
in=multi.getInputStream("file1");
bis=new BufferedInputStream(in);
File output=new File("/fileuploadtest");
fw=new FileWriter(output);
int i;
i=bis.read();
while (i != -1) {
fw.write(i);
i = bis.read();
catch(IOException e){
System.out.println("Exception=" +e);
finally{
try{
if(in!=null)
in.close();
if(bis!=null)
bis.close();
if(fw!=null)
fw.close();
catch(Exception e){
System.out.println(e);
This code is giving error as: cannot resolve symbol: class MultipartRequest
Why is this happening?
Pls let me know whether this code works or no and also i have written form.html.
Can u pls tel me whether there are ways in which i can write a code to upload a file using servlets without using third party packages. Pls help.
Also how should be the servlet mapping for this code.?
Regards
Message was edited by:
user461713 -
New to java and having issues trying to modify sample code.
i was trying to edit the following code to add about 10+ more labels and textfields and save the information to the contacts.dat in the code. it currently displays all the fields i entered, but it only saves the first 7 fields information?? not sure why. also i was trying to just line the fields up using a flowlayout but it just errors. anyone have any suggestions?
<source code below this line>
====================START OF CODE ======================
// cm.java
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
// =========================================================
// Class: cm
// This class drives the contact manager. It contains the
// main method which gets called as soon as this application
// begins to run.
// =========================================================
class cm extends Frame implements ActionListener
// Container of contact objects (one object per business
// contact).
private Vector contacts = new Vector (100);
// List of names component. (Must specify java.awt in
// front of List to distinguish the List class in the
// java.awt package from the List class in the java.util
// package.)
private java.awt.List names = new java.awt.List ();
// delete and edit button components.
private Button delete;
private Button edit;
// Default constructor.
public cm ()
// Assign Contact Manager to title bar of frame window.
super ("Customer Manager Version 0.001 BY Pebkac");
// Add a listener that responds to window closing
// events. When this event occurs (by clicking on the
// close box in the title bar), save contacts and exit.
addWindowListener (new WindowAdapter ()
public void windowClosing
(WindowEvent e)
saveContacts ();
System.exit (0);
// Place an empty label in the north part of the frame
// window. This is done to correct an AWT positioning
// problem. (One thing that you'll come to realize as
// you work with the AWT is that there are lots of bugs.)
Label l = new Label ();
add ("North", l);
// Place the names component in the center part of the
// frame window.
add ("Center", names);
// Create a panel object to hold four buttons.
Panel p = new Panel ();
Button b;
// Add an add button to the Panel object and register
// the current cm object as a listener for button events.
p.add (b = new Button ("add"));
b.addActionListener (this);
// Add a delete button to the Panel object and register
// the current cm object as a listener for button events.
p.add (delete = new Button ("delete"));
delete.addActionListener (this);
// The delete button should be disabled until there is at
// least one contact to delete.
delete.setEnabled (false);
// Add an edit button to the Panel object and register
// the current cm object as a listener for button events.
p.add (edit = new Button ("edit"));
edit.addActionListener (this);
// The edit button should be disabled until there is at
// least one contact to edit.
edit.setEnabled (false);
// Add a quit button to the Panel object and register
// the current cm object as a listener for button events.
p.add (b = new Button ("quit"));
b.addActionListener (this);
// Add the panel object to the frame window container.
add ("South", p);
// Set the background of the frame window container to
// pink (to give a pleasing effect).
setBackground (Color.pink);
// Set the size of the frame window container to 400
// pixels horizontally by 200 pixels vertically.
setSize (400, 200);
// Do not allow the user to resize the frame window.
setResizable (false);
// Load all contacts.
loadContacts ();
// Make sure that the frame window is visible.
setVisible (true);
public void actionPerformed (ActionEvent e)
if (e.getActionCommand ().equals ("delete"))
delete ();
else
if (e.getActionCommand ().equals ("quit"))
saveContacts ();
System.exit (0);
else
if (e.getActionCommand ().equals ("add"))
add ();
else
edit ();
public Insets getInsets ()
// Return an Insets object that describes the number of
// pixels to reserve as a border around the edges of the
// frame window.
return new Insets (10, 10, 10, 10);
public static void main (String [] args)
// Create a new cm object and let it do its thing.
new cm ();
private void delete ()
// Obtain index of selected contact item from the names
// component.
int index = names.getSelectedIndex ();
// If no item was selected, index is -1. We cannot edit
// a contact if no contact item in the names component was
// selected - because we would have nothing to work with.
if (index != -1)
// Remove the contact item from the names component.
names.remove (index);
// Remove the Contact object from the contacts Vector
// object.
contacts.remove (index);
// If there are no more contacts ...
if (contacts.size () == 0)
delete.setEnabled (false);
edit.setEnabled (false);
else
// Make sure that the first contact item in the names
// list is highlighted.
names.select (0);
private void add ()
// Create an add data entry form to enter information
// for a new contact.
DataEntryForm def = new DataEntryForm (this, "add");
// If the bOk Boolean flag is set, this indicates the user
// exited the form by pressing the Ok button.
if (def.bOk)
// Create a Contact object and assign information from
// the form to its fields.
Contact temp = new Contact ();
temp.fname = new String (def.fname.getText ());
temp.lname = new String (def.lname.getText ());
temp.haddress = new String (def.haddress.getText ());
temp.maddress = new String (def.maddress.getText ());
temp.phone = new String (def.phone.getText ());
temp.wphone = new String (def.wphone.getText ());
temp.cphone = new String (def.cphone.getText ());
temp.email = new String (def.email.getText ());
temp.bdate = new String (def.bdate.getText ());
temp.comments = new String (def.comments.getText ());
// Add a new contact item to the names component.
names.add (temp.lname + ", " + temp.fname);
// Add the Contact object to the contacts Vector
// object.
contacts.add (temp);
// Make sure that the delete and edit buttons are
// enabled.
delete.setEnabled (true);
edit.setEnabled (true);
// Destroy the dialog box.
def.dispose ();
// Make sure that the first contact item in the names list
// is highlighted.
names.select (0);
// ===========================================================
// Load all contacts from contacts.dat into the contacts
// Vector object. Also, make sure that the last name/first
// name from each contact is combined into a String object and
// added into the names component - as a contact item.
// ===========================================================
private void loadContacts ()
FileInputStream fis = null;
try
fis = new FileInputStream ("contacts.dat");
DataInputStream dis = new DataInputStream (fis);
int nContacts = dis.readInt ();
for (int i = 0; i < nContacts; i++)
Contact temp = new Contact ();
temp.fname = dis.readUTF ();
temp.lname = dis.readUTF ();
temp.haddress = dis.readUTF ();
temp.maddress = dis.readUTF ();
temp.phone = dis.readUTF ();
temp.wphone = dis.readUTF ();
temp.cphone = dis.readUTF ();
temp.email = dis.readUTF ();
temp.bdate = dis.readUTF ();
temp.comments = dis.readUTF ();
names.add (temp.lname + ", " + temp.fname);
contacts.add (temp);
if (nContacts > 0)
delete.setEnabled (true);
edit.setEnabled (true);
catch (Exception e)
finally
if (fis != null)
try
fis.close ();
catch (Exception e) {}
// Make sure that the first contact item in the names list
// is highlighted.
names.select (0);
// ========================================================
// Save all Contact objects from the contacts Vector object
// to contacts.dat. The number of contacts are saved as an
// int to make it easy for loadContacts () to do its job.
// ========================================================
private void saveContacts ()
FileOutputStream fos = null;
try
fos = new FileOutputStream ("contacts.dat");
DataOutputStream dos = new DataOutputStream (fos);
dos.writeInt (contacts.size ());
for (int i = 0; i < contacts.size (); i++)
Contact temp = (Contact) contacts.elementAt (i);
dos.writeUTF (temp.fname);
dos.writeUTF (temp.lname);
dos.writeUTF (temp.haddress);
dos.writeUTF (temp.maddress);
dos.writeUTF (temp.phone);
dos.writeUTF (temp.wphone);
dos.writeUTF (temp.cphone);
dos.writeUTF (temp.email);
dos.writeUTF (temp.bdate);
dos.writeUTF (temp.comments);
catch (Exception e)
MsgBox mb = new MsgBox (this, "CM Error",
e.toString ());
mb.dispose ();
finally
if (fos != null)
try
fos.close ();
catch (Exception e) {}
private void edit ()
// Obtain index of selected contact item from the names
// component.
int index = names.getSelectedIndex ();
// If no item was selected, index is -1. We cannot edit
// a contact if no contact item in the names component was
// selected - because we would have nothing to work with.
if (index != -1)
// Obtain a reference to the Contact object (from the
// contacts Vector object) that is associated with the
// index.
Contact temp = (Contact) contacts.elementAt (index);
// Create and display an edit entry form.
DataEntryForm def = new DataEntryForm (this, "edit",
temp.fname,
temp.lname,
temp.haddress,
temp.maddress,
temp.phone,
temp.wphone,
temp.cphone,
temp.email,
temp.bdate,
temp.comments);
// If the user pressed Ok...
if (def.bOk)
// edit the contact information in the contacts
// Vector object.
temp.fname = new String (def.fname.getText ());
temp.lname = new String (def.lname.getText ());
temp.haddress = new String (def.haddress.getText ());
temp.maddress = new String (def.maddress.getText ());
temp.phone = new String (def.phone.getText ());
temp.wphone = new String (def.wphone.getText ());
temp.cphone = new String (def.cphone.getText ());
temp.email = new String (def.email.getText ());
temp.bdate = new String (def.bdate.getText ());
temp.comments = new String (def.comments.getText ());
// Make sure the screen reflects the edit.
names.replaceItem (temp.lname + ", " + temp.fname,
index);
// Destroy the dialog box.
def.dispose ();
// Make sure that the first contact item in the names
// list is highlighted.
names.select (0);
// ========================================================
// Class: Contact
// This class describes the contents of a business contact.
// ========================================================
class Contact
public String fname;
public String lname;
public String haddress;
public String maddress;
public String phone;
public String wphone;
public String cphone;
public String email;
public String bdate;
public String comments;
// ==========================================================
// Class: DataEntryForm
// This class provides a data entry form for entering contact
// information.
// ==========================================================
class DataEntryForm extends Dialog implements ActionListener
// bOk is a boolean flag. When true, it indicates that
// the Ok button was pressed to terminate the dialog box
// (as opposed to the Cancel button).
public boolean bOk;
// The following components hold the text that the user
// entered into the visible text fields.
public TextField fname;
public TextField lname;
public TextField haddress;
public TextField maddress;
public TextField phone;
public TextField wphone;
public TextField cphone;
public TextField email;
public TextField bdate;
public TextField comments;
public void actionPerformed (ActionEvent e)
// If the user pressed the Ok button, indicate this
// by assigning true to bOk.
if (e.getActionCommand ().equals ("Ok"))
bOk = true;
// Destroy the dialog box and return to the point
// just after the creation of the DataEntryForm object.
dispose ();
public DataEntryForm (Frame parent, String title)
// Call the other constructor. The current constructor
// is used for add operations. The other constructor
// is used for edit operations.
this (parent, title, "", "", "", "", "", "", "", "", "", "");
public DataEntryForm (Frame parent, String title,
String fname, String lname,
String haddress, String maddress,
String phone,String wphone,
String cphone,String email,
String bdate,String comments)
// Initialize the superclass layer.
super (parent, title, true);
// Choose a grid bag layout so that components can be more
// accurately positioned. (It looks nicer.)
setLayout (new GridBagLayout ());
// Add appropriate first name, last name, phone, wphone, and
// email components to the current DataEntryForm container.
// (Remember, DataEntryForm is a subclass of Dialog.
// Dialog is a container. Therefore, DataEntryForm
// inherits the ability to be a container.)
addComponent (this, new Label ("First Name: "),0, 0, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.WEST);
this.fname = new TextField (20);
addComponent (this, this.fname, 1, 0, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.CENTER);
if (title.equals ("edit"))
this.fname.setText (fname);
addComponent (this, new Label ("Last Name: "), 0, 1, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.WEST);
this.lname = new TextField (20);
addComponent (this, this.lname, 1, 1, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.CENTER);
if (title.equals ("edit"))
this.lname.setText (lname);
addComponent (this, new Label ("Home Address: "), 0, 2, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.WEST);
this.haddress = new TextField (20);
addComponent (this, this.haddress, 1, 2, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.CENTER);
if (title.equals ("edit"))
this.haddress.setText (haddress);
addComponent (this, new Label ("Mailing Address: "), 0, 3, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.WEST);
this.maddress = new TextField (20);
addComponent (this, this.maddress, 1, 3, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.CENTER);
if (title.equals ("edit"))
this.maddress.setText (maddress);
addComponent (this, new Label ("Home Number: "), 0, 4, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.WEST);
this.phone = new TextField (20);
addComponent (this, this.phone, 1, 4, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.CENTER);
if (title.equals ("edit"))
this.phone.setText (phone);
addComponent (this, new Label ("Work Number: "), 0, 5, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.WEST);
this.wphone = new TextField (20);
addComponent (this, this.wphone, 1, 5, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.CENTER);
if (title.equals ("edit"))
this.wphone.setText (wphone);
addComponent (this, new Label ("Cell Number: "), 0, 6, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.WEST);
this.cphone = new TextField (20);
addComponent (this, this.cphone, 1, 6, 1, 1,
GridBagConstraints.WEST,
GridBagConstraints.WEST);
addComponent (this, new Label ("Email Address: "), 0, 7, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.WEST);
this.email = new TextField (20);
addComponent (this, this.email, 1, 7, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.WEST);
addComponent (this, new Label ("Birth Date: "), 0, 8, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.WEST);
this.bdate = new TextField (20);
addComponent (this, this.bdate, 1, 8, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.WEST);
addComponent (this, new Label ("Comments: "), 2, 0, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.WEST);
this.comments = new TextField (20);
addComponent (this, this.comments, 2, 1, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.WEST);
addComponent (this, new Label (""), 0, 9, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.WEST);
addComponent (this, new Label (""), 1, 9, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.WEST);
Button b;
// Add an Ok button to this container.
addComponent (this, b = new Button ("Ok"), 0, -9, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.CENTER);
b.addActionListener (this);
// Add a Cancel button to this container.
addComponent (this, b = new Button ("Cancel"), 1, -9, 1, 1,
GridBagConstraints.NONE,
GridBagConstraints.CENTER);
b.addActionListener (this);
// Set the background of the frame window container to
// pink (to give a pleasing effect).
setBackground (Color.pink);
// Set the size of the dialog window to 250 pixels
// horizontally by 200 pixels vertically.
setSize (450, 500);
// Do not allow users to resize the dialog window.
setResizable (false);
// Make sure that the dialog window is visible.
setVisible (true);
private void addComponent (Container con, Component com,
int gridx, int gridy,
int gridw, int gridh, int fill,
int anchor)
// Get the current layout manager. It is assumed to
// be a GridBagLayout object.
LayoutManager lm = con.getLayout ();
// Create a GridBagConstraints object to make it
// possible to customize component positioning.
GridBagConstraints gbc = new GridBagConstraints ();
// Assign the x and y grid positions.
gbc.gridx = gridx;
gbc.gridy = gridy;
// Assign the number of grid blocks horizontally and
// vertically that are occupied by the component.
gbc.gridwidth = gridw;
gbc.gridheight = gridh;
// Specify the component's resize policy (fill) and
// the direction in which the component is positioned
// when its size is smaller than available space (anchor).
gbc.fill = fill;
gbc.anchor = anchor;
// Set the new constraints that the grid bag layout
// manager will use.
((GridBagLayout) lm).setConstraints (com, gbc);
// Add the component to the container.
con.add (com);
// ===========================================================
// Class: MsgBox
// This class displays a message box to the user. The message
// is usually an error message. The user must press the Ok
// button to terminate the message box.
// ===========================================================
class MsgBox extends Dialog implements ActionListener
public void actionPerformed (ActionEvent e)
// Terminate the dialog box in response to the user
// pressing the Ok button.
dispose ();
public MsgBox (Frame parent, String title, String msg)
// Initialize the superclass layer.
super (parent, title, true);
// Store the msg argument in a Label object and add
// this object to the center part of the dialog window.
Label l = new Label (msg);
add ("Center", l);
// Create a Button object and add it to the south part
// of the dialog window.
Button b = new Button ("Ok");
add ("South", b);
// Make the current object a listener to events that
// occur as a result of the user pressing the Ok
// button.
b.addActionListener (this);
// Make sure that the Ok button has the focus.
b.requestFocus ();
// Do not allow users to resize the dialog window.
setResizable (false);
// Allow the layout manager to choose an appropriate
// size for the dialog window.
pack ();
// Make sure that the dialog window is visible.
setVisible (true);
====================END OF CODE =======================You should first start by formatting the code before
posting. I lost my interest as I browsed thorugh the
code.
Read here -
http://forum.java.sun.com/help.jspa?sec=formatting
...and its way too much code to expect anyone to read. Post a short excerpt of the part you are having trouble with. -
Need sample code in webdynpro for java
Hi all
actually i have one webdynpro form which is having multiple input elements. for example name,address,phoneno,price quantity and amount. and there is update button for that form.
when i click the update button the multiplication of quantity and price value will be updated by in one input field which is part of the another webdynpro form is part of the same view.
i want to update the input field in another form only when i change the value of either price or quantity otherwise the value of inputfield in another form should be same.
now how do we retrieve the event of either price or quantity inputfield which only changes rather than changes of name or adreess.
only when i modify the value of price or quantity in form and updated button then only the multiplication will be reflected in inputfield of another form.i dont want to reflect that inputfield of another form when i changes of other inputfields except price or quantity.
please provide the sample code on the same...especially how to retrieve the event of that price or quantity in a form..
Regards
Suresh babuHi Suresh,
please post your issue to the Web Dynpro forum.
Greetings,
Carsten -
Sample Send Email Java code in OIM.
Hi All,
Can anybody please tell me the sample code to send an email when ever the new user created in the OIM an email has to be sent to that user's email ID(specified while user registration).
Thanks in Advance.
Siva Pokuri.Hi JMD,
Thanks for your quick response.
I have written the same code what you specified here and i deployed in JavaTasks folder of OIM server.
And i have created Entity Adapter for this code as well.
I have assigned this adapter to user for in Data Object Manager as a post insert task.
And finally when im trying to create the user in OIM the task was triggering but its giving the NullPointer Exception.
I donno where i have done the mis configuration. Is there anythign that im missing??
Please helpme out.
Thanks & Regards,
Siva Pokuri. -
Java + Open SQL sample code..
Hi All,
I want to use Open SQL in our project, Can any one send me a Stand alone sample example of Java and Open SQL.
also point me, from where i can get informations regardig the same..
We have SAP J2EE 6.20.
Also pls let me know the supporting jar,zip files, and from where can i download the same.
I googled, but i couldnt get any sample examples..
1. Does SAP J2EE 6.20 support Java & Open SQL.
2. What all supporting jar files, do i need and from where can i get the same..
Regards,
Shridhar..Hi Sridhar,
To use open sql in particular project in Netweaver Studio,you should have WAS 6.40.SO the current version which you had mentioned WAS 6.20 doesn't support open sql.
Secondly to use open sql you should place the driver .jar file in the lib folder of your respective perspective.you can download the same .jar file from the vendor's website(eg:- oracle).Then you need to conect to the DB,have youe executable statement and iterate thro' your resultset similarly what you in an ordinary JDBC program.
Hope this helps.
Regards,
Guru -
Error creating GUI for dmardemo.java
Hi friends!
I took the demo dmardemo.java (Association Rules) which comes with the ODM for Java to test Data Mining function in the sample database Sales History. In the original code, the application ran normally. However, I'm trying to create a GUI to execute the most important funcionalities like creating view, preparing and building model and restoring rules and itemsets. I created a visual class in the same project where the demo is. I've done some changes in the methods, like putting some input parameters for them. e.g.:
[i]public static void buildModel(String viewModelo, String configTask, String modelName, String taskName) throws JDMException
Connecting is ok. However I can not create the view.. When I execute this method for creating the view, some erros occurs, like:
Create build data view...
java.sql.SQLException: Closed Connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:840)
at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:759)
at project1.dmardemo.createBuildData(dmardemo.java:277)
at project1.Principal.jMenuItem1ActionPerformed(Principal.java:181)
at project1.Principal$7.actionPerformed(Principal.java:110)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1170)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1211)
at java.awt.Component.processMouseEvent(Component.java:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
What could be happening?
Thanks!!
Regards
LuisI have to tell you that the problem was occurring because of the clean() method. It must clean all views created before, and I was ignoring its execution. Now, another thing is happening: every time I made a call for it, an exception occurs, telling me that I must pass an input parameter for this method, and a null value for the objectName is not allowed.
However, this method doesn't work with any parameters.
What could be happening?
Thanks a lot!
Luis -
Association Rules - dmardemo.java - DisplayAssociationRules method
Hi, friends!
I'm making some changes in the sample Java demo for the Association Rules - dmardemo.java. I've created another method which contains the name of the model just created before and in this same method, I call the method to display the association rules detected:
public static void restoreRules(String modelNome) throws JDMException {
m_modelName = modelNome;
model = (AssociationModel)m_dmeConn.retrieveObject(
m_modelName, NamedObject.model);
displayAssociationRules(model);
In another class, which is a GUI, I'm trying to call that method to restore all the rules found in the mining process and display them in a jTable Swing component. For this, I've tried to adapt the main method (displayAssocationRules) to do this, as follows:
public static Object displayAssociationRules(AssociationModel model)
throws JDMException {
// DISPLAY TOP-10 ASSOCIATION RULES
Object[] obj = new Object[5];
int contador = 0;
// 1. Set order by confidence DESC, support DESC
OraRulesFilter filter = (OraRulesFilter) m_filterFactory.create();
filter.setOrderingCondition(
new RuleProperty[] { RuleProperty.confidence, RuleProperty.support},
new SortOrder[] { SortOrder.descending, SortOrder.descending }
// 2. Set to return the first 10 rules only
filter.setMaxNumberOfRules(10);
// 3. Retrieve rules
Collection rules = model.getRules(filter);
Iterator iRules = rules.iterator();
while( iRules.hasNext() )
OraAssociationRule rule = (OraAssociationRule) iRules.next();
obj[0] = rule.getRuleIdentifier();
//System.out.print( "Rule " + rule.getRuleIdentifier() + ": " );
Itemset antecedent = rule.getAntecedent();
//obj[1] = antecedent.getItems();
Object[] ante_items = antecedent.getItems();
// sort the items in antecedent to produce deterministic order of items
TreeSet sortedSet = new TreeSet();
for(int i = 0; i < obj.length; i++)
sortedSet.add(ante_items);
obj[1] = ante_items;
Iterator sortedI = sortedSet.iterator();
/*while(sortedI.hasNext())
System.out.print(sortedI.next() + " ");*/
Itemset consequent = rule.getConsequent();
Object[] cons_items = consequent.getItems();
obj[2] = cons_items;
obj[3] = m_df.format(rule.getSupport());
obj[4] = m_df.format(rule.getConfidence());
/*System.out.println("==> " + cons_items[0] + " (support=" +
m_df.format(rule.getSupport()) + ", confidence=" + m_df.format(rule.getConfidence()) + ")" );*/
return obj;
Some parts of the old code are present in that for you to compare what I've done. However, it's not working. What should I do to see the rules generated in the process in a jTable?
Regards
LuisAs you can see in the code above, I've split the code into two parts. However, a problem is happening when I try to restore the rules to the GUI.
"Exception in thread "AWT-EventQueue-0" javax.datamining.JDMIllegalArgumentException: The required argument objectName is null. Supply a non-null value."
It says that I'm not passing any parameters to the method. But, as you can see, in the first method I've created, I took the name of the model and transfers it for the method displayAssociationRules as a AssociationModel objet.
In the GUI, in an event for the button "Restore Rules", I've put this code below:
String modelo = Principal.getModelName(); // where Principal is the main GUI class for the execution of the process.
dmardemo.restoreRules(modelo);// I call the method in the dmardemo class to restore the rules having a String (modelo) as its parameter. That's when the problem happens. Is the argument really null, as the error message says?
Regards
Luis
Maybe you are looking for
-
SOLUTION: iCal calendar duplicates created by iCloud
Two weeks after I migrated to Lion, I stopped syncing my iPad and iPhone through iTunes and turned on iCloud. I had 15 years of calendar data, and after the iCloud syncing, most of the entries were duplicated or even triplicated. It took me 5 days
-
How do I Consolidate my photos scattered on my c drive and my H drive?
All of my photos have been imported already but some are on my C drive and others are on my H drive. All of those on my H drive are all under a single folder My Lightroom photographs. Those on my C drive are under a whole set of about 50 folders. I h
-
Is it possible to find the i pad version (2, 3 4) from serial number
Is it possible to find the i pad version (2, 3 4) from serial number ?
-
After I double click on the firefox icon, firefox refuses to load. Why?
'''bold text'''I have windows 7. When I double click on the firefox icon on my desktop the circle moves around and around then stops and nothing happens
-
Help please. I cannt get itunes match to work. It just stops on the first step and the status bar continues to say "sending information to apple" for hours. Any ideas?