Package com.salesforce.ide.core.model

Examples of com.salesforce.ide.core.model.ProjectPackageList


            InterruptedException, ForceRemoteException, CoreException {
        if (connection == null) {
            throw new IllegalArgumentException("Connection cannot be null");
        }

        ProjectPackageList projectPackageList =
                getProjectPackageFactory().getManagedInstalledProjectPackages(connection);

        if (Utils.isEmpty(projectPackageList)) {
            if (logger.isInfoEnabled()) {
                logger.info("No installed, managed packages to retrieve");
            }
            return new RetrieveResultExt();
        }

        RetrieveRequest retrieveRequest = getRetrieveRequest();
        // installed, managed packages are saved to the project w/ package level (<package-name>/<comonent-type>/etc)
        retrieveRequest.setSinglePackage(false);

        if (Utils.isNotEmpty(projectPackageList.getNamedPackageNames())) {
            retrieveRequest.setPackageNames(projectPackageList.getNamedPackageNames());
        }

        RetrieveResultExt resultExt = retrieveWork(connection, retrieveRequest, monitor);
        resultExt.setProjectPackageList(projectPackageList);
View Full Code Here


            FactoryException, InterruptedException {
        if (connection == null || component == null) {
            throw new IllegalArgumentException("Component and/or connection cannot be null");
        }

        ProjectPackageList projectPackageList = getProjectPackageListInstance();
        // REVIEWME: should this be an arg requirement?
        if (component.getFileResource() != null) {
            projectPackageList.setProject(component.getFileResource().getProject());
        } else {
            logger.warn("Project not provided, and will not be attached to returned project package");
        }

        projectPackageList.addComponent(component, includeMetadata);

        return retrieveSelective(connection, projectPackageList, true, monitor);
    }
View Full Code Here

            }

            // take care of case where sub-component type is supported for retrieve independent from parent component type existence.
            // ex. custom field, validation rule can be retrieved independently from custom object.
            if (getComponentFactory().hasSubComponentTypesForComponentType(componentType)) {
                ProjectPackageList projectPackage = getProjectPackageListInstance();
                IFolder componentFolder = getProjectService().getComponentFolderByComponentType(project, componentType);
                projectPackage =
                        getProjectPackageFactory().loadProjectPackageList(componentFolder, projectPackage, false,
                            new NullProgressMonitor());
                List<String> filePaths = projectPackage.getFilePaths(true);
                filePathList.addAll(filePaths);
            }

        }
View Full Code Here

        if (packageManifest != null) {
            retrieveRequest.setUnpackaged(getPackageManifestFactory().convert(packageManifest));
        }

        RetrieveResultExt resultExt = retrieveWork(connection, retrieveRequest, monitor);
        ProjectPackageList projectPackageList = getProjectPackageFactory().getProjectPackageListInstance(packageNames);

        resultExt.setProjectPackageList(projectPackageList);
        return resultExt;
    }
View Full Code Here

                }
            }

            if (Utils.isNotEmpty(componentTypes)) {
                // refresh component dirs
                ProjectPackageList projectPackageList =
                        ContainerDelegate.getInstance().getServiceLocator().getProjectService().getProjectPackageFactory().getProjectPackageListInstance(model.getProject());

                // only save these types
                String[] componentTypeArray = componentTypes.toArray(new String[componentTypes.size()]);
View Full Code Here

    private DeploymentResult deployWork(Connection connection, DeploymentPayload deploymentPayload, boolean checkOnly,
            IProgressMonitor monitor) throws InterruptedException, ForceProjectException, FactoryException,
            ForceConnectionException, ServiceException, ForceRemoteException, JAXBException {

        final ServiceLocator serviceLocator = ContainerDelegate.getInstance().getServiceLocator();
        ProjectPackageList projectPackageList = serviceLocator.getProjectService().getProjectPackageListInstance();
        projectPackageList.setProject(deploymentPayload.getProject());
        PackageManifestFactory factory = projectPackageList.getPackageManifestFactory();
        // See W-837427 - we handle custom objects differently upon deploy, and so
        // call this specialized manifest factory method.
        Package manifest = factory.createSpecialDefaultPackageManifest();
        manifest.setVersion(serviceLocator.getProjectService().getLastSupportedEndpointVersion());


        monitorCheckSubTask(monitor, "Loading deployment candidates...");
        DeploymentComponentSet deploymentComponents = deploymentPayload.getDeploySelectedComponents();

        IProject project = deploymentPayload.getProject();
        Package packageManifest = serviceLocator.getProjectService().getPackageManifestFactory().getPackageManifest(project);
       
        // Looping through each component that we want to deploy.
        //
        // Custom object components are handled differently.
        for (DeploymentComponent deploymentComponent : deploymentComponents) {
            if (deploymentComponent.getDestinationSummary().equals(DeploymentSummary.DELETED)) {
                projectPackageList.addDeleteComponent(deploymentComponent.getComponent());
            } else {
                projectPackageList.addComponent(deploymentComponent.getComponent());
              
                // If this is a custom object component, check to see if it's actually in the manifest -
                // maybe a field inside the object was retrieved from the source org into the project,
                // but the object itself wasn't.
                //
                // If so, we don't want to add the object to the deployment manifest.  Any fields
                // will be included by default because the manifest has a "*" for that component type.
                // (In fact it has a "*" for every component type except custom object, because of
                // this particular issue. See changelist 1452239.)
                //
                //Package packageManifest = serviceLocator.getProjectService().getPackageManifestFactory().getPackageManifest(project);
        String type = deploymentComponent.getComponent().getComponentType();
                boolean isObject = type.equals(Constants.CUSTOM_OBJECT);
                boolean isSharingRule = Constants.ABSTRACT_SHARING_RULE_TYPES.contains(type) || Constants.SHARING_RULE_TYPES.contains(type);
        if(isObject) {
          boolean isPresent = new PackageManifest(packageManifest).contains("CustomObject", deploymentComponent.getComponent().getName());
          if (isPresent) {
            factory.addComponentToManifest(manifest, deploymentComponent.getComponent());
          }
        }
        //If it's a sharing rule, we will add it from the project manifest
        else if (!isSharingRule) {// && !type.equals("Settings")) {
          factory.addComponentToManifest(manifest, deploymentComponent.getComponent());
        }

            }
        }
       
        //Add sharing rules from the package manifest file since the component and file structure is
        //different than what is required by the package manifest file.
        //W-1169372
        for (PackageTypeMembers member : packageManifest.getTypes()) {
          if (Constants.SHARING_RULE_TYPES.contains(member.getName())) {
            manifest.getTypes().add(member);
          }
        }
        monitorWork(monitor);

        try {
            Component comp = factory.getComponentFactory().getComponentById(Constants.PACKAGE_MANIFEST);
            comp.setMetadataFilePath(Constants.PACKAGE_MANIFEST_FILE_NAME);
            comp.setBody(manifest.getXMLString());
            comp.setName(manifest.getFullName());

            projectPackageList.get(0).removePackageManifestComponent();
            projectPackageList.get(0).setPackageManifest(comp);
            projectPackageList.get(0).addComponent(comp);
        } catch (Exception e) {
            logger.warn("Unable to change deploy manifest", e);
        }

        // prepare result and record datetime
View Full Code Here

        if (retrieveResultHandler.getZipFileCount() != projectPackageList.getComponentCount(false)) {
            logger.warn("Remote retrieve result count [" + retrieveResultHandler.getZipFileCount()
                + "] does not equal request count [" + projectPackageList.getComponentCount(false) + "].");
        }

        ProjectPackageList remoteProjectPackageList =
                factoryLocator.getProjectPackageFactory().getProjectPackageListInstance(project,
                    retrieveResultHandler.getZipFile(), retrieveResultHandler.getFileMetadataHandler());

        // for each component in each package in build payload, check for conflict
        for (ProjectPackage projectPackage : projectPackageList) {
View Full Code Here

        monitorCheck(monitor);
        // container to hold status entries
        List<RefactoringStatusEntry> entries = new ArrayList<RefactoringStatusEntry>();

        // get components to inspect
        ProjectPackageList projectPackageList = refactorModel.getProjectPackageList();
        if (projectPackageList == null) {
            String message =
                    "Cannot find component for file '" + changeCandidate.getFullPath().toPortableString() + "'";
            logger.error(message);
            entries.add(createFatalRefactoringStatusEntry(message));
            return entries;
        }

        ComponentList componentList = projectPackageList.getAllComponents();

        // get enabled object types to compare against
        String[] enabledComponentTypes = null;
        try {
            enabledComponentTypes = getEnabledComponentTypes(getRefactorModel().getDestinationProject(), monitor);
View Full Code Here

        // get stored project package list containing package(s) and component(s) to delete
        monitorCheck(monitor);

        // get stored project package list containing package(s) and component(s) to copy
        // currently, perform copy only supports processing of one candidate per time
        ProjectPackageList projectPackageList = refactorModel.getProjectPackageList();
        if (Utils.isEmpty(projectPackageList)) {
            logger.warn("Cannot perform change - project package list is null");
            throw new ForceProjectException("Cannot perform change - project package list is null");
        }

        // create new project package for destination
        ProjectPackage projectPackage =
                ContainerDelegate.getInstance().getServiceLocator().getProjectService().getProjectPackageFactory().getProjectPackage(getRefactorModel().getDestinationProject(), true);

        if (projectPackage == null) {
            throw new ForceProjectException("Cannot determine new package name");
        }

        monitorCheck(monitor);

        // add each component to new project package
        ComponentList componentList = projectPackageList.getAllComponents();
        for (Component component : componentList) {
            if (component.isPackageManifest()) {
                continue;
            }

            String origPackageName = component.getPackageName();
            String metadataFilePath = component.getMetadataFilePath();
            metadataFilePath = metadataFilePath.replace(origPackageName, projectPackage.getName());
            component.setMetadataFilePath(metadataFilePath);
            component.setPackageName(projectPackage.getName());
            projectPackage.addComponent(component);
        }

        // add to list
        final ProjectPackageList destinationProjectPackageList = projectPackageList.getProjectPackageListInstance();
        destinationProjectPackageList.add(projectPackage);
        destinationProjectPackageList.setProject(getRefactorModel().getDestinationProject());

        monitorCheck(monitor);

        if (logger.isDebugEnabled()) {
            logger.debug("Copying the following components:\n" + projectPackageList.getAllComponents().toStringLite());
        }

        try {
            ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
                public void run(IProgressMonitor monitor) throws CoreException {
                    try {
                        destinationProjectPackageList.saveResources(new SubProgressMonitor(monitor, 3));
                    } catch (Exception e) {
                        throw new CoreException(new Status(IStatus.ERROR, Constants.FORCE_PLUGIN_PREFIX, 0, e
                                .getMessage(), e));
                    }
                }
View Full Code Here

                }
            }

            if (Utils.isNotEmpty(componentTypes)) {
                // refresh component dirs
                ProjectPackageList localProjectPackageList =
                        ContainerDelegate.getInstance().getServiceLocator().getProjectService().getProjectPackageFactory().getProjectPackageListInstance(getProject());

                // only save these types
                String[] saveComponentTypes = componentTypes.toArray(new String[componentTypes.size()]);
View Full Code Here

TOP

Related Classes of com.salesforce.ide.core.model.ProjectPackageList

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.