/** * Returns the name of this property.<p> * * @return name of this property * * @deprecated use {@link #getName()} instead */ public String getKey() { return getName(); }
/** * Stores a collection of properties in a map, with the property names as keys.<p> * * @param properties the properties to store in the map * * @return the map with the property names as keys and the property objects as values */ public static Map<String, CmsProperty> toObjectMap(Iterable<CmsProperty> properties) { Map<String, CmsProperty> result = new LinkedHashMap<String, CmsProperty>(); for (CmsProperty property : properties) { result.put(property.getName(), property); } return result; }
/** * Converts a list of properties to a map.<p> * * @param properties the list of properties * * @return a map from property names to properties */ protected Map<String, CmsProperty> getPropertiesByName(List<CmsProperty> properties) { Map<String, CmsProperty> result = new HashMap<String, CmsProperty>(); for (CmsProperty property : properties) { String key = property.getName(); result.put(key, property.clone()); } return result; }
/** * Converts a list of properties to a map.<p> * * @param properties the list of properties * * @return a map from property names to properties */ protected Map<String, CmsProperty> getPropertiesByName(List<CmsProperty> properties) { Map<String, CmsProperty> result = new HashMap<String, CmsProperty>(); for (CmsProperty property : properties) { String key = property.getName(); result.put(key, property.clone()); } return result; }
/** * Converts a sequence of properties to a map of client-side property beans.<p> * * @param props the sequence of properties * @param preserveOrigin if true, the origin of the properties should be copied to the client properties * * @return the map of client properties * */ static Map<String, CmsClientProperty> createClientProperties(Iterable<CmsProperty> props, boolean preserveOrigin) { Map<String, CmsClientProperty> result = new HashMap<String, CmsClientProperty>(); for (CmsProperty prop : props) { CmsClientProperty clientProp = createClientProperty(prop, preserveOrigin); result.put(prop.getName(), clientProp); } return result; }
Set keyValidationSet = new HashSet(); CmsProperty property = (CmsProperty)properties.get(i); if (!keyValidationSet.contains(property.getName())) { keyValidationSet.add(property.getName()); } else { throw new CmsVfsException(Messages.get().container( Messages.ERR_VFS_INVALID_PROPERTY_LIST_1, property.getName()));
/** * Converts CmsProperty objects to CmsClientProperty objects.<p> * * @param properties a list of server-side properties * * @return a map of client-side properties */ protected Map<String, CmsClientProperty> convertProperties(List<CmsProperty> properties) { Map<String, CmsClientProperty> result = new HashMap<String, CmsClientProperty>(); for (CmsProperty prop : properties) { CmsClientProperty clientProp = new CmsClientProperty( prop.getName(), prop.getStructureValue(), prop.getResourceValue()); clientProp.setOrigin(prop.getOrigin()); result.put(clientProp.getName(), clientProp); } return result; }
/** * Creates a client property bean from a server-side property.<p> * * @param prop the property from which to create the client property * @param preserveOrigin if true, the origin will be copied into the new object * * @return the new client property */ public static CmsClientProperty createClientProperty(CmsProperty prop, boolean preserveOrigin) { CmsClientProperty result = new CmsClientProperty( prop.getName(), prop.getStructureValue(), prop.getResourceValue()); if (preserveOrigin) { result.setOrigin(prop.getOrigin()); } return result; }
CmsProperty property = (CmsProperty)p.next(); Element propertyNode = propertiesNode.addElement(N_PROPERTY); propertyNode.addElement(N_NAME).addText(property.getName()); if (property.getStructureValue() != null) { propertyNode.addElement(N_VALUE).addCDATA(property.getStructureValue());
property.getName(), dbc.currentProject(), resource);
/** * Writes a property for a specified resource.<p> * * @param context the current request context * @param resource the resource to write the property for * @param property the property to write * * @throws CmsException if something goes wrong * @throws CmsSecurityException if the user has insufficient permission for the given resource ({@link CmsPermissionSet#ACCESS_WRITE} required) * * @see CmsObject#writePropertyObject(String, CmsProperty) * @see org.opencms.file.types.I_CmsResourceType#writePropertyObject(CmsObject, CmsSecurityManager, CmsResource, CmsProperty) */ public void writePropertyObject(CmsRequestContext context, CmsResource resource, CmsProperty property) throws CmsException, CmsSecurityException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkOfflineProject(dbc); checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_WRITE, true, CmsResourceFilter.IGNORE_EXPIRATION); m_driverManager.writePropertyObject(dbc, resource, property); } catch (Exception e) { dbc.report( null, Messages.get().container(Messages.ERR_WRITE_PROP_2, property.getName(), context.getSitePath(resource)), e); } finally { dbc.clear(); } }
/** * Writes a property for a specified resource.<p> * * @param context the current request context * @param resource the resource to write the property for * @param property the property to write * * @throws CmsException if something goes wrong * @throws CmsSecurityException if the user has insufficient permission for the given resource ({@link CmsPermissionSet#ACCESS_WRITE} required) * * @see CmsObject#writePropertyObject(String, CmsProperty) * @see org.opencms.file.types.I_CmsResourceType#writePropertyObject(CmsObject, CmsSecurityManager, CmsResource, CmsProperty) */ public void writePropertyObject(CmsRequestContext context, CmsResource resource, CmsProperty property) throws CmsException, CmsSecurityException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkOfflineProject(dbc); checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_WRITE, true, CmsResourceFilter.IGNORE_EXPIRATION); m_driverManager.writePropertyObject(dbc, resource, property); } catch (Exception e) { dbc.report(null, Messages.get().container( Messages.ERR_WRITE_PROP_2, property.getName(), context.getSitePath(resource)), e); } finally { dbc.clear(); } }
CmsProperty property = cms.readPropertyObject(resource, propertyName, false); if (!property.isNullProperty()) { props.put(property.getName(), property.getValue()); } else { props.put(propertyName, null);
for (CmsProperty prop : properties) { CmsClientProperty clientProp = CmsVfsSitemapService.createClientProperty(prop, false); clientProperties.put(prop.getName(), clientProp);