Package org.jitterbit.integration.data.entity

Examples of org.jitterbit.integration.data.entity.Folder


            return node1.getDisplayName().compareToIgnoreCase(node2.getDisplayName());
        }
    }

    private int compareFolderNodes(IntegrationEntityTreeNode node1, IntegrationEntityTreeNode node2) {
        Folder f1 = (Folder) node1.getUserObject();
        Folder f2 = (Folder) node2.getUserObject();
        // We want the Jitterbit Connect (TM) folder to appear before any other folders.
        if (f1.isJitterbitConnectFolder()) {
            return -1;
        } else if (f2.isJitterbitConnectFolder()) {
            return 1;
        }
        boolean f1_is_connect = JitterbitConnectNames.isConnectWizardFolder(f1);
        boolean f2_is_connect = JitterbitConnectNames.isConnectWizardFolder(f2);
        if (f1_is_connect && f2_is_connect) {
            // We want the standard connect folders to appear before the salesforce
            // folders. When comparing two salesforce folders we want the
            // folder with shared items to appear last.
            boolean f1_is_salesforce = f1.isSalesforceFolder();
            boolean f2_is_salesforce = f2.isSalesforceFolder();
            if (f1_is_salesforce && f2_is_salesforce) {
                if (f1.isSharedSalesforceItemsFolder()) {
                    return 1;
                } else if (f2.isSharedSalesforceItemsFolder()) {
                    return -1;
                }
            } else if (f1_is_salesforce) {
                return 1;
            } else if (f2_is_salesforce) {
View Full Code Here


            processFolder(folder, destination);
        }
    }
   
    private void processFolder(Folder folderToDuplicate, Folder destination) {
        Folder targetFolder = destination.findSubFolder(folderToDuplicate.getName());
        if (targetFolder == null) {
            targetFolder = new Folder(folderToDuplicate.getName(), destination.getItemType());
            project.insertEntity(targetFolder, destination);
            newFolders.add(targetFolder);
        }
        for (Folder child : folderToDuplicate.getAllSubFolders()) {
            processFolder(child, targetFolder);
View Full Code Here

            }
        }
    }

    private void processSharedItems(Folder root) {
        Folder shared = null;
        EntityType type = root.getItemType();
        for (IntegrationEntity e : root.getAllItems()) {
            if (SalesforceUtils.isSalesforceWizardObject(e)) {
                if (shared == null) {
                    shared = SalesforceProjectFolders.createSharedItemsFolder(type);
View Full Code Here

      // NOTE: FolderItemTab.ParentFolder_Id must have been joined with FolderTab to be able to do this!
      //
      FolderId parentFolderId = getFolderId(keyValues.get(FolderItem.PARENT_FOLDER_ID));
      String stName = keyValues.get(Folder.FOLDER_NAME);
      Folder folder = new Folder(folderId, stName, entityType);

      m_folderIdFolderMap.put(folderId, folder);

      // Assign to InterchangeProject if possible.
      IntegrationProject project = null;
      String sProjectId = keyValues.getString(IntegrationProject.PROPERTY_INTERCHANGE_PROJECT_ID);
      if ( sProjectId != null ) {
        IntegrationProjectId projectId = (IntegrationProjectId)EntityType.Project.getIntegrationId(sProjectId);
        project = m_integrationProjectMap.get(projectId);
      }

            if( parentFolderId == null ) {
        RootFolder rootFolder = getRootFolder(entityType, project);
        if ( rootFolder == null ) {
          System.out.println("Failed to find RootFolder for Folder " + folder.getName());
        }
        else
          rootFolder.addSubFolder(folder);
      }
      else {
        Folder parentFolder = m_folderIdFolderMap.get(parentFolderId);
        if ( parentFolder == null )
          orphanFolders.add(new OrphanFolder(folder, parentFolderId));
        else
          parentFolder.addSubFolder(folder);
      }
    }

    // Handle all the orphan folders.
    int nOrphanedFolders = orphanFolders.size();
    while ( nOrphanedFolders > 0 ) {
      int currentNumber = nOrphanedFolders;
      for( int iFolder = 0; iFolder < nOrphanedFolders; /*iFolder updated in the loop*/) {
        Folder orphanFolder = orphanFolders.get(iFolder).getFolder();
        FolderId parentFolderId = orphanFolders.get(iFolder).getParentFolderId();
        Folder parentFolder = m_folderIdFolderMap.get(parentFolderId);
        if ( parentFolder != null ) {
          parentFolder.addSubFolder(orphanFolder);

          // Remove the current folder from the list of orphaned folders and continue iterating from the same index.
          orphanFolders.remove(iFolder);
          nOrphanedFolders = orphanFolders.size();
        }
View Full Code Here

    for( InterchangeDataRow row : arrData ) {
      StringKeyValuePairs keyValues = dataParser.parse(row);

      FolderId parentFolderId = getFolderId(keyValues.get(FolderItem.PARENT_FOLDER_ID));
      if ( parentFolderId != null ) {
        Folder folder = m_folderIdFolderMap.get(parentFolderId);
        if ( folder != null ) {
          int iEntityTypeId = keyValues.getInt(FolderItem.ENTITY_TYPE_ID);
          EntityType et = EntityType.fromId(iEntityTypeId);
          IntegrationEntityId itemId = et.getIntegrationId( keyValues.get(FolderItem.ITEM_ID) );
          addEntityToFolder(itemId, folder);
View Full Code Here

    // Start by checking if it belongs to a folder.
    // This will implicitly add the item to a project.
    List<Folder> folderList = m_itemIdParentFolderListMap.get( entity.getID() );
    if ( folderList != null && !folderList.isEmpty() ) {
      Folder nextFolder = folderList.get(0);
      nextFolder.addItem(entity);
      folderList.remove(0);
      return;
    }
    else {
      project.getRootFolder(entity.getEntityType()).addItem(entity);
View Full Code Here

            // however the entity does not have an explicit flag saying if it is
            // permission dirty or not so this is checked inside this method.
            updatePermissions(entity);

            if (entity instanceof Folder) {
                Folder childFolder = (Folder) entity;
                if (childFolder.isDeployDirty() || childFolder.hasMoved()) {
                    // Insert/Update the folder
                    String[] fields = childFolder.getPropertyValuesForDeploy();
                    m_updatedFolders.add(getInterchangeDataRow(fields));

                    addFolderItem(folder, childFolder);
                }
                updatePermissions(entity);
View Full Code Here

        assertFalse(isValidType(schedule));
    }

    @Test
    public void ensureIsValidTypeWorksForFolders() {
        Folder operations = new Folder("Test", EntityType.Operation);
        assertTrue(isValidType(operations));
        Folder schedules = new Folder("Test", EntityType.Schedule);
        assertFalse(isValidType(schedules));
    }
View Full Code Here

    public Folder getTransformationParent(boolean createIfNotExists) {
        return getWizardFolder(EntityType.Transformation, createIfNotExists);
    }

    public Folder getWizardFolder(EntityType type, boolean createIfNotExists) {
        Folder connectRoot = getConnectRoot(type, createIfNotExists);
        if (connectRoot == null) {
            return null;
        }
        Folder folder = connectRoot.findSubFolder(wizardName);
        if (folder == null && createIfNotExists) {
            folder = createAndInsertFolder(type, connectRoot, wizardName);
        }
        return folder;
    }
View Full Code Here

        }
        return folder;
    }

    private Folder createAndInsertFolder(EntityType type, Folder parent, String name) {
        Folder folder;
        folder = new Folder(name, type);
        createdFolders.add(folder);
        project.insertEntity(folder, parent);
        return folder;
    }
View Full Code Here

TOP

Related Classes of org.jitterbit.integration.data.entity.Folder

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.