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:com.wso2telco.gsma.handlers.MIFEStepBasedSequenceHandler.java

private void publishAuthEndpointData(HttpServletRequest request, AuthenticationContext context) {

    Map<String, String> authMap = (Map<String, String>) context
            .getProperty(Constants.AUTH_ENDPOINT_DATA_PUBLISHING_PARAM);

    boolean isAuthenticated = context.isRequestAuthenticated();
    String consentStatus = "consent rejected";
    if (isAuthenticated) {
        consentStatus = "consent given";
    }//ww w  .  j  a  v a 2  s .c  o m

    boolean isNewuser = (boolean) context.getProperty(Constants.IS_REGISTERING);
    String authenticatedUser;
    String authenticators = "";
    Object amrValue;
    if (context.isRequestAuthenticated() && context.getSequenceConfig().getAuthenticatedUser() != null) {
        amrValue = context.getProperty("amr");
        authenticatedUser = context.getSequenceConfig().getAuthenticatedUser().getUserName();
    } else {
        amrValue = context.getProperty("failedamr");
        authenticatedUser = (String) context.getProperty("faileduser");
    }
    if (null != amrValue && amrValue instanceof ArrayList<?>) {
        @SuppressWarnings("unchecked")
        List<String> amr = (ArrayList<String>) amrValue;
        authenticators = amr.toString();
    }

    String telcoScope = "openid";
    if (request.getParameter("telco_scope") != null) {
        telcoScope = request.getParameter("telco_scope");
    } else if (context.getProperty("telco_scope") != null) {
        telcoScope = request.getParameter("telco_scope");
    }

    String systemTime = String.valueOf(new java.util.Date().getTime());

    authMap.put("ConsentTimestamp", systemTime);
    authMap.put("AuthenticatorEndTime", systemTime);
    authMap.put("IpHeader", retrieveIPAddress(request));
    authMap.put("AuthenticatorMethods", authenticators);
    authMap.put("IsAuthenticated", Boolean.toString(isAuthenticated));
    authMap.put("IsNewUser", Boolean.toString(isNewuser));
    authMap.put("Msisdn", authenticatedUser);
    authMap.put("Timestamp", systemTime);
    authMap.put("ConsentState", consentStatus);
    authMap.put("IsAuthCodeIssued", Boolean.toString(isAuthenticated));
    authMap.put("AppID", context.getSequenceConfig().getApplicationId());
    authMap.put("telco_scope", telcoScope);

    // Handling exception due to data unavailability in user registration scenario
    try {
        authMap.put("ServerHost", request.getHeader("X-FORWARDED-FOR"));
    } catch (NullPointerException e) {
        log.error("X-FORWARDED-FOR header does not exist", e);
    }

    if (authMap.get("AcrValue") == null) {
        authMap.put("AcrValue", request.getParameter("acr_values"));
    }
    authMap.put("SessionId", DataPublisherUtil.getSessionID(request, context));
    DataPublisherUtil.publishAuthEndpointData(authMap);
}

From source file:com.liferay.asset.publisher.service.test.AssetPublisherServiceTest.java

@Test
public void testGetAssetEntriesFilteredByAssetCategoryIds() throws Exception {

    addAssetVocabulary();//from w w  w.ja va2 s. co m

    long[] allAssetCategoryIds = { _assetCategoryIds[0], _assetCategoryIds[1], _assetCategoryIds[2] };

    List<AssetEntry> expectedAssetEntries = addAssetEntries(allAssetCategoryIds, _NO_ASSET_TAG_NAMES, 2, true);

    PortletPreferences portletPreferences = getAssetPublisherPortletPreferences();

    List<AssetEntry> assetEntries = _assetPublisherHelper.getAssetEntries(new MockPortletRequest(),
            portletPreferences, _permissionChecker, new long[] { _group.getGroupId() }, false, false);

    Assert.assertEquals(assetEntries.toString(), _assetEntries.size() + expectedAssetEntries.size(),
            assetEntries.size());

    List<AssetEntry> filteredAsssetEntries = _assetPublisherHelper.getAssetEntries(new MockPortletRequest(),
            portletPreferences, _permissionChecker, new long[] { _group.getGroupId() }, allAssetCategoryIds,
            _NO_ASSET_TAG_NAMES, false, false);

    Assert.assertEquals(expectedAssetEntries, filteredAsssetEntries);
}

From source file:controlador.Controlador.java

private Destino handleKeep(HttpServletRequest request, HttpServletResponse response, String op, String accion,
        String origen) throws JSONException {

    switch (op) {
    case "actualiza":
        System.out.println("ENTRA");
        Keep keep = new Keep(null, -1, request.getParameter("contenido"), null, "estable");
        JSONObject obje = GestorKeep.removeKeep(keep, request.getParameter("login"));
        return new Destino(Camino.print, "", obje.toString());
    case "create":
        if (origen.equals("android")) {
            Keep k = new Keep(null, Integer.parseInt(request.getParameter("idAndroid")),
                    request.getParameter("contenido"), null, "estable");
            JSONObject obj = GestorKeep.addKeep(k, request.getParameter("login"));
            // GestorKeep.addKeep(k);
            return new Destino(Camino.print, "", obj.toString());
        }//  w ww .j a  v a 2 s.c o m
        if (origen.equals("web")) {
            Keep k = new Keep(null, -1, request.getParameter("contenido"), null, "estable");
            JSONObject obj = GestorKeep.addKeep(k, request.getParameter("login"));
            List<Keep> keeps = GestorKeep.listKeeps(request.getParameter("login"));
            request.setAttribute("listado", keeps);
            return new Destino(Camino.forward, "/WEB-INF/viewkeeps.jsp", keeps.toString());

        }
    case "read":
        if (origen.equals("android")) {
            JSONObject obj = GestorKeep.getKeeps(request.getParameter("login"));
            return new Destino(Camino.print, "", obj.toString());
        }
    case "delete":
        if (origen.equals("android")) {
            Keep k = new Keep(null, Integer.parseInt(request.getParameter("idAndroid")),
                    request.getParameter("contenido"), null, "estable");
            JSONObject obj = GestorKeep.removeKeep(k, request.getParameter("login"));
            return new Destino(Camino.print, "", obj.toString());
        }
        if (origen.equals("web")) {
            int id = Integer.parseInt(request.getParameter("id"));
            GestorKeep.removeKeepWeb(id);
            List<Keep> keeps = GestorKeep.listKeeps(request.getParameter("login"));
            request.setAttribute("listado", keeps);
            return new Destino(Camino.forward, "/WEB-INF/viewkeeps.jsp", keeps.toString());
        }
    case "update":
        if (origen.equals("web")) {
            int id = Integer.parseInt(request.getParameter("id"));
            int idAndroid = Integer.parseInt(request.getParameter("idAndroid"));

            Keep k = new Keep(id, idAndroid, request.getParameter("contenido"), "estable");

            GestorKeep.updateKeep(k);
            List<Keep> keeps = GestorKeep.listKeeps(request.getParameter("login"));
            request.setAttribute("listado", keeps);
            return new Destino(Camino.forward, "/WEB-INF/viewkeeps.jsp", keeps.toString());
        }

    }

    return null;
}

From source file:com.liferay.asset.publisher.service.test.AssetPublisherServiceTest.java

@Test
public void testGetAssetEntriesFilteredByAssetCategoryIdsAndAssetTagNames() throws Exception {

    addAssetVocabulary();/* w  ww  .  j  a v  a 2  s . c om*/

    long[] allCategoyIds = { _assetCategoryIds[0], _assetCategoryIds[1], _assetCategoryIds[2],
            _assetCategoryIds[3] };

    String[] allAssetTagNames = { _ASSET_TAG_NAMES[0], _ASSET_TAG_NAMES[1] };

    List<AssetEntry> expectedAssetEntries = addAssetEntries(allCategoyIds, allAssetTagNames, 2, true);

    PortletPreferences portletPreferences = getAssetPublisherPortletPreferences();

    List<AssetEntry> assetEntries = _assetPublisherHelper.getAssetEntries(new MockPortletRequest(),
            portletPreferences, _permissionChecker, new long[] { _group.getGroupId() }, false, false);

    Assert.assertEquals(assetEntries.toString(), _assetEntries.size() + expectedAssetEntries.size(),
            assetEntries.size());

    List<AssetEntry> filteredAssetEntries = _assetPublisherHelper.getAssetEntries(new MockPortletRequest(),
            portletPreferences, _permissionChecker, new long[] { _group.getGroupId() }, allCategoyIds,
            allAssetTagNames, false, false);

    Assert.assertEquals(expectedAssetEntries, filteredAssetEntries);
}

From source file:com.tk.httpClientErp.buscheck.BusListActivity.java

/**
 * /*from w ww  .  ja  va 2s.  com*/
 */
@SuppressWarnings("unchecked")
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    switch (item.getItemId()) {
    //   
    case R.id.menu_item_buslist_yes:
        HashMap<String, Object> busListHashMaps = MyStore.subAndDel(MyStore.busList);
        List<JSONObject> submitJsonArray = (List<JSONObject>) busListHashMaps.get("submitJsonArray");
        List<HashMap<String, Object>> delList = (List<HashMap<String, Object>>) busListHashMaps.get("delList");
        params.add(new BasicNameValuePair("submitJsonArray", submitJsonArray.toString()));
        String reultString = null;
        try {
            reultString = HttpClientUtil.postRequest("/android.do?method=checkBusList", params,
                    MyStore.sessionID);
        } catch (TimeoutException e) {
            e.printStackTrace();
            BusListActivity.this.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    Toast.makeText(BusListActivity.this, MyStore.TIMEOUTLOGIN, Toast.LENGTH_SHORT).show();
                }
            });
        }
        if (HttpClientUtil.reSUCCorFAILE && delList.size() != 0)
            MyStore.busList.removeAll(delList);
        reultString = HttpClientUtil.callBackSuccOrFail(reultString, "resualt");
        final String MSG = reultString;
        BusListActivity.this.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(BusListActivity.this, MSG, Toast.LENGTH_SHORT).show();
            }
        });
        ((SimpleAdapter) getListAdapter()).notifyDataSetChanged();
        break;
    //   /
    case R.id.menu_item_buslist_selectec_or_cancle:
        MyStore.selectORcancle(mResult, "mResult", MyStore.busList);
        mResult = mResult == true ? false : true;
        ((SimpleAdapter) getListAdapter()).notifyDataSetChanged();
        break;
    }
    return true;
}

From source file:com.vmware.upgrade.factory.CompositeUpgradeDefinitionFactory.java

@Override
public String toString() {
    final List<String> names = new ArrayList<>();
    for (UpgradeDefinitionFactoryRef ref : definitionFactoryRefs) {
        names.add(ref.name);//w w w  . j  a v a2 s  .  c  om
    }
    return names.toString();
}

From source file:com.vmware.photon.controller.apife.backends.ProjectSqlBackend.java

@Override
@Transactional/*from  w ww. java  2s.c  om*/
public TaskEntity setSecurityGroups(String projectId, List<String> securityGroups) throws ExternalException {

    logger.info("Updating the security groups of project {} to {}", projectId, securityGroups.toString());

    ProjectEntity projectEntity = findById(projectId);

    List<SecurityGroup> currSecurityGroups = SecurityGroupUtils
            .toApiRepresentation(projectEntity.getSecurityGroups());
    Pair<List<SecurityGroup>, List<String>> result = SecurityGroupUtils
            .mergeSelfSecurityGroups(currSecurityGroups, securityGroups);

    replaceSecurityGroups(projectId, result.getLeft());

    TaskEntity taskEntity = taskBackend.createCompletedTask(projectEntity,
            Operation.SET_PROJECT_SECURITY_GROUPS);
    StepEntity stepEntity = taskBackend.getStepBackend().createCompletedStep(taskEntity, projectEntity,
            Operation.SET_PROJECT_SECURITY_GROUPS);

    if (!result.getRight().isEmpty()) {
        stepEntity.addWarning(new SecurityGroupsAlreadyInheritedException(result.getRight()));
    }

    return taskEntity;
}

From source file:de.uni_potsdam.hpi.asg.common.io.Invoker.java

private ProcessReturn invoke(String[] cmd, List<String> params, File folder, int timeout) {
    List<String> command = new ArrayList<String>();
    command.addAll(Arrays.asList(cmd));
    command.addAll(params);//from  w w  w.ja va 2s  . c  om
    ProcessReturn retVal = new ProcessReturn(Arrays.asList(cmd), params);
    Process process = null;
    try {
        logger.debug("Exec command: " + command.toString());
        //System.out.println(timeout + ": " + command.toString());
        ProcessBuilder builder = new ProcessBuilder(command);
        builder.directory(folder);
        builder.environment(); // bugfix setting env in test-mode (why this works? i dont know..)
        process = builder.start();

        Thread timeoutThread = null;
        if (timeout > 0) {
            timeoutThread = new Thread(new Timeout(Thread.currentThread(), timeout));
            timeoutThread.setName("Timout for " + command.toString());
            timeoutThread.start();
        }
        IOStreamReader ioreader = new IOStreamReader(process);
        Thread streamThread = new Thread(ioreader);
        streamThread.setName("StreamReader for " + command.toString());
        streamThread.start();
        process.waitFor();
        streamThread.join();
        if (timeoutThread != null) {
            timeoutThread.interrupt();
        }
        String out = ioreader.getResult();
        //System.out.println(out);
        if (out == null) {
            //System.out.println("out = null");
            retVal.setStatus(Status.noio);
        }
        retVal.setCode(process.exitValue());
        retVal.setStream(out);
        retVal.setStatus(Status.ok);
    } catch (InterruptedException e) {
        process.destroy();
        retVal.setTimeout(timeout);
        retVal.setStatus(Status.timeout);
    } catch (IOException e) {
        logger.error(e.getLocalizedMessage());
        retVal.setStatus(Status.ioexception);
    }
    return retVal;
}

From source file:net.cpollet.jixture.asserts.JixtureAssert.java

public JixtureAssert containsAtMost(List<Fixture> fixtures) {
    List<Map<String, ?>> expectedMaps = new LinkedList<Map<String, ?>>();

    for (Fixture fixture : fixtures) {
        expectedMaps.addAll(getExpectedMaps(fixture));
    }/*from   w  w w.  j a  va 2  s.  co  m*/

    List<Map<String, ?>> actualMaps = getActualMaps();

    actualMaps.removeAll(expectedMaps);

    if (0 != actualMaps.size()) {
        throw new AssertionError("Unexpected but present elements " + actualMaps.toString());
    }

    return this;
}

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

/**
 * =====================================
 */// www. jav  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_headmanchecklist_check_yes:
        HashMap<String, Object> hashMapsYES = MyStore.subAndDel(MyStore.headManCheckList);
        List<JSONObject> submitJsonArrayYES = (List<JSONObject>) hashMapsYES.get("submitJsonArray");
        List<HashMap<String, Object>> delListYES = (List<HashMap<String, Object>>) hashMapsYES.get("delList");
        params.add(new BasicNameValuePair("submitJsonArray", submitJsonArrayYES.toString()));
        try {
            reultString = HttpClientUtil.postRequest("/android.do?method=updateHeadmancheckYES", params,
                    MyStore.sessionID);
        } catch (TimeoutException e) {
            e.printStackTrace();
            HeadmancheckDetailActivity.this.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    Toast.makeText(HeadmancheckDetailActivity.this, MyStore.TIMEOUTLOGIN, Toast.LENGTH_SHORT)
                            .show();
                }
            });
        }
        reultString = HttpClientUtil.callBackSuccOrFail(reultString, "resualt");
        if (HttpClientUtil.reSUCCorFAILE && delListYES.size() != 0) {
            MyStore.headManCheckList.removeAll(delListYES);
            headmancheckDetail.removeAll(delListYES);
        }
        final String MSG = reultString;
        HeadmancheckDetailActivity.this.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(HeadmancheckDetailActivity.this, MSG, Toast.LENGTH_SHORT).show();
            }
        });
        if (headmancheckDetail.size() == 0) {
            MyStore.deletBeanById(gd_no, "gd_no", MyStore.headManCheckFenzu);
            HeadmancheckDetailActivity.this.finish(); // Activity
        }
        ((MySimpleAdapter) getListAdapter()).notifyDataSetChanged();
        break;
    case R.id.menu_item_headmanchecklist_check_no:
        HashMap<String, Object> hashMapsNO = MyStore.subAndDel(MyStore.headManCheckList);
        List<JSONObject> submitJsonArrayNO = (List<JSONObject>) hashMapsNO.get("submitJsonArray");
        List<HashMap<String, Object>> delListNO = (List<HashMap<String, Object>>) hashMapsNO.get("delList");
        params.add(new BasicNameValuePair("submitJsonArray", submitJsonArrayNO.toString()));
        try {
            reultString = HttpClientUtil.postRequest("/android.do?method=updateHeadmancheckNO", params,
                    MyStore.sessionID);
        } catch (TimeoutException e) {
            e.printStackTrace();
            HeadmancheckDetailActivity.this.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    Toast.makeText(HeadmancheckDetailActivity.this, MyStore.TIMEOUTLOGIN, Toast.LENGTH_SHORT)
                            .show();
                }
            });
        }
        reultString = HttpClientUtil.callBackSuccOrFail(reultString, "resualt");
        if (HttpClientUtil.reSUCCorFAILE && delListNO.size() != 0) {
            MyStore.headManCheckList.removeAll(delListNO);
            headmancheckDetail.removeAll(delListNO);
        }
        final String MSG2 = reultString;
        HeadmancheckDetailActivity.this.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(HeadmancheckDetailActivity.this, MSG2, Toast.LENGTH_SHORT).show();
            }
        });
        if (headmancheckDetail.size() == 0) {
            MyStore.deletBeanById(gd_no, "gd_no", MyStore.headManCheckFenzu);
            HeadmancheckDetailActivity.this.finish(); // Activity
        }
        ((MySimpleAdapter) getListAdapter()).notifyDataSetChanged();
        break;
    case R.id.menu_item_headmanchecklist_selectec_or_cancle:
        MyStore.selectORcancle(mResult, "mResult", headmancheckDetail);
        mResult = mResult == true ? false : true;
        ((MySimpleAdapter) getListAdapter()).notifyDataSetChanged();
        break;
    }
    return true;
}