Powered By Blogger

Thursday, December 6, 2012

Branching in svn

http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-branchtag.html

Wednesday, December 5, 2012

Tuesday, December 4, 2012


Alfresco Search Examples

Refer to the search criteria examples provided in the following table to better understand how to perform content searches in Share.

To locate...Enter the search criteria...This searches...
the word banana anywhere it existsbananaor
=banana
names, titles, descriptions, blog comments, and content in all page components
Performing the search without a qualifier expands the search to include tags.
the exact phrase banana peel anywhere it exists"banana peel"names, titles, descriptions, blog comments, and content in all page components
the words banana, peel, and slipperywhere they all appear together in any order or positionbanana AND peel AND slipperynames, titles, descriptions, blog comments, and content in all page components
content containing any of the wordsbanana, peel, and slipperybanana peel slippery
or
banana OR peel OR slippery
names, titles, descriptions, blog comments, and content in all page components
the word banana where it is used in a titletitle:bananatitles in the Wiki, Blog, Document Library, Discussions, and Data List page components
the word banana where it is used in a namename:banananames of folders and content items in the Document Library page component and titles in the Wiki page component
the word banana where it is used in the descriptiondescription:bananadescriptions of folders and content items in the Document Library page component and of lists in the Data Lists page component
the word banana where it is used in site contentTEXT:bananawiki pages; blog postings and comments; content items; and discussion items and replies
content created on May 26, 2010created:"2010-05-26"wiki pages, blog postings, library folders, content items, events, links, discussion topics, and data lists, including comments made on this content
content created between May 26 and May 31, 2010created:["2010-05-26" to "2010-05-31"]wiki pages, blog postings, library folders, content items, events, links, discussion topics, and data lists, including comments made on this content
any content modified on May 26, 2010modified:"2010-05-26"wiki pages, blog postings, library folders, content items, events, links, discussion topics, and data lists, including comments made on this content
any content modified between May 26 and May 31, 2010modified:["2010-05-26" to "2010-05-31"]wiki pages, blog postings, library folders, content items, events, links, discussion topics, and data lists, including comments made on this content
any content created by a specific usercreator:username
Replace usernamewith the appropriate Share user name.
wiki pages, blog postings, library folders, content items, events, links, discussion topics, and data lists, including comments made on this content
any content modified by a specific usermodifier:username
Replace usernamewith the appropriate Share user name.
wiki pages, blog postings, library folders, content items, events, links, discussion topics, and data lists, including comments made on this content
any content containing the letter sequence useThe results returned will include references to use, user, reuse, etc.TEXT:*use*wiki pages, blog postings, library folders, content items, and discussion topics, including comments made on this content


This link is having more info

http://www.alfresco.com/help/34/enterprise/sharehelp/concepts/rm-searchsyntax-intro.html

Tuesday, November 27, 2012

Program to convert TextToPDF

package com.patil.repo.content.transform;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream;
import org.apache.pdfbox.pdmodel.font.PDSimpleFont;
import org.apache.pdfbox.pdmodel.font.PDTrueTypeFont;
import org.apache.pdfbox.pdmodel.font.PDType1Font;


/**
 * This will take a text file and ouput a pdf with that text.
 *
 * @author Ben Litchfield
 * @version $Revision: 1.4 $
 */
public class TextToPDF
{
    private int fontSize = 10;
    private PDSimpleFont font = PDType1Font.COURIER;

    /**
     * Create a PDF document with some text.
     *
     * @param text The stream of text data.
     *
     * @return The document with the text in it.
     *
     * @throws IOException If there is an error writing the data.
     */
    public PDDocument createPDFFromText( Reader text ) throws IOException
    {
        PDDocument doc = null;
        try
        {
           
            final int margin = 40;
            float height = font.getFontDescriptor().getFontBoundingBox().getHeight()/1000;

            //calculate font height and increase by 5 percent.
            height = height*fontSize*1.05f;
            doc = new PDDocument();
            BufferedReader data = new BufferedReader( text );
            String nextLine = null;
            PDPage page = new PDPage();
            PDPageContentStream contentStream = null;
            float y = -1;
           
           page.getMediaBox().setUpperRightX(500);
            // maxStringLength value needs to be increased to accomodate all the content in single line.
            float maxStringLength = page.getMediaBox().getWidth() - 2*margin;
           
            // There is a special case of creating a PDF document from an empty string.
            boolean textIsEmpty = true;
           
            boolean pagelengthset = false ;
           
           
            while( (nextLine = data.readLine()) != null )
            {
               
                if( !pagelengthset){ 
                    System.out.println("setting length first line" + (font.getStringWidth( nextLine )/1000) * fontSize);
                    page.getMediaBox().setUpperRightX(((font.getStringWidth( nextLine )/1000) * fontSize)+125);
                    maxStringLength = page.getMediaBox().getWidth() - 2*margin;
                    pagelengthset = true ;
                }
                // The input text is nonEmpty. New pages will be created and added
                // to the PDF document as they are needed, depending on the length of
                // the text.
                textIsEmpty = false;

                String[] lineWords = nextLine.split( " " );
                int lineIndex = 0;
                while( lineIndex < lineWords.length )
                {
                    StringBuffer nextLineToDraw = new StringBuffer();
                    float lengthIfUsingNextWord = 0;
                    do
                    {
                        nextLineToDraw.append( lineWords[lineIndex] );
                        nextLineToDraw.append( " " );
                        lineIndex++;
                        if( lineIndex < lineWords.length )
                        {
                            String lineWithNextWord = nextLineToDraw.toString() + lineWords[lineIndex];
                            lengthIfUsingNextWord =
                                (font.getStringWidth( lineWithNextWord )/1000) * fontSize;
                        }
                    }
                    while( lineIndex < lineWords.length &&
                           lengthIfUsingNextWord < maxStringLength );
                    if( y < margin )
                    {
                        // We have crossed the end-of-page boundary and need to extend the
                        // document by another page.
                        page = new PDPage();
                        doc.addPage( page );
                        if( contentStream != null )
                        {
                            contentStream.endText();
                            contentStream.close();
                        }
                        contentStream = new PDPageContentStream(doc, page);
                        contentStream.setFont( font, fontSize );
                       
                        contentStream.beginText();
                        y = page.getMediaBox().getHeight() - margin + height;
                        contentStream.moveTextPositionByAmount(
                            margin, y );

                    }
                    //System.out.println( "Drawing string at " + x + "," + y );

                    if( contentStream == null )
                    {
                        throw new IOException( "Error:Expected non-null content stream." );
                    }
                    contentStream.moveTextPositionByAmount( 0, -height);
                    y -= height;
                    contentStream.drawString( nextLineToDraw.toString() );
                }


            }
           
            // If the input text was the empty string, then the above while loop will have short-circuited
            // and we will not have added any PDPages to the document.
            // So in order to make the resultant PDF document readable by Adobe Reader etc, we'll add an empty page.
            if (textIsEmpty)
            {
                doc.addPage(page);
            }
           
            if( contentStream != null )
            {
                contentStream.endText();
                contentStream.close();
            }
        }
        catch( IOException io )
        {
            if( doc != null )
            {
                doc.close();
            }
            throw io;
        }
        return doc;
    }

    /**
     * This will create a PDF document with some text in it.
     *

     * see usage() for commandline
     *
     * @param args Command line arguments.
     *
     * @throws IOException If there is an error with the PDF.
     */
    public static void main(String[] args) throws IOException
    {
        TextToPDF app = new TextToPDF();
        PDDocument doc = null;
        try
        {
            if( args.length < 2 )
            {
                app.usage();
            }
            else
            {
                for( int i=0; i                {
                    if( args[i].equals( "-standardFont" ))
                    {
                        i++;
                        app.setFont( PDType1Font.getStandardFont( args[i] ));
                    }
                    else if( args[i].equals( "-ttf" ))
                    {
                        i++;
                        PDTrueTypeFont font = PDTrueTypeFont.loadTTF( doc, new File( args[i]));
                        app.setFont( font );
                    }
                    else if( args[i].equals( "-fontSize" ))
                    {
                        i++;
                        app.setFontSize( Integer.parseInt( args[i] ) );
                    }
                    else
                    {
                        throw new IOException( "Unknown argument:" + args[i] );
                    }
                }
                doc = app.createPDFFromText( new FileReader( args[args.length-1] ) );
                doc.save( args[args.length-2] );
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        finally
        {
            if( doc != null )
            {
                doc.close();
            }
        }
       
        System.out.println("Completed pdf conversion");
    }

    /**
     * This will print out a message telling how to use this example.
     */
    private void usage()
    {
        String[] std14 = PDType1Font.getStandard14Names();
        System.err.println( "usage: jar -jar pdfbox-app-x.y.z.jar TextToPDF [options] " );
        System.err.println( "    -standardFont     default:" + PDType1Font.HELVETICA.getBaseFont() );
        for( int i=0; i        {
            System.err.println( "                                    " + std14[i] );
        }
        System.err.println( "    -ttf          The TTF font to use.");
        System.err.println( "    -fontSize     default:10" );


    }
    /**
     * @return Returns the font.
     */
    public PDSimpleFont getFont()
    {
        return font;
    }
    /**
     * @param aFont The font to set.
     */
    public void setFont(PDSimpleFont aFont)
    {
        this.font = aFont;
    }
    /**
     * @return Returns the fontSize.
     */
    public int getFontSize()
    {
        return fontSize;
    }
    /**
     * @param aFontSize The fontSize to set.
     */
    public void setFontSize(int aFontSize)
    {
        this.fontSize = aFontSize;
    }
}

Wednesday, November 14, 2012

Thursday, October 18, 2012

FIle upload based on Type in share


http://tribloom.com/blogs/michael/2011/05/03/share-dynamic-forms
http://www.ixxus.com/blog/2011/09/customising-the-upload-file-dialog-box-in-alfresco-share/

http://www.ixxus.com/blog/2012/10/solr-facets-alfresco-walkthrough/