Package java.io

Examples of java.io.PrintWriter


   * @return
   */
  public String getCommandDescriptions()
  {
    StringWriter sw = new StringWriter();
    PrintWriter out = new PrintWriter(sw);
    for (Iterator iter = iterator(); iter.hasNext();) {
      IConsoleCommand cmd = (IConsoleCommand) iter.next();
      out.println(cmd.getCommandDescriptions());
    }
    return sw.toString();
  }
View Full Code Here


    public Start(String args[]) {
//      if(args.length == 0)
//        return;

      Socket sck = null;
      PrintWriter pw = null;
      try {         
        System.out.println("StartSocket: passing startup args to already-running Azureus java process.");
       
        sck = new Socket("127.0.0.1", 6880);
       
        pw = new PrintWriter(new OutputStreamWriter(sck.getOutputStream(),"UTF8"));
       
        StringBuffer buffer = new StringBuffer("Azureus Start Server Access;args;");
       
        for(int i = 0 ; i < args.length ; i++) {
          String arg = args[i].replaceAll("&","&&").replaceAll(";","&;");
          buffer.append(arg);
          buffer.append(';');
        }
      
        pw.println(buffer.toString());
        pw.flush();
      } catch(Exception e) {
        Debug.printStackTrace( e );
      } finally {
        try {
          if (pw != null)
            pw.close();
        } catch (Exception e) {
        }
        try {
          if (sck != null)
            sck.close();
View Full Code Here

   * @see org.gudy.azureus2.ui.console.commands.IConsoleCommand#printHelp(java.io.PrintStream, java.util.List)
   */
  public void printHelpExtra(PrintStream out, List args)
  {
    HelpFormatter formatter = new HelpFormatter();
    PrintWriter writer = new PrintWriter(out);
    writer.println("> -----");
    writer.println(getCommandDescriptions());
//    formatter.printHelp(writer, 80, getCommandDescriptions(), ">>>", getOptions(), 4, 4, ">>>", true);
    formatter.printOptions(writer, 80, getOptions(), 4, 4);
    writer.println("> -----");
    writer.flush();
  }
View Full Code Here

          new AEThread2("GenerateNetDiag", true)
          {
            public void run() {
              StringWriter sw = new StringWriter();
             
              PrintWriter  pw = new PrintWriter( sw );
                 
              IndentWriter iw = new IndentWriter( pw );
             
              NetworkAdmin admin = NetworkAdmin.getSingleton();
             
              admin.generateDiagnostics( iw );
             
              pw.close();
             
              final String  info = sw.toString();
             
              Logger.log( new LogEvent(LOGID, "Network Info:\n" + info));

              Utils.execSWTThread(
                new Runnable()
                {
                  public void
                  run()
                  {
                    ClipboardCopy.copyToClipBoard( info );
                  }
                });
            }
          }.start();
        }
      });
   
  // stats
 
  Label generate_stats_info = new Label(gLogging, SWT.NULL);
  Messages.setLanguageText(generate_stats_info, CFG_PREFIX + "statsinfo");

  Button generate_stats_button = new Button(gLogging, SWT.PUSH);
  Messages.setLanguageText(generate_stats_button, CFG_PREFIX + "generatediagnostics");

 
  generate_stats_button.addListener(
      SWT.Selection,
      new Listener()
      {
        public void
        handleEvent(Event event)
        {
          java.util.Set  types = new HashSet();
         
          types.add( AzureusCoreStats.ST_ALL );
         
          Map  reply = AzureusCoreStats.getStats( types );
         
          Iterator  it = reply.entrySet().iterator();
         
          StringBuffer buffer = new StringBuffer(16000);
         
          while( it.hasNext()){
           
            Map.Entry  entry = (Map.Entry)it.next();
           
            buffer.append( entry.getKey() + " -> " + entry.getValue() + "\r\n" );
          }
         
          String  str = buffer.toString();
         
          ClipboardCopy.copyToClipBoard( str );

          Logger.log( new LogEvent(LOGID, "Stats Info:\n" + str));
        }
      });

        // diagnostics

   
  Label generate_info = new Label(gLogging, SWT.NULL);

  Messages.setLanguageText(generate_info, CFG_PREFIX + "generatediagnostics.info");

  Button generate_button = new Button(gLogging, SWT.PUSH);

  Messages.setLanguageText(generate_button, CFG_PREFIX + "generatediagnostics");

  generate_button.addListener(
      SWT.Selection,
      new Listener()
      {
        public void
        handleEvent(Event event)
        {
          StringWriter sw = new StringWriter();
         
          PrintWriter  pw = new PrintWriter( sw );
         
          AEDiagnostics.generateEvidence( pw );
         
          pw.close();
         
          String  evidence = sw.toString();
         
          ClipboardCopy.copyToClipBoard( evidence );
View Full Code Here

    }

    protected void process(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        resp.setCharacterEncoding("UTF-8");
        resp.setContentType("text/html");
        PrintWriter out = resp.getWriter();
        String queryPath = req.getServletPath();
        final CachedQuery loaded;
        try {
            loaded = loadQuery(queryPath);
        } catch (XQueryException e) {
View Full Code Here

        return result;
    }
   
    public static String getStackTrace( final Throwable t ) {
        final ByteArrayOutputStream bas = new ByteArrayOutputStream();
        final PrintWriter pw = new PrintWriter(bas);
        t.printStackTrace(pw);
        pw.close();
        return bas.toString();
    }
View Full Code Here

            this.annotations = new ArrayList<Annotation>();
        }
       
        if(this.recordDebug) {
            this.stringWriter = new StringWriter();
            this.debugWriter = new PrintWriter(this.stringWriter);
        }
    }
View Full Code Here

    String dataSource = Settings.getInstance().getSiteInfo(
        CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();

    // we print directly to the browser, so we need to set the content type
    response.setContentType("text/plain");
    PrintWriter writer = response.getWriter();
    String myOutput = new String();

    ActivityEditHandler requestForm = (ActivityEditHandler)form;

    String sessionID = requestForm.getSessionID();
    HttpSession session = request.getSession();
    UserObject userobjectd = (UserObject)session.getAttribute("userobject");
    UserPrefererences userPrefs = userobjectd.getUserPref();
    TimeZone tz = TimeZone.getTimeZone(userPrefs.getTimeZone());
    Locale locale = request.getLocale();
    int individualID = userobjectd.getIndividualID();
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    // date format for writing to the form should be in the format based on
    // locale
    DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
    DateFormat tf = DateFormat.getTimeInstance(DateFormat.SHORT, locale);

    int activitytype = 0;

    int activityid = Integer.parseInt(requestForm.getActivityID());
    String result = "";

    // created session facade to call EJB methods (SyncFacade is a local class,
    // not an EJB!)
    SyncFacade syncfacade = new SyncFacade();
    syncfacade.setDataSource(dataSource);

    // if session is correct
    if (userobjectd.getSessionID().equals(sessionID)) {
      // A cheap way to check for NullPointerExceptions.
      try {
        ActivityForm activityForm = new ActivityForm();
        activityForm.setLocale(locale);
        activityForm.setActivityID(Integer.toString(activityid));

        String detailpriority = requestForm.getPriority();
        String detailstatus = requestForm.getStatus();

        if (detailstatus == null) {
          detailstatus = "1";
        }

        if (detailstatus != null && !detailstatus.equals("")) {
          if (detailstatus.equals("Pending")) {
            detailstatus = "1";
          } else if (detailstatus.equals("Completed")) {
            detailstatus = "2";
          }
        }

        String detailtitle = requestForm.getTitle();
        String detaildetail = requestForm.getDescription();

        // call to getting activity details
        ActivityVO vo = null;
        activitytype = syncfacade.getActivityType(activityid);
        vo = syncfacade.getActivity(activityid, individualID);

        ActivityGenericFillVOX agf = new ActivityGenericFillVOX();
        activityForm.setLocale(request.getLocale());
        agf.fillBasicForm(vo, activityForm);

        // if user wants to edit any field , that will not be null , so
        // that field is set to ActivityForm

        if (detailpriority != null) {
          activityForm.setActivityPriority(detailpriority);
        }

        if (detailstatus != null) {
          activityForm.setActivityStatus(detailstatus);
        }

        if (detailtitle != null) {
          activityForm.setActivityTitle(detailtitle);
        }

        if (detaildetail != null) {
          activityForm.setActivityDetail(detaildetail);
        }

        // startdate
        String activitystartdate = requestForm.getStartDateTime();
        Calendar start = new GregorianCalendar(tz, locale);
        if (activitystartdate != null) {
          try {
            Date dd = simpleDateFormat.parse(activitystartdate);
            start.setTime(dd);
          } catch (Exception e) {
            logger.error("[execute]: Exception", e);
          }
        }
        activityForm.setActivityStartDate(df.format(start.getTime()));
        activityForm.setActivityStartTime(tf.format(start.getTime()));

        String activityenddate = requestForm.getEndDateTime();
        Calendar end = new GregorianCalendar(tz, locale);
        if (activityenddate != null) {
          try {
            Date dd = simpleDateFormat.parse(activityenddate);
            end.setTime(dd);
          } catch (Exception e) {
            logger.error("[execute]: Exception", e);
          }
        }
        activityForm.setActivityEndDate(df.format(end.getTime()));
        activityForm.setActivityEndTime(tf.format(end.getTime()));

        // alarm date time
        String alarmDateTime = requestForm.getAlarmDateTime();
        Calendar remind = new GregorianCalendar(tz, locale);
        // if alarmDateTime is not null , so set it to ActivityForm
        if (alarmDateTime != null) {
          try {
            Date d = simpleDateFormat.parse(alarmDateTime);
            remind.setTime(d);
          } catch (Exception e) {
            logger.error("[execute]: Exception", e);
          }
        }
        activityForm.setActivityRemindDate(df.format(remind));
        activityForm.setActivityReminderTime(tf.format(remind));

        activityForm.setActivityType(String.valueOf(activitytype));

        result = syncfacade.updateActivity(activityForm, individualID);

        String recurrenceType = requestForm.getRecurrenceType();

        if (recurrenceType != null && !recurrenceType.equals("")) {
          // This is a recurring activity - update the recurring info
          int every = requestForm.getEvery();
          int recurrOn = requestForm.getOn();
          String recurringStartDateString = requestForm.getStartDateTime();
          String recurringEndDateString = requestForm.getRecurrenceEndDate();

          Date recurringStartDate = null;
          Date recurringEndDate = null;

          try {
            recurringStartDate = simpleDateFormat.parse(recurringStartDateString);
          } catch (Exception dateException) {
            recurringStartDate = null;
          }

          try {
            recurringEndDate = simpleDateFormat.parse(recurringEndDateString);
          } catch (Exception dateException) {
            recurringEndDate = null;
          }

          try {
            SyncFacadeHome syncHome = (SyncFacadeHome)CVUtility.getHomeObject(
                "com.centraview.syncfacade.SyncFacadeHome", "SyncFacade");
            com.centraview.syncfacade.SyncFacade sfremote = syncHome.create();
            sfremote.setDataSource(dataSource);

            boolean updateResult = sfremote.updateRecurringFields(activityid, recurrenceType,
                every, recurrOn, recurringStartDate, recurringEndDate);

            if (updateResult != true) {
              writer.print("FAIL");
              return (null);
            }
          } catch (Exception de) {
            logger.error("[execute]: Exception", de);
          }
        } // end if (recurrenceType != null && ! recurrenceType.equals("")) {

        // finish up! print that data to the client!

        myOutput = myOutput + result;
        // another temporary fix
        if (result.equals("OK")) {
          writer.print(requestForm.getActivityID());
        } else {
          writer.print("FAIL");
        }

      } catch (Exception e) {
        logger.error("[execute]: Exception", e);
        writer.print("FAIL");
      }
    } else {
      logger.error("[execute]: Sync failed because sessionID is not valid");
      writer.print("FAIL");
    }
    // we're not forwarding to a jsp, so return null
    return (null);
  } // end execute()
View Full Code Here

    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();

    // CompanionLink expects plain text, and we're printing
    // directly to STDOUT, so set the content type
    response.setContentType("text/plain");
    PrintWriter writer = response.getWriter();

    HttpSession session = request.getSession();
    UserObject userObject = (UserObject)session.getAttribute("userobject");

    int individualID = userObject.getIndividualID();    // logged in user

    // "activtyListForm" defined in struts-config-sync.xml
    DynaActionForm activityForm = (DynaActionForm)form;

    String sessionID = (String)activityForm.get("sessionID");
    SyncUtils syncUtils = new SyncUtils();

    try
    {
      // check to see if CompanionLink Agent has signed in
      if (syncUtils.checkSession(userObject, activityForm) == false)
      {
        writer.print("FAIL: You are not logged in.");
        return(null);
      }

      // decode all characters that are encoded by CompanionLink Agent
      activityForm = syncUtils.parseSpecialChars(activityForm);

      // get an EJB connection
      SyncFacadeHome syncHome = (SyncFacadeHome)CVUtility.getHomeObject("com.centraview.syncfacade.SyncFacadeHome", "SyncFacade");
      com.centraview.syncfacade.SyncFacade sfremote = (com.centraview.syncfacade.SyncFacade)syncHome.create();
      sfremote.setDataSource(dataSource);

      // get the list of individuals from the ejb layer
      Collection activityList = sfremote.getActivityList(individualID);

      // get the logged-in user's field-level privileges and
      // store for use when printing fields later.
      ModuleFieldRightMatrix rightsMatrix = userObject.getUserPref().getModuleAuthorizationMatrix();
      HashMap fieldRights = rightsMatrix.getFieldRights("Activities");

      // activityList shouldn't be null. If it is, there's a problem
      // SyncFacadeEJB should always return a valid Collection (an
      // empty Collection is still a valid Collection, but null is not)
      if (activityList != null)
      {
        // print the header row, even if there are not results returned...
        StringBuffer headers = new StringBuffer();
        headers.append("activityID\t");
        headers.append("type\t");
        headers.append("title\t");
        headers.append("lastModified\t");
        headers.append("dueDate\t");
        headers.append("priority\t");
        headers.append("status\t");
        headers.append("createdBy\t");
        headers.append("startDateTime\t");
        headers.append("endDateTime\t");
        headers.append("description\t");
        headers.append("private\t");
        headers.append("recurrenceStartDate\t");
        headers.append("recurrenceEndDate\t");
        headers.append("recurrenceType\t");
        headers.append("every\t");
        headers.append("on\t");
        headers.append("alarmDateTime\t");
        headers.append("LinkCompany\t");
        headers.append("LinkContact");

        writer.print(headers.toString() + "\n");

        // we successfully got the Activities list, let's process it :-)
        if (activityList.size() > 0)
        {
          Iterator it = activityList.iterator();
         
          while (it.hasNext())
          {
            HashMap activityDetails = (HashMap)it.next();
           
            String activityType = (String)activityDetails.get("activityType");
            if (activityType != null && (activityType.equals("Forecast Sale") || activityType.equals("Task") || activityType.equals("Literature Request")))
            {
              // We do not send Opportunity, Task, or Literture Request
              // records to CompanionLink, so skip this iteration of the
              // while loop.
              continue;
            }

            // This hashmap will temporarily hold all field values until
            // we are ready to print them out. It will be helpful to us
            // when we need to encode special characters.
            HashMap record = new HashMap();
           
            // activityID
            int activityID = ((Number)activityDetails.get("activityID")).intValue();
            record.put("activityID", String.valueOf(activityID));

            // type
            record.put("type", activityType);
           
            // First check field rights privileges (of certain fields),
            // if user has sufficient privilege, print field, if user
            // does not have sufficient privilege, print a "-".
           
            // ***IMPORTANT!!*** If the user does not have privilege to
            // a given field, CompanionLink expects a "-". Sending a null
            // or blank string will cause CompanionLink to believe this
            // is the CONTENT of the field, and will update the record
            // with that information. It is extremely important to make
            // sure this is done properly.

            // ***IMPORTANT!!*** It is also extremely important to note
            // that we can never set any field to the java NULL value. This
            // will cause "null" to be printed out to the CompanionLink
            // client, in which case CompanionLink will evaluate the String
            // "null" as the content of the field. Therefore, ALWAYS CHECK
            // FOR NULL VALUES BEFORE PRINTING!!! (or adding to our temp
            // HashMap)...
           
            // Title
            if (((Integer)fieldRights.get("title")).intValue() < ModuleFieldRightMatrix.NONE_RIGHT)
            {
              // user has privilege to View this field (or greater)
              String title = (String)activityDetails.get("title");
              record.put("title", (title != null) ? title : "");
            }else{
              // user has None privilege to this field
              record.put("title", "-");
            }
           
            // lastModified
            record.put("lastModified", syncUtils.formatDate((Timestamp)activityDetails.get("lastModified")));

            // dueDate
            record.put("dueDate", syncUtils.formatDate((Timestamp)activityDetails.get("dueDate")));
           
            // Priority
            if (((Integer)fieldRights.get("priority")).intValue() < ModuleFieldRightMatrix.NONE_RIGHT)
            {
              String priority = (String)activityDetails.get("priority");
              record.put("priority", (priority != null) ? priority : "");
            }else{
              record.put("priority", "-");
            }
           
            // Status
            if (((Integer)fieldRights.get("status")).intValue() < ModuleFieldRightMatrix.NONE_RIGHT)
            {
              String status = (String)activityDetails.get("status");
              record.put("status", (status != null) ? status : "");
            }else{
              record.put("status", "-");
            }

            // CreatedBy
            if (((Integer)fieldRights.get("creator")).intValue() < ModuleFieldRightMatrix.NONE_RIGHT)
            {
              String createdBy = (String)activityDetails.get("createdBy");
              record.put("createdBy", (createdBy != null) ? createdBy : "");
            }else{
              record.put("createdBy", "-");
            }
           
            // startDateTime
            if (((Integer)fieldRights.get("start")).intValue() < ModuleFieldRightMatrix.NONE_RIGHT)
            {
              record.put("startDateTime", syncUtils.formatDate((Timestamp)activityDetails.get("startDateTime")));
            }else{
              record.put("startDateTime", "-");
            }


            // endDateTime
            if (((Integer)fieldRights.get("end")).intValue() < ModuleFieldRightMatrix.NONE_RIGHT)
            {
              record.put("endDateTime", syncUtils.formatDate((Timestamp)activityDetails.get("endDateTime")));
            }else{
              record.put("endDateTime", "-");
            }
           
            // description
            if (((Integer)fieldRights.get("details")).intValue() < ModuleFieldRightMatrix.NONE_RIGHT)
            {
              String description = (String)activityDetails.get("description");
              record.put("description", (description != null) ? description : "");
            }else{
              record.put("description", "-");
            }
           
            // private
            if (((Integer)fieldRights.get("visibility")).intValue() < ModuleFieldRightMatrix.NONE_RIGHT)
            {
              String privateStatus = (String)activityDetails.get("private");
              if (privateStatus != null && privateStatus.equals("PRIVATE"))
              {
                record.put("private", "Yes");
              }else{
                record.put("private", "No");
              }
            }else{
              record.put("private", "-");
            }
           
            // recurrenceStartDate
            java.sql.Date recurrStartDate = (java.sql.Date)activityDetails.get("recurrenceStartDate");
            if (recurrStartDate != null)
            {
              Timestamp recurrStartTimestamp = new Timestamp(recurrStartDate.getTime());
              record.put("recurrenceStartDate", syncUtils.formatDate(recurrStartTimestamp));
            }else{
              record.put("recurrenceStartDate", "");
            }

            // recurrenceEndDate
            java.sql.Date recurrEndDate = (java.sql.Date)activityDetails.get("recurrenceEndDate");
            if (recurrEndDate != null)
            {
              Timestamp recurrEndTimestamp = new Timestamp(recurrEndDate.getTime());
              record.put("recurrenceEndDate", syncUtils.formatDate(recurrEndTimestamp));
            }else{
              record.put("recurrenceEndDate", "");
            }
           
            // recurrenceType
            String recurrenceType = (String)activityDetails.get("recurrenceType");
            record.put("recurrenceType", (recurrenceType != null) ? recurrenceType : "");

            // every
            Number every = (Number)activityDetails.get("every");
            if (every != null)
            {
              record.put("every", every.toString());
            }else{
              record.put("every", "");
            }

            // on
            Number on = (Number)activityDetails.get("recurrOn");
            if (on != null)
            {
              record.put("on", on.toString());
            }else{
              record.put("on", "");
            }
           
            // alarmDateTime
            record.put("alarmDateTime", syncUtils.formatDate((Timestamp)activityDetails.get("alarmDateTime")));
           
            // linkCompany
            String linkCompany = (String)activityDetails.get("linkCompany");
            record.put("LinkCompany", (linkCompany != null) ? linkCompany : "");

            // linkContact
            String linkContact = (String)activityDetails.get("linkContact");
            record.put("LinkContact", (linkContact != null) ? linkContact : "");


            // now encode all strings in the record properly
            record = syncUtils.encodeRecord(record);

            // time to print out the record and move on
            // DO NOT CHANGE THE ORDER OF THESE FIELDS!
            // NOTE that we did not add the "\t" delimiter
            // to each field, but instead we're adding it here
            // as we print out each field. That is because we
            // encode the "record" HashMap as a whole, and part
            // of that encoding encodes tabs into a non-printable
            // character. If we had added the tab to our fields,
            // then we would lose our field delimiter...
            writer.print(record.get("activityID") + "\t");
            writer.print(record.get("type") + "\t");
            writer.print(record.get("title") + "\t");
            writer.print(record.get("lastModified") + "\t");
            writer.print(record.get("dueDate") + "\t");
            writer.print(record.get("priority") + "\t");
            writer.print(record.get("status") + "\t");
            writer.print(record.get("createdBy") + "\t");
            writer.print(record.get("startDateTime") + "\t");
            writer.print(record.get("endDateTime") + "\t");
            writer.print(record.get("description") + "\t");
            writer.print(record.get("private") + "\t");
            writer.print(record.get("recurrenceStartDate") + "\t");
            writer.print(record.get("recurrenceEndDate") + "\t");
            writer.print(record.get("recurrenceType") + "\t");
            writer.print(record.get("every") + "\t");
            writer.print(record.get("on") + "\t");
            writer.print(record.get("alarmDateTime") + "\t");
            writer.print(record.get("LinkCompany") + "\t");
            writer.print(record.get("LinkContact") + "\n")// NOTE THE NEWLINE HERE!!!
          }   // end while(it.hasNext()) (activityList)
        }
      }else{
        // activity list was null. Something must have gone wrong.
        writer.print("FAIL: An unknown error occurred.");
        return(null);
      }
    }catch(Exception e){
      System.out.println("[Exception][Sync][ActivityList] Exception thrown in execute(): " + e);
      // TODO: remove stack trace
View Full Code Here

  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
  {
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();

    response.setContentType("text/plain");
    PrintWriter writer = response.getWriter();

    HttpSession session = request.getSession();
    UserObject userObject = (UserObject)session.getAttribute("userobject");

    int individualID = userObject.getIndividualID();    // logged in user

    // "sycnContactForm", defined in struts-config-sync.xml
    DynaActionForm contactForm = (DynaActionForm)form;
    SyncUtils syncUtils = new SyncUtils();

    try
    {
      // check to see if CompanionLink Agent has signed in
      if (syncUtils.checkSession(userObject, contactForm) == false)
      {
        writer.print("FAIL: You are not logged in.");
        return(null);
      }
     
      // decode all characters that are encoded by CompanionLink Agent
      contactForm = syncUtils.parseSpecialChars(contactForm);

      int contactID = 0;
      String formContactID = (String)contactForm.get("contactID");
      if (formContactID != null && ! formContactID.equals(""))
      {
        try
        {
          contactID = Integer.parseInt(formContactID);
        }catch(NumberFormatException nfe){
          writer.print("FAIL: Invalid contact ID specified.");
          return(null);
        }
      }else{
        writer.print("FAIL: Invalid contact ID specified.");
        return(null);
      }

      try
      {
        // check to see if the user has the right to update this record
        AuthorizationHome authHome = (AuthorizationHome)CVUtility.getHomeObject("com.centraview.administration.authorization.AuthorizationHome", "Authorization");
        Authorization authRemote = (Authorization)authHome.create();
       
        if (! authRemote.canPerformRecordOperation(individualID, "Individual", contactID, 10))
        {
          writer.print("FAIL: You do not have permission to delete this record.");
          return(null);
        }
      }catch(Exception e){
        System.out.println("[Exception][SyncFacade] Exception thrown in deleteContact(): " + e);
        writer.print("FAIL: Unknown error occurred.");
        return(null);
      }

      ContactFacadeHome cfh = (ContactFacadeHome)CVUtility.getHomeObject("com.centraview.contact.contactfacade.ContactFacadeHome","ContactFacade");
      ContactFacade remote = (ContactFacade)cfh.create();
      remote.setDataSource(dataSource);

      // deleteIndividual() returns void
      // I guess, if no exception is thrown, then everything is good
      remote.deleteIndividual(contactID, individualID);
     
      ListGenerator lg = ListGenerator.getListGenerator(dataSource);
      lg.makeListDirty("Individual");

      writer.print(contactID);
    }catch(Exception e){
      writer.print("FAIL");
      return(null);
    }

    // we're not forwarding to a jsp, so return null
    return(null);
View Full Code Here

TOP

Related Classes of java.io.PrintWriter

Copyright © 2015 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.