Example usage for java.util HashMap putAll

List of usage examples for java.util HashMap putAll

Introduction

In this page you can find the example usage for java.util HashMap putAll.

Prototype

public void putAll(Map<? extends K, ? extends V> m) 

Source Link

Document

Copies all of the mappings from the specified map to this map.

Usage

From source file:net.spfbl.data.Trap.java

public synchronized static HashMap<String, Long> getMap() {
    HashMap<String, Long> map = new HashMap<String, Long>();
    map.putAll(MAP);
    return map;// ww  w .  jav a2s . com
}

From source file:net.spfbl.core.Reverse.java

private static synchronized HashMap<String, Reverse> getMap() {
    HashMap<String, Reverse> map = new HashMap<String, Reverse>();
    map.putAll(MAP);
    return map;/*from   w  ww  .j  a  va  2 s  .co m*/
}

From source file:org.pentaho.di.trans.util.TransUtil.java

public static Map<String, ProvidesDatabaseConnectionInformation> collectOutputStepInTrans(
        final TransMeta transMeta, final Repository repository, final IMetaStore metastore)
        throws KettleException {
    HashMap<String, ProvidesDatabaseConnectionInformation> stepMap = new HashMap<String, ProvidesDatabaseConnectionInformation>();
    for (StepMeta stepMeta : transMeta.getSteps()) {
        ProvidesDatabaseConnectionInformation info = getDatabaseConnectionInformation(
                stepMeta.getStepMetaInterface());
        if (info != null) {
            stepMap.put(StringUtils.trimToEmpty(stepMeta.getName()), info);
        } else if (stepMeta.getStepMetaInterface() instanceof MetaInjectMeta) {
            MetaInjectMeta metaInject = ((MetaInjectMeta) stepMeta.getStepMetaInterface());
            TransMeta injectedTransMeta = MetaInjectMeta.loadTransformationMeta(metaInject, repository,
                    metastore, transMeta);
            stepMap.putAll(collectOutputStepInTrans(injectedTransMeta, repository, metastore));
        }//from   www.  j  a  v a 2  s  .  c  o m
    }
    return stepMap;
}

From source file:gr.interamerican.bo2.utils.JavaBeanUtils.java

/**
 * Finds the properties of all interfaces implemented by an abstract class
 * and returns them in a {@link HashMap} with
 * the property name as key./*from www  .  j a v a2 s.  com*/
 * 
 * @param type
 *            the bean
 * @return Returns the property descriptors of a java bean.
 * 
 * @see #getBeansProperties(Class)
 * 
 */
@SuppressWarnings("rawtypes")
public static Map<String, PropertyDescriptor> getBeansPropertiesOfAbstractClass(Class<?> type) {
    List<Class> types = CollectionUtils.addAll(new ArrayList<Class>(), (Class[]) type.getInterfaces());
    types.add(type);
    HashMap<String, PropertyDescriptor> properties = new HashMap<String, PropertyDescriptor>();
    for (Class infc : types) {
        Map<String, PropertyDescriptor> subMap = JavaBeanUtils.getBeansPropertiesMap(infc);
        properties.putAll(subMap);
    }
    return properties;
}

From source file:org.openiam.provision.service.UserAttributeHelper.java

static public User cloneUser(User user) {
    User newUser = new User();

    newUser.setBirthdate(user.getBirthdate());
    newUser.setCompanyOwnerId(user.getCompanyOwnerId());
    newUser.setCreateDate(user.getCreateDate());
    newUser.setCreatedBy(user.getCreatedBy());
    newUser.setEmployeeId(user.getEmployeeId());
    newUser.setEmployeeTypeId(user.getEmployeeTypeId());

    newUser.setFirstName(user.getFirstName());
    newUser.setJobCodeId(user.getJobCodeId());
    newUser.setLastName(user.getLastName());
    newUser.setLastUpdate(user.getLastUpdate());
    newUser.setLastUpdatedBy(user.getLastUpdatedBy());
    newUser.setLocationCd(user.getLocationCd());
    newUser.setLocationName(user.getLocationName());
    newUser.setMdTypeId(user.getMdTypeId());
    newUser.setClassification(user.getClassification());
    newUser.setMiddleInit(user.getMiddleInit());
    newUser.setPrefix(user.getPrefix());
    newUser.setSex(user.getSex());//from  ww w  . j  a  v a 2s.  co m
    newUser.setStatus(user.getStatus());
    newUser.setSecondaryStatus(user.getSecondaryStatus());
    newUser.setSuffix(user.getSuffix());
    newUser.setTitle(user.getTitle());
    newUser.setId(user.getId());
    newUser.setUserTypeInd(user.getUserTypeInd());
    newUser.setMailCode(user.getMailCode());
    newUser.setCostCenter(user.getCostCenter());
    newUser.setStartDate(user.getStartDate());
    newUser.setLastDate(user.getLastDate());
    newUser.setClaimDate(user.getClaimDate());
    newUser.setNickname(user.getNickname());
    newUser.setMaidenName(user.getMaidenName());
    newUser.setPasswordTheme(user.getPasswordTheme());
    newUser.setEmail(user.getEmail());
    newUser.setShowInSearch(user.getShowInSearch());
    newUser.setAlternateContactId(user.getAlternateContactId());

    //
    HashMap<String, UserAttribute> userAttributes = new HashMap<String, UserAttribute>(0);
    userAttributes.putAll(user.getUserAttributes());
    newUser.setUserAttributes(userAttributes);

    newUser.setPhones(user.getPhones());

    newUser.setAddresses(user.getAddresses());

    newUser.setEmailAddresses(user.getEmailAddresses());

    return newUser;

}

From source file:de.dfki.iui.mmds.core.emf.persistence.EmfPersistence.java

public static void write(Resource resource, OutputStream os, Map<String, Object> saveOptions)
        throws IOException {
    ExtendedMetaData modelMetaData;/*w  w w  . j a  va2s .com*/
    if (resource.getResourceSet() != null) {
        modelMetaData = new BasicExtendedMetaData(resource.getResourceSet().getPackageRegistry());
    } else {
        modelMetaData = new BasicExtendedMetaData(Registry.INSTANCE);
    }
    HashMap<String, Object> options = new HashMap<String, Object>();

    options.put(XMIResource.OPTION_ENCODING, "UTF-8");
    if (!options.containsKey(XMIResource.OPTION_KEEP_DEFAULT_CONTENT)) {
        options.put(XMIResource.OPTION_KEEP_DEFAULT_CONTENT, Boolean.TRUE);
    }
    options.put(XMIResource.OPTION_EXTENDED_META_DATA, modelMetaData);
    options.put(XMLResource.OPTION_URI_HANDLER, new URIHandlerImpl.PlatformSchemeAware());
    options.put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.FALSE);
    if (saveOptions != null) {
        options.putAll(saveOptions);
    }
    if (os != null) {
        resource.save(os, options);
    } else {
        resource.save(options);
    }
}

From source file:org.keycloak.testsuite.admin.realm.RealmTest.java

public static void assertRealm(RealmRepresentation realm, RealmRepresentation storedRealm) {
    if (realm.getId() != null) {
        assertEquals(realm.getId(), storedRealm.getId());
    }//from w  ww  .ja v a 2  s  .  c o m
    if (realm.getRealm() != null) {
        assertEquals(realm.getRealm(), storedRealm.getRealm());
    }
    if (realm.isEnabled() != null)
        assertEquals(realm.isEnabled(), storedRealm.isEnabled());
    if (realm.isBruteForceProtected() != null)
        assertEquals(realm.isBruteForceProtected(), storedRealm.isBruteForceProtected());
    if (realm.getMaxFailureWaitSeconds() != null)
        assertEquals(realm.getMaxFailureWaitSeconds(), storedRealm.getMaxFailureWaitSeconds());
    if (realm.getMinimumQuickLoginWaitSeconds() != null)
        assertEquals(realm.getMinimumQuickLoginWaitSeconds(), storedRealm.getMinimumQuickLoginWaitSeconds());
    if (realm.getWaitIncrementSeconds() != null)
        assertEquals(realm.getWaitIncrementSeconds(), storedRealm.getWaitIncrementSeconds());
    if (realm.getQuickLoginCheckMilliSeconds() != null)
        assertEquals(realm.getQuickLoginCheckMilliSeconds(), storedRealm.getQuickLoginCheckMilliSeconds());
    if (realm.getMaxDeltaTimeSeconds() != null)
        assertEquals(realm.getMaxDeltaTimeSeconds(), storedRealm.getMaxDeltaTimeSeconds());
    if (realm.getFailureFactor() != null)
        assertEquals(realm.getFailureFactor(), storedRealm.getFailureFactor());
    if (realm.isRegistrationAllowed() != null)
        assertEquals(realm.isRegistrationAllowed(), storedRealm.isRegistrationAllowed());
    if (realm.isRegistrationEmailAsUsername() != null)
        assertEquals(realm.isRegistrationEmailAsUsername(), storedRealm.isRegistrationEmailAsUsername());
    if (realm.isRememberMe() != null)
        assertEquals(realm.isRememberMe(), storedRealm.isRememberMe());
    if (realm.isVerifyEmail() != null)
        assertEquals(realm.isVerifyEmail(), storedRealm.isVerifyEmail());
    if (realm.isLoginWithEmailAllowed() != null)
        assertEquals(realm.isLoginWithEmailAllowed(), storedRealm.isLoginWithEmailAllowed());
    if (realm.isDuplicateEmailsAllowed() != null)
        assertEquals(realm.isDuplicateEmailsAllowed(), storedRealm.isDuplicateEmailsAllowed());
    if (realm.isResetPasswordAllowed() != null)
        assertEquals(realm.isResetPasswordAllowed(), storedRealm.isResetPasswordAllowed());
    if (realm.isEditUsernameAllowed() != null)
        assertEquals(realm.isEditUsernameAllowed(), storedRealm.isEditUsernameAllowed());
    if (realm.getSslRequired() != null)
        assertEquals(realm.getSslRequired(), storedRealm.getSslRequired());
    if (realm.getAccessCodeLifespan() != null)
        assertEquals(realm.getAccessCodeLifespan(), storedRealm.getAccessCodeLifespan());
    if (realm.getAccessCodeLifespanUserAction() != null)
        assertEquals(realm.getAccessCodeLifespanUserAction(), storedRealm.getAccessCodeLifespanUserAction());
    if (realm.getActionTokenGeneratedByAdminLifespan() != null)
        assertEquals(realm.getActionTokenGeneratedByAdminLifespan(),
                storedRealm.getActionTokenGeneratedByAdminLifespan());
    if (realm.getActionTokenGeneratedByUserLifespan() != null)
        assertEquals(realm.getActionTokenGeneratedByUserLifespan(),
                storedRealm.getActionTokenGeneratedByUserLifespan());
    else
        assertEquals(realm.getAccessCodeLifespanUserAction(),
                storedRealm.getActionTokenGeneratedByUserLifespan());
    if (realm.getNotBefore() != null)
        assertEquals(realm.getNotBefore(), storedRealm.getNotBefore());
    if (realm.getAccessTokenLifespan() != null)
        assertEquals(realm.getAccessTokenLifespan(), storedRealm.getAccessTokenLifespan());
    if (realm.getAccessTokenLifespanForImplicitFlow() != null)
        assertEquals(realm.getAccessTokenLifespanForImplicitFlow(),
                storedRealm.getAccessTokenLifespanForImplicitFlow());
    if (realm.getSsoSessionIdleTimeout() != null)
        assertEquals(realm.getSsoSessionIdleTimeout(), storedRealm.getSsoSessionIdleTimeout());
    if (realm.getSsoSessionMaxLifespan() != null)
        assertEquals(realm.getSsoSessionMaxLifespan(), storedRealm.getSsoSessionMaxLifespan());
    if (realm.getSsoSessionIdleTimeoutRememberMe() != null)
        Assert.assertEquals(realm.getSsoSessionIdleTimeoutRememberMe(),
                storedRealm.getSsoSessionIdleTimeoutRememberMe());
    if (realm.getSsoSessionMaxLifespanRememberMe() != null)
        Assert.assertEquals(realm.getSsoSessionMaxLifespanRememberMe(),
                storedRealm.getSsoSessionMaxLifespanRememberMe());
    if (realm.getRequiredCredentials() != null) {
        assertNotNull(storedRealm.getRequiredCredentials());
        for (String cred : realm.getRequiredCredentials()) {
            assertTrue(storedRealm.getRequiredCredentials().contains(cred));
        }
    }
    if (realm.getLoginTheme() != null)
        assertEquals(realm.getLoginTheme(), storedRealm.getLoginTheme());
    if (realm.getAccountTheme() != null)
        assertEquals(realm.getAccountTheme(), storedRealm.getAccountTheme());
    if (realm.getAdminTheme() != null)
        assertEquals(realm.getAdminTheme(), storedRealm.getAdminTheme());
    if (realm.getEmailTheme() != null)
        assertEquals(realm.getEmailTheme(), storedRealm.getEmailTheme());

    if (realm.getPasswordPolicy() != null)
        assertEquals(realm.getPasswordPolicy(), storedRealm.getPasswordPolicy());

    if (realm.getDefaultRoles() != null) {
        assertNotNull(storedRealm.getDefaultRoles());
        for (String role : realm.getDefaultRoles()) {
            assertTrue(storedRealm.getDefaultRoles().contains(role));
        }
    }

    if (realm.getSmtpServer() != null) {
        assertEquals(realm.getSmtpServer(), storedRealm.getSmtpServer());
    }

    if (realm.getBrowserSecurityHeaders() != null) {
        assertEquals(realm.getBrowserSecurityHeaders(), storedRealm.getBrowserSecurityHeaders());
    }

    if (realm.getAttributes() != null) {
        HashMap<String, String> attributes = new HashMap<>();
        attributes.putAll(storedRealm.getAttributes());
        attributes.entrySet().retainAll(realm.getAttributes().entrySet());
        assertEquals(realm.getAttributes(), attributes);
    }

    if (realm.isUserManagedAccessAllowed() != null)
        assertEquals(realm.isUserManagedAccessAllowed(), storedRealm.isUserManagedAccessAllowed());
}

From source file:Main.java

/**
 * Method that merges 2 data structures into 1
 * /*from   w ww.j  ava  2  s . c  o  m*/
 * @param featureSet:
 *            the structure containing all features
 * @param featureSet2:
 *            the structure containing Pairwise Correlation features
 * @return the concatenated data structure
 */
public static HashMap<Integer, ArrayList<HashMap<String, Double>>> mergeStructures(
        HashMap<Integer, ArrayList<HashMap<String, Double>>> featureSet,
        ArrayList<ArrayList<HashMap<String, Double>>> featureSet2) {

    HashMap<Integer, ArrayList<HashMap<String, Double>>> featureSet_final = new HashMap<Integer, ArrayList<HashMap<String, Double>>>();

    for (int i = 0; i < featureSet.size(); i++) {
        ArrayList<HashMap<String, Double>> featuresPerChann = featureSet.get(i);
        ArrayList<HashMap<String, Double>> featuresPerChann2 = featureSet2.get(i);
        if (featuresPerChann2 == null)
            continue;

        ArrayList<HashMap<String, Double>> featuresPerChann_final = new ArrayList<HashMap<String, Double>>();

        for (int ii = 0; ii < featuresPerChann.size(); ii++) {
            HashMap<String, Double> h1 = new HashMap<String, Double>();
            HashMap<String, Double> h2 = new HashMap<String, Double>();
            // System.out.println("s:: "+String.format("%03d", ii));
            h1 = featuresPerChann.get(ii);
            for (int j = 0; j < featuresPerChann2.size(); j++) {
                h2 = featuresPerChann2.get(j);
                // System.out.println("h2:"+h2);
                String s = h2.keySet().toString();

                if (s.contains("s" + String.format("%04d", ii))) {
                    // System.out.println("sss"+s.substring(1,14));
                    String new_s = s.substring(1, 17);
                    if (h2.get(new_s) != null) {
                        double v = h2.get(new_s);
                        HashMap<String, Double> h = new HashMap<String, Double>();
                        h.put(new_s.substring(0, 11), v);
                        h1.putAll(h);
                    }
                }
            }
            featuresPerChann_final.add(h1);

        }
        featureSet_final.put(i, featuresPerChann_final);
    }

    return featureSet_final;
}

From source file:net.spfbl.core.Client.java

public static synchronized HashMap<String, Client> getMap() {
    HashMap<String, Client> map = new HashMap<String, Client>();
    map.putAll(MAP);
    return map;//w  w w.  j  a  va 2 s .  c  o  m
}

From source file:net.spfbl.dns.QueryDNS.java

private static synchronized HashMap<String, Zone> getMap() {
    HashMap<String, Zone> map = new HashMap<String, Zone>();
    map.putAll(MAP);
    return map;//from  w ww  . ja v  a 2 s  .c o  m
}