private void updateProperties(
        CmsObject cms,
        CmsResource ownRes,
        CmsResource defaultFileRes,
        List<CmsPropertyModification> propertyModifications)
    throws CmsException {

        Map<String, CmsProperty> ownProps = getPropertiesByName(cms.readPropertyObjects(ownRes, false));
        // determine if the title property should be changed in case of a 'NavText' change
        boolean changeOwnTitle = shouldChangeTitle(ownProps);

        boolean changeDefaultFileTitle = false;
        Map<String, CmsProperty> defaultFileProps = Maps.newHashMap();
        if (defaultFileRes != null) {
            defaultFileProps = getPropertiesByName(cms.readPropertyObjects(defaultFileRes, false));
            // determine if the title property of the default file should be changed
            changeDefaultFileTitle = shouldChangeDefaultFileTitle(
                defaultFileProps,
                ownProps.get(CmsPropertyDefinition.PROPERTY_NAVTEXT));
        }
        String hasNavTextChange = null;
        List<CmsProperty> ownPropertyChanges = new ArrayList<CmsProperty>();
        List<CmsProperty> defaultFilePropertyChanges = new ArrayList<CmsProperty>();
        for (CmsPropertyModification propMod : propertyModifications) {
            CmsProperty propToModify = null;
            if (ownRes.getStructureId().equals(propMod.getId())) {

                if (CmsPropertyDefinition.PROPERTY_NAVTEXT.equals(propMod.getName())) {
                    hasNavTextChange = propMod.getValue();
                } else if (CmsPropertyDefinition.PROPERTY_TITLE.equals(propMod.getName())) {
                    changeOwnTitle = false;
                }
                propToModify = ownProps.get(propMod.getName());
                if (propToModify == null) {
                    propToModify = new CmsProperty(propMod.getName(), null, null);
                }
                ownPropertyChanges.add(propToModify);
            } else {
                if (CmsPropertyDefinition.PROPERTY_TITLE.equals(propMod.getName())) {
                    changeDefaultFileTitle = false;
                }
                propToModify = defaultFileProps.get(propMod.getName());
                if (propToModify == null) {
                    propToModify = new CmsProperty(propMod.getName(), null, null);
                }
                defaultFilePropertyChanges.add(propToModify);
            }

            String newValue = propMod.getValue();
            if (newValue == null) {
                newValue = "";
            }
            if (propMod.isStructureValue()) {
                propToModify.setStructureValue(newValue);
            } else {
                propToModify.setResourceValue(newValue);
            }
        }
        if (hasNavTextChange != null) {
            if (changeOwnTitle) {
                CmsProperty titleProp = ownProps.get(CmsPropertyDefinition.PROPERTY_TITLE);
                if (titleProp == null) {
                    titleProp = new CmsProperty(CmsPropertyDefinition.PROPERTY_TITLE, null, null);
                }
                titleProp.setStructureValue(hasNavTextChange);
                ownPropertyChanges.add(titleProp);
            }
            if (changeDefaultFileTitle) {
                CmsProperty titleProp = defaultFileProps.get(CmsPropertyDefinition.PROPERTY_TITLE);
                if (titleProp == null) {
                    titleProp = new CmsProperty(CmsPropertyDefinition.PROPERTY_TITLE, null, null);
                }
                titleProp.setStructureValue(hasNavTextChange);
                defaultFilePropertyChanges.add(titleProp);
            }
        }
        if (!ownPropertyChanges.isEmpty()) {
            cms.writePropertyObjects(ownRes, ownPropertyChanges);
        }
        if (!defaultFilePropertyChanges.isEmpty() && (defaultFileRes != null)) {
            cms.writePropertyObjects(defaultFileRes, defaultFilePropertyChanges);
        }
    }
private void updateProperties ( CmsObject cms , CmsResource ownRes , CmsResource defaultFileRes , List < CmsPropertyModification > propertyModifications ) throws CmsException { Map < String , CmsProperty > ownProps = getPropertiesByName ( cms . readPropertyObjects ( ownRes , false ) ) ; boolean changeOwnTitle = shouldChangeTitle ( ownProps ) ; boolean changeDefaultFileTitle = false ; Map < String , CmsProperty > defaultFileProps = Maps . newHashMap ( ) ; if ( defaultFileRes != null ) { defaultFileProps = getPropertiesByName ( cms . readPropertyObjects ( defaultFileRes , false ) ) ; changeDefaultFileTitle = shouldChangeDefaultFileTitle ( defaultFileProps , ownProps . get ( CmsPropertyDefinition . PROPERTY_NAVTEXT ) ) ; } String hasNavTextChange = null ; List < CmsProperty > ownPropertyChanges = new ArrayList < CmsProperty > ( ) ; List < CmsProperty > defaultFilePropertyChanges = new ArrayList < CmsProperty > ( ) ; for ( CmsPropertyModification propMod : propertyModifications ) { CmsProperty propToModify = null ; if ( ownRes . getStructureId ( ) . equals ( propMod . getId ( ) ) ) { if ( CmsPropertyDefinition . PROPERTY_NAVTEXT . equals ( propMod . getName ( ) ) ) { hasNavTextChange = propMod . getValue ( ) ; } else if ( CmsPropertyDefinition . PROPERTY_TITLE . equals ( propMod . getName ( ) ) ) { changeOwnTitle = false ; } propToModify = ownProps . get ( propMod . getName ( ) ) ; if ( propToModify == null ) { propToModify = new CmsProperty ( propMod . getName ( ) , null , null ) ; } ownPropertyChanges . add ( propToModify ) ; } else { if ( CmsPropertyDefinition . PROPERTY_TITLE . equals ( propMod . getName ( ) ) ) { changeDefaultFileTitle = false ; } propToModify = defaultFileProps . get ( propMod . getName ( ) ) ; if ( propToModify == null ) { propToModify = new CmsProperty ( propMod . getName ( ) , null , null ) ; } defaultFilePropertyChanges . add ( propToModify ) ; } String newValue = propMod . getValue ( ) ; if ( newValue == null ) { newValue = "" ; } if ( propMod . isStructureValue ( ) ) { propToModify . setStructureValue ( newValue ) ; } else { propToModify . setResourceValue ( newValue ) ; } } if ( hasNavTextChange != null ) { if ( changeOwnTitle ) { CmsProperty titleProp = ownProps . get ( CmsPropertyDefinition . PROPERTY_TITLE ) ; if ( titleProp == null ) { titleProp = new CmsProperty ( CmsPropertyDefinition . PROPERTY_TITLE , null , null ) ; } titleProp . setStructureValue ( hasNavTextChange ) ; ownPropertyChanges . add ( titleProp ) ; } if ( changeDefaultFileTitle ) { CmsProperty titleProp = defaultFileProps . get ( CmsPropertyDefinition . PROPERTY_TITLE ) ; if ( titleProp == null ) { titleProp = new CmsProperty ( CmsPropertyDefinition . PROPERTY_TITLE , null , null ) ; } titleProp . setStructureValue ( hasNavTextChange ) ; defaultFilePropertyChanges . add ( titleProp ) ; } } if ( ! ownPropertyChanges . isEmpty ( ) ) { cms . writePropertyObjects ( ownRes , ownPropertyChanges ) ; } if ( ! defaultFilePropertyChanges . isEmpty ( ) && ( defaultFileRes != null ) ) { cms . writePropertyObjects ( defaultFileRes , defaultFilePropertyChanges ) ; } }
Updates properties for a resource and possibly its detail page.<p>

@param cms the CMS context
@param ownRes the resource
@param defaultFileRes the default file resource (possibly null)
@param propertyModifications the property modifications

@throws CmsException if something goes wrong