AlbertObille
asked on
Agent hang up in Lotus 6 Client
Hi!
I still have problems on my Java Agent running on Lotus Notes 6. It was called in our database and access another database to verify if the item in our database is already fix on ther database. The database is on server and the agent was run through onEvent. I tried to check the settings for Java Agent but still it doesnt work.
You can use this link:
http://oldlook.experts-exchange.com/questions/20758986/Problem-In-Lotus-Notes-6.html#9506399
Thank you for your time. I really need the fixes for this problem or else my boss will kick me out of the office.
Hope for your response soon. Thanks!
I still have problems on my Java Agent running on Lotus Notes 6. It was called in our database and access another database to verify if the item in our database is already fix on ther database. The database is on server and the agent was run through onEvent. I tried to check the settings for Java Agent but still it doesnt work.
You can use this link:
http://oldlook.experts-exchange.com/questions/20758986/Problem-In-Lotus-Notes-6.html#9506399
Thank you for your time. I really need the fixes for this problem or else my boss will kick me out of the office.
Hope for your response soon. Thanks!
What do you mean by "onEvents?" Please be specific as to how the agent is executed. I can't tell from this whether the agent runs client side, or server side, and if client side, via user action or in the background, and if background (client or server) what evcent or schedule kicks it off.
R6, by the way, offers server-side debugging. I know it works for LotusScript agents, I do npot know if it works for Java.
R6, by the way, offers server-side debugging. I know it works for LotusScript agents, I do npot know if it works for Java.
http://www-10.lotus.com/ldd/today.nsf/9148b29c86ffdcd385256658007aaa0f/ef1565a0b202808285256c94004fd0fb?OpenDocument
...
My unrestricted agent does not run (Notes/Domino 6 only)
You may have an agent that was signed by an unrestricted signer and that runs fine in R5, but after editing it with Domino Designer 6, the agent stops running. In this case, check the security tab of the Agent Properties box to see the runtime security setting:
Agent Properties security tab
An agent that has not been edited with Domino Designer 6 runs on a Domino 6 server with the rights of the signer just as it would in R5. So in the case of an unrestricted signer, the agent runs with unrestricted rights. But if the agent is edited by Domino Designer 6, the default setting is “Do not allow restricted operations” (the safer setting). If you want to perform unrestricted operations in the agent after you have edited it with Domino Designer 6, you need to explicitly set this security setting.
...
cheers,
Tom
...
My unrestricted agent does not run (Notes/Domino 6 only)
You may have an agent that was signed by an unrestricted signer and that runs fine in R5, but after editing it with Domino Designer 6, the agent stops running. In this case, check the security tab of the Agent Properties box to see the runtime security setting:
Agent Properties security tab
An agent that has not been edited with Domino Designer 6 runs on a Domino 6 server with the rights of the signer just as it would in R5. So in the case of an unrestricted signer, the agent runs with unrestricted rights. But if the agent is edited by Domino Designer 6, the default setting is “Do not allow restricted operations” (the safer setting). If you want to perform unrestricted operations in the agent after you have edited it with Domino Designer 6, you need to explicitly set this security setting.
...
cheers,
Tom
ASKER
Here are the codes of my Java Agent.
I tried already the security settings of the Java Agent Itself but it still doesnt work.
Kindly please review my codes. thanks.
The agent runs only once the command was executed.
I tried already the security settings of the Java Agent Itself but it still doesnt work.
Kindly please review my codes. thanks.
The agent runs only once the command was executed.
ASKER
SaveClientAction.java
import java.io.*;
import java.text.*;
import java.util.*;
public class SaveClientAction extends PrintStream {
static OutputStream logfile;
static PrintStream oldStdout;
static PrintStream oldStderr;
/**
*
* Constructor for instantiating the super class.
*
* @param ps java.io.PrintStream object.
*
*/
SaveClientAction(PrintStre am ps) {
super(ps);
}
/**
*
* Method to start copying stdout and stderr to the log file.
*
*/
public static synchronized void start(ProcessMessage pm) throws IOException {
// Save old settings.
pm.appendText("inside start save");
oldStdout = System.out;
oldStderr = System.err;
// Create/Open logfile.
pm.appendText("before new PrintStream");
logfile = new PrintStream(
new BufferedOutputStream(
new FileOutputStream("cmvcActi on.log", true)));
pm.appendText("\nafter new PrintStream");
// Start redirecting the output.
pm.appendText("before new save client action system out");
//System.setOut(new SaveClientAction(System.ou t, pm));
pm.appendText("before new save client action system err");
//System.setErr(new SaveClientAction(System.er r, pm));
}
/**
*
* Method to stop writing to log file and restore the original settings.
*
*/
public static synchronized void stop(ProcessMessage pm) {
pm.appendText("\nSTART CLIENT SOTP");
System.setOut(oldStdout); // after the message above, it hangs up here.
System.setErr(oldStderr);
try {
logfile.close();
} catch (Exception e) {
e.printStackTrace();
}
pm.appendText("\nFINISH CLIENT SOTP");
}
/**
*
* Overrides the write method of super class.
*
* @param b character to write.
*
*/
public void write(int b) {
try {
logfile.write(b);
} catch (Exception e) {
e.printStackTrace();
setError();
}
super.write(b);
}
/**
*
* Overrides the write method of super class.
*
* @param buf[] array of bytes to write.
* @param off offset.
* @param len length.
*
*/
public void write(byte buf[], int off, int len) {
try {
logfile.write(buf, off, len);
} catch (Exception e) {
e.printStackTrace();
setError();
}
super.write(buf, off, len);
}
}
SaveClientError.java
import java.io.*;
import java.text.*;
import java.util.*;
public class SaveClientError extends PrintStream {
static OutputStream logfile;
static PrintStream oldStdout;
static PrintStream oldStderr;
/**
*
* Constructor for instantiating the super class.
*
* @param ps java.io.PrintStream object.
*
*/
SaveClientError(PrintStrea m ps) {
super(ps);
}
/**
*
* Method to start copying stdout and stderr to the log file.
*
*/
public static void start() throws IOException {
// Save old settings.
oldStdout = System.out;
oldStderr = System.err;
// Create/Open logfile.
logfile = new PrintStream(
new BufferedOutputStream(
new FileOutputStream("cmvcErro r.log", true)));
// Start redirecting the output.
System.setOut(new SaveClientError(System.out ));
System.setErr(new SaveClientError(System.err ));
}
/**
*
* Method to stop writing to log file and restore the original settings.
*
*/
public static void stop() {
// pm.appendText("\nstarting saveclient error stop");
System.setOut(oldStdout);
System.setErr(oldStderr);
try {
logfile.close();
} catch (Exception e) {
e.printStackTrace();
}
//pm.appendText("\nFINISHE S STOP");
}
/**
*
* Overrides the write method of super class.
*
* @param b character to write.
*
*/
public void write(int b) {
try {
logfile.write(b);
} catch (Exception e) {
e.printStackTrace();
setError();
}
super.write(b);
}
/**
*
* Overrides the write method of super class.
*
* @param buf[] array of bytes to write.
* @param off offset.
* @param len length.
*
*/
public void write(byte buf[], int off, int len) {
try {
logfile.write(buf, off, len);
} catch (Exception e) {
e.printStackTrace();
setError();
}
super.write(buf, off, len);
}
}
UserPasswordProfile.java
public class UserPasswordProfile {
public UserPasswordProfile() {
}
}
import java.io.*;
import java.text.*;
import java.util.*;
public class SaveClientAction extends PrintStream {
static OutputStream logfile;
static PrintStream oldStdout;
static PrintStream oldStderr;
/**
*
* Constructor for instantiating the super class.
*
* @param ps java.io.PrintStream object.
*
*/
SaveClientAction(PrintStre
super(ps);
}
/**
*
* Method to start copying stdout and stderr to the log file.
*
*/
public static synchronized void start(ProcessMessage pm) throws IOException {
// Save old settings.
pm.appendText("inside start save");
oldStdout = System.out;
oldStderr = System.err;
// Create/Open logfile.
pm.appendText("before new PrintStream");
logfile = new PrintStream(
new BufferedOutputStream(
new FileOutputStream("cmvcActi
pm.appendText("\nafter new PrintStream");
// Start redirecting the output.
pm.appendText("before new save client action system out");
//System.setOut(new SaveClientAction(System.ou
pm.appendText("before new save client action system err");
//System.setErr(new SaveClientAction(System.er
}
/**
*
* Method to stop writing to log file and restore the original settings.
*
*/
public static synchronized void stop(ProcessMessage pm) {
pm.appendText("\nSTART CLIENT SOTP");
System.setOut(oldStdout); // after the message above, it hangs up here.
System.setErr(oldStderr);
try {
logfile.close();
} catch (Exception e) {
e.printStackTrace();
}
pm.appendText("\nFINISH CLIENT SOTP");
}
/**
*
* Overrides the write method of super class.
*
* @param b character to write.
*
*/
public void write(int b) {
try {
logfile.write(b);
} catch (Exception e) {
e.printStackTrace();
setError();
}
super.write(b);
}
/**
*
* Overrides the write method of super class.
*
* @param buf[] array of bytes to write.
* @param off offset.
* @param len length.
*
*/
public void write(byte buf[], int off, int len) {
try {
logfile.write(buf, off, len);
} catch (Exception e) {
e.printStackTrace();
setError();
}
super.write(buf, off, len);
}
}
SaveClientError.java
import java.io.*;
import java.text.*;
import java.util.*;
public class SaveClientError extends PrintStream {
static OutputStream logfile;
static PrintStream oldStdout;
static PrintStream oldStderr;
/**
*
* Constructor for instantiating the super class.
*
* @param ps java.io.PrintStream object.
*
*/
SaveClientError(PrintStrea
super(ps);
}
/**
*
* Method to start copying stdout and stderr to the log file.
*
*/
public static void start() throws IOException {
// Save old settings.
oldStdout = System.out;
oldStderr = System.err;
// Create/Open logfile.
logfile = new PrintStream(
new BufferedOutputStream(
new FileOutputStream("cmvcErro
// Start redirecting the output.
System.setOut(new SaveClientError(System.out
System.setErr(new SaveClientError(System.err
}
/**
*
* Method to stop writing to log file and restore the original settings.
*
*/
public static void stop() {
// pm.appendText("\nstarting saveclient error stop");
System.setOut(oldStdout);
System.setErr(oldStderr);
try {
logfile.close();
} catch (Exception e) {
e.printStackTrace();
}
//pm.appendText("\nFINISHE
}
/**
*
* Overrides the write method of super class.
*
* @param b character to write.
*
*/
public void write(int b) {
try {
logfile.write(b);
} catch (Exception e) {
e.printStackTrace();
setError();
}
super.write(b);
}
/**
*
* Overrides the write method of super class.
*
* @param buf[] array of bytes to write.
* @param off offset.
* @param len length.
*
*/
public void write(byte buf[], int off, int len) {
try {
logfile.write(buf, off, len);
} catch (Exception e) {
e.printStackTrace();
setError();
}
super.write(buf, off, len);
}
}
UserPasswordProfile.java
public class UserPasswordProfile {
public UserPasswordProfile() {
}
}
I don't see a NotesMain anywhere in your code. That's the entry point the agent manager's JVM uses.
ASKER
Hello guys!
here is the complete source code of my agent. Please gave me feedback for this. In R5, I encountered warnings about the deprecated classes but in R6, it doesnt have warnings. It just hangs up. Please help me..... Thank you in advance
CMVCAgent.java
import java.io.IOException;
import java.util.Date;
import lotus.domino.*;
public class CMVCAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
String action = session.getEnvironmentStri ng("action ", false);
String cmvcNo = session.getEnvironmentStri ng("cmvcNo ", false);
String family = session.getEnvironmentStri ng("family ", false);
String unid = session.getEnvironmentStri ng("unid", false);
String authMethod = session.getEnvironmentStri ng("PA_CMV C_AUTH_MET HOD", false);
AgentContext agentContext = session.getAgentContext();
Database db = agentContext.getCurrentDat abase();
String serverName = db.getServer();
System.out.println(serverN ame);
Document doc = db.getProfileDocument("Fil eName Profile", null);
String projectDb = doc.getItemValueString("pr ofiletxtTM SFile");
String cmvcDb = doc.getItemValueString("pr ofiletxtPR File");
Name user = session.getUserNameObject( );
doc = db.getProfileDocument("CMV CUserInfor mation", user.getAbbreviated());
String userName = doc.getItemValueString("DB 2UserName" );
String passwd = doc.getItemValueString("DB 2Password" );
boolean isToProcess = false;
boolean isToSave = false;
if (authMethod.equals("pw")) {
if (userName == null || userName.equals("")) {
PasswordFrame pwFrame = new PasswordFrame();
userName = pwFrame.getUserName();
passwd = pwFrame.getPassword();
System.out.println(userNam e + " " + passwd);
isToProcess = pwFrame.isToProcess();
isToSave = pwFrame.isToSave();
} else if (passwd == null || passwd.equals("")) {
PasswordFrame pwFrame = new PasswordFrame(userName);
userName = pwFrame.getUserName();
passwd = pwFrame.getPassword();
System.out.println(userNam e + " " + passwd);
isToProcess = pwFrame.isToProcess();
isToSave = pwFrame.isToSave();
} else {
isToProcess = true;
}
} else {
isToProcess = true;
}
if (isToProcess == true) {
if (action.equals("open") || action.equals("view")) {
new MainProcess(userName, passwd, action, cmvcNo, family, null, null, authMethod, serverName, cmvcDb, projectDb, session);
} else if (action.equals("note") || action.equals("cancel") || action.equals("reopen")) {
new RemarksFrame(userName, passwd, action, cmvcNo, family, authMethod, serverName, cmvcDb, projectDb);
} else if (action.equals("verify")) {
new VerifyFrame(userName, passwd, action, cmvcNo, family, unid, authMethod, serverName, cmvcDb, projectDb);
}
}
if (isToSave == true) {
if (doc != null) {
Item userItem = doc.replaceItemValue("DB2U serName", userName);
userItem.setEncrypted(true );
Item passItem = doc.replaceItemValue("DB2P assword", passwd);
passItem.setEncrypted(true );
doc.encrypt();
doc.save(true);
}
}
} catch (NotesException nx) {
try {
SaveClientError.start();
System.out.println(new Date());
System.out.println("NotesM ain Exception: " + nx.id + " " + nx.text);
SaveClientError.stop();
} catch (IOException iox) {
System.out.println(iox);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
CommandProcessor.java
import java.io.IOException;
import java.util.Date;
import java.util.Vector;
public class CommandProcessor {
private Vector cmvcData = new Vector();
private Vector cmvcErrData = new Vector();
private boolean isError;
/**
*
* Constructor for executing the CMVC Commands and storing the unparsed data.
*
* @param dosCommand Command to be used by a process.
* @param remarks String passed to the {@link ibmpa.cmvc.streams.OutputS treamThrea d} Class.
*
*/
public CommandProcessor(String dosCommand, String remarks) {
try {
Runtime runtime = Runtime.getRuntime();
Process cmvcProcess = runtime.exec(dosCommand);
new ErrorStreamThread(cmvcProc ess.getErr orStream() , cmvcErrData).start();
new InputStreamThread(cmvcProc ess.getInp utStream() , cmvcData).start();
new OutputStreamThread(cmvcPro cess.getOu tputStream (), remarks).start();
cmvcProcess.waitFor();
synchronized (cmvcData) {
if (cmvcData.size() == 0)
isError = true;
}
} catch (Exception ex) {
try {
SaveClientError.start();
System.out.println(new Date());
System.out.println("Comman dProcessor Exception: " + ex);
SaveClientError.stop();
} catch (IOException iox) {
System.out.println(iox);
}
}
}
/**
*
* Method for determining if error occurred.
*
* @return boolean - if true then error, if false then data is valid.
*
*/
public boolean isError() {
return isError;
}
/**
*
* Method for getting CMVC DB2 Data.
*
* @return java.util.List object - unparsed data.
*
*/
public Vector getCmvcData() {
synchronized (cmvcData) {
return cmvcData;
}
}
/**
*
* Method for getting the CMVC DB2 Error Data.
*
* @return java.util.List object - error data.
*
*/
public Vector getCmvcErrData() {
synchronized (cmvcErrData) {
return cmvcErrData;
}
}
}
DataProcessor.java
import java.util.Vector;
public class DataProcessor {
private String cmvcNo;
private String state;
private String abstrak;
private String family;
private String release;
private String phaseFound;
private String severity;
private String prefix;
private String symptom;
private String component;
private String brand;
private String targetDate;
private String targetState;
private String envName;
private String lastUpdate;
private String problemRemarks;
private String remarksHistory;
private String openDate;
private String workingDate;
private String returnDate;
private String cancelDate;
private String verifyDate;
private String closeDate;
private String openedBy;
private String workedBy;
private String returnedBy;
private String canceledBy;
private String verifiedBy;
private String closedBy;
private String ownerLogin;
private String ownerName;
private String originName;
private String originArea;
// addendum
private String reference;
private String duplicate;
private String age;
private String answer;
private String level;
private String assignDate;
private String responseDate;
private String endDate;
private String ownerArea;
private String remoteName;
private String remoteFamily;
private String phaseInject;
private String priority;
private String target;
private String source;
// @PC
private String originLogin;
/**
*
* Constructor for initializing CMVC number and family.
*
* @param cmvcNo CMVC number.
* @param family CMVC family.
*
*/
public DataProcessor(String cmvcNo, String family) {
this.cmvcNo = cmvcNo;
this.family = family;
}
/**
*
* Method for setting the fields in a Notes CMVC document.
*
* @param doc Stub object wrapping a Notes Document object.
*
*/
public void setDoc(NotesCMVCDocument doc) {
doc.setName(cmvcNo);
doc.setFamily(family);
doc.setPrefix(prefix);
doc.setAbstract(abstrak);
doc.setSeverity(severity);
doc.setState(state);
doc.setTargetDate(targetDa te);
doc.setTargetState(targetS tate);
doc.setComponent(component );
doc.setRelease(release);
doc.setSymptom(symptom);
doc.setPhaseFound(phaseFou nd);
doc.setBrand(brand);
doc.setEnvName(envName);
doc.setRemarksHistory(rema rksHistory );
doc.setLastUpdate(lastUpda te);
doc.setOpenDate(openDate);
doc.setWorkingDate(working Date);
doc.setReturnDate(returnDa te);
doc.setCancelDate(cancelDa te);
doc.setVerifyDate(verifyDa te);
doc.setCloseDate(closeDate );
doc.setOpenedBy(openedBy);
doc.setWorkedBy(workedBy);
doc.setReturnedBy(returned By);
doc.setCanceledBy(canceled By);
doc.setVerifiedBy(verified By);
doc.setClosedBy(closedBy);
doc.setOwnerLogin(ownerLog in);
doc.setOwnerName(ownerName );
doc.setOriginName(originNa me);
doc.setOriginArea(originAr ea);
doc.setReference(reference );
doc.setDuplicate(duplicate );
doc.setAge(age);
doc.setAnswer(answer);
doc.setLevel(level);
doc.setAssignDate(assignDa te);
doc.setResponseDate(respon seDate);
doc.setEndDate(endDate);
doc.setOwnerArea(ownerArea );
doc.setRemoteName(remoteNa me);
doc.setRemoteFamily(remote Family);
doc.setPhaseInject(phaseIn ject);
doc.setPriority(priority);
doc.setTarget(target);
doc.setSource(source);
// @PC
doc.setOriginLogin(originL ogin);
}
/**
*
* Method for loading the date fields in a Notes CMVC Document.
*
* @param doc Stub object wrapping a Notes Document object.
*
*/
public void loadDates(NotesCMVCDocumen t doc) {
doc.setName(cmvcNo);
doc.setFamily(family);
doc.loadDates();
openDate = (doc.getOpenDate() == null) ? "" : doc.getOpenDate();
workingDate = (doc.getWorkingDate() == null) ? "" : doc.getWorkingDate();
returnDate = (doc.getReturnDate() == null) ? "" : doc.getReturnDate();
cancelDate = (doc.getCancelDate() == null) ? "" : doc.getCancelDate();
verifyDate = (doc.getVerifyDate() == null) ? "" : doc.getVerifyDate();
closeDate = (doc.getCloseDate() == null) ? "" : doc.getCloseDate();
openedBy = (doc.getOpenedBy() == null) ? "" : doc.getOpenedBy();
workedBy = (doc.getWorkedBy() == null) ? "" : doc.getWorkedBy();
returnedBy = (doc.getReturnedBy() == null) ? "" : doc.getReturnedBy();
canceledBy = (doc.getCanceledBy() == null) ? "" : doc.getCanceledBy();
verifiedBy = (doc.getVerifiedBy() == null) ? "" : doc.getVerifiedBy();
closedBy = (doc.getClosedBy() == null) ? "" : doc.getClosedBy();
}
/**
*
* Method for parsing the data from a {@link ibmpa.cmvc.CommandProcesso r} Object.
*
* @param cmvcData unparsed data from CMVC DB2.
*
*/
public void parseRetrievedDoc(Vector cmvcData) {
String str = (String) cmvcData.elementAt(1);
str = str.substring(14);
prefix = str.trim();
str = (String) cmvcData.elementAt(3);
str = str.substring(14);
reference = str.trim();
str = (String) cmvcData.elementAt(4);
str = str.substring(14);
abstrak = str.trim();
str = (String) cmvcData.elementAt(5);
str = str.substring(14);
duplicate = str.trim();
str = (String) cmvcData.elementAt(7);
str = str.substring(14);
state = str.trim();
str = (String) cmvcData.elementAt(8);
str = str.substring(14);
severity = str.trim();
str = (String) cmvcData.elementAt(9);
str = str.substring(14);
age = str.trim();
str = (String) cmvcData.elementAt(11);
str = str.substring(14, 40);
component = str.trim();
str = (String) cmvcData.elementAt(11);
str = str.substring(56);
answer = str.trim();
str = (String) cmvcData.elementAt(12);
str = str.substring(14);
release = str.trim();
str = (String) cmvcData.elementAt(13);
str = str.substring(14);
envName = str.trim();
str = (String) cmvcData.elementAt(14);
str = str.substring(14);
level = str.trim();
str = (String) cmvcData.elementAt(16);
str = str.substring(56);
assignDate = str.trim();
str = (String) cmvcData.elementAt(17);
str = str.substring(14, 40);
lastUpdate = str.trim();
str = (String) cmvcData.elementAt(17);
str = str.substring(56);
responseDate = str.trim();
str = (String) cmvcData.elementAt(18);
str = str.substring(14);
endDate = str.trim();
str = (String) cmvcData.elementAt(20);
str = str.substring(14, 40);
ownerLogin = str.trim();
// @PC
str = (String) cmvcData.elementAt(20);
str = str.substring(56);
originLogin = str.trim();
str = (String) cmvcData.elementAt(21);
str = str.substring(14, 40);
ownerName = str.trim();
str = (String) cmvcData.elementAt(21);
str = str.substring(56);
originName = str.trim();
str = (String) cmvcData.elementAt(22);
str = str.substring(14, 40);
ownerArea = str.trim();
str = (String) cmvcData.elementAt(22);
str = str.substring(56);
originArea = str.trim();
str = (String) cmvcData.elementAt(24);
str = str.substring(14, 40);
remoteName = str.trim();
str = (String) cmvcData.elementAt(24);
str = str.substring(56);
remoteFamily = str.trim();
str = (String) cmvcData.elementAt(25);
str = str.substring(14);
symptom = str.trim();
str = (String) cmvcData.elementAt(26);
str = str.substring(14);
phaseFound = str.trim();
str = (String) cmvcData.elementAt(27);
str = str.substring(14);
phaseInject = str.trim();
str = (String) cmvcData.elementAt(28);
str = str.substring(14);
priority = str.trim();
str = (String) cmvcData.elementAt(29);
str = str.substring(14);
target = str.trim();
str = (String) cmvcData.elementAt(30);
str = str.substring(14);
source = str.trim();
str = (String) cmvcData.elementAt(31);
str = str.substring(14);
targetDate = str.trim();
str = (String) cmvcData.elementAt(32);
str = str.substring(14);
targetState = str.trim();
str = (String) cmvcData.elementAt(33);
str = str.substring(14);
brand = str.trim();
for (int i = 41; i < cmvcData.size(); i++) {
str = (String) cmvcData.elementAt(i);;
if (str.equals(""))
continue;
if (str.startsWith("duplicate defects:"))
break;
if (str.length() < 40)
continue;
String dateStr = str.substring(4, 23);
String action = str.substring(25, 40).trim();
String userStr = str.substring(41).trim();
if (action.equals("open")) {
if (openDate.equals("")) {
openDate = dateStr;
openedBy = userStr;
} else if (openDate.compareTo(dateSt r) > 0) {
openDate = dateStr;
openedBy = userStr;
}
} else if (action.equals("accept")) {
if (workingDate.equals("")) {
workingDate = dateStr;
workedBy = userStr;
} else if (workingDate.compareTo(dat eStr) > 0) {
workingDate = dateStr;
workedBy = userStr;
}
} else if (action.equals("return")) {
if (returnDate.compareTo(date Str) < 0) {
returnDate = dateStr;
returnedBy = userStr;
}
} else if (action.equals("cancel")) {
if (cancelDate.compareTo(date Str) < 0) {
cancelDate = dateStr;
canceledBy = userStr;
}
} else if (action.equals("verify")) {
if (verifyDate.compareTo(date Str) < 0) {
verifyDate = dateStr;
verifiedBy = userStr;
}
} else if (action.equals("close")) {
if (closeDate.compareTo(dateS tr) < 0) {
closeDate = dateStr;
closedBy = userStr;
}
}
}
str = "";
for (int i = 34; i < cmvcData.size(); i++) {
str += (String) cmvcData.elementAt(i) + "~";
}
byte[] b = str.getBytes();
int length = (b.length > 32000) ? 32000 : b.length;
remarksHistory = new String(b, 0, length);
}
/**
*
* Method for parsing the new CMVC number taken from CMVC DB2 System after opening a CMVC.
*
* @param cmvcData unparsed data from CMVC DB2.
* @return String object - new CMVC number.
*
*/
public String parseNewCMVCNo(Vector cmvcData) {
String str = (String) cmvcData.elementAt(1);
str = str.substring(25, str.indexOf('.')).trim();
return str;
}
/**
*
* Method for changing the CMVC number after verify-rejecting a CMVC.
*
* @param cmvcNo old CMVC number.
* @return String object - new CMVC number.
*
*/
public String parseNewCMVCNo(String cmvcNo) {
int startIndex;
if ((startIndex = cmvcNo.lastIndexOf("f_")) != -1) {
String str = cmvcNo.substring(startInde x + 2, cmvcNo.length());
int newNo = Integer.parseInt(str);
cmvcNo = cmvcNo.substring(0, startIndex + 2) + (newNo + 1);
this.cmvcNo = cmvcNo;
return cmvcNo;
} else {
cmvcNo = cmvcNo + "f_1";
this.cmvcNo = cmvcNo;
return cmvcNo;
}
}
/**
*
* Method for transforming a set of CMVC fields into a command String for opening a CMVC record.
*
* @param component Component/Categories field in Notes CMVC document.
* @param abstrak Abstract/Subject field in Notes CMVC document.
* @param release Release/Product field in Notes CMVC document.
* @param prefix Prefix field in Notes CMVC document.
* @param severity Severity field in Notes CMVC document.
* @param symptom Symptom field in Notes CMVC document.
* @param phaseFound Phase field in Notes CMVC document.
* @param brand Brand field in Notes CMVC document.
* @return String object - Command String for {@link ibmpa.cmvc.CommandProcesso r} Object.
*
*/
public String openCMVCString(String component, String abstrak,
String release, String prefix,
String severity, String symptom,
String phaseFound, String brand) {
String str = "defect -open -family \"" + family +
"\" -component \"" + component +
"\" -remarks -" +
" -abstract \"" + abstrak +
"\" -release \"" + release +
"\" -prefix \"" + prefix +
"\" -severity \"" + severity +
"\" -symptom \"" + symptom +
"\" -phasefound \"" + phaseFound +
"\" -brand \"" + brand +
"\"";
return str;
}
/**
*
* Method for returning command String for viewing a CMVC record.
*
* @return String object - Command String for {@link ibmpa.cmvc.CommandProcesso r} Object.
*
*/
public String viewCMVCString() {
String str = "defect -long -view " + cmvcNo + " -family " + family;
return str;
}
/**
*
* Method for returning command String for canceling a CMVC record.
*
* @return String object - Command String for {@link ibmpa.cmvc.CommandProcesso r} Object.
*
*/
public String cancelCMVCString() {
String str = "defect -cancel " + cmvcNo + " -family " + family +
" -remarks -";
return str;
}
/**
*
* Method for returning command String for reopening a CMVC record.
*
* @return String object - Command String for {@link ibmpa.cmvc.CommandProcesso r} Object.
*
*/
public String reopenCMVCString() {
String str = "defect -reopen " + cmvcNo + " -family " + family +
" -remarks -";
return str;
}
/**
*
* Method for returning command String for verify-rejecting a CMVC record.
*
* @return String object - Command String for {@link ibmpa.cmvc.CommandProcesso r} Object.
*
*/
public String verifyOpenCMVCString() {
String str = "verifycm -reject -defect " + cmvcNo + " -family " + family +
" -remarks -";
return str;
}
/**
*
* Method for returning command String for verify-closing a CMVC record.
*
* @return String object - Command String for {@link ibmpa.cmvc.CommandProcesso r} Object.
*
*/
public String verifyCloseCMVCString() {
String str = "verifycm -accept -defect " + cmvcNo + " -family " + family +
" -remarks -";
return str;
}
/**
*
* Method for returning command String for noting a CMVC record.
*
* @return String object - Command String for {@link ibmpa.cmvc.CommandProcesso r} Object.
*
*/
public String addCMVCRemarksString() {
String str = "defect -note " + cmvcNo + " -family " + family +
" -remarks -";
return str;
}
/**
*
* Method for getting the last update of a CMVC record.
*
* @return String object - date of last update of CMVC record.
*
*/
public String getLastUpdate() {
return lastUpdate;
}
}
Entry.java
import java.io.IOException;
import java.util.Date;
import java.util.Vector;
import lotus.domino.*;
public class Entry {
private String product = "Unspecified";
private String area = "Unspecified";
private String serverName;
private String projectDb;
public Entry(String serverName, String projectDb) {
this.serverName = serverName;
this.projectDb = projectDb;
}
/**
*
* Method for searching problem area given product name and component.
*
*/
public void searchProduct(String release) {
try {
NotesThread.sinitThread();
Session session = NotesFactory.createSession ();
Database db = session.getDatabase(server Name, projectDb);
DocumentCollection dc = db.search("Form=\"CMVCProf ile\"");
Document doc = dc.getFirstDocument();
if (doc != null) {
Item item = doc.getFirstItem("releasen ame");
Vector releases = item.getValues();
item = doc.getFirstItem("productn ame");
Vector products = item.getValues();
int count = 0;
for (int i = 0; i < releases.size(); i++) {
if (release.equals(releases.e lementAt(i ))) {
count++;
product = (String) products.elementAt(i);
}
if (count > 1) {
break;
}
}
if (count != 1) {
product = "Unspecified";
}
}
} catch (NotesException nx) {
try {
SaveClientError.start();
System.out.println(new Date());
System.out.println("Entry Exception: " + nx.id + " " + nx.text);
SaveClientError.stop();
} catch (IOException iox) {
System.out.println(iox);
}
} finally {
NotesThread.stermThread();
}
}
/**
*
* Method for searching problem area given product name and component.
*
*/
public void searchProblemArea(String product, String component) {
this.product = product;
try {
NotesThread.sinitThread();
Session session = NotesFactory.createSession ();
Database db = session.getDatabase(server Name, projectDb);
DocumentCollection dc = db.search("form=\"Componen ts\" & (productname=\"" + product + "\" | productname=\"Common\")");
Document doc = dc.getFirstDocument();
while (doc != null) {
Item item = doc.getFirstItem("componen tname");
Vector components = item.getValues();
item = doc.getFirstItem("area");
Vector areas = item.getValues();
if (components.contains(compo nent) == true) {
int idx = components.indexOf(compone nt);
area = (String) areas.elementAt(idx);
break;
}
doc = dc.getNextDocument();
}
} catch (NotesException nx) {
try {
SaveClientError.start();
System.out.println(new Date());
System.out.println("Entry Exception: " + nx.id + " " + nx.text);
SaveClientError.stop();
} catch (IOException iox) {
System.out.println(iox);
}
} finally {
NotesThread.stermThread();
}
}
public String getProduct() {
return product;
}
public String getArea() {
return area;
}
}
ErrorStreamThread.java
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Vector;
public class ErrorStreamThread extends Thread {
private InputStream errStream;
private Vector cmvcErrData;
/**
*
* Constructor for initializing the error stream and List object.
*
* @param errStream java.io.InputStream object.
* @param cmvcErrData java.util.Vector object.
*
*/
public ErrorStreamThread(InputStr eam errStream, Vector cmvcErrData) {
this.errStream = errStream;
this.cmvcErrData = cmvcErrData;
}
/**
*
* Method for starting the thread.
*
*/
public void run() {
try {
BufferedReader err = new BufferedReader(new InputStreamReader(errStrea m));
String str = null;
synchronized (cmvcErrData) {
while ((str = err.readLine()) != null) {
cmvcErrData.addElement(str );
}
}
} catch (java.io.IOException e) {
System.out.println(e);
}
}
}
InputStreamThread.java
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Vector;
public class InputStreamThread extends Thread {
private InputStream inStream;
private Vector cmvcData;
/**
*
* Constructor for initializing the input stream and List object.
*
* @param inStream java.io.InputStream object.
* @param cmvcData java.util.Vector object.
*
*/
public InputStreamThread(InputStr eam inStream, Vector cmvcData) {
this.inStream = inStream;
this.cmvcData = cmvcData;
}
/**
*
* Method for starting the thread.
*
*/
public void run() {
try {
BufferedReader in = new BufferedReader(new InputStreamReader(inStream ));
String str = null;
synchronized (cmvcData) {
while ((str = in.readLine()) != null) {
cmvcData.addElement(str);
}
}
} catch (java.io.IOException e) {
System.out.println(e);
}
}
}
MainProcess.java
import java.io.IOException;
import java.util.Date;
import java.util.Vector;
import lotus.domino.*;
public class MainProcess {
NotesCMVCDocument doc;
DataProcessor data;
CommandProcessor comProc;
ProcessMessage processMessage;
// @PC 02192002 deleted on purpose
// MessageDialog messageDialog;
String userName;
String password;
String action;
String cmvcNo;
String family;
String remark;
String unid;
String authMethod;
Session SessionTemp;
/**
*
* Constructor for executing the CMVC functions.
*
* @param args Array of String objects for command and fields.
*
*/
public MainProcess(String userName, String password, String action, String cmvcNo, String family, String remark, String unid, String authMethod, String serverName, String cmvcDb, String projectDb, Session SessionTemp) {
this.userName = userName;
this.password = password;
this.action = action;
this.cmvcNo = cmvcNo;
this.family = family;
this.remark = remark;
this.unid = unid;
this.authMethod = authMethod;
try {
// create a window for displaying the progress of transaction.
processMessage = new ProcessMessage("CMVC Transaction Message");
// @PC 02192002 deleted on purpose
// messageDialog = new MessageDialog(processMessa ge);
doc = new NotesCMVCDocument(serverNa me, cmvcDb, projectDb); // create a Notes CMVC Document.
data = new DataProcessor(cmvcNo, family); // create a CMVC DB2 Data Processor.
if (authMethod != null && authMethod.equals("pw")) {
processMessage.appendText( "User " + userName + " is logging in...");
// log in to CMVC DB2 System.
comProc = new CommandProcessor("cmvclog -in " + userName + " -noprompt " + password +
" -family " + family, "");
if (comProc.isError() == true) {
if (comProc.getCmvcErrData(). isEmpty() == false) {
throw new CMVCException(showCMVCErro r(comProc. getCmvcErr Data()));
}
}
processMessage.appendText( "ok\n");
}
processMessage.appendText( "\nTransac tion Processing...\n");
processMessage.appendText( "Please wait...\n" + action);
// OPEN CMVC OPERATION
if (action.equals("open")) {
doc.loadData(cmvcNo); // get the Data from Domino to open to CMVC DB2 System.
String component = doc.getComponent();
String problemRemarks = doc.getProblemRemark();
String abstrak = doc.getAbstract();
String release = doc.getRelease();
String prefix = doc.getPrefix();
String severity = doc.getSeverity();
String symptom = doc.getSymptom();
String phaseFound = doc.getPhaseFound();
String brand = doc.getBrand();
processMessage.appendText( "Opening a CMVC to DB2...\n");
String dosCommand = data.openCMVCString(compon ent, abstrak, release,
prefix, severity, symptom,
phaseFound, brand);
// open a CMVC to DB2
comProc = new CommandProcessor(dosComman d, problemRemarks);
logOperation(dosCommand, processMessage); // log the action.
if (comProc.isError() == true) {
throw new CMVCException(showCMVCErro r(comProc. getCmvcErr Data()));
} else {
processMessage.appendText( "Retrievin g the new CMVC Number...\n");
String newCmvcNo = data.parseNewCMVCNo(comPro c.getCmvcD ata());
doc.updateNewNum(newCmvcNo , cmvcNo);
data = new DataProcessor(newCmvcNo, family);
viewCMVC(processMessage, data, doc);
}
// VIEW CMVC OPERATION
} else if (action.equals("view")) {
viewCMVC(processMessage, data, doc);
// CANCEL CMVC OPERATION
} else if (action.equals("cancel")) {
processMessage.appendText( "Canceling the CMVC in DB2...\n");
String dosCommand = data.cancelCMVCString();
comProc = new CommandProcessor(dosComman d, remark);
logOperation(dosCommand,pr ocessMessa ge); // log the action.
cleanup(processMessage, data, comProc, doc, "\nThe CMVC has been canceled in DB2.\n\n");
// REOPEN CMVC OPERATION
} else if (action.equals("reopen")) {
processMessage.appendText( "Reopening the CMVC in DB2...\n");
String dosCommand = data.reopenCMVCString();
comProc = new CommandProcessor(dosComman d, remark);
logOperation(dosCommand,pr ocessMessa ge); // log the action.
cleanup(processMessage, data, comProc, doc, "\nThe CMVC has been reopened in DB2.\n\n");
// ACCEPT CMVC OPERATION
} else if (action.equals("accept")) {
processMessage.appendText( "Verify accepting the CMVC in DB2...\n");
String dosCommand = data.verifyCloseCMVCString ();
comProc = new CommandProcessor(dosComman d, remark);
logOperation(dosCommand,pr ocessMessa ge); // log the action.
cleanup(processMessage, data, comProc, doc, "\nThe CMVC has been verify accepted in DB2.\n\n");
// REJECT CMVC OPERATION
} else if (action.equals("reject")) {
processMessage.appendText( "Verify rejecting the CMVC in DB2...\n");
String dosCommand = data.verifyOpenCMVCString( );
comProc = new CommandProcessor(dosComman d, remark);
logOperation(dosCommand,pr ocessMessa ge); // log the action.
if (comProc.isError() == true) {
throw new CMVCException(showCMVCErro r(comProc. getCmvcErr Data()));
} else {
processMessage.appendText( "Updating spawned CMVC Number to Domino...\n");
doc.updateNewNum(data.pars eNewCMVCNo (cmvcNo), unid);
data = new DataProcessor(data.parseNe wCMVCNo(cm vcNo), family);
do {
comProc = new CommandProcessor(data.view CMVCString (), "");
processMessage.appendText( "Refreshin g the CMVC from DB2 1...\n");
} while (comProc.isError() == true);
saveData(processMessage, data, comProc, doc);
}
// NOTE CMVC OPERATION
} else if (action.equals("note")) {
processMessage.appendText( "Noting the CMVC in DB2...\n");
String dosCommand = data.addCMVCRemarksString( );
comProc = new CommandProcessor(dosComman d, remark);
logOperation(dosCommand, processMessage); // log the action.
cleanup(processMessage, data, comProc, doc, "\nThe CMVC has been noted in DB2.\n\n");
}
// @PC 02192002 deleted on purpose, changed to ...
// messageDialog.showMessage( "Transacti on processed successfully.\n\nPlease refresh document from view (F9).", "CMVC");
processMessage.appendText( "\nTransac tion processed successfully.\n\nPlease refresh document from view (F9).\n\n");
} catch (CMVCException cx) {
} catch (Exception e) {
try {
SaveClientError.start();
System.out.println(new Date());
System.out.println("CMVCMa in Exception: " + e);
//e.printStackTrace();
SaveClientError.stop();
// @PC 02192002 deleted on purpose
// messageDialog.showMessage( "Transaction failed! Please send " +
// "cmvcError.log in <Notes> directory to TEMS " +
// "Development Team for technical support.",
// "CMVC Java Error");
try
{
SessionTemp.setEnvironment Var("JavaR esult", "FALSE", false);
}
catch (Exception me)
{
me.printStackTrace();
}
processMessage.appendText( "Transacti on failed! Please send cmvcError.log in <Notes> " +
"directory to TEMS Development Team for technical support.");
} catch (IOException iox) {
System.out.println(iox);
}
}
processMessage.dispose();
// messageDialog.dispose();
}
/**
*
* Method for displaying the error message from CMVC DB2 System in a window.
*
* @param error Error message from DB2.
*
*/
// Method for displaying error messages sent by the CMVC DB2 System.
private String showCMVCError(Vector error) {
String str = "";
for (int i = 0; i < error.size(); i++) {
str += (String) error.elementAt(i) + "\n";
}
// @PC 02192002 deleted on purpose
// messageDialog.showMessage( "Transacti on failed!\n\n" + str, "CMVC DB2 Error Message");
processMessage.appendText( "Transacti on failed!\n\n" + str);
return str;
}
// Method for logging operations done to CMVC DB2 System by the user.
private void logOperation(String operation, ProcessMessage pm) throws java.io.IOException {
pm.appendText("inside logoperation before saveclientaction start\n");
SaveClientAction.start(pm) ;
pm.appendText("inside logoperation after saveclientaction start\n");
System.out.print(new Date());
System.out.println("\t" + operation);
pm.appendText("inside logoperation before saveclientaction stop\n");
SaveClientAction.stop(pm);
pm.appendText("inside logoperationafter saveclientaction stop\n");
}
// Method for saving data to Domino Server.
private void saveData(ProcessMessage pm, DataProcessor dp, CommandProcessor cp, NotesCMVCDocument doc) {
pm.appendText("Saving data to Domino...\n");
dp.loadDates(doc);
dp.parseRetrievedDoc(cp.ge tCmvcData( ));
dp.setDoc(doc);
doc.storeData();
}
// Method for viewing a CMVC in DB2 System.
private void viewCMVC(ProcessMessage pm, DataProcessor dp, NotesCMVCDocument doc) throws IOException, CMVCException {
pm.appendText("Refreshing the CMVC from DB22 in viewcmvc...\n");
String dosCommand = dp.viewCMVCString();
pm.appendText("After doscommand" + dosCommand);
CommandProcessor comProc = new CommandProcessor(dosComman d, "");
pm.appendText("After new command processor");
logOperation(dosCommand, pm); // log the action.
pm.appendText("After dos command");
if (comProc.isError() == true) {
throw new CMVCException(showCMVCErro r(comProc. getCmvcErr Data()));
} else {
pm.appendText("Before save data");
saveData(pm, dp, comProc, doc);
pm.appendText("After save data");
}
}
// Method for cleaning up after an operation to CMVC DB2.
private void cleanup(ProcessMessage pm, DataProcessor dp, CommandProcessor cp,
NotesCMVCDocument doc, String message) throws java.io.IOException, CMVCException {
if (cp.isError() == true) {
if (cp.getCmvcErrData().isEmp ty() == false) {
throw new CMVCException(showCMVCErro r(cp.getCm vcErrData( )));
} else {
pm.appendText(message);
viewCMVC(pm, dp, doc);
}
}
}
class CMVCException extends Exception {
CMVCException(String message) {
super(message);
}
}
}
MessageDialog.java
import java.awt.Button;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Panel;
import java.awt.Rectangle;
import java.awt.TextArea;
import java.awt.Toolkit;
import java.awt.event.ActionEvent ;
import java.awt.event.ActionListe ner;
public class MessageDialog extends Dialog implements ActionListener {
TextArea textArea;
public MessageDialog(Frame window) {
super(window, true);
Panel p1 = new Panel();
textArea = new TextArea();
p1.add(textArea);
Panel p2 = new Panel();
p2.setLayout(new FlowLayout());
Button okButton = new Button("OK");
p2.add(okButton);
okButton.addActionListener (this);
add("Center", p1);
add("South", p2);
}
public void actionPerformed(ActionEven t evt) {
setVisible(false);
}
public void showMessage(String message, String title) {
setTitle(title);
textArea.append(message);
pack();
Dimension screenSize = Toolkit.getDefaultToolkit( ).getScree nSize();
Rectangle rect = getBounds();
setLocation((screenSize.wi dth-rect.w idth)/2,(s creenSize. height-rec t.height)/ 2);
setVisible(true);
}
}
NotesCMVCDocument.java
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Date;
import java.util.Properties;
import lotus.domino.*;
public class NotesCMVCDocument {
// metadata
String serverName;
String cmvcDb;
String projectDb;
// Document data
protected String cmvcNo;
protected String state;
protected String abstrak;
protected String family;
protected String release;
protected String phaseFound;
protected String severity;
protected String prefix;
protected String symptom;
protected String component;
protected String brand;
protected String targetDate;
protected String targetState;
protected String envName;
private String problemRemark;
protected String remarksHistory;
protected String lastUpdate;
protected String openDate;
protected String workingDate;
protected String returnDate;
protected String cancelDate;
protected String verifyDate;
protected String closeDate;
protected String openedBy;
protected String workedBy;
protected String returnedBy;
protected String canceledBy;
protected String verifiedBy;
protected String closedBy;
protected String ownerLogin;
protected String ownerName;
protected String originName;
protected String originArea;
// addendum
protected String reference;
protected String duplicate;
protected String age;
protected String answer;
protected String level;
protected String assignDate;
protected String responseDate;
protected String endDate;
protected String ownerArea;
protected String remoteName;
protected String remoteFamily;
protected String phaseInject;
protected String priority;
protected String target;
protected String source;
// @PC
protected String originLogin;
public NotesCMVCDocument (String serverName, String cmvcDb, String projectDb) {
this.serverName = serverName;
this.cmvcDb = cmvcDb;
this.projectDb = projectDb;
System.out.println(cmvcDb) ;
}
/**
*
* Method for storing data to Notes CMVC database.
* @return boolean - true if data were stored in database.
*
*/
public void storeData() {
try {
NotesThread.sinitThread();
Session session = NotesFactory.createSession ();
Database db = session.getDatabase(server Name, cmvcDb);
DocumentCollection dc = db.search("Form=\"CMVC\" & CMVC_No=\"" + cmvcNo + "\" & familyalias=\"" + family + "\"");
Document doc = dc.getFirstDocument();
while (doc != null) {
System.out.println("store doc " + cmvcNo);
if (component.equals(doc.getI temValueSt ring("Cate gories")) == false) {
Entry entry = new Entry(serverName, projectDb);
entry.searchProblemArea(do c.getItemV alueString ("kw_produ ct"), component);
doc.replaceItemValue("kw_p roblem_are a", entry.getArea());
}
doc.replaceItemValue("kw_p refix", prefix);
doc.replaceItemValue("Subj ect", abstrak);
doc.replaceItemValue("kw_s everity", severity);
doc.replaceItemValue("kw_s tate", state);
doc.replaceItemValue("date _fixTarget Date", targetDate);
doc.replaceItemValue("kw_f ix_target_ state", targetState);
doc.replaceItemValue("Cate gories", component);
doc.replaceItemValue("kw_r elease", release);
doc.replaceItemValue("kw_s ymptom", symptom);
doc.replaceItemValue("kw_p hase", phaseFound);
doc.replaceItemValue("kw_b rand", brand);
doc.replaceItemValue("last Update", lastUpdate);
doc.replaceItemValue("txt_ history", "");
replaceHistory(doc);
doc.replaceItemValue("open date", openDate);
doc.replaceItemValue("work ingdate", workingDate);
doc.replaceItemValue("retu rndate", returnDate);
doc.replaceItemValue("canc eldate", cancelDate);
doc.replaceItemValue("veri fydate", verifyDate);
doc.replaceItemValue("clos edate", closeDate);
doc.replaceItemValue("open edby", openedBy);
doc.replaceItemValue("work edby", workedBy);
doc.replaceItemValue("retu rnedby", returnedBy);
doc.replaceItemValue("canc eledby", canceledBy);
doc.replaceItemValue("veri fiedby", verifiedBy);
doc.replaceItemValue("clos edby", closedBy);
doc.replaceItemValue("deve loperLogin ", ownerLogin);
doc.replaceItemValue("deve loper", ownerName);
doc.replaceItemValue("txt_ reference" , reference);
doc.replaceItemValue("txt_ duplicate" , duplicate);
doc.replaceItemValue("txt_ age", age);
doc.replaceItemValue("txt_ answer", answer);
doc.replaceItemValue("txt_ envName", envName);
doc.replaceItemValue("txt_ level", level);
doc.replaceItemValue("txt_ assignDate ", assignDate);
doc.replaceItemValue("txt_ responseDa te", responseDate);
doc.replaceItemValue("txt_ endDate", endDate);
doc.replaceItemValue("txt_ ownerArea" , ownerArea);
doc.replaceItemValue("txt_ remoteName ", remoteName);
doc.replaceItemValue("txt_ remoteFami ly", remoteFamily);
doc.replaceItemValue("txt_ phaseInjec t", phaseInject);
doc.replaceItemValue("txt_ priority", priority);
doc.replaceItemValue("txt_ target", target);
doc.replaceItemValue("txt_ source", source);
// @PC
doc.replaceItemValue("Orig inLogin", originLogin);
doc.replaceItemValue("Orig inArea", originArea);
doc.replaceItemValue("Orig inName", originName);
// add 012702
doc.replaceItemValue("kw_l ocation", originArea);
doc.save(true);
doc = dc.getNextDocument();
}
} catch (NotesException nx) {
try {
SaveClientError.start();
System.out.println(new Date());
System.out.println("NotesD ocument Exception: " + nx.id + " " + nx.text);
SaveClientError.stop();
} catch (IOException iox) {
System.out.println(iox);
}
} finally {
NotesThread.stermThread();
}
}
private void replaceHistory(Document doc) throws NotesException {
RichTextItem history = (RichTextItem) doc.getFirstItem("txt_Hist ory");
int startIndex = 0;
int endIndex;
while ((endIndex = remarksHistory.indexOf("~" , startIndex)) != -1) {
history.appendText(remarks History.su bstring(st artIndex, endIndex));
history.addNewLine();
startIndex = endIndex + 1;
}
}
public void loadDates() {
try {
System.out.println("initia lizing notesthread");
NotesThread.sinitThread();
System.out.println("creati ng a new session");
Session session = NotesFactory.createSession ();
Database db = session.getDatabase(server Name, cmvcDb);
DocumentCollection dc = db.search("Form=\"CMVC\" & CMVC_No=\"" + cmvcNo + "\" & familyalias=\"" + family + "\"");
Document doc = dc.getFirstDocument();
while (doc != null) {
System.out.println("load dates ok");
openDate = doc.getItemValueString("op endate");
workingDate = doc.getItemValueString("wo rkingdate" );
returnDate = doc.getItemValueString("re turndate") ;
cancelDate = doc.getItemValueString("ca nceldate") ;
verifyDate = doc.getItemValueString("ve rifydate") ;
closeDate = doc.getItemValueString("cl osedate");
openedBy = doc.getItemValueString("op enedby");
workedBy = doc.getItemValueString("wo rkedby");
returnedBy = doc.getItemValueString("re turnedby") ;
canceledBy = doc.getItemValueString("ca nceledby") ;
verifiedBy = doc.getItemValueString("ve rifiedby") ;
closedBy = doc.getItemValueString("cl osedby");
doc = dc.getNextDocument();
}
} catch (NotesException nx) {
try {
SaveClientError.start();
System.out.println(new Date());
System.out.println("NotesD ocument Exception: " + nx.id + " " + nx.text);
SaveClientError.stop();
} catch (IOException iox) {
System.out.println(iox);
}
} finally {
NotesThread.stermThread();
}
}
public void updateNewNum(String cmvcNo, String unid) {
try {
NotesThread.sinitThread();
Session session = NotesFactory.createSession ();
Database db = session.getDatabase(server Name, cmvcDb);
Document doc = db.getDocumentByUNID(unid) ;
if (doc != null) {
doc.replaceItemValue("CMVC _No", cmvcNo);
doc.save(true);
}
} catch (NotesException nx) {
try {
SaveClientError.start();
System.out.println(new Date());
System.out.println("NotesD ocument Exception: " + nx.id + " " + nx.text);
SaveClientError.stop();
} catch (IOException iox) {
System.out.println(iox);
}
} finally {
NotesThread.stermThread();
}
}
public void loadData(String unid) {
try {
System.out.println(unid);
NotesThread.sinitThread();
Session session = NotesFactory.createSession ();
Database db = session.getDatabase(server Name, cmvcDb);
System.out.println(serverN ame + " " + cmvcDb);
Document doc = db.getDocumentByUNID(unid) ;
if (doc != null) {
problemRemark = (new ProblemRemark(doc)).toStri ng();
abstrak = doc.getItemValueString("Su bject");
release = doc.getItemValueString("kw _release") ;
phaseFound = doc.getItemValueString("kw _phase");
severity = doc.getItemValueString("kw _severity" );
prefix = doc.getItemValueString("kw _prefix");
symptom = doc.getItemValueString("kw _symptom") ;
component = doc.getItemValueString("Ca tegories") ;
brand = doc.getItemValueString("kw _brand");
}
} catch (NotesException nx) {
try {
SaveClientError.start();
System.out.println(new Date());
System.out.println("NotesD ocument Exception: " + nx.id + " " + nx.text);
SaveClientError.stop();
} catch (IOException iox) {
System.out.println(iox);
}
} finally {
NotesThread.stermThread();
}
}
public void setName(String name) {
cmvcNo = name;
}
public void setFamily(String family) {
this.family = family;
}
public void setState(String state) {
this.state = state;
}
public void setAbstract(String abstrak) {
this.abstrak = abstrak;
}
public void setRelease(String release) {
this.release = release;
}
public void setPhaseFound(String phaseFound) {
this.phaseFound = phaseFound;
}
public void setSeverity(String severity) {
this.severity = severity;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
public void setSymptom(String symptom) {
this.symptom = symptom;
}
public void setComponent(String comp) {
this.component = comp;
}
public void setBrand(String brand) {
this.brand = brand;
}
public void setTargetDate(String fixDate) {
this.targetDate = fixDate;
}
public void setTargetState(String targetState) {
this.targetState = targetState;
}
public void setRemarksHistory(String remarksHistory) {
this.remarksHistory = remarksHistory;
}
public void setOwnerLogin(String ownerLogin) {
this.ownerLogin = ownerLogin;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
public void setOriginName(String originName) {
this.originName = originName;
}
public void setOriginArea(String originArea) {
this.originArea = originArea;
}
public void setLastUpdate(String lastUpdate) {
this.lastUpdate = lastUpdate;
}
// addendum
public void setReference(String reference) {
this.reference = reference;
}
public void setDuplicate(String duplicate) {
this.duplicate = duplicate;
}
public void setAge(String age) {
this.age = age;
}
public void setAnswer(String answer) {
this.answer = answer;
}
public void setEnvName(String envName) {
this.envName = envName;
}
public void setLevel(String level) {
this.level = level;
}
public void setAssignDate(String assignDate) {
this.assignDate = assignDate;
}
public void setResponseDate(String responseDate) {
this.responseDate = responseDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
public void setOwnerArea(String ownerArea) {
this.ownerArea = ownerArea;
}
public void setRemoteName(String remoteName) {
this.remoteName = remoteName;
}
public void setRemoteFamily(String remoteFamily) {
this.remoteFamily = remoteFamily;
}
public void setPhaseInject(String phaseInject) {
this.phaseInject = phaseInject;
}
public void setPriority(String priority) {
this.priority = priority;
}
public void setTarget(String target) {
this.target = target;
}
public void setSource(String source) {
this.source = source;
}
// @PC
public void setOriginLogin(String originLogin) {
this.originLogin = originLogin;
}
// dates
public void setOpenDate(String openDate) {
this.openDate = openDate;
}
public void setWorkingDate(String workingDate) {
this.workingDate = workingDate;
}
public void setReturnDate(String returnDate) {
this.returnDate = returnDate;
}
public void setCancelDate(String cancelDate) {
this.cancelDate = cancelDate;
}
public void setVerifyDate(String verifyDate) {
this.verifyDate = verifyDate;
}
public void setCloseDate(String closeDate) {
this.closeDate = closeDate;
}
public String getOpenDate() {
return openDate;
}
public String getWorkingDate() {
return workingDate;
}
public String getReturnDate() {
return returnDate;
}
public String getCancelDate() {
return cancelDate;
}
public String getVerifyDate() {
return verifyDate;
}
public String getCloseDate() {
return closeDate;
}
public void setOpenedBy(String openedBy) {
this.openedBy = openedBy;
}
public void setWorkedBy(String workedBy) {
this.workedBy = workedBy;
}
public void setReturnedBy(String returnedBy) {
this.returnedBy = returnedBy;
}
public void setCanceledBy(String canceledBy) {
this.canceledBy = canceledBy;
}
public void setVerifiedBy(String verifiedBy) {
this.verifiedBy = verifiedBy;
}
public void setClosedBy(String closedBy) {
this.closedBy = closedBy;
}
public String getOpenedBy() {
return openedBy;
}
public String getWorkedBy() {
return workedBy;
}
public String getReturnedBy() {
return returnedBy;
}
public String getCanceledBy() {
return canceledBy;
}
public String getVerifiedBy() {
return verifiedBy;
}
public String getClosedBy() {
return closedBy;
}
public String getProblemRemark() {
return problemRemark;
}
// open data
public String getAbstract() {
return abstrak;
}
public String getRelease() {
return release;
}
public String getPhaseFound() {
return phaseFound;
}
public String getSeverity() {
return severity;
}
public String getPrefix() {
return prefix;
}
public String getSymptom() {
return symptom;
}
public String getComponent() {
return component;
}
public String getBrand() {
return brand;
}
}
OutputStreamThread.java
import java.io.BufferedWriter;
import java.io.OutputStream;
import java.io.OutputStreamWriter ;
public class OutputStreamThread extends Thread {
private OutputStream outStream;
private String data;
/**
*
* Constructor for initializing the output stream and string to be written.
*
* @param outStream java.io.OutputStream object.
* @param data java.lang.String object.
*
*/
public OutputStreamThread(OutputS tream outStream, String data) {
this.outStream = outStream;
this.data = data;
}
/**
*
* Method for starting the thread.
*
*/
public void run() {
try {
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(outStre am));
for (int i = 0; i < data.length(); i++) {
if ((data.charAt(i) == '\\') && (data.charAt(i+1) == 'n')) {
out.write('\n');
i++;
} else if ((data.charAt(i) == '\\') && (data.charAt(i+1) == 't')) {
out.write('\t');
i++;
} else {
out.write(data.charAt(i));
}
}
out.write('\u001A');
out.close();
} catch (java.io.IOException e) {
System.out.println(e);
}
}
}
PasswordFrame.java
import java.awt.Button;
import java.awt.BorderLayout;
import java.awt.Checkbox;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Font;
import java.awt.Label;
import java.awt.Panel;
import java.awt.TextField;
import java.awt.Toolkit;
import java.awt.event.ActionEvent ;
import java.awt.event.ActionListe ner;
import java.awt.event.WindowEvent ;
import java.awt.event.WindowListe ner;
import java.io.IOException;
import java.util.Date;
import lotus.domino.*;
public class PasswordFrame extends Frame implements ActionListener, WindowListener {
boolean isUserSet;
boolean isToSave = false;
boolean isToProcess = false;
String userStr;
String passStr;
TextField userName;
TextField password;
Checkbox saveEntry;
Button okButton;
Button cancelButton;
public PasswordFrame() {
Panel p1 = new Panel();
p1.setLayout(new BorderLayout());
Label label1 = new Label("UserName:", Label.RIGHT);
label1.setFont(new Font("Arial", Font.BOLD, 14));
Label label2 = new Label(" ");
label2.setFont(new Font("Arial", Font.PLAIN, 1));
Label label3 = new Label("Password:", Label.RIGHT);
label3.setFont(new Font("Arial", Font.BOLD, 14));
p1.add("North", label1);
p1.add("Center", label2);
p1.add("South", label3);
Panel p2 = new Panel();
p2.setLayout(new BorderLayout());
userName = new TextField(20);
userName.setFont(new Font("Arial", Font.PLAIN, 14));
Label emptyLabel = new Label(" ");
emptyLabel.setFont(new Font("Arial", Font.PLAIN, 1));
password = new TextField(20);
password.setFont(new Font("Arial", Font.PLAIN, 14));
password.setEchoChar('*');
p2.add("North", userName);
p2.add("Center", emptyLabel);
p2.add("South", password);
Panel p3 = new Panel();
p3.add(p1);
p3.add(p2);
p3.setBackground(Color.lig htGray);
add("Center", p3);
Panel p4 = new Panel();
saveEntry = new Checkbox("Save Username and Password");
saveEntry.setFont(new Font("Arial", Font.PLAIN, 14));
p4.setBackground(Color.lig htGray);
p4.add(saveEntry);
add("South", p4);
Panel p5 = new Panel();
p5.setLayout(new BorderLayout());
okButton = new Button("OK");
okButton.setFont(new Font("Arial", Font.PLAIN, 14));
Label emptyLabel2 = new Label(" ");
emptyLabel2.setFont(new Font("Arial", Font.PLAIN, 4));
cancelButton = new Button("Cancel");
cancelButton.setFont(new Font("Arial", Font.PLAIN, 14));
okButton.addActionListener (this);
cancelButton.addActionList ener(this) ;
p5.add("North", okButton);
p5.add("Center", emptyLabel2);
p5.add("South", cancelButton);
p5.setBackground(Color.lig htGray);
Panel p6 = new Panel();
p6.setBackground(Color.lig htGray);
p6.add(p5);
add("East", p6);
Dimension screenSize = Toolkit.getDefaultToolkit( ).getScree nSize();
setBounds((screenSize.widt h-400)/2,( screenSize .height-15 0)/2,400,1 50);
addWindowListener(this);
setTitle("CMVC Login");
setResizable(false);
setVisible(true);
}
public PasswordFrame(String userName) {
this();
this.userName.setText(user Name);
}
public void actionPerformed(ActionEven t evt) {
Object source = evt.getSource();
if (source == okButton) {
setVisible(false);
setUserPassword();
dispose();
} else if (source == cancelButton) {
cancelAction();
dispose();
}
}
public void windowOpened(WindowEvent e) {}
public void windowClosing(WindowEvent e) {
dispose();
}
public void windowClosed(WindowEvent e) {}
public void windowIconified(WindowEven t e) {}
public void windowDeiconified(WindowEv ent e) {}
public void windowActivated(WindowEven t e) {}
public void windowDeactivated(WindowEv ent e) {}
private synchronized void setUserPassword() {
if (saveEntry.getState() == true) {
isToSave = true;
}
userStr = userName.getText();
passStr = password.getText();
isUserSet = true;
isToProcess = true;
notifyAll();
}
private synchronized void cancelAction() {
isUserSet = true;
notifyAll();
}
public synchronized String getUserName() {
while (isUserSet == false) {
try {
wait();
} catch (InterruptedException iex) {}
}
return userStr;
}
public synchronized String getPassword() {
while (isUserSet == false) {
try {
wait();
} catch (InterruptedException iex) {}
}
return passStr;
}
public boolean isToSave() {
return isToSave;
}
public boolean isToProcess() {
return isToProcess;
}
/*private void saveUserPassword() {
try {
//NotesThread.sinitThread( );
//Session session = NotesFactory.createSession ();
//Database db = session.getDatabase(server Name, cmvcDb);
//db.open();
} catch (NotesException nx) {
try {
SaveClientError.start();
System.out.println(new Date());
System.out.println("Passwo rdFrame Exception: " + nx.id + " " + nx.text);
SaveClientError.stop();
} catch (IOException iox) {
System.out.println(iox);
}
} finally {
NotesThread.stermThread();
}
}*/
}
ProblemRemark.java
import lotus.domino.*;
public class ProblemRemark {
String string;
/**
*
* Constructor for formatting the Problem Remarks fields into Java String.
*
* @param doc Notes Document object.
*
*/
public ProblemRemark(Document doc) throws NotesException {
string = "PROBLEM DESCRIPTION:\n" +
doc.getItemValueString("rt xt_Problem _Descripti on") + "\n\n" +
"< Observed symptom ? >" + "\n" +
(doc.getItemValueString("t xt_Observe d_Symptoms ") == null ? "" : doc.getItemValueString("tx t_Observed _Symptoms" )) + "\n\n" +
"< Error message/code ? > " + "\n" +
(doc.getItemValueString("t xt_Error_M essage") == null ? "" : doc.getItemValueString("tx t_Error_Me ssage")) + "\n\n" +
"< Conditions to reproduce ? >" + "\n" +
(doc.getItemValueString("t xt_Conditi ons_Rep") == null ? "" : doc.getItemValueString("tx t_Conditio ns_Rep")) + "\n\n" +
"< Expected Behavior ? >" + "\n" +
(doc.getItemValueString("t xt_Expecte d_Behavior ") == null ? "" : doc.getItemValueString("tx t_Expected _Behavior" )) + "\n\n" +
"< How to Recover ? >" + "\n" +
(doc.getItemValueString("t xt_Recover ") == null ? "" : doc.getItemValueString("tx t_Recover" )) + "\n\n" +
"< Other Information >" + "\n" +
(doc.getItemValueString("t xt_Other_I nfo") == null ? "" : doc.getItemValueString("tx t_Other_In fo")) + "\n\n" +
// "What is the actual symptom seen ? " + "\n" +
// (doc.getItemValueString("t xt_Actual_ Symptoms") == null ? "" : doc.getItemValueString("tx t_Actual_S ymptoms")) + "\n" +
// "What is mandatory condition to recreate ? " + "\n" +
// (doc.getItemValueString("t xt_Mandato ry_Conditi on") == null ? "" : doc.getItemValueString("tx t_Mandator y_Conditio n")) + "\n\n" +
"VERIFICATION:\n" +
"ITEM\t\tYES / NO\tREMARK\n" +
"Frequency : " +
(doc.getItemValueString("k w_Frequenc y") == null ? "" : doc.getItemValueString("kw _Frequency ")) +
" (\"S\" olid / \"I\" intermittent)\n" +
"Unique to EUT ?\t" +
(doc.getItemValueString("k w_unique_e ut") == null ? "" : doc.getItemValueString("kw _unique_eu t")) + "\t" +
(doc.getItemValueString("t xt_unique_ eut") == null ? "" : doc.getItemValueString("tx t_unique_e ut")) + "\n" +
"Unique to Configuration ?\t" +
(doc.getItemValueString("k w_unique_c onfig") == null ? "" : doc.getItemValueString("kw _unique_co nfig")) + "\t" +
(doc.getItemValueString("t xt_unique_ config") == null ? "" : doc.getItemValueString("tx t_unique_c onfig")) + "\n" +
"Unique to OS ?\t" +
(doc.getItemValueString("k w_unique_o s") == null ? "" : doc.getItemValueString("kw _unique_os ")) + "\t" +
(doc.getItemValueString("t xt_unique_ os") == null ? "" : doc.getItemValueString("tx t_unique_o s")) + "\n" +
"Unique to Product ?\t" +
(doc.getItemValueString("k w_unique_p roduct") == null ? "" : doc.getItemValueString("kw _unique_pr oduct")) + "\t" +
(doc.getItemValueString("t xt_unique_ product") == null ? "" : doc.getItemValueString("tx t_unique_p roduct")) + "\n" +
// @PC
// removed this lines!
// "Unique to IBM ?\t" +
// (doc.getItemValueString("k w_unique_i ndustry") == null ? "" : doc.getItemValueString("kw _unique_in dustry")) + "\t" +
// (doc.getItemValueString("t xt_unique_ industry") == null ? "" : doc.getItemValueString("tx t_unique_i ndustry")) + "\n\n" +
//
"Unique to Current Version ?\t" +
(doc.getItemValueString("k w_unique_c urrent") == null ? "" : doc.getItemValueString("kw _unique_cu rrent")) + "\t" +
(doc.getItemValueString("t xt_unique_ current") == null ? "" : doc.getItemValueString("tx t_unique_c urrent")) + "\n\n" +
"OTHER\n\n" +
(doc.getItemValueString("r txt_Proble m_Verifica tion") == null ? "" : doc.getItemValueString("rt xt_Problem _Verificat ion")) + "\n\n" +
"[RE-CREATION PROCEDURE]\n\n" +
(doc.getItemValueString("r txt_Recrea tion_proc" ) == null ? "" : doc.getItemValueString("rt xt_Recreat ion_proc") ) + "\n\n" +
"MISC. INFORMATION:\n\n" +
"(reviewed by " +
(doc.getItemValueString("t xt_reviewe d_by_copy" ) == null ? "" : doc.getItemValueString("tx t_reviewed _by_copy") ) + ")\n" +
// @PC changed the position of this lines
// "Frequency : " +
// (doc.getItemValueString("k w_Frequenc y") == null ? "" : doc.getItemValueString("kw _Frequency ")) +
// " (\"S\" olid / \"I\" intermittent)\n" +
"Test item : " +
(doc.getItemValueString("t xt_Test_It em_copy") == null ? "" : doc.getItemValueString("tx t_Test_Ite m_copy")) + "\n" +
"Test case : " +
(doc.getItemValueString("t xt_Test_ca se_copy") == null ? "" : doc.getItemValueString("tx t_Test_cas e_copy")) + "\n\n" +
"Suspective area : " +
(doc.getItemValueString("k w_suspecti ve_area") == null ? "" : doc.getItemValueString("kw _suspectiv e_area")) + "\n" +
"Suspective reason : " +
(doc.getItemValueString("t xt_suspect ive_reason ") == null ? "" : doc.getItemValueString("tx t_suspecti ve_reason" )) + "\n\n" +
"[H/W]\n" +
"H/W level : " +
(doc.getItemValueString("t xt_HW_leve l") == null ? "" : doc.getItemValueString("tx t_HW_level ")) + "\n" +
"S/N : " +
(doc.getItemValueString("t xt_SN") == null ? "" : doc.getItemValueString("tx t_SN")) + "\n" +
"CPU : " +
(doc.getItemValueString("t xt_CPU") == null ? "" : doc.getItemValueString("tx t_CPU")) + "\n" +
"LCD : " +
(doc.getItemValueString("t xt_LCD") == null ? "" : doc.getItemValueString("tx t_LCD")) + "\n" +
"HDD : " +
(doc.getItemValueString("t xt_HDD") == null ? "" : doc.getItemValueString("tx t_HDD")) + " GB\n" +
"Memory : " +
(doc.getItemValueString("t xt_Memory" ) == null ? "" : doc.getItemValueString("tx t_Memory") ) + "MB\n" +
"2nd Drive : " +
(doc.getItemValueString("t xt_CDROM_m odel") == null ? "" : doc.getItemValueString("tx t_CDROM_mo del")) + "\n" +
// @PC
// removed this lines!
// "MPEG : " +
// (doc.getItemValueString("t xt_MPEG") == null ? "" : doc.getItemValueString("tx t_MPEG")) + "\n" +
//
// "Peripheral : " +
// (doc.getItemValueString("t xt_Periphe ral") == null ? "" : doc.getItemValueString("tx t_Peripher al")) + "\n\n\n" +
"[S/W]\n" +
"ROM : " +
(doc.getItemValueString("t xt_ROM") == null ? "" : doc.getItemValueString("tx t_ROM")) + "\n" +
"H8 : " +
(doc.getItemValueString("t xt_H8") == null ? "" : doc.getItemValueString("tx t_H8")) + "\n" +
"OS : " +
(doc.getItemValueString("t xt_OS") == null ? "" : doc.getItemValueString("tx t_OS")) + "\n" +
"CSD : " +
(doc.getItemValueString("t xt_CSD") == null ? "" : doc.getItemValueString("tx t_CSD")) + "\n" +
"Patch : " +
(doc.getItemValueString("t xt_Patch") == null ? "" : doc.getItemValueString("tx t_Patch")) + "\n" +
"Utility : " +
(doc.getItemValueString("t xt_Utility _driver") == null ? "" : doc.getItemValueString("tx t_Utility_ driver")) + "\n" +
"Video : " +
(doc.getItemValueString("t xt_Video_d river") == null ? "" : doc.getItemValueString("tx t_Video_dr iver")) + "\n" +
"Audio : " +
(doc.getItemValueString("t xt_Audio_d river") == null ? "" : doc.getItemValueString("tx t_Audio_dr iver")) + "\n" +
// @PC
// removed this lines!
// "PCMCIA : " +
// (doc.getItemValueString("t xt_PCMCIA_ driver") == null ? "" : doc.getItemValueString("tx t_PCMCIA_d river")) + "\n" +
//
// "IR : " +
// (doc.getItemValueString("t xt_IR_driv er") == null ? "" : doc.getItemValueString("tx t_IR_drive r")) + "\n" +
"Modem : " +
(doc.getItemValueString("t xt_Modem_d river") == null ? "" : doc.getItemValueString("tx t_Modem_dr iver")) + "\n" +
"Capture : " +
(doc.getItemValueString("t xt_Capture _driver") == null ? "" : doc.getItemValueString("tx t_Capture_ driver")) + "\n" +
// @PC
// removed this lines!
// "MPEG : " +
// (doc.getItemValueString("t xt_MPEG_dr iver") == null ? "" : doc.getItemValueString("tx t_MPEG_dri ver")) + "\n" +
//
// "CDROM : " +
// (doc.getItemValueString("t xt_CDROM_d river") == null ? "" : doc.getItemValueString("tx t_CDROM_dr iver")) + "\n" +
//
// "DVD : " +
// (doc.getItemValueString("t xt_DVD_dri ver") == null ? "" : doc.getItemValueString("tx t_DVD_driv er")) + "\n" +
"Wireless Driver : " +
(doc.getItemValueString("t xt_Wireles s_driver") == null ? "" : doc.getItemValueString("tx t_Wireless _driver")) + "\n" +
"Ethernet Driver : " +
(doc.getItemValueString("t xt_Etherne t_driver") == null ? "" : doc.getItemValueString("tx t_Ethernet _driver")) + "\n" +
"CDC [EDC/MDC/BDC] : " +
(doc.getItemValueString("t xt_CDC_dri ver") == null ? "" : doc.getItemValueString("tx t_CDC_driv er")) + "\n" +
"Hotkey Features : " +
(doc.getItemValueString("t xt_Hotkey_ Features") == null ? "" : doc.getItemValueString("tx t_Hotkey_F eatures")) + "\n" +
"CMD IDE Driver : " +
(doc.getItemValueString("t xt_CMD_IDE _Driver") == null ? "" : doc.getItemValueString("tx t_CMD_IDE_ Driver")) + "\n" +
"Package Manager : " +
(doc.getItemValueString("t xt_Package _Manager") == null ? "" : doc.getItemValueString("tx t_Package_ Manager")) + "\n" +
"Access Connections : " +
(doc.getItemValueString("t xt_Access_ Connection s") == null ? "" : doc.getItemValueString("tx t_Access_C onnections ")) + "\n" +
"Others : " +
(doc.getItemValueString("t xt_Others" ) == null ? "" : doc.getItemValueString("tx t_Others") ) + "\n\n\n" +
"[PARAMETER]\n" +
"BIOS Setting : " +
(doc.getItemValueString("t xt_BIOS_se tting") == null ? "" : doc.getItemValueString("tx t_BIOS_set ting")) + "\n" +
"OS Setting : " +
(doc.getItemValueString("t xt_OS_sett ing") == null ? "" : doc.getItemValueString("tx t_OS_setti ng"));
// @PC moved to another position
// "[RE-CREATION PROCEDURE]\n" +
// (doc.getItemValueString("r txt_Recrea tion_proc" ) == null ? "" : doc.getItemValueString("rt xt_Recreat ion_proc") ); // + "\n\n\n" +
//"[OTHER]\n" +
//(doc.getItemValueString( "txt_other ") == null ? "" : doc.getItemValueString("tx t_other")) ;
}
/**
*
* Method for getting the String equivalent of Problem Remarks.
*
*/
public String toString() {
return string;
}
}
ProcessMessage.java
import java.awt.Dimension;
import java.awt.Font;
import java.awt.ScrollPane;
import java.awt.TextArea;
import java.awt.Toolkit;
import java.awt.event.WindowEvent ;
import java.awt.event.WindowListe ner;
public class ProcessMessage extends java.awt.Frame implements WindowListener {
TextArea textArea;
/**
*
* Constructor for executing the display.
*
* @param title Window title.
*
*/
public ProcessMessage(String title) {
textArea = new TextArea();
textArea.setFont(new Font("Arial", Font.PLAIN, 12));
//textArea.setLineWrap(tru e);
//textArea.setWrapStyleWor d(true);
textArea.setEditable(false );
ScrollPane areaScrollPane = new ScrollPane();
areaScrollPane.add(textAre a);
areaScrollPane.setSize(new Dimension(600, 200));
add(areaScrollPane);
Dimension screenSize = Toolkit.getDefaultToolkit( ).getScree nSize();
setBounds((screenSize.widt h-640)/2,( screenSize .height-48 0)/2,640,2 40);
addWindowListener(this);
setTitle(title);
setVisible(true);
}
public void appendText(String message) {
textArea.append(message);
}
public void windowOpened(WindowEvent e) {}
public void windowClosing(WindowEvent e) {
dispose();
}
public void windowClosed(WindowEvent e) {}
public void windowIconified(WindowEven t e) {}
public void windowDeiconified(WindowEv ent e) {}
public void windowActivated(WindowEven t e) {}
public void windowDeactivated(WindowEv ent e) {}
}
RemarksFrame.java
import java.awt.Button;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Font;
import java.awt.Label;
import java.awt.Panel;
import java.awt.ScrollPane;
import java.awt.TextArea;
import java.awt.Toolkit;
import java.awt.event.ActionEvent ;
import java.awt.event.ActionListe ner;
import java.awt.event.WindowEvent ;
import java.awt.event.WindowListe ner;
import lotus.domino.*;
public class RemarksFrame extends Frame implements ActionListener, WindowListener {
Button okButton;
Button cancelButton;
TextArea textArea;
String userName;
String password;
String action;
String cmvcNo;
String family;
String authMethod;
String serverName;
String cmvcDb;
String projectDb;
/**
*
* Constructor for executing the display.
*
* @param title Window title.
*
*/
public RemarksFrame(String userName, String password, String action, String cmvcNo, String family, String authMethod, String serverName, String cmvcDb, String projectDb) {
this.userName = userName;
this.password = password;
this.action = action;
this.cmvcNo = cmvcNo;
this.family = family;
this.authMethod = authMethod;
this.serverName = serverName;
this.cmvcDb = cmvcDb;
this.projectDb = projectDb;
textArea = new TextArea();
Panel p1 = new Panel();
p1.setLayout(new BorderLayout());
Label label1 = new Label("Action:", Label.RIGHT);
Label label2 = new Label("CMVC No.:", Label.RIGHT);
p1.add("Center", label1);
p1.add("South", label2);
Panel p2 = new Panel();
p2.setLayout(new BorderLayout());
Label label3 = new Label(action);
Label label4 = new Label(cmvcNo);
label3.setFont(new Font("Arial", Font.BOLD, 12));
label4.setFont(new Font("Arial", Font.BOLD, 12));
p2.add("Center", label3);
p2.add("South", label4);
Panel p3 = new Panel();
p3.add(p1);
p3.add(p2);
p3.setBackground(Color.lig htGray);
add("North", p3);
textArea.setFont(new Font("Arial", Font.PLAIN, 12));
ScrollPane areaScrollPane = new ScrollPane();
areaScrollPane.add(textAre a);
areaScrollPane.setSize(new Dimension(600, 440));
add("Center", areaScrollPane);
Panel p4 = new Panel();
okButton = new Button(" OK ");
cancelButton = new Button("Cancel");
okButton.addActionListener (this);
cancelButton.addActionList ener(this) ;
p4.add(okButton);
p4.add(new Label(" "));
p4.add(cancelButton);
p4.setBackground(Color.lig htGray);
add("South", p4);
Dimension screenSize = Toolkit.getDefaultToolkit( ).getScree nSize();
setBounds((screenSize.widt h-640)/2,( screenSize .height-48 0)/2,640,4 80);
addWindowListener(this);
setTitle("CMVC Operation");
setVisible(true);
}
public void actionPerformed(ActionEven t evt) {
Object source = evt.getSource();
if (source == okButton) {
setVisible(false);
// new MainProcess(userName, password, action, cmvcNo, family, textArea.getText(), null, authMethod, serverName, cmvcDb, projectDb);
new MainProcess(userName, password, action, cmvcNo, family, textArea.getText(), null, authMethod, serverName, cmvcDb, projectDb, null);
dispose();
} else if (source == cancelButton) {
dispose();
}
}
public void windowOpened(WindowEvent e) {}
public void windowClosing(WindowEvent e) {
dispose();
}
public void windowClosed(WindowEvent e) {}
public void windowIconified(WindowEven t e) {}
public void windowDeiconified(WindowEv ent e) {}
public void windowActivated(WindowEven t e) {}
public void windowDeactivated(WindowEv ent e) {}
}
SaveClientAction.java
import java.io.*;
import java.text.*;
import java.util.*;
public class SaveClientAction extends PrintStream {
static OutputStream logfile;
static PrintStream oldStdout;
static PrintStream oldStderr;
/**
*
* Constructor for instantiating the super class.
*
* @param ps java.io.PrintStream object.
*
*/
SaveClientAction(PrintStre am ps) {
super(ps);
}
/**
*
* Method to start copying stdout and stderr to the log file.
*
*/
public static synchronized void start(ProcessMessage pm) throws IOException {
// Save old settings.
pm.appendText("inside start save");
oldStdout = System.out;
oldStderr = System.err;
// Create/Open logfile.
pm.appendText("before new PrintStream");
logfile = new PrintStream(
new BufferedOutputStream(
new FileOutputStream("cmvcActi on.log", true)));
pm.appendText("\nafter new PrintStream");
// Start redirecting the output.
pm.appendText("before new save client action system out");
//System.setOut(new SaveClientAction(System.ou t, pm));
pm.appendText("before new save client action system err");
//System.setErr(new SaveClientAction(System.er r, pm));
}
/**
*
* Method to stop writing to log file and restore the original settings.
*
*/
public static synchronized void stop(ProcessMessage pm) {
pm.appendText("\nSTART CLIENT SOTP");
System.setOut(oldStdout);
System.setErr(oldStderr);
try {
logfile.close();
} catch (Exception e) {
e.printStackTrace();
}
pm.appendText("\nFINISH CLIENT SOTP");
}
/**
*
* Overrides the write method of super class.
*
* @param b character to write.
*
*/
public void write(int b) {
try {
logfile.write(b);
} catch (Exception e) {
e.printStackTrace();
setError();
}
super.write(b);
}
/**
*
* Overrides the write method of super class.
*
* @param buf[] array of bytes to write.
* @param off offset.
* @param len length.
*
*/
public void write(byte buf[], int off, int len) {
try {
logfile.write(buf, off, len);
} catch (Exception e) {
e.printStackTrace();
setError();
}
super.write(buf, off, len);
}
}
SaveClientError.java
import java.io.*;
import java.text.*;
import java.util.*;
public class SaveClientError extends PrintStream {
static OutputStream logfile;
static PrintStream oldStdout;
static PrintStream oldStderr;
/**
*
* Constructor for instantiating the super class.
*
* @param ps java.io.PrintStream object.
*
*/
SaveClientError(PrintStrea m ps) {
super(ps);
}
/**
*
* Method to start copying stdout and stderr to the log file.
*
*/
public static void start() throws IOException {
// Save old settings.
oldStdout = System.out;
oldStderr = System.err;
// Create/Open logfile.
logfile = new PrintStream(
new BufferedOutputStream(
new FileOutputStream("cmvcErro r.log", true)));
// Start redirecting the output.
System.setOut(new SaveClientError(System.out ));
System.setErr(new SaveClientError(System.err ));
}
/**
*
* Method to stop writing to log file and restore the original settings.
*
*/
public static void stop() {
// pm.appendText("\nstarting saveclient error stop");
System.setOut(oldStdout);
System.setErr(oldStderr);
try {
logfile.close();
} catch (Exception e) {
e.printStackTrace();
}
//pm.appendText("\nFINISHE S STOP");
}
/**
*
* Overrides the write method of super class.
*
* @param b character to write.
*
*/
public void write(int b) {
try {
logfile.write(b);
} catch (Exception e) {
e.printStackTrace();
setError();
}
super.write(b);
}
/**
*
* Overrides the write method of super class.
*
* @param buf[] array of bytes to write.
* @param off offset.
* @param len length.
*
*/
public void write(byte buf[], int off, int len) {
try {
logfile.write(buf, off, len);
} catch (Exception e) {
e.printStackTrace();
setError();
}
super.write(buf, off, len);
}
}
UserPasswordProfile.java
public class UserPasswordProfile {
public UserPasswordProfile() {
}
}
VerifyFrame.java
import java.awt.Button;
import java.awt.BorderLayout;
import java.awt.Choice;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Font;
import java.awt.Label;
import java.awt.Panel;
import java.awt.ScrollPane;
import java.awt.TextArea;
import java.awt.Toolkit;
import java.awt.event.ActionEvent ;
import java.awt.event.ActionListe ner;
import java.awt.event.WindowEvent ;
import java.awt.event.WindowListe ner;
import lotus.domino.*;
public class VerifyFrame extends Frame implements ActionListener, WindowListener {
Button okButton;
Button cancelButton;
Choice result;
TextArea textArea;
String userName;
String password;
String action;
String cmvcNo;
String family;
String unid;
String authMethod;
String serverName;
String cmvcDb;
String projectDb;
/**
*
* Constructor for executing the display.
*
* @param title Window title.
*
*/
public VerifyFrame(String userName, String password, String action, String cmvcNo, String family, String unid, String authMethod, String serverName, String cmvcDb, String projectDb) {
this.userName = userName;
this.password = password;
this.action = action;
this.cmvcNo = cmvcNo;
this.family = family;
this.unid = unid;
this.authMethod = authMethod;
this.serverName = serverName;
this.cmvcDb = cmvcDb;
this.projectDb = projectDb;
textArea = new TextArea();
Panel p1 = new Panel();
p1.setLayout(new BorderLayout());
Label label1 = new Label("Action:", Label.RIGHT);
Label label2 = new Label("CMVC No.:", Label.RIGHT);
Label label3 = new Label("Result:", Label.RIGHT);
p1.add("North", label1);
p1.add("Center", label2);
p1.add("South", label3);
Panel p2 = new Panel();
p2.setLayout(new BorderLayout());
Label label4 = new Label(action);
Label label5 = new Label(cmvcNo);
result = new Choice();
result.add("PASS");
result.add("FAIL");
label4.setFont(new Font("Arial", Font.BOLD, 12));
label5.setFont(new Font("Arial", Font.BOLD, 12));
p2.add("North", label4);
p2.add("Center", label5);
p2.add("South", result);
Panel p3 = new Panel();
p3.add(p1);
p3.add(p2);
p3.setBackground(Color.lig htGray);
add("North", p3);
textArea.setFont(new Font("Arial", Font.PLAIN, 12));
ScrollPane areaScrollPane = new ScrollPane();
areaScrollPane.add(textAre a);
areaScrollPane.setSize(new Dimension(600, 440));
add("Center", areaScrollPane);
Panel p4 = new Panel();
okButton = new Button(" OK ");
cancelButton = new Button("Cancel");
okButton.addActionListener (this);
cancelButton.addActionList ener(this) ;
p4.add(okButton);
p4.add(new Label(" "));
p4.add(cancelButton);
p4.setBackground(Color.lig htGray);
add("South", p4);
Dimension screenSize = Toolkit.getDefaultToolkit( ).getScree nSize();
setBounds((screenSize.widt h-640)/2,( screenSize .height-48 0)/2,640,4 80);
addWindowListener(this);
setTitle("CMVC Operation");
setVisible(true);
}
public void actionPerformed(ActionEven t evt) {
Object source = evt.getSource();
if (source == okButton) {
setVisible(false);
String verifyResult = result.getSelectedItem();
if (verifyResult.equals("PASS ")) {
// new MainProcess(userName, password, "accept", cmvcNo, family, "Verification Result: PASS\n\n" + textArea.getText(), null, authMethod, serverName, cmvcDb, projectDb);
new MainProcess(userName, password, "accept", cmvcNo, family, "Verification Result: PASS\n\n" + textArea.getText(), null, authMethod, serverName, cmvcDb, projectDb, null);
} else if (verifyResult.equals("FAIL ")) {
// new MainProcess(userName, password, "reject", cmvcNo, family, "Verification Result: FAIL\n\n" + textArea.getText(), unid, authMethod, serverName, cmvcDb, projectDb);
new MainProcess(userName, password, "reject", cmvcNo, family, "Verification Result: FAIL\n\n" + textArea.getText(), unid, authMethod, serverName, cmvcDb, projectDb, null);
}
dispose();
} else if (source == cancelButton) {
dispose();
}
}
public void windowOpened(WindowEvent e) {}
public void windowClosing(WindowEvent e) {
dispose();
}
public void windowClosed(WindowEvent e) {}
public void windowIconified(WindowEven t e) {}
public void windowDeiconified(WindowEv ent e) {}
public void windowActivated(WindowEven t e) {}
public void windowDeactivated(WindowEv ent e) {}
}
here is the complete source code of my agent. Please gave me feedback for this. In R5, I encountered warnings about the deprecated classes but in R6, it doesnt have warnings. It just hangs up. Please help me..... Thank you in advance
CMVCAgent.java
import java.io.IOException;
import java.util.Date;
import lotus.domino.*;
public class CMVCAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
String action = session.getEnvironmentStri
String cmvcNo = session.getEnvironmentStri
String family = session.getEnvironmentStri
String unid = session.getEnvironmentStri
String authMethod = session.getEnvironmentStri
AgentContext agentContext = session.getAgentContext();
Database db = agentContext.getCurrentDat
String serverName = db.getServer();
System.out.println(serverN
Document doc = db.getProfileDocument("Fil
String projectDb = doc.getItemValueString("pr
String cmvcDb = doc.getItemValueString("pr
Name user = session.getUserNameObject(
doc = db.getProfileDocument("CMV
String userName = doc.getItemValueString("DB
String passwd = doc.getItemValueString("DB
boolean isToProcess = false;
boolean isToSave = false;
if (authMethod.equals("pw")) {
if (userName == null || userName.equals("")) {
PasswordFrame pwFrame = new PasswordFrame();
userName = pwFrame.getUserName();
passwd = pwFrame.getPassword();
System.out.println(userNam
isToProcess = pwFrame.isToProcess();
isToSave = pwFrame.isToSave();
} else if (passwd == null || passwd.equals("")) {
PasswordFrame pwFrame = new PasswordFrame(userName);
userName = pwFrame.getUserName();
passwd = pwFrame.getPassword();
System.out.println(userNam
isToProcess = pwFrame.isToProcess();
isToSave = pwFrame.isToSave();
} else {
isToProcess = true;
}
} else {
isToProcess = true;
}
if (isToProcess == true) {
if (action.equals("open") || action.equals("view")) {
new MainProcess(userName, passwd, action, cmvcNo, family, null, null, authMethod, serverName, cmvcDb, projectDb, session);
} else if (action.equals("note") || action.equals("cancel") || action.equals("reopen")) {
new RemarksFrame(userName, passwd, action, cmvcNo, family, authMethod, serverName, cmvcDb, projectDb);
} else if (action.equals("verify")) {
new VerifyFrame(userName, passwd, action, cmvcNo, family, unid, authMethod, serverName, cmvcDb, projectDb);
}
}
if (isToSave == true) {
if (doc != null) {
Item userItem = doc.replaceItemValue("DB2U
userItem.setEncrypted(true
Item passItem = doc.replaceItemValue("DB2P
passItem.setEncrypted(true
doc.encrypt();
doc.save(true);
}
}
} catch (NotesException nx) {
try {
SaveClientError.start();
System.out.println(new Date());
System.out.println("NotesM
SaveClientError.stop();
} catch (IOException iox) {
System.out.println(iox);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
CommandProcessor.java
import java.io.IOException;
import java.util.Date;
import java.util.Vector;
public class CommandProcessor {
private Vector cmvcData = new Vector();
private Vector cmvcErrData = new Vector();
private boolean isError;
/**
*
* Constructor for executing the CMVC Commands and storing the unparsed data.
*
* @param dosCommand Command to be used by a process.
* @param remarks String passed to the {@link ibmpa.cmvc.streams.OutputS
*
*/
public CommandProcessor(String dosCommand, String remarks) {
try {
Runtime runtime = Runtime.getRuntime();
Process cmvcProcess = runtime.exec(dosCommand);
new ErrorStreamThread(cmvcProc
new InputStreamThread(cmvcProc
new OutputStreamThread(cmvcPro
cmvcProcess.waitFor();
synchronized (cmvcData) {
if (cmvcData.size() == 0)
isError = true;
}
} catch (Exception ex) {
try {
SaveClientError.start();
System.out.println(new Date());
System.out.println("Comman
SaveClientError.stop();
} catch (IOException iox) {
System.out.println(iox);
}
}
}
/**
*
* Method for determining if error occurred.
*
* @return boolean - if true then error, if false then data is valid.
*
*/
public boolean isError() {
return isError;
}
/**
*
* Method for getting CMVC DB2 Data.
*
* @return java.util.List object - unparsed data.
*
*/
public Vector getCmvcData() {
synchronized (cmvcData) {
return cmvcData;
}
}
/**
*
* Method for getting the CMVC DB2 Error Data.
*
* @return java.util.List object - error data.
*
*/
public Vector getCmvcErrData() {
synchronized (cmvcErrData) {
return cmvcErrData;
}
}
}
DataProcessor.java
import java.util.Vector;
public class DataProcessor {
private String cmvcNo;
private String state;
private String abstrak;
private String family;
private String release;
private String phaseFound;
private String severity;
private String prefix;
private String symptom;
private String component;
private String brand;
private String targetDate;
private String targetState;
private String envName;
private String lastUpdate;
private String problemRemarks;
private String remarksHistory;
private String openDate;
private String workingDate;
private String returnDate;
private String cancelDate;
private String verifyDate;
private String closeDate;
private String openedBy;
private String workedBy;
private String returnedBy;
private String canceledBy;
private String verifiedBy;
private String closedBy;
private String ownerLogin;
private String ownerName;
private String originName;
private String originArea;
// addendum
private String reference;
private String duplicate;
private String age;
private String answer;
private String level;
private String assignDate;
private String responseDate;
private String endDate;
private String ownerArea;
private String remoteName;
private String remoteFamily;
private String phaseInject;
private String priority;
private String target;
private String source;
// @PC
private String originLogin;
/**
*
* Constructor for initializing CMVC number and family.
*
* @param cmvcNo CMVC number.
* @param family CMVC family.
*
*/
public DataProcessor(String cmvcNo, String family) {
this.cmvcNo = cmvcNo;
this.family = family;
}
/**
*
* Method for setting the fields in a Notes CMVC document.
*
* @param doc Stub object wrapping a Notes Document object.
*
*/
public void setDoc(NotesCMVCDocument doc) {
doc.setName(cmvcNo);
doc.setFamily(family);
doc.setPrefix(prefix);
doc.setAbstract(abstrak);
doc.setSeverity(severity);
doc.setState(state);
doc.setTargetDate(targetDa
doc.setTargetState(targetS
doc.setComponent(component
doc.setRelease(release);
doc.setSymptom(symptom);
doc.setPhaseFound(phaseFou
doc.setBrand(brand);
doc.setEnvName(envName);
doc.setRemarksHistory(rema
doc.setLastUpdate(lastUpda
doc.setOpenDate(openDate);
doc.setWorkingDate(working
doc.setReturnDate(returnDa
doc.setCancelDate(cancelDa
doc.setVerifyDate(verifyDa
doc.setCloseDate(closeDate
doc.setOpenedBy(openedBy);
doc.setWorkedBy(workedBy);
doc.setReturnedBy(returned
doc.setCanceledBy(canceled
doc.setVerifiedBy(verified
doc.setClosedBy(closedBy);
doc.setOwnerLogin(ownerLog
doc.setOwnerName(ownerName
doc.setOriginName(originNa
doc.setOriginArea(originAr
doc.setReference(reference
doc.setDuplicate(duplicate
doc.setAge(age);
doc.setAnswer(answer);
doc.setLevel(level);
doc.setAssignDate(assignDa
doc.setResponseDate(respon
doc.setEndDate(endDate);
doc.setOwnerArea(ownerArea
doc.setRemoteName(remoteNa
doc.setRemoteFamily(remote
doc.setPhaseInject(phaseIn
doc.setPriority(priority);
doc.setTarget(target);
doc.setSource(source);
// @PC
doc.setOriginLogin(originL
}
/**
*
* Method for loading the date fields in a Notes CMVC Document.
*
* @param doc Stub object wrapping a Notes Document object.
*
*/
public void loadDates(NotesCMVCDocumen
doc.setName(cmvcNo);
doc.setFamily(family);
doc.loadDates();
openDate = (doc.getOpenDate() == null) ? "" : doc.getOpenDate();
workingDate = (doc.getWorkingDate() == null) ? "" : doc.getWorkingDate();
returnDate = (doc.getReturnDate() == null) ? "" : doc.getReturnDate();
cancelDate = (doc.getCancelDate() == null) ? "" : doc.getCancelDate();
verifyDate = (doc.getVerifyDate() == null) ? "" : doc.getVerifyDate();
closeDate = (doc.getCloseDate() == null) ? "" : doc.getCloseDate();
openedBy = (doc.getOpenedBy() == null) ? "" : doc.getOpenedBy();
workedBy = (doc.getWorkedBy() == null) ? "" : doc.getWorkedBy();
returnedBy = (doc.getReturnedBy() == null) ? "" : doc.getReturnedBy();
canceledBy = (doc.getCanceledBy() == null) ? "" : doc.getCanceledBy();
verifiedBy = (doc.getVerifiedBy() == null) ? "" : doc.getVerifiedBy();
closedBy = (doc.getClosedBy() == null) ? "" : doc.getClosedBy();
}
/**
*
* Method for parsing the data from a {@link ibmpa.cmvc.CommandProcesso
*
* @param cmvcData unparsed data from CMVC DB2.
*
*/
public void parseRetrievedDoc(Vector cmvcData) {
String str = (String) cmvcData.elementAt(1);
str = str.substring(14);
prefix = str.trim();
str = (String) cmvcData.elementAt(3);
str = str.substring(14);
reference = str.trim();
str = (String) cmvcData.elementAt(4);
str = str.substring(14);
abstrak = str.trim();
str = (String) cmvcData.elementAt(5);
str = str.substring(14);
duplicate = str.trim();
str = (String) cmvcData.elementAt(7);
str = str.substring(14);
state = str.trim();
str = (String) cmvcData.elementAt(8);
str = str.substring(14);
severity = str.trim();
str = (String) cmvcData.elementAt(9);
str = str.substring(14);
age = str.trim();
str = (String) cmvcData.elementAt(11);
str = str.substring(14, 40);
component = str.trim();
str = (String) cmvcData.elementAt(11);
str = str.substring(56);
answer = str.trim();
str = (String) cmvcData.elementAt(12);
str = str.substring(14);
release = str.trim();
str = (String) cmvcData.elementAt(13);
str = str.substring(14);
envName = str.trim();
str = (String) cmvcData.elementAt(14);
str = str.substring(14);
level = str.trim();
str = (String) cmvcData.elementAt(16);
str = str.substring(56);
assignDate = str.trim();
str = (String) cmvcData.elementAt(17);
str = str.substring(14, 40);
lastUpdate = str.trim();
str = (String) cmvcData.elementAt(17);
str = str.substring(56);
responseDate = str.trim();
str = (String) cmvcData.elementAt(18);
str = str.substring(14);
endDate = str.trim();
str = (String) cmvcData.elementAt(20);
str = str.substring(14, 40);
ownerLogin = str.trim();
// @PC
str = (String) cmvcData.elementAt(20);
str = str.substring(56);
originLogin = str.trim();
str = (String) cmvcData.elementAt(21);
str = str.substring(14, 40);
ownerName = str.trim();
str = (String) cmvcData.elementAt(21);
str = str.substring(56);
originName = str.trim();
str = (String) cmvcData.elementAt(22);
str = str.substring(14, 40);
ownerArea = str.trim();
str = (String) cmvcData.elementAt(22);
str = str.substring(56);
originArea = str.trim();
str = (String) cmvcData.elementAt(24);
str = str.substring(14, 40);
remoteName = str.trim();
str = (String) cmvcData.elementAt(24);
str = str.substring(56);
remoteFamily = str.trim();
str = (String) cmvcData.elementAt(25);
str = str.substring(14);
symptom = str.trim();
str = (String) cmvcData.elementAt(26);
str = str.substring(14);
phaseFound = str.trim();
str = (String) cmvcData.elementAt(27);
str = str.substring(14);
phaseInject = str.trim();
str = (String) cmvcData.elementAt(28);
str = str.substring(14);
priority = str.trim();
str = (String) cmvcData.elementAt(29);
str = str.substring(14);
target = str.trim();
str = (String) cmvcData.elementAt(30);
str = str.substring(14);
source = str.trim();
str = (String) cmvcData.elementAt(31);
str = str.substring(14);
targetDate = str.trim();
str = (String) cmvcData.elementAt(32);
str = str.substring(14);
targetState = str.trim();
str = (String) cmvcData.elementAt(33);
str = str.substring(14);
brand = str.trim();
for (int i = 41; i < cmvcData.size(); i++) {
str = (String) cmvcData.elementAt(i);;
if (str.equals(""))
continue;
if (str.startsWith("duplicate
break;
if (str.length() < 40)
continue;
String dateStr = str.substring(4, 23);
String action = str.substring(25, 40).trim();
String userStr = str.substring(41).trim();
if (action.equals("open")) {
if (openDate.equals("")) {
openDate = dateStr;
openedBy = userStr;
} else if (openDate.compareTo(dateSt
openDate = dateStr;
openedBy = userStr;
}
} else if (action.equals("accept")) {
if (workingDate.equals("")) {
workingDate = dateStr;
workedBy = userStr;
} else if (workingDate.compareTo(dat
workingDate = dateStr;
workedBy = userStr;
}
} else if (action.equals("return")) {
if (returnDate.compareTo(date
returnDate = dateStr;
returnedBy = userStr;
}
} else if (action.equals("cancel")) {
if (cancelDate.compareTo(date
cancelDate = dateStr;
canceledBy = userStr;
}
} else if (action.equals("verify")) {
if (verifyDate.compareTo(date
verifyDate = dateStr;
verifiedBy = userStr;
}
} else if (action.equals("close")) {
if (closeDate.compareTo(dateS
closeDate = dateStr;
closedBy = userStr;
}
}
}
str = "";
for (int i = 34; i < cmvcData.size(); i++) {
str += (String) cmvcData.elementAt(i) + "~";
}
byte[] b = str.getBytes();
int length = (b.length > 32000) ? 32000 : b.length;
remarksHistory = new String(b, 0, length);
}
/**
*
* Method for parsing the new CMVC number taken from CMVC DB2 System after opening a CMVC.
*
* @param cmvcData unparsed data from CMVC DB2.
* @return String object - new CMVC number.
*
*/
public String parseNewCMVCNo(Vector cmvcData) {
String str = (String) cmvcData.elementAt(1);
str = str.substring(25, str.indexOf('.')).trim();
return str;
}
/**
*
* Method for changing the CMVC number after verify-rejecting a CMVC.
*
* @param cmvcNo old CMVC number.
* @return String object - new CMVC number.
*
*/
public String parseNewCMVCNo(String cmvcNo) {
int startIndex;
if ((startIndex = cmvcNo.lastIndexOf("f_")) != -1) {
String str = cmvcNo.substring(startInde
int newNo = Integer.parseInt(str);
cmvcNo = cmvcNo.substring(0, startIndex + 2) + (newNo + 1);
this.cmvcNo = cmvcNo;
return cmvcNo;
} else {
cmvcNo = cmvcNo + "f_1";
this.cmvcNo = cmvcNo;
return cmvcNo;
}
}
/**
*
* Method for transforming a set of CMVC fields into a command String for opening a CMVC record.
*
* @param component Component/Categories field in Notes CMVC document.
* @param abstrak Abstract/Subject field in Notes CMVC document.
* @param release Release/Product field in Notes CMVC document.
* @param prefix Prefix field in Notes CMVC document.
* @param severity Severity field in Notes CMVC document.
* @param symptom Symptom field in Notes CMVC document.
* @param phaseFound Phase field in Notes CMVC document.
* @param brand Brand field in Notes CMVC document.
* @return String object - Command String for {@link ibmpa.cmvc.CommandProcesso
*
*/
public String openCMVCString(String component, String abstrak,
String release, String prefix,
String severity, String symptom,
String phaseFound, String brand) {
String str = "defect -open -family \"" + family +
"\" -component \"" + component +
"\" -remarks -" +
" -abstract \"" + abstrak +
"\" -release \"" + release +
"\" -prefix \"" + prefix +
"\" -severity \"" + severity +
"\" -symptom \"" + symptom +
"\" -phasefound \"" + phaseFound +
"\" -brand \"" + brand +
"\"";
return str;
}
/**
*
* Method for returning command String for viewing a CMVC record.
*
* @return String object - Command String for {@link ibmpa.cmvc.CommandProcesso
*
*/
public String viewCMVCString() {
String str = "defect -long -view " + cmvcNo + " -family " + family;
return str;
}
/**
*
* Method for returning command String for canceling a CMVC record.
*
* @return String object - Command String for {@link ibmpa.cmvc.CommandProcesso
*
*/
public String cancelCMVCString() {
String str = "defect -cancel " + cmvcNo + " -family " + family +
" -remarks -";
return str;
}
/**
*
* Method for returning command String for reopening a CMVC record.
*
* @return String object - Command String for {@link ibmpa.cmvc.CommandProcesso
*
*/
public String reopenCMVCString() {
String str = "defect -reopen " + cmvcNo + " -family " + family +
" -remarks -";
return str;
}
/**
*
* Method for returning command String for verify-rejecting a CMVC record.
*
* @return String object - Command String for {@link ibmpa.cmvc.CommandProcesso
*
*/
public String verifyOpenCMVCString() {
String str = "verifycm -reject -defect " + cmvcNo + " -family " + family +
" -remarks -";
return str;
}
/**
*
* Method for returning command String for verify-closing a CMVC record.
*
* @return String object - Command String for {@link ibmpa.cmvc.CommandProcesso
*
*/
public String verifyCloseCMVCString() {
String str = "verifycm -accept -defect " + cmvcNo + " -family " + family +
" -remarks -";
return str;
}
/**
*
* Method for returning command String for noting a CMVC record.
*
* @return String object - Command String for {@link ibmpa.cmvc.CommandProcesso
*
*/
public String addCMVCRemarksString() {
String str = "defect -note " + cmvcNo + " -family " + family +
" -remarks -";
return str;
}
/**
*
* Method for getting the last update of a CMVC record.
*
* @return String object - date of last update of CMVC record.
*
*/
public String getLastUpdate() {
return lastUpdate;
}
}
Entry.java
import java.io.IOException;
import java.util.Date;
import java.util.Vector;
import lotus.domino.*;
public class Entry {
private String product = "Unspecified";
private String area = "Unspecified";
private String serverName;
private String projectDb;
public Entry(String serverName, String projectDb) {
this.serverName = serverName;
this.projectDb = projectDb;
}
/**
*
* Method for searching problem area given product name and component.
*
*/
public void searchProduct(String release) {
try {
NotesThread.sinitThread();
Session session = NotesFactory.createSession
Database db = session.getDatabase(server
DocumentCollection dc = db.search("Form=\"CMVCProf
Document doc = dc.getFirstDocument();
if (doc != null) {
Item item = doc.getFirstItem("releasen
Vector releases = item.getValues();
item = doc.getFirstItem("productn
Vector products = item.getValues();
int count = 0;
for (int i = 0; i < releases.size(); i++) {
if (release.equals(releases.e
count++;
product = (String) products.elementAt(i);
}
if (count > 1) {
break;
}
}
if (count != 1) {
product = "Unspecified";
}
}
} catch (NotesException nx) {
try {
SaveClientError.start();
System.out.println(new Date());
System.out.println("Entry Exception: " + nx.id + " " + nx.text);
SaveClientError.stop();
} catch (IOException iox) {
System.out.println(iox);
}
} finally {
NotesThread.stermThread();
}
}
/**
*
* Method for searching problem area given product name and component.
*
*/
public void searchProblemArea(String product, String component) {
this.product = product;
try {
NotesThread.sinitThread();
Session session = NotesFactory.createSession
Database db = session.getDatabase(server
DocumentCollection dc = db.search("form=\"Componen
Document doc = dc.getFirstDocument();
while (doc != null) {
Item item = doc.getFirstItem("componen
Vector components = item.getValues();
item = doc.getFirstItem("area");
Vector areas = item.getValues();
if (components.contains(compo
int idx = components.indexOf(compone
area = (String) areas.elementAt(idx);
break;
}
doc = dc.getNextDocument();
}
} catch (NotesException nx) {
try {
SaveClientError.start();
System.out.println(new Date());
System.out.println("Entry Exception: " + nx.id + " " + nx.text);
SaveClientError.stop();
} catch (IOException iox) {
System.out.println(iox);
}
} finally {
NotesThread.stermThread();
}
}
public String getProduct() {
return product;
}
public String getArea() {
return area;
}
}
ErrorStreamThread.java
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Vector;
public class ErrorStreamThread extends Thread {
private InputStream errStream;
private Vector cmvcErrData;
/**
*
* Constructor for initializing the error stream and List object.
*
* @param errStream java.io.InputStream object.
* @param cmvcErrData java.util.Vector object.
*
*/
public ErrorStreamThread(InputStr
this.errStream = errStream;
this.cmvcErrData = cmvcErrData;
}
/**
*
* Method for starting the thread.
*
*/
public void run() {
try {
BufferedReader err = new BufferedReader(new InputStreamReader(errStrea
String str = null;
synchronized (cmvcErrData) {
while ((str = err.readLine()) != null) {
cmvcErrData.addElement(str
}
}
} catch (java.io.IOException e) {
System.out.println(e);
}
}
}
InputStreamThread.java
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Vector;
public class InputStreamThread extends Thread {
private InputStream inStream;
private Vector cmvcData;
/**
*
* Constructor for initializing the input stream and List object.
*
* @param inStream java.io.InputStream object.
* @param cmvcData java.util.Vector object.
*
*/
public InputStreamThread(InputStr
this.inStream = inStream;
this.cmvcData = cmvcData;
}
/**
*
* Method for starting the thread.
*
*/
public void run() {
try {
BufferedReader in = new BufferedReader(new InputStreamReader(inStream
String str = null;
synchronized (cmvcData) {
while ((str = in.readLine()) != null) {
cmvcData.addElement(str);
}
}
} catch (java.io.IOException e) {
System.out.println(e);
}
}
}
MainProcess.java
import java.io.IOException;
import java.util.Date;
import java.util.Vector;
import lotus.domino.*;
public class MainProcess {
NotesCMVCDocument doc;
DataProcessor data;
CommandProcessor comProc;
ProcessMessage processMessage;
// @PC 02192002 deleted on purpose
// MessageDialog messageDialog;
String userName;
String password;
String action;
String cmvcNo;
String family;
String remark;
String unid;
String authMethod;
Session SessionTemp;
/**
*
* Constructor for executing the CMVC functions.
*
* @param args Array of String objects for command and fields.
*
*/
public MainProcess(String userName, String password, String action, String cmvcNo, String family, String remark, String unid, String authMethod, String serverName, String cmvcDb, String projectDb, Session SessionTemp) {
this.userName = userName;
this.password = password;
this.action = action;
this.cmvcNo = cmvcNo;
this.family = family;
this.remark = remark;
this.unid = unid;
this.authMethod = authMethod;
try {
// create a window for displaying the progress of transaction.
processMessage = new ProcessMessage("CMVC Transaction Message");
// @PC 02192002 deleted on purpose
// messageDialog = new MessageDialog(processMessa
doc = new NotesCMVCDocument(serverNa
data = new DataProcessor(cmvcNo, family); // create a CMVC DB2 Data Processor.
if (authMethod != null && authMethod.equals("pw")) {
processMessage.appendText(
// log in to CMVC DB2 System.
comProc = new CommandProcessor("cmvclog -in " + userName + " -noprompt " + password +
" -family " + family, "");
if (comProc.isError() == true) {
if (comProc.getCmvcErrData().
throw new CMVCException(showCMVCErro
}
}
processMessage.appendText(
}
processMessage.appendText(
processMessage.appendText(
// OPEN CMVC OPERATION
if (action.equals("open")) {
doc.loadData(cmvcNo); // get the Data from Domino to open to CMVC DB2 System.
String component = doc.getComponent();
String problemRemarks = doc.getProblemRemark();
String abstrak = doc.getAbstract();
String release = doc.getRelease();
String prefix = doc.getPrefix();
String severity = doc.getSeverity();
String symptom = doc.getSymptom();
String phaseFound = doc.getPhaseFound();
String brand = doc.getBrand();
processMessage.appendText(
String dosCommand = data.openCMVCString(compon
prefix, severity, symptom,
phaseFound, brand);
// open a CMVC to DB2
comProc = new CommandProcessor(dosComman
logOperation(dosCommand, processMessage); // log the action.
if (comProc.isError() == true) {
throw new CMVCException(showCMVCErro
} else {
processMessage.appendText(
String newCmvcNo = data.parseNewCMVCNo(comPro
doc.updateNewNum(newCmvcNo
data = new DataProcessor(newCmvcNo, family);
viewCMVC(processMessage, data, doc);
}
// VIEW CMVC OPERATION
} else if (action.equals("view")) {
viewCMVC(processMessage, data, doc);
// CANCEL CMVC OPERATION
} else if (action.equals("cancel")) {
processMessage.appendText(
String dosCommand = data.cancelCMVCString();
comProc = new CommandProcessor(dosComman
logOperation(dosCommand,pr
cleanup(processMessage, data, comProc, doc, "\nThe CMVC has been canceled in DB2.\n\n");
// REOPEN CMVC OPERATION
} else if (action.equals("reopen")) {
processMessage.appendText(
String dosCommand = data.reopenCMVCString();
comProc = new CommandProcessor(dosComman
logOperation(dosCommand,pr
cleanup(processMessage, data, comProc, doc, "\nThe CMVC has been reopened in DB2.\n\n");
// ACCEPT CMVC OPERATION
} else if (action.equals("accept")) {
processMessage.appendText(
String dosCommand = data.verifyCloseCMVCString
comProc = new CommandProcessor(dosComman
logOperation(dosCommand,pr
cleanup(processMessage, data, comProc, doc, "\nThe CMVC has been verify accepted in DB2.\n\n");
// REJECT CMVC OPERATION
} else if (action.equals("reject")) {
processMessage.appendText(
String dosCommand = data.verifyOpenCMVCString(
comProc = new CommandProcessor(dosComman
logOperation(dosCommand,pr
if (comProc.isError() == true) {
throw new CMVCException(showCMVCErro
} else {
processMessage.appendText(
doc.updateNewNum(data.pars
data = new DataProcessor(data.parseNe
do {
comProc = new CommandProcessor(data.view
processMessage.appendText(
} while (comProc.isError() == true);
saveData(processMessage, data, comProc, doc);
}
// NOTE CMVC OPERATION
} else if (action.equals("note")) {
processMessage.appendText(
String dosCommand = data.addCMVCRemarksString(
comProc = new CommandProcessor(dosComman
logOperation(dosCommand, processMessage); // log the action.
cleanup(processMessage, data, comProc, doc, "\nThe CMVC has been noted in DB2.\n\n");
}
// @PC 02192002 deleted on purpose, changed to ...
// messageDialog.showMessage(
processMessage.appendText(
} catch (CMVCException cx) {
} catch (Exception e) {
try {
SaveClientError.start();
System.out.println(new Date());
System.out.println("CMVCMa
//e.printStackTrace();
SaveClientError.stop();
// @PC 02192002 deleted on purpose
// messageDialog.showMessage(
// "cmvcError.log in <Notes> directory to TEMS " +
// "Development Team for technical support.",
// "CMVC Java Error");
try
{
SessionTemp.setEnvironment
}
catch (Exception me)
{
me.printStackTrace();
}
processMessage.appendText(
"directory to TEMS Development Team for technical support.");
} catch (IOException iox) {
System.out.println(iox);
}
}
processMessage.dispose();
// messageDialog.dispose();
}
/**
*
* Method for displaying the error message from CMVC DB2 System in a window.
*
* @param error Error message from DB2.
*
*/
// Method for displaying error messages sent by the CMVC DB2 System.
private String showCMVCError(Vector error) {
String str = "";
for (int i = 0; i < error.size(); i++) {
str += (String) error.elementAt(i) + "\n";
}
// @PC 02192002 deleted on purpose
// messageDialog.showMessage(
processMessage.appendText(
return str;
}
// Method for logging operations done to CMVC DB2 System by the user.
private void logOperation(String operation, ProcessMessage pm) throws java.io.IOException {
pm.appendText("inside logoperation before saveclientaction start\n");
SaveClientAction.start(pm)
pm.appendText("inside logoperation after saveclientaction start\n");
System.out.print(new Date());
System.out.println("\t" + operation);
pm.appendText("inside logoperation before saveclientaction stop\n");
SaveClientAction.stop(pm);
pm.appendText("inside logoperationafter saveclientaction stop\n");
}
// Method for saving data to Domino Server.
private void saveData(ProcessMessage pm, DataProcessor dp, CommandProcessor cp, NotesCMVCDocument doc) {
pm.appendText("Saving data to Domino...\n");
dp.loadDates(doc);
dp.parseRetrievedDoc(cp.ge
dp.setDoc(doc);
doc.storeData();
}
// Method for viewing a CMVC in DB2 System.
private void viewCMVC(ProcessMessage pm, DataProcessor dp, NotesCMVCDocument doc) throws IOException, CMVCException {
pm.appendText("Refreshing the CMVC from DB22 in viewcmvc...\n");
String dosCommand = dp.viewCMVCString();
pm.appendText("After doscommand" + dosCommand);
CommandProcessor comProc = new CommandProcessor(dosComman
pm.appendText("After new command processor");
logOperation(dosCommand, pm); // log the action.
pm.appendText("After dos command");
if (comProc.isError() == true) {
throw new CMVCException(showCMVCErro
} else {
pm.appendText("Before save data");
saveData(pm, dp, comProc, doc);
pm.appendText("After save data");
}
}
// Method for cleaning up after an operation to CMVC DB2.
private void cleanup(ProcessMessage pm, DataProcessor dp, CommandProcessor cp,
NotesCMVCDocument doc, String message) throws java.io.IOException, CMVCException {
if (cp.isError() == true) {
if (cp.getCmvcErrData().isEmp
throw new CMVCException(showCMVCErro
} else {
pm.appendText(message);
viewCMVC(pm, dp, doc);
}
}
}
class CMVCException extends Exception {
CMVCException(String message) {
super(message);
}
}
}
MessageDialog.java
import java.awt.Button;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Panel;
import java.awt.Rectangle;
import java.awt.TextArea;
import java.awt.Toolkit;
import java.awt.event.ActionEvent
import java.awt.event.ActionListe
public class MessageDialog extends Dialog implements ActionListener {
TextArea textArea;
public MessageDialog(Frame window) {
super(window, true);
Panel p1 = new Panel();
textArea = new TextArea();
p1.add(textArea);
Panel p2 = new Panel();
p2.setLayout(new FlowLayout());
Button okButton = new Button("OK");
p2.add(okButton);
okButton.addActionListener
add("Center", p1);
add("South", p2);
}
public void actionPerformed(ActionEven
setVisible(false);
}
public void showMessage(String message, String title) {
setTitle(title);
textArea.append(message);
pack();
Dimension screenSize = Toolkit.getDefaultToolkit(
Rectangle rect = getBounds();
setLocation((screenSize.wi
setVisible(true);
}
}
NotesCMVCDocument.java
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Date;
import java.util.Properties;
import lotus.domino.*;
public class NotesCMVCDocument {
// metadata
String serverName;
String cmvcDb;
String projectDb;
// Document data
protected String cmvcNo;
protected String state;
protected String abstrak;
protected String family;
protected String release;
protected String phaseFound;
protected String severity;
protected String prefix;
protected String symptom;
protected String component;
protected String brand;
protected String targetDate;
protected String targetState;
protected String envName;
private String problemRemark;
protected String remarksHistory;
protected String lastUpdate;
protected String openDate;
protected String workingDate;
protected String returnDate;
protected String cancelDate;
protected String verifyDate;
protected String closeDate;
protected String openedBy;
protected String workedBy;
protected String returnedBy;
protected String canceledBy;
protected String verifiedBy;
protected String closedBy;
protected String ownerLogin;
protected String ownerName;
protected String originName;
protected String originArea;
// addendum
protected String reference;
protected String duplicate;
protected String age;
protected String answer;
protected String level;
protected String assignDate;
protected String responseDate;
protected String endDate;
protected String ownerArea;
protected String remoteName;
protected String remoteFamily;
protected String phaseInject;
protected String priority;
protected String target;
protected String source;
// @PC
protected String originLogin;
public NotesCMVCDocument (String serverName, String cmvcDb, String projectDb) {
this.serverName = serverName;
this.cmvcDb = cmvcDb;
this.projectDb = projectDb;
System.out.println(cmvcDb)
}
/**
*
* Method for storing data to Notes CMVC database.
* @return boolean - true if data were stored in database.
*
*/
public void storeData() {
try {
NotesThread.sinitThread();
Session session = NotesFactory.createSession
Database db = session.getDatabase(server
DocumentCollection dc = db.search("Form=\"CMVC\" & CMVC_No=\"" + cmvcNo + "\" & familyalias=\"" + family + "\"");
Document doc = dc.getFirstDocument();
while (doc != null) {
System.out.println("store doc " + cmvcNo);
if (component.equals(doc.getI
Entry entry = new Entry(serverName, projectDb);
entry.searchProblemArea(do
doc.replaceItemValue("kw_p
}
doc.replaceItemValue("kw_p
doc.replaceItemValue("Subj
doc.replaceItemValue("kw_s
doc.replaceItemValue("kw_s
doc.replaceItemValue("date
doc.replaceItemValue("kw_f
doc.replaceItemValue("Cate
doc.replaceItemValue("kw_r
doc.replaceItemValue("kw_s
doc.replaceItemValue("kw_p
doc.replaceItemValue("kw_b
doc.replaceItemValue("last
doc.replaceItemValue("txt_
replaceHistory(doc);
doc.replaceItemValue("open
doc.replaceItemValue("work
doc.replaceItemValue("retu
doc.replaceItemValue("canc
doc.replaceItemValue("veri
doc.replaceItemValue("clos
doc.replaceItemValue("open
doc.replaceItemValue("work
doc.replaceItemValue("retu
doc.replaceItemValue("canc
doc.replaceItemValue("veri
doc.replaceItemValue("clos
doc.replaceItemValue("deve
doc.replaceItemValue("deve
doc.replaceItemValue("txt_
doc.replaceItemValue("txt_
doc.replaceItemValue("txt_
doc.replaceItemValue("txt_
doc.replaceItemValue("txt_
doc.replaceItemValue("txt_
doc.replaceItemValue("txt_
doc.replaceItemValue("txt_
doc.replaceItemValue("txt_
doc.replaceItemValue("txt_
doc.replaceItemValue("txt_
doc.replaceItemValue("txt_
doc.replaceItemValue("txt_
doc.replaceItemValue("txt_
doc.replaceItemValue("txt_
doc.replaceItemValue("txt_
// @PC
doc.replaceItemValue("Orig
doc.replaceItemValue("Orig
doc.replaceItemValue("Orig
// add 012702
doc.replaceItemValue("kw_l
doc.save(true);
doc = dc.getNextDocument();
}
} catch (NotesException nx) {
try {
SaveClientError.start();
System.out.println(new Date());
System.out.println("NotesD
SaveClientError.stop();
} catch (IOException iox) {
System.out.println(iox);
}
} finally {
NotesThread.stermThread();
}
}
private void replaceHistory(Document doc) throws NotesException {
RichTextItem history = (RichTextItem) doc.getFirstItem("txt_Hist
int startIndex = 0;
int endIndex;
while ((endIndex = remarksHistory.indexOf("~"
history.appendText(remarks
history.addNewLine();
startIndex = endIndex + 1;
}
}
public void loadDates() {
try {
System.out.println("initia
NotesThread.sinitThread();
System.out.println("creati
Session session = NotesFactory.createSession
Database db = session.getDatabase(server
DocumentCollection dc = db.search("Form=\"CMVC\" & CMVC_No=\"" + cmvcNo + "\" & familyalias=\"" + family + "\"");
Document doc = dc.getFirstDocument();
while (doc != null) {
System.out.println("load dates ok");
openDate = doc.getItemValueString("op
workingDate = doc.getItemValueString("wo
returnDate = doc.getItemValueString("re
cancelDate = doc.getItemValueString("ca
verifyDate = doc.getItemValueString("ve
closeDate = doc.getItemValueString("cl
openedBy = doc.getItemValueString("op
workedBy = doc.getItemValueString("wo
returnedBy = doc.getItemValueString("re
canceledBy = doc.getItemValueString("ca
verifiedBy = doc.getItemValueString("ve
closedBy = doc.getItemValueString("cl
doc = dc.getNextDocument();
}
} catch (NotesException nx) {
try {
SaveClientError.start();
System.out.println(new Date());
System.out.println("NotesD
SaveClientError.stop();
} catch (IOException iox) {
System.out.println(iox);
}
} finally {
NotesThread.stermThread();
}
}
public void updateNewNum(String cmvcNo, String unid) {
try {
NotesThread.sinitThread();
Session session = NotesFactory.createSession
Database db = session.getDatabase(server
Document doc = db.getDocumentByUNID(unid)
if (doc != null) {
doc.replaceItemValue("CMVC
doc.save(true);
}
} catch (NotesException nx) {
try {
SaveClientError.start();
System.out.println(new Date());
System.out.println("NotesD
SaveClientError.stop();
} catch (IOException iox) {
System.out.println(iox);
}
} finally {
NotesThread.stermThread();
}
}
public void loadData(String unid) {
try {
System.out.println(unid);
NotesThread.sinitThread();
Session session = NotesFactory.createSession
Database db = session.getDatabase(server
System.out.println(serverN
Document doc = db.getDocumentByUNID(unid)
if (doc != null) {
problemRemark = (new ProblemRemark(doc)).toStri
abstrak = doc.getItemValueString("Su
release = doc.getItemValueString("kw
phaseFound = doc.getItemValueString("kw
severity = doc.getItemValueString("kw
prefix = doc.getItemValueString("kw
symptom = doc.getItemValueString("kw
component = doc.getItemValueString("Ca
brand = doc.getItemValueString("kw
}
} catch (NotesException nx) {
try {
SaveClientError.start();
System.out.println(new Date());
System.out.println("NotesD
SaveClientError.stop();
} catch (IOException iox) {
System.out.println(iox);
}
} finally {
NotesThread.stermThread();
}
}
public void setName(String name) {
cmvcNo = name;
}
public void setFamily(String family) {
this.family = family;
}
public void setState(String state) {
this.state = state;
}
public void setAbstract(String abstrak) {
this.abstrak = abstrak;
}
public void setRelease(String release) {
this.release = release;
}
public void setPhaseFound(String phaseFound) {
this.phaseFound = phaseFound;
}
public void setSeverity(String severity) {
this.severity = severity;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
public void setSymptom(String symptom) {
this.symptom = symptom;
}
public void setComponent(String comp) {
this.component = comp;
}
public void setBrand(String brand) {
this.brand = brand;
}
public void setTargetDate(String fixDate) {
this.targetDate = fixDate;
}
public void setTargetState(String targetState) {
this.targetState = targetState;
}
public void setRemarksHistory(String remarksHistory) {
this.remarksHistory = remarksHistory;
}
public void setOwnerLogin(String ownerLogin) {
this.ownerLogin = ownerLogin;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
public void setOriginName(String originName) {
this.originName = originName;
}
public void setOriginArea(String originArea) {
this.originArea = originArea;
}
public void setLastUpdate(String lastUpdate) {
this.lastUpdate = lastUpdate;
}
// addendum
public void setReference(String reference) {
this.reference = reference;
}
public void setDuplicate(String duplicate) {
this.duplicate = duplicate;
}
public void setAge(String age) {
this.age = age;
}
public void setAnswer(String answer) {
this.answer = answer;
}
public void setEnvName(String envName) {
this.envName = envName;
}
public void setLevel(String level) {
this.level = level;
}
public void setAssignDate(String assignDate) {
this.assignDate = assignDate;
}
public void setResponseDate(String responseDate) {
this.responseDate = responseDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
public void setOwnerArea(String ownerArea) {
this.ownerArea = ownerArea;
}
public void setRemoteName(String remoteName) {
this.remoteName = remoteName;
}
public void setRemoteFamily(String remoteFamily) {
this.remoteFamily = remoteFamily;
}
public void setPhaseInject(String phaseInject) {
this.phaseInject = phaseInject;
}
public void setPriority(String priority) {
this.priority = priority;
}
public void setTarget(String target) {
this.target = target;
}
public void setSource(String source) {
this.source = source;
}
// @PC
public void setOriginLogin(String originLogin) {
this.originLogin = originLogin;
}
// dates
public void setOpenDate(String openDate) {
this.openDate = openDate;
}
public void setWorkingDate(String workingDate) {
this.workingDate = workingDate;
}
public void setReturnDate(String returnDate) {
this.returnDate = returnDate;
}
public void setCancelDate(String cancelDate) {
this.cancelDate = cancelDate;
}
public void setVerifyDate(String verifyDate) {
this.verifyDate = verifyDate;
}
public void setCloseDate(String closeDate) {
this.closeDate = closeDate;
}
public String getOpenDate() {
return openDate;
}
public String getWorkingDate() {
return workingDate;
}
public String getReturnDate() {
return returnDate;
}
public String getCancelDate() {
return cancelDate;
}
public String getVerifyDate() {
return verifyDate;
}
public String getCloseDate() {
return closeDate;
}
public void setOpenedBy(String openedBy) {
this.openedBy = openedBy;
}
public void setWorkedBy(String workedBy) {
this.workedBy = workedBy;
}
public void setReturnedBy(String returnedBy) {
this.returnedBy = returnedBy;
}
public void setCanceledBy(String canceledBy) {
this.canceledBy = canceledBy;
}
public void setVerifiedBy(String verifiedBy) {
this.verifiedBy = verifiedBy;
}
public void setClosedBy(String closedBy) {
this.closedBy = closedBy;
}
public String getOpenedBy() {
return openedBy;
}
public String getWorkedBy() {
return workedBy;
}
public String getReturnedBy() {
return returnedBy;
}
public String getCanceledBy() {
return canceledBy;
}
public String getVerifiedBy() {
return verifiedBy;
}
public String getClosedBy() {
return closedBy;
}
public String getProblemRemark() {
return problemRemark;
}
// open data
public String getAbstract() {
return abstrak;
}
public String getRelease() {
return release;
}
public String getPhaseFound() {
return phaseFound;
}
public String getSeverity() {
return severity;
}
public String getPrefix() {
return prefix;
}
public String getSymptom() {
return symptom;
}
public String getComponent() {
return component;
}
public String getBrand() {
return brand;
}
}
OutputStreamThread.java
import java.io.BufferedWriter;
import java.io.OutputStream;
import java.io.OutputStreamWriter
public class OutputStreamThread extends Thread {
private OutputStream outStream;
private String data;
/**
*
* Constructor for initializing the output stream and string to be written.
*
* @param outStream java.io.OutputStream object.
* @param data java.lang.String object.
*
*/
public OutputStreamThread(OutputS
this.outStream = outStream;
this.data = data;
}
/**
*
* Method for starting the thread.
*
*/
public void run() {
try {
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(outStre
for (int i = 0; i < data.length(); i++) {
if ((data.charAt(i) == '\\') && (data.charAt(i+1) == 'n')) {
out.write('\n');
i++;
} else if ((data.charAt(i) == '\\') && (data.charAt(i+1) == 't')) {
out.write('\t');
i++;
} else {
out.write(data.charAt(i));
}
}
out.write('\u001A');
out.close();
} catch (java.io.IOException e) {
System.out.println(e);
}
}
}
PasswordFrame.java
import java.awt.Button;
import java.awt.BorderLayout;
import java.awt.Checkbox;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Font;
import java.awt.Label;
import java.awt.Panel;
import java.awt.TextField;
import java.awt.Toolkit;
import java.awt.event.ActionEvent
import java.awt.event.ActionListe
import java.awt.event.WindowEvent
import java.awt.event.WindowListe
import java.io.IOException;
import java.util.Date;
import lotus.domino.*;
public class PasswordFrame extends Frame implements ActionListener, WindowListener {
boolean isUserSet;
boolean isToSave = false;
boolean isToProcess = false;
String userStr;
String passStr;
TextField userName;
TextField password;
Checkbox saveEntry;
Button okButton;
Button cancelButton;
public PasswordFrame() {
Panel p1 = new Panel();
p1.setLayout(new BorderLayout());
Label label1 = new Label("UserName:", Label.RIGHT);
label1.setFont(new Font("Arial", Font.BOLD, 14));
Label label2 = new Label(" ");
label2.setFont(new Font("Arial", Font.PLAIN, 1));
Label label3 = new Label("Password:", Label.RIGHT);
label3.setFont(new Font("Arial", Font.BOLD, 14));
p1.add("North", label1);
p1.add("Center", label2);
p1.add("South", label3);
Panel p2 = new Panel();
p2.setLayout(new BorderLayout());
userName = new TextField(20);
userName.setFont(new Font("Arial", Font.PLAIN, 14));
Label emptyLabel = new Label(" ");
emptyLabel.setFont(new Font("Arial", Font.PLAIN, 1));
password = new TextField(20);
password.setFont(new Font("Arial", Font.PLAIN, 14));
password.setEchoChar('*');
p2.add("North", userName);
p2.add("Center", emptyLabel);
p2.add("South", password);
Panel p3 = new Panel();
p3.add(p1);
p3.add(p2);
p3.setBackground(Color.lig
add("Center", p3);
Panel p4 = new Panel();
saveEntry = new Checkbox("Save Username and Password");
saveEntry.setFont(new Font("Arial", Font.PLAIN, 14));
p4.setBackground(Color.lig
p4.add(saveEntry);
add("South", p4);
Panel p5 = new Panel();
p5.setLayout(new BorderLayout());
okButton = new Button("OK");
okButton.setFont(new Font("Arial", Font.PLAIN, 14));
Label emptyLabel2 = new Label(" ");
emptyLabel2.setFont(new Font("Arial", Font.PLAIN, 4));
cancelButton = new Button("Cancel");
cancelButton.setFont(new Font("Arial", Font.PLAIN, 14));
okButton.addActionListener
cancelButton.addActionList
p5.add("North", okButton);
p5.add("Center", emptyLabel2);
p5.add("South", cancelButton);
p5.setBackground(Color.lig
Panel p6 = new Panel();
p6.setBackground(Color.lig
p6.add(p5);
add("East", p6);
Dimension screenSize = Toolkit.getDefaultToolkit(
setBounds((screenSize.widt
addWindowListener(this);
setTitle("CMVC Login");
setResizable(false);
setVisible(true);
}
public PasswordFrame(String userName) {
this();
this.userName.setText(user
}
public void actionPerformed(ActionEven
Object source = evt.getSource();
if (source == okButton) {
setVisible(false);
setUserPassword();
dispose();
} else if (source == cancelButton) {
cancelAction();
dispose();
}
}
public void windowOpened(WindowEvent e) {}
public void windowClosing(WindowEvent e) {
dispose();
}
public void windowClosed(WindowEvent e) {}
public void windowIconified(WindowEven
public void windowDeiconified(WindowEv
public void windowActivated(WindowEven
public void windowDeactivated(WindowEv
private synchronized void setUserPassword() {
if (saveEntry.getState() == true) {
isToSave = true;
}
userStr = userName.getText();
passStr = password.getText();
isUserSet = true;
isToProcess = true;
notifyAll();
}
private synchronized void cancelAction() {
isUserSet = true;
notifyAll();
}
public synchronized String getUserName() {
while (isUserSet == false) {
try {
wait();
} catch (InterruptedException iex) {}
}
return userStr;
}
public synchronized String getPassword() {
while (isUserSet == false) {
try {
wait();
} catch (InterruptedException iex) {}
}
return passStr;
}
public boolean isToSave() {
return isToSave;
}
public boolean isToProcess() {
return isToProcess;
}
/*private void saveUserPassword() {
try {
//NotesThread.sinitThread(
//Session session = NotesFactory.createSession
//Database db = session.getDatabase(server
//db.open();
} catch (NotesException nx) {
try {
SaveClientError.start();
System.out.println(new Date());
System.out.println("Passwo
SaveClientError.stop();
} catch (IOException iox) {
System.out.println(iox);
}
} finally {
NotesThread.stermThread();
}
}*/
}
ProblemRemark.java
import lotus.domino.*;
public class ProblemRemark {
String string;
/**
*
* Constructor for formatting the Problem Remarks fields into Java String.
*
* @param doc Notes Document object.
*
*/
public ProblemRemark(Document doc) throws NotesException {
string = "PROBLEM DESCRIPTION:\n" +
doc.getItemValueString("rt
"< Observed symptom ? >" + "\n" +
(doc.getItemValueString("t
"< Error message/code ? > " + "\n" +
(doc.getItemValueString("t
"< Conditions to reproduce ? >" + "\n" +
(doc.getItemValueString("t
"< Expected Behavior ? >" + "\n" +
(doc.getItemValueString("t
"< How to Recover ? >" + "\n" +
(doc.getItemValueString("t
"< Other Information >" + "\n" +
(doc.getItemValueString("t
// "What is the actual symptom seen ? " + "\n" +
// (doc.getItemValueString("t
// "What is mandatory condition to recreate ? " + "\n" +
// (doc.getItemValueString("t
"VERIFICATION:\n" +
"ITEM\t\tYES / NO\tREMARK\n" +
"Frequency : " +
(doc.getItemValueString("k
" (\"S\" olid / \"I\" intermittent)\n" +
"Unique to EUT ?\t" +
(doc.getItemValueString("k
(doc.getItemValueString("t
"Unique to Configuration ?\t" +
(doc.getItemValueString("k
(doc.getItemValueString("t
"Unique to OS ?\t" +
(doc.getItemValueString("k
(doc.getItemValueString("t
"Unique to Product ?\t" +
(doc.getItemValueString("k
(doc.getItemValueString("t
// @PC
// removed this lines!
// "Unique to IBM ?\t" +
// (doc.getItemValueString("k
// (doc.getItemValueString("t
//
"Unique to Current Version ?\t" +
(doc.getItemValueString("k
(doc.getItemValueString("t
"OTHER\n\n" +
(doc.getItemValueString("r
"[RE-CREATION PROCEDURE]\n\n" +
(doc.getItemValueString("r
"MISC. INFORMATION:\n\n" +
"(reviewed by " +
(doc.getItemValueString("t
// @PC changed the position of this lines
// "Frequency : " +
// (doc.getItemValueString("k
// " (\"S\" olid / \"I\" intermittent)\n" +
"Test item : " +
(doc.getItemValueString("t
"Test case : " +
(doc.getItemValueString("t
"Suspective area : " +
(doc.getItemValueString("k
"Suspective reason : " +
(doc.getItemValueString("t
"[H/W]\n" +
"H/W level : " +
(doc.getItemValueString("t
"S/N : " +
(doc.getItemValueString("t
"CPU : " +
(doc.getItemValueString("t
"LCD : " +
(doc.getItemValueString("t
"HDD : " +
(doc.getItemValueString("t
"Memory : " +
(doc.getItemValueString("t
"2nd Drive : " +
(doc.getItemValueString("t
// @PC
// removed this lines!
// "MPEG : " +
// (doc.getItemValueString("t
//
// "Peripheral : " +
// (doc.getItemValueString("t
"[S/W]\n" +
"ROM : " +
(doc.getItemValueString("t
"H8 : " +
(doc.getItemValueString("t
"OS : " +
(doc.getItemValueString("t
"CSD : " +
(doc.getItemValueString("t
"Patch : " +
(doc.getItemValueString("t
"Utility : " +
(doc.getItemValueString("t
"Video : " +
(doc.getItemValueString("t
"Audio : " +
(doc.getItemValueString("t
// @PC
// removed this lines!
// "PCMCIA : " +
// (doc.getItemValueString("t
//
// "IR : " +
// (doc.getItemValueString("t
"Modem : " +
(doc.getItemValueString("t
"Capture : " +
(doc.getItemValueString("t
// @PC
// removed this lines!
// "MPEG : " +
// (doc.getItemValueString("t
//
// "CDROM : " +
// (doc.getItemValueString("t
//
// "DVD : " +
// (doc.getItemValueString("t
"Wireless Driver : " +
(doc.getItemValueString("t
"Ethernet Driver : " +
(doc.getItemValueString("t
"CDC [EDC/MDC/BDC] : " +
(doc.getItemValueString("t
"Hotkey Features : " +
(doc.getItemValueString("t
"CMD IDE Driver : " +
(doc.getItemValueString("t
"Package Manager : " +
(doc.getItemValueString("t
"Access Connections : " +
(doc.getItemValueString("t
"Others : " +
(doc.getItemValueString("t
"[PARAMETER]\n" +
"BIOS Setting : " +
(doc.getItemValueString("t
"OS Setting : " +
(doc.getItemValueString("t
// @PC moved to another position
// "[RE-CREATION PROCEDURE]\n" +
// (doc.getItemValueString("r
//"[OTHER]\n" +
//(doc.getItemValueString(
}
/**
*
* Method for getting the String equivalent of Problem Remarks.
*
*/
public String toString() {
return string;
}
}
ProcessMessage.java
import java.awt.Dimension;
import java.awt.Font;
import java.awt.ScrollPane;
import java.awt.TextArea;
import java.awt.Toolkit;
import java.awt.event.WindowEvent
import java.awt.event.WindowListe
public class ProcessMessage extends java.awt.Frame implements WindowListener {
TextArea textArea;
/**
*
* Constructor for executing the display.
*
* @param title Window title.
*
*/
public ProcessMessage(String title) {
textArea = new TextArea();
textArea.setFont(new Font("Arial", Font.PLAIN, 12));
//textArea.setLineWrap(tru
//textArea.setWrapStyleWor
textArea.setEditable(false
ScrollPane areaScrollPane = new ScrollPane();
areaScrollPane.add(textAre
areaScrollPane.setSize(new
add(areaScrollPane);
Dimension screenSize = Toolkit.getDefaultToolkit(
setBounds((screenSize.widt
addWindowListener(this);
setTitle(title);
setVisible(true);
}
public void appendText(String message) {
textArea.append(message);
}
public void windowOpened(WindowEvent e) {}
public void windowClosing(WindowEvent e) {
dispose();
}
public void windowClosed(WindowEvent e) {}
public void windowIconified(WindowEven
public void windowDeiconified(WindowEv
public void windowActivated(WindowEven
public void windowDeactivated(WindowEv
}
RemarksFrame.java
import java.awt.Button;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Font;
import java.awt.Label;
import java.awt.Panel;
import java.awt.ScrollPane;
import java.awt.TextArea;
import java.awt.Toolkit;
import java.awt.event.ActionEvent
import java.awt.event.ActionListe
import java.awt.event.WindowEvent
import java.awt.event.WindowListe
import lotus.domino.*;
public class RemarksFrame extends Frame implements ActionListener, WindowListener {
Button okButton;
Button cancelButton;
TextArea textArea;
String userName;
String password;
String action;
String cmvcNo;
String family;
String authMethod;
String serverName;
String cmvcDb;
String projectDb;
/**
*
* Constructor for executing the display.
*
* @param title Window title.
*
*/
public RemarksFrame(String userName, String password, String action, String cmvcNo, String family, String authMethod, String serverName, String cmvcDb, String projectDb) {
this.userName = userName;
this.password = password;
this.action = action;
this.cmvcNo = cmvcNo;
this.family = family;
this.authMethod = authMethod;
this.serverName = serverName;
this.cmvcDb = cmvcDb;
this.projectDb = projectDb;
textArea = new TextArea();
Panel p1 = new Panel();
p1.setLayout(new BorderLayout());
Label label1 = new Label("Action:", Label.RIGHT);
Label label2 = new Label("CMVC No.:", Label.RIGHT);
p1.add("Center", label1);
p1.add("South", label2);
Panel p2 = new Panel();
p2.setLayout(new BorderLayout());
Label label3 = new Label(action);
Label label4 = new Label(cmvcNo);
label3.setFont(new Font("Arial", Font.BOLD, 12));
label4.setFont(new Font("Arial", Font.BOLD, 12));
p2.add("Center", label3);
p2.add("South", label4);
Panel p3 = new Panel();
p3.add(p1);
p3.add(p2);
p3.setBackground(Color.lig
add("North", p3);
textArea.setFont(new Font("Arial", Font.PLAIN, 12));
ScrollPane areaScrollPane = new ScrollPane();
areaScrollPane.add(textAre
areaScrollPane.setSize(new
add("Center", areaScrollPane);
Panel p4 = new Panel();
okButton = new Button(" OK ");
cancelButton = new Button("Cancel");
okButton.addActionListener
cancelButton.addActionList
p4.add(okButton);
p4.add(new Label(" "));
p4.add(cancelButton);
p4.setBackground(Color.lig
add("South", p4);
Dimension screenSize = Toolkit.getDefaultToolkit(
setBounds((screenSize.widt
addWindowListener(this);
setTitle("CMVC Operation");
setVisible(true);
}
public void actionPerformed(ActionEven
Object source = evt.getSource();
if (source == okButton) {
setVisible(false);
// new MainProcess(userName, password, action, cmvcNo, family, textArea.getText(), null, authMethod, serverName, cmvcDb, projectDb);
new MainProcess(userName, password, action, cmvcNo, family, textArea.getText(), null, authMethod, serverName, cmvcDb, projectDb, null);
dispose();
} else if (source == cancelButton) {
dispose();
}
}
public void windowOpened(WindowEvent e) {}
public void windowClosing(WindowEvent e) {
dispose();
}
public void windowClosed(WindowEvent e) {}
public void windowIconified(WindowEven
public void windowDeiconified(WindowEv
public void windowActivated(WindowEven
public void windowDeactivated(WindowEv
}
SaveClientAction.java
import java.io.*;
import java.text.*;
import java.util.*;
public class SaveClientAction extends PrintStream {
static OutputStream logfile;
static PrintStream oldStdout;
static PrintStream oldStderr;
/**
*
* Constructor for instantiating the super class.
*
* @param ps java.io.PrintStream object.
*
*/
SaveClientAction(PrintStre
super(ps);
}
/**
*
* Method to start copying stdout and stderr to the log file.
*
*/
public static synchronized void start(ProcessMessage pm) throws IOException {
// Save old settings.
pm.appendText("inside start save");
oldStdout = System.out;
oldStderr = System.err;
// Create/Open logfile.
pm.appendText("before new PrintStream");
logfile = new PrintStream(
new BufferedOutputStream(
new FileOutputStream("cmvcActi
pm.appendText("\nafter new PrintStream");
// Start redirecting the output.
pm.appendText("before new save client action system out");
//System.setOut(new SaveClientAction(System.ou
pm.appendText("before new save client action system err");
//System.setErr(new SaveClientAction(System.er
}
/**
*
* Method to stop writing to log file and restore the original settings.
*
*/
public static synchronized void stop(ProcessMessage pm) {
pm.appendText("\nSTART CLIENT SOTP");
System.setOut(oldStdout);
System.setErr(oldStderr);
try {
logfile.close();
} catch (Exception e) {
e.printStackTrace();
}
pm.appendText("\nFINISH CLIENT SOTP");
}
/**
*
* Overrides the write method of super class.
*
* @param b character to write.
*
*/
public void write(int b) {
try {
logfile.write(b);
} catch (Exception e) {
e.printStackTrace();
setError();
}
super.write(b);
}
/**
*
* Overrides the write method of super class.
*
* @param buf[] array of bytes to write.
* @param off offset.
* @param len length.
*
*/
public void write(byte buf[], int off, int len) {
try {
logfile.write(buf, off, len);
} catch (Exception e) {
e.printStackTrace();
setError();
}
super.write(buf, off, len);
}
}
SaveClientError.java
import java.io.*;
import java.text.*;
import java.util.*;
public class SaveClientError extends PrintStream {
static OutputStream logfile;
static PrintStream oldStdout;
static PrintStream oldStderr;
/**
*
* Constructor for instantiating the super class.
*
* @param ps java.io.PrintStream object.
*
*/
SaveClientError(PrintStrea
super(ps);
}
/**
*
* Method to start copying stdout and stderr to the log file.
*
*/
public static void start() throws IOException {
// Save old settings.
oldStdout = System.out;
oldStderr = System.err;
// Create/Open logfile.
logfile = new PrintStream(
new BufferedOutputStream(
new FileOutputStream("cmvcErro
// Start redirecting the output.
System.setOut(new SaveClientError(System.out
System.setErr(new SaveClientError(System.err
}
/**
*
* Method to stop writing to log file and restore the original settings.
*
*/
public static void stop() {
// pm.appendText("\nstarting saveclient error stop");
System.setOut(oldStdout);
System.setErr(oldStderr);
try {
logfile.close();
} catch (Exception e) {
e.printStackTrace();
}
//pm.appendText("\nFINISHE
}
/**
*
* Overrides the write method of super class.
*
* @param b character to write.
*
*/
public void write(int b) {
try {
logfile.write(b);
} catch (Exception e) {
e.printStackTrace();
setError();
}
super.write(b);
}
/**
*
* Overrides the write method of super class.
*
* @param buf[] array of bytes to write.
* @param off offset.
* @param len length.
*
*/
public void write(byte buf[], int off, int len) {
try {
logfile.write(buf, off, len);
} catch (Exception e) {
e.printStackTrace();
setError();
}
super.write(buf, off, len);
}
}
UserPasswordProfile.java
public class UserPasswordProfile {
public UserPasswordProfile() {
}
}
VerifyFrame.java
import java.awt.Button;
import java.awt.BorderLayout;
import java.awt.Choice;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Font;
import java.awt.Label;
import java.awt.Panel;
import java.awt.ScrollPane;
import java.awt.TextArea;
import java.awt.Toolkit;
import java.awt.event.ActionEvent
import java.awt.event.ActionListe
import java.awt.event.WindowEvent
import java.awt.event.WindowListe
import lotus.domino.*;
public class VerifyFrame extends Frame implements ActionListener, WindowListener {
Button okButton;
Button cancelButton;
Choice result;
TextArea textArea;
String userName;
String password;
String action;
String cmvcNo;
String family;
String unid;
String authMethod;
String serverName;
String cmvcDb;
String projectDb;
/**
*
* Constructor for executing the display.
*
* @param title Window title.
*
*/
public VerifyFrame(String userName, String password, String action, String cmvcNo, String family, String unid, String authMethod, String serverName, String cmvcDb, String projectDb) {
this.userName = userName;
this.password = password;
this.action = action;
this.cmvcNo = cmvcNo;
this.family = family;
this.unid = unid;
this.authMethod = authMethod;
this.serverName = serverName;
this.cmvcDb = cmvcDb;
this.projectDb = projectDb;
textArea = new TextArea();
Panel p1 = new Panel();
p1.setLayout(new BorderLayout());
Label label1 = new Label("Action:", Label.RIGHT);
Label label2 = new Label("CMVC No.:", Label.RIGHT);
Label label3 = new Label("Result:", Label.RIGHT);
p1.add("North", label1);
p1.add("Center", label2);
p1.add("South", label3);
Panel p2 = new Panel();
p2.setLayout(new BorderLayout());
Label label4 = new Label(action);
Label label5 = new Label(cmvcNo);
result = new Choice();
result.add("PASS");
result.add("FAIL");
label4.setFont(new Font("Arial", Font.BOLD, 12));
label5.setFont(new Font("Arial", Font.BOLD, 12));
p2.add("North", label4);
p2.add("Center", label5);
p2.add("South", result);
Panel p3 = new Panel();
p3.add(p1);
p3.add(p2);
p3.setBackground(Color.lig
add("North", p3);
textArea.setFont(new Font("Arial", Font.PLAIN, 12));
ScrollPane areaScrollPane = new ScrollPane();
areaScrollPane.add(textAre
areaScrollPane.setSize(new
add("Center", areaScrollPane);
Panel p4 = new Panel();
okButton = new Button(" OK ");
cancelButton = new Button("Cancel");
okButton.addActionListener
cancelButton.addActionList
p4.add(okButton);
p4.add(new Label(" "));
p4.add(cancelButton);
p4.setBackground(Color.lig
add("South", p4);
Dimension screenSize = Toolkit.getDefaultToolkit(
setBounds((screenSize.widt
addWindowListener(this);
setTitle("CMVC Operation");
setVisible(true);
}
public void actionPerformed(ActionEven
Object source = evt.getSource();
if (source == okButton) {
setVisible(false);
String verifyResult = result.getSelectedItem();
if (verifyResult.equals("PASS
// new MainProcess(userName, password, "accept", cmvcNo, family, "Verification Result: PASS\n\n" + textArea.getText(), null, authMethod, serverName, cmvcDb, projectDb);
new MainProcess(userName, password, "accept", cmvcNo, family, "Verification Result: PASS\n\n" + textArea.getText(), null, authMethod, serverName, cmvcDb, projectDb, null);
} else if (verifyResult.equals("FAIL
// new MainProcess(userName, password, "reject", cmvcNo, family, "Verification Result: FAIL\n\n" + textArea.getText(), unid, authMethod, serverName, cmvcDb, projectDb);
new MainProcess(userName, password, "reject", cmvcNo, family, "Verification Result: FAIL\n\n" + textArea.getText(), unid, authMethod, serverName, cmvcDb, projectDb, null);
}
dispose();
} else if (source == cancelButton) {
dispose();
}
}
public void windowOpened(WindowEvent e) {}
public void windowClosing(WindowEvent e) {
dispose();
}
public void windowClosed(WindowEvent e) {}
public void windowIconified(WindowEven
public void windowDeiconified(WindowEv
public void windowActivated(WindowEven
public void windowDeactivated(WindowEv
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
cheers,
Tom