Esempio n. 1
0
 /**
  * mark the pv if NVP concept
  *
  * @param curBean evs bean object
  * @param session HttpSession object
  */
 @SuppressWarnings("unchecked")
 public void markNVPConcept(EVS_Bean curBean, HttpSession session) {
   Vector<String> vNVP = (Vector) session.getAttribute("NVPConcepts");
   if (vNVP == null) vNVP = new Vector<String>();
   String conID = curBean.getCONCEPT_IDENTIFIER();
   if (conID != null && vNVP.contains(conID)) curBean.setNAME_VALUE_PAIR_IND(1);
   else curBean.setNAME_VALUE_PAIR_IND(0);
 }
  /**
   * Returns true iff all the files listed in this tracker's dependency list exist and are at the
   * same version as when they were recorded.
   *
   * @return a boolean
   */
  boolean isUpToDate(Properties properties) {
    Iterator e;

    // fixes bug 962
    {
      if (mProperties.size() != properties.size()) {
        mLogger.debug(
            /* (non-Javadoc)
             * @i18n.test
             * @org-mes="my size " + p[0]
             */
            org.openlaszlo.i18n.LaszloMessages.getMessage(
                DependencyTracker.class.getName(),
                "051018-181",
                new Object[] {new Integer(mProperties.size())}));
        mLogger.debug(
            /* (non-Javadoc)
             * @i18n.test
             * @org-mes="new size " + p[0]
             */
            org.openlaszlo.i18n.LaszloMessages.getMessage(
                DependencyTracker.class.getName(),
                "051018-189",
                new Object[] {new Integer(properties.size())}));
        return false;
      }

      for (e = mProperties.keySet().iterator(); e.hasNext(); ) {
        String key = (String) e.next();
        String val0 = mProperties.getProperty(key);
        String val1 = properties.getProperty(key);

        // val0 can't be null; properties don't allow that
        if (val1 == null || !val0.equals(val1)) {
          mLogger.debug(
              /* (non-Javadoc)
               * @i18n.test
               * @org-mes="Missing or changed property: " + p[0]
               */
              org.openlaszlo.i18n.LaszloMessages.getMessage(
                  DependencyTracker.class.getName(), "051018-207", new Object[] {val0}));
          return false;
        }
      }
    }

    for (e = mDependencies.iterator(); e.hasNext(); ) {
      FileInfo saved = (FileInfo) e.next();
      FileInfo current = new FileInfo(saved.mPathname);
      if (!saved.isUpToDate(current)) {
        mLogger.debug(saved.mPathname + " has changed");
        mLogger.debug("was " + saved.mLastMod);
        mLogger.debug(" is " + current.mLastMod);
        return false;
      }
    }
    return true;
  }
 /**
  * Add the specified file to the list of file dependencies.
  *
  * @param file a file
  */
 void addFile(File file) {
   mLogger.debug("addFile Path is " + file.getPath());
   FileInfo fi = new FileInfo(file.getPath());
   try {
     fi.mPathname = file.getCanonicalPath();
   } catch (java.io.IOException e) {
     throw new ChainedException(e);
   }
   mDependencies.add(fi);
 }
Esempio n. 4
0
  public Vector getMappingCodingSchemesEntityParticipatesIn(String code, String namespace) {
    Vector v = new Vector();
    try {
      MappingExtension mappingExtension =
          (MappingExtension) lbSvc.getGenericExtension("MappingExtension");

      AbsoluteCodingSchemeVersionReferenceList mappingSchemes =
          mappingExtension.getMappingCodingSchemesEntityParticipatesIn(code, namespace);

      // output is all of the mapping ontologies that this code participates in.
      for (AbsoluteCodingSchemeVersionReference ref :
          mappingSchemes.getAbsoluteCodingSchemeVersionReference()) {
        v.add(ref.getCodingSchemeURN() + "|" + ref.getCodingSchemeVersion());
      }

    } catch (Exception ex) {
      ex.printStackTrace();
    }
    return v;
  }
 /** Copy file info from the given tracker to me, omitting omitting then given file. */
 void copyFiles(DependencyTracker t, File omitMe) {
   try {
     for (Iterator e = t.mDependencies.iterator(); e.hasNext(); ) {
       FileInfo f = (FileInfo) e.next();
       if (!f.mPathname.equals(omitMe.getCanonicalPath())) {
         mDependencies.add(f);
       }
     }
   } catch (java.io.IOException e) {
     throw new ChainedException(e);
   }
 }
 /**
  * This will update the FileInfo object chain to use the (possibly new) webappPath once the
  * DependencyTracker object has been reconstitutded from ondisk cache.
  */
 void updateWebappPath() {
   String webappPath = LPS.HOME(); // get it from global
   if (webappPath.equals(mWebappPath)) return;
   mLogger.debug(
       /* (non-Javadoc)
        * @i18n.test
        * @org-mes="updating webappPath from: " + p[0]
        */
       org.openlaszlo.i18n.LaszloMessages.getMessage(
           DependencyTracker.class.getName(), "051018-128", new Object[] {mWebappPath}));
   mLogger.debug(
       /* (non-Javadoc)
        * @i18n.test
        * @org-mes="updating webappPath to:   " + p[0]
        */
       org.openlaszlo.i18n.LaszloMessages.getMessage(
           DependencyTracker.class.getName(), "051018-136", new Object[] {webappPath}));
   for (Iterator e = mDependencies.iterator(); e.hasNext(); ) {
     FileInfo saved = (FileInfo) e.next();
     if (saved.mPathname.startsWith(mWebappPath)) {
       mLogger.debug(
           /* (non-Javadoc)
            * @i18n.test
            * @org-mes="updating dependencies from: " + p[0]
            */
           org.openlaszlo.i18n.LaszloMessages.getMessage(
               DependencyTracker.class.getName(), "051018-147", new Object[] {saved.mPathname}));
       saved.mPathname = webappPath + saved.mPathname.substring(mWebappPath.length());
       mLogger.debug(
           /* (non-Javadoc)
            * @i18n.test
            * @org-mes="updating dependencies to  : " + p[0]
            */
           org.openlaszlo.i18n.LaszloMessages.getMessage(
               DependencyTracker.class.getName(), "051018-157", new Object[] {saved.mPathname}));
     }
   }
   mWebappPath = webappPath;
 }
Esempio n. 7
0
  /**
   * get the vocab attributes from teh user bean using filter attr and filter value to check and
   * return its equivaltnt attrs
   *
   * @param eUser EVS_userbean obtained from the database at login
   * @param sFilterValue string existing value
   * @param filterAttr int existing vocab name
   * @param retAttr int returning vocab name
   * @return value from returning vocab
   */
  public String getVocabAttr(
      EVS_UserBean eUser,
      String sFilterValue,
      int filterAttr,
      int retAttr) // String sFilterAttr, String sRetAttr)
      {
    // go back if origin is emtpy
    if (sFilterValue == null || sFilterValue.equals("")) return "";

    String sRetValue =
        sFilterValue; // sFilterValue is the value but the full name of 2) Select EVS Vocabulary
                      // from the front end (cdecurate) e.g. Logical Observation Identifier Names
                      // and Codes instead of LOINC
    Hashtable eHash = eUser.getVocab_Attr();
    Vector vVocabs = eUser.getVocabNameList();
    if (vVocabs == null) vVocabs = new Vector();
    // handle teh special case to make sure vocab for api query is valid
    if (filterAttr == EVSSearch.VOCAB_NULL) // (sFilterAttr == null || sFilterAttr.equals(""))
    {
      // it is valid vocab name
      if (vVocabs.contains(sFilterValue)) return sFilterValue; // found it
      // first check if filter value is from diplay vocab list
      Vector vDisplay = eUser.getVocabDisplayList();
      if (vDisplay != null && vDisplay.contains(sFilterValue)) {
        int iIndex = vDisplay.indexOf(sFilterValue);
        sRetValue = (String) vVocabs.elementAt(iIndex);
        return sRetValue; // found it
      }
      // filter it as dborigin
      filterAttr = EVSSearch.VOCAB_DBORIGIN; // sFilterAttr = "vocabDBOrigin";
    }
    for (int i = 0; i < vVocabs.size(); i++) {
      String sName = (String) vVocabs.elementAt(i);
      EVS_UserBean usrVocab = (EVS_UserBean) eHash.get(sName);
      String sValue = "";
      // check if the vocab is meta thesaurus
      String sMeta = usrVocab.getIncludeMeta();
      if (sMeta != null && !sMeta.equals("") && sMeta.equals(sFilterValue))
        return EVSSearch.META_VALUE; // "MetaValue";
      // get teh data from teh bean to match search
      if (filterAttr == EVSSearch.VOCAB_DISPLAY) // (sFilterAttr.equalsIgnoreCase("vocabDisplay"))
      sValue = usrVocab.getVocabDisplay();
      else if (filterAttr
          == EVSSearch.VOCAB_DBORIGIN) // (sFilterAttr.equalsIgnoreCase("vocabDBOrigin"))
      sValue = usrVocab.getVocabDBOrigin();
      else if (filterAttr == EVSSearch.VOCAB_NAME) // (sFilterAttr.equalsIgnoreCase("vocabName"))
      sValue = usrVocab.getVocabName();
      // do matching and return the value
      // System.out.println(sFilterValue + " getvocab " + sValue);
      //  if (sFilterValue.equalsIgnoreCase(sValue))  //check it later
      if (sFilterValue.contains(sValue)) {
        // get its value from teh bean for the return attr
        if (retAttr == EVSSearch.VOCAB_DISPLAY) // (sRetAttr.equalsIgnoreCase("vocabDisplay"))
        sRetValue = usrVocab.getVocabDisplay();
        else if (retAttr
            == EVSSearch.VOCAB_DBORIGIN) // (sRetAttr.equalsIgnoreCase("vocabDBOrigin"))
        sRetValue = usrVocab.getVocabDBOrigin();
        else if (retAttr == EVSSearch.VOCAB_NAME) // (sRetAttr.equalsIgnoreCase("vocabName"))
        sRetValue = usrVocab.getVocabName();
        break;
      }
    }
    // return the first vocab if null
    //  if ((sRetValue == null || sRetValue.equals("")) && vVocabs != null)
    //    sRetValue = (String)vVocabs.elementAt(0);
    // System.out.println(sRetValue + sFilterValue + filterAttr + retAttr);
    if (sRetValue == null) sRetValue = "";
    return sRetValue;
  }