Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     ReportCaster API to edit a Schedule

Read-Only Read-Only Topic
Go
Search
Notify
Tools
ReportCaster API to edit a Schedule
 Login/Join
 
Silver Member
posted
We have a front end application to get the inputs from the customers and submit a schedule to the ReportCaster using ReportCaster APIs. We are also providing options to the customers to edit the already entered schedule details, say if a report is scheduled to run on a daily basis for 5 days and after 3 days if the customer edit the same scheduled request and change the frequency to run it on every week. Is there any way to edit the same schedule that was entered already and changing only the frequency.
 
Posts: 31 | Registered: October 26, 2006Report This Post
Expert
posted Hide Post
Hi Fazlina,

Suggestion from senior techie is that, this sounds like an issue to be reported to Information Builders' Customer Support Services. Please submit a new case for further research/troubleshooting. You may either call at 1-800-736-6130, or access the online system InfoResponse. Here is a list of information to be ready when you call: http://techsupport.ibi.com/before_you_call.jsp.

Hope this helps. Big Grin

Cheers,

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.
 
Posts: 1948 | Location: New York | Registered: November 16, 2004Report This Post
Guru
posted Hide Post
Fazlina,

I have some java code at another location that does this. It only works in 7.13. If you believe that it would be helpful then send me a private message to remind me to send it to you.

Fernando


Prod WF 8.1.04, QA WF 8.2.03, Dev WF 8.2.03
 
Posts: 278 | Registered: October 10, 2006Report This Post
Silver Member
posted Hide Post
quote:
at another location that does this

Fernando,

We are working on an application like that. Just wondering if you could send that code to the email address sjadoon99@yahoo.com please? Thanks.

Mike


Prod: WebFOCUS 7.1.3 on Linux Kernel-2.6.5 zSeries 64bit/Apache Tomcat/5.0.28 JAVA version 1.4.2_11 server
 
Posts: 35 | Location: Oklahoma City | Registered: May 11, 2006Report This Post
Silver Member
posted Hide Post
Hi Fernando,
Can you please paste the code here itself so that it would be of helpful to many.

Thanks in advance.
 
Posts: 31 | Registered: October 26, 2006Report This Post
Guru
posted Hide Post
Ok, Here we go. It's long and you will see that it is built as servlet that requires plenty of parms. I have tried to shorten it. Sorry if I missed any functions. Premise is connect to caster, find the schedule by id, modify it using api functions and then save it.

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.resource.*;
import javax.resource.cci.*;
import java.util.*;
import ibi.broker.api.*;
import ibi.broker.api.cci.*;
import ibi.broker.api.data.*;
import ibi.broker.api.data.addrbook.*;
import ibi.broker.api.data.schedule.*;
import ibi.broker.api.cci.LibraryAccessManager;
import ibi.broker.api.data.libraryaccess.AccessElement;
import ibi.broker.api.data.libraryaccess.LibraryAccessBook;

public class CasterServlet extends HttpServlet
{
private CasterConnection con = null;
private String user = null;
private String password = null;
private ScheduleManager manager = null;
private HttpServletRequest m_request = null;
private HttpServletResponse m_response = null;
private PrintWriter out = null;
private Schedule schedule = null;
private String casterServerName = null;
private String casterPortNumber = null;
private String mailServerName = null;

// Handle a get request [called automattically]
public void doGet(HttpServletRequest request, HttpServletResponse response) throws

ServletException, IOException
{
doPost(request, response);
}

// Handle a post request [called automattically]
public void doPost(HttpServletRequest request, HttpServletResponse response) throws

ServletException, IOException
{
String msg;

m_request = request;
m_response = response;
out = response.getWriter();

try {

// Connect to the caster distribution server
manager = connect ();
if (manager == null) {
out.println("Error_Connection");
return;
}
}
catch (ResourceException ex) {
out.println("Error_Connection");
return;
}


// Handle the action
try {

String scheduleId = m_request.getParameter("IBIB_scheduleId");

schedule = manager.getSchedule(scheduleId);

String jbdesc = m_request.getParameter("IBIB_jobdesc");
schedule.setDescription(jbdesc);

String jbpriority = m_request.getParameter("IBIB_priority");
java.lang.Integer tjbpriority = new java.lang.Integer(jbpriority);
int ijbpriority = tjbpriority.intValue();
schedule.setPriority(ijbpriority);

Notification notification = createNotification ();
schedule.setNotification(notification);

TaskStandardReport task = createTaskSR ();
schedule.setTaskList(new Task[] { task } );

String dtype = m_request.getParameter("IBIB_disttype");
if (dtype.equals("E")) { // EMail
DistributionEmail distributionEMail = createEMailDist();
schedule.setDistribution(distributionEMail);
Destination destinationEMail = createDest ();
distributionEMail.setDestination(destinationEMail);
schedule.setDistribution(distributionEMail);
}

if (dtype.equals("L")) { // Library
StorageLibrary distributionLibrary = createLibDist();
getAccess(distributionLibrary, true);
schedule.setDistribution(distributionLibrary);
}

if (dtype.equals("F")) { // Ftp
DistributionFTP distributionFTP = createFTP();
Destination destinationFTP = createDest ();
distributionFTP.setDestination(destinationFTP);
schedule.setDistribution(distributionFTP);
}

if (dtype.equals("P")) { // Printer
DistributionPrint distributionPrint = new DistributionPrint();
Destination destinationPrint = createDest ();
distributionPrint.setDestination(destinationPrint);
schedule.setDistribution(distributionPrint);
}

String sinfo = m_request.getParameter("IBIB_interval");
java.lang.Integer iinfo = new java.lang.Integer(sinfo);
int tinfo = iinfo.intValue();
switch (tinfo) {
case 0: // Once
TimeInfoOnce timeInfoOnce = createTmInfoOnce (null, true);
schedule.setTimeInfo(timeInfoOnce);
break;
case 1: // Minute
TimeInfoMinute timeInfoMinute = createTmInfoMinute (null, true);
timeInfoMinute.setFrequency(getOften(timeInfoMinute, true));
schedule.setTimeInfo(timeInfoMinute);
break;
case 2: // Hour
TimeInfoHour timeInfoHour = createTmInfoHour (null, true);
timeInfoHour.setFrequency(getOften(timeInfoHour, true));
schedule.setTimeInfo(timeInfoHour);
break;
case 3: // Day
TimeInfoDay timeInfoDay = createTmInfoDay (null, true);
timeInfoDay.setFrequency(getOften(timeInfoDay, true));
schedule.setTimeInfo(timeInfoDay);
break;
case 4: // Week
TimeInfoWeek timeInfoWeek = createTmInfoWeek (null, true);
timeInfoWeek.setFrequency(getOften(timeInfoWeek, true));
schedule.setTimeInfo(timeInfoWeek);
break;
case 5: // Month
TimeInfoMonth timeInfoMonth = createTmInfoMonth (null, true);
timeInfoMonth.setFrequency(getOften(timeInfoMonth, true));
schedule.setTimeInfo(timeInfoMonth);
break;
case 6: // Year
TimeInfoYear timeInfoYear = createTmInfoYear (null, true);
timeInfoYear.setFrequency(getOften(timeInfoYear, true));
schedule.setTimeInfo(timeInfoYear);
break;
}

schedule.setActive(true);

}
catch (Exception ex) {
out.println("General error: " + ex.toString());
return;
}

}

// Initialization [called automattically]
public void init() throws ServletException
{
user = getInitParameter("IBIB_user");
password = getInitParameter("IBIB_password");
casterServerName = getInitParameter("IBIB_casterServerName");
casterPortNumber = getInitParameter("IBIB_casterServerPort");
mailServerName = getInitParameter("IBIB_mailServerName");
}

// Connect to Caster
public ScheduleManager connect () throws ResourceException, IOException
{

// Connect to caster
CasterManagedConnectionFactory managedConnectionFactory = new

CasterManagedConnectionFactory();
managedConnectionFactory.setServerName(casterServerName);
managedConnectionFactory.setPortNumber(casterPortNumber);

CasterConnectionFactory connectionFactory = (CasterConnectionFactory)

managedConnectionFactory.createConnectionFactory();
ConnectionSpec credential = new PasswordCredential(user, password.toCharArray());
con = (CasterConnection) connectionFactory.getConnection(credential);

ScheduleManager manager = con.getScheduleManager();

return manager;
}


// Create an EMail Distribution
public DistributionEmail createEMailDist () throws ResourceException
{
String emailFrom = m_request.getParameter("IBIB_email");
String mailSubject = m_request.getParameter("IBIB_mailsubject");
String inlineMessage = m_request.getParameter("IBIB_inlineMessage");
String zipFileName = m_request.getParameter("IBIB_zipFileName");

DistributionEmail distribution = new DistributionEmail();
distribution.setMailReplyAddress(emailFrom);
distribution.setInlineMessage(inlineMessage);
distribution.setInlineTaskIndex(0);
distribution.setMailFrom(emailFrom);
distribution.setMailServerName(mailServerName);
distribution.setMailSubject(mailSubject);
distribution.setSendingReportAsAttachment(true);
distribution.setZipFileName(zipFileName);

return distribution;
}

// Create a FTP distribution
public DistributionFTP createFTP()
{
String ftpuser = m_request.getParameter("IBIB_ftpUser");
String ftppass = m_request.getParameter("IBIB_ftpPass");
String ftploc = m_request.getParameter("IBIB_ftpLocation");
String ftpserv = m_request.getParameter("IBIB_ftpServer");
String ftpindexFile = m_request.getParameter("IBIB_ftpIndex");

DistributionFTP distribution = new DistributionFTP();
distribution.setFtpLocation(ftploc);
distribution.setFtpServerName(ftpserv);
distribution.setFtpUserName(ftpuser);
distribution.setFtpPassword(ftppass);
distribution.setIndexFile(ftpindexFile);

return distribution;
}

// Create a library Distribution
public StorageLibrary createLibDist () throws ResourceException
{
StorageLibrary distribution = new StorageLibrary();
String category = m_request.getParameter("IBIB_category");
distribution.setCategory(category);

String emode = m_request.getParameter("IBIB_emode");
distribution.setExpirationMode(emode);

String exp = m_request.getParameter("IBIB_exp");
java.lang.Integer texp = new java.lang.Integer(exp);
int iexp = texp.intValue();
distribution.setExpirationData(iexp);

distribution.setAccessType(m_request.getParameter("IBIB_accessType"));
distribution.setSendEmailAfterSaveReport(false);

return distribution;
}

// Create the destination and the Address Book
public Destination createDest () throws ResourceException
{
String bookName = m_request.getParameter("IBIB_jobdesc");
Destination destination = new Destination();

destination.setType(ibi.broker.api.data.schedule.Destination.DISTRIBUTION_LIST);
destination.setDistributionList(bookName);

getAddress(destination, true);
return destination;
}

// Create Standard task
public TaskStandardReport createTaskSR () throws ResourceException
{
String domain, folder;

TaskStandardReport task = new TaskStandardReport();
fillTask (task);

domain = m_request.getParameter("IBIB_domainHREF");
folder = m_request.getParameter("IBIB_folderHREF");

task.setDomainHREF(domain);
task.setFolderHREF(folder);

return task;
}

// Create WF task
public TaskWFServerProcedure createTask () throws ResourceException
{
TaskWFServerProcedure task = new TaskWFServerProcedure();
fillTask (task);

return task;
}

// Create notification
public Notification createNotification () throws ResourceException
{
Notification notification = new Notification ();

String notiType = m_request.getParameter("IBIB_onError");
notification.setType(notiType);

String notificationAddress = null;
notificationAddress = m_request.getParameter("IBIB_notifyaddress");
if (notiType.equals(ibi.broker.api.data.schedule.Notification.INACTIVE)) {
notification.setAddressForBriefNotification("");
notification.setAddressForFullNotification("");
}

if (((notiType.equals(ibi.broker.api.data.schedule.Notification.ONERROR))) ||

((notiType.equals(ibi.broker.api.data.schedule.Notification.ALWAYS)))) {
notification.setAddressForBriefNotification(notificationAddress);
notification.setAddressForFullNotification(notificationAddress);
}

String errorSubject = null;
errorSubject = m_request.getParameter("IBIB_errorsubject");
if (errorSubject != null)
notification.setSubject(errorSubject);

String emailFrom = m_request.getParameter("IBIB_email");
notification.setFrom(emailFrom);

return notification;
}

// Create the schedule
public Schedule createSchedule () throws ResourceException
{
Schedule schedule = manager.createScheduleInstanceDefault();
String jbdesc = m_request.getParameter("IBIB_jobdesc");
schedule.setDescription(jbdesc);

String jbpriority = m_request.getParameter("IBIB_priority");
if (jbpriority == null)
jbpriority = "3";
java.lang.Integer tjbpriority = new java.lang.Integer(jbpriority);
int ijbpriority = tjbpriority.intValue();
schedule.setPriority(ijbpriority);

Notification notification = createNotification ();
schedule.setNotification(notification);

TaskStandardReport task = createTaskSR ();
schedule.setTaskList(new Task[] { task } );

String dtype = m_request.getParameter("IBIB_disttype");
if (dtype.equals("E")) { // EMail
DistributionEmail distributionEMail = createEMailDist();
schedule.setDistribution(distributionEMail);
Destination destinationEMail = createDest ();
distributionEMail.setDestination(destinationEMail);
schedule.setDistribution(distributionEMail);
}

if (dtype.equals("L")) { // Library
StorageLibrary distributionLibrary = createLibDist();
getAccess(distributionLibrary, true);
schedule.setDistribution(distributionLibrary);
}

if (dtype.equals("F")) { // Ftp
DistributionFTP distributionFTP = createFTP();
Destination destinationFTP = createDest ();
distributionFTP.setDestination(destinationFTP);
schedule.setDistribution(distributionFTP);
}

if (dtype.equals("P")) { // Printer
DistributionPrint distributionPrint = new DistributionPrint();
Destination destinationPrint = createDest ();
distributionPrint.setDestination(destinationPrint);
schedule.setDistribution(distributionPrint);
}

String sinfo = m_request.getParameter("IBIB_interval");
java.lang.Integer iinfo = new java.lang.Integer(sinfo);
int tinfo = iinfo.intValue();
switch (tinfo) {
case 0: // Once
TimeInfoOnce timeInfoOnce = createTmInfoOnce (null, true);
schedule.setTimeInfo(timeInfoOnce);
break;
case 1: // Minute
TimeInfoMinute timeInfoMinute = createTmInfoMinute (null, true);
timeInfoMinute.setFrequency(getOften(timeInfoMinute, true));
schedule.setTimeInfo(timeInfoMinute);
break;
case 2: // Hour
TimeInfoHour timeInfoHour = createTmInfoHour (null, true);
timeInfoHour.setFrequency(getOften(timeInfoHour, true));
schedule.setTimeInfo(timeInfoHour);
break;
case 3: // Day
TimeInfoDay timeInfoDay = createTmInfoDay (null, true);
timeInfoDay.setFrequency(getOften(timeInfoDay, true));
schedule.setTimeInfo(timeInfoDay);
break;
case 4: // Week
TimeInfoWeek timeInfoWeek = createTmInfoWeek (null, true);
timeInfoWeek.setFrequency(getOften(timeInfoWeek, true));
schedule.setTimeInfo(timeInfoWeek);
break;
case 5: // Month
TimeInfoMonth timeInfoMonth = createTmInfoMonth (null, true);
timeInfoMonth.setFrequency(getOften(timeInfoMonth, true));
schedule.setTimeInfo(timeInfoMonth);
break;
case 6: // Year
TimeInfoYear timeInfoYear = createTmInfoYear (null, true);
timeInfoYear.setFrequency(getOften(timeInfoYear, true));
schedule.setTimeInfo(timeInfoYear);
break;
}

schedule.setActive(true);

return schedule;
}

// Create Date
public GregorianCalendar createDate (String inDate, String inTime) {

GregorianCalendar cDateTime = new GregorianCalendar();
int cYear = 0;
int cMonth = 0;
int cDay = 0;

// Get the date
String cDate = m_request.getParameter(inDate);
if ((cDate != null) && (!cDate.equals("")) && (cDate.length() == 10)) {
cMonth = (new java.lang.Integer(cDate.substring(0, 2))).intValue() - 1;
cDay = (new java.lang.Integer(cDate.substring(3, 5))).intValue();
cYear = (new java.lang.Integer(cDate.substring(6, 10))).intValue();
cDateTime.set(java.util.Calendar.MONTH, cMonth);
cDateTime.set(java.util.Calendar.DAY_OF_MONTH, cDay);
cDateTime.set(java.util.Calendar.YEAR, cYear);
}

// Get the time
int cHour = 0;
int cMin = 0;
String cTime = m_request.getParameter(inTime);
if ((cTime != null) && (cTime.length() == 5)) {
cHour = (new java.lang.Integer(cTime.substring(0, 2))).intValue();
cMin = (new java.lang.Integer(cTime.substring(3, 5))).intValue();
cDateTime.set(java.util.Calendar.HOUR, cHour);
cDateTime.set(java.util.Calendar.MINUTE, cMin);
cDateTime.set(java.util.Calendar.AM_PM, java.util.Calendar.AM);
}

return cDateTime;
}

// Create Date
public void createDaysofWeek (TimeInfoMinute tm) {

String cDay = null;

cDay = m_request.getParameter("IBIB_weekdays_1");
if ((cDay != null) && (cDay.equals("MON")))
tm.setMonday(true);

cDay = m_request.getParameter("IBIB_weekdays_2");
if ((cDay != null) && (cDay.equals("TUE")))
tm.setTuesday(true);

cDay = m_request.getParameter("IBIB_weekdays_3");
if ((cDay != null) && (cDay.equals("WED")))
tm.setWednesday(true);

cDay = m_request.getParameter("IBIB_weekdays_4");
if ((cDay != null) && (cDay.equals("THU")))
tm.setThursday(true);

cDay = m_request.getParameter("IBIB_weekdays_5");
if ((cDay != null) && (cDay.equals("FRI")))
tm.setFriday(true);

cDay = m_request.getParameter("IBIB_weekdays_6");
if ((cDay != null) && (cDay.equals("SAT")))
tm.setSaturday(true);

cDay = m_request.getParameter("IBIB_weekdays_7");
if ((cDay != null) && (cDay.equals("SUN")))
tm.setSunday(true);
}

// Create Once TimeInfo
public TimeInfoOnce createTmInfoOnce (TimeInfoOnce tm, boolean isNew)
{
TimeInfoOnce timeInfo;
if (isNew) {
timeInfo = new TimeInfoOnce();
}
else
timeInfo = tm;
fillDate (timeInfo, isNew);
return timeInfo;
}

// Create Minute TimeInfo
public TimeInfoMinute createTmInfoMinute (TimeInfoMinute tm, boolean isNew)
{
TimeInfoMinute timeInfo;
if (isNew) {
timeInfo = new TimeInfoMinute();
createDaysofWeek (timeInfo);
}
else
timeInfo = tm;
fillDate (timeInfo, isNew);
fillOften (timeInfo, isNew);

return timeInfo;
}

// Create Hour TimeInfo
public TimeInfoHour createTmInfoHour (TimeInfoHour tm, boolean isNew)
{
TimeInfoHour timeInfo;
if (isNew) {
timeInfo = new TimeInfoHour();
createDaysofWeek (timeInfo);
}
else
timeInfo = tm;

fillDate (timeInfo, isNew);
fillOften (timeInfo, isNew);
return timeInfo;
}

// Create Day TimeInfo
public TimeInfoDay createTmInfoDay (TimeInfoDay tm, boolean isNew)
{
TimeInfoDay timeInfo;
if (isNew) {
timeInfo = new TimeInfoDay();
}
else
timeInfo = tm;

fillDate (timeInfo, isNew);
fillOften (timeInfo, isNew);
return timeInfo;
}

// Create Week TimeInfo
public TimeInfoWeek createTmInfoWeek (TimeInfoWeek tm, boolean isNew)
{
TimeInfoWeek timeInfo;
if (isNew) {
timeInfo = new TimeInfoWeek();
createDaysofWeek (timeInfo);
}
else
timeInfo = tm;

fillDate (timeInfo, isNew);
fillOften (timeInfo, isNew);
return timeInfo;
}

// Create Month TimeInfo
public TimeInfoMonth createTmInfoMonth (TimeInfoMonth tm, boolean isNew)
{
TimeInfoMonth timeInfo;
if (isNew) {
timeInfo = new TimeInfoMonth();
}
else
timeInfo = tm;

fillDate (timeInfo, isNew);
fillOften (timeInfo, isNew);
if (!isNew)
return timeInfo;

// Get the days of the month
boolean[] days = new boolean[31];
for (int i=0; i<31; i++) {
String cDay = null;
cDay = m_request.getParameter("IBIB_day_" + (i + 1));
if ((cDay != null) && (cDay.equals("on")))
days[i] = true;
else
days[i] = false;
}

timeInfo.setDaysOfMonth(days);
String cLastday = null;
cLastday = m_request.getParameter("IBIB_day_Last");
if ((cLastday != null) && (cLastday.equals("on")))
timeInfo.setLastDayOfMonth(true);

return timeInfo;
}

// Create Year TimeInfo
public TimeInfoYear createTmInfoYear (TimeInfoYear tm, boolean isNew)
{
TimeInfoYear timeInfo;
if (isNew) {
timeInfo = new TimeInfoYear();
}
else
timeInfo = tm;

fillDate (timeInfo, isNew);
fillOften (timeInfo, isNew);
return timeInfo;
}

// Create objects for the other parameters
public void createParmObjects () {

// Go thru the current parms and then send them to the scheduled program if they

don't begin with IBIB

Enumeration parms = m_request.getParameterNames();
String pname = null;
while (parms.hasMoreElements()) {
pname = (String) parms.nextElement();
if ((pname.length() >= 4) && (pname.substring(0, 4).equals( "IBIB")))
continue;

String pval = m_request.getParameter(pname);
out.println("
+ "\">");
}
}


// Retrieve any input parmeters not beginning with IBIB and create these
// as parameters for the fex
public Parameter[] getFexParms() {

Vector parmvec = new Vector(20, 10);
Enumeration parms = m_request.getParameterNames();
String pname = null;

// Loop thru all of the input parameters
while (parms.hasMoreElements()) {
pname = (String) parms.nextElement();
if ((pname.length() >= 4) && (pname.substring(0, 4).equals( "IBIB")))
continue;

String pval = m_request.getParameter(pname);

Parameter parameter = new Parameter();
parameter.setName(pname);
parameter.setValue(pval);
parmvec.addElement(parameter);
}

// Transfer the extra parameters to an array
Parameter[] pList = new Parameter[parmvec.size()];
for (int j = 0; j < parmvec.size[); j++) {
pList[j] = (Parameter) parmvec.elementAt(j);
}

return pList;
}

// Get the time
public String getTime(TimeInfo tm)
{
String sMin, sHour;

Calendar cal = tm.getStartTime();

int Min = cal.get(java.util.Calendar.MINUTE);
int Hour = cal.get(java.util.Calendar.HOUR);
int AMPM = cal.get(java.util.Calendar.AM_PM);

if (AMPM == 1)
Hour += 12;

if (Hour < 10)
sHour = "0" + Hour;
else
sHour = "" + Hour;

if (Min < 10)
sMin = "0" + Min;
else
sMin = "" + Min;

return sHour + ":" + sMin;
}

// Get the day
public String getDay(TimeInfo tm)
{
Calendar cal = tm.getStartTime();

int Month = cal.get(java.util.Calendar.MONTH) + 1;
int Day = cal.get(java.util.Calendar.DAY_OF_MONTH);
int Year = cal.get(java.util.Calendar.YEAR);
String sMonth, sDay;

if (Month < 10)
sMonth = "0" + Month;
else
sMonth = "" + Month;

if (Day < 10)
sDay = "0" + Day;
else
sDay = "" + Day;

return sMonth + "/" + sDay + "/" + Year;
}

// Create the address book and list
public AddrBook getAddress(Destination destination, boolean isNew)
{
AddressBookManager abmanager = con.getAddressBookManager();
AddrBook addrBook = null;
DestinationElement[] dList;
int i, j;

if (isNew) {
String bookName = m_request.getParameter("IBIB_jobdesc");

addrBook = null;
try {
addrBook = abmanager.getAddressBook(bookName);
abmanager.deleteAddressBook(bookName);
}
catch (CasterException ex) {
}

addrBook = new AddrBook();
addrBook.setBookName(bookName);
addrBook.setAccess(ibi.broker.api.data.addrbook.AddrBook.PRIVATE);
addrBook.setMethod(ibi.broker.api.data.schedule.Distribution.EMAIL);
addrBook.setOwner(user);

// Set into addrBook new DestinationElement List with new destinationElement
String [] sendnum = m_request.getParameterValues("IBIB_distList");
j = 0;
if (sendnum != null)
j = sendnum.length;
dList = new DestinationElement[j];

for (i = 0; i < j; i++) {
DestinationElement distelement = new DestinationElement();
distelement.setBurstValue(i + "");
distelement.setLocation(sendnum[i]);
dList[i] = distelement;
}

addrBook.setDestinationList(dList);
try {
abmanager.addAddressBook(addrBook);
}
catch (CasterException ex) {
return null;
}

return addrBook;
}
else {
try {
addrBook = abmanager.getAddressBook(destination.getDistributionList());
}
catch (CasterException ex) {
return null;
}
j = 0;

dList = addrBook.getDestinationList();
if (dList != null)
j = dList.length;
for (i=0; i fillItem("IBIB_distList", dList[i].getLocation(), dList[i].getLocation());
}

return addrBook;
}
}

// Create the access list
public LibraryAccessBook getAccess(StorageLibrary libdist, boolean isNew)
{
LibraryAccessManager acmanager = con.getLibraryAccessManager();
LibraryAccessBook book = null;
AccessElement[] aList;
int i, j;

if (isNew) {
String bookName = m_request.getParameter("IBIB_jobdesc");
String acType = m_request.getParameter("IBIB_accessType");

if ((acType.equals(ibi.broker.api.data.library.Content.ACCESS_TYPE_OWNER))
|| (acType.equals(ibi.broker.api.data.library.Content.ACCESS_TYPE_PUBLIC)))

{
return null;
}

try {
book = acmanager.getLibraryAccessBook(bookName);
acmanager.deleteLibraryAccessBook(bookName);
}
catch (CasterException ex) {
}

book = new LibraryAccessBook();
book.setName(bookName);
book.setDescription(bookName);
book.setOwner(user);
libdist.setAccessList(bookName);

// Set into the accesss Book a new AccessElement List with new AccessElements
String [] sendnum = m_request.getParameterValues("IBIB_libsendTo");
j = 0;
if (sendnum != null)
j = sendnum.length;
aList = new AccessElement[j];
for (i = 0; i < j; i++) {
AccessElement aelement = new AccessElement();
aelement.setBurstValue(i + "");
aelement.setMemberType("U");
aelement.setMemberName(sendnum[i]);
aList[i] = aelement;
}
book.setAccessElementList(aList);

try {
acmanager.addLibraryAccessBook(book);
}
catch (CasterException ex) {
return null;
}
}
else {
try {
book = acmanager.getLibraryAccessBook(libdist.getAccessList());
}
catch (CasterException ex) {
return null;
}

j = 0;
aList = book.getAccessElementList();
if (aList != null)
j = aList.length;
for (i=0; i fillItem("IBIB_libsendTo", aList[i].getMemberName(), aList[i].getMemberName());
}
}

return book;
}

// Retrieve the value of often
public int getOften (TimeInfoMinute timeInfo, boolean isNew)
{
if (isNew) {
return (getOften());
}

return timeInfo.getFrequency();
}

// Retrieve the value of often
public int getOften (TimeInfoMonth timeInfo, boolean isNew)
{
if (isNew) {
return (getOften());
}

return timeInfo.getFrequency();
}

// Retrieve the value of often
public int getOften (TimeInfoDay timeInfo, boolean isNew)
{
if (isNew) {
return (getOften());
}

return timeInfo.getFrequency();
}

// Retrieve the value of often
public int getOften ()
{
String frequency = m_request.getParameter("IBIB_often");
java.lang.Integer tfrequency = new java.lang.Integer(frequency);
int ifrequency = tfrequency.intValue();

return (ifrequency);
}

// Fill the task with general info
public void fillTask (TaskWFServerProcedure task)
{
String fex, format, domain, folder;

fex = m_request.getParameter("IBIB_fex");
format = m_request.getParameter("IBIB_format");
task.setProcedureName(fex);
task.setSendFormat(format);
task.setDescription("task1");
task.setReportName("ereport");

task.setExecId(user);
task.setExecPassword(password);

task.setParameterList(getFexParms());

}

// Fill often
public void fillOften (TimeInfoMinute tm, boolean isNew)
{
tm.setFrequency(getOften (tm, isNew));
}

// Fill often
public void fillOften (TimeInfoMonth tm, boolean isNew)
{
tm.setFrequency(getOften (tm, isNew));
}

// Fill often
public void fillOften (TimeInfoDay tm, boolean isNew)
{
tm.setFrequency(getOften (tm, isNew));
}

// Fill in date
public void fillDate (TimeInfo tm, boolean isNew)
{
GregorianCalendar cDateTime = null;
if (isNew)
cDateTime = createDate ("IBIB_startdate", "IBIB_starttime");
else
cDateTime = (GregorianCalendar) schedule.getTimeInfo().getStartTime();

tm.setStartTime(cDateTime);
}

// Tell it to fill an item
public void fillItem(String obj, String item, String value)
{
out.println("doFill(\"" + obj + "\",\"" + item + "\", \"" + value + "\");");
}

// Tell it to fill an item
public void fillItem(String obj, String item, String value, boolean var)
{
out.println("doFill(\"" + obj + "\",\"" + item + "\", " + value + ");");
}

// Fill in the days
public void fillDays(TimeInfoMinute tm)
{
if (tm.isMonday())
fillItem("IBIB_weekdays_1", "", "true");
if (tm.isTuesday())
fillItem("IBIB_weekdays_2", "", "true");
if (tm.isWednesday())
fillItem("IBIB_weekdays_3", "", "true");
if (tm.isThursday())
fillItem("IBIB_weekdays_4", "", "true");
if (tm.isFriday())
fillItem("IBIB_weekdays_5", "", "true");
if (tm.isSaturday())
fillItem("IBIB_weekdays_6", "", "true");
if (tm.isSunday())
fillItem("IBIB_weekdays_7", "", "true");
}

}


Prod WF 8.1.04, QA WF 8.2.03, Dev WF 8.2.03
 
Posts: 278 | Registered: October 10, 2006Report This Post
Silver Member
posted Hide Post
Thanks a lot Fernando... Will try this out and let you know
 
Posts: 31 | Registered: October 26, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     ReportCaster API to edit a Schedule

Copyright © 1996-2020 Information Builders