}
public void validateBasicInfo(PortletDefinitionForm def, MessageContext context) {
if (StringUtils.isEmpty(def.getFname())) {
context.addMessage(new MessageBuilder().error().source("fName")
.code("please.enter.fname").build());
} else if (!FunctionalNameType.isValid(def.getFname())) {
context.addMessage(new MessageBuilder().error().source("fName")
.code("fname.invalid").build());
}
// if this is a new portlet and the fname is already taken
else if (def.getId() == null && portletDefinitionRegistry.getPortletDefinitionByFname(def.getFname()) != null) {
context.addMessage(new MessageBuilder().error().source("fName")
.code("fname.in.use").build());
}
if (StringUtils.isEmpty(def.getTitle())) {
context.addMessage(new MessageBuilder().error().source("title")
.code("please.enter.title").build());
}
if (StringUtils.isEmpty(def.getName())) {
context.addMessage(new MessageBuilder().error().source("name")
.code("please.enter.name").build());
}
// if this is a new portlet and the name is already taken
if (def.getId() == null && portletDefinitionRegistry.getPortletDefinitionByName(def.getName()) != null) {
context.addMessage(new MessageBuilder().error().source("name")
.code("name.in.use").build());
}
}