Package com.mks.api.response

Examples of com.mks.api.response.WorkItem


            if ( !siProject.isBuild() )
            {
                Response res = siProject.checkpoint( msg, chkptLabel );
                int exitCode = res.getExitCode();
                boolean success = ( exitCode == 0 ? true : false );
                WorkItem wi = res.getWorkItem( siProject.getConfigurationPath() );
                String chkpt = wi.getResult().getField( "resultant" ).getItem().getId();
                getLogger().info(
                    "Successfully checkpointed project " + siProject.getConfigurationPath() + " with label '"
                        + chkptLabel + "', new revision is " + chkpt );
                result =
                    new TagScmResult( res.getCommandString(), wi.getResult().getMessage(), "Exit Code: " + exitCode,
                                      success );
            }
            else
            {
                getLogger().error(
View Full Code Here


                Response res = siSandbox.resync();
                // Lets output what we got from running this command
                WorkItemIterator wit = res.getWorkItems();
                while ( wit.hasNext() )
                {
                    WorkItem wi = wit.next();
                    if ( wi.getModelType().equals( SIModelTypeName.MEMBER ) )
                    {
                        Result message = wi.getResult();
                        getLogger().debug( wi.getDisplayId() + " " + ( null != message ? message.getMessage() : "" ) );
                    }
                }
                int exitCode = res.getExitCode();
                boolean success = ( exitCode == 0 ? true : false );
                result = new CheckOutScmResult( res.getCommandString(), "", "Exit Code: " + exitCode, success );
View Full Code Here

            // Get the changed/dropped members from the sandbox
            List<WorkItem> changeList = siSandbox.getChangeList();
            for ( Iterator<WorkItem> wit = changeList.iterator(); wit.hasNext(); )
            {
                WorkItem wi = wit.next();
                File memberFile = new File( wi.getField( "name" ).getValueAsString() );
                // Separate the changes into files that have been updated and deleted files
                if ( siSandbox.hasWorkingFile( (Item) wi.getField( "wfdelta" ).getValue() ) )
                {
                    scmFileList.add( new ScmFile( memberFile.getAbsolutePath(), ScmFileStatus.UPDATED ) );
                }
                else
                {
View Full Code Here

                Response res = siSandbox.resync();
                // Lets capture what we got from running this resync
                WorkItemIterator wit = res.getWorkItems();
                while ( wit.hasNext() )
                {
                    WorkItem wi = wit.next();
                    if ( wi.getModelType().equals( SIModelTypeName.MEMBER ) )
                    {
                        Result message = wi.getResult();
                        getLogger().debug( wi.getDisplayId() + " " + ( null != message ? message.getMessage() : "" ) );
                        if ( null != message && message.getMessage().length() > 0 )
                        {
                            updatedFiles.add( new ScmFile( wi.getDisplayId(),
                                                           message.getMessage().equalsIgnoreCase( "removed" )
                                                               ? ScmFileStatus.DELETED
                                                               : ScmFileStatus.UPDATED ) );
                        }
                    }
View Full Code Here

        api.getLogger().debug( "Validating existing sandbox: " + sandbox );
        Response res = api.runCommand( cmd );
        WorkItemIterator wit = res.getWorkItems();
        try
        {
            WorkItem wi = wit.next();
            return wi.getField( "fullConfigSyntax" ).getValueAsString().equalsIgnoreCase(
                siProject.getConfigurationPath() );
        }
        catch ( APIException aex )
        {
            ExceptionHandler eh = new ExceptionHandler( aex );
View Full Code Here

        // Run the view sandbox command
        Response r = api.runCommand( siViewSandbox );
        // Check-in all changed files, drop all members with missing working files
        for ( WorkItemIterator wit = r.getWorkItems(); wit.hasNext(); )
        {
            WorkItem wi = wit.next();
            api.getLogger().debug( "Inspecting file: " + wi.getField( "name" ).getValueAsString() );

            if ( wi.getModelType().equals( SIModelTypeName.MEMBER ) )
            {
                Item wfdeltaItem = (Item) wi.getField( "wfdelta" ).getValue();
                // Proceed with this entry only if it is an actual working file delta
                if ( isDelta( wfdeltaItem ) )
                {
                    File memberFile = new File( wi.getField( "name" ).getValueAsString() );
                    if ( hasWorkingFile( wfdeltaItem ) )
                    {
                        // Only report on files that have actually changed...
                        if ( hasMemberChanged( memberFile, wi.getId() ) )
                        {
                            changedFiles.add( wi );
                        }
                    }
                    else
View Full Code Here

            // Check-in all changed files, drop all members with missing working files
            for ( Iterator<WorkItem> wit = changeList.iterator(); wit.hasNext(); )
            {
                try
                {
                    WorkItem wi = wit.next();
                    File memberFile = new File( wi.getField( "name" ).getValueAsString() );
                    // Check-in files that have actually changed...
                    if ( hasWorkingFile( (Item) wi.getField( "wfdelta" ).getValue() ) )
                    {
                        // Lock each member as you go...
                        lock( memberFile, wi.getId() );
                        // Commit the changes...
                        checkin( memberFile, wi.getId(), message );
                        // Update the changed file list
                        changedFiles.add( new ScmFile( memberFile.getAbsolutePath(), ScmFileStatus.CHECKED_IN ) );
                    }
                    else
                    {
                        // Drop the member if there is no working file
                        dropMember( memberFile, wi.getId() );
                        // Update the changed file list
                        changedFiles.add( new ScmFile( memberFile.getAbsolutePath(), ScmFileStatus.DELETED ) );
                    }
                }
                catch ( APIException aex )
View Full Code Here

        siRlog.addOption( new Option( "cwd", sandboxDir ) );
        // Execute the si rlog command
        Response response = api.runCommand( siRlog );
        for ( WorkItemIterator wit = response.getWorkItems(); wit.hasNext(); )
        {
            WorkItem wi = wit.next();
            String memberName = wi.getContext();
            // We're going to have to do a little dance to get the correct server file name
            memberName = memberName.substring( 0, memberName.lastIndexOf( '/' ) );
            memberName = memberName + '/' + wi.getId();
            memberName = memberName.replace( '\\', '/' );
            // Now lets get the revisions for this file
            Field revisionsFld = wi.getField( "revisions" );
            if ( null != revisionsFld && revisionsFld.getDataType().equals( Field.ITEM_LIST_TYPE )
                && null != revisionsFld.getList() )
            {
                @SuppressWarnings( "unchecked" ) List<Item> revList = revisionsFld.getList();
                for ( Iterator<Item> lit = revList.iterator(); lit.hasNext(); )
View Full Code Here

            Command siProjectInfoCmd = new Command( Command.SI, "projectinfo" );
            siProjectInfoCmd.addOption( new Option( "project", configPath ) );
            api.getLogger().info( "Preparing to execute si projectinfo for " + configPath );
            Response infoRes = api.runCommand( siProjectInfoCmd );
            // Get the only work item from the response
            WorkItem wi = infoRes.getWorkItems().next();
            // Get the metadata information about the project
            Field pjNameFld = wi.getField( "projectName" );
            Field pjTypeFld = wi.getField( "projectType" );
            Field pjCfgPathFld = wi.getField( "fullConfigSyntax" );
            Field pjChkptFld = wi.getField( "lastCheckpoint" );

            // Convert to our class fields
            // First obtain the project name field
            if ( null != pjNameFld && null != pjNameFld.getValueAsString() )
            {
                projectName = pjNameFld.getValueAsString();
            }
            else
            {
                api.getLogger().warn( "Project info did not provide a value for the 'projectName' field!" );
                projectName = "";
            }
            // Next, we'll need to know the project type
            if ( null != pjTypeFld && null != pjTypeFld.getValueAsString() )
            {
                projectType = pjTypeFld.getValueAsString();
                if ( isBuild() )
                {
                    // Next, we'll need to know the current build checkpoint for this configuration
                    Field pjRevFld = wi.getField( "revision" );
                    if ( null != pjRevFld && null != pjRevFld.getItem() )
                    {
                        projectRevision = pjRevFld.getItem().getId();
                    }
                    else
View Full Code Here

        // Iterate through the list of members returned by the API
        WorkItemIterator wit = viewRes.getWorkItems();
        while ( wit.hasNext() )
        {
            WorkItem wi = wit.next();
            if ( wi.getModelType().equals( SIModelTypeName.SI_SUBPROJECT ) )
            {
                // Save the configuration path for the current subproject, using the canonical path name
                pjConfigHash.put( wi.getField( "name" ).getValueAsString(), wi.getId() );
            }
            else if ( wi.getModelType().equals( SIModelTypeName.MEMBER ) )
            {
                // Figure out this member's parent project's canonical path name
                String parentProject = wi.getField( "parent" ).getValueAsString();
                // Instantiate our Integrity CM Member object
                Member iCMMember = new Member( wi, pjConfigHash.get( parentProject ), projectRoot, workspaceDir );
                // Add this to the full list of members in this project
                memberList.add( iCMMember );
            }
            else
            {
                api.getLogger().warn( "View project output contains an invalid model type: " + wi.getModelType() );
            }
        }

        // Sort the files list...
        Collections.sort( memberList, FILES_ORDER );
View Full Code Here

TOP

Related Classes of com.mks.api.response.WorkItem

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.