/** * @see org.opencms.gwt.shared.rpc.I_CmsVfsService#getSitePath(org.opencms.util.CmsUUID) */ public String getSitePath(CmsUUID structureId) { try { CmsResource resource = getCmsObject().readResource(structureId, CmsResourceFilter.IGNORE_EXPIRATION); return getCmsObject().getSitePath(resource); } catch (CmsException e) { if (LOG.isWarnEnabled()) { LOG.warn(e.getMessageContainer(), e); } } return null; }
/** * @see org.opencms.db.I_CmsUserDriver#getOrganizationalUnits(org.opencms.db.CmsDbContext, org.opencms.security.CmsOrganizationalUnit, boolean) */ public List getOrganizationalUnits(CmsDbContext dbc, CmsOrganizationalUnit parent, boolean includeChildren) throws CmsDataAccessException { List orgUnits = new ArrayList(); try { CmsResource parentFolder = internalOrgUnitFolder(dbc, parent); Iterator itResources = m_driverManager.readResources( dbc, parentFolder, CmsResourceFilter.DEFAULT, includeChildren).iterator(); while (itResources.hasNext()) { CmsResource resource = (CmsResource)itResources.next(); orgUnits.add(internalCreateOrgUnitFromResource(dbc, resource)); } } catch (CmsException e) { throw new CmsDataAccessException(e.getMessageContainer(), e); } return orgUnits; }
/** * Creates a new helper object.<p> * * @param cms the cms object * @param publishList a publish list to validate */ public CmsRelationPublishValidator(CmsObject cms, CmsPublishList publishList) { try { m_cms = OpenCms.initCmsObject(cms); } catch (CmsException e) { m_cms = cms; } try { m_brokenRelations = OpenCms.getPublishManager().validateRelations(m_cms, publishList, null); } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); throw new CmsRuntimeException(e.getMessageContainer(), e); } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); throw new RuntimeException(e.getLocalizedMessage()); } }
/** * @see org.opencms.db.I_CmsUserDriver#getResourcesForOrganizationalUnit(org.opencms.db.CmsDbContext, org.opencms.security.CmsOrganizationalUnit) */ public List getResourcesForOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit) throws CmsDataAccessException { List result = new ArrayList(); try { CmsResource ouResource = m_driverManager.readResource(dbc, orgUnit.getId(), CmsResourceFilter.ALL); Iterator itPaths = internalResourcesForOrgUnit(dbc, ouResource).iterator(); while (itPaths.hasNext()) { String path = (String)itPaths.next(); try { result.add(m_driverManager.readResource(dbc, path, CmsResourceFilter.ALL)); } catch (CmsVfsResourceNotFoundException e) { LOG.error(e.getLocalizedMessage(), e); } } } catch (CmsException e) { throw new CmsDataAccessException(e.getMessageContainer(), e); } return result; }
/** * Sets the parent Group name.<p> * * @param parentGroup the parent Group name to set */ public void setParentGroup(String parentGroup) { if (CmsStringUtil.isEmpty(parentGroup) || parentGroup.equals("null") || parentGroup.equals("none")) { parentGroup = null; } if (parentGroup != null) { try { getCms().readGroup(parentGroup); } catch (CmsException e) { throw new CmsIllegalArgumentException(e.getMessageContainer()); } } m_parentGroup = parentGroup; }
/** * Sets the parent Group name.<p> * * @param parentGroup the parent Group name to set */ public void setParentGroup(String parentGroup) { if (CmsStringUtil.isEmpty(parentGroup) || parentGroup.equals("null") || parentGroup.equals("none")) { parentGroup = null; } if (parentGroup != null) { try { getCms().readGroup(parentGroup); } catch (CmsException e) { throw new CmsIllegalArgumentException(e.getMessageContainer()); } } m_parentGroup = parentGroup; }
/** * Checks if the given group name is a valid opencms user group.<p> * * @param groupName the group name to check * * @return the read group */ private CmsGroup checkGroup(String groupName) { try { return getCms().readGroup(groupName); } catch (CmsException e) { throw new CmsIllegalArgumentException(e.getMessageContainer()); } } }
/** * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions() */ @Override public void executeListSingleActions() throws IOException, ServletException { if (getParamListAction().equals(LIST_ACTION_RESTORE)) { try { performRestoreOperation(); Map params = new HashMap(); params.put(PARAM_ACTION, DIALOG_INITIAL); getToolManager().jspForwardPage(this, "/system/workplace/views/explorer/explorer_files.jsp", params); } catch (CmsException e) { LOG.error(e.getMessage(), e); throw new CmsRuntimeException(e.getMessageContainer()); } } refreshList(); }
/** * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions() */ @Override public void executeListSingleActions() throws IOException, ServletException { if (getParamListAction().equals(LIST_ACTION_RESTORE)) { try { performRestoreOperation(); Map<String, String[]> params = new HashMap<String, String[]>(); params.put(PARAM_ACTION, new String[] {DIALOG_INITIAL}); getToolManager().jspForwardPage(this, "/system/workplace/views/explorer/explorer_files.jsp", params); } catch (CmsException e) { LOG.error(e.getMessage(), e); throw new CmsRuntimeException(e.getMessageContainer()); } } refreshList(); }
/** * Returns the uuid id for the given id, * remove this method as soon as possible.<p> * * @param context the current cms context * @param id the old project id * * @return the new uuid for the given id * * @throws CmsException if something goes wrong */ public CmsUUID getProjectId(CmsRequestContext context, int id) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsUUID result = null; try { result = m_driverManager.getProjectId(dbc, id); } catch (CmsException e) { dbc.report(null, e.getMessageContainer(), e); } finally { dbc.clear(); } return result; }
/** * @see org.opencms.workplace.list.A_CmsListDialog#executeListMultiActions() */ @Override public void executeListMultiActions() throws IOException, ServletException { Map<String, String[]> params = new HashMap<String, String[]>(); params.put(A_CmsMessageDialog.PARAM_SESSIONIDS, new String[] {getParamSelItems()}); // set action parameter to initial dialog call params.put(CmsDialog.PARAM_ACTION, new String[] {CmsDialog.DIALOG_INITIAL}); if (getParamListAction().equals(LIST_MACTION_MESSAGE)) { // execute the send message multiaction // forward to the edit message screen getToolManager().jspForwardTool(this, "/workplace/broadcast/message", params); } else if (getParamListAction().equals(LIST_MACTION_EMAIL)) { // execute the send email multiaction // forward to the edit email screen getToolManager().jspForwardTool(this, "/workplace/broadcast/email", params); } else if (getParamListAction().equals(LIST_MACTION_KILL_SESSION)) { List<String> selectedItems = CmsStringUtil.splitAsList(getParamSelItems(), "|"); for (String selectedItem : selectedItems) { try { OpenCms.getSessionManager().killSession(getCms(), new CmsUUID(selectedItem)); } catch (CmsException e) { throw new CmsRuntimeException(e.getMessageContainer(), e); } } } else { throwListUnsupportedActionException(); } }
/** * @see org.opencms.db.I_CmsUserDriver#readOrganizationalUnit(org.opencms.db.CmsDbContext, String) */ public CmsOrganizationalUnit readOrganizationalUnit(CmsDbContext dbc, String ouFqn) throws CmsDataAccessException { try { CmsResource resource = m_driverManager.readResource( dbc, ORGUNIT_BASE_FOLDER + ouFqn, CmsResourceFilter.DEFAULT); return internalCreateOrgUnitFromResource(dbc, resource); } catch (CmsVfsResourceNotFoundException e) { throw new CmsDbEntryNotFoundException(Messages.get().container(Messages.ERR_READ_ORGUNIT_1, ouFqn), e); } catch (CmsException e) { throw new CmsDataAccessException(e.getMessageContainer(), e); } }
/** * @see org.opencms.db.I_CmsUserDriver#readOrganizationalUnit(org.opencms.db.CmsDbContext, String) */ public CmsOrganizationalUnit readOrganizationalUnit(CmsDbContext dbc, String ouFqn) throws CmsDataAccessException { try { CmsResource resource = m_driverManager.readResource( dbc, ORGUNIT_BASE_FOLDER + ouFqn, CmsResourceFilter.DEFAULT); return internalCreateOrgUnitFromResource(dbc, resource); } catch (CmsVfsResourceNotFoundException e) { throw new CmsDbEntryNotFoundException(Messages.get().container(Messages.ERR_READ_ORGUNIT_1, ouFqn), e); } catch (CmsException e) { throw new CmsDataAccessException(e.getMessageContainer(), e); } }
/** * @see org.opencms.db.I_CmsUserDriver#readOrganizationalUnit(org.opencms.db.CmsDbContext, String) */ public CmsOrganizationalUnit readOrganizationalUnit(CmsDbContext dbc, String ouFqn) throws CmsDataAccessException { try { CmsResource resource = m_driverManager.readResource( dbc, ORGUNIT_BASE_FOLDER + ouFqn, CmsResourceFilter.DEFAULT); return internalCreateOrgUnitFromResource(dbc, resource); } catch (CmsVfsResourceNotFoundException e) { throw new CmsDbEntryNotFoundException(Messages.get().container(Messages.ERR_READ_ORGUNIT_1, ouFqn), e); } catch (CmsException e) { throw new CmsDataAccessException(e.getMessageContainer(), e); } }
/** * @see org.opencms.db.I_CmsUserDriver#deleteOrganizationalUnit(org.opencms.db.CmsDbContext, org.opencms.security.CmsOrganizationalUnit) */ public void deleteOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit organizationalUnit) throws CmsDataAccessException { try { CmsResource resource = m_driverManager.readResource( dbc, ORGUNIT_BASE_FOLDER + organizationalUnit.getName(), CmsResourceFilter.DEFAULT); internalDeleteOrgUnitResource(dbc, resource); if (organizationalUnit.getProjectId() != null) { try { // maintain the default project synchronized m_driverManager.deleteProject( dbc, m_driverManager.readProject(dbc, organizationalUnit.getProjectId())); } catch (CmsDbEntryNotFoundException e) { // ignore } } } catch (CmsException e) { throw new CmsDataAccessException(e.getMessageContainer(), e); } }
/** * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions() */ @Override public void executeListSingleActions() throws CmsRuntimeException { if (getParamListAction().equals(LIST_ACTION_REMOVE1) || getParamListAction().equals(LIST_ACTION_REMOVE2)) { try { // lock resource if autolock is enabled checkLock(getParamResource()); CmsListItem listItem = getSelectedItem(); String categoryPath = listItem.getId(); getCategoryService().removeResourceFromCategory(getCms(), getParamResource(), categoryPath); getCategoryService().repairRelations(getCms(), getParamResource()); } catch (CmsException e) { throw new CmsRuntimeException(e.getMessageContainer(), e); } } else { throwListUnsupportedActionException(); } listSave(); }
/** * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions() */ @Override public void executeListSingleActions() throws CmsRuntimeException { if (getParamListAction().equals(LIST_ACTION_REMOVE1) || getParamListAction().equals(LIST_ACTION_REMOVE2)) { try { // lock resource if autolock is enabled checkLock(getParamResource()); CmsListItem listItem = getSelectedItem(); String categoryPath = listItem.getId(); getCategoryService().removeResourceFromCategory(getCms(), getParamResource(), categoryPath); getCategoryService().repairRelations(getCms(), getParamResource()); } catch (CmsException e) { throw new CmsRuntimeException(e.getMessageContainer(), e); } } else { throwListUnsupportedActionException(); } listSave(); }
/** * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions() */ @Override public void executeListSingleActions() throws CmsRuntimeException { if (getParamListAction().equals(LIST_ACTION_ADD)) { try { // lock resource if autolock is enabled checkLock(getParamResource()); CmsListItem listItem = getSelectedItem(); getCategoryService().addResourceToCategory(getCms(), getParamResource(), listItem.getId()); getCategoryService().repairRelations(getCms(), getParamResource()); } catch (CmsException e) { throw new CmsRuntimeException(e.getMessageContainer(), e); } } else { throwListUnsupportedActionException(); } listSave(); }
/** * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions() */ @Override public void executeListSingleActions() throws CmsRuntimeException { if (getParamListAction().equals(LIST_ACTION_ADD)) { try { // lock resource if autolock is enabled checkLock(getParamResource()); CmsListItem listItem = getSelectedItem(); getCategoryService().addResourceToCategory(getCms(), getParamResource(), listItem.getId()); getCategoryService().repairRelations(getCms(), getParamResource()); } catch (CmsException e) { throw new CmsRuntimeException(e.getMessageContainer(), e); } } else { throwListUnsupportedActionException(); } listSave(); }
/** * Starts the publish thread for the project.<p> */ private void startPublishThread() { // create a publish thread from the current publish list CmsPublishList publishList = getSettings().getPublishList(); try { OpenCms.getPublishManager().publishProject( getCms(), new CmsHtmlReport(getLocale(), getCms().getRequestContext().getSiteRoot()), publishList); } catch (CmsException e) { throw new CmsRuntimeException(e.getMessageContainer()); } setParamAction(REPORT_END); setAction(ACTION_REPORT_END); setParamThreadHasNext(CmsStringUtil.FALSE); }