Example usage for org.apache.commons.lang ArrayUtils isEmpty

List of usage examples for org.apache.commons.lang ArrayUtils isEmpty

Introduction

In this page you can find the example usage for org.apache.commons.lang ArrayUtils isEmpty.

Prototype

public static boolean isEmpty(boolean[] array) 

Source Link

Document

Checks if an array of primitive booleans is empty or null.

Usage

From source file:com.qatickets.service.TicketService.java

@Transactional(readOnly = false)
public void updateComponents(UserProfile user, int projectId, int ticketId, Integer[] components) {

    log.debug("Update components for ticket: " + ticketId + " to '" + components + "'");

    final Ticket ticket = this.findById(ticketId);
    final Project project = this.projectService.findById(projectId);

    if (ticket == null || project == null) {
        return;//  w ww .ja  v  a2  s.  c  o  m
    }

    // delete existing ticket components
    ticketComponentDao.deleteByTicket(ticket);

    final Set<TicketComponent> list = new HashSet<TicketComponent>();
    ticket.setComponents(list);

    if (!ArrayUtils.isEmpty(components)) {
        for (Integer componentId : components) {
            final Component component = this.componentService.findByProjectAndId(project, componentId);
            if (component != null) {
                log.debug("Add component: " + component.getName() + " to ticket: " + ticket.getNum());
                ticket.addComponent(new TicketComponent(ticket, component));
            }
        }
    }

    this.save(ticket);

}

From source file:com.etcc.csc.presentation.datatype.PaymentContext.java

public BigDecimal getCollectionInvTotalFNAdminFee() {
    BigDecimal amount = BigDecimal.ZERO;
    if (!ArrayUtils.isEmpty(collectionInvs)) {
        for (int i = 0; i < collectionInvs.length; i++) {
            if ("N".equals(collectionInvs[i].getPaidIndicator())) {
                amount = amount.add(BigDecimalUtil.nullSafe(collectionInvs[i].getInvoiceAdminFee()));
            }/*w  ww  . j ava 2  s  .  com*/
        }
    }
    return amount;
}

From source file:eu.europeana.api2.v2.model.json.view.FullView.java

public String getAttributionSnippet(boolean firstOnly, boolean htmlOut) {
    String rightsPage = "rel=\"xhv:license http://www.europeana.eu/schemas/edm/rights\"";
    String resPdUsgGd = "resource=\"http://www.europeana.eu/rights/pd-usage-guide/\"";
    String aHref = "<a href=\"";
    String zHref = "\">";
    String ferh = "</a>";
    String naps = "</span>";
    String retval = "", landingPage = "", title = "", creator = "", dataProvider = "", shownAt = "",
            shownBy = "", rights = "";
    int i, j;//from  w  w w  .  j ava  2 s  .c om

    List<? extends Proxy> prxs = getProxies();
    EuropeanaAggregation euAgg = getEuropeanaAggregation();
    Aggregation agg = getAggregations().get(0);

    // if there are proxies present: check if there are dc:creator / dc:title data in there
    if (!prxs.isEmpty()) {
        for (Proxy prx : prxs) {
            // check for dc:creator
            if ("".equals(creator) && prx.getDcCreator() != null && !prx.getDcCreator().isEmpty()) {
                if (prx.getDcCreator().get("def") != null) {
                    List<String> dcc = stripEmptyStrings(prx.getDcCreator().get("def"));
                    // assign possible multiple 'def' entries to creator
                    j = dcc.size();
                    i = 1;
                    creator += "(def) ";
                    for (String creatorEntry : dcc) {
                        creator += cleanUp(creatorEntry) + (i < j ? "; " : "");
                        i++;
                    }
                } else {
                    // no 'def' key implies 1 or more language-specific keys. loop through those. For every one:
                    // loop through possible multiple entries & concat those
                    for (Map.Entry<String, List<String>> langCreatorEntry : prx.getDcCreator().entrySet()) {
                        List<String> lcev = stripEmptyStrings(langCreatorEntry.getValue());
                        j = lcev.size();
                        i = 1;
                        creator += "(" + langCreatorEntry.getKey() + ") ";
                        for (String langCreatorLine : lcev) {
                            creator += cleanUp(langCreatorLine) + (i < j ? "; " : "");
                            i++;
                        }
                    }
                }
            }
            // check for dc:title
            if ("".equals(title) && prx.getDcTitle() != null && !prx.getDcTitle().isEmpty()) {
                if (prx.getDcTitle().get("def") != null) {
                    List<String> dct = stripEmptyStrings(prx.getDcTitle().get("def"));
                    j = dct.size();
                    i = 1;
                    title += "(def) ";
                    for (String titleEntry : dct) {
                        title += cleanUp(titleEntry) + (i < j ? "; " : "");
                        i++;
                    }
                } else {
                    for (Map.Entry<String, List<String>> langTitleEntry : prx.getDcTitle().entrySet()) {
                        List<String> ltev = stripEmptyStrings(langTitleEntry.getValue());
                        j = ltev.size();
                        i = 1;
                        title += "(" + langTitleEntry.getKey() + ") ";
                        for (String langTitleLine : ltev) {
                            title += cleanUp(langTitleLine) + (i < j ? "; " : "");
                            i++;
                        }
                    }
                }
            }
        }
    }

    // if an aggregation is present; fetch the shownAt & shownBy
    // if the aggregation contains webresources, check if the 'about' URL is equal to
    // the edm:isShownBy URL from the aggregation (if available).
    // If this is the case, fetch the *first* edm:rights from the webresource

    if (agg != null) {
        // check if aggregation contains an edmIsShownAt URL
        if (!"".equals(agg.getEdmIsShownAt())) {
            shownAt = cleanUp(agg.getEdmIsShownAt());
        }
        // check if aggregation contains an edm:isShownBy URL
        if (!"".equals(agg.getEdmIsShownBy())) {
            shownBy = agg.getEdmIsShownBy();
            // check if aggregation contains webresources
            if (agg.getWebResources() != null && !agg.getWebResources().isEmpty()) {
                List<? extends WebResource> wRess = agg.getWebResources();
                for (WebResource wRes : wRess) {
                    // ++++ leave webresource-level dc:creator for 2nd iteration (David, Antoine) ++++
                    //                  if (wRes.getAbout().equalsIgnoreCase(shownBy)
                    //                        && wRes.getDcCreator() != null){
                    //                     // there is a webresource where the about URL == aggregation edm:isShownBy
                    //                     // and which has a dc:creator entry
                    //                     if (wRes.getDcCreator().get("def") != null) {
                    //                        List<String> dcc = stripEmptyStrings(wRes.getDcCreator().get("def"));
                    //                        // assign possible multiple 'def' entries to creator
                    //                        j = dcc.size();
                    //                        i = 1;
                    //                        creator += "(def) ";
                    //                        for (String creatorEntry : dcc) {
                    //                           creator += cleanUp(creatorEntry) + (i < j ? "; " : "");
                    //                           i++;
                    //                        }
                    //                     } else {
                    //                        // no 'def' key implies 1 or more language-specific keys. loop through those. For every one:
                    //                        // loop through possible multiple entries & concat those
                    //                        for (Map.Entry<String, List<String>> langCreatorEntry : wRes.getDcCreator().entrySet()) {
                    //                           List<String> lcev = stripEmptyStrings(langCreatorEntry.getValue());
                    //                           j = lcev.size();
                    //                           i = 1;
                    //                           creator += "(" + langCreatorEntry.getKey() + ") ";
                    //                           for (String langCreatorLine : lcev) {
                    //                              creator += cleanUp(langCreatorLine) + (i < j ? "; " : "");
                    //                              i++;
                    //                           }
                    //                        }
                    //                     }
                    //                  } else
                    // check if the webResource.about URL == aggregation's isShownBy URL
                    if (wRes.getAbout().equalsIgnoreCase(shownBy) && wRes.getWebResourceEdmRights() != null) {
                        // fetch edm:rights values
                        for (Map.Entry<String, List<String>> wrEdmRights : wRes.getWebResourceEdmRights()
                                .entrySet()) {
                            List<String> wrer = stripEmptyStrings(wrEdmRights.getValue());
                            if (wrer != null && !wrer.isEmpty()) {
                                rights += cleanUp(wrer.get(0));
                                break; // needed ernly wernce
                            }
                        }
                    }
                }
            }
        }

        // check if aggregation contains edm:dataprovider: yes? Get it.
        if (agg.getEdmDataProvider() != null && !agg.getEdmDataProvider().isEmpty()) {
            if (agg.getEdmDataProvider().get("def") != null) {
                List<String> edp = stripEmptyStrings(agg.getEdmDataProvider().get("def"));
                j = edp.size();
                i = 1;
                dataProvider += "(def) ";
                for (String dataProviderEntry : edp) {
                    dataProvider += cleanUp(dataProviderEntry) + (i < j ? "; " : "");
                    i++;
                }
            } else {
                for (Map.Entry<String, List<String>> langDataProviderEntry : agg.getEdmDataProvider()
                        .entrySet()) {
                    List<String> ldpev = stripEmptyStrings(langDataProviderEntry.getValue());
                    j = ldpev.size();
                    i = 1;
                    dataProvider += "(" + langDataProviderEntry.getKey() + ") ";
                    for (String langDataProviderLine : ldpev) {
                        dataProvider += cleanUp(langDataProviderLine) + (i < j ? "; " : "");
                        i++;
                    }
                }
            }
        }

        // If no edm:rights entries were found on the webresources, check the aggregation itself
        if ("".equals(rights) && agg.getEdmRights() != null && !agg.getEdmRights().isEmpty()) {
            for (Map.Entry<String, List<String>> edmRights : agg.getEdmRights().entrySet()) {
                List<String> edr = stripEmptyStrings(edmRights.getValue());
                if (edr != null && !edr.isEmpty()) {
                    rights += cleanUp(edr.get(0));
                    break; // needed ernly wernce
                }
            }
        }
    }

    // check if there's a Europeana Aggregation. If found, get the edm:landingPage
    if (euAgg != null) {
        landingPage = "".equals(euAgg.getEdmLandingPage()) ? "" : euAgg.getEdmLandingPage();

        // if there was no dc:creator in the webresources, check the Europeana aggregation
        if ("".equals(creator) && euAgg.getDcCreator() != null && !euAgg.getDcCreator().isEmpty()) {
            if (euAgg.getDcCreator().get("def") != null) {
                List<String> dcc = stripEmptyStrings(euAgg.getDcCreator().get("def"));
                j = dcc.size();
                i = 1;
                creator += "(def) ";
                for (String creatorEntry : dcc) {
                    creator += cleanUp(creatorEntry) + (i < j ? "; " : "");
                    i++;
                }
            } else {
                for (Map.Entry<String, List<String>> langCreatorEntry : euAgg.getDcCreator().entrySet()) {
                    List<String> lcev = stripEmptyStrings(langCreatorEntry.getValue());
                    j = lcev.size();
                    i = 1;
                    creator += "(" + langCreatorEntry.getKey() + ") ";
                    for (String langCreatorLine : lcev) {
                        creator += cleanUp(langCreatorLine) + (i < j ? "; " : "");
                        i++;
                    }
                }
            }
        }
        // if there was no edm:rights in the webresources or in the aggregation itself,
        // check the Europeana aggregation
        if ("".equals(rights) && euAgg.getEdmRights() != null && !euAgg.getEdmRights().isEmpty()) {
            for (Map.Entry<String, List<String>> euEdmRights : euAgg.getEdmRights().entrySet()) {
                List<String> euer = stripEmptyStrings(euEdmRights.getValue());
                if (euer != null && !euer.isEmpty()) {
                    rights += cleanUp(euer.get(0));
                    break; // needed ernly wernce
                }
            }
        }
    }

    // if there was no title found in the proxy, get it from the record object itself
    if ("".equals(title) && getTitle() != null && !ArrayUtils.isEmpty(getTitle())) {
        String[] titles = stripEmptyStrings(getTitle());
        j = titles.length;
        i = 1;
        for (String titlePart : titles) {
            title += cleanUp(titlePart);
            if (firstOnly) {
                break;
            } else if (i < j) {
                title += "; ";
            }
            i++;
        }
    }

    if (htmlOut) {
        if (!"".equals(title)) {
            if (!"".equals(landingPage)) {
                retval += spannify("about", landingPage) + aHref + landingPage + zHref;
            }
            retval += spannify("property", "dc:title") + title + naps;
            if (!"".equals(landingPage)) {
                retval += ferh;
            }
            retval += ". ";
        }
        retval += !"".equals(creator) ? spannify("property", "dc:creator") + creator + naps + ". " : "";

        if (!"".equals(dataProvider)) {
            if (!"".equals(shownAt)) {
                retval += aHref + shownAt + zHref;
            }
            retval += dataProvider + ". ";
            if (!"".equals(shownAt)) {
                retval += ferh;
            }
        }
        if (!"".equals(rights)) {
            retval += aHref + rights + "\" " + rightsPage + ">" + getRightsLabel(rights) + ferh
                    + spannify("rel", "cc:useGuidelines") + resPdUsgGd + ".";
        }
        if (!"".equals(landingPage)) {
            retval += naps; // close opening <span about ...>
        }
        return retval;
    } else {
        retval += title;
        retval += (!"".equals(title) && !"".equals(landingPage)) ? " - " : "";
        retval += landingPage;
        retval += (!"".equals(title) || !"".equals(landingPage)) ? ". " : "";
        retval += !"".equals(creator) ? creator + ". " : "";
        retval += dataProvider;
        retval += (!"".equals(dataProvider) && !"".equals(shownAt)) ? " - " : "";
        retval += shownAt;
        retval += (!"".equals(dataProvider) || !"".equals(shownAt)) ? ". " : "";
        retval += !"".equals(rights) ? getRightsLabel(rights) + " - " + rights + "." : "";
        return retval;
    }
}

From source file:net.lmxm.ute.configuration.ConfigurationReader.java

/**
 * Parses the patterns.//from  w w  w . j av a 2 s.c o  m
 * 
 * @param task the task
 * @param patternsType the patterns type
 */
private void parsePatterns(final FindReplaceTask task, final PatternsType patternsType) {
    final String prefix = "parsePatterns() :";

    LOGGER.debug("{} entered", prefix);

    if (patternsType == null) {
        LOGGER.debug("{} patternsType is null, exiting", prefix);

        return;
    }

    final List<FindReplacePattern> patterns = task.getPatterns();
    final PatternType[] patternTypeArray = patternsType.getPatternArray();

    if (ArrayUtils.isEmpty(patternTypeArray)) {
        LOGGER.debug("{} fileArray is empty is null, exiting", prefix);

        return;
    }

    LOGGER.debug("{} parsing {} pattern types", prefix, patternTypeArray.length);

    for (final PatternType patternType : patternTypeArray) {
        final FindReplacePattern pattern = parsePattern(patternType);

        if (pattern != null) {
            patterns.add(pattern);
        }
    }

    LOGGER.debug("{} exiting", prefix);
}

From source file:com.etcc.csc.presentation.datatype.PaymentContext.java

public BigDecimal getCollectionInvTotalSNAdminFee() {
    BigDecimal amount = BigDecimal.ZERO;
    if (!ArrayUtils.isEmpty(collectionInvs)) {
        for (int i = 0; i < collectionInvs.length; i++) {
            if ("N".equals(collectionInvs[i].getPaidIndicator())) {
                amount = amount.add(BigDecimalUtil.nullSafe(collectionInvs[i].getInvSecondNoticeAdminFee()));
            }//from  w  ww.  j a  va  2  s.c  o  m
        }
    }
    return amount;
}

From source file:com.sun.identity.security.cert.AMCRLStore.java

/**
 * It gets the new CRL from ldap server. 
 * If it is ldap URI, the URI has to be a dn that can be accessed 
 * with ldap anonymous bind. //from w  ww. j  a  v  a 2s . c  o m
 * (example : ldap://server:port/uid=ca,o=company.com) 
 * This dn entry has to have CRL in attribute certificaterevocationlist 
 * or certificaterevocationlist;binary.
 * 
 * if attrNames does only contain one value the ldap search filter will be
 * (attrName=Value_of_the_corresponding_Attribute_from_SubjectDN)
 * e.g. SubjectDN of issuer cert 'C=BE, CN=Citizen CA, serialNumber=201007'
 * attrNames is 'CN', search filter used will be (CN=Citizen CA)
 * 
 * if attrNames does contain serveral values the ldap search filter value will be
 * a comma separated list of name attribute values, the search attribute will be 'cn'
 * (cn="attrNames[0]=Value_of_the_corresponding_Attribute_from_SubjectDN,
 * attrNames[1]=Value_of_the_corresponding_Attribute_from_SubjectDN")
 * 
 * e.g. SubjectDN of issuer cert 'C=BE, CN=Citizen CA, serialNumber=201007'
 * attrNames is {"CN","serialNumber"}, search filter used will be
 * (cn=CN=Citizen CA,serialNumber=201007)
 * 
 * The order of the values of attrNames matter as they must match the value of the
 * 'cn' attribute of a crlDistributionPoint entry in the directory server
 * 
 * @param ldapParam 
 * @param cert
 * @param attrNames, attributes names from the subjectDN of the issuer cert
 */
static public X509CRL getCRL(AMLDAPCertStoreParameters ldapParam, X509Certificate cert, String... attrNames) {
    X509CRL crl = null;

    try {

        if (!ArrayUtils.isEmpty(attrNames)) {

            X500Name dn = null;

            try {
                dn = AMCRLStore.getIssuerDN(cert);
            } catch (Exception ex) {
                if (debug.messageEnabled()) {
                    debug.message("AMCRLStore:getCRL " + "Certificate - getIssuerDN: ", ex);
                }
                return crl;
            }

            String searchFilter = null;

            if (attrNames.length < 2) {
                /*
                 * Get the CN of the input certificate
                 */
                String attrValue = null;

                if (null != dn) {
                    // Retrieve attribute value of the attribute name
                    attrValue = dn.getAttributeValue(attrNames[0]);
                }

                if (null == attrValue) {
                    return crl;
                }

                searchFilter = setSearchFilter(attrNames[0], attrValue);

            } else {

                String searchFilterValue = buildSearchFilterValue(attrNames, dn);

                if (searchFilterValue.isEmpty()) {
                    return crl;
                }
                searchFilter = setSearchFilter("cn", searchFilterValue);
            }

            if (debug.messageEnabled()) {
                debug.message("AMCRLStore:getCRL using searchFilter " + searchFilter);
            }

            /*
             * Lookup the certificate in the LDAP certificate directory
             */

            ldapParam.setSearchFilter(searchFilter);

            AMCRLStore store = new AMCRLStore(ldapParam);
            crl = store.getCRL(cert);
        }

    } catch (Exception e) {
        debug.error("AMCRLStore:getCRL ", e);
    }

    return crl;
}

From source file:com.etcc.csc.dao.OraclePaymentDAO.java

public PaymentResponse monthlyStatementPayment(String dbSessionId, String ipAddress, String loginId, Long docId,
        String docType, String statementId, BigDecimal transactionId, BigDecimal tagstoreAmt,
        BigDecimal totalAmount, MonthlyStatement monthlyStatement, String dlState, String dlNumber,
        String email, boolean updatePmtInfo, String cardCode, String paymentType, String cardNumber,
        String expireMonth, String expireYear, String nameOnCard, String address, String address2, String city,
        String state, String zipCode, String plus4, String cardSecurityCode, Invoice[] invoices,
        Violation[] uninvoiceViols) throws EtccErrorMessageException, Exception {
    PaymentResponse paymentResponse = null;
    try {// w  w  w. j  av a  2s.com
        setConnection(Util.getDbConnection());

        OLC_PAYMENT_INFO_REC olcPaymentInfoRec = new OLC_PAYMENT_INFO_REC();
        olcPaymentInfoRec.setPMT_TYPE(paymentType);
        olcPaymentInfoRec.setCARD_CODE(cardCode);
        olcPaymentInfoRec.setCARD_SEC_CODE(cardSecurityCode);
        olcPaymentInfoRec.setCARD_NBR(cardNumber);
        olcPaymentInfoRec.setCARD_EXPIRES(DateUtil.monthYearToTimestamp(expireMonth + "/" + expireYear));
        olcPaymentInfoRec.setNAME_ON_CARD(nameOnCard);
        olcPaymentInfoRec.setADDRESS1(address);
        olcPaymentInfoRec.setADDRESS2(address2);
        olcPaymentInfoRec.setCITY(city);
        olcPaymentInfoRec.setSTATE(state);
        olcPaymentInfoRec.setZIP_CODE(zipCode);
        olcPaymentInfoRec.setPLUS4(plus4);

        OLC_ST_PMT_INV_REC olcSTPmtInvRec = new OLC_ST_PMT_INV_REC();
        olcSTPmtInvRec.setSTATEMENT_ID(new BigDecimal(statementId));
        olcSTPmtInvRec.setACCOUNT_ID(BigDecimal.ZERO);
        OLC_ST_INVOICES_ARR P_OLC_ST_INVOICES_ARR = new OLC_ST_INVOICES_ARR();
        P_OLC_ST_INVOICES_ARR.setArray(PaymentDetailUtil.invoicesToOLC_ST_INVOICES_RECs(invoices));
        olcSTPmtInvRec.setINVOICES(P_OLC_ST_INVOICES_ARR);

        OLC_UNINVOICED_VIOLS_ARR P_OLC_UNINVOICED_VIOLS_ARR = new OLC_UNINVOICED_VIOLS_ARR();
        OLC_VPS_UNINV_PMT_ARR P_UNINV_VIOL_PMT_ARR = new OLC_VPS_UNINV_PMT_ARR();
        OLC_VPS_UNINV_FEE_PMT_ARR P_UNINV_FEE_PMT_ARR = new OLC_VPS_UNINV_FEE_PMT_ARR();

        P_OLC_UNINVOICED_VIOLS_ARR
                .setArray(PaymentDetailUtil.violationsToOLC_UNINVOICED_VIOLS_RECs(uninvoiceViols));
        P_UNINV_VIOL_PMT_ARR.setArray(PaymentDetailUtil.violationsToOLC_VPS_UNINV_PMT_RECs(uninvoiceViols));
        P_UNINV_FEE_PMT_ARR.setArray(PaymentDetailUtil.violationsToOLC_VPS_UNINV_FEE_PMT_RECs(uninvoiceViols));

        olcSTPmtInvRec.setUNINVOICED_VIOLS(P_OLC_UNINVOICED_VIOLS_ARR);
        olcSTPmtInvRec.setUNINVOICED_VIOL_PMTS(P_UNINV_VIOL_PMT_ARR);
        olcSTPmtInvRec.setUNINVOICED_FEE_PMTS(P_UNINV_FEE_PMT_ARR);

        OLC_ST_PMT_INV_REC[] olcSTPmtInvRecArray = new OLC_ST_PMT_INV_REC[1];
        olcSTPmtInvRecArray[0] = olcSTPmtInvRec;

        String[] P_POSTING_STATUS = new String[] { "" };
        //   BigDecimal[] P_PAYMENT_ID = new BigDecimal[] { new BigDecimal(0) };
        OLC_ERROR_MSG_ARR[] O_ERROR_MSG_ARR = new OLC_ERROR_MSG_ARR[] { new OLC_ERROR_MSG_ARR() };

        int result = new OLCSC_INV(conn).MAKE_STATEMENT_PAYMENT(dbSessionId, ipAddress, loginId,
                new BigDecimal(docId), docType, new BigDecimal(statementId), transactionId, tagstoreAmt,
                totalAmount, olcSTPmtInvRecArray, olcPaymentInfoRec, email, updatePmtInfo ? "Y" : "N",
                P_POSTING_STATUS, O_ERROR_MSG_ARR, true).intValue();

        if (result == 1) {
            if (!ArrayUtils.isEmpty(P_POSTING_STATUS)) {
                paymentResponse = new PaymentResponse();
                paymentResponse.setPostingStatus(P_POSTING_STATUS[0].trim());
            }
            System.out.println("PAYMENT_RECEIPTS  :" + olcSTPmtInvRecArray[0].getPAYMENT_RECEIPTS());

            if (olcSTPmtInvRecArray[0].getPAYMENT_RECEIPTS() != null) {

                paymentResponse = new PaymentResponse();
                paymentResponse.setPostingStatus(P_POSTING_STATUS[0].trim());
                OLC_ST_PAYMENT_RCPT_REC[] OLC_ST_PAYMENT_RCPT_RECs = olcSTPmtInvRecArray[0]
                        .getPAYMENT_RECEIPTS().getArray();
                List<PaymentResultDTO> paymentResultDTOs = new ArrayList<PaymentResultDTO>();
                for (int i = 0; i < OLC_ST_PAYMENT_RCPT_RECs.length; i++) {
                    logger.info("Payment Receipt Id " + OLC_ST_PAYMENT_RCPT_RECs[i].getPAYMENT_RECEIPT_ID()); //RTalreja 02/16/2015 Ticket:RITE2128P1 Receipt
                    logger.info("OLC_Payment_id " + OLC_ST_PAYMENT_RCPT_RECs[i].getOL_PMT_ID());
                    PaymentResultDTO paymentResultDTO = new PaymentResultDTO();
                    paymentResultDTO.setPaymentId(OLC_ST_PAYMENT_RCPT_RECs[i].getPAYMENT_RECEIPT_ID());
                    paymentResultDTO.setOlPaymentId(OLC_ST_PAYMENT_RCPT_RECs[i].getOL_PMT_ID()); //RTalreja 02/16/2015 Ticket:RITE2128P1 Receipt
                    paymentResultDTO.setInvoiceType(OLC_ST_PAYMENT_RCPT_RECs[i].getINVOICE_TYPE());
                    paymentResultDTOs.add(paymentResultDTO);
                }
                paymentResponse.setPaymentResultDTOs(paymentResultDTOs);
            }
        } else {
            if (O_ERROR_MSG_ARR[0] != null && O_ERROR_MSG_ARR[0].getArray() != null
                    && O_ERROR_MSG_ARR[0].getArray().length > 0) {
                OLC_ERROR_MSG_REC[] errorMsgRecs = O_ERROR_MSG_ARR[0].getArray();
                EtccErrorMessageException em = new EtccErrorMessageException(
                        "PaymentWS::combinedPayment error message");
                for (int i = 0; i < errorMsgRecs.length; i++) {
                    em.addRecoverable(errorMsgRecs[i].getERROR_MSG());
                }
                throw em;
            } else {
                throw new EtccException("PaymentWS::combinedPayment fatal error");
            }
        }
    } finally {
        closeConnection();
    }
    return paymentResponse;
}

From source file:de.codesourcery.eve.apiclient.parsers.AbstractResponseParser.java

/**
 * Parse {@literal <rowset/>} XML.
 * /*from   w w w .j  av a  2  s .co m*/
 * @param name the rowset name the returned rowset should get
 * @param rowSet the rowset node
 * @return rowset with the given name
 * @throws UnparseableResponseException if the rowset
 * does not contain any columns or the XML has an unexpected structure.
 * @see #getRowSetNode(Node, String)
 */
protected RowSet parseRowSet(String name, Element rowSet) {

    // parse columns
    final Set<String> columns = new HashSet<String>();

    final String[] sColumns = getAttributeValue(rowSet, "columns").split(",");

    if (ArrayUtils.isEmpty(sColumns)) {
        throw new UnparseableResponseException("Response XML contains rowset without any columns ?");
    }

    for (String col : sColumns) {
        columns.add(col);
    }

    // parse key
    final String key = getAttributeValue(rowSet, "key", false);

    final RowSet result = new RowSet(name, key, columns);

    // parse rows
    final NodeList children = rowSet.getChildNodes();
    for (int i = 0; i < children.getLength(); i++) {
        final Node n = children.item(i);
        if (!(n instanceof Element)) {
            continue;
        }

        final Element element = (Element) n;
        if (!"row".equalsIgnoreCase(element.getNodeName())) {
            throw new UnparseableResponseException("Invalid response XML ," + " found unexpected node <"
                    + element.getNodeName() + "> in rowset");
        }

        final Map<String, String> data = new HashMap<String, String>();

        for (String attribute : result.getColumnNames()) {
            final String value = getAttributeValue(element, attribute, false);
            if (value != null) {
                data.put(attribute, value);
            }
        }
        result.addRow(data);
    }

    return result;
}

From source file:loci.formats.in.MIASReader.java

@Override
protected void initFile(String id) throws FormatException, IOException {
    super.initFile(id);

    if (checkSuffix(id, "txt")) {
        // first need to find a relevant TIFF file

        Location base = new Location(id).getAbsoluteFile();
        Location plate = null;/*from   www . ja v  a  2  s .  com*/
        if (base.getParentFile().getName().equals("Batchresults")) {
            Location experiment = base.getParentFile().getParentFile();
            String[] plates = experiment.list(true);
            Arrays.sort(plates);
            plate = new Location(experiment, plates[0]);
        } else {
            plate = base.getParentFile();
            if (plate.getName().equals("results"))
                plate = plate.getParentFile();
        }

        String[] list = plate.list(true);
        for (String f : list) {
            if (f.startsWith("Well")) {
                Location well = new Location(plate, f);
                String[] wellList = well.list(true);
                for (String file : wellList) {
                    String path = new Location(well, file).getAbsolutePath();
                    if (isThisType(path) && checkSuffix(path, new String[] { "tif", "tiff" })) {
                        initFile(path);
                        return;
                    }
                }
            }
        }

        throw new FormatException("Could not locate an appropriate TIFF file.");
    }

    if (!isGroupFiles()) {
        tiffs = new String[][] { { id } };
        readers = new MinimalTiffReader[1][1];
        readers[0][0] = new MinimalTiffReader();

        TiffReader r = new TiffReader();
        r.setMetadataStore(getMetadataStore());
        r.setId(tiffs[0][0]);
        core = new ArrayList<CoreMetadata>(r.getCoreMetadataList());
        metadataStore = r.getMetadataStore();

        final Map<String, Object> globalMetadata = r.getGlobalMetadata();
        for (final Map.Entry<String, Object> entry : globalMetadata.entrySet()) {
            addGlobalMeta(entry.getKey(), entry.getValue());
        }

        r.close();

        tileRows = 1;
        tileCols = 1;

        return;
    }

    analysisFiles = new ArrayList<AnalysisFile>();

    // MIAS is a high content screening format which supports multiple plates,
    // wells and fields.
    // Most of the metadata comes from the directory hierarchy, as very little
    // metadata is present in the actual files.
    //
    // The directory hierarchy is either:
    //
    // <experiment name>                        top level experiment directory
    //   Batchresults                           analysis results for experiment
    //   <plate number>_<plate barcode>         one directory for each plate
    //     results                              analysis results for plate
    //     Well<xxxx>                           one directory for each well
    //       mode<x>_z<xxx>_t<xxx>_im<x>_<x>.tif
    //
    // or:
    //
    // <experiment name>                        top level experiment directory
    //   <plate number>                         plate directory (3 digits)
    //     <well number>                        well directory (4 digits)
    //       <channel number>                   channel directory (1 digit)
    //         <tile row>_<tile col>_<Z>_<T>.tif
    //
    // Each TIFF file contains a single grayscale plane.  The "mode" block
    // refers to the channel number; the "z" and "t" blocks refer to the
    // Z section and timepoint, respectively.  The "im<x>_<x>" block gives
    // the row and column coordinates of the image within a mosaic.
    //
    // We are initially given one of these TIFF files; from there, we need
    // to find the top level experiment directory and work our way down to
    // determine how many plates and wells are present.

    LOGGER.info("Building list of TIFF files");

    Location baseFile = new Location(id).getAbsoluteFile();
    Location plate = baseFile.getParentFile().getParentFile();

    String plateName = plate.getName();
    if (!(plateName.length() == 3
            || (plateName.length() > 3 && plateName.replaceAll("\\d", "").startsWith("-")))) {
        plate = plate.getParentFile();
        plateName = plate.getName();
    }

    int plateNumber = Integer.parseInt(plateName.substring(0, 3));

    Location experiment = plate.getParentFile();
    String[] directories = experiment.list(true);
    Arrays.sort(directories);
    for (String dir : directories) {
        Location f = new Location(experiment, dir);
        if (dir.equals("Batchresults")) {
            String[] results = f.list(true);
            for (String result : results) {
                Location file = new Location(f, result);
                if (result.startsWith("NEO_Results")) {
                    resultFile = file.getAbsolutePath();
                    AnalysisFile af = new AnalysisFile();
                    af.filename = resultFile;
                    analysisFiles.add(af);
                } else if (result.startsWith("NEO_PlateOutput_")) {
                    int plateIndex = Integer.parseInt(result.substring(16, 19));
                    if (plateIndex == plateNumber) {
                        AnalysisFile af = new AnalysisFile();
                        af.filename = file.getAbsolutePath();
                        af.plate = 0;
                        analysisFiles.add(af);
                    }
                }
            }
        }
    }

    String[] list = plate.list(true);
    Arrays.sort(list);
    final List<String> wellDirectories = new ArrayList<String>();
    for (String dir : list) {
        Location f = new Location(plate, dir);
        if (f.getName().startsWith("Well") || f.getName().length() == 4) {
            // directory name is valid, but we need to make sure that the
            // directory contains a TIFF or a subdirectory
            String[] wellList = f.list(true);
            if (wellList != null) {
                boolean validWell = false;
                for (String potentialTIFF : wellList) {
                    if (potentialTIFF.toLowerCase().endsWith(".tif")
                            || new Location(f, potentialTIFF).isDirectory()) {
                        validWell = true;
                        break;
                    }
                }
                if (validWell)
                    wellDirectories.add(f.getAbsolutePath());
            }
        } else if (f.getName().equals("results")) {
            String[] resultsList = f.list(true);
            for (String result : resultsList) {
                // exclude proprietary program state files
                if (!result.endsWith(".sav") && !result.endsWith(".dsv") && !result.endsWith(".dat")) {
                    Location r = new Location(f, result);
                    AnalysisFile af = new AnalysisFile();
                    af.filename = r.getAbsolutePath();
                    af.plate = 0;
                    if (result.toLowerCase().startsWith("well")) {
                        af.well = Integer.parseInt(result.substring(4, 8)) - 1;
                    }
                    analysisFiles.add(af);
                }
            }
        } else if (f.getName().equals("Nugenesistemplate.txt")) {
            templateFile = f.getAbsolutePath();
        }
    }

    int nWells = wellDirectories.size();

    LOGGER.debug("Found {} wells.", nWells);

    readers = new MinimalTiffReader[nWells][];
    tiffs = new String[nWells][];
    int[] zCount = new int[nWells];
    int[] cCount = new int[nWells];
    int[] tCount = new int[nWells];
    String[] order = new String[nWells];
    wellNumber = new int[nWells];

    String[] wells = wellDirectories.toArray(new String[nWells]);
    Arrays.sort(wells);

    for (int j = 0; j < nWells; j++) {
        Location well = new Location(wells[j]);
        String wellName = well.getName().replaceAll("Well", "");
        wellNumber[j] = Integer.parseInt(wellName) - 1;

        String[] tiffFiles = well.list(true);
        final List<String> tmpFiles = new ArrayList<String>();
        for (String tiff : tiffFiles) {
            String name = tiff.toLowerCase();
            if (name.endsWith(".tif") || name.endsWith(".tiff")) {
                tmpFiles.add(new Location(well, tiff).getAbsolutePath());
            }
        }

        if (tmpFiles.size() == 0) {
            LOGGER.debug("No TIFFs in well directory {}", wells[j]);
            // no TIFFs in the well directory, so there are probably channel
            // directories which contain the TIFFs
            for (String dir : tiffFiles) {
                Location file = new Location(well, dir);
                if (dir.length() == 1 && file.isDirectory()) {
                    cCount[j]++;

                    String[] tiffs = file.list(true);
                    for (String tiff : tiffs) {
                        String name = tiff.toLowerCase();
                        if (name.endsWith(".tif") || name.endsWith(".tiff")) {
                            tmpFiles.add(new Location(file, tiff).getAbsolutePath());
                        }
                    }
                }
            }
        }

        tiffFiles = tmpFiles.toArray(new String[0]);
        if (ArrayUtils.isEmpty(tiffFiles)) {
            throw new FormatException("Empty dataset - No tiff files were found.");
        }

        Location firstTiff = new Location(tiffFiles[0]);

        List<String> names = new ArrayList<String>();
        for (Location f : firstTiff.getParentFile().listFiles()) {
            names.add(f.getName());
        }

        FilePattern fp = new FilePattern(
                FilePattern.findPattern(firstTiff.getName(), null, names.toArray(new String[names.size()])));
        String[] blocks = fp.getPrefixes();

        order[j] = "XY";

        int[] count = fp.getCount();

        for (int block = blocks.length - 1; block >= 0; block--) {
            blocks[block] = blocks[block].toLowerCase();
            blocks[block] = blocks[block].substring(blocks[block].lastIndexOf("_") + 1);

            if (blocks[block].equals("z")) {
                zCount[j] = count[block];
                order[j] += 'Z';
            } else if (blocks[block].equals("t")) {
                tCount[j] = count[block];
                order[j] += 'T';
            } else if (blocks[block].equals("mode")) {
                cCount[j] = count[block];
                order[j] += 'C';
            } else if (blocks[block].equals("im"))
                tileRows = count[block];
            else if (blocks[block].equals(""))
                tileCols = count[block];
            else if (blocks[block].replaceAll("\\d", "").length() == 0) {
                if (block == 3)
                    tileRows = count[block];
                else if (block == 2)
                    tileCols = count[block];
                else if (block == 0) {
                    zCount[j] = count[block];
                    order[j] += 'Z';
                } else if (block == 1) {
                    tCount[j] = count[block];
                    order[j] += 'T';
                }
            } else {
                throw new FormatException("Unsupported block '" + blocks[block]);
            }
        }

        Arrays.sort(tiffFiles);
        tiffs[j] = tiffFiles;
        LOGGER.debug("Well {} has {} files.", j, tiffFiles.length);
        readers[j] = new MinimalTiffReader[tiffFiles.length];
        for (int k = 0; k < tiffFiles.length; k++) {
            readers[j][k] = new MinimalTiffReader();
        }
    }

    // Populate core metadata

    LOGGER.info("Populating core metadata");

    int nSeries = tiffs.length;

    bpp = new int[nSeries];

    if (readers.length == 0) {
        throw new FormatException("No wells were found.");
    }

    // assume that all wells have the same width, height, and pixel type
    readers[0][0].setId(tiffs[0][0]);
    tileWidth = readers[0][0].getSizeX();
    tileHeight = readers[0][0].getSizeY();

    if (tileCols == 0)
        tileCols = 1;
    if (tileRows == 0)
        tileRows = 1;

    core.clear();
    for (int i = 0; i < nSeries; i++) {
        CoreMetadata ms = new CoreMetadata();
        core.add(ms);

        ms.sizeZ = zCount[i];
        ms.sizeC = cCount[i];
        ms.sizeT = tCount[i];

        if (ms.sizeZ == 0)
            ms.sizeZ = 1;
        if (ms.sizeC == 0)
            ms.sizeC = 1;
        if (ms.sizeT == 0)
            ms.sizeT = 1;

        ms.sizeX = tileWidth * tileCols;
        ms.sizeY = tileHeight * tileRows;
        ms.pixelType = readers[0][0].getPixelType();
        ms.sizeC *= readers[0][0].getSizeC();
        ms.rgb = readers[0][0].isRGB();
        ms.littleEndian = readers[0][0].isLittleEndian();
        ms.interleaved = readers[0][0].isInterleaved();
        ms.indexed = readers[0][0].isIndexed();
        ms.falseColor = readers[0][0].isFalseColor();
        ms.dimensionOrder = order[i];

        if (ms.dimensionOrder.indexOf('Z') == -1) {
            ms.dimensionOrder += 'Z';
        }
        if (ms.dimensionOrder.indexOf('C') == -1) {
            ms.dimensionOrder += 'C';
        }
        if (ms.dimensionOrder.indexOf('T') == -1) {
            ms.dimensionOrder += 'T';
        }

        ms.imageCount = ms.sizeZ * ms.sizeT * cCount[i];
        if (ms.imageCount == 0) {
            ms.imageCount = 1;
        }
        bpp[i] = FormatTools.getBytesPerPixel(ms.pixelType);
    }

    // Populate metadata hashtable

    LOGGER.info("Populating metadata hashtable");

    if (resultFile != null && getMetadataOptions().getMetadataLevel() != MetadataLevel.MINIMUM) {
        String[] cols = null;
        final List<String> rows = new ArrayList<String>();

        boolean doKeyValue = true;
        int nStarLines = 0;

        String analysisResults = DataTools.readFile(resultFile);
        String[] lines = analysisResults.split("\n");

        for (String line : lines) {
            line = line.trim();
            if (line.length() == 0)
                continue;
            if (line.startsWith("******") && line.endsWith("******"))
                nStarLines++;

            if (doKeyValue) {
                String[] n = line.split("\t");
                if (n[0].endsWith(":"))
                    n[0] = n[0].substring(0, n[0].length() - 1);
                if (n.length >= 2)
                    addGlobalMeta(n[0], n[1]);
            } else {
                if (cols == null)
                    cols = line.split("\t");
                else
                    rows.add(line);
            }
            if (nStarLines == 2)
                doKeyValue = false;
        }

        for (String row : rows) {
            String[] d = row.split("\t");
            for (int col = 3; col < cols.length; col++) {
                addGlobalMeta("Plate " + d[0] + ", Well " + d[2] + " " + cols[col], d[col]);

                if (cols[col].equals("AreaCode")) {
                    String wellID = d[col].replaceAll("\\D", "");
                    wellColumns = Integer.parseInt(wellID);
                }
            }
        }
    }

    // Populate MetadataStore

    LOGGER.info("Populating MetadataStore");

    MetadataStore store = makeFilterMetadata();
    MetadataTools.populatePixels(store, this, true);

    // HACK: if we don't have the analysis file, we don't how many
    // rows/columns are in the plate
    //
    // assume that a 96 well plate is 8x12, and a 384 well plate is 16x24
    if (wellColumns == 0) {
        if (nWells == 96) {
            wellColumns = 12;
        } else if (nWells == 384) {
            wellColumns = 24;
        } else {
            LOGGER.warn("Could not determine the plate dimensions.");
            wellColumns = 24;
        }
    }

    store.setPlateID(MetadataTools.createLSID("Plate", 0), 0);

    String plateAcqId = MetadataTools.createLSID("PlateAcquisition", 0, 0);
    store.setPlateAcquisitionID(plateAcqId, 0, 0);
    store.setPlateAcquisitionMaximumFieldCount(new PositiveInteger(1), 0, 0);

    for (int well = 0; well < nWells; well++) {
        int wellIndex = wellNumber[well];

        int row = wellIndex / wellColumns;
        int wellCol = (wellIndex % wellColumns) + 1;
        char wellRow = (char) ('A' + row);

        store.setWellID(MetadataTools.createLSID("Well", 0, well), 0, well);
        store.setWellRow(new NonNegativeInteger(row), 0, well);
        store.setWellColumn(new NonNegativeInteger(wellCol - 1), 0, well);

        String imageID = MetadataTools.createLSID("Image", well);
        String wellSampleID = MetadataTools.createLSID("WellSample", 0, well, 0);
        store.setWellSampleID(wellSampleID, 0, well, 0);
        store.setWellSampleIndex(new NonNegativeInteger(well), 0, well, 0);

        store.setImageID(imageID, well);
        store.setImageName("Well " + wellRow + wellCol, well);
        store.setWellSampleImageRef(imageID, 0, well, 0);

        store.setPlateAcquisitionWellSampleRef(wellSampleID, 0, 0, well);
    }

    MetadataLevel level = getMetadataOptions().getMetadataLevel();

    if (level != MetadataLevel.MINIMUM) {
        String experimentID = MetadataTools.createLSID("Experiment", 0);
        store.setExperimentID(experimentID, 0);
        store.setExperimentType(getExperimentType("Other"), 0);
        store.setExperimentDescription(experiment.getName(), 0);

        // populate SPW metadata
        store.setPlateColumnNamingConvention(getNamingConvention("Number"), 0);
        store.setPlateRowNamingConvention(getNamingConvention("Letter"), 0);

        parseTemplateFile(store);

        plateName = plateName.substring(plateName.indexOf('-') + 1);
        store.setPlateName(plateName, 0);
        store.setPlateExternalIdentifier(plateName, 0);

        for (int well = 0; well < nWells; well++) {
            // populate Image/Pixels metadata
            store.setImageExperimentRef(experimentID, well);

            String instrumentID = MetadataTools.createLSID("Instrument", 0);
            store.setInstrumentID(instrumentID, 0);
            store.setImageInstrumentRef(instrumentID, well);
        }

        roiFiles = new ArrayList<AnalysisFile>();
        for (AnalysisFile af : analysisFiles) {
            String file = af.filename;
            String name = new Location(file).getName();
            if (!name.startsWith("Well"))
                continue;

            if (name.endsWith("AllModesOverlay.tif")) {
                roiFiles.add(af);
            } else if (name.endsWith("overlay.tif")) {
                roiFiles.add(af);
            }
        }

        if (level != MetadataLevel.NO_OVERLAYS) {
            // populate image-level ROIs
            Color[] colors = new Color[getSizeC()];

            int nextROI = 0;
            for (AnalysisFile af : analysisFiles) {
                String file = af.filename;
                String name = new Location(file).getName();
                if (!name.startsWith("Well"))
                    continue;

                int[] position = getPositionFromFile(file);
                int well = position[0];

                if (name.endsWith("detail.txt")) {
                    String data = DataTools.readFile(file);
                    String[] lines = data.split("\n");
                    int start = 0;
                    while (start < lines.length && !lines[start].startsWith("Label")) {
                        start++;
                    }
                    if (start >= lines.length)
                        continue;

                    String[] columns = lines[start].split("\t");
                    List<String> columnNames = Arrays.asList(columns);

                    for (int j = start + 1; j < lines.length; j++) {
                        populateROI(columnNames, lines[j].split("\t"), well, nextROI++, position[1],
                                position[2], store);
                    }
                } else if (name.endsWith("AllModesOverlay.tif")) {
                    // original color for each channel is stored in
                    // results/Well<nnnn>_mode<n>_z<nnn>_t<nnn>_AllModesOverlay.tif
                    if (colors[position[3]] != null)
                        continue;
                    try {
                        colors[position[3]] = getChannelColorFromFile(file);
                    } catch (IOException e) {
                    }
                    if (colors[position[3]] == null)
                        continue;

                    for (int s = 0; s < getSeriesCount(); s++) {
                        store.setChannelColor(colors[position[3]], s, position[3]);
                    }
                    if (position[3] == 0) {
                        nextROI += parseMasks(store, well, nextROI, file);
                    }
                } else if (name.endsWith("overlay.tif")) {
                    nextROI += parseMasks(store, well, nextROI, file);
                }
            }
        }
    }
}

From source file:com.photon.phresco.framework.rest.api.FeatureService.java

/**
 * Updates the feature configurations/*from w w  w.jav  a2s. c  o m*/
 *
 * @param request the request
 * @param userId the user id
 * @param customerId the customer id
 * @param featureName the feature name
 * @param featureType the feature type
 * @param appDirName the app directory name
 */
@POST
@Path("/configureFeature")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response configureFeature(@Context HttpServletRequest request,
        @QueryParam(REST_QUERY_USERID) String userId, @QueryParam(REST_QUERY_CUSTOMERID) String customerId,
        @QueryParam(REST_QUERY_FEATURENAME) String featureName,
        @QueryParam(REST_QUERY_APPDIR_NAME) String appDirName,
        @QueryParam(REST_QUERY_MODULE_NAME) String module) {
    ResponseInfo<FeatureConfigure> responseData = new ResponseInfo<FeatureConfigure>();
    String rootModulePath = "";
    String subModuleName = "";
    try {
        ServiceManager serviceManager = CONTEXT_MANAGER_MAP.get(userId);
        if (serviceManager == null) {
            ResponseInfo<FeatureConfigure> finalOutput = responseDataEvaluation(responseData, null, null,
                    RESPONSE_STATUS_FAILURE, PHR410001);
            return Response.status(Status.OK).entity(finalOutput).header("Access-Control-Allow-Origin", "*")
                    .build();
        }

        if (StringUtils.isNotEmpty(module)) {
            rootModulePath = Utility.getProjectHome() + appDirName;
            subModuleName = module;
        } else {
            rootModulePath = Utility.getProjectHome() + appDirName;
        }
        FeatureConfigure featureConfigure = new FeatureConfigure();
        featureConfigure = getTemplateConfigFile(appDirName, customerId, serviceManager, featureName,
                rootModulePath, subModuleName);
        Properties properties = new Properties();
        if (CollectionUtils.isNotEmpty(featureConfigure.getPropertyTemplates())) {
            for (PropertyTemplate propertyTemplate : featureConfigure.getPropertyTemplates()) {
                String key = propertyTemplate.getKey();
                String value = request.getParameter(key);
                properties.setProperty(key, escapeHtml(value));
            }
        }
        String[] keys = request.getParameterValues(REQ_KEY);
        String[] values = request.getParameterValues(REQ_VALUE);
        if (!ArrayUtils.isEmpty(keys) && !ArrayUtils.isEmpty(values)) {
            for (int i = 0; i < keys.length; i++) {
                if (StringUtils.isNotEmpty(keys[i]) && StringUtils.isNotEmpty(values[i])) {
                    properties.setProperty(keys[i], escapeHtml(values[i]));
                }
            }
        }
        Configuration configuration = new Configuration();
        configuration.setName(featureName);
        List<Environment> allEnvironments = getAllEnvironments(rootModulePath, subModuleName);
        for (Environment environment : allEnvironments) {
            if (environment.isDefaultEnv()) {
                configuration.setEnvName(environment.getName());
            }
        }
        configuration.setProperties(properties);
        List<Configuration> configs = new ArrayList<Configuration>();
        configs.add(configuration);
        FrameworkServiceUtil frameworkServiceUtil = new FrameworkServiceUtil();
        ProjectInfo projectInfo = Utility.getProjectInfo(rootModulePath, subModuleName);
        frameworkServiceUtil
                .getApplicationProcessor(appDirName, customerId, serviceManager, rootModulePath, subModuleName)
                .postFeatureConfiguration(projectInfo.getAppInfos().get(0), configs, featureName);
        ResponseInfo<FeatureConfigure> finalOutput = responseDataEvaluation(responseData, null, null,
                RESPONSE_STATUS_SUCCESS, PHR400006);
        return Response.status(Status.OK).entity(finalOutput).header("Access-Control-Allow-Origin", "*")
                .build();
    } catch (PhrescoException e) {
        ResponseInfo<FeatureConfigure> finalOutput = responseDataEvaluation(responseData, e, null,
                RESPONSE_STATUS_ERROR, PHR410008);
        return Response.status(Status.OK).entity(finalOutput).header("Access-Control-Allow-Origin", "*")
                .build();
    } catch (ConfigurationException e) {
        ResponseInfo<FeatureConfigure> finalOutput = responseDataEvaluation(responseData, e, null,
                RESPONSE_STATUS_ERROR, PHR410009);
        return Response.status(Status.OK).entity(finalOutput).header("Access-Control-Allow-Origin", "*")
                .build();
    }
}