Package hudson.model

Examples of hudson.model.Item


        }
    }

    public SidACL getACL(ItemGroup g) {
        if (g instanceof Item) {
            Item item = (Item) g;
            return (SidACL)item.getACL();
        }
        return getRootACL();
    }
View Full Code Here


        binding.setProperty("stdout",stdout);
        binding.setProperty("stderr",stderr);
        binding.setProperty("channel",channel);
        String j = getClientEnvironmentVariable("JOB_NAME");
        if (j!=null) {
            Item job = Jenkins.getInstance().getItemByFullName(j);
            binding.setProperty("currentJob", job);
            String b = getClientEnvironmentVariable("BUILD_NUMBER");
            if (b!=null && job instanceof AbstractProject) {
                Run r = ((AbstractProject) job).getBuildByNumber(Integer.parseInt(b));
                binding.setProperty("currentBuild", r);
View Full Code Here

            StringTokenizer tokens = new StringTokenizer(Util.fixNull(value),",");
            boolean hasProjects = false;
            while(tokens.hasMoreTokens()) {
                String projectName = tokens.nextToken().trim();
                if (StringUtils.isNotBlank(projectName)) {
                    Item item = Jenkins.getInstance().getItem(projectName,project,Item.class);
                    if(item==null)
                        return FormValidation.error(Messages.BuildTrigger_NoSuchProject(projectName,
                                AbstractProject.findNearest(projectName,project.getParent()).getRelativeNameFrom(project)));
                    if(!(item instanceof AbstractProject))
                        return FormValidation.error(Messages.BuildTrigger_NotBuildable(projectName));
View Full Code Here

                continue;
            }

            if (ctx instanceof ItemGroup) {
                ItemGroup g = (ItemGroup) ctx;
                Item i = g.getItem(s);
                if (i==null || !i.hasPermission(Item.READ)) {
                    ctx=null;    // can't go up further
                    break;
                }
                ctx=i;
            } else {
View Full Code Here

    public final Item getItem(String pathName, Item context) {
        return getItem(pathName,context!=null?context.getParent():null);
    }

    public final <T extends Item> T getItem(String pathName, ItemGroup context, Class<T> type) {
        Item r = getItem(pathName, context);
        if (type.isInstance(r))
            return type.cast(r);
        return null;
    }
View Full Code Here

        ItemGroup parent = this;

        if(!tokens.hasMoreTokens()) return null;    // for example, empty full name.

        while(true) {
            Item item = parent.getItem(tokens.nextToken());
            if(!tokens.hasMoreTokens()) {
                if(type.isInstance(item))
                    return type.cast(item);
                else
                    return null;
            }

            if(!(item instanceof ItemGroup))
                return null;    // this item can't have any children

            if (!item.hasPermission(Item.READ))
                return null;

            parent = (ItemGroup) item;
        }
    }
View Full Code Here

     * @param name The name to test
     * @param currentJobName The name of the job that the user is configuring
     * @return
     */
    boolean isNameUnique(String name, String currentJobName) {
        Item item = getItem(name);
       
        if(null==item) {
            // the candidate name didn't return any items so the name is unique
            return true;
        }
        else if(item.getName().equals(currentJobName)) {
            // the candidate name returned an item, but the item is the item
            // that the user is configuring so this is ok
            return true;
        }
        else {
View Full Code Here

    public static List<String> parseExcludedJobsFromString(String jobs){
        List<String> list = new ArrayList<String>();
        String jobNames[] = jobs.split(",");
        for(String name: jobNames){
            name = name.trim();
            Item item = Jenkins.getInstance().getItem(name);
            if(item!=null && item instanceof AbstractProject)
                list.add(name);
        }
        return list;
    }
View Full Code Here

   
    // Synchronizing hudson config files
    sscBusiness.synchronizeAllConfigs(ScmSyncConfigurationPlugin.AVAILABLE_STRATEGIES);
   
    // Renaming fakeJob to newFakeJob
    Item mockedItem = Mockito.mock(TopLevelItem.class);
    File mockedItemRootDir = new File(getCurrentHudsonRootDirectory() + "/jobs/newFakeJob/" );
    when(mockedItem.getRootDir()).thenReturn(mockedItemRootDir);
        when(mockedItem.getName()).thenReturn("newFakeJob");

        // We should duplicate files in fakeJob to newFakeJob
        File oldJobDirectory = new File(getCurrentHudsonRootDirectory() + "/jobs/fakeJob/");
        FileUtils.copyDirectory(oldJobDirectory, mockedItemRootDir);
View Full Code Here

    File configFile = new File(jobDirectory.getAbsolutePath() + File.separator + "config.xml");
    jobDirectory.mkdir();
    FileUtils.copyFile(new ClassPathResource("expected-scm-hierarchies/HudsonExtensionsTest.shouldJobAddBeCorrectlyImpactedOnSCM/jobs/newFakeJob/config.xml").getFile(), configFile);
   
    // Creating fake new job
    Item mockedItem = Mockito.mock(TopLevelItem.class);
    when(mockedItem.getRootDir()).thenReturn(jobDirectory);
   
    sscItemListener.onCreated(mockedItem);
   
    verifyCurrentScmContentMatchesHierarchy("expected-scm-hierarchies/InitRepositoryTest.shouldSynchronizeHudsonFiles/");
   
View Full Code Here

TOP

Related Classes of hudson.model.Item

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.