code: protected void writeTitleProperty(CmsResource res) {
  
          String resPath = getCms().getSitePath(res);
          String currentPropertyValue = getParamPropertyValue();
          try {
              CmsProperty currentProperty = getCms().readPropertyObject(
                  resPath,
                  CmsPropertyDefinition.PROPERTY_TITLE,
                  false);
              // detect if property is a null property or not
              if (currentProperty.isNullProperty()) {
                  // create new property object and set key and value
                  currentProperty = new CmsProperty();
                  currentProperty.setName(CmsPropertyDefinition.PROPERTY_TITLE);
                  if (OpenCms.getWorkplaceManager().isDefaultPropertiesOnStructure()) {
                      // set structure value
                      currentProperty.setStructureValue(currentPropertyValue);
                      currentProperty.setResourceValue(null);
                  } else {
                      // set resource value
                      currentProperty.setStructureValue(null);
                      currentProperty.setResourceValue(currentPropertyValue);
                  }
              } else if (currentProperty.getStructureValue() != null) {
                  // structure value has to be updated
                  currentProperty.setStructureValue(currentPropertyValue);
                  currentProperty.setResourceValue(null);
              } else {
                  // resource value has to be updated
                  currentProperty.setStructureValue(null);
                  currentProperty.setResourceValue(currentPropertyValue);
              }
              CmsLock lock = getCms().getLock(res);
              if (lock.isUnlocked()) {
                  // lock resource before operation
                  getCms().lockResource(resPath);
              }
              // write the property to the resource
              getCms().writePropertyObject(resPath, currentProperty);
              // unlock the resource
              getCms().unlockResource(resPath);
          } catch (CmsException e) {
              // writing the property failed, log error
              LOG.error(e.getLocalizedMessage(), e);
          }
      }
docs: Changes the value of the property title for the specified resource.<p>
  
  @param res the resource to change the property value