Package org.jitterbit.collections

Examples of org.jitterbit.collections.StringKeyValuePairs


      return;
    InterchangeDataParser dataParser = new InterchangeDataParser(dataTable);

    InterchangeDataRow[] arrData = dataTable.getRows();
    for( InterchangeDataRow row : arrData ) {
      StringKeyValuePairs keyValues = dataParser.parse(row);
      IntegrationEntity entity = null;
      try {
        entity = entityHandler.createEntity(keyValues);
        if ( entity == null )
          continue;
      } catch (ItemCheckoutException e) {
        System.err.println("Warning: " + e.getMessage());
        continue;
      }

      // Check if it is specified to which project this entity belongs.
      String sProjectId = keyValues.getString(IntegrationProject.PROPERTY_INTERCHANGE_PROJECT_ID);
      if ( sProjectId != null ) {
        IntegrationProjectId projectId = (IntegrationProjectId)EntityType.Project.getIntegrationId(sProjectId);
        IntegrationProject project = m_integrationProjectMap.get(projectId);
        addEntityToFolderOrProject(entity, project);
      }
View Full Code Here


     *             if <code>db</code> is null.
     */
    public DatabaseLocation(DatabaseLocation db) {
        super(DataLocationType.Database);
        portSupport = new PortAccessibleSupport(this, PORT_PROPERTY);
        StringKeyValuePairs original = db.getData();
        for (String key : original.getKeys()) {
            setProperty(key, original.get(key));
        }
    }
View Full Code Here

    }

    @Override
    public StringKeyValuePairs getPropertiesForSource() {
        synchronized (getDataLock()) {
            StringKeyValuePairs data = super.getPropertiesForSource();
            if (isManualMode()) {
                data.put(CONNECT_STRING_PROPERTY, getManualConnectionString());
            } else {
                // We use an empty string rather than null so that the server will
                // be updated correctly in case the location was previously deployed
                // as manual but is now deployed as automatic.
                data.put(CONNECT_STRING_PROPERTY, "");
            }
            addAdditionalPropertiesForDeploy(data);
            return data;
        }
    }
View Full Code Here

    }

    @Override
    public StringKeyValuePairs getPropertiesForTarget() {
        synchronized (getDataLock()) {
            StringKeyValuePairs data = super.getPropertiesForSource();
            if (isManualMode()) {
                data.put(CONNECT_STRING_PROPERTY, getManualConnectionString());
            } else {
                // We use an empty string rather than null so that the server will
                // be updated correctly in case the location was previously deployed
                // as manual but is now deployed as automatic.
                data.put(CONNECT_STRING_PROPERTY, "");
            }
            addAdditionalPropertiesForDeploy(data);
            return data;
        }
    }
View Full Code Here

    if ( m_keys == null )
      throw new IllegalStateException("This InterchangeDataParser has not been initialized with valid data."); //$NON-NLS-1$
    if ( dataRow.getFields().length != m_keys.length)
      throw new IllegalArgumentException("Illegal size of data row. Expected " + m_keys.length + " but got " + dataRow.getFields().length + "."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    StringKeyValuePairs retval = new StringKeyValuePairs();
    int i = 0;
    for( String value : dataRow.getFields() ) {
      retval.put(m_keys[i], value);
      ++i;
    }
    return retval;
  }
View Full Code Here

        return (TargetId) super.getID();
    }

    @Override
    public StringKeyValuePairs getPropertiesForDeploy() {
        StringKeyValuePairs keyValues = location.getPropertiesForTarget();
        keyValues.put(TARGET_ID, getID().toString());
        keyValues.put(TARGET_NAME, getName());
        keyValues.put(Source.SOURCE_TYPE_ID, Integer.toString(location.getDataLocationType().getId()));
        return keyValues;
    }
View Full Code Here

   * This method sets some default values for some properties
   */
  private StringKeyValuePairs getPropertiesForSourceOrTarget(boolean isTarget) {
        // This method is only used for setting default values now.
        // Remove the commented code if this works...
        StringKeyValuePairs keyValues = new StringKeyValuePairs();
        keyValues.put("document_id", "0");
        keyValues.put(DatabaseLocation.TIMEOUT_PROPERTY, "-1");
        if (isTarget) {
            // Nothing to add
        } else {
            keyValues.put(LocatableProperties.IGNORE_FIRST_LINES, "0");
            keyValues.put(LocatableProperties.IGNORE_LAST_LINES, "0");
        }
        keyValues.put(FtpLocation.PROPERTY_TRANSFER_TYPE, "-1");
        keyValues.put(FileLocation.PROPERTY_ENCRYPTION, "0");
        keyValues.put(FtpLocation.PROPERTY_PORT, "-1");
        keyValues.put(FtpLocation.PROPERTY_PASSIVE_MODE, "0");

        // This can not be null so set the default values.
        HttpVerb verb = isTarget ? HttpLocation.getDefaultVerb(SourceTarget.Target) :
            HttpLocation.getDefaultVerb(SourceTarget.Source);
        keyValues.putInt(HttpLocation.PROPERTY_HTTP_VERB, verb.getId());
        // Add the properties from the base class.
        keyValues.putAll(super.getPropertiesForDeploy());
        return keyValues;
  }
View Full Code Here

     * Since the Source object itself does not have a lot of properties we construct it here from
     * the location.
     */
    @Override
    public StringKeyValuePairs getPropertiesForDeploy() {
    StringKeyValuePairs keyValues = location.getPropertiesForSource();
        keyValues.put(SOURCE_ID, getID().toString());
        keyValues.put(SOURCE_NAME, getName());
        keyValues.put(SOURCE_TYPE_ID, Integer.toString(location.getDataLocationType().getId()));
        return keyValues;
    }
View Full Code Here

     */
    private WsKeyValuePairs constructWsKeyValuePairs(Schedule schedule) {
        Map<String, ServerPropertyKey> clientServerMappings =
          ClientServerDeployKeyMappings.getClientServerKeyMappings(EntityType.Schedule);
       
        StringKeyValuePairs scheduleProperties = schedule.getPropertiesForDeploy();
        Set<String> clientKeys = scheduleProperties.getKeys();
        List<WsKeyValue> propertyList = new ArrayList<WsKeyValue>();
        for( String clientKey : clientKeys ) {
          String value = scheduleProperties.get(clientKey);
          if ( value == null ) continue;
          ServerPropertyKey serverKey = clientServerMappings.get(clientKey);
          if ( serverKey == null ) {
            continue;
          }
View Full Code Here

*/
public class StringKeyValuePairsPersistorJUnitTest {

    @Test
    public void run() {
        StringKeyValuePairs original = new StringKeyValuePairs();
        original.putString("name", "Dantes");
        original.putInt("number", 34);
        original.putBoolean("escaped", true);
        original.put("nothing", null);
        XmlPersistor xml = XmlPersistor.newRoot("Pairs");
        StringKeyValuePairsPersistor.save(original, xml);
        StringKeyValuePairs restored = StringKeyValuePairsPersistor.restoreFrom(xml);
        assertEquals(original.size(), restored.size());
        assertEquals("Dantes", restored.get("name"));
        assertEquals(34, restored.getInt("number"));
        assertEquals(true, restored.getBoolean("escaped"));
        assertNull(restored.get("nothing"));
    }
View Full Code Here

TOP

Related Classes of org.jitterbit.collections.StringKeyValuePairs

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.