private UserBusiness getUserBusiness(IWApplicationContext iwac) {
   try {
     return (UserBusiness) IBOLookup.getServiceInstance(iwac, UserBusiness.class);
   } catch (IBOLookupException ile) {
     throw new IBORuntimeException(ile);
   }
 }
 private CourseBusiness getCourseBusiness() {
   try {
     return (CourseBusiness)
         IBOLookup.getServiceInstance(getIWApplicationContext(), CourseBusiness.class);
   } catch (IBOLookupException ile) {
     throw new IBORuntimeException(ile);
   }
 }
 /* (non-Javadoc)
  * @see se.idega.idegaweb.commune.school.business.SchoolCaseBusiness#caseIsOpen(com.idega.block.process.data.Case, com.idega.presentation.IWContext)
  */
 public boolean caseIsOpen(Case useCase, IWContext iwc)
     throws RemoteException, IBOLookupException, FinderException {
   AdultEducationBusiness adultSchBuiz;
   adultSchBuiz =
       (AdultEducationBusiness) IBOLookup.getServiceInstance(iwc, AdultEducationBusiness.class);
   AdultEducationChoice adultChoice = adultSchBuiz.getChoice(useCase.getPrimaryKey());
   return (adultChoice != null && !adultChoice.isPlacementMessageSent());
 }
 /**
  * Method getChildCareBusiness returns the ChildCareBusiness object.
  *
  * @param iwc
  * @return ChildCareBusiness
  */
 ChildCareBusiness getChildCareBusiness(IWContext iwc) {
   try {
     return (ChildCareBusiness)
         com.idega.business.IBOLookup.getServiceInstance(iwc, ChildCareBusiness.class);
   } catch (RemoteException e) {
     return null;
   }
 }
 private QueryService getQueryService(IWContext iwc) {
   try {
     return (QueryService)
         IBOLookup.getServiceInstance(iwc.getApplicationContext(), QueryService.class);
   } catch (RemoteException ex) {
     throw new RuntimeException("[QueryUploader]: Can't retrieve QueryService");
   }
 }
 private SchoolUserBusiness getSchoolUserBusiness(IWContext iwc) {
   try {
     return (SchoolUserBusiness) IBOLookup.getServiceInstance(iwc, SchoolUserBusiness.class);
   } catch (IBOLookupException ex) {
     ex.printStackTrace();
   }
   return null;
 }
 private SchoolUserBusiness getSchoolUserBusiness() {
   try {
     return (SchoolUserBusiness)
         IBOLookup.getServiceInstance(this.getIWApplicationContext(), SchoolUserBusiness.class);
   } catch (IBOLookupException ile) {
     throw new IBORuntimeException(ile);
   }
 }
 private RunBusiness getRunBiz(IWContext iwc) {
   RunBusiness business = null;
   try {
     business = (RunBusiness) IBOLookup.getServiceInstance(iwc, RunBusiness.class);
   } catch (IBOLookupException e) {
     business = null;
   }
   return business;
 }
 protected CommuneBusiness getCommuneBusiness(IWContext iwc) {
   try {
     return (CommuneBusiness) IBOLookup.getServiceInstance(iwc, CommuneBusiness.class);
   } catch (RemoteException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return null;
 }
Пример #10
0
  public void main(IWContext iwc) throws Exception {
    _iwc = iwc;

    userID = iwc.getUserId();

    if (userID > 0) {
      user = ((UserBusiness) IBOLookup.getServiceInstance(iwc, UserBusiness.class)).getUser(userID);
    }
    add(getDoctorForm());
  }
  public Collection<SearchResult> getArticleSearchResults(
      String folder, List<String> categories, IWContext iwc) {
    if (folder == null) {
      return null;
    }
    if (iwc == null) {
      iwc = IWContext.getInstance();
      if (iwc == null) {
        return null;
      }
    }

    IWTimestamp oldest = null;

    if (this.numberOfDaysDisplayed > 0) {
      oldest = IWTimestamp.RightNow();
      oldest.addDays(-this.numberOfDaysDisplayed);
    }

    IWSlideSession session = null;
    try {
      session = (IWSlideSession) IBOLookup.getSessionInstance(iwc, IWSlideSession.class);
    } catch (IBOLookupException e) {
      e.printStackTrace();
      return null;
    }
    String webDavUri = null;
    try {
      webDavUri = session.getWebdavServerURI();
    } catch (RemoteException e) {
      e.printStackTrace();
    }
    if (webDavUri != null) {
      if (folder.startsWith(webDavUri)) {
        folder = folder.substring(webDavUri.length());
      }
      if (folder.startsWith(CoreConstants.SLASH)) {
        folder = folder.substring(1);
      }
    }
    SearchRequest articleSearch = null;
    try {
      articleSearch = getSearchRequest(folder, iwc.getCurrentLocale(), oldest, categories);
    } catch (SearchException e) {
      e.printStackTrace();
      return null;
    }
    ContentSearch searchBusiness = new ContentSearch(iwc.getIWMainApplication());
    searchBusiness.setToUseRootAccessForSearch(true);
    searchBusiness.setToUseDescendingOrder(true);
    Search search = searchBusiness.createSearch(articleSearch);
    return search.getSearchResults();
  }
 public ClubInformationPluginBusiness getClubInformationPluginBusiness(IWApplicationContext iwc) {
   ClubInformationPluginBusiness business = null;
   try {
     business =
         (ClubInformationPluginBusiness)
             com.idega.business.IBOLookup.getServiceInstance(
                 iwc, ClubInformationPluginBusiness.class);
   } catch (java.rmi.RemoteException rme) {
     throw new RuntimeException(rme.getMessage());
   }
   return business;
 }
 public boolean validateTicket(java.lang.String in0, java.lang.String in1)
     throws java.rmi.RemoteException {
   try {
     WSTicketBusiness bus1 =
         (WSTicketBusiness)
             IBOLookup.getServiceInstance(
                 IWMainApplication.getDefaultIWApplicationContext(), WSTicketBusiness.class);
     return bus1.validateTicket(in0, in1);
   } catch (Exception ex) {
     ex.printStackTrace();
     return false;
   }
 }
Пример #14
0
 @SuppressWarnings("unchecked")
 protected <T extends IBOSession> T getSessionInstance(
     IWUserContext iwuc, Class<? extends IBOSession> sessionBeanClass) {
   try {
     return (T)
         IBOLookup.getSessionInstance(
             iwuc,
             sessionBeanClass); //	Casting is needed to avoid stupid compilation error in Maven 2
   } catch (Exception e) {
     LOGGER.log(Level.WARNING, "Error getting session instance: " + sessionBeanClass);
   }
   return null;
 }
Пример #15
0
 private UserBusiness getUserBusiness() {
   try {
     if (userBusiness == null) {
       this.userBusiness =
           IBOLookup.getServiceInstance(
               iwc == null ? CoreUtil.getIWContext() : iwc, UserBusiness.class);
     }
   } catch (IBOLookupException e) {
     Logger.getLogger("ContentShareComponent")
         .log(Level.WARNING, "Failed getting UserBusiness", e);
   }
   return userBusiness;
 }
 private void parseAction(IWContext iwc)
     throws NumberFormatException, IDOStoreException, IOException, RemoteException,
         FinderException {
   if (iwc.isParameterSet(ReportQueryBuilder.PARAM_LAYOUT_FOLDER_ID)) {
     this.layoutFolderId = iwc.getParameter(ReportQueryBuilder.PARAM_LAYOUT_FOLDER_ID);
   } else {
     return;
   }
   if (iwc.isParameterSet(KEY_QUERY_UPLOAD_IS_SUBMITTED)) {
     Object queryToBeReplacedId = iwc.getParameter(KEY_CHOSEN_QUERY_FOR_REPLACING);
     if (VALUE_DO_NOT_REPLACE_A_QUERY.equals(queryToBeReplacedId)) {
       queryToBeReplacedId = null;
     } else {
       queryToBeReplacedId = new Integer((String) queryToBeReplacedId);
     }
     UploadFile uploadFile = iwc.getUploadedFile();
     ICFile icFile = MediaBusiness.saveMediaToDBUploadFolder(uploadFile, iwc);
     String name = iwc.getParameter(KEY_QUERY_NAME);
     String permission = iwc.getParameter(KEY_PERMISSION);
     boolean isPrivate = PRIVATE.equals(permission);
     QueryService queryService =
         (QueryService) IBOLookup.getServiceInstance(iwc, QueryService.class);
     UserQuery userQuery =
         queryService.storeQuery(name, icFile, isPrivate, queryToBeReplacedId, iwc);
     this.userQueryId = ((Integer) userQuery.getPrimaryKey()).intValue();
   } else if (iwc.isParameterSet(KEY_QUERY_DOWNLOAD_IS_SUBMITTED)) {
     Object queryToBeDownloadedId = iwc.getParameter(KEY_CHOSEN_QUERY_FOR_DOWNLOADING);
     if (!VALUE_DO_NOT_REPLACE_A_QUERY.equals(queryToBeDownloadedId)) {
       Integer queryToBeDownloaded = new Integer((String) queryToBeDownloadedId);
       UserQueryHome userQueryHome = (UserQueryHome) IDOLookup.getHome(UserQuery.class);
       UserQuery userQuery = userQueryHome.findByPrimaryKey(queryToBeDownloaded);
       ICFile realQuery = userQuery.getSource();
       FileBusiness fileBusiness =
           (FileBusiness) IBOLookup.getServiceInstance(iwc, FileBusiness.class);
       this.downloadUrl = fileBusiness.getURLForOfferingDownload(realQuery, iwc);
     }
   }
 }
 public void reset() {
   getChildren().clear();
   setInitialized(false);
   IWContext iwc = IWContext.getInstance();
   try {
     WebDAVMetadataResource resource =
         (WebDAVMetadataResource) IBOLookup.getSessionInstance(iwc, WebDAVMetadataResource.class);
     resource.clear();
   } catch (IBOLookupException e) {
     throw new RuntimeException(e);
   } catch (RemoteException e) {
     throw new RuntimeException(e);
   }
 }
Пример #18
0
 @SuppressWarnings("unchecked")
 protected <T extends IBOService> T getServiceInstance(
     IWApplicationContext iwac, Class<? extends IBOService> serviceBeanClass) {
   try {
     //	Casting is needed to avoid stupid compilation error in Maven 2
     return (T)
         IBOLookup.getServiceInstance(
             iwac == null ? IWMainApplication.getDefaultIWApplicationContext() : iwac,
             serviceBeanClass);
   } catch (Exception e) {
     LOGGER.log(Level.WARNING, "Error getting service instance: " + serviceBeanClass);
   }
   return null;
 }
  private String getFeed(
      String title, String feedFileName, Collection entries, RSSRequest rssRequest, IWContext iwc) {
    if (rssFileURIsCacheList.contains(feedFileName))
      return PATH_TO_FEED_PARENT_FOLDER + feedFileName;
    Date now = new Date();
    RSSBusiness rss = null;
    try {
      rss = IBOLookup.getServiceInstance(iwc, RSSBusiness.class);
    } catch (IBOLookupException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    }
    String serverName = iwc.getServerURL();
    serverName = serverName.substring(0, serverName.length() - 1);
    SyndFeed feed = null;

    feed =
        rss.createNewFeed(
            title,
            serverName,
            FEED_DESCRIPTION,
            "atom_1.0",
            iwc.getCurrentLocale().toString(),
            new Timestamp(now.getTime()));

    if (entries != null) feed.setEntries(getFeedEntries(entries));

    try {
      String feedContent = rss.convertFeedToAtomXMLString(feed);
      IWSlideService service = this.getIWSlideService(rssRequest);
      service.uploadFileAndCreateFoldersFromStringAsRoot(
          PATH_TO_FEED_PARENT_FOLDER,
          feedFileName,
          feedContent,
          RSSAbstractProducer.RSS_CONTENT_TYPE,
          true);
      rssFileURIsCacheList.add(feedFileName);
    } catch (RemoteException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }
    return PATH_TO_FEED_PARENT_FOLDER + feedFileName;
  }
 /**
  * Gets the set categories, either from the resourcePath property or the setCategories property
  *
  * @return
  */
 private Collection<String> getSetCategoriesList() {
   if (this.resourcePath != null) {
     IWContext iwuc = IWContext.getInstance();
     try {
       WebDAVMetadataResource resource =
           (WebDAVMetadataResource)
               IBOLookup.getSessionInstance(iwuc, WebDAVMetadataResource.class);
       return resource.getCategories(this.resourcePath);
     } catch (IBOLookupException e) {
       throw new RuntimeException(e);
     } catch (IOException e) {
       throw new RuntimeException(e);
     }
   } else if (this.setCategories != null) {
     return CategoryBean.getCategoriesFromString(this.setCategories);
   }
   return null;
 }
  public void saveCategoriesSettings() {
    if (this.resourcePath == null) {
      throw new RuntimeException("resourcePath is null");
    }

    IWContext iwc = CoreUtil.getIWContext();

    //	Save the selection of categories to the article
    String categories = getEnabledCategories(iwc);

    try {
      WebDAVMetadataResource resource =
          (WebDAVMetadataResource) IBOLookup.getSessionInstance(iwc, WebDAVMetadataResource.class);
      resource.setCategories(resourcePath, categories.toString(), getSetCategoriesOnParent());
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
  public void main(IWContext iwc) throws Exception {
    _iwc = iwc;

    userID = iwc.getUserId();

    if (userID > 0) {
      user = ((UserBusiness) IBOLookup.getServiceInstance(iwc, UserBusiness.class)).getUser(userID);
    }

    imageCircleD = getBundle(iwc).getImage("circleDown.gif");
    imageCircleU = getBundle(iwc).getImage("circleUp.gif");
    imageBgVert = getBundle(iwc).getImage("bgbeigeVert.gif");
    imageBgVertOut = getBundle(iwc).getImage("bgbeigeVert1.gif");

    //	add(getOverviewForm(iwc));
    if (user != null && user.getDateOfBirth() != null) age = new Age(user.getDateOfBirth());
    else if (user != null && user.getPersonalID() != null)
      age = new Age(PIDChecker.getInstance().getDateFromPersonalID(user.getPersonalID()));

    add(getOverviewForm());
  }
 private AddressBusiness getAddressBusiness(IWApplicationContext iwc) throws RemoteException {
   return (AddressBusiness) IBOLookup.getServiceInstance(iwc, AddressBusiness.class);
 }
 private CommuneUserBusiness getCommuneUserBusiness(IWContext iwc) throws RemoteException {
   return (CommuneUserBusiness)
       com.idega.business.IBOLookup.getServiceInstance(iwc, CommuneUserBusiness.class);
 }
 private FamilyLogic getMemberFamilyLogic(IWContext iwc) throws RemoteException {
   return (FamilyLogic) com.idega.business.IBOLookup.getServiceInstance(iwc, FamilyLogic.class);
 }
 private SchoolCommuneBusiness getSchoolCommuneBusiness(IWContext iwc) throws RemoteException {
   return (SchoolCommuneBusiness) IBOLookup.getServiceInstance(iwc, SchoolCommuneBusiness.class);
 }
 protected CommuneUserBusiness getUserBusiness(IWApplicationContext iwc)
     throws IBOLookupException {
   return (CommuneUserBusiness) IBOLookup.getServiceInstance(iwc, CommuneUserBusiness.class);
 }
 private SchoolChoiceBusiness getSchoolChoiceBusiness(IWApplicationContext iwac)
     throws RemoteException {
   return (SchoolChoiceBusiness) IBOLookup.getServiceInstance(iwac, SchoolChoiceBusiness.class);
 }
Пример #29
0
  // public PresentationObject getVisitForm(IWContext iwc, User userVK) throws
  // java.rmi.RemoteException {
  public UIComponent getDoctorForm() {
    IWResourceBundle iwrb = this.getResourceBundle(_iwc);
    Form myForm = new Form();
    myForm.setName(prmForm);

    Table table = new Table(3, 3);
    table.setCellpadding(0);
    table.setCellspacing(0);
    table.setBorder(0);
    table.setVerticalAlignment(1, 1, Table.VERTICAL_ALIGN_TOP);
    table.setVerticalAlignment(3, 1, Table.VERTICAL_ALIGN_TOP);
    table.setVerticalAlignment(1, 2, Table.VERTICAL_ALIGN_BOTTOM);
    table.setVerticalAlignment(1, 3, Table.VERTICAL_ALIGN_BOTTOM);

    table.setWidth(400);
    table.setWidth(2, 1, 15);
    table.setWidth(1, 1, 73);

    myForm.add(table);

    Age age = null;
    String doctorInfo = null;

    if (user != null && user.getDateOfBirth() != null) age = new Age(user.getDateOfBirth());
    else if (user != null && user.getPersonalID() != null)
      age = new Age(PIDChecker.getInstance().getDateFromPersonalID(user.getPersonalID()));

    int userIDDr = 45;

    if (age != null && age.getYears() >= 70) {
      userIDDr = 46; // 45   41047
    }

    PresentationObject picture = null;
    User doctor = null;

    int userImageID = -1;
    try {
      doctor =
          ((UserBusiness) IBOLookup.getServiceInstance(_iwc, UserBusiness.class)).getUser(userIDDr);
    } catch (Exception fe) {
      log(fe);
    }

    if (doctor != null) userImageID = doctor.getSystemImageID();

    if (userImageID == -1) {
      Table fakeImageTable = new Table(1, 1);
      fakeImageTable.setAlignment(1, 1, Table.HORIZONTAL_ALIGN_CENTER);
      fakeImageTable.setBorder(4);
      fakeImageTable.setHeight(140);
      fakeImageTable.setWidth(100);
      String fakeImageColor = "#CCCCCC";
      Text photoText = new Text(iwrb.getLocalizedString("managerview.photo_text", "Photo"));
      photoText.setBold();
      photoText.setFontColor(fakeImageColor);
      photoText.setFontSize(Text.FONT_SIZE_12_STYLE_TAG);
      fakeImageTable.add(photoText, 1, 1);
      fakeImageTable.setBorderColor(fakeImageColor);
      picture = fakeImageTable;
    } else {
      Image image = new Image();
      image.setImageID(userImageID);
      image.setWidth(73);

      picture = image;
    }
    table.add(picture, 1, 1);

    if (age != null && age.getYears() >= 70) {
      doctorInfo =
          "<b>Dr. Inga Pren</b><br>Allmänläkare<br>Telefon:<br>018-987624<br>Telefontid: Mån-ons, kl 08:30-10.00<br>Webbsida: <a href='http://www.flogsta.se' target='_new'>www.flogsta.se</a>";
    } else {
      doctorInfo =
          "<b>Dr. Magne Syhl</b><br>Allmänläkare<br>Telefon:<br>018-987654<br>Telefontid: Mån-ons, kl 08-10.00<br>Webbsida: <a href='http://www.gimovc.se' target='_new'>www.gimovc.se</a>";
    }

    table.add(doctorInfo, 3, 1);
    GenericButton message =
        getButton(new GenericButton("send_message", localize(prmSendMessage, "Send message")));
    if (_messagePage != null) message.setPageToOpen(_messagePage);

    table.add(message, 3, 2);
    table.setHeight(3, 2, "25");

    GenericButton visitbooking =
        getButton(new GenericButton("visit", localize(prmVisitBooking, "Book an appointment")));
    if (_appointmentPage != null) visitbooking.setPageToOpen(_appointmentPage);

    SubmitButton smb = new SubmitButton();
    smb.setStyleClass("ehealth_InterfaceButton");
    smb.setValue("Skicka meddelande >");
    smb.setPageToOpen(132);

    table.add(visitbooking, 3, 3);

    return myForm;
  }
 private ProductBusiness getProductBusiness() throws RemoteException {
   return (ProductBusiness) IBOLookup.getServiceInstance(this.iwc, ProductBusiness.class);
 }