Go Back   Java Programming Forums > Java Standard Edition Programming Help > Java IDEs


Reply
 
LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 19-01-2010, 03:19 PM
Idy Idy is offline
Junior Member
 

Join Date: Jan 2010
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Idy is on a distinguished road
Default Re: where can i find the tmp/foo directory?

Json,

below is what i have using netbeans

i have a class called Locations in the ejb

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package msc_project.ejb;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
*
* @author owner
*/
@Entity
@Table(name = "LOCATIONS")
@NamedQueries({
@NamedQuery(name = "Locations.findAll", query = "SELECT l FROM Locations l"),
@NamedQuery(name = "Locations.findById", query = "SELECT l FROM Locations l WHERE l.id = :id"),
@NamedQuery(name = "Locations.findByLocationCode", query = "SELECT l FROM Locations l WHERE l.locationCode = :locationCode"),
@NamedQuery(name = "Locations.findByName", query = "SELECT l FROM Locations l WHERE l.name = :name"),
@NamedQuery(name = "Locations.findByAddress", query = "SELECT l FROM Locations l WHERE l.address = :address")})
public class Locations implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "ID")
private Integer id;
@Basic(optional = false)
@Column(name = "LOCATION_CODE")
private String locationCode;
@Basic(optional = false)
@Column(name = "NAME")
private String name;
@Basic(optional = false)
@Column(name = "ADDRESS")
private String address;
@OneToMany(mappedBy = "locationId", fetch = FetchType.EAGER)
private List<Storerooms> storeroomsList;

public Locations() {
}

public Locations(Integer id) {
this.id = id;
}

public Locations(Integer id, String locationCode, String name, String address) {
this.id = id;
this.locationCode = locationCode;
this.name = name;
this.address = address;
}

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public String getLocationCode() {
return locationCode;
}

public void setLocationCode(String locationCode) {
this.locationCode = locationCode;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getAddress() {
return address;
}

public void setAddress(String address) {
this.address = address;
}

public List<Storerooms> getStoreroomsList() {
return storeroomsList;
}

public void setStoreroomsList(List<Storerooms> storeroomsList) {
this.storeroomsList = storeroomsList;
}

@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}

@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Locations)) {
return false;
}
Locations other = (Locations) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}

@Override
public String toString() {
return "msc_project.ejb.Locations[id=" + id + "]";
}

}


and the i defined the methods and operation of the calss in a LocationServer that implements it remotely in a class called the LocationServerRemote

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package msc_project.ejb;

import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
*
* @author owner
*/
@Stateless
public class LocationServer implements LocationServerRemote {

@PersistenceContext
private EntityManager manager;

//@PermitAll
public Locations readLocation(int id) {
return manager.find(Locations.class, id);
}

//@RolesAllowed("ADMINISTRATOR")
public void createLocation(Locations l) {
if (l.getId() == null) {
manager.persist(l);
} else {
manager.merge(l);
}
}

//@RolesAllowed("ADMINISTRATOR")
public void updateLocation(Locations l) {
manager.merge(l);
}

//@RolesAllowed("ADMINISTRATOR")
public void deleteLocation(int id) {
Locations l = manager.find(Locations.class, id);
manager.remove(l);
}

@SuppressWarnings("unchecked")
//@PermitAll
public List<Locations> getLocations() {
String query = "select l from Locations l order by l.locationCode";
return manager.createQuery(query).getResultList();
}

// Add business logic below. (Right-click in editor and choose
// "Insert Code > Add Business Method" or "Web Service > Add Operation")

}


/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package msc_project.ejb;

import java.util.List;
import javax.ejb.Remote;

/**
*
* @author owner
*/
@Remote
public interface LocationServerRemote {
Locations readLocation(int id);

void createLocation(Locations l);

void updateLocation(Locations l);

void deleteLocation(int id);

List<Locations> getLocations();

}



after which i created LocationWS class from the LocationServerBean


/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package msc_project.ejb.ws;

import java.util.List;
import javax.ejb.EJB;
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.ejb.Stateless;
import msc_project.ejb.LocationServerRemote;
import msc_project.ejb.Locations;

/**
*
* @author owner
*/
@WebService()
@Stateless()
public class LocationWS {
@EJB
private LocationServerRemote ejbRef;// Add business logic below. (Right-click in editor and choose
// "Insert Code > Add Web Service Operation")

@WebMethod(operationName = "readLocation")
public Locations readLocation(@WebParam(name = "id")
int id) {
return ejbRef.readLocation(id);
}

@WebMethod(operationName = "createLocation")
@Oneway
public void createLocation(@WebParam(name = "l")
Locations l) {
ejbRef.createLocation(l);
}

@WebMethod(operationName = "updateLocation")
@Oneway
public void updateLocation(@WebParam(name = "l")
Locations l) {
ejbRef.updateLocation(l);
}

@WebMethod(operationName = "deleteLocation")
@Oneway
public void deleteLocation(@WebParam(name = "id")
int id) {
ejbRef.deleteLocation(id);
}

@WebMethod(operationName = "getLocations")
public List<Locations> getLocations() {
return ejbRef.getLocations();
}

}


and that was it with the ejb.
n/b there are other classes but i am showing you what i have done with one of the classes.

in the web archive, i then created the web service clients from the web services to generate required classes and codes and create the LocationWSService/Ports

then in the war, i created a LocationBeanthat the web pages call to generate result as required by a user.


/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package msc_project.web;

import java.util.List;
import msc_project.ejb.ws.Locations;

/**
*
* @author owner
*/
public class LocationBean {
private msc_project.ejb.ws.LocationWSService locservice;
private msc_project.ejb.ws.LocationWS locport;
private Locations location;
private String error;

public String getError() {
return error;
}

public void setError(String error) {
this.error = error;
}

public Locations getLocation() {
return location;
}

public void setLocation(Locations location) {
this.location = location;
}

public LocationBean() {
error = "";
location = new Locations();

}

public void readLocation() {

try { // Call Web Service Operation
//msc_project.ejb.ws.EquipmentWSService service = new msc_project.ejb.ws.EquipmentWSService();
//msc_project.ejb.ws.EquipmentWS port = service.getEquipmentWSPort();
setUpLocationPorts();
// TODO initialize WS operation arguments here
//int id = 0;
// TODO process result here
//msc_project.ejb.ws.Equipments result = port.readEquipment(id);
//System.out.println("Result = "+result);
location = locport.readLocation(location.getId());
} catch (Exception ex) {
// TODO handle custom exceptions here
}
error = "";
}

public void createLocation() {

try { // Call Web Service Operation
//msc_project.ejb.ws.EquipmentWSService service = new msc_project.ejb.ws.EquipmentWSService();
//msc_project.ejb.ws.EquipmentWS port = service.getEquipmentWSPort();
setUpLocationPorts();
// TODO initialize WS operation arguments here
//msc_project.ejb.ws.Equipments e = new msc_project.ejb.ws.Equipments();
//port.createEquipment(e);
locport.createLocation(location);
} catch (Exception ex) {
// TODO handle custom exceptions here
}
location = new Locations();
error = "LOCATION - sucessfully created";
}

public void updateLocation() {

try { // Call Web Service Operation
//msc_project.ejb.ws.EquipmentWSService service = new msc_project.ejb.ws.EquipmentWSService();
//msc_project.ejb.ws.EquipmentWS port = service.getEquipmentWSPort();
setUpLocationPorts();
// TODO initialize WS operation arguments here
//msc_project.ejb.ws.Equipments e = new msc_project.ejb.ws.Equipments();
//port.updateEquipment(e);
locport.updateLocation(location);
} catch (Exception ex) {
// TODO handle custom exceptions here
}
location = new Locations();
error = "LOCATION - sucessfully updated";
}

public void deleteLocation() {

try { // Call Web Service Operation
//msc_project.ejb.ws.EquipmentWSService service = new msc_project.ejb.ws.EquipmentWSService();
//msc_project.ejb.ws.EquipmentWS port = service.getEquipmentWSPort();
setUpLocationPorts();
// TODO initialize WS operation arguments here
//int id = 0;
// port.deleteEquipment(id);
locport.deleteLocation(location.getId());
} catch (Exception ex) {
// TODO handle custom exceptions here
}
location = new Locations();
error = "LOCATION - sucessfully deleted";
}

public List<Locations> getLocations() {
List<msc_project.ejb.ws.Locations> result = null;

try { // Call Web Service Operation
//msc_project.ejb.ws.EquipmentWSService service = new msc_project.ejb.ws.EquipmentWSService();
//msc_project.ejb.ws.EquipmentWS port = service.getEquipmentWSPort();
setUpLocationPorts();
// TODO process result here
//java.util.List<msc_project.ejb.ws.Equipments> result = port.getEquipments();
result = locport.getLocations();
System.out.println("Result = " + result);
} catch (Exception ex) {
// TODO handle custom exceptions here
}
return result;
}

public void setUpLocationPorts() {
// Call Web Service Operation
if (locservice == null) {
locservice = new msc_project.ejb.ws.LocationWSService();
locport = locservice.getLocationWSPort();
}
}
}


that all i can explain for now, i would like more clarifications pls
thanks



Reply With Quote
Sponsored Links
Java Training from DevelopIntelligence
  #12 (permalink)  
Old 19-01-2010, 03:21 PM
Idy Idy is offline
Junior Member
 

Join Date: Jan 2010
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Idy is on a distinguished road
Default Re: where can i find the tmp/foo directory?

there was no method specified for me to use
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Similar Threads
Thread Thread Starter Forum Replies Last Post
About META-INF directory? chinni Java Servlet 2 09-02-2010 02:36 PM
How to List all files in a directory JavaPF Java Code Snippets and Tutorials 5 03-11-2009 01:42 PM
Class directory Kit Java Theory & Questions 7 11-10-2009 03:07 PM
How to Get the current directory path JavaPF Java Code Snippets and Tutorials 1 09-10-2009 05:59 PM
How to Make a directory with Java JavaPF Java Code Snippets and Tutorials 0 19-05-2008 11:43 AM


100 most searched terms
Search Cloud
2 dimensional arraylist java 2d arraylist java actionlistener actionlistener in java addactionlistener addactionlistener java convert double to integer java double format java double to integer in java double to integer java drag en drop programmeren java eclipse shortcut keys exception in thread "awt-eventqueue-0" java.lang.outofmemoryerror: java heap space exception in thread "main" java.lang.nullpointerexception exception in thread "main" java.lang.outofmemoryerror: java heap space format double in java format double java get mouse position java java 2d arraylist java actionlistener java double format java double formatting java double to int java double to integer java format double java forum java forums java get mouse position java list to map java mouse position java programming forum java programming forums java programming practice problems java send keystrokes to another application java two dimensional arraylist java.io.ioexception: premature eof java.lang.classformaterror: truncated class file java.lang.outofmemoryerror: java heap space java.util.arraylist jbutton action jbutton actionlistener jtextarea font jtextfield font size jxl.read.biff.biffexception: unable to recognize ole stream programming mutators and generics smack api two dimensional arraylist two dimensional arraylist java unable to sendviapost to url what is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

All times are GMT. The time now is 01:53 AM.
Powered by vBulletin® Copyright ©2000-2009, Jelsoft Enterprises Ltd.