public DebateItemReference remove(Long debateItemReferencePK) throws NoSuchDebateItemReferenceException, SystemException { Session session = null; try { session = openSession(); DebateItemReference debateItemReference = (DebateItemReference) session.get(DebateItemReferenceImpl.class, debateItemReferencePK); if (debateItemReference == null) { if (_log.isWarnEnabled()) { _log.warn("No DebateItemReference exists with the primary key " + debateItemReferencePK); } throw new NoSuchDebateItemReferenceException( "No DebateItemReference exists with the primary key " + debateItemReferencePK); } return remove(debateItemReference); } catch (NoSuchDebateItemReferenceException nsee) { throw nsee; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
public static List<CalEvent> getMonthEvent(ThemeDisplay themeDisplay, EventDisplayModel evModel) { List<CalEvent> lstEvents = new ArrayList<CalEvent>(); TimeZone timeZone = themeDisplay.getTimeZone(); Locale locale = themeDisplay.getLocale(); java.util.Calendar curCal = CalendarFactoryUtil.getCalendar(timeZone, locale); int curDay = curCal.get(Calendar.DAY_OF_MONTH); int curMonth = curCal.get(Calendar.MONTH); int curYear = curCal.get(Calendar.YEAR); int maxDayOfMonth = curCal.getActualMaximum(Calendar.DATE); GregorianCalendar gregCal = new GregorianCalendar(); gregCal.set(Calendar.MONTH, curMonth); gregCal.set(Calendar.YEAR, curYear); try { for (int i = 1; i < maxDayOfMonth; i++) { List<CalEvent> tempEvents = new ArrayList<CalEvent>(); gregCal.set(Calendar.DATE, i); tempEvents.addAll( CalEventServiceUtil.getEvents(themeDisplay.getScopeGroupId(), gregCal, new String())); lstEvents.addAll(tempEvents); } return lstEvents; } catch (PortalException e) { // TODO Auto-generated catch block _log.error(e); return null; } catch (SystemException e) { // TODO Auto-generated catch block _log.error(e); return null; } }
private TaiLieuDinhKem getTailieuDinhKemBoiIdStep2(Long chungthucId) { // TODO Auto-generated method stub log.info("1.step 1 chungthuc Id:" + chungthucId); try { TaiLieuChungThuc chungThuc = TaiLieuChungThucLocalServiceUtil.fetchTaiLieuChungThuc(chungthucId); if (chungThuc == null) { log.info("2. null objct chungthuc by id"); chungThuc = TaiLieuChungThucLocalServiceUtil.getTaiLieuChungThuc(chungthucId); } if (chungThuc != null) { DanhMucGiayTo type = DanhMucGiayToLocalServiceUtil.fetchDanhMucGiayTo(chungThuc.getDanhMucGiayToId()); if (type == null) { log.info("3. null object danhmuc by id"); type = DanhMucGiayToLocalServiceUtil.getDanhMucGiayTo(chungThuc.getDanhMucGiayToId()); } if (type != null) { TaiLieuDinhKem dinhKem = new TaiLieuDinhKem(DanhMucGiayToSoap.toSoapModel(type)); dinhKem.setTailieuChungThuc(TaiLieuChungThucSoap.toSoapModel(chungThuc)); dinhKem.setUrl( WebserviceFactory.getThamSoService().getValue(Constants.ThamSo.DOMAIN) + storage.getURLById(chungThuc.getNoiLuuTruId())); return dinhKem; } } } catch (Exception e) { // TODO Auto-generated catch block log.info("document-------------error:" + e.getMessage()); // e.printStackTrace(); } return null; }
@Override public Department addDepartment(Department department, ServiceContext serviceContext) { try { department.setGroupId(serviceContext.getScopeGroupId()); department.setCompanyId(serviceContext.getCompanyId()); department.setUserId(serviceContext.getUserId()); department.setCreateDate(new Date()); department.setModifiedDate(new Date()); department = super.addDepartment(department); // NOSONAR // add permission resourceLocalService.addResources( department.getCompanyId(), department.getGroupId(), serviceContext.getUserId(), Department.class.getName(), department.getDepartmentId(), false, true, true); return department; } catch (SystemException e) { LOGGER.info(e); } catch (PortalException e) { LOGGER.info(e); } return null; }
/** * Render. * * @param request the request * @param response the response * @param model the model * @return the string */ @RenderMapping public String render( final RenderRequest request, final RenderResponse response, final Model model) { m_objLog.trace("render::start"); String page = request.getParameter("jspPage"); if (page == null) { page = "../shared/register"; if (this.isLoggedInOrg(request)) { page = "registerLoggedIn"; } } final String error = request.getParameter("error"); if (error != null) { model.addAttribute("error", error); m_objLog.warn("Handing over error " + error); final String ePage = request.getParameter("errorPage"); if (ePage != null) { page = ePage; } } /* * else { model.addAttribute("data", new BerliosProject()); } */ m_objLog.trace("render::end(" + page + ")"); return page; }
/** * Removes the proposal rating with the primary key from the database. Also notifies the * appropriate model listeners. * * @param primaryKey the primary key of the proposal rating * @return the proposal rating that was removed * @throws com.ext.portlet.NoSuchProposalRatingException if a proposal rating with the primary key * could not be found * @throws SystemException if a system exception occurred */ @Override public ProposalRating remove(Serializable primaryKey) throws NoSuchProposalRatingException, SystemException { Session session = null; try { session = openSession(); ProposalRating proposalRating = (ProposalRating) session.get(ProposalRatingImpl.class, primaryKey); if (proposalRating == null) { if (_log.isWarnEnabled()) { _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } throw new NoSuchProposalRatingException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } return remove(proposalRating); } catch (NoSuchProposalRatingException nsee) { throw nsee; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
@Override public Department addDepartment(String name, long devisionId, ServiceContext serviceContext) { try { Department department = departmentPersistence.create(counterLocalService.increment()); department.setName(name); department.setDevisionId(devisionId); department.setGroupId(serviceContext.getScopeGroupId()); department.setCompanyId(serviceContext.getCompanyId()); department.setUserId(serviceContext.getUserId()); department.setCreateDate(new Date()); department.setModifiedDate(new Date()); department = super.addDepartment(department); // add permission resourceLocalService.addResources( department.getCompanyId(), department.getGroupId(), serviceContext.getUserId(), Department.class.getName(), department.getDepartmentId(), false, true, true); return department; } catch (SystemException e) { LOGGER.info(e); } catch (PortalException e) { LOGGER.info(e); } return null; }
public EmpDiscipline addEmpDiscipline( EmpDiscipline prePersistedObj, ServiceContext serviceContext) { try { final EmpDiscipline o = super.addEmpDiscipline(prePersistedObj); // add permission resourceLocalService.addResources( o.getCompanyId(), o.getGroupId(), o.getUserId(), EmpDiscipline.class.getName(), o.getEmpDisciplineId(), false, true, true); // index new EmpDiscipline Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(EmpDiscipline.class); indexer.reindex(EmpDiscipline.class.getName(), o.getEmpDisciplineId()); final Emp emp = empLocalService.fetchEmp(o.getEmpId()); emp.setStatus(EmployeeStatus.DISCIPLINE.toString()); empLocalService.updateEmp(emp); return o; } catch (SystemException e) { LOGGER.info(e); } catch (SearchException e) { LOGGER.info(e); } catch (PortalException e) { LOGGER.info(e); } return null; }
public String getBrowserTimingFooter() { log.debug("getBrowserTimingFooter"); String newRelicSnippet = NewRelic.getBrowserTimingFooter(); log.debug("newRelicSnippet: " + newRelicSnippet); return newRelicSnippet; }
@SuppressWarnings("unchecked") public List<Document> filterByFields( SearchContext searchContext, Map<String, Object> filters, Sort sort, long companyId, int start, int end) throws ParseException { final List<Query> queries = new ArrayList<>(); if (filters != null) { Date effectiveDateFrom = filters.get(EmpDisciplineField.EFFECTIVE_DATE_FROM) != null ? (Date) filters.get(EmpDisciplineField.EFFECTIVE_DATE_FROM) : null; Date effectiveDateTo = filters.get(EmpDisciplineField.EFFECTIVE_DATE_TO) != null ? (Date) filters.get(EmpDisciplineField.EFFECTIVE_DATE_TO) : null; for (Map.Entry<String, Object> filter : filters.entrySet()) { final String filterProperty = filter.getKey(); final Object filterValue = filter.getValue(); LOGGER.info("Filter Property: " + filterProperty); if (filterValue instanceof String) { LOGGER.info("Filter Property Value: " + filterValue); // TODO BooleanQuery stringFilterQuery = BooleanQueryFactoryUtil.create(searchContext); stringFilterQuery.addTerm( filterProperty, (String) filterValue, true, BooleanClauseOccur.MUST); queries.add(stringFilterQuery); } else if (filterValue instanceof List<?>) { queries.add( empLocalService.createStringListQuery( filterProperty, (List<String>) filterValue, searchContext)); } else if (filterValue instanceof Date) { Query effectiveDateQuery = empLocalService.createDateTermRangeQuery( EmpDisciplineField.EFFECTIVE_DATE, effectiveDateFrom, effectiveDateTo, true, true, searchContext); if (effectiveDateQuery != null) { queries.add(effectiveDateQuery); } } } } /* SORT */ if (sort == null) { sort = new Sort(EmpDisciplineField.ID, false); } return searchAllDocuments(searchContext, queries, companyId, sort, start, end); }
/** * @deprecated Use <code>update(DebateItemReference debateItemReference, boolean merge)</code>. */ public DebateItemReference update(DebateItemReference debateItemReference) throws SystemException { if (_log.isWarnEnabled()) { _log.warn( "Using the deprecated update(DebateItemReference debateItemReference) method. Use update(DebateItemReference debateItemReference, boolean merge) instead."); } return update(debateItemReference, false); }
public void completelyRemoveAll() { for (TitlesDepartmentUnitUnitGroup item : findAll()) { try { titlesDepartmentUnitUnitGroupPersistence.remove(item.getTitlesDepartmentUnitUnitGroupId()); } catch (NoSuchTitlesDepartmentUnitUnitGroupException e) { LOGGER.info(e); } catch (SystemException e) { LOGGER.info(e); } } }
public void completelyRemoveAll() { for (Department department : findAll()) { try { departmentPersistence.remove(department.getDepartmentId()); } catch (NoSuchDepartmentException e) { LOGGER.info(e); } catch (SystemException e) { LOGGER.info(e); } } }
/** * Restituisce la view della portlet. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param req The non-HTTP request we are processing * @param res The non-HTTP response we are creating * @return action forward * @throws Exception if the application business logic throws an exception. */ private ActionForward processAction( final ActionMapping mapping, final ActionForm form, final HttpServletRequest req, final HttpServletResponse res) throws Exception { if (logger.isDebugEnabled()) { logger.debug("processAction - begin"); } return mapping.findForward("/activities-browser/view"); }
/** * Restituisce la view della portlet. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param req The non-HTTP request we are processing * @param res The non-HTTP response we are creating * @return action forward * @throws Exception if the application business logic throws an exception. */ private ActionForward processAction( final ActionMapping mapping, final ActionForm form, final HttpServletRequest req, final HttpServletResponse res) throws Exception { if (logger.isDebugEnabled()) { logger.debug("processAction - begin"); } PortletRequest aReq = (PortletRequest) req.getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST); String hpmProcessId = ParamUtil.getString(req, KpeoplePortalConstants.HPM_PROCESS_ID); int idPatternType = ParamUtil.getInteger(req, "idPatternType"); String patternName = ParamUtil.getString(req, "patternName"); String redirectDettaglio = ParamUtil.getString(req, "redirectDettaglio"); aReq.setAttribute(KpeoplePortalConstants.HPM_PROCESS_ID, hpmProcessId); aReq.setAttribute("idPatternType", idPatternType); aReq.setAttribute("patternName", patternName); aReq.setAttribute("redirectDettaglio", redirectDettaglio); // recupero degli utenti dal servizio (utilizzato per gli autocomplete) req.setAttribute("allUsers", getAllUsers()); if (idPatternType == PatternBrowserConstants.PATTERN_TYPE_RICHIEDI_CONTRIBUTO) { return mapping.findForward("/pattern-browser/create-pattern-richiedi-contributo"); } if (idPatternType == PatternBrowserConstants.PATTERN_TYPE_DELEGA) { return mapping.findForward("/pattern-browser/create-pattern-delega"); } if (idPatternType == PatternBrowserConstants.PATTERN_TYPE_ESCALATION) { return mapping.findForward("/pattern-browser/create-pattern-esclation"); } if (idPatternType == PatternBrowserConstants.PATTERN_TYPE_PIANIFICA_RIUNIONE) { return mapping.findForward("/pattern-browser/create-pattern-pianifica-riunione"); } if (idPatternType == PatternBrowserConstants.PATTERN_TYPE_RICHIEDI_AUTORIZZAZIONE) { return mapping.findForward("/pattern-browser/create-pattern-richiedi-autorizzazione"); } if (idPatternType == PatternBrowserConstants.PATTERN_TYPE_SOLLECITO) { return mapping.findForward("/pattern-browser/create-pattern-sollecito"); } if (logger.isDebugEnabled()) { logger.debug("processAction - end"); } return mapping.findForward("/pattern-browser/view"); }
public void run() { File tmpDir = null; try { tmpDir = WidgetsetUtil.createTempDir(); WidgetsetUtil.createWidgetset(tmpDir, widgetset, getIncludeWidgetsets()); compiler = new WidgetsetCompiler( outputLog, widgetset, tmpDir.getAbsolutePath(), getClasspathEntries(tmpDir)); try { compiler.compileWidgetset(); } catch (InterruptedException e1) { Thread.currentThread().interrupt(); } File compiledWidgetset = new File(tmpDir, widgetset); if (compiledWidgetset.exists() && compiledWidgetset.isDirectory()) { String ws = ControlPanelPortletUtil.getWidgetsetDir() + widgetset; WidgetsetUtil.rotateWidgetsetBackups(ws); WidgetsetUtil.backupOldWidgetset(ws); File destDir = new File(ws); outputLog.log("Copying widgetset from " + compiledWidgetset + " to " + destDir); System.out.println("Copying widgetset from " + compiledWidgetset + " to " + destDir); FileUtils.copyDirectory(compiledWidgetset, destDir); outputLog.log("Copying done"); System.out.println("Copying done"); } } catch (IOException e) { log.warn("Could not compile widgetsets.", e); System.out.println("Could not compile widgetsets. " + e.getMessage()); } finally { try { System.out.println("Remove temp directory"); FileUtils.deleteDirectory(tmpDir); System.out.println("Removing done..."); } catch (IOException e) { log.warn("Could not delete temporary directory: " + tmpDir, e); System.out.println("Could not delete temporary directory: " + tmpDir + " " + e); } compilationFinished(); } }
/** * Returns the proposal rating with the primary key or throws a {@link * com.liferay.portal.NoSuchModelException} if it could not be found. * * @param primaryKey the primary key of the proposal rating * @return the proposal rating * @throws com.ext.portlet.NoSuchProposalRatingException if a proposal rating with the primary key * could not be found * @throws SystemException if a system exception occurred */ @Override public ProposalRating findByPrimaryKey(Serializable primaryKey) throws NoSuchProposalRatingException, SystemException { ProposalRating proposalRating = fetchByPrimaryKey(primaryKey); if (proposalRating == null) { if (_log.isWarnEnabled()) { _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } throw new NoSuchProposalRatingException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } return proposalRating; }
/** * Deletes the book from the database. Also notifies the appropriate model listeners. * * @param book the book * @throws SystemException if a system exception occurred */ public void deleteBook(Book book) throws SystemException { bookPersistence.remove(book); Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName()); if (indexer != null) { try { indexer.delete(book); } catch (SearchException se) { if (_log.isWarnEnabled()) { _log.warn(se, se); } } } }
/** * Default article. * * @param request the request * @param response the response */ public void defaultArticle(ActionRequest request, ActionResponse response) { String defaultArticle = ParamUtil.getString(request, ARTICLE_ID); PortletPreferences preferences = request.getPreferences(); try { preferences.setValue(DEFAULT_ARTICLE, defaultArticle); preferences.store(); } catch (ReadOnlyException e) { LOG.error(e); } catch (ValidatorException e) { LOG.error(e); } catch (IOException e) { LOG.error(e); } SessionMessages.add(request, ARTICLE_DEAFULT); }
public DebateItemReference findByPrimaryKey(Long debateItemReferencePK) throws NoSuchDebateItemReferenceException, SystemException { DebateItemReference debateItemReference = fetchByPrimaryKey(debateItemReferencePK); if (debateItemReference == null) { if (_log.isWarnEnabled()) { _log.warn("No DebateItemReference exists with the primary key " + debateItemReferencePK); } throw new NoSuchDebateItemReferenceException( "No DebateItemReference exists with the primary key " + debateItemReferencePK); } return debateItemReference; }
@Override public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException, PortletException { String id = resourceRequest.getResourceID(); if (id.equalsIgnoreCase("getBrokerTopics")) { JSONArray topics = JSONFactoryUtil.createJSONArray(); long brokerId = ParamUtil.getLong(resourceRequest, "brokerId"); long brokerMessageListenerId = ParamUtil.getLong(resourceRequest, "brokerMessageListenerId"); try { Broker b = BrokerLocalServiceUtil.fetchBroker(brokerId); BrokerMessageListener bml = (brokerMessageListenerId > 0) ? BrokerMessageListenerLocalServiceUtil.fetchBrokerMessageListener( brokerMessageListenerId) : null; String[] topicsArr = b.getTopics().split(";"); for (int i = 0; i < topicsArr.length; i++) { JSONObject obj = JSONFactoryUtil.createJSONObject(); obj.put("topic", topicsArr[i]); boolean checked = false; if (bml != null) { String[] messageListenerTopcs = bml.getTopics().split(";"); for (int j = 0; j < messageListenerTopcs.length && !checked; j++) { if (messageListenerTopcs[j].equalsIgnoreCase(topicsArr[i])) checked = true; } } obj.put("checked", checked); topics.put(obj); } } catch (Exception e) { logger.error(e); } resourceResponse.getWriter().println(topics.toString()); } }
public static synchronized void stopApplication() { if (appStarted) { appStarted = false; LogHolder.detach(); log.info("Log Viewer Shutdown"); } }
@Override public void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { LOGGER.info("do view AssetCategoriesImporter"); super.doView(renderRequest, renderResponse); }
public TitlesDepartmentUnitUnitGroup addTitlesDepartmentUnitUnitGroup( long titlesId, long departmentId, long unitId, long unitGroupId, ServiceContext serviceContext) { try { TitlesDepartmentUnitUnitGroup o = titlesDepartmentUnitUnitGroupPersistence.create(counterLocalService.increment()); o.setTitlesId(titlesId); o.setUnitGroupId(unitGroupId); o.setUnitId(unitId); o.setDepartmentId(departmentId); o.setCreateDate(new Date()); o.setModifiedDate(new Date()); o.setGroupId(serviceContext.getScopeGroupId()); o.setCompanyId(serviceContext.getCompanyId()); o.setUserId(serviceContext.getUserId()); return super.addTitlesDepartmentUnitUnitGroup(o); } catch (SystemException e) { LOGGER.info(e); } return null; }
public List<EmpDiscipline> findAll(int start, int end, OrderByComparator orderByComparator) { try { return empDisciplinePersistence.findAll(start, end, orderByComparator); } catch (SystemException e) { LOGGER.info(e); } return new ArrayList<>(); }
public Department createPrePersistedDepartment() { try { return super.createDepartment(counterLocalService.increment()); } catch (SystemException e) { LOGGER.info(e); } return null; }
static { _allMediaGalleryMimeTypes.addAll( SetUtil.fromArray(PropsUtil.getArray(PropsKeys.DL_FILE_ENTRY_PREVIEW_AUDIO_MIME_TYPES))); _allMediaGalleryMimeTypes.addAll( SetUtil.fromArray(PropsUtil.getArray(PropsKeys.DL_FILE_ENTRY_PREVIEW_VIDEO_MIME_TYPES))); _allMediaGalleryMimeTypes.addAll( SetUtil.fromArray(PropsUtil.getArray(PropsKeys.DL_FILE_ENTRY_PREVIEW_IMAGE_MIME_TYPES))); _allMediaGalleryMimeTypesString = StringUtil.merge(_allMediaGalleryMimeTypes); String[] fileIcons = null; try { fileIcons = PropsUtil.getArray(PropsKeys.DL_FILE_ICONS); } catch (Exception e) { if (_log.isDebugEnabled()) { _log.debug(e, e); } fileIcons = new String[] {StringPool.BLANK}; } for (int i = 0; i < fileIcons.length; i++) { // Only process non wildcard extensions if (!StringPool.STAR.equals(fileIcons[i])) { // Strip starting period String extension = fileIcons[i]; if (extension.length() > 0) { extension = extension.substring(1); } _fileIcons.add(extension); } } String[] genericNames = PropsUtil.getArray(PropsKeys.DL_FILE_GENERIC_NAMES); for (String genericName : genericNames) { _populateGenericNamesMap(genericName); } }
static { try { _findClassMethod = ReflectionUtil.getDeclaredMethod(ClassLoader.class, "findClass", String.class); _getResourceMethod = ReflectionUtil.getDeclaredMethod(ClassLoader.class, "getResource", String.class); _getResourcesMethod = ReflectionUtil.getDeclaredMethod(ClassLoader.class, "getResources", String.class); _loadClassMethod = ReflectionUtil.getDeclaredMethod( ClassLoader.class, "loadClass", String.class, boolean.class); } catch (Exception e) { if (_log.isErrorEnabled()) { _log.error("Unable to locate required methods", e); } } }
public void init() throws PortletException { super.init(); _responseJSP = getInitParameter("response-view"); _defaultJSP = getInitParameter("view-template"); _proxyHandler = new ProxyHandler(); // create default portlet action log.info("init"); }
public List<TitlesDepartmentUnitUnitGroup> findByUnit(long unitId) { try { return titlesDepartmentUnitUnitGroupPersistence.findByUnit(unitId); } catch (SystemException e) { LOGGER.info(e); } return new ArrayList<>(); }