Example usage for java.lang Boolean Boolean

List of usage examples for java.lang Boolean Boolean

Introduction

In this page you can find the example usage for java.lang Boolean Boolean.

Prototype

@Deprecated(since = "9")
public Boolean(String s) 

Source Link

Document

Allocates a Boolean object representing the value true if the string argument is not null and is equal, ignoring case, to the string "true" .

Usage

From source file:org.dspace.app.webui.cris.controller.OUDetailsController.java

@Override
public ModelAndView handleDetails(HttpServletRequest request, HttpServletResponse response) throws Exception {
    Map<String, Object> model = new HashMap<String, Object>();

    OrganizationUnit ou = extractOrganizationUnit(request);

    if (ou == null) {
        response.sendError(HttpServletResponse.SC_NOT_FOUND, "OU page not found");
        return null;
    }/*from  www .  j  a  v  a  2 s  .  c o  m*/

    Context context = UIUtil.obtainContext(request);
    EPerson currentUser = context.getCurrentUser();
    if ((ou.getStatus() == null || ou.getStatus().booleanValue() == false)
            && !AuthorizeManager.isAdmin(context)) {

        if (currentUser != null || Authenticate.startAuthentication(context, request, response)) {
            // Log the error
            log.info(LogManager.getHeader(context, "authorize_error",
                    "Only system administrator can access to disabled researcher page"));

            JSPManager.showAuthorizeError(request, response,
                    new AuthorizeException("Only system administrator can access to disabled researcher page"));
        }
        return null;
    }

    if (AuthorizeManager.isAdmin(context)) {
        model.put("ou_page_menu", new Boolean(true));
    }

    ModelAndView mvc = null;

    try {
        mvc = super.handleDetails(request, response);
    } catch (RuntimeException e) {
        return null;
    }

    if (subscribeService != null) {
        boolean subscribed = subscribeService.isSubscribed(currentUser, ou);
        model.put("subscribed", subscribed);
    }

    request.setAttribute("sectionid", StatsConfig.DETAILS_SECTION);
    new DSpace().getEventService().fireEvent(new UsageEvent(UsageEvent.Action.VIEW, request, context, ou));

    mvc.getModel().putAll(model);
    mvc.getModel().put("ou", ou);
    return mvc;
}

From source file:com.tc.apn.push.core.config.AppConfigFactory.java

private AppConfig buildConfig(Document docCfg) {
    InputStream in = null;//from  w w  w .  j  a  v  a2 s . com

    AppConfig cfg = new AppConfig();

    try {
        Session session = docCfg.getParentDatabase().getParent();

        @SuppressWarnings("unchecked")
        Vector<String> attachments = session.evaluate("@AttachmentNames", docCfg);

        //find the .p12 attachment and load up the bytes
        for (String a : attachments) {
            if (a.endsWith(".p12")) {
                EmbeddedObject eo = docCfg.getAttachment(a);
                in = eo.getInputStream();
                cfg.setApnKeyStore(IOUtils.toByteArray(eo.getInputStream()));
            }
        }

        //set the appId.
        cfg.setAppId(docCfg.getItemValueString("appId"));

        //password used to authenticate to the APN, it is used w/ the .p12 certificate
        cfg.setApnPassword(docCfg.getItemValueString("apnPassword"));

        //set to determine which APN to target (TEST, or PROD)
        cfg.setApnProd(new Boolean(docCfg.getItemValueString("apnProd")));

        //set the app title.
        cfg.setAppTitle(docCfg.getItemValueString("appTitle"));

        //store the messages in the apn.nsf
        cfg.setStoreMessages(new Boolean(docCfg.getItemValueString("storeMessages")));

    } catch (Exception e) {
        logger.log(Level.SEVERE, null, e);
    } finally {
        CloseUtils.close(in);
    }

    return cfg;
}

From source file:cz.zcu.kiv.eegdatabase.wui.ui.experiments.canvas.ExperimentSignalViewCanvasPanel.java

@Override
public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {

    // metoda generuje html vystup

    // template je zde nactena sablona ze souboru v tomto package. Obsahuje
    // html + javascript a promenne kam se budou vkladat data. Promenna ma
    // tvar: ${nazevPromenne}
    PackageTextTemplate template = new PackageTextTemplate(this.getClass(), "view.tpl");

    // mapa promenych pro interpolaci se sablonou. Interpolace nahradi
    // promene  ${nazevPromenne} tim co najde v mape pod nazvem promenne.
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put("toggle.text", ResourceUtils.getString("text.visualization.toggle"));

    Boolean filesIn = new Boolean(false);
    StringBuilder tree = new StringBuilder();
    StringBuilder generateddata = new StringBuilder();

    // puvodni cyklus pro generovani dat pro vizualizaci signalu. Misto
    // vkladani do modelu controlleru se data generuji jako string, ktery je
    // pak vlozen misto promenne v sablone.
    VhdrReader vhdr = new VhdrReader();
    List<ChannelInfo> channels = null;
    byte[] bytes = null;
    byte[] data = null;
    ArrayList<double[]> signalData = new ArrayList<double[]>();
    for (DataFile file : experiment.getDataFiles()) {
        if (file.getFilename().endsWith(".vhdr")) {
            FileDTO fileDto = fileFacade.getFile(file.getDataFileId());
            bytes = FileUtils.getFileContent(fileDto.getFile());
            vhdr.readVhdr(bytes);//  w  w w  .j  ava  2  s  .co  m
            channels = vhdr.getChannels();
            tree.append(getTree(channels));
            for (DataFile file2 : experiment.getDataFiles()) {
                if ((file2.getFilename().endsWith(".eeg")) || (file2.getFilename().endsWith(".avg"))) {
                    filesIn = true;
                    FileDTO fileDto2 = fileFacade.getFile(file2.getDataFileId());
                    data = FileUtils.getFileContent(fileDto2.getFile());
                    EegReader eeg = new EegReader(vhdr);
                    for (ChannelInfo ch : channels) {
                        signalData.add(eeg.readFile(data, ch.getNumber()));
                    }
                    generateddata.append(getData(signalData));
                }
            }
        }
    }

    // nastaveni viditelnosti
    this.setVisibilityAllowed(filesIn);

    parameters.put("generate.tree", tree.toString());
    parameters.put("generate.data", generateddata.toString());
    // provedeni interpolaci promenych a sablony a vygenerovani html
    // vystupu.
    getResponse().write(template.asString(parameters));
}

From source file:hk.hku.cecid.edi.as2.admin.listener.PartnershipPageletAdaptor.java

/**
 * @param request/* w ww .java2  s  . c o  m*/
 * @throws DAOException
 * @throws IOException
 */
private void updatePartnership(Hashtable ht, HttpServletRequest request, PropertyTree dom)
        throws DAOException, IOException {

    // get the parameters
    String requestAction = (String) ht.get("request_action");
    String partnershipId = (String) ht.get("partnership_id");
    String subject = (String) ht.get("subject");
    String recipientAddress = (String) ht.get("recipient_address");
    boolean isHostnameVerified = new Boolean((String) ht.get("is_hostname_verified")).booleanValue();
    String receiptAddress = (String) ht.get("receipt_address");
    boolean isSyncReply = new Boolean((String) ht.get("is_sync_reply")).booleanValue();
    boolean isReceiptRequested = new Boolean((String) ht.get("is_receipt_requested")).booleanValue();
    boolean isOutboundSignRequired = new Boolean((String) ht.get("is_outbound_sign_required")).booleanValue();
    boolean isOutboundEncryptRequired = new Boolean((String) ht.get("is_outbound_encrypt_required"))
            .booleanValue();
    boolean isOutboundCompressRequired = new Boolean((String) ht.get("is_outbound_compress_required"))
            .booleanValue();
    boolean isReceiptSignRequired = new Boolean((String) ht.get("is_receipt_sign_required")).booleanValue();
    boolean isInboundSignRequired = new Boolean((String) ht.get("is_inbound_sign_required")).booleanValue();
    boolean isInbouhndEncryptRequired = new Boolean((String) ht.get("is_inbound_encrypt_required"))
            .booleanValue();
    String signAlgorithm = (String) ht.get("sign_algorithm");
    String encryptAlgorithm = (String) ht.get("encrypt_algorithm");
    String micAlgorithm = (String) ht.get("mic_algorithm");
    String as2From = (String) ht.get("as2_from");
    String as2To = (String) ht.get("as2_to");
    String retries = (String) ht.get("retries");
    String retryInterval = (String) ht.get("retry_interval");
    boolean isDisabled = new Boolean((String) ht.get("disabled")).booleanValue();
    boolean hasEncryptCert = ht.get("encrypt_cert") != null;
    InputStream encryptCertInputStream = null;
    if (hasEncryptCert) {
        encryptCertInputStream = (InputStream) ht.get("encrypt_cert");
    }
    boolean hasRemoveEncryptCert = false;
    if (ht.get("encrypt_cert_remove") != null) {
        if (((String) ht.get("encrypt_cert_remove")).equalsIgnoreCase("on")) {
            hasRemoveEncryptCert = true;
        }
    }
    boolean hasVerifyCert = ht.get("verify_cert") != null;
    InputStream verifyCertInputStream = null;
    if (hasVerifyCert) {
        verifyCertInputStream = (InputStream) ht.get("verify_cert");
    }
    boolean hasRemoveVerifyCert = false;
    if (ht.get("verify_cert_remove") != null) {
        if (((String) ht.get("verify_cert_remove")).equalsIgnoreCase("on")) {
            hasRemoveVerifyCert = true;
        }
    }

    if ("add".equalsIgnoreCase(requestAction) || "update".equalsIgnoreCase(requestAction)
            || "delete".equalsIgnoreCase(requestAction)) {

        // validate and set to dao
        PartnershipDAO partnershipDAO = (PartnershipDAO) AS2PlusProcessor.getInstance().getDAOFactory()
                .createDAO(PartnershipDAO.class);
        PartnershipDVO partnershipDAOData = (PartnershipDVO) partnershipDAO.createDVO();

        partnershipDAOData.setPartnershipId(partnershipId);
        if ("update".equalsIgnoreCase(requestAction)) {
            partnershipDAO.retrieve(partnershipDAOData);
        }
        partnershipDAOData.setAs2From(as2From);
        partnershipDAOData.setAs2To(as2To);
        partnershipDAOData.setSubject(subject);
        partnershipDAOData.setRecipientAddress(recipientAddress);
        partnershipDAOData.setIsHostnameVerified(isHostnameVerified);
        partnershipDAOData.setReceiptAddress(receiptAddress);
        partnershipDAOData.setIsSyncReply(isSyncReply);
        partnershipDAOData.setIsReceiptRequired(isReceiptRequested);
        partnershipDAOData.setIsOutboundSignRequired(isOutboundSignRequired);
        partnershipDAOData.setIsOutboundEncryptRequired(isOutboundEncryptRequired);
        partnershipDAOData.setIsOutboundCompressRequired(isOutboundCompressRequired);
        partnershipDAOData.setIsReceiptSignRequired(isReceiptSignRequired);
        partnershipDAOData.setIsInboundSignRequired(isInboundSignRequired);
        partnershipDAOData.setIsInboundEncryptRequired(isInbouhndEncryptRequired);
        partnershipDAOData.setSignAlgorithm(signAlgorithm);
        partnershipDAOData.setEncryptAlgorithm(encryptAlgorithm);
        partnershipDAOData.setMicAlgorithm(micAlgorithm);
        partnershipDAOData.setIsDisabled(isDisabled);
        partnershipDAOData.setRetries(StringUtilities.parseInt(retries));
        partnershipDAOData.setRetryInterval(StringUtilities.parseInt(retryInterval));

        if ("add".equalsIgnoreCase(requestAction)) {
            getPartnership(partnershipDAOData, dom, "add_partnership/");
        }

        if (partnershipId.equals("")) {
            request.setAttribute(ATTR_MESSAGE, "Partnership ID cannot be empty");
            return;
        }
        if (as2From.equals("")) {
            request.setAttribute(ATTR_MESSAGE, "AS2 From cannot be empty");
            return;
        }
        if (as2To.equals("")) {
            request.setAttribute(ATTR_MESSAGE, "AS2 To cannot be empty");
            return;
        }
        if (as2From.length() > 100) {
            request.setAttribute(ATTR_MESSAGE, "AS2 From cannot be longer than 100 characters.");
            return;
        }
        if (as2To.length() > 100) {
            request.setAttribute(ATTR_MESSAGE, "AS2 To cannot be longer than 100 characters.");
            return;
        }

        if (partnershipDAOData.getRetries() == Integer.MIN_VALUE) {
            request.setAttribute(ATTR_MESSAGE, "Retries must be integer");
            return;
        }
        if (partnershipDAOData.getRetryInterval() == Integer.MIN_VALUE) {
            request.setAttribute(ATTR_MESSAGE, "Retry Interval must be integer");
            return;
        }

        // encrypt cert
        if (hasRemoveEncryptCert) {
            partnershipDAOData.setEncryptCert(null);
        }
        if (hasEncryptCert) {
            try {
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                IOHandler.pipe(encryptCertInputStream, baos);
                CertificateFactory.getInstance("X.509")
                        .generateCertificate(new ByteArrayInputStream(baos.toByteArray()));
                partnershipDAOData.setEncryptCert(baos.toByteArray());
            } catch (Exception e) {
                request.setAttribute(ATTR_MESSAGE, "Uploaded encrypt cert is not an X.509 cert");
                return;
            }
        }
        // verify cert
        if (hasRemoveVerifyCert) {
            partnershipDAOData.setVerifyCert(null);
        }
        if (hasVerifyCert) {
            try {
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                IOHandler.pipe(verifyCertInputStream, baos);
                CertificateFactory.getInstance("X.509")
                        .generateCertificate(new ByteArrayInputStream(baos.toByteArray()));
                partnershipDAOData.setVerifyCert(baos.toByteArray());
            } catch (Exception e) {
                request.setAttribute(ATTR_MESSAGE, "Uploaded verify cert is not an X.509 cert");
                return;
            }
        }

        // check partnership conflict
        if (!partnershipDAOData.isDisabled()) {
            Iterator allConflictDAOData = partnershipDAO
                    .findPartnershipsByPartyID(partnershipDAOData.getAS2From(), partnershipDAOData.getAs2To())
                    .iterator();
            while (allConflictDAOData.hasNext()) {
                PartnershipDVO conflictDAOData = (PartnershipDVO) allConflictDAOData.next();
                if (conflictDAOData != null
                        && !conflictDAOData.getPartnershipId().equals(partnershipDAOData.getPartnershipId())
                        && !conflictDAOData.isDisabled()) {
                    request.setAttribute(ATTR_MESSAGE, "Partnership '" + conflictDAOData.getPartnershipId()
                            + "' with same From/To party IDs has already been enabled");
                    return;
                }
            }
        }

        // dao action
        if ("add".equalsIgnoreCase(requestAction)) {

            partnershipDAO.create(partnershipDAOData);
            request.setAttribute(ATTR_MESSAGE, "Partnership added successfully");
            dom.removeProperty("/partnerships/add_partnership");
            dom.setProperty("/partnerships/add_partnership", "");
        }
        if ("update".equalsIgnoreCase(requestAction)) {
            partnershipDAO.persist(partnershipDAOData);
            request.setAttribute(ATTR_MESSAGE, "Partnership updated successfully");
        }
        if ("delete".equalsIgnoreCase(requestAction)) {
            partnershipDAO.remove(partnershipDAOData);
            request.setAttribute(ATTR_MESSAGE, "Partnership deleted successfully");
        }
    }
}

From source file:org.opencastproject.inspection.remote.MediaInspectionServiceRemoteImpl.java

/**
 * {@inheritDoc}//from www  .j  a  v  a  2  s.  c o m
 * 
 * @see org.opencastproject.inspection.api.MediaInspectionService#enrich(org.opencastproject.mediapackage.AbstractMediaPackageElement,
 *      boolean)
 */
@Override
public Job enrich(MediaPackageElement original, boolean override) throws MediaInspectionException {
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    try {
        params.add(new BasicNameValuePair("mediaPackageElement", MediaPackageElementParser.getAsXml(original)));
        params.add(new BasicNameValuePair("override", new Boolean(override).toString()));
    } catch (Exception e) {
        throw new MediaInspectionException(e);
    }
    logger.info("Enriching {} using a remote media inspection service", original);
    HttpResponse response = null;
    try {
        HttpPost post = new HttpPost("/enrich");
        post.setEntity(new UrlEncodedFormEntity(params));
        response = getResponse(post);
        if (response != null) {
            Job receipt = JobParser.parseJob(response.getEntity().getContent());
            logger.info("Completing inspection of media file at {} using a remote media inspection service",
                    original.getURI());
            return receipt;
        }
    } catch (Exception e) {
        throw new MediaInspectionException(
                "Unable to enrich " + original + " using a remote inspection service", e);
    } finally {
        closeConnection(response);
    }
    throw new MediaInspectionException("Unable to enrich " + original + " using a remote inspection service");
}

From source file:com.liangc.hq.base.utils.MonitorUtils.java

private static Boolean isSubMiniTabSelected(Integer tabId, Integer selectedId) {
    return new Boolean(selectedId != null && selectedId.intValue() == tabId.intValue());
}

From source file:org.dspace.app.webui.cris.controller.DynamicObjectDetailsController.java

@Override
public ModelAndView handleDetails(HttpServletRequest request, HttpServletResponse response) throws Exception {
    Map<String, Object> model = new HashMap<String, Object>();

    setSpecificPartPath(Utils.getSpecificPath(request, null));
    ResearchObject dyn = extractDynamicObject(request);

    if (dyn == null) {
        response.sendError(HttpServletResponse.SC_NOT_FOUND, getSpecificPartPath() + " page not found");
        return null;
    }/*www. j a va  2  s .c om*/

    Context context = UIUtil.obtainContext(request);
    EPerson currentUser = context.getCurrentUser();
    if ((dyn.getStatus() == null || dyn.getStatus().booleanValue() == false)
            && !AuthorizeManager.isAdmin(context)) {

        if (currentUser != null || Authenticate.startAuthentication(context, request, response)) {
            // Log the error
            log.info(LogManager.getHeader(context, "authorize_error",
                    "Only system administrator can access to disabled researcher page"));

            JSPManager.showAuthorizeError(request, response,
                    new AuthorizeException("Only system administrator can access to disabled researcher page"));
        }
        return null;
    }

    if (AuthorizeManager.isAdmin(context)) {
        model.put("do_page_menu", new Boolean(true));
    }

    ModelAndView mvc = null;

    try {
        mvc = super.handleDetails(request, response);
    } catch (RuntimeException e) {
        return null;
    }

    if (subscribeService != null) {
        boolean subscribed = subscribeService.isSubscribed(currentUser, dyn);
        model.put("subscribed", subscribed);
    }

    request.setAttribute("sectionid", StatsConfig.DETAILS_SECTION);
    new DSpace().getEventService().fireEvent(new UsageEvent(UsageEvent.Action.VIEW, request, context, dyn));

    mvc.getModel().putAll(model);
    mvc.getModel().put("entity", dyn);
    return mvc;
}

From source file:net.jcreate.e3.tree.xtree.XTreeBuilder.java

public void buildRootNodeStart(Node pRootNode, int pLevel, int pRow) throws BuildTreeException {
    if (pRootNode instanceof WebTreeNode == false) {
        throw new IllegalArgumentException("node type is error, should be WebTreeNode type");
    }//from w ww . j  av  a  2 s .  c om
    treeScript.append("<script language='javascript'>").append(ENTER);
    WebTreeNode node = (WebTreeNode) pRootNode;
    StringBuffer nodeTemplate = new StringBuffer();

    nodeTemplate.append("webFXTreeConfig.usePersistence = ${usePersistence};").append(ENTER);
    nodeTemplate.append("webFXTreeConfig.setImagePath(\"${imagePath}\");").append(ENTER);
    nodeTemplate.append("   var ${nodeScriptName}=new WebFXTree(\"${text}\",")
            .append("\"${action}\",\"${behavior}\",\"${icon}\",\"${openIcon}\",${open} ); ");
    nodeTemplate.append(ENTER);

    Context context = new DefaultContext();
    context.put("usePersistence", new Boolean(this.isUsePersistence()));
    context.put("nodeScriptName", getNodeScriptName(node));
    context.put("text", node.getName());
    context.put("behavior", this.behavior);
    context.put("imagePath", this.getResourceHome() + "/images/");
    context.put("action", node.getAction());
    context.put("icon", node.getIcon());
    context.put("openIcon", node.getOpenIcon());
    context.put("open", this.rootExpand);

    treeScript.append(StrTemplateUtil.merge(nodeTemplate.toString(), context));
}

From source file:dmeduc.weblink.category.GenCategory.java

/**
 * Sets approved.//from  w  w w  .  j  av  a2  s. c o  m
 * 
 * @param approved
 *            approved
 */
public void setApproved(boolean approved) {
    setApproved(new Boolean(approved));
}

From source file:com.duroty.application.admin.utils.AdminDefaultAction.java

/**
 * DOCUMENT ME!/*w w  w. j a  v a 2 s. c o  m*/
 *
 * @param request DOCUMENT ME!
 *
 * @return DOCUMENT ME!
 *
 * @throws NamingException DOCUMENT ME!
 * @throws RemoteException DOCUMENT ME!
 * @throws CreateException DOCUMENT ME!
 */
protected Admin getAdminInstance(HttpServletRequest request)
        throws NamingException, RemoteException, CreateException {
    AdminHome home = null;

    Boolean localServer = new Boolean(Configuration.properties.getProperty(Configuration.LOCAL_WEB_SERVER));

    if (localServer.booleanValue()) {
        home = AdminUtil.getHome();
    } else {
        Hashtable environment = getContextProperties(request);
        home = AdminUtil.getHome(environment);
    }

    return home.create();
}