Example usage for java.util List toString

List of usage examples for java.util List toString

Introduction

In this page you can find the example usage for java.util List toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:org.esupportail.portlet.filemanager.services.evaluators.ListUserRoleEvaluatorEditor.java

/**
 * @param arg0/*from  www. j  a  v  a 2s.  c o m*/
 * @throws IllegalArgumentException
 * @see org.springframework.beans.propertyeditors.PropertiesEditor#setAsText(java.lang.String)
 */
private void setAsText(final List<String> arg0) throws IllegalArgumentException {
    List<UserRoleEvaluator> list = new LinkedList<UserRoleEvaluator>();
    for (String grp : arg0) {
        list.add(new UserRoleEvaluator(grp));
    }
    if (LOG.isDebugEnabled()) {
        LOG.debug("String in : " + arg0 + " List out : " + list.toString());
    }
    this.editedProperties = list;
}

From source file:com.tekstosense.segmenter.StructurePdf.PdfSections.java

public List<String> generateOutput() throws IOException {
    List<String> finalJson = new ArrayList<>();
    ObjectMapper mapper = new ObjectMapper();
    for (Entry<File, List<Section>> entry : pdfSections.entrySet()) {
        List<Structure> structures = StructureUtil.toStructure(entry.getValue());

        if (this.params.getOutputDir() != null) {
            File toFile = new File(this.params.getOutputDir(), entry.getKey().getName() + ".txt");
            Files.write(structures.toString(), toFile, Charsets.UTF_8);
        } else if (params.getFormat().equalsIgnoreCase("STDOUT")) {
            System.out.println(structures.toString());
        }//  w w  w .  j av a 2 s.  c  om
        finalJson.add(mapper.writeValueAsString(structures));
    }
    return finalJson;
}

From source file:com.intuit.wasabi.tests.service.IntegrationAuthorization.java

/**
 * Test getting user application permission
 *///from w w w  .  j  a  v a 2s .c  o  m
@Test(dependsOnMethods = { "t_createExperiments" })
public void t_getUserAppPermissions() {
    String uri = "authorization/users/" + userName + "/applications/" + experiment.applicationName
            + "/permissions";
    response = apiServerConnector.doGet(uri);
    assertReturnCode(response, HttpStatus.SC_OK);
    @SuppressWarnings("rawtypes")
    HashMap jsonMap = (HashMap) response.jsonPath().get();
    Assert.assertNotNull(jsonMap);
    @SuppressWarnings("unchecked")
    List<String> permissions = (List<String>) jsonMap.get("permissions");
    Assert.assertTrue(permissions.toString().contains("CREATE"));
    Assert.assertTrue(permissions.toString().contains("READ"));
    Assert.assertTrue(permissions.toString().contains("UPDATE"));
    Assert.assertTrue(permissions.toString().contains("DELETE"));
    Assert.assertTrue(permissions.toString().contains("ADMIN"));
    Assert.assertTrue(permissions.toString().contains("SUPERADMIN"));

    Assert.assertEquals(jsonMap.get("applicationName"), experiment.applicationName);
}

From source file:com.symbian.driver.plugins.ftptelnet.test.FtpTransferTest.java

public final void testListDrives() {
    FtpTransfer lSession = FtpTransfer.getInstance("tcp:192.168.0.3:21");

    List<String> lDrives = lSession.listDrives();
    assertNotNull(lDrives);//from  w  ww.  j  a  v a 2  s . c  om
    assertTrue(!lDrives.isEmpty());
    System.out.println("List of drives :" + lDrives.toString());
}

From source file:edu.kit.scc.IdentityHarmonizer.java

/**
 * Links the users represented in the JSON serialized list of SCIM user's via LDAP locally.
 * //from w  w  w  . j  a va  2  s .c o m
 * @param scimUsers the SCIM user's to link
 * @return a list of JSON serialized SCIM user's containing the modification information
 */
public List<ScimUser> harmonizeIdentities(List<ScimUser> scimUsers) {
    ArrayList<ScimUser> linkedUsers = new ArrayList<>();
    ScimUser primaryUser = null;

    for (ScimUser user : scimUsers) {
        if (user.isActive()) {
            primaryUser = user;
            log.debug("Primary user {}", primaryUser.toString());
            break;
        }
    }

    if (scimUsers.remove(primaryUser)) {
        log.debug("LDAP lookup for user {}", primaryUser.getUserName());
        PosixUser primaryPosixUser = ldapClient.getPosixUser(primaryUser.getUserName());
        log.debug("Primary user {}", primaryPosixUser.toString());

        Meta metaData = new Meta();
        metaData.put("homeDirectory", primaryPosixUser.getHomeDirectory());
        metaData.put("cn", primaryPosixUser.getCommonName());
        metaData.put("gidNumber", String.valueOf(primaryPosixUser.getGidNumber()));
        metaData.put("uid", primaryPosixUser.getUid());
        metaData.put("uidNumber", String.valueOf(primaryPosixUser.getUidNumber()));

        primaryUser.setMeta(metaData);

        List<PosixGroup> primaryGroups = ldapClient.getUserGroups(primaryUser.getUserName());
        log.debug("Primary groups {}", primaryGroups.toString());

        primaryUser.setGroups(new ArrayList<>());

        for (ScimUser secondaryUser : scimUsers) {
            PosixUser secondaryPosixUser = ldapClient.getPosixUser(secondaryUser.getUserName());
            log.debug("Secondary user {}", secondaryUser.toString());

            metaData = new Meta();
            metaData.put("homeDirectory", secondaryPosixUser.getHomeDirectory());
            metaData.put("cn", secondaryPosixUser.getCommonName());
            metaData.put("gidNumber", String.valueOf(secondaryPosixUser.getGidNumber()));
            metaData.put("uid", secondaryPosixUser.getUid());
            metaData.put("uidNumber", String.valueOf(secondaryPosixUser.getUidNumber()));

            secondaryUser.setMeta(metaData);

            List<PosixGroup> secondaryGroups = ldapClient.getUserGroups(secondaryUser.getUserName());
            log.debug("Secondary groups {}", secondaryGroups.toString());

            secondaryUser.setGroups(new ArrayList<>());

            for (PosixGroup group : primaryGroups) {
                List<String> members = group.getMemberUids();
                log.debug("Group {} members {}", group.getCommonName(), members);
                if (!members.contains(secondaryUser.getUserName())) {
                    ldapClient.addGroupMember(group.getCommonName(), secondaryUser.getUserName());

                    ScimGroup scimGroup = new ScimGroup();
                    scimGroup.setDisplay(group.getCommonName());
                    scimGroup.setValue(String.valueOf(group.getGidNumber()));
                    secondaryUser.getGroups().add(scimGroup);

                    log.debug("Adding user {} to group {}", secondaryUser.getUserName(), group.getCommonName());
                }
            }

            for (PosixGroup group : secondaryGroups) {
                List<String> members = group.getMemberUids();
                log.debug("Group members {}", members);
                if (!members.contains(primaryUser.getUserName())) {
                    ldapClient.addGroupMember(group.getCommonName(), primaryUser.getUserName());

                    ScimGroup scimGroup = new ScimGroup();
                    scimGroup.setDisplay(group.getCommonName());
                    scimGroup.setValue(String.valueOf(group.getGidNumber()));
                    primaryUser.getGroups().add(scimGroup);

                    log.debug("Adding user {} to group {}", primaryUser.getUserName(), group.getCommonName());
                }
            }

            linkedUsers.add(secondaryUser);

            secondaryPosixUser.setUidNumber(primaryPosixUser.getUidNumber());
            secondaryPosixUser.setHomeDirectory(primaryPosixUser.getHomeDirectory());
            ldapClient.updatePosixUser(secondaryPosixUser);

            log.debug("Modified LDAP user {}", secondaryUser.toString());

        }

        linkedUsers.add(primaryUser);

    }
    return linkedUsers;
}

From source file:com.tapcentive.sdk.icons.IconRetrievalService.java

protected void syncIcons(List<IconReference> icon_list) {
    Log.d(TAG, "Calling syncIcons with icon_list: " + icon_list.toString());
    // Get the current list of stored icons and delete ones that aren't in the icon_list
    File dir = new File(getApplicationContext().getFilesDir() + "/" + ICONDIR);
    dir.mkdirs(); // Just make sure it exists always
    LinkedList<Long> localFileIds = new LinkedList<Long>();
    if (dir.isDirectory()) {
        for (final File iconFile : dir.listFiles()) {
            //String iconFileId = iconFile.getName().substring(0, iconFile.getName().length()-4); // Remove .png, .gif, etc
            String iconFileId = iconFile.getName().substring(0, iconFile.getName().lastIndexOf(".")); // Remove extension
            localFileIds.add(Long.parseLong(iconFileId));
            boolean found = false;
            for (IconReference ref : icon_list) {
                if (Long.toString(ref.id).equals(iconFileId)) {
                    found = true;//from w  w  w  . j a  va2s .c  o  m
                    break;
                }
            }
            if (!found) {
                iconFile.delete();
            }
        }
        Log.d(TAG, "Would start to sync icons here: " + icon_list.toString());
        for (IconReference icon : icon_list) {
            if (!localFileIds.contains(icon.id)) {
                retrieveIcon(icon);
            }
        }
    }

}

From source file:net.abhinavsarkar.spelhelper.ImplicitConstructorResolver.java

@Override
public ConstructorExecutor resolve(final EvaluationContext context, final String typeName,
        final List<TypeDescriptor> argumentTypes) throws AccessException {
    try {/*from   w w w  . j av  a2  s.c  om*/
        return delegate.resolve(context, typeName, argumentTypes);
    } catch (AccessException ex) {
        Object variable = ((SpelHelper) context.lookupVariable(SpelHelper.CONTEXT_LOOKUP_KEY))
                .lookupImplicitConstructor(typeName + argumentTypes.toString());
        if (variable instanceof Constructor<?>) {
            Constructor<?> constructor = (Constructor<?>) variable;
            return delegate.resolve(context, constructor.getDeclaringClass().getName(), argumentTypes);
        }
        return null;
    }
}

From source file:org.openbaton.nse.core.ConnectivityManagerHandler.java

public boolean removeQos(List<String> servers, String nsrID) {

    List<Server> serversList;
    logger.info(/*from   ww  w .j  a v  a2 s. com*/
            "[CONNECTIVITY-MANAGER-HANDLER] removing slice for " + nsrID + " at time " + new Date().getTime());
    try {
        serversList = internalData.get(nsrID);
        logger.info("SERVER LIST FOR DELETING IS " + serversList.toString());
    } catch (NullPointerException e) {
        logger.debug("Servers for " + nsrID + " not found");
        return false;
    }

    queueHandler.removeQos(hostMap, serversList, servers, nsrID);
    flowsHandler.removeFlow(hostMap, servers, internalData.get(nsrID), nsrID);
    internalData.remove(nsrID);
    logger.info(
            "[CONNECTIVITY-MANAGER-HANDLER] removed slice for " + nsrID + " at time " + new Date().getTime());
    return true;
}

From source file:com.liferay.sync.engine.service.SyncFileServiceTest.java

protected void testResyncFolders(int[] syncFileStates, int expectedExecutionCount, int expectedModifiedCount)
        throws Exception {

    List<SyncFile> syncFiles = new ArrayList<>();

    SyncFile folderSyncFileA = SyncFileTestUtil.addFolderSyncFile(FileUtil.getFilePathName(filePathName, "a"),
            syncFileStates[0], syncAccount.getSyncAccountId());

    syncFiles.add(folderSyncFileA);// w  ww .jav  a 2 s  .com

    SyncFile folderSyncFileAA = SyncFileTestUtil.addFolderSyncFile(
            FileUtil.getFilePathName(filePathName, "a", "a"), folderSyncFileA.getTypePK(), syncFileStates[1],
            syncAccount.getSyncAccountId());

    syncFiles.add(folderSyncFileAA);

    SyncFile folderSyncFileAB = SyncFileTestUtil.addFolderSyncFile(
            FileUtil.getFilePathName(filePathName, "a", "b"), folderSyncFileA.getTypePK(), syncFileStates[2],
            syncAccount.getSyncAccountId());

    syncFiles.add(folderSyncFileAB);

    SyncFile folderSyncFileAAA = SyncFileTestUtil.addFolderSyncFile(
            FileUtil.getFilePathName(filePathName, "a", "a", "a"), folderSyncFileAA.getTypePK(),
            syncFileStates[3], syncAccount.getSyncAccountId());

    syncFiles.add(folderSyncFileAAA);

    SyncFilePersistence syncFilePersistence = SyncFileService.getSyncFilePersistence();

    PowerMockito.mockStatic(FileEventUtil.class);

    SyncFileService.resyncFolders(syncAccount.getSyncAccountId(), syncFiles);

    PowerMockito.verifyStatic(Mockito.times(expectedExecutionCount));

    FileEventUtil.resyncFolder(Mockito.anyLong(), Mockito.any(SyncFile.class));

    List<SyncFile> resyncingSyncFiles = syncFilePersistence.queryForEq("uiEvent", SyncFile.UI_EVENT_RESYNCING);

    Assert.assertEquals(resyncingSyncFiles.toString(), expectedModifiedCount, resyncingSyncFiles.size());

    for (SyncFile syncFile : syncFiles) {
        syncFilePersistence.delete(syncFile);
    }

    FileUtils.deleteDirectory(new File(folderSyncFileA.getFilePathName()));
}

From source file:com.tk.httpClientErp.headmancheck.Headmancheckqianshuzhi.java

/**
 * =====================================
 *///from  ww  w  . j av a 2 s  . com
@SuppressWarnings("unchecked")
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    String reultString = null;
    switch (item.getItemId()) {
    case R.id.menu_item_buslist_yes:
        HashMap<String, Object> hashMapsYES = MyStore.subAndDel(MyStore.headManCheckFenzu);
        List<JSONObject> submitJsonArrayYES = (List<JSONObject>) hashMapsYES.get("submitJsonArray");
        params.add(new BasicNameValuePair("submitJsonArray", submitJsonArrayYES.toString()));
        try {
            reultString = HttpClientUtil.postRequest("/android.do?method=qianshuzhi", params,
                    MyStore.sessionID);
        } catch (TimeoutException e) {
            e.printStackTrace();
            Headmancheckqianshuzhi.this.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    Toast.makeText(Headmancheckqianshuzhi.this, MyStore.TIMEOUTLOGIN, Toast.LENGTH_SHORT)
                            .show();
                }
            });
        }
        reultString = HttpClientUtil.callBackSuccOrFail(reultString, "resualt");
        final String MSG = reultString;
        Headmancheckqianshuzhi.this.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(Headmancheckqianshuzhi.this, MSG, Toast.LENGTH_SHORT).show();
            }
        });
    case R.id.menu_item_buslist_selectec_or_cancle:
        MyStore.selectORcancle(mResult, "mResult", MyStore.headManCheckFenzu);
        mResult = mResult == true ? false : true;
        ((MySimpleAdapter) getListAdapter()).notifyDataSetChanged();
        break;
    }
    return true;
}