Package org.apache.lenya.cms.repository

Examples of org.apache.lenya.cms.repository.Session


    public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
    throws ProcessingException, SAXException, IOException {
       
        Request request = ObjectModelHelper.getRequest(objectModel);
        Session session;
        try {
            session = RepositoryUtil.getSession(this.manager, request);
        } catch (RepositoryException e) {
            throw new ProcessingException(e);
        }
View Full Code Here


     * @throws ServiceException
     */
    public void testXLinkCollection() throws PublicationException, AccessControlException,
            TransactionException, ServiceException {

        Session session = login("lenya");
        DocumentFactory map = DocumentUtil.createDocumentFactory(getManager(), session);

        Publication pub = getPublication("test");

        Document collectionDoc = createCollectionDocument(pub);
View Full Code Here

     */
    public void testNotification() throws Exception {

        login("lenya");

        Session session = getFactory().getSession();

        User lenya = getAccreditableManager().getUserManager().getUser("lenya");
        User alice = getAccreditableManager().getUserManager().getUser("alice");

        Identifiable[] recipients = { alice };

        Message message = new Message(SUBJECT, new String[0], "body", new String[0], lenya,
                recipients);
        NotificationEventDescriptor descr = new NotificationEventDescriptor(message);
        RepositoryEvent event = RepositoryEventFactory.createEvent(getManager(), session,
                getLogger(), descr);

        session.enqueueEvent(event);
       
        Inbox inbox = getInbox(alice);
        cleanUp(inbox, SUBJECT);
       
        assertFalse(containsMessage(inbox, SUBJECT));
        session.commit();
        Thread.sleep(100);
        assertTrue(containsMessage(inbox, SUBJECT));
       
        cleanUp(inbox, SUBJECT);

View Full Code Here

    public void testResourceWrapper() throws RepositoryException, PublicationException,
            ServiceException, MalformedURLException, IOException, MetaDataException, AccessControlException {

        String path = "/testResource";

        Session session = login("lenya");
        DocumentFactory factory = DocumentUtil.createDocumentFactory(getManager(), session);

        Publication pub = getPublication("test");

        Document doc = createResource(factory, pub, path, getManager(), getLogger());
View Full Code Here

            Parameters _parameters) throws ProcessingException, SAXException, IOException {
        super.setup(_resolver, _objectModel, _source, _parameters);

        Request request = ObjectModelHelper.getRequest(_objectModel);
        try {
            Session session = RepositoryUtil.getSession(this.manager, request);
            DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, session);
            this.rewriter = new UrlToUuidRewriter(factory);
        } catch (final Exception e1) {
            throw new ProcessingException(e1);
        }
View Full Code Here

import org.apache.lenya.cms.repository.Session;

public class OutgoingLinkRewriterTest extends AbstractAccessControlTest {

    public void testRelativeUrls() throws Exception {
        Session session = login("lenya");
        String url = "/aaa/bbb/ccc";

        boolean ssl = false;
        boolean considerSslPolicies = false;
        boolean relativeUrls = true;
View Full Code Here

            Parameters params) throws ProcessingException, SAXException, IOException {
        super.setup(_resolver, _objectModel, _source, params);
        Request request = ObjectModelHelper.getRequest(_objectModel);

        try {
            Session session = RepositoryUtil.getSession(this.manager, request);
            DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, session);
            String webappUrl = getWebappUrl(params, objectModel);
            URLInformation info = new URLInformation(webappUrl);
            String pubId = info.getPublicationId();
            this.rewriter = new IncomingLinkRewriter(factory.getPublication(pubId));
View Full Code Here

        try {
            if (params.isParameter(PARAMETER_URLS)) {
                setUrlType(params.getParameter(PARAMETER_URLS));
            }
            Session session = RepositoryUtil.getSession(this.manager, request);
            String webappUrl = getWebappUrl(params, objectModel);
            this.rewriter = new OutgoingLinkRewriter(this.manager, session, webappUrl,
                    request.isSecure(), false, this.relativeUrls);
        } catch (final Exception e) {
            throw new RuntimeException(e);
View Full Code Here

                // Workaround:
                // We create a new session because the sitetree of the transaction doesn't yet contain
                // references to any new documents that were uploaded during the transaction.
                // See https://issues.apache.org/bugzilla/show_bug.cgi?id=47621
                Session readOnlySession = RepositoryUtil.createSession(this.manager, examinedDocument.getSession().getIdentity(), false);
                DocumentFactory newFactory = DocumentUtil.createDocumentFactory(this.manager, readOnlySession);
                LinkRewriter urlToUuidRewriter = new UrlToUuidRewriter(newFactory);

                org.w3c.dom.Document xml = DocumentHelper.readDocument(examinedDocument
                        .getInputStream());
View Full Code Here

     * The test.
     * @throws Exception
     */
    public void testUsecase() throws Exception {

        Session session = getSession();
        prepareUsecase();

        UsecaseInvoker invoker = null;
        try {
            invoker = (UsecaseInvoker) getManager().lookup(TestUsecaseInvoker.ROLE);
View Full Code Here

TOP

Related Classes of org.apache.lenya.cms.repository.Session

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.