Package org.uberfire.java.nio.base.version

Examples of org.uberfire.java.nio.base.version.VersionAttributeView


            final org.uberfire.java.nio.file.Path path = Paths.convert( resource );

            final DublinCoreView dcoreView = ioService.getFileAttributeView( path, DublinCoreView.class );
            final DiscussionView discussView = ioService.getFileAttributeView( path, DiscussionView.class );
            final OtherMetaView otherMetaView = ioService.getFileAttributeView( path, OtherMetaView.class );
            final VersionAttributeView versionAttributeView = ioService.getFileAttributeView( path, VersionAttributeView.class );

            return MetadataBuilder.newMetadata()
                    .withPath( Paths.convert( path.toRealPath() ) )
                    .withCheckinComment( versionAttributeView.readAttributes().history().records().size() > 0 ? versionAttributeView.readAttributes().history().records().get( versionAttributeView.readAttributes().history().records().size() - 1 ).comment() : null )
                    .withLastContributor( versionAttributeView.readAttributes().history().records().size() > 0 ? versionAttributeView.readAttributes().history().records().get( versionAttributeView.readAttributes().history().records().size() - 1 ).author() : null )
                    .withCreator( versionAttributeView.readAttributes().history().records().size() > 0 ? versionAttributeView.readAttributes().history().records().get( 0 ).author() : null )
                    .withLastModified( new Date( versionAttributeView.readAttributes().lastModifiedTime().toMillis() ) )
                    .withDateCreated( new Date( versionAttributeView.readAttributes().creationTime().toMillis() ) )
                    .withSubject( dcoreView.readAttributes().subjects().size() > 0 ? dcoreView.readAttributes().subjects().get( 0 ) : null )
                    .withType( dcoreView.readAttributes().types().size() > 0 ? dcoreView.readAttributes().types().get( 0 ) : null )
                    .withExternalRelation( dcoreView.readAttributes().relations().size() > 0 ? dcoreView.readAttributes().relations().get( 0 ) : null )
                    .withExternalSource( dcoreView.readAttributes().sources().size() > 0 ? dcoreView.readAttributes().sources().get( 0 ) : null )
                    .withDescription( dcoreView.readAttributes().descriptions().size() > 0 ? dcoreView.readAttributes().descriptions().get( 0 ) : null )
                    .withCategories( otherMetaView.readAttributes().categories() )
                    .withDiscussion( discussView.readAttributes().discussion() )
                    .withVersion( new ArrayList<VersionRecord>( versionAttributeView.readAttributes().history().records().size() ) {{
                        for ( final VersionRecord record : versionAttributeView.readAttributes().history().records() ) {
                            add( new PortableVersionRecord( record.id(), record.author(), record.email(), record.comment(), record.date(), record.uri() ) );
                        }
                    }} )
                    .build();
View Full Code Here


            final org.uberfire.java.nio.file.Path path = Paths.convert( resource );

            final DublinCoreView dcoreView = ioService.getFileAttributeView( path, DublinCoreView.class );
            final DiscussionView discussView = ioService.getFileAttributeView( path, DiscussionView.class );
            final OtherMetaView otherMetaView = ioService.getFileAttributeView( path, OtherMetaView.class );
            final VersionAttributeView versionAttributeView = ioService.getFileAttributeView( path, VersionAttributeView.class );

            return MetadataBuilder.newMetadata()
                    .withPath( Paths.convert( path.toRealPath() ) )
                    .withCheckinComment( versionAttributeView.readAttributes().history().records().size() > 0 ? versionAttributeView.readAttributes().history().records().get( versionAttributeView.readAttributes().history().records().size() - 1 ).comment() : null )
                    .withLastContributor( versionAttributeView.readAttributes().history().records().size() > 0 ? versionAttributeView.readAttributes().history().records().get( versionAttributeView.readAttributes().history().records().size() - 1 ).author() : null )
                    .withCreator( versionAttributeView.readAttributes().history().records().size() > 0 ? versionAttributeView.readAttributes().history().records().get( 0 ).author() : null )
                    .withLastModified( new Date( versionAttributeView.readAttributes().lastModifiedTime().toMillis() ) )
                    .withDateCreated( new Date( versionAttributeView.readAttributes().creationTime().toMillis() ) )
                    .withSubject( dcoreView.readAttributes().subjects().size() > 0 ? dcoreView.readAttributes().subjects().get( 0 ) : null )
                    .withType( dcoreView.readAttributes().types().size() > 0 ? dcoreView.readAttributes().types().get( 0 ) : null )
                    .withExternalRelation( dcoreView.readAttributes().relations().size() > 0 ? dcoreView.readAttributes().relations().get( 0 ) : null )
                    .withExternalSource( dcoreView.readAttributes().sources().size() > 0 ? dcoreView.readAttributes().sources().get( 0 ) : null )
                    .withDescription( dcoreView.readAttributes().descriptions().size() > 0 ? dcoreView.readAttributes().descriptions().get( 0 ) : null )
                    .withCategories( otherMetaView.readAttributes().categories() )
                    .withDiscussion( discussView.readAttributes().discussion() )
                    .withVersion( new ArrayList<VersionRecord>( versionAttributeView.readAttributes().history().records().size() ) {{
                        for ( final VersionRecord record : versionAttributeView.readAttributes().history().records() ) {
                            add( new PortableVersionRecord( record.id(), record.author(), record.email(), record.comment(), record.date(), record.uri() ) );
                        }
                    }} )
                    .build();
View Full Code Here

            final org.uberfire.java.nio.file.Path path = Paths.convert( resource );

            final DublinCoreView dcoreView = ioService.getFileAttributeView( path, DublinCoreView.class );
            final DiscussionView discussView = ioService.getFileAttributeView( path, DiscussionView.class );
            final OtherMetaView otherMetaView = ioService.getFileAttributeView( path, OtherMetaView.class );
            final VersionAttributeView versionAttributeView = ioService.getFileAttributeView( path, VersionAttributeView.class );

            return MetadataBuilder.newMetadata()
                    .withPath( Paths.convert( path.toRealPath() ) )
                    .withCheckinComment( versionAttributeView.readAttributes().history().records().size() > 0 ? versionAttributeView.readAttributes().history().records().get( versionAttributeView.readAttributes().history().records().size() - 1 ).comment() : null )
                    .withLastContributor( versionAttributeView.readAttributes().history().records().size() > 0 ? versionAttributeView.readAttributes().history().records().get( versionAttributeView.readAttributes().history().records().size() - 1 ).author() : null )
                    .withCreator( versionAttributeView.readAttributes().history().records().size() > 0 ? versionAttributeView.readAttributes().history().records().get( 0 ).author() : null )
                    .withLastModified( new Date( versionAttributeView.readAttributes().lastModifiedTime().toMillis() ) )
                    .withDateCreated( new Date( versionAttributeView.readAttributes().creationTime().toMillis() ) )
                    .withSubject( dcoreView.readAttributes().subjects().size() > 0 ? dcoreView.readAttributes().subjects().get( 0 ) : null )
                    .withType( dcoreView.readAttributes().types().size() > 0 ? dcoreView.readAttributes().types().get( 0 ) : null )
                    .withExternalRelation( dcoreView.readAttributes().relations().size() > 0 ? dcoreView.readAttributes().relations().get( 0 ) : null )
                    .withExternalSource( dcoreView.readAttributes().sources().size() > 0 ? dcoreView.readAttributes().sources().get( 0 ) : null )
                    .withDescription( dcoreView.readAttributes().descriptions().size() > 0 ? dcoreView.readAttributes().descriptions().get( 0 ) : null )
                    .withCategories( otherMetaView.readAttributes().categories() )
                    .withDiscussion( discussView.readAttributes().discussion() )
                    .withVersion( new ArrayList<VersionRecord>( versionAttributeView.readAttributes().history().records().size() ) {{
                        for ( final VersionRecord record : versionAttributeView.readAttributes().history().records() ) {
                            add( new PortableVersionRecord( record.id(), record.author(), record.email(), record.comment(), record.date(), record.uri() ) );
                        }
                    }} )
                    .build();
View Full Code Here

    }

    @Override
    public List<VersionRecord> getRepositoryHistory( String alias, int startIndex, int endIndex ) {
        final Repository repo = getRepository( alias );
        final VersionAttributeView versionAttributeView = ioService.getFileAttributeView( convert( repo.getRoot() ), VersionAttributeView.class );
        final List<VersionRecord> records = versionAttributeView.readAttributes().history().records();

        if ( startIndex < 0 ) {
            startIndex = 0;
        }
        if ( endIndex < 0 || endIndex > records.size()) {
View Full Code Here

    }

    @Override
    public List<VersionRecord> getRepositoryHistory( String alias, int startIndex, int endIndex ) {
        final Repository repo = getRepository( alias );
        final VersionAttributeView versionAttributeView = ioService.getFileAttributeView( convert( repo.getRoot() ), VersionAttributeView.class );
        final List<VersionRecord> records = versionAttributeView.readAttributes().history().records();

        if ( startIndex < 0 ) {
            startIndex = 0;
        }
        if ( endIndex < 0 || endIndex > records.size()) {
View Full Code Here

        Path branchPath = ioService.get(URI.create("git://" + branchName + "@" + gitRepo));

        if (compareToBranchName != null) {
            Path compareToBranchPath = ioService.get(URI.create("git://" + compareToBranchName + "@" + gitRepo));
            VersionAttributeView compareView = ioService.getFileAttributeView( compareToBranchPath, VersionAttributeView.class );
            List<VersionRecord> compareLogs = compareView.readAttributes().history().records();

            for (VersionRecord ccommit : compareLogs) {
                if (startCommitDate != null && startCommitDate.after(ccommit.date())) {
                    break;
                }
                existingCommits.add(ccommit.id());
            }
        }

        VersionAttributeView vinit = ioService.getFileAttributeView( branchPath, VersionAttributeView.class );
        List<VersionRecord> logs = vinit.readAttributes().history().records();

        List<CommitInfo> commits = new ArrayList<CommitInfo>();
        JGitFileSystem fs = (JGitFileSystem)ioService.getFileSystem(branchPath.toUri());
        Collections.reverse(logs);
View Full Code Here

                    ouName = ou.getName();
                }
            }
        }

        final VersionAttributeView versionAttributeView = ioService.getFileAttributeView( convert( repo.getRoot() ), VersionAttributeView.class );
        final List<VersionRecord> records = versionAttributeView.readAttributes().history().records();
        Collections.reverse( records );

        return new RepositoryInfo( alias, ouName, repo.getRoot(), repo.getPublicURIs(), new ArrayList<VersionRecord>( HISTORY_PAGE_SIZE ) {{
            int size = 0;
            for ( final VersionRecord record : records ) {
View Full Code Here

    @Override
    public List<VersionRecord> getRepositoryHistory( final String alias,
                                                     final int startIndex ) {
        final Repository repo = getRepository( alias );

        final VersionAttributeView versionAttributeView = ioService.getFileAttributeView( convert( repo.getRoot() ), VersionAttributeView.class );

        final List<VersionRecord> records = versionAttributeView.readAttributes().history().records();

        if ( records.size() <= startIndex ) {
            return Collections.emptyList();
        }
View Full Code Here

        Path path = Paths.convert( _path );
        final DirectoryStream<Path> stream = ioService.newDirectoryStream( path );

        for ( final Path activePath : stream ) {
            final VersionAttributeView versionAttributeView = ioService.getFileAttributeView( activePath, VersionAttributeView.class );
            int index = versionAttributeView.readAttributes().history().records().size() - 1;

            final String authorEmail = versionAttributeView.readAttributes().history().records().get( index ).email();
            final String author = versionAttributeView.readAttributes().history().records().get( index ).author();
            final String comment = versionAttributeView.readAttributes().history().records().get( index ).comment();

            final String time = p.format( new Date( Files.getLastModifiedTime( activePath ).toMillis() ) );
            result.add( new DataContent( Files.isDirectory( activePath ), comment, author, authorEmail, time, Paths.convert( activePath ) ) );
        }
View Full Code Here

        {
            List<WatchEvent<?>> events = ws.poll().pollEvents();
            assertEquals( 1, events.size() );// modify file
        }

        final VersionAttributeView vinit = ioService.getFileAttributeView( init, VersionAttributeView.class );
        final VersionAttributeView vinit2 = ioService.getFileAttributeView( init, VersionAttributeView.class );

        assertEquals( "init 2!", ioService.readAllString( init ) );

        assertNotNull( vinit );
        assertEquals( 2, vinit.readAttributes().history().records().size() );
        assertNotNull( vinit2 );
        assertEquals( 2, vinit2.readAttributes().history().records().size() );

        ioService.startBatch( new FileSystem[]{ init.getFileSystem() } );
        final Path path = ioService.get( URI.create( "git://amend-repo-test/mybatch" + new Random( 10L ).nextInt() + ".txt" ) );
        final Path path2 = ioService.get( URI.create( "git://amend-repo-test/mybatch2" + new Random( 10L ).nextInt() + ".txt" ) );
        ioService.write( path, "ooooo!" );
        //init.file event
        assertNotNull( ws.poll() );
        ioService.write( path, "ooooo wdfs fg sdf!" );
        assertNull( ws.poll() );
        ioService.write( path2, "ooooo222!" );
        assertNull( ws.poll() );
        ioService.write( path2, " sdfsdg sdg ooooo222!" );
        assertNull( ws.poll() );
        ioService.endBatch();
        {
            List<WatchEvent<?>> events = ws.poll().pollEvents();
            assertEquals( 2, events.size() ); //adds files
        }

        final VersionAttributeView v = ioService.getFileAttributeView( path, VersionAttributeView.class );
        final VersionAttributeView v2 = ioService.getFileAttributeView( path2, VersionAttributeView.class );

        assertNotNull( v );
        assertNotNull( v2 );
        assertEquals( 1, v.readAttributes().history().records().size() );
        assertEquals( 1, v2.readAttributes().history().records().size() );
    }
View Full Code Here

TOP

Related Classes of org.uberfire.java.nio.base.version.VersionAttributeView

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.