protected final Action newCreateKeyAction() {
return new Action("create") {
protected Object doAction(Object... params) {
SSLKey key = (SSLKey) params[0];
if ((key.getId() == null) || (key.getId().equals(""))) {
key.setId(UUID.randomUUID().toString());
}
if (key.getContent() == null || key.getContent().isEmpty()) {
throw new IllegalArgumentException("Must include content when creating a key");
}
if(key.getDisplayName() == null || key.getDisplayName().isEmpty()) {
throw new IllegalArgumentException("Must include a display name when creating a key");
}
if(LOG.isDebugEnabled())
LOG.debug("Creating SSLKey ID:", key.getId());
// Convert the provisioning object to the true model object
com.alu.e3.data.model.Key modelKey = BeanConverterUtil.toDataModel(key);
dataManager.addKey(modelKey);
SSLKeyResponse response = new SSLKeyResponse(SSLKeyResponse.SUCCESS);
response.setId(key.getId());
return response;
}
};
}