private AWEncodedString computeRecordPlaybackSemanticKey (AWRequestContext requestContext, AWComponent component,
AWEncodedString tagName, AWEncodedString name,
AWEncodedString semanticKeyFromBinding)
{
AWEncodedString semanticKey =
semanticKeyFromBinding == null ? null: semanticKeyFromBinding;
String semanticKeyString =
semanticKeyFromBinding == null ? null : semanticKeyFromBinding.string();
String nameString = null;
if (_formValuesKey != null) {
nameString = _formValuesKey.stringValue(component);
}
else {
nameString = name == null ? null : name.string();
}
String elementIdString = nameString;
if (semanticKeyString == null) {
if (tagName != null &&
_type != null &&
"input".equalsIgnoreCase(tagName.string())) {
String value = _value == null ? null : _value.stringValue(component);
if (value != null && nameString != null) {
String type = _type.stringValue(component);
if ("hidden".equalsIgnoreCase(type)) {
// In here, we have a hidden field or radio field
if (nameString.equals(AWComponentActionRequestHandler.FormSenderKey) ||
nameString.equals(AWComponentActionRequestHandler.SenderKey)) {
// element id is the form value in this case
semanticKeyString = nameString;
elementIdString = value;
}
}
else if ("radio".equalsIgnoreCase(type)) {
// element id is the form value in this case
elementIdString = value;
}
}
}
}
if (semanticKeyString == null) {
// Only tags which represent action items or form input elements need semantic keys
if (_hasFormValues || _invokeAction != null || _hasSemenaticKey) {
semanticKeyString = component._debugCompositeSemanticKey(null);
}
}
if (semanticKeyString != null) {
String semanticKeyWithPrefix = AWRecordingManager.applySemanticKeyPrefix(requestContext, semanticKeyString, null);
semanticKeyString = AWRecordingManager.registerSemanticKey(elementIdString, semanticKeyWithPrefix, requestContext);
if (semanticKey == null) {
semanticKey = AWEncodedString.sharedEncodedString(semanticKeyString);
}
else if (semanticKey != null && !semanticKey.string().equals(semanticKeyString)) {
semanticKey = AWEncodedString.sharedEncodedString(semanticKeyString);
}
}