Examples of PasteItem


Examples of com.mysticcoders.mysticpaste.model.PasteItem

        HibernateUnitils.assertMappingWithDatabaseConsistent();
    }

    @Test
    public void testCreateAndRetrieve() {
        PasteItem paste = new PasteItem();
        paste.setContent("TEST-DATA");
        paste.setType("text");

        String id = svc.createItem(paste);
        System.out.println(id);
        PasteItem item2 = svc.getItem(id);

        assertEquals(item2.getContent(), paste.getContent());
//        assertEquals(item2.getClientToken(), paste.getClientToken());

    }
View Full Code Here

Examples of com.mysticcoders.mysticpaste.model.PasteItem

        if(!params.get("0").isNull()) {
            originalPaste = new ViewPasteModel(params.get("0").toString(), pasteService);
            add(new PasteForm("pasteForm", new CompoundPropertyModel<PasteItem>(originalPaste)));
        } else {
            add(new PasteForm("pasteForm", new CompoundPropertyModel<PasteItem>(new PasteItem())));
        }

        add(new Spin());
    }
View Full Code Here

Examples of com.mysticcoders.mysticpaste.model.PasteItem

            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);
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.