String type = ls.getType();
if (type != null && type.startsWith(Constants.LEGACY_NS))
type = Constants.NS + type.substring(Constants.LEGACY_NS.length());
if (ls.isChannel()) {
ChannelDefinition channelDef = crs.getChannelDefinition(ls.getChanId());
if (channelDef != null && channelApproved(channelDef.getApprovalDate())) {
if (localeAware) {
channelDef.setLocale(ls.getLocale()); // for i18n by Shoji
}
structure = channelDef.getDocument(doc, channelPrefix + ls.getStructId());
} else {
// Create an error channel if channel is missing or not approved
ChannelDefinition cd = new ChannelDefinition(ls.getChanId());
cd.setTitle("Missing channel");
cd.setName("Missing channel");
cd.setTimeout(20000);
String missingChannel = "Unknown";
if (channelDef != null) {
missingChannel = channelDef.getName();
}
structure = cd.getDocument(doc, channelPrefix + ls.getStructId(),
"The '" + missingChannel + "' channel is no longer available. " +
"Please remove it from your layout.",
ErrorCode.CHANNEL_MISSING_EXCEPTION.getCode());
}
} else