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:de.uzk.hki.da.convert.PublishImageConversionStrategyTest.java

/**
 * Test watermark with real image./*from   w ww .j av a  2  s. c o m*/
 *
 * @throws FileNotFoundException the file not found exception
 */
public void testWatermarkWithRealImage() throws FileNotFoundException {

    Document dom = XPathUtils
            .parseDom(TC.TEST_ROOT_CONVERT + "/PublishImageConversionStrategyTests/premis.xml");
    if (dom == null) {
        throw new RuntimeException("Error while parsing premis.xml");
    }

    Object o = TESTHelper.setUpObject("123", new RelativePath(workAreaRootPath));

    PublishImageConversionStrategy s = new PublishImageConversionStrategy();
    s.setCLIConnector(new CommandLineConnector());

    DAFile sourceFile = new DAFile(o.getLatestPackage(), "a", "filename.tif");

    ConversionInstruction ci = new ConversionInstruction();
    ci.setSource_file(sourceFile);
    ci.setTarget_folder("target/");

    ConversionRoutine cr = new ConversionRoutine();
    cr.setTarget_suffix("jpg");
    ci.setConversion_routine(cr);

    s.setObject(o);
    List<Event> events = s.convertFile(new WorkArea(n, o), ci);

    System.out.println(events.toString());

}

From source file:org.unitedid.shibboleth.config.attribute.resolver.dataConnector.MongoDbDataConnectorBeanDefinitionParser.java

/** {@inheritDoc} */
protected void doParse(String pluginId, Element pluginConfig, Map<QName, List<Element>> pluginConfigChildren,
        BeanDefinitionBuilder pluginBuilder, ParserContext parserContext) {
    super.doParse(pluginId, pluginConfig, pluginConfigChildren, pluginBuilder, parserContext);

    /**/*from  w ww .j a  va2  s .c  o  m*/
     * Data connector attributes (<resolver:DataConnector attr1="" attr2=""></resolver:DataConnector>)
     */
    String mongoDbName = pluginConfig.getAttributeNS(null, "mongoDbName");
    log.info("Data connector {} MONGODB DATABASE: {}", pluginId, mongoDbName);
    pluginBuilder.addPropertyValue("mongoDbName", mongoDbName);

    String mongoCollection = pluginConfig.getAttributeNS(null, "mongoCollection");
    log.info("Data connector {} MONGODB COLLECTION: {}", pluginId, mongoCollection);
    pluginBuilder.addPropertyValue("mongoCollection", mongoCollection);

    if (pluginConfig.hasAttributeNS(null, "mongoUser")) {
        String mongoUser = pluginConfig.getAttributeNS(null, "mongoUser");
        log.info("Data connector {} MONGODB USERNAME: {}", pluginId, mongoUser);
        pluginBuilder.addPropertyValue("mongoUser", mongoUser);
    }

    if (pluginConfig.hasAttributeNS(null, "mongoPassword")) {
        String mongoPassword = pluginConfig.getAttributeNS(null, "mongoPassword");
        pluginBuilder.addPropertyValue("mongoPassword", mongoPassword);
    }

    String preferredRead = "primaryPreferred";
    if (pluginConfig.hasAttributeNS(null, "preferredRead")) {
        preferredRead = pluginConfig.getAttributeNS(null, "preferredRead");
    }
    log.info("Data connector {} preferredRead type: {}", pluginId, preferredRead);
    pluginBuilder.addPropertyValue("preferredRead", preferredRead);

    boolean cacheResults = false;
    if (pluginConfig.hasAttributeNS(null, "cacheResults")) {
        cacheResults = XMLHelper
                .getAttributeValueAsBoolean(pluginConfig.getAttributeNodeNS(null, "cacheResults"));
    }
    log.info("Data connector {} cache results: {}", pluginId, cacheResults);
    pluginBuilder.addPropertyValue("cacheResults", cacheResults);

    /**
     * Mongodb host entries (<uid:MongoHost host="" port="" />)
     */
    List<ServerAddress> hosts = parseMongoHostNames(pluginId, pluginConfigChildren);
    log.debug("Data connector {} hosts {}", pluginId, hosts.toString());
    pluginBuilder.addPropertyValue("mongoHost", hosts);

    boolean usePersistentId = false;
    if (pluginConfigChildren.containsKey(PID_ELEMENT_NAME)) {
        Element e = pluginConfigChildren.get(PID_ELEMENT_NAME).get(0);
        pluginBuilder.addPropertyValue("pidGeneratedAttributeId",
                e.getAttributeNS(null, "generatedAttributeId"));
        pluginBuilder.addPropertyValue("pidSourceAttributeId", e.getAttributeNS(null, "sourceAttributeId"));
        usePersistentId = true;
    }
    log.info("Data connector {} running in persistentId mode: {}", pluginId, usePersistentId);
    pluginBuilder.addPropertyValue("usePersistentId", usePersistentId);

    List<MongoDbKeyAttributeMapper> keyAttributeMaps = parseAttributeMappings(pluginId, pluginConfigChildren);
    pluginBuilder.addPropertyValue("keyAttributeMap", keyAttributeMaps);

    if (!usePersistentId) {
        String queryTemplate = pluginConfigChildren.get(QUERY_TEMPLATE_ELEMENT_NAME).get(0).getTextContent();
        queryTemplate = DatatypeHelper.safeTrimOrNullString(queryTemplate);
        log.debug("Data connector {} query template: {}", pluginId, queryTemplate);
        pluginBuilder.addPropertyValue("queryTemplate", queryTemplate);
    }

    String templateEngineRef = pluginConfig.getAttributeNS(null, "templateEngine");
    pluginBuilder.addPropertyReference("templateEngine", templateEngineRef);
}

From source file:gemlite.shell.service.batch.ImportService.java

public String listNames() {
    checkContextInitialized();//from w  w  w .ja  v a  2 s .c  o m
    List<String> names = new ArrayList<>(jobItems.keySet());
    Collections.sort(names);
    return names.toString();
}

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

@Override
@Transactional/* w w  w  .  ja v  a2s.c  o  m*/
public void setSecurityGroups(String id, List<SecurityGroup> securityGroups) throws ExternalException {

    logger.info("Changing the security groups of tenant {} to {}", id, securityGroups.toString());

    TenantEntity tenantEntity = findById(id);
    tenantEntity.setSecurityGroups(SecurityGroupUtils.fromApiRepresentation(securityGroups));

    tenantDao.update(tenantEntity);
}

From source file:com.hightail.metrics.reporter.NewRelicReporterFactory.java

private static NewRelicReporter buildNewRelicHttpV1Instance(Properties properties)
        throws CannotCreateInstanceException {

    List<String> errorMsgs = new ArrayList<String>();

    if (!properties.containsKey(NewRelicConstants.METRIC_REGISTRY)
            || properties.get(NewRelicConstants.METRIC_REGISTRY) == null) {
        errorMsgs.add(NewRelicConstants.METRIC_REGISTRY + " is not provided");
    }// www .  ja v  a  2s .  c  o m

    if (!properties.containsKey(NewRelicConstants.LICENSE_KEY)
            || StringUtils.isBlank(properties.getProperty(NewRelicConstants.LICENSE_KEY))) {
        errorMsgs.add(NewRelicConstants.LICENSE_KEY + " is not provided");
    }

    if (!properties.containsKey(NewRelicConstants.COMPONENT_NAME)
            || StringUtils.isBlank(properties.getProperty(NewRelicConstants.COMPONENT_NAME))) {
        errorMsgs.add(NewRelicConstants.COMPONENT_NAME + " is not provided");
    }

    if (!properties.containsKey(NewRelicConstants.APP_ID)
            || StringUtils.isBlank(properties.getProperty(NewRelicConstants.APP_ID))) {
        errorMsgs.add(NewRelicConstants.APP_ID + " is not provided");
    }

    if (!errorMsgs.isEmpty()) {
        logger.error("Cannot instantiate New Relic Reporter because mandatory attributes are not provided: "
                + errorMsgs.toString());
        throw new CannotCreateInstanceException(errorMsgs.toString());
    }

    MetricRegistry registry = (MetricRegistry) properties.get(NewRelicConstants.METRIC_REGISTRY);
    String licenseKey = properties.getProperty(NewRelicConstants.LICENSE_KEY);
    String componentName = properties.getProperty(NewRelicConstants.COMPONENT_NAME);
    String appId = properties.getProperty(NewRelicConstants.APP_ID);

    String prefix = (properties.containsKey(NewRelicConstants.PREFIX))
            ? properties.getProperty(NewRelicConstants.PREFIX)
            : NewRelicConstants.DEFAULT_PREFIX;
    TimeUnit rateUnit = (properties.containsKey(NewRelicConstants.RATE_UNIT))
            ? (TimeUnit) properties.get(NewRelicConstants.RATE_UNIT)
            : NewRelicConstants.DEFAULT_RATE_UNIT;
    TimeUnit durationUnit = (properties.containsKey(NewRelicConstants.DURATION_UNIT))
            ? (TimeUnit) properties.get(NewRelicConstants.DURATION_UNIT)
            : NewRelicConstants.DEFAULT_DURATION_UNIT;
    MetricFilter filter = (properties.containsKey(NewRelicConstants.METRIC_FILTER))
            ? (MetricFilter) properties.get(NewRelicConstants.METRIC_FILTER)
            : NewRelicConstants.DEFAULT_METRIC_FILTER;

    NewRelic newRelic = new NewRelic(NewRelicConstants.DEFAULT_URL, licenseKey, componentName, appId);

    return NewRelicHTTPv1Reporter.forRegistry(registry).prefixedWith(prefix).convertRatesTo(rateUnit)
            .convertDurationsTo(durationUnit).filter(filter).build(newRelic);
}

From source file:forge.limited.BoosterDraftAI.java

/**
 * <p>/*from  ww w  . jav a 2s. co m*/
 * Choose a CardPrinted from the list given.
 * </p>
 *
 * @param chooseFrom
 *            List of CardPrinted
 * @param player
 *            a int.
 * @return a {@link forge.item.PaperCard} object.
 */
public PaperCard choose(final List<PaperCard> chooseFrom, final int player) {
    if (ForgePreferences.DEV_MODE) {
        System.out.println("Player[" + player + "] pack: " + chooseFrom.toString());
    }

    final DeckColors deckCols = this.playerColors.get(player);
    final ColorSet currentChoice = deckCols.getChosenColors();
    final boolean canAddMoreColors = deckCols.canChoseMoreColors();

    final List<Pair<PaperCard, Double>> rankedCards = rankCards(chooseFrom);

    for (final Pair<PaperCard, Double> p : rankedCards) {
        double valueBoost = 0;

        // If a card is not ai playable, somewhat decrease its rating
        if (p.getKey().getRules().getAiHints().getRemAIDecks()) {
            valueBoost = TAKE_BEST_THRESHOLD;
        }

        // if I cannot choose more colors, and the card cannot be played with chosen colors, decrease its rating.
        if (!canAddMoreColors
                && !p.getKey().getRules().getManaCost().canBePaidWithAvaliable(currentChoice.getColor())) {
            valueBoost = TAKE_BEST_THRESHOLD * 3;
        }

        if (valueBoost > 0) {
            p.setValue(p.getValue() + valueBoost);
            //System.out.println(p.getKey() + " is now " + p.getValue());
        }
    }

    double bestRanking = Double.MAX_VALUE;
    PaperCard bestPick = null;
    final List<PaperCard> possiblePick = new ArrayList<PaperCard>();
    for (final Pair<PaperCard, Double> p : rankedCards) {
        final double rating = p.getValue();
        if (rating <= bestRanking + .01) {
            if (rating < bestRanking) {
                // found a better card start a new list
                possiblePick.clear();
                bestRanking = rating;
            }
            possiblePick.add(p.getKey());
        }
    }

    bestPick = Aggregates.random(possiblePick);

    if (canAddMoreColors) {
        deckCols.addColorsOf(bestPick);
    }

    System.out.println("Player[" + player + "] picked: " + bestPick + " ranking of " + bestRanking);
    this.deck.get(player).add(bestPick);

    return bestPick;
}

From source file:com.playcez.GooglePlus.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final Intent intent = getIntent();
    if (intent == null || !intent.hasExtra("token")) {
        AuthUtils.refreshAuthToken(this);
        return;/*from   w  w w  .j  ava  2s . com*/
    }

    setContentView(R.layout.activity_list);
    mListView = (ListView) findViewById(R.id.activityList);

    loginProgress = ProgressDialog.show(GooglePlus.this, "Please wait", "Autheticating...", true);

    AsyncTask<String, Void, List<Activity>> task = new AsyncTask<String, Void, List<Activity>>() {

        @Override
        protected List<Activity> doInBackground(String... params) {
            try {
                plus = new PlusWrap(GooglePlus.this).get();
                Person mePerson = plus.people().get("me").execute();

                Log.d(TAG, "ID:\t" + mePerson.getId());
                Log.d(TAG, "Display Name:\t" + mePerson.getDisplayName());
                Log.d(TAG, "Image URL:\t" + mePerson.getImage().getUrl());
                Log.d(TAG, "Profile URL:\t" + mePerson.getUrl());

                final String TOKEN = "access_token";
                SharedPreferences myData = getSharedPreferences("myData", MODE_PRIVATE);
                Editor edit = myData.edit();
                edit.putString(TOKEN, "access_token");
                edit.putString("uid", mePerson.getId());
                edit.commit();
                Log.d(TAG, "hererre");
                String placesLived = "";
                String name = "";
                String json = "";
                JSONArray obj = null;
                try {
                    name = mePerson.getDisplayName().toString();
                    placesLived = mePerson.getPlacesLived().toString();
                    List<PersonPlacesLived> object = mePerson.getPlacesLived();
                    json = object.toString();
                    obj = new JSONArray(json);
                    json = obj.toString();
                } catch (Exception e) {
                    e.printStackTrace();
                }

                final SharedPreferences settings = getSharedPreferences(AuthUtils.PREFS_NAME, 0);
                final String account_name = settings.getString(AuthUtils.PREF_ACCOUNT_NAME, "");
                final String accessToken = settings.getString("accessToken", null);

                sendToServer("https://playcez.com/api_getUID.php", name, mePerson.getBirthday(),
                        mePerson.getId(), mePerson.getCurrentLocation(), obj, mePerson.getGender(), accessToken,
                        account_name);

                return plus.activities().list("me", "public").execute().getItems();
            } catch (IOException e) {
                loginProgress.dismiss();
                Toast.makeText(getApplicationContext(), "Check your network connection!", Toast.LENGTH_LONG)
                        .show();
                Log.e(TAG, "Unable to list recommended people for user: " + params[0], e);
            }
            return null;
        }

        @Override
        protected void onPostExecute(List<Activity> feed) {
            if (feed != null) {
                Log.d(TAG, feed + "");
                SharedPreferences data = getSharedPreferences("myData", MODE_PRIVATE);
                boolean showTut = data.getBoolean("showTut", true);
                Editor myEdit = data.edit();
                myEdit.putBoolean("showTut", false);
                myEdit.commit();

                if (showTut) {
                    startActivity(new Intent(getApplicationContext(), Tutorial3.class));
                } else {
                    startActivity(new Intent(getApplicationContext(), Start_Menu.class));
                }
                finish();
            } else {
            }
        }
    };
    task.execute("me");
}

From source file:edu.harvard.i2b2.fhirserver.ws.OAuth2AuthzEndpoint.java

public String srvResourceOwnerScopeChoice(String pmResponseXml) throws XQueryUtilException {
    String page = "<div align=\"center\"><br><p style=\"color:green\"> Authentication Successful!</p><br>"
            + "<br>Choose one of the following projects for the SMART session: <br></div><br>"
            + "<form align=\"center\" action=\"processScope\" method=\"post\">";
    List<String> projects = I2b2Util.getUserProjects(pmResponseXml);
    logger.trace("projects:" + projects.toString());
    for (String p : projects) {
        page += "<input type=\"radio\" name=\"project\" value=\"" + p + "\" checked>" + p + "<br>";
    }//w w  w. j av  a 2  s  . co  m
    page += "<br><input type=\"submit\" value=\"Submit\"></form>";

    return page;
}

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

@Override
@Transactional//from  ww  w . j ava2  s.  c  o m
public TaskEntity prepareSetSecurityGroups(String id, List<String> securityGroups) throws ExternalException {

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

    TenantEntity tenantEntity = findById(id);
    List<SecurityGroup> currSecurityGroups = SecurityGroupUtils
            .toApiRepresentation(tenantEntity.getSecurityGroups());
    Pair<List<SecurityGroup>, List<String>> result = SecurityGroupUtils
            .mergeSelfSecurityGroups(currSecurityGroups, securityGroups);
    tenantEntity.setSecurityGroups(SecurityGroupUtils.fromApiRepresentation(result.getLeft()));

    TaskEntity taskEntity = taskBackend.createQueuedTask(tenantEntity, Operation.SET_TENANT_SECURITY_GROUPS);

    StepEntity stepEntity = taskBackend.getStepBackend().createQueuedStep(taskEntity, tenantEntity,
            Operation.SET_TENANT_SECURITY_GROUPS);
    if (!result.getRight().isEmpty()) {
        stepEntity.addWarning(new SecurityGroupsAlreadyInheritedException(result.getRight()));
    }

    taskBackend.getStepBackend().createQueuedStep(taskEntity, tenantEntity,
            Operation.PUSH_TENANT_SECURITY_GROUPS);

    logger.info("Created Task: {}", taskEntity);
    return taskEntity;
}

From source file:com.netflix.conductor.contribs.queue.QueueManager.java

private void startMonitor(Status status, ObservableQueue queue) {

    queue.observe().subscribe((Message msg) -> {

        try {//  www.  j  a v  a2  s  .  c  o  m

            logger.debug("Got message {}", msg.getPayload());

            String payload = msg.getPayload();
            JsonNode payloadJSON = om.readTree(payload);
            String externalId = getValue("externalId", payloadJSON);
            if (externalId == null || "".equals(externalId)) {
                logger.error("No external Id found in the payload {}", payload);
                queue.ack(Arrays.asList(msg));
                return;
            }

            JsonNode json = om.readTree(externalId);
            String workflowId = getValue("workflowId", json);
            String taskRefName = getValue("taskRefName", json);
            if (workflowId == null || "".equals(workflowId)) {
                //This is a bad message, we cannot process it
                logger.error("No workflow id found in the message. {}", payload);
                queue.ack(Arrays.asList(msg));
                return;
            }
            Workflow workflow = es.getExecutionStatus(workflowId, true);
            Optional<Task> ot = Optional.empty();
            if (taskRefName == null || "".equals(taskRefName)) {
                logger.error(
                        "No taskRefName found in the message. If there is only one WAIT task, will mark it as completed. {}",
                        payload);
                ot = workflow.getTasks().stream()
                        .filter(task -> !task.getStatus().isTerminal() && task.getTaskType().equals(Wait.NAME))
                        .findFirst();
            } else {
                ot = workflow.getTasks().stream().filter(task -> !task.getStatus().isTerminal()
                        && task.getReferenceTaskName().equals(taskRefName)).findFirst();
            }

            if (!ot.isPresent()) {
                logger.error("No matching tasks to be found to be marked as completed for workflow {}",
                        workflowId);
                return;
            }

            Task task = ot.get();
            task.setStatus(status);
            task.getOutputData().putAll(om.convertValue(payloadJSON, _mapType));
            es.updateTask(task);

            List<String> failures = queue.ack(Arrays.asList(msg));
            if (!failures.isEmpty()) {
                logger.error("Not able to ack the messages {}", failures.toString());
            }

        } catch (JsonParseException e) {
            logger.error("Bad mesage? " + e.getMessage(), e);
            queue.ack(Arrays.asList(msg));

        } catch (ApplicationException e) {
            if (e.getCode().equals(Code.NOT_FOUND)) {
                logger.error("Workflow ID specified is not valid for this environment: " + e.getMessage());
                queue.ack(Arrays.asList(msg));
            }
            logger.error(e.getMessage(), e);
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }

    }, (Throwable t) -> {
        logger.error(t.getMessage(), t);
    });
    logger.info("QueueListener::STARTED...listening for " + queue.getName());
}