Example usage for org.apache.commons.lang StringUtils deleteWhitespace

List of usage examples for org.apache.commons.lang StringUtils deleteWhitespace

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils deleteWhitespace.

Prototype

public static String deleteWhitespace(String str) 

Source Link

Document

Deletes all whitespaces from a String as defined by Character#isWhitespace(char) .

Usage

From source file:org.mifos.config.persistence.ApplicationConfigurationPersistenceIntegrationTest.java

@Test
public void testGetLookupEntities() {
    List<LookUpEntity> entities = applicationConfigurationDao.findLookupEntities();
    Assert.assertNotNull(entities);//from  ww  w . j  a  va2 s.c o  m

    // Enforce that no entity names contain whitespace
    for (LookUpEntity entity : entities) {
        Assert.assertEquals(StringUtils.deleteWhitespace(entity.getEntityType()), entity.getEntityType());

        Set<LookUpLabelEntity> labels = entity.getLookUpLabels();

        // Enforce that each entity has 0 or 1 labels and not more
        Assert.assertTrue(labels.size() <= 1);
        for (LookUpLabelEntity label : labels) {
            //                if (entity.getEntityType().equals("Client")) {
            //                    Assert.assertEquals("Client", label.getLabelText());
            //                }
        }
    }

}

From source file:org.mortagne.budget.transaction.AbstractTransaction.java

public String getId() {
    StringBuilder buffer = new StringBuilder();

    buffer.append(this.date.getTime());
    if (this.realDate != null) {
        buffer.append(this.realDate.getTime());
    }/*from  w ww.j  av a  2s .co  m*/
    buffer.append(this.value);
    if (this.type != null) {
        buffer.append(this.type);
    }
    if (this.description != null) {
        buffer.append(StringUtils.deleteWhitespace(this.description).toUpperCase());
    }

    return buffer.toString();
}

From source file:org.msec.sink.es.ESSink.java

@Override
public void configure(Context context) {
    pathController = PathManagerFactory.getInstance("DEFAULT", context);

    if (StringUtils.isNotBlank(context.getString("hosts"))) {
        serverAddressStrings = StringUtils.deleteWhitespace(context.getString("hosts")).split(",");
    }//from   w ww.  j a  v a2 s  .c o  m
    Preconditions.checkState(serverAddressStrings != null && serverAddressStrings.length > 0,
            "Missing Param:" + "hosts");

    if (StringUtils.isNotBlank(context.getString("indexName"))) {
        this.indexName = context.getString("indexName");
    }

    if (StringUtils.isNotBlank(context.getString("indexType"))) {
        this.indexType = context.getString("indexType");
    }

    if (StringUtils.isNotBlank(context.getString("clusterName"))) {
        this.clusterName = context.getString("clusterName");
    }

    if (StringUtils.isNotBlank(context.getString("indexRollingTime"))) {
        this.indexRollingTime = context.getString("indexRollingTime");
    }

    bulkNum = context.getInteger("bulkNum", 1);

    batchSize = context.getInteger("batchSize", 100);
    Preconditions.checkNotNull(batchSize > 0, "batchSize must be a positive number!!");

    maxContentLength = context.getInteger("maxContentLength", 1000);
    Preconditions.checkNotNull(maxContentLength > 0, "maxContentLength must be a positive number!!");
}

From source file:org.nuclos.client.wizard.NuclosEntityWizardStaticModel.java

public String getTableOrViewName() {
    final boolean virtual = !StringUtils.isBlank(virtualentity);
    if (strTableName != null) {
        if (!virtual && strTableName.startsWith("V_")) {
            strTableName = "T_" + strTableName.substring(2);
        } else if (virtual && strTableName.startsWith("T_")) {
            strTableName = "V_" + strTableName.substring(2);
        }//from   w w w .  j  ava  2  s .  c o  m
        if (strTableName.length() > 30) {
            return StringUtils.abbreviate(StringUtils.deleteWhitespace(strTableName).toUpperCase(), 30);
        } else if (strTableName.length() < 1) {
            final String sTable = (virtual ? "V_EO" : "T_EO_")
                    + StringUtils.deleteWhitespace(entityName).toUpperCase();
            return sTable;
        } else {
            return strTableName;
        }
    } else {
        final String sTable = StringUtils.abbreviate(
                (virtual ? "V_EO" : "T_EO_") + StringUtils.deleteWhitespace(entityName).toUpperCase(), 30);
        return sTable;
    }
}

From source file:org.occiware.clouddesigner.occi.docker.connector.dockerjava.DockerContainerManager.java

public CreateContainerCmd containerFactory(final Container container, final DockerClient dockerClient) {
    CreateContainerCmd create = null;//  w ww . j a  v  a  2 s .  c  om
    String _image = container.getImage();
    boolean _isNotBlank = StringUtils.isNotBlank(_image);
    if (_isNotBlank) {
        String _image_1 = container.getImage();
        String _trim = _image_1.trim();
        CreateContainerCmd _createContainerCmd = dockerClient.createContainerCmd(_trim);
        create = _createContainerCmd;
    } else {
        CreateContainerCmd _createContainerCmd_1 = dockerClient.createContainerCmd("busybox");
        create = _createContainerCmd_1;
    }
    String _command = container.getCommand();
    boolean _isNotBlank_1 = StringUtils.isNotBlank(_command);
    if (_isNotBlank_1) {
        String _command_1 = container.getCommand();
        String _deleteWhitespace = StringUtils.deleteWhitespace(_command_1);
        String[] cmd = _deleteWhitespace.split(",");
        create.withCmd(cmd);
    } else {
        create.withCmd("sleep", "9999");
    }
    int _cpu_shares = container.getCpu_shares();
    boolean _greaterThan = (_cpu_shares > 0);
    if (_greaterThan) {
        int _cpu_shares_1 = container.getCpu_shares();
        create.withCpuShares(Integer.valueOf(_cpu_shares_1));
    }
    String _add_host = container.getAdd_host();
    boolean _isNotBlank_2 = StringUtils.isNotBlank(_add_host);
    if (_isNotBlank_2) {
        String _hostname = container.getHostname();
        String _deleteWhitespace_1 = StringUtils.deleteWhitespace(_hostname);
        create.withHostName(_deleteWhitespace_1);
    }
    String _cpuset = container.getCpuset();
    boolean _isNotBlank_3 = StringUtils.isNotBlank(_cpuset);
    if (_isNotBlank_3) {
        String _cpuset_1 = container.getCpuset();
        String _deleteWhitespace_2 = StringUtils.deleteWhitespace(_cpuset_1);
        create.withCpusetCpus(_deleteWhitespace_2);
    }
    boolean _isPrivileged = container.isPrivileged();
    if (_isPrivileged) {
        boolean _isPrivileged_1 = container.isPrivileged();
        create.withPrivileged(Boolean.valueOf(_isPrivileged_1));
    }
    String _dns = container.getDns();
    boolean _isNotBlank_4 = StringUtils.isNotBlank(_dns);
    if (_isNotBlank_4) {
        String _dns_1 = container.getDns();
        String _deleteWhitespace_3 = StringUtils.deleteWhitespace(_dns_1);
        create.withDns(_deleteWhitespace_3);
    }
    String _environment = container.getEnvironment();
    boolean _isNotBlank_5 = StringUtils.isNotBlank(_environment);
    if (_isNotBlank_5) {
        String _environment_1 = container.getEnvironment();
        String _deleteWhitespace_4 = StringUtils.deleteWhitespace(_environment_1);
        String[] env = _deleteWhitespace_4.split(",");
        create.withEnv(env);
    }
    String _ports = container.getPorts();
    String _plus = ("Container ports = " + _ports);
    DockerContainerManager.LOGGER.info(_plus);
    String _ports_1 = container.getPorts();
    boolean _isNotBlank_6 = StringUtils.isNotBlank(_ports_1);
    if (_isNotBlank_6) {
        String _ports_2 = container.getPorts();
        final String[] l_r_ports = _ports_2.split(":");
        String _get = l_r_ports[0];
        int _parseInt = Integer.parseInt(_get);
        ExposedPort tcp = ExposedPort.tcp(_parseInt);
        final Ports portBindings = new Ports();
        int _size = ((List<String>) Conversions.doWrapArray(l_r_ports)).size();
        boolean _equals = (_size == 2);
        if (_equals) {
            String _get_1 = l_r_ports[1];
            boolean _isNotBlank_7 = StringUtils.isNotBlank(_get_1);
            if (_isNotBlank_7) {
                String _get_2 = l_r_ports[1];
                int _parseInt_1 = Integer.parseInt(_get_2);
                Ports.Binding _bindPort = Ports.Binding.bindPort(_parseInt_1);
                portBindings.bind(tcp, _bindPort);
            } else {
                Ports.Binding _bindPort_1 = Ports.Binding.bindPort(32768);
                portBindings.bind(tcp, _bindPort_1);
            }
        }
        CreateContainerCmd _withExposedPorts = create.withExposedPorts(tcp);
        _withExposedPorts.withPortBindings(portBindings);
    }
    String _name = container.getName();
    boolean _isNotBlank_8 = StringUtils.isNotBlank(_name);
    if (_isNotBlank_8) {
        String _name_1 = container.getName();
        String _deleteWhitespace_5 = StringUtils.deleteWhitespace(_name_1);
        create.withName(_deleteWhitespace_5);
    }
    String _hostname_1 = container.getHostname();
    boolean _isNotBlank_9 = StringUtils.isNotBlank(_hostname_1);
    if (_isNotBlank_9) {
        String _hostname_2 = container.getHostname();
        String _deleteWhitespace_6 = StringUtils.deleteWhitespace(_hostname_2);
        create.withHostName(_deleteWhitespace_6);
    }
    String _net = container.getNet();
    boolean _isNotBlank_10 = StringUtils.isNotBlank(_net);
    if (_isNotBlank_10) {
        String _net_1 = container.getNet();
        create.withNetworkMode(_net_1);
    }
    boolean _isPublish_all = container.isPublish_all();
    if (_isPublish_all) {
        boolean _isPublish_all_1 = container.isPublish_all();
        create.withPublishAllPorts(Boolean.valueOf(_isPublish_all_1));
    }
    boolean _isStdin_open = container.isStdin_open();
    if (_isStdin_open) {
        boolean _isStdin_open_1 = container.isStdin_open();
        create.withStdInOnce(Boolean.valueOf(_isStdin_open_1));
    }
    String _user = container.getUser();
    boolean _isNotBlank_11 = StringUtils.isNotBlank(_user);
    if (_isNotBlank_11) {
        String _user_1 = container.getUser();
        create.withUser(_user_1);
    }
    String _volumes = container.getVolumes();
    boolean _isNotBlank_12 = StringUtils.isNotBlank(_volumes);
    if (_isNotBlank_12) {
        String _volumes_1 = container.getVolumes();
        Volume _volume = new Volume(_volumes_1);
        create.withVolumes(_volume);
    }
    int _mem_limit = container.getMem_limit();
    boolean _greaterThan_1 = (_mem_limit > 0);
    if (_greaterThan_1) {
        int _mem_limit_1 = container.getMem_limit();
        Long _valueOf = Long.valueOf(_mem_limit_1);
        create.withMemory(_valueOf);
    }
    int _memory_swap = container.getMemory_swap();
    boolean _greaterThan_2 = (_memory_swap > 0);
    if (_greaterThan_2) {
        int _memory_swap_1 = container.getMemory_swap();
        Long _valueOf_1 = Long.valueOf(_memory_swap_1);
        create.withMemory(_valueOf_1);
    }
    String _lxc_conf = container.getLxc_conf();
    boolean _isNotBlank_13 = StringUtils.isNotBlank(_lxc_conf);
    if (_isNotBlank_13) {
        final LxcConf lxcCon = new LxcConf("key", "value");
        create.withLxcConf(lxcCon);
    }
    String _domainname = container.getDomainname();
    boolean _isNotBlank_14 = StringUtils.isNotBlank(_domainname);
    if (_isNotBlank_14) {
        String _domainname_1 = container.getDomainname();
        create.withDomainName(_domainname_1);
    }
    String _dns_search = container.getDns_search();
    boolean _isNotBlank_15 = StringUtils.isNotBlank(_dns_search);
    if (_isNotBlank_15) {
        String _dns_search_1 = container.getDns_search();
        String[] dnsSearch = _dns_search_1.split(",");
        create.withDnsSearch(dnsSearch);
    }
    String _entrypoint = container.getEntrypoint();
    boolean _isNotBlank_16 = StringUtils.isNotBlank(_entrypoint);
    if (_isNotBlank_16) {
        String _entrypoint_1 = container.getEntrypoint();
        String[] entrypoint = _entrypoint_1.split(",");
        create.withEntrypoint(entrypoint);
    }
    String _net_2 = container.getNet();
    boolean _isNotBlank_17 = StringUtils.isNotBlank(_net_2);
    if (_isNotBlank_17) {
        String _net_3 = container.getNet();
        String _deleteWhitespace_7 = StringUtils.deleteWhitespace(_net_3);
        create.withNetworkMode(_deleteWhitespace_7);
    }
    String _pid = container.getPid();
    boolean _isNotBlank_18 = StringUtils.isNotBlank(_pid);
    if (_isNotBlank_18) {
        String _pid_1 = container.getPid();
        String _deleteWhitespace_8 = StringUtils.deleteWhitespace(_pid_1);
        create.withPidMode(_deleteWhitespace_8);
    }
    boolean _isPrivileged_2 = container.isPrivileged();
    if (_isPrivileged_2) {
        boolean _isPrivileged_3 = container.isPrivileged();
        create.withPrivileged(Boolean.valueOf(_isPrivileged_3));
    }
    boolean _isPublish_all_2 = container.isPublish_all();
    if (_isPublish_all_2) {
        boolean _isPublish_all_3 = container.isPublish_all();
        create.withPublishAllPorts(Boolean.valueOf(_isPublish_all_3));
    }
    boolean _isRead_only = container.isRead_only();
    if (_isRead_only) {
        boolean _isRead_only_1 = container.isRead_only();
        create.withReadonlyRootfs(Boolean.valueOf(_isRead_only_1));
    }
    boolean _isTty = container.isTty();
    if (_isTty) {
        boolean _isTty_1 = container.isTty();
        create.withTty(Boolean.valueOf(_isTty_1));
    }
    String _restart = container.getRestart();
    boolean _isNotBlank_19 = StringUtils.isNotBlank(_restart);
    if (_isNotBlank_19) {
        String _restart_1 = container.getRestart();
        String _deleteWhitespace_9 = StringUtils.deleteWhitespace(_restart_1);
        RestartPolicy _parse = RestartPolicy.parse(_deleteWhitespace_9);
        create.withRestartPolicy(_parse);
    }
    String _working_dir = container.getWorking_dir();
    boolean _isNotBlank_20 = StringUtils.isNotBlank(_working_dir);
    if (_isNotBlank_20) {
        String _working_dir_1 = container.getWorking_dir();
        String _deleteWhitespace_10 = StringUtils.deleteWhitespace(_working_dir_1);
        create.withWorkingDir(_deleteWhitespace_10);
        create.getCpusetCpus();
    }
    return create;
}

From source file:org.occiware.clouddesigner.occi.docker.connector.dockerjava.DockerContainerManager.java

public CreateContainerCmd containerFactory(final Container container, final DockerClient dockerClient,
        final Multimap<String, String> containerDependency) {
    CreateContainerCmd create = null;/*from  w  w  w  .j a  v  a 2 s .  c  om*/
    String _image = container.getImage();
    boolean _notEquals = (!Objects.equal(_image, null));
    if (_notEquals) {
        String _image_1 = container.getImage();
        String _trim = _image_1.trim();
        CreateContainerCmd _createContainerCmd = dockerClient.createContainerCmd(_trim);
        create = _createContainerCmd;
    } else {
        String _image_2 = container.getImage();
        boolean _equals = Objects.equal(_image_2, null);
        if (_equals) {
            CreateContainerCmd _createContainerCmd_1 = dockerClient.createContainerCmd("busybox");
            create = _createContainerCmd_1;
        }
    }
    String _command = container.getCommand();
    boolean _isNotBlank = StringUtils.isNotBlank(_command);
    if (_isNotBlank) {
        String _command_1 = container.getCommand();
        String _deleteWhitespace = StringUtils.deleteWhitespace(_command_1);
        final String[] cmd = _deleteWhitespace.split(",");
        create.withCmd(cmd);
    } else {
        create.withCmd("sleep", "9999");
    }
    int _cpu_shares = container.getCpu_shares();
    boolean _greaterThan = (_cpu_shares > 0);
    if (_greaterThan) {
        int _cpu_shares_1 = container.getCpu_shares();
        create.withCpuShares(Integer.valueOf(_cpu_shares_1));
    }
    String _add_host = container.getAdd_host();
    boolean _isNotBlank_1 = StringUtils.isNotBlank(_add_host);
    if (_isNotBlank_1) {
        String _hostname = container.getHostname();
        String _deleteWhitespace_1 = StringUtils.deleteWhitespace(_hostname);
        create.withHostName(_deleteWhitespace_1);
    }
    String _cpuset = container.getCpuset();
    boolean _isNotBlank_2 = StringUtils.isNotBlank(_cpuset);
    if (_isNotBlank_2) {
        String _cpuset_1 = container.getCpuset();
        String _deleteWhitespace_2 = StringUtils.deleteWhitespace(_cpuset_1);
        create.withCpusetCpus(_deleteWhitespace_2);
    }
    boolean _isPrivileged = container.isPrivileged();
    if (_isPrivileged) {
        boolean _isPrivileged_1 = container.isPrivileged();
        create.withPrivileged(Boolean.valueOf(_isPrivileged_1));
    }
    String _dns = container.getDns();
    boolean _isBlank = StringUtils.isBlank(_dns);
    boolean _not = (!_isBlank);
    if (_not) {
        String _dns_1 = container.getDns();
        String _deleteWhitespace_3 = StringUtils.deleteWhitespace(_dns_1);
        create.withDns(_deleteWhitespace_3);
    }
    String _environment = container.getEnvironment();
    boolean _isBlank_1 = StringUtils.isBlank(_environment);
    boolean _not_1 = (!_isBlank_1);
    if (_not_1) {
        String _environment_1 = container.getEnvironment();
        String _deleteWhitespace_4 = StringUtils.deleteWhitespace(_environment_1);
        create.withEnv(_deleteWhitespace_4);
    }
    String _ports = container.getPorts();
    boolean _isBlank_2 = StringUtils.isBlank(_ports);
    boolean _not_2 = (!_isBlank_2);
    if (_not_2) {
        String _ports_1 = container.getPorts();
        final String[] ports = _ports_1.split(":");
        String _get = ports[0];
        int _parseInt = Integer.parseInt(_get);
        ExposedPort port = ExposedPort.tcp(_parseInt);
        final Ports portBindings = new Ports();
        int _size = ((List<String>) Conversions.doWrapArray(ports)).size();
        boolean _equals_1 = (_size == 2);
        if (_equals_1) {
            String _get_1 = ports[1];
            int _parseInt_1 = Integer.parseInt(_get_1);
            Ports.Binding _bindPort = Ports.Binding.bindPort(_parseInt_1);
            portBindings.bind(port, _bindPort);
        } else {
            int _size_1 = ((List<String>) Conversions.doWrapArray(ports)).size();
            boolean _equals_2 = (_size_1 == 1);
            if (_equals_2) {
                String _get_2 = ports[0];
                int _parseInt_2 = Integer.parseInt(_get_2);
                Ports.Binding _bindPort_1 = Ports.Binding.bindPort(_parseInt_2);
                portBindings.bind(port, _bindPort_1);
            }
        }
        create.withPortBindings(portBindings);
    }
    String _name = container.getName();
    boolean _isBlank_3 = StringUtils.isBlank(_name);
    boolean _not_3 = (!_isBlank_3);
    if (_not_3) {
        String _name_1 = container.getName();
        String _deleteWhitespace_5 = StringUtils.deleteWhitespace(_name_1);
        create.withName(_deleteWhitespace_5);
    }
    String _hostname_1 = container.getHostname();
    boolean _isBlank_4 = StringUtils.isBlank(_hostname_1);
    boolean _not_4 = (!_isBlank_4);
    if (_not_4) {
        String _hostname_2 = container.getHostname();
        String _deleteWhitespace_6 = StringUtils.deleteWhitespace(_hostname_2);
        create.withName(_deleteWhitespace_6);
    }
    String _net = container.getNet();
    boolean _isBlank_5 = StringUtils.isBlank(_net);
    boolean _not_5 = (!_isBlank_5);
    if (_not_5) {
        String _net_1 = container.getNet();
        String _deleteWhitespace_7 = StringUtils.deleteWhitespace(_net_1);
        create.withNetworkMode(_deleteWhitespace_7);
    }
    boolean _isPublish_all = container.isPublish_all();
    if (_isPublish_all) {
        boolean _isPublish_all_1 = container.isPublish_all();
        create.withPublishAllPorts(Boolean.valueOf(_isPublish_all_1));
    }
    boolean _isTty = container.isTty();
    if (_isTty) {
        boolean _isTty_1 = container.isTty();
        create.withTty(Boolean.valueOf(_isTty_1));
    }
    boolean _isStdin_open = container.isStdin_open();
    if (_isStdin_open) {
        boolean _isStdin_open_1 = container.isStdin_open();
        create.withStdInOnce(Boolean.valueOf(_isStdin_open_1));
    }
    String _user = container.getUser();
    boolean _isBlank_6 = StringUtils.isBlank(_user);
    boolean _not_6 = (!_isBlank_6);
    if (_not_6) {
        String _user_1 = container.getUser();
        String _deleteWhitespace_8 = StringUtils.deleteWhitespace(_user_1);
        create.withUser(_deleteWhitespace_8);
    }
    String _volumes = container.getVolumes();
    boolean _isBlank_7 = StringUtils.isBlank(_volumes);
    boolean _not_7 = (!_isBlank_7);
    if (_not_7) {
        String _volumes_1 = container.getVolumes();
        String _deleteWhitespace_9 = StringUtils.deleteWhitespace(_volumes_1);
        Volume _volume = new Volume(_deleteWhitespace_9);
        create.withVolumes(_volume);
    }
    int _mem_limit = container.getMem_limit();
    boolean _greaterThan_1 = (_mem_limit > 0);
    if (_greaterThan_1) {
        int _mem_limit_1 = container.getMem_limit();
        Long _valueOf = Long.valueOf(_mem_limit_1);
        create.withMemory(_valueOf);
    }
    int _memory_swap = container.getMemory_swap();
    boolean _greaterThan_2 = (_memory_swap > 0);
    if (_greaterThan_2) {
        int _memory_swap_1 = container.getMemory_swap();
        Long _valueOf_1 = Long.valueOf(_memory_swap_1);
        create.withMemorySwap(_valueOf_1);
    }
    String _lxc_conf = container.getLxc_conf();
    boolean _isBlank_8 = StringUtils.isBlank(_lxc_conf);
    boolean _not_8 = (!_isBlank_8);
    if (_not_8) {
        final LxcConf lxcCon = new LxcConf("key", "value");
        create.withLxcConf(lxcCon);
    }
    String _name_2 = container.getName();
    boolean _containsKey = containerDependency.containsKey(_name_2);
    if (_containsKey) {
        String _name_3 = container.getName();
        Collection<String> _get_3 = containerDependency.get(_name_3);
        LinkedHashSet<String> _linkedHashSet = new LinkedHashSet<String>(_get_3);
        final List<String> depdupeContainers = new ArrayList<String>(_linkedHashSet);
        List<Link> dockeClientlinks = new ArrayList<Link>();
        Link dockeClientlink = null;
        for (final String entry : depdupeContainers) {
            {
                String _name_4 = container.getName();
                String _plus = (_name_4 + "LinkTo");
                String _plus_1 = (_plus + entry);
                Link _link = new Link(entry, _plus_1);
                dockeClientlink = _link;
                dockeClientlinks.add(dockeClientlink);
            }
        }
        int _size_2 = depdupeContainers.size();
        boolean _greaterThan_3 = (_size_2 > 1);
        if (_greaterThan_3) {
            create.withLinks(dockeClientlinks);
        } else {
            int _size_3 = depdupeContainers.size();
            boolean _equals_3 = (_size_3 == 1);
            if (_equals_3) {
                create.withLinks(dockeClientlink);
            }
        }
    }
    return create;
}

From source file:org.occiware.clouddesigner.occi.docker.connector.ModelHandler.java

public org.occiware.clouddesigner.occi.docker.Container buildContainer(final Machine machine,
        final String containerId) {
    final DockerContainerManager instance = new DockerContainerManager(machine);
    final InspectContainerResponse currentContainer = instance.inspectContainer(machine, containerId);
    org.occiware.clouddesigner.occi.docker.Container modelContainer = DockerFactory.eINSTANCE.createContainer();
    String _id = currentContainer.getId();
    modelContainer.setId(_id);//from   ww w . j  a v a2s  . c om
    String _name = currentContainer.getName();
    String _replace = _name.replace("/", "");
    modelContainer.setName(_replace);
    ContainerConfig _config = currentContainer.getConfig();
    String _image = _config.getImage();
    modelContainer.setImage(_image);
    ContainerConfig _config_1 = currentContainer.getConfig();
    String[] _cmd = _config_1.getCmd();
    boolean _isEmpty = ((List<String>) Conversions.doWrapArray(_cmd)).isEmpty();
    boolean _not = (!_isEmpty);
    if (_not) {
        ContainerConfig _config_2 = currentContainer.getConfig();
        String[] _cmd_1 = _config_2.getCmd();
        String _string = Arrays.toString(_cmd_1);
        String _replace_1 = _string.replace("[", "");
        String _replace_2 = _replace_1.replace("]", "");
        String _deleteWhitespace = StringUtils.deleteWhitespace(_replace_2);
        modelContainer.setCommand(_deleteWhitespace);
    }
    String _id_1 = currentContainer.getId();
    modelContainer.setContainerid(_id_1);
    ContainerConfig _config_3 = currentContainer.getConfig();
    String _macAddress = _config_3.getMacAddress();
    modelContainer.setMac_address(_macAddress);
    ContainerConfig _config_4 = currentContainer.getConfig();
    String _domainName = _config_4.getDomainName();
    modelContainer.setDomainname(_domainName);
    ContainerConfig _config_5 = currentContainer.getConfig();
    String _hostName = _config_5.getHostName();
    modelContainer.setHostname(_hostName);
    ContainerConfig _config_6 = currentContainer.getConfig();
    String _workingDir = _config_6.getWorkingDir();
    modelContainer.setWorking_dir(_workingDir);
    ContainerConfig _config_7 = currentContainer.getConfig();
    String[] _entrypoint = _config_7.getEntrypoint();
    String _string_1 = Arrays.toString(_entrypoint);
    modelContainer.setEntrypoint(_string_1);
    ContainerConfig _config_8 = currentContainer.getConfig();
    String[] _env = _config_8.getEnv();
    String _string_2 = Arrays.toString(_env);
    String _replace_3 = _string_2.replace("[", "");
    String _replace_4 = _replace_3.replace("]", "");
    modelContainer.setEnvironment(_replace_4);
    ContainerConfig _config_9 = currentContainer.getConfig();
    Boolean _tty = _config_9.getTty();
    modelContainer.setTty((_tty).booleanValue());
    ContainerConfig _config_10 = currentContainer.getConfig();
    Boolean _stdinOpen = _config_10.getStdinOpen();
    modelContainer.setStdin_open((_stdinOpen).booleanValue());
    String _processLabel = currentContainer.getProcessLabel();
    modelContainer.setPid(_processLabel);
    InspectContainerResponse.ContainerState _state = currentContainer.getState();
    Boolean _running = _state.getRunning();
    if ((_running).booleanValue()) {
        modelContainer.setState(ComputeStatus.ACTIVE);
    } else {
        modelContainer.setState(ComputeStatus.INACTIVE);
    }
    return modelContainer;
}

From source file:org.openbravo.erpCommon.ad_callouts.SL_ProductPrice_PriceListVersion.java

private void printPage(HttpServletResponse response, VariablesSecureApp vars, String strPriceListV,
        String strOrg) throws IOException, ServletException {
    if (log4j.isDebugEnabled())
        log4j.debug("Output: dataSheet");
    XmlDocument xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_callouts/CallOut")
            .createXmlDocument();// ww  w .j av  a 2  s.  com

    try {
        OBContext.setAdminMode();
        StringBuilder resultado = new StringBuilder();
        boolean hasAccessTo = false;

        // If the role has access to the Price List Version Organization, we set this organization to
        // the record.
        PriceListVersion plv = OBDal.getInstance().get(PriceListVersion.class, strPriceListV);
        final String plvOrgId = plv.getOrganization().getId();
        Role role = OBDal.getInstance().get(Role.class, vars.getRole());
        String roleOrgListStr = role.getOrganizationList();
        if (StringUtils.contains(role.getUserLevel(), "C")) {
            // If the role is for Client or Client + Organization, we add * organization to the list
            roleOrgListStr = roleOrgListStr + ",0";
        }
        StringTokenizer roleOrgList = new StringTokenizer(StringUtils.deleteWhitespace(roleOrgListStr), ",");
        while (!hasAccessTo && roleOrgList.hasMoreTokens()) {
            hasAccessTo = StringUtils.equals(roleOrgList.nextToken(), plvOrgId);
        }

        resultado.append("var calloutName='SL_ProductPrice_PriceListVersion';\n\n");
        resultado.append("var respuesta = new Array(");
        resultado.append("new Array(\"inpadOrgId\", \"" + ((hasAccessTo) ? plvOrgId : strOrg) + "\"));");
        xmlDocument.setParameter("array", resultado.toString());
        xmlDocument.setParameter("frameName", "appFrame");
        response.setContentType("text/html; charset=UTF-8");
        PrintWriter out = response.getWriter();
        out.println(xmlDocument.print());
        out.close();
    } finally {
        OBContext.restorePreviousMode();
    }
}

From source file:org.openbravo.module.taxreportlauncher.Dao.TaxReportLauncherDao.java

/**
 * Returns a List of Period objects for the list of comma-separated Period's ID string
 * /*ww  w  . j  av a 2  s.c  om*/
 * @param strPeriodIds
 *          comma-separated Period's ID. Example: "1000,1001,1002"
 * @return a List of Period objects
 */
public List<Period> getPeriods(String strPeriodIds) {
    List<Period> periods = new ArrayList<Period>();
    StringTokenizer st = new StringTokenizer(StringUtils.deleteWhitespace(strPeriodIds), ",");
    while (st.hasMoreTokens()) {
        periods.add(this.getPeriod(st.nextToken()));
    }
    return periods;
}

From source file:org.openbravo.module.taxreportlauncher.erpCommon.ad_reports.OBTL_TaxReportLauncher.java

private void throwOBError(HttpServletResponse response, VariablesSecureApp vars, Exception e)
        throws IOException, ServletException {

    OBError obError = new OBError();
    obError.setType("Error");

    if (e instanceof OBTL_Exception) {
        obError.setTitle(// w ww.j a va2s  . co m
                Utility.parseTranslation(this, vars, vars.getLanguage(), ((OBTL_Exception) e).getTitle()));
        obError.setMessage(Utility.parseTranslation(this, vars, vars.getLanguage(), e.getMessage()));
    } else if (e instanceof ClassNotFoundException) {
        obError.setTitle(Utility.parseTranslation(this, vars, vars.getLanguage(), "@OBTL_ClassNotFound@"));
        obError.setMessage(e.getMessage());
    } else if (e instanceof StringIndexOutOfBoundsException) {
        obError.setTitle(
                Utility.parseTranslation(this, vars, vars.getLanguage(), "@OBTL_StringIndexOutOfBoundsTitle@"));
        String eMsg = e.getMessage();
        Integer position = new Integer(
                StringUtils.deleteWhitespace(eMsg.substring(eMsg.lastIndexOf(":") + 1, eMsg.length()))) + 1;
        obError.setMessage(Utility.parseTranslation(this, vars, vars.getLanguage(),
                "@OBTL_StringIndexOutOfBoundsMessage@" + position));
    } else {
        e.printStackTrace();
        throw new ServletException(e);
    }

    vars.setMessage("TaxReportLauncher", obError);
    this.printPagePopUp(response, vars);
}