this.languageType = languageType;
}
protected void onPaste(boolean isPrivate) {
PasteItem pasteItem = PasteForm.this.getModelObject();
if (pasteItem.getContent() == null || pasteItem.getContent().equals("")) {
error("Paste content is required!");
feedbackContainer.setVisible(true);
return;
}
if (getSpamEmail() != null || StringUtils.hasSpamKeywords(pasteItem.getContent())) {
error("Spam Spam Spam Spam");
feedbackContainer.setVisible(true);
return;
}
if(originalPaste!=null) {
pasteItem.setParent(originalPaste.getObject().getItemId());
}
pasteItem.setPrivate(isPrivate);
System.out.println("isPrivate:" + isPrivate);
pasteItem.setType(getLanguageType() != null ? getLanguageType().getLanguage() : "text");
pasteItem.setClientIp(getClientIpAddress());
logger.info("New " + pasteItem.getContent() + " line " + (isPrivate ? "private" : "public") + " paste created with IP:" + getClientIpAddress() + " language set at:" + pasteItem.getType());
pasteService.createItem(pasteItem);
PageParameters params = new PageParameters();
if (pasteItem.isPrivate()) {
params.add("0", pasteItem.getItemId());
setResponsePage(ViewPrivatePage.class, params);
} else {
params.add("0", pasteItem.getItemId());
setResponsePage(ViewPublicPage.class, params);
}
}