Lotus Notes / Domino Sonstiges > Help-Desk Applikation !!Help!!
Help Application demo at Lotusphere
flaite:
--- Zitat von: eknori am 30.12.05 - 17:18:50 ---Axel:
Wenn ein Supporter angegeben wird, der keine Tickets hat ( also nicht in der DB existiert ) springe ich aus der function mit exit function raus.
entsprechend wir das hier als response geliefert; kann man damit was anfangen, sprich im Frontend entsprechend behandeln ??
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <soapenv:Body>
<ns1:GETALLTICKETSBYSUPPORTERResponse xmlns:ns1="urn:DefaultNamespace" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</soapenv:Body>
</soapenv:Envelope>
--- Ende Zitat ---
GETALLTICKETSBYSUPPORTERR scheint hier bei leeren Collections null zu sein. Ich find das nicht so gut. Wenn es schon ein Objekt gibt, dass als eine Art von Container für den Array dient und dazu noch eine ARRAY.length Variable (wie immer die heisst) hält, dann sollte nicht das ganze Objekt null sein. Das muß irgendwie gehen, dass in GETALLTICKETSBYSUPPORTER ein Array[0] zurückgegeben wird. Das wäre wesentlich besser.
flaite:
Den Rest mach ich später. Sieht aber gut aus.
Vielleicht ist es keine schlechte Idee noch ein bischen Funktionalität für die Todos anzubieten.
Ich werde jetzt schneller.
Am nervigsten war es, vernünftige datenstrukturen für die Collections, die in den Views angezeigt werden, hinzubekommen.
Je mehr Mühe ich mir hier gemacht habe, desto weniger Arbeit habe ich, wenn ich tatsächlich eine JTable auf diese Daten loslasse.
Java5 war teilweise ein bischen gewöhnungsbedürftig. Generics (dieses Zeugs <String>) sind sehr praktisch. Ebenfalls die ForAll Schleife, in denen kein ForAll als Wort vorkommt. Denke ich kann auch Scott Delap für die Gui folgen, ohne dass mich das aus der Bahn wirft.
Hier ist die zentrale Facade-Klasse, die mit den von Eclipse generierten Klassen spricht und sich die Werte über Webservices holt:
--- Code: ---package de.atnotes.help.wsclient.domain;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import de.atnotes.help.wsclient.gui.AppUtils;
import de.atnotes.help.wsclient.ws.TICKET;
import de.atnotes.help.wsclient.ws.TICKETCOLLECTION;
import de.atnotes.help.wsclient.ws.TICKETDETAILS;
import de.atnotes.help.wsclient.ws.TODO;
import de.atnotes.help.wsclient.ws.WsTicketProxy;
/**
* @author Axel
*
*/
public class BasicTicketsRepository implements TicketsRepository {
private WsTicketProxy ticketProxy;
private Map<String, TicketPartial> mTicketsSuporter;
private Map<String, TicketPartial> mTicketsUser;
private Map<String, TicketFull> mTicketsFull;
private Map<Integer, Set<TicketPartial>> userTicketsOrderedByStatus;
private Map<Integer, Set<TicketPartial>> suporterTicketsOrderedByStatus;
private Map<String, Set<TicketPartial>> suporterTicketsOrderedByUser;
public BasicTicketsRepository() {
}
/**
* to use in view
*
* @throws EnvironmentException
*/
public Map<Integer, Set<TicketPartial>> getUserTicketsOrderedByStatus(
String user, boolean retrieveRemotely) throws EnvironmentException {
// if null then retrieve allways from remote database
if (userTicketsOrderedByStatus == null)
retrieveRemotely = true;
if (retrieveRemotely) {
retrieveAllTicketsByUser(user);
if (userTicketsOrderedByStatus == null)
userTicketsOrderedByStatus = new HashMap<Integer, Set<TicketPartial>>();
else {
userTicketsOrderedByStatus.clear();
}
for (TicketPartial ticketPartial : mTicketsUser.values()) {
Set<TicketPartial> sTicketsPartial = userTicketsOrderedByStatus
.get(ticketPartial.getStatusCode());
if (sTicketsPartial == null) {
sTicketsPartial = new HashSet<TicketPartial>();
}
sTicketsPartial.add(ticketPartial);
userTicketsOrderedByStatus.put(ticketPartial.getStatusCode(),
sTicketsPartial);
}
}
return userTicketsOrderedByStatus;
}
/**
* to use in view
*
* @throws EnvironmentException
*/
public Map<Integer, Set<TicketPartial>> getSuporterTicketsOrderedByStatus(
String user, boolean retrieveRemotely) throws EnvironmentException {
// if null then retrieve allways from remote database
if (suporterTicketsOrderedByStatus == null)
retrieveRemotely = true;
if (retrieveRemotely) {
retrieveAllTicketsBySupporter(user);
if (suporterTicketsOrderedByStatus == null)
suporterTicketsOrderedByStatus = new HashMap<Integer, Set<TicketPartial>>();
else {
suporterTicketsOrderedByStatus.clear();
}
for (TicketPartial ticketPartial : mTicketsSuporter.values()) {
Set<TicketPartial> sTicketsPartial = suporterTicketsOrderedByStatus
.get(ticketPartial.getStatusCode());
if (sTicketsPartial == null) {
sTicketsPartial = new HashSet<TicketPartial>();
}
sTicketsPartial.add(ticketPartial);
suporterTicketsOrderedByStatus.put(ticketPartial
.getStatusCode(), sTicketsPartial);
}
}
return suporterTicketsOrderedByStatus;
}
/**
* to use in view
*/
public Map<String, Set<TicketPartial>> getSuporterTicketsOrderedByUser(
String user, boolean retrieveRemotely) throws EnvironmentException {
// if null then retrieve allways from remote database
if (suporterTicketsOrderedByUser == null)
retrieveRemotely = true;
if (retrieveRemotely) {
retrieveAllTicketsBySupporter(user);
if (suporterTicketsOrderedByUser == null)
suporterTicketsOrderedByUser = new HashMap<String, Set<TicketPartial>>();
else {
suporterTicketsOrderedByUser.clear();
}
for (TicketPartial ticketPartial : mTicketsSuporter.values()) {
Set<TicketPartial> sTicketsPartial = suporterTicketsOrderedByUser
.get(ticketPartial.getUser());
if (sTicketsPartial == null) {
sTicketsPartial = new HashSet<TicketPartial>();
}
sTicketsPartial.add(ticketPartial);
suporterTicketsOrderedByUser.put(ticketPartial.getUser(),
sTicketsPartial);
}
}
return suporterTicketsOrderedByUser;
}
/**
* calls Webservices to get a full ticket from the webservice to show in a
* form.
*
*
* @param String
* idTicket the id of the full ticket to retrieve.
*
* @return TicketFull
* @throws EnvironmentException
* called when webservice doesn't work or it returns an
* errorcode.
*/
public TicketFull getFullTicketById(String idTicket)
throws EnvironmentException {
TICKETDETAILS ticketFullWs = null;
try {
ticketFullWs = getTicketProxy().GETTICKETDETAILS(idTicket);
/*
* ERRORCODE !!! if (ticketF.getERRORCODE() != 0) throw new
* EnvironmentException( AppUtils
* .getValue("exception.environmentException.WebserviceErrorCode") +
* ticketColWs.getERRORCODE());
*/
} catch (RemoteException e) {
throw new EnvironmentException(
AppUtils
.getValue("exception.environmentException.ConnectionWithWebServiceFailed"),
e);
}
TODO[] toDosWs = ticketFullWs.getASSOCIATEDTODO().getTODOS();
List<TodoFull> todosFull = new ArrayList<TodoFull>();
if (toDosWs != null) {
for (TODO toDoWs : toDosWs) {
TodoFull todoFull = TodoFull
.getInstanceUsingWebserviceData(toDoWs);
todosFull.add(todoFull);
}
}
return TicketFull.getInstanceUsingWebserviceData(ticketFullWs,
todosFull);
}
/*
* (non-Javadoc)
*
* @see de.atnotes.help.goodies.bonus.wsclient.domain.TicketRepository#assignTicket(java.lang.String,
* java.lang.String)
*/
public int assignTicket(String id, String newSupporter)
throws EnvironmentException {
// TODO muss noch überarbeitet werden.
int ret = -1;
try {
ret = getTicketProxy().ASSIGNTICKET(id, newSupporter);
} catch (RemoteException e) {
throw new EnvironmentException(
AppUtils
.getValue("exception.environmentException.ConnectionWithWebServiceFailed"),
e);
}
return ret;
}
/*
* (non-Javadoc)
*
* @see de.atnotes.help.goodies.bonus.wsclient.domain.TicketRepository#closeTicket(java.lang.String)
*/
public int closeTicket(String id) throws EnvironmentException {
int ret = -1;
try {
ret = getTicketProxy().CLOSETICKET(id);
} catch (RemoteException e) {
throw new EnvironmentException(
AppUtils
.getValue("exception.environmentException.ConnectionWithWebServiceFailed"),
e);
}
return ret;
}
public int createTicket(TicketFull ticketFull) throws EnvironmentException {
short ret = -1;
try {
ret = getTicketProxy().CREATETICKET(ticketFull.getUser().trim(),
ticketFull.getProblem().trim());
if (ret == 1) {
throw new EnvironmentException(AppUtils
.getValue("exception.general.mandatoryParameterNotSet")
+ "ticketFull.user="
+ ticketFull.getUser()
+ "ticketFull.problem=" + ticketFull.getProblem());
}
if (ret == 2) {
throw new EnvironmentException(
AppUtils
.getValue("exception.environmentException.WebserviceErrorCode"));
}
} catch (RemoteException e) {
throw new EnvironmentException(
AppUtils
.getValue("exception.environmentException.ConnectionWithWebServiceFailed"),
e);
}
return ret;
}
/**
* calls Webservices to get partial tickets from a webservice. Can be used
* to implement a cache later
*
* @param mTicketsSuporter
* map of existing lands in business layer
* @return
* @throws EnvironmentException
* called when webservice doesn't work or it returns an
* errorcode.
*/
void retrieveAllTicketsBySupporter(String suporter)
throws EnvironmentException {
TICKET[] ticketsWs = new TICKET[0];
try {
TICKETCOLLECTION ticketColWs = getTicketProxy()
.GETALLTICKETSBYSUPPORTER(suporter);
if (ticketColWs.getERRORCODE() != 0)
throw new EnvironmentException(
AppUtils
.getValue("exception.environmentException.WebserviceErrorCode")
+ ticketColWs.getERRORCODE());
ticketsWs = ticketColWs.getTICKETS();
} catch (RemoteException rex) {
throw new EnvironmentException(
AppUtils
.getValue("exception.environmentException.ConnectionWithWebServiceFailed"),
rex);
}
mTicketsSuporter = generateTicketsPartialFromWsData(ticketsWs,
mTicketsSuporter);
}
/**
* calls Webservices to get a map of partial tickets from a webservice. Can
* be used to implement a cache later
*
* @param mTicketsSuporter
* map of existing lands in business layer
* @return Map <String, TicketPartial>
* @throws EnvironmentException
* called when webservice doesn't work or it returns an
* errorcode.
*/
void retrieveAllTicketsByUser(String user) throws EnvironmentException {
TICKET[] ticketsWs = new TICKET[0];
try {
TICKETCOLLECTION ticketColWs = getTicketProxy()
.GETALLTICKETSBYUSER(user);
if (ticketColWs.getERRORCODE() != 0)
throw new EnvironmentException(
AppUtils
.getValue("exception.environmentException.WebserviceErrorCode")
+ ticketColWs.getERRORCODE());
ticketsWs = ticketColWs.getTICKETS();
} catch (RemoteException e) {
throw new EnvironmentException(
AppUtils
.getValue("exception.environmentException.ConnectionWithWebServiceFailed"),
e);
}
mTicketsUser = generateTicketsPartialFromWsData(ticketsWs, mTicketsUser);
}
/**
* helper function used by getAllTicketsByUser and getAllTicketsBySupporter
*/
private Map<String, TicketPartial> generateTicketsPartialFromWsData(
TICKET[] ticketsWs, Map<String, TicketPartial> mTicketsPartial) {
// if (mTicketsPartial == null)
mTicketsPartial = new HashMap<String, TicketPartial>();
for (TicketPartial ticketBO : mTicketsPartial.values()) {
ticketBO.setNewItem(false);
}
for (TICKET ticketWs : ticketsWs) {
TicketPartial ticketV = null;
if ((ticketV = mTicketsPartial.get(ticketWs.getTICKETNUMBER())) != null) {
System.out.println("old.ticket");
ticketV.setStatusCode(ticketWs.getSTATUS());
ticketV.setUser(ticketWs.getUSER());
ticketV.setProblem(ticketWs.getPROBLEM());
} else {
ticketV = TicketPartial
.getInstanceUsingWebserviceData(ticketWs);
}
mTicketsPartial.put(ticketV.getId(), ticketV);
}
return mTicketsPartial;
}
/**
* @return Returns the ticketProxy.
*/
private WsTicketProxy getTicketProxy() {
if (ticketProxy == null)
ticketProxy = new WsTicketProxy();
return ticketProxy;
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
--- Ende Code ---
Gruß Axel
eknori (retired):
--- Zitat ---Die Funktion getTicketDetails ist nicht implementiert
--- Ende Zitat ---
Richtig, ebenso wie die AssignTicket; da existiert bisher nur ein func stub ...
eknori (retired):
@Axel:
Habe die
Class TicketDetails
Public User As String
Public Supporter As String
Public ID As String
Public Problem As String
Public Solution As String
Public Status As Integer
Public application As String
'... keine Ahnung was sonst noch
'Public AssociatedTodo As ToDoCollection
End Class
eingebaut.
Und CreateTicket gibt jetzt die TicketNummer als string zurück.
Mark³:
ist die Testdatenbank noch online?
Ich habe gestern und heute mal mit dem .NET WebService Studio getestet, bekomme aber immer
--- Zitat ---System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
--- Ende Zitat ---
Hab unseren Proxy bereits eingetragen, klappt aber noch nicht...
Navigation
[0] Themen-Index
[#] Nächste Seite
[*] Vorherige Sete
Zur normalen Ansicht wechseln