/** * Sets all needed data of the user into the list item object.<p> * * @param user the user to set the data for * @param item the list item object to set the data into */ protected void setUserData(CmsUser user, CmsListItem item) { item.set(LIST_COLUMN_LOGIN, user.getName()); item.set(LIST_COLUMN_NAME, user.getSimpleName()); item.set(LIST_COLUMN_ORGUNIT, CmsOrganizationalUnit.SEPARATOR + user.getOuFqn()); item.set(LIST_COLUMN_FULLNAME, user.getFullName()); }
/** * @see org.opencms.workplace.list.A_CmsListResourceCollector#setAdditionalColumns(org.opencms.workplace.list.CmsListItem, org.opencms.workplace.explorer.CmsResourceUtil) */ @Override protected void setAdditionalColumns(CmsListItem item, CmsResourceUtil resUtil) { item.set(CmsSearchResultsList.LIST_COLUMN_SCORE, new Integer(getSearchResult(item.getId()).getScore())); }
/** * @see org.opencms.workplace.tools.I_CmsHtmlIconButton#isEnabled() */ @Override public boolean isEnabled() { Boolean isEnabled = (Boolean)getItem().get(LIST_COLUMN_VERSION_ENABLE); if (isEnabled.booleanValue()) { return true; } return false; } };
/** * This method returns the item identified by the parameter id.<p> * * Only current visible item can be retrieved using this method.<p> * * @param id the id of the item to look for * * @return the requested item or <code>null</code> if not found */ public CmsListItem getItem(String id) { Iterator<CmsListItem> it = getAllContent().iterator(); while (it.hasNext()) { CmsListItem item = it.next(); if (item.getId().equals(id)) { return item; } } return null; }
/** * @see org.opencms.workplace.tools.A_CmsHtmlIconButton#isVisible() */ @Override public boolean isVisible() { String paramResource = getResource(); if (paramResource == null) { return false; } // not for offline entries if ("-1".equals(getItem().getId())) { return false; } String itemResource = getCms().getRequestContext().removeSiteRoot( (String)getItem().get(CmsHistoryList.LIST_COLUMN_RESOURCE_PATH)); return paramResource.equals(itemResource); }
/** * @see org.opencms.workplace.list.A_CmsListExplorerDialog#getListItems() */ @Override protected List<CmsListItem> getListItems() throws CmsException { List<CmsListItem> newItems = new ArrayList<CmsListItem>(); List<CmsListItem> items = super.getListItems(); Iterator<CmsListItem> itItems = items.iterator(); while (itItems.hasNext()) { CmsListItem item = itItems.next(); CmsResource resource = getResourceUtil(item).getResource(); CmsRelationType relationType = getRelationTypes().get(resource).remove(0); String localizedRelationType = relationType.getLocalizedName(getMessages()); Map<String, Object> itemValues = item.getValues(); CmsListItem newItem = getList().newItem(localizedRelationType + "_" + resource.getStructureId().toString()); Iterator<Entry<String, Object>> itItemValuesKeys = itemValues.entrySet().iterator(); while (itItemValuesKeys.hasNext()) { Entry<String, Object> e = itItemValuesKeys.next(); String currentKey = e.getKey(); newItem.set(currentKey, e.getValue()); } newItem.set(LIST_COLUMN_RELATION_TYPE, localizedRelationType); newItems.add(newItem); } return newItems; }
CmsListColumnDefinition col = li1.getMetadata().getColumnDefinition(columnId); if (col.getDirectActions().size() > 0) { String i1 = null; Comparable c1 = (Comparable)((CmsListItem)o1).get(columnId); Comparable c2 = (Comparable)((CmsListItem)o2).get(columnId); if (c1 != null) { if (c2 == null) {
/** * Returns the value of the column for this item.<p> * * @param columnId the column id * * @return the content, may be <code>null</code> * * @throws CmsIllegalArgumentException if the given <code>columnId</code> is invalid */ public Object get(String columnId) throws CmsIllegalArgumentException { if ((getMetadata().getColumnDefinition(columnId) == null) && (getMetadata().getItemDetailDefinition(columnId) == null)) { throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_LIST_INVALID_COLUMN_1, columnId)); } return m_values.get(columnId); }
/** * Returns a new list item for this list.<p> * * @param id the id of the item has to be unique * @return a new list item */ public CmsListItem newItem(String id) { return new CmsListItem(getMetadata(), id); }
/** * Returns the dummy resource object representing the "none" selection, this has to be treated specially.<p> * * @see org.opencms.workplace.list.A_CmsListResourceCollector#getResource(org.opencms.file.CmsObject, org.opencms.workplace.list.CmsListItem) */ @Override public CmsResource getResource(CmsObject cms, CmsListItem item) { // check if the item is the "dummy" item if (item.getId().equals(CmsUUID.getConstantUUID(CmsNewResourceXmlContent.VALUE_NONE + "s").getStringValue())) { for (CmsResource result : m_resources) { if (item.getId().equals(result.getStructureId().getStringValue())) { return result; } } } // all other items are real resources, use the default implementation return super.getResource(cms, item); }
/** * @see org.opencms.workplace.tools.A_CmsHtmlIconButton#isVisible() */ @Override public boolean isVisible() { String paramResource = getResource(); if (paramResource == null) { return false; } // not for offline entries if ("-1".equals(getItem().getId())) { return false; } String itemResource = getCms().getRequestContext().removeSiteRoot( (String)getItem().get(CmsHistoryList.LIST_COLUMN_RESOURCE_PATH)); return paramResource.equals(itemResource); }
/** * @see org.opencms.workplace.list.A_CmsListExplorerDialog#getListItems() */ @Override protected List getListItems() throws CmsException { List newItems = new ArrayList(); List items = super.getListItems(); Iterator itItems = items.iterator(); while (itItems.hasNext()) { CmsListItem item = (CmsListItem)itItems.next(); CmsResource resource = getResourceUtil(item).getResource(); CmsRelationType relationType = (CmsRelationType)((List)getRelationTypes().get(resource)).remove(0); String localizedRelationType = relationType.getLocalizedName(getMessages()); Map itemValues = item.getValues(); CmsListItem newItem = getList().newItem(localizedRelationType + "_" + resource.getStructureId().toString()); Iterator itItemValuesKeys = itemValues.entrySet().iterator(); while (itItemValuesKeys.hasNext()) { Map.Entry e = (Map.Entry)itItemValuesKeys.next(); String currentKey = (String)e.getKey(); newItem.set(currentKey, e.getValue()); } newItem.set(LIST_COLUMN_RELATION_TYPE, localizedRelationType); newItems.add(newItem); } return newItems; }
CmsListColumnDefinition col = li1.getMetadata().getColumnDefinition(columnId); if (col.getDirectActions().size() > 0) { String i1 = null; } else { Object o1 = li1.get(columnId); Object o2 = li2.get(columnId);
/** * Returns the value of the column for this item.<p> * * @param columnId the column id * * @return the content, may be <code>null</code> * * @throws CmsIllegalArgumentException if the given <code>columnId</code> is invalid */ public Object get(String columnId) throws CmsIllegalArgumentException { if ((getMetadata().getColumnDefinition(columnId) == null) && (getMetadata().getItemDetailDefinition(columnId) == null)) { throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_LIST_INVALID_COLUMN_1, columnId)); } return m_values.get(columnId); }
/** * Returns a new list item for this list.<p> * * @param id the id of the item has to be unique * @return a new list item */ public CmsListItem newItem(String id) { return new CmsListItem(getMetadata(), id); }
/** * Sets all needed data of the user into the list item object.<p> * * @param user the user to set the data for * @param item the list item object to set the data into */ protected void setUserData(CmsUser user, CmsListItem item) { item.set(LIST_COLUMN_LOGIN, user.getName()); item.set(LIST_COLUMN_NAME, user.getFullName()); item.set(LIST_COLUMN_EMAIL, user.getEmail()); item.set(LIST_COLUMN_LASTLOGIN, new Date(user.getLastlogin())); }
/** * @see org.opencms.workplace.tools.A_CmsHtmlIconButton#isVisible() */ @Override public boolean isVisible() { int state = ((Integer)getItem().get(LIST_COLUMN_STATE)).intValue(); return (state != STATE_PROCEED); } };
/** * @see org.opencms.workplace.list.A_CmsListResourceCollector#setAdditionalColumns(org.opencms.workplace.list.CmsListItem, org.opencms.workplace.explorer.CmsResourceUtil) */ @Override protected void setAdditionalColumns(CmsListItem item, CmsResourceUtil resUtil) { item.set(CmsSearchResultsList.LIST_COLUMN_SCORE, new Integer(getSearchResult(item.getId()).getScore())); }
/** * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions() */ @Override public void executeListSingleActions() throws IOException, ServletException { Map<String, String[]> params = new HashMap<String, String[]>(); params.put(A_CmsMessageDialog.PARAM_SESSIONIDS, new String[] {getSelectedItem().getId()}); // set action parameter to initial dialog call params.put(CmsDialog.PARAM_ACTION, new String[] {CmsDialog.DIALOG_INITIAL}); if (getParamListAction().equals(LIST_ACTION_MESSAGE) || getParamListAction().equals(LIST_DEFACTION_MESSAGE)) { getToolManager().jspForwardTool(this, "/workplace/broadcast/message", params); } else { throwListUnsupportedActionException(); } listSave(); }
/** * Restores a backed up resource version.<p> * * @throws CmsException if something goes wrong */ protected void performRestoreOperation() throws CmsException { CmsUUID structureId = new CmsUUID(getSelectedItem().get(LIST_COLUMN_STRUCTURE_ID).toString()); int version = Integer.parseInt(getSelectedItems().get(0).getId()); if (version == CmsHistoryResourceHandler.PROJECT_OFFLINE_VERSION) { // it is not possible to restore the offline version return; } CmsResource res = getCms().readResource(structureId, CmsResourceFilter.IGNORE_EXPIRATION); checkLock(getCms().getSitePath(res)); getCms().restoreResourceVersion(res.getStructureId(), version); }