public static NavigationalContext createNavigationalContextOrNull(StateString navigationalState, Map<String, String[]> publicNavigationalState)
{
if (navigationalState != null || publicNavigationalState != null)
{
NavigationalContext context = new NavigationalContext();
if (navigationalState != null)
{
String state = navigationalState.getStringValue();
if (!StateString.JBPNS_PREFIX.equals(state)) // fix-me: see JBPORTAL-900
{
context.setOpaqueValue(state);
}
}
if (ParameterValidation.existsAndIsNotEmpty(publicNavigationalState))
{
// todo: public NS GTNWSRP-38
for (Map.Entry<String, String[]> entry : publicNavigationalState.entrySet())
{
String name = entry.getKey();
for (String value : entry.getValue())
{
context.getPublicValues().add(WSRPTypeFactory.createNamedString(name, value));
}
}
}
return context;