Package org.internna.iwebmvc.model

Examples of org.internna.iwebmvc.model.Link


    @Autowired private LinkParser linkParser;
    @Autowired private DAO baseDao;

    @Before
    public void init() throws Exception {
        Link link = new Link();
        link.setReadableText(new I18nText());
        link.getReadableText().add(new Locale("en"), "hi");
        link.getReadableText().add(new Locale("es"), "hola");
        link.setUrl("http://localhost/application");
        link.setTooltipText(new I18nText());
        link.getTooltipText().add(new Locale("en"), "hi");
        link.getTooltipText().add(new Locale("es"), "hola");
        baseDao.create(link);
    }
View Full Code Here


    }

    @Test
    public void testParse() {
        assertNull(linkParser.parse(null));
        Link link = new Link();
        assertEquals(link, linkParser.parse(link));
        Link unique = baseDao.first(Link.class);
        link.setId(unique.getId());
        link = linkParser.parse(link);
        assertNull(link.getReadableText());
        assertNull(link.getTooltipText());
        link = new Link();
        link.setId(unique.getId());
        link.setReadableText(new I18nText());
        link.getReadableText().add(new Locale("en"), "new");
        link.getReadableText().add(new Locale("es"), "nuevo");
        link.setTooltipText(new I18nText());
        link.getTooltipText().add(new Locale("en"), "tooltip");
        link.getTooltipText().add(new Locale("es"), "etiqueta");
        link = linkParser.parse(link);
        assertEquals(link.getReadableText().getId(), unique.getReadableText().getId());
        assertEquals("new", link.getReadableText().getData().get(0).getTranslation());
        assertEquals(link.getTooltipText().getId(), unique.getTooltipText().getId());
        assertEquals("etiqueta", link.getTooltipText().getData().get(1).getTranslation());
    }
View Full Code Here

    @Autowired private MockUserManager userManager;
    private RemoteEntityManagerImpl impl = new RemoteEntityManagerImpl();

    @Before
    public void init() throws Exception {
        Link l = new Link();
        l.setReadableText(new I18nText());
        l.getReadableText().add(Locale.CANADA, "a");
        l.setTooltipText(new I18nText());
        l.getReadableText().add(Locale.UK, "b");
        l.setUrl("http://www.google.com");
        dao.create(l);
        generatedID = l.getId();
        securityDAO.createAuthority("registered_user");
        UserImpl john = new UserImpl();
        john.setUsername("john");
        john.setName("Jopn Smith");
        john.setPassword("john");
View Full Code Here

            Person m = new Person();
            m.setName(new Name());
            m.getName().setName("John Smith");
            m.setSex(sex.get(0));
            m.setPhotos(new MultiDocument().addDocument(photoJohn).addDocument(house).addDocument(car).addDocument(dog));
            m.setBlog(new Link());
            m.getBlog().setReadableText(new I18nText());
            m.getBlog().getReadableText().add(new Locale("en"), "My tech blog");
            m.getBlog().getReadableText().add(new Locale("es"), "Mi blog de tecnolog�a");
            m.getBlog().setUrl("http://internna.blogspot.com");
            m.getBlog().setTooltipText(new I18nText());
View Full Code Here

    }

    @Override
    public Link parse(Link link) {
        if ((link != null) && (link.getId() != null)) {
            Link old = getDao().find(Link.class, link.getId());
            old.setUrl(link.getUrl());
            old.setRel(link.getRel());
            if (link.getReadableText() != null) {
                for (int index = 0; index < old.getReadableText().getData().size();index++)
                    old.getReadableText().getData().get(index).setTranslation(link.getReadableText().getData().get(index).getTranslation());
            } else if (old.getReadableText() != null)
                old.setReadableText(null);
            if (link.getTooltipText() != null) {
                if (old.getTooltipText() == null)
                    old.setTooltipText(link.getTooltipText());
                else {
                    for (int index = 0; index < old.getTooltipText().getData().size();index++)
                        old.getTooltipText().getData().get(index).setTranslation(link.getTooltipText().getData().get(index).getTranslation());
                }
            } else old.setTooltipText(null);
            return old;
        }
        return link;
    }
View Full Code Here

TOP

Related Classes of org.internna.iwebmvc.model.Link

Copyright © 2018 www.massapicom. 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.