コード例 #1
0
  /**
   * This method deletes the TerminationReasons record from database based on TerminationReasons
   * record Id
   *
   * @param resourceRequest
   * @param resourceResponse
   * @throws IOException
   * @throws PortletException
   * @throws SystemException
   * @throws PortalException
   * @throws NumberFormatException
   */
  public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
      throws IOException {
    if (resourceRequest.getResourceID().equals("deleteTerminationReasons")) {
      System.out.println("deleting thes TerminationReasons");

      String[] idsArray = ParamUtil.getParameterValues(resourceRequest, "terminationreasonsIds");
      System.out.println(idsArray.length);

      for (int i = 0; i <= idsArray.length - 1; i++) {

        try {
          try {
            TerminationReasonsLocalServiceUtil.deleteTerminationReasons(
                Long.parseLong(idsArray[i]));
          } catch (PortalException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          } catch (SystemException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
        } catch (NumberFormatException e) {
        }
      }
    }
  }
コード例 #2
0
  /*
   *   Processes resource bundle for specified locale
   * */
  private static void saveProperties(
      Locale locale, Hashtable<String, String> bundle, String bundleName) {

    for (Map.Entry property : bundle.entrySet()) {

      String key = (String) property.getKey();
      String value = (String) property.getValue();

      try {

        MessageSourcePK messageSourcePK = new MessageSourcePK(key, locale.toString());
        MessageSource messageSource =
            MessageSourceLocalServiceUtil.fetchMessageSource(messageSourcePK);

        if (messageSource == null) {

          messageSource = MessageSourceUtil.create(messageSourcePK);
          messageSource.setValue(value);
          messageSource.setBundle(bundleName);
          MessageSourceLocalServiceUtil.updateMessageSource(messageSource);
        }

      } catch (SystemException ex) {
        ex.printStackTrace();
      } catch (Exception ex) {
        ex.printStackTrace();
      }
    }
  }
コード例 #3
0
  private void update() {

    if (!IConstants.CFG_NOTIFY_OLD_USERS) return;

    DynamicQuery dynamicQuery =
        DynamicQueryFactoryUtil.forClass(User.class, PortalClassLoaderUtil.getClassLoader());
    dynamicQuery.add(RestrictionsFactoryUtil.eq("jobTitle", "mail-not-sent"));

    try {
      @SuppressWarnings("unchecked")
      List<User> users = UserLocalServiceUtil.dynamicQuery(dynamicQuery);

      int cnt = 0;

      for (User user : users) {
        // notifyUser thru email and SMS

        user.setJobTitle(StringPool.BLANK);
        user.setLastName(StringPool.BLANK);
        user = UserLocalServiceUtil.updateUser(user);
        cnt++;

        if (cnt == 200) break;
      }
    } catch (SystemException e) {
      e.printStackTrace();
    }
  }
コード例 #4
0
  public void updateBook(ActionRequest actionRequest, ActionResponse actionResponse)
      throws IOException, PortletException {
    String bookTitle = ParamUtil.getString(actionRequest, "asuid");
    String author = ParamUtil.getString(actionRequest, "email");
    System.out.println("Your inputs ==> " + bookTitle + ", " + author);

    LMSBook book = new LMSBookImpl();
    // set primary key
    long bookId = 0L;
    try {
      bookId = CounterLocalServiceUtil.increment(this.getClass().getName());
    } catch (SystemException e) {
      e.printStackTrace();
    }
    book.setBookId(bookId);
    // set UI fields
    book.setAsuid(bookTitle);
    book.setEmail(author);
    // set audit field(s)
    book.setDateAdded(new Date());

    try {
      LMSBookLocalServiceUtil.addLMSBook(book);
    } catch (SystemException e) {
      e.printStackTrace();
    }
  }
コード例 #5
0
 public Books getBooksInstance() {
   try {
     return booksPersistence.create(counterLocalService.increment(Books.class.getName()));
   } catch (SystemException e) {
     e.printStackTrace();
     return null;
   }
 }
コード例 #6
0
 public DLFileEntry updateFileEntry(DLFileEntry file) {
   try {
     return fileService.updateDLFileEntry(file);
   } catch (SystemException ex) {
     ex.printStackTrace();
     return file;
   }
 }
コード例 #7
0
 public List<Books> getAllBooks(long companyId) {
   try {
     return booksPersistence.findByCompanyId(companyId);
   } catch (SystemException e) {
     e.printStackTrace();
     return Collections.emptyList();
   }
 }
コード例 #8
0
 public List<Books> getAllBooks(long groupId, String title) {
   try {
     return booksPersistence.findByGroup_Title(groupId, title);
   } catch (SystemException e) {
     e.printStackTrace();
     return Collections.emptyList();
   }
 }
コード例 #9
0
 public List<Books> getBooksByUserId(long userId) {
   try {
     return booksPersistence.findByUserId(userId);
   } catch (SystemException e) {
     e.printStackTrace();
     return null;
   }
 }
コード例 #10
0
 public List<Books> getAllBooks() {
   try {
     return booksPersistence.findAll();
   } catch (SystemException e) {
     e.printStackTrace();
     return Collections.emptyList();
   }
 }
コード例 #11
0
  /**
   * This method inserts new TerminationReason record into the database table
   *
   * @param actionRequest
   * @param actionResponse
   * @throws IOException
   * @throws PortletException
   * @throws SystemException
   */
  public void saveTerminationReasons(ActionRequest actionRequest, ActionResponse actionResponse)
      throws IOException, PortletException, SystemException {
    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
    try {
      TerminationReasons terminationReasons =
          TerminationReasonsLocalServiceUtil.createTerminationReasons(
              CounterLocalServiceUtil.increment());

      String id = ParamUtil.getString(actionRequest, "terminationreasonsId");
      String name = ParamUtil.getString(actionRequest, "terminationreasonsName");
      String terminationReason = name.trim();
      if (terminationReason.equals("") || terminationReason == null) {

        System.out.println("Empty value in TerminationReason...");
        SessionMessages.add(actionRequest.getPortletSession(), "termination-form-error");
        actionResponse.setRenderParameter("mvcPath", "/html/terminationreasons/add.jsp");
      } else {

        System.out.println("id == " + id + "Name = " + name);
        if (id == "" || id == null) {

          DynamicQuery dynamicQuery =
              DynamicQueryFactoryUtil.forClass(
                  TerminationReasons.class, PortalClassLoaderUtil.getClassLoader());

          dynamicQuery.add(RestrictionsFactoryUtil.eq("terminationreasonsName", name));
          List<TerminationReasons> list =
              TerminationReasonsLocalServiceUtil.dynamicQuery(dynamicQuery);

          if (list.size() > 0) {
            TerminationReasons terminationReasons2 = list.get(0);

            if (terminationReasons2 != null) {

              SessionMessages.add(
                  actionRequest.getPortletSession(), "termination-form-duplicate-error");
              actionResponse.setRenderParameter("mvcPath", "/html/terminationreasons/add.jsp");
            }
          } else {

            terminationReasons.setTerminationreasonsName(
                ParamUtil.getString(actionRequest, "terminationreasonsName"));
            terminationReasons.setCreateDate(date);
            terminationReasons.setModifiedDate(date);
            terminationReasons.setCompanyId(themeDisplay.getCompanyId());
            terminationReasons.setGroupId(themeDisplay.getCompanyGroupId());
            terminationReasons.setUserId(themeDisplay.getUserId());
            terminationReasons =
                TerminationReasonsLocalServiceUtil.addTerminationReasons(terminationReasons);
          }
        }
      }
    } catch (SystemException e) {

      e.printStackTrace();
    }
  }
コード例 #12
0
 public Long getCitizenId() {
   try {
     return CounterLocalServiceUtil.increment(Citizen.class.getName());
   } catch (SystemException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return 0L;
 }
コード例 #13
0
 public Long getAutoIncrement() {
   try {
     return CounterLocalServiceUtil.increment("CMON_HOSOTTHCCONG_AUTO_INCREMENT");
   } catch (SystemException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return null;
 }
コード例 #14
0
 public DLFileEntry getFileEntry(long fileId) {
   try {
     return fileService.getDLFileEntry(fileId);
   } catch (PortalException ex) {
     ex.printStackTrace();
     return null;
   } catch (SystemException ex) {
     ex.printStackTrace();
     return null;
   }
 }
コード例 #15
0
 public DLFileEntry getFileEntry(String processUUID, String title) {
   try {
     return fileService.getFileEntryByTitle(
         processBaseGroup.getGroupId(), getFolder(processUUID).getFolderId(), title);
   } catch (PortalException ex) {
     ex.printStackTrace();
     return null;
   } catch (SystemException ex) {
     ex.printStackTrace();
     return null;
   }
 }
コード例 #16
0
ファイル: UniversityConverter.java プロジェクト: taotran/eco
 @Override
 protected University returnedModelObject(String value) {
   try {
     return UniversityLocalServiceUtil.getUniversity(Long.valueOf(value));
   } catch (NumberFormatException e) {
     e.printStackTrace();
   } catch (PortalException e) {
     e.printStackTrace();
   } catch (SystemException e) {
     e.printStackTrace();
   }
   return null;
 }
コード例 #17
0
  @RenderMapping
  public ModelAndView handleRenderRequest(
      RenderRequest request, RenderResponse response, ModelMap modelMap) {
    List<VoloDTO> listVolo = null;
    try {
      listVolo = voloService.findAll();
    } catch (SystemException e) {
      e.printStackTrace();
    }

    modelMap.put("listVolo", listVolo);
    return new ModelAndView("view", modelMap);
  }
コード例 #18
0
  public boolean isAssetPresent(String id_isin, String security_ticker) {

    boolean present = false;

    try {
      Asset asset = assetPersistence.fetchByIdISIN_Ticker(id_isin, security_ticker);
      present = Validator.isNotNull(asset);
    } catch (SystemException e) {
      e.printStackTrace();
    }

    return present;
  }
コード例 #19
0
  public void deleteBooks(long booksId, long companyId) {

    Books books;
    try {
      books = booksPersistence.findByPrimaryKey(booksId);
    } catch (SystemException e) {
      e.printStackTrace();
      return;
    } catch (NoSuchooksException e) {
      e.printStackTrace();
      return;
    }
    deleteBooks(books, companyId);
  }
コード例 #20
0
 /**
  * Entfernt einen Favoriten aus der DB
  *
  * @param event
  */
 public void deleteFavorite(ActionEvent event) {
   try {
     FavoriteLocalServiceUtil.deleteFavorite(Long.valueOf(currentFav));
   } catch (NumberFormatException e) {
     System.out.println("Beim lšschen eines Favoriten " + "ist ein Fehler aufgetreten!");
     e.printStackTrace();
   } catch (PortalException e) {
     System.out.println("Beim lšschen eines Favoriten " + "ist ein Fehler aufgetreten!");
     e.printStackTrace();
   } catch (SystemException e) {
     System.out.println("Beim lšschen eines Favoriten " + "ist ein Fehler aufgetreten!");
     e.printStackTrace();
   }
   moveToFavoriteSelection(event);
 }
コード例 #21
0
 /**
  * Verfolgt Aenderungen in der Favoriten-Auswahl Fuer die aktuelle Auswahl wird eine Vorschau
  * angezeigt
  *
  * @param vcEvent
  */
 public void favoritePreviewListener(ValueChangeEvent vcEvent) {
   try {
     slideBackingBean.showPreview(
         SlideLocalServiceUtil.getSlide(
                 FavoriteLocalServiceUtil.getFavorite(
                         Long.valueOf(vcEvent.getNewValue().toString()))
                     .getSlideId())
             .getIndex());
   } catch (NumberFormatException e) {
     e.printStackTrace();
   } catch (PortalException e) {
     e.printStackTrace();
   } catch (SystemException e) {
     e.printStackTrace();
   }
 }
コード例 #22
0
 /**
  * Zeigt den aktuellen Favoriten als Folie im slideViewer an
  *
  * @param event
  */
 public void moveToFavorite(ActionEvent event) {
   navigationBackingBean.setFavoriteSelectionStatus(false);
   navigationBackingBean.setSlideViewerStatus(true);
   try {
     slideBackingBean.showSlide(
         "" + FavoriteLocalServiceUtil.getFavorite(Long.valueOf(currentFav)).getSlideId());
   } catch (NumberFormatException e) {
     System.out.println("Beim navigieren zu einem Favoriten " + "ist ein Fehler aufgetreten!");
     e.printStackTrace();
   } catch (PortalException e) {
     System.out.println("Beim navigieren zu einem Favoriten " + "ist ein Fehler aufgetreten!");
     e.printStackTrace();
   } catch (SystemException e) {
     System.out.println("Beim navigieren zu einem Favoriten " + "ist ein Fehler aufgetreten!");
     e.printStackTrace();
   }
 }
コード例 #23
0
 /**
  * Laedt ein einzelnes Modul aus der Datenbank und belegt die ModuleModelBean
  *
  * @param moduleId
  */
 public void fetchModule(long moduleId) {
   try {
     Module module = ModuleLocalServiceUtil.getModule(moduleId);
     moduleModelBean.setLecturerUserId(module.getLecturerUserId());
     moduleModelBean.setModuleTitle(module.getModuleTitle());
     moduleModelBean.setDate(module.getCreateDate());
     moduleModelBean.setAdditionalInfo(module.getAdditionalInfo());
   } catch (NumberFormatException e) {
     System.out.println("Beim fetchen eines Moduls " + "ist ein Fehler aufgetreten!");
     e.printStackTrace();
   } catch (PortalException e) {
     System.out.println("Beim fetchen eines Moduls " + "ist ein Fehler aufgetreten!");
     e.printStackTrace();
   } catch (SystemException e) {
     System.out.println("Beim fetchen eines Moduls " + "ist ein Fehler aufgetreten!");
     e.printStackTrace();
   }
 }
コード例 #24
0
  @SuppressWarnings("unchecked")
  public List<Asset> getAssets(String pattern, boolean ticker) {
    List<Asset> results = new ArrayList<Asset>();
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(AssetImpl.class);

    dynamicQuery.add(
        RestrictionsFactoryUtil.like(
            ticker ? "security_ticker" : "id_isin",
            StringPool.PERCENT + pattern + StringPool.PERCENT));
    dynamicQuery.addOrder(OrderFactoryUtil.asc(ticker ? "security_ticker" : "id_isin"));

    try {
      results = assetLocalService.dynamicQuery(dynamicQuery);
    } catch (SystemException e) {
      e.printStackTrace();
    }

    return results;
  }
コード例 #25
0
ファイル: Tags.java プロジェクト: fraunhoferfokus/gemo
  /**
   * The search redirection.
   *
   * @return an empty string.
   */
  public String search() {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    Object responseObject = facesContext.getExternalContext().getResponse();

    if (responseObject != null && responseObject instanceof ActionResponse) {
      ActionResponse actionResponse = (ActionResponse) responseObject;

      Query query = new Query();
      query.getTags().add(selectedTag);
      actionResponse.setEvent(
          new QName("http://fokus.fraunhofer.de/odplatform", "querydatasets"), query);

      String location = LiferayFacesContext.getInstance().getThemeDisplay().getPortalURL();
      Layout layout = LiferayFacesContext.getInstance().getThemeDisplay().getLayout();

      try {
        if (layout.isPublicLayout()) {
          location +=
              LiferayFacesContext.getInstance().getThemeDisplay().getPathFriendlyURLPublic();
        }

        location +=
            layout.hasScopeGroup()
                ? layout.getScopeGroup().getFriendlyURL()
                : layout.getGroup().getFriendlyURL();
        location += "/suchen";
      } catch (PortalException e) {
        e.printStackTrace();
      } catch (SystemException e) {
        e.printStackTrace();
      }

      try {
        facesContext.getExternalContext().redirect(location);
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
    return "";
  }
コード例 #26
0
 public byte[] getFileBody(String processUUID, long fileId) {
   byte[] result = null;
   try {
     DLFileEntry file = getFileEntry(fileId);
     result = new byte[Long.valueOf(file.getSize()).intValue()];
     InputStream is =
         fileService.getFileAsStream(
             currentUser.getCompanyId(),
             currentUser.getUserId(),
             processBaseGroup.getGroupId(),
             getFolder(processUUID).getFolderId(),
             file.getName());
     is.read(result);
   } catch (PortalException ex) {
     ex.printStackTrace();
   } catch (SystemException ex) {
     ex.printStackTrace();
   } catch (IOException ex) {
     ex.printStackTrace();
   }
   return result;
 }
コード例 #27
0
ファイル: XslProxy.java プロジェクト: arejae/liferay
  public void render(RenderRequest renderRequest, RenderResponse renderResponse)
      throws IOException, PortletException {
    if (!_processed) {
      ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
      PortletConfig portletConfig =
          (PortletConfig) renderRequest.getAttribute("javax.portlet.config");
      _portletName = portletConfig.getPortletName();
      PortletURL pURL =
          PortletURLFactoryUtil.create(
              renderRequest,
              _portletName + "_WAR_" + _portletName + "portlet",
              themeDisplay.getPlid(),
              PortletRequest.ACTION_PHASE);
      pURL.setParameter(ActionRequest.ACTION_NAME, ProxyConstant.ACTION_LINK);
      _portletURL = pURL.toString();
      // read portlet config;
      PortletPreferences preferences = renderRequest.getPreferences();
      String portletResource = ParamUtil.getString(renderRequest, "portletResource");

      if (Validator.isNotNull(portletResource)) {
        try {
          preferences =
              PortletPreferencesFactoryUtil.getPortletSetup(renderRequest, portletResource);
        } catch (PortalException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        } catch (SystemException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
      }
      _proxyURL = preferences.getValue("url", "");
      log.info("proxyurl=" + _proxyURL);

      defaultProxyRequest();
      renderResponse.getWriter().print(_result);
    } else renderResponse.getWriter().print("processed");
  }
コード例 #28
0
ファイル: XslProxy.java プロジェクト: arejae/liferay
  private void getPortletInfo(ActionRequest actionRequest) {
    log.info("getPortletInfo");
    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
    PortletConfig portletConfig =
        (PortletConfig) actionRequest.getAttribute("javax.portlet.config");
    _portletName = portletConfig.getPortletName();
    PortletURL pURL =
        PortletURLFactoryUtil.create(
            actionRequest,
            _portletName + "_WAR_" + _portletName + "portlet",
            themeDisplay.getPlid(),
            PortletRequest.ACTION_PHASE);
    /*try {
    	pURL.setWindowState(WindowState.NORMAL );
    } catch (WindowStateException e1) {
    	// TODO Auto-generated catch block
    	e1.printStackTrace();
    }*/
    pURL.setParameter(ActionRequest.ACTION_NAME, ProxyConstant.ACTION_LINK);
    _portletURL = pURL.toString();

    // read portlet config;
    PortletPreferences preferences = actionRequest.getPreferences();
    String portletResource = ParamUtil.getString(actionRequest, "portletResource");

    if (Validator.isNotNull(portletResource)) {
      try {
        preferences = PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, portletResource);
      } catch (PortalException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (SystemException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
    _proxyURL = preferences.getValue("url", "");
  } /*
コード例 #29
0
 /**
  * Navigationsmethode mit Ziel questionViewer.xhtml Zeigt die gewaehlte Frage und die
  * dazugehoerige Antwort an
  *
  * @param event
  */
 public void moveToQuestionViewer(ActionEvent event) {
   navigationBackingBean.setQuestionSelectionStatus(false);
   navigationBackingBean.setQuestionViewerStatus(true);
   try {
     Question question = QuestionLocalServiceUtil.fetchQuestion(Long.valueOf(currentQuest));
     questionModelBean.setAnswer(question.getAnswer());
     if (questionModelBean.getAnswer() == null || questionModelBean.getAnswer() == "") {
       questionModelBean.setAnswer("Diese Frage wurde leider noch nicht beantwortet!");
     }
     questionModelBean.setModuleId(question.getModuleId());
     questionModelBean.setQuestionId(question.getQuestionId());
     questionModelBean.setQuestionText(question.getQuestionText());
     questionModelBean.setUserId(question.getUserId());
   } catch (NumberFormatException e) {
     e.printStackTrace();
     System.out.println(
         "Beim generieren des Question Modell " + "Objektes ist ein Fehler aufgetreten!");
   } catch (SystemException e) {
     System.out.println(
         "Beim generieren des Question Modell " + "Objektes ist ein Fehler aufgetreten!");
     e.printStackTrace();
   }
 }
コード例 #30
0
  public void run(String[] arg0) throws ActionException {

    File file = new File("old-users.csv");

    _log.debug("file ==> " + file.getAbsolutePath());

    InputStream inputStream = null;
    try {
      inputStream = new FileInputStream(file);
    } catch (FileNotFoundException e) {
      _log.debug("File not found...Existing....");
      return;
    }

    BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));

    long companyId = PortalUtil.getDefaultCompanyId();
    long creatorUserId = 0l;
    try {
      creatorUserId = UserLocalServiceUtil.getDefaultUserId(companyId);
    } catch (PortalException e) {
      e.printStackTrace();
    } catch (SystemException e) {
      e.printStackTrace();
    }

    try {
      String line = StringPool.BLANK;
      while (Validator.isNotNull(line = br.readLine())) {
        insertOldUser(companyId, creatorUserId, line);
      }
    } catch (IOException e) {
      e.printStackTrace();
    }

    file.delete();
  }