// so, we remove the Visible and replace with a RestrictAccess
ChromatticSession chromatticSession = session.getManager().getLifeCycle().getContext().getSession();
if (sourceNav.isAdapted(Visible.class)) {
chromatticSession.remove(sourceNav.adapt(Visible.class));
}
RestrictAccess restrictAccess = chromatticSession.create(RestrictAccess.class);
chromatticSession.setEmbedded(sourceNav, RestrictAccess.class, restrictAccess);
}
//
RestrictAccess restrictAccess = sourceNav.adapt(RestrictAccess.class);
restrictAccess.setVisibility(state.getVisibility());
restrictAccess.setStartPublicationDate(state.getStartPublicationDate());
restrictAccess.setEndPublicationDate(state.getEndPublicationDate());
restrictAccess.setRestrictOutsidePublicationWindow(state.isRestrictOutsidePublicationWindow());
// Sync the attributes
Attributes attrs = sourceNav.getAttributes();
AttributesState.sync(state.getAttributesState(), CUSTOM_NODE_ATTRIBUTE_PREFIX, attrs);
attrs.setValue(MappedAttributes.ICON, state.getIcon());