Package org.apache.ws.scout.uddi

Examples of org.apache.ws.scout.uddi.TModel$Factory


   public static Concept getConcept(TModelDetail tm, LifeCycleManager lcm)
           throws JAXRException
   {
      Concept concept = new ConceptImpl(lcm);
      TModel[] tc = tm.getTModelArray();
      TModel tmodel = tc != null && tc.length > 0 ? tc[0] : null;
     
      if (tmodel != null) {
        concept.setKey(lcm.createKey(tmodel.getTModelKey()));
        concept.setName(lcm.createInternationalString(getLocale(tmodel.getName().getLang()), tmodel.getName().getStringValue()));

        Description desc = getDescription(tmodel);
        if( desc != null ) {
            concept.setDescription(lcm.createInternationalString(getLocale(desc.getLang()), desc.getStringValue()));
        }

          concept.addExternalIdentifiers(getExternalIdentifiers(tmodel.getIdentifierBag(), lcm));
          concept.addClassifications(getClassifications(tmodel.getCategoryBag(), lcm));
      }
      return concept;
   }
View Full Code Here


        return tm;
    }

    public static TModel getTModelFromJAXRConcept(Concept scheme)
      throws JAXRException {
      TModel tm = TModel.Factory.newInstance();
    if (scheme == null)
      return null;
    try {
            Key key = scheme.getKey();
      if (key != null && key.getId() != null)
        tm.setTModelKey(key.getId());
            Slot sl1 = scheme.getSlot("authorizedName");
      if (sl1 != null && sl1.getName() != null)
        tm.setAuthorizedName(sl1.getName());

            Slot sl2 = scheme.getSlot("operator");
      if (sl2 != null && sl2.getName() != null)
        tm.setOperator(sl2.getName());

      InternationalString iname = ((RegistryObject) scheme).getName();
     
      for (LocalizedString locName : iname.getLocalizedStrings()) {
          Name name = tm.addNewName();
          name.setStringValue(locName.getValue());
          name.setLang(locName.getLocale().getLanguage());         
      }
     
      InternationalString idesc = ((RegistryObject) scheme).getDescription();
     
            if (idesc != null) {
                for (LocalizedString locName : idesc.getLocalizedStrings()) {
                    Description desc = tm.addNewDescription();
                    desc.setStringValue(locName.getValue());
                    desc.setLang(locName.getLocale().getLanguage());
                }
            }
//          External Links
            Collection<ExternalLink> externalLinks = scheme.getExternalLinks();
            if(externalLinks != null && externalLinks.size() > 0)
            {
                tm.setOverviewDoc(getOverviewDocFromExternalLink((ExternalLink)externalLinks.iterator().next()));
           

            IdentifierBag idBag = getIdentifierBagFromExternalIdentifiers(scheme.getExternalIdentifiers());
            if (idBag!=null) {
                tm.setIdentifierBag(idBag);
            }
            CategoryBag catBag = getCategoryBagFromClassifications(scheme.getClassifications());
            if (catBag!=null) {
                tm.setCategoryBag(catBag);
            }

    } catch (Exception ud) {
            throw new JAXRException("Apache JAXR Impl:", ud);
        }
View Full Code Here

        Iterator iter = schemes.iterator();
        int currLoc = 0;
        while (iter.hasNext()) {
            try {
                TModel en =
                        ScoutJaxrUddiHelper.getTModelFromJAXRClassificationScheme((ClassificationScheme) iter.next());
                entityarr[currLoc] = en;
                currLoc++;
            }
            catch (ClassCastException ce) {
                throw new UnexpectedObjectException();
            }
        }
        log.debug("Method:save_classificationscheme: ENlength=" + entityarr.length);
        // Save business
        TModelDetail td = null;
        try {
            td = (TModelDetail) executeOperation(entityarr, "SAVE_TMODEL");
        }
        catch (RegistryException e) {
            exceptions.add(new SaveException(e.getLocalizedMessage()));
            bulk.setStatus(JAXRResponse.STATUS_FAILURE);
            return bulk;
        }

        entityarr = td.getTModelArray();
        log.debug("After Saving TModel. Obtained vector size:" + entityarr != null ? entityarr.length : 0);
        for (int i = 0; entityarr != null && i < entityarr.length; i++) {
            TModel tm = (TModel) entityarr[i];
            coll.add(new KeyImpl(tm.getTModelKey()));
        }

        bulk.setCollection(coll);
        bulk.setExceptions(exceptions);
View Full Code Here

        Iterator iter = concepts.iterator();
        int currLoc = 0;
        while (iter.hasNext()) {
            try {
                TModel en =
                        ScoutJaxrUddiHelper.getTModelFromJAXRConcept((Concept) iter.next());
                entityarr[currLoc] = en;
                currLoc++;
            }
            catch (ClassCastException ce) {
                throw new UnexpectedObjectException();
            }
        }
        log.debug("Method:save_concept: ENlength=" + entityarr.length);
        // Save business
        TModelDetail td = null;
        try {
            td = (TModelDetail) executeOperation(entityarr, "SAVE_TMODEL");
        }
        catch (RegistryException e) {
            exceptions.add(new SaveException(e.getLocalizedMessage()));
            bulk.setStatus(JAXRResponse.STATUS_FAILURE);
            return bulk;
        }

        entityarr = td.getTModelArray();
        log.debug("After Saving TModel. Obtained vector size:" + entityarr != null ? entityarr.length : 0);
        for (int i = 0; entityarr != null && i < entityarr.length; i++) {
            TModel tm = (TModel) entityarr[i];
            coll.add(new KeyImpl(tm.getTModelKey()));
        }

        bulk.setCollection(coll);
        bulk.setExceptions(exceptions);
View Full Code Here

        return bs;
    }

  public static TModel getTModelFromJAXRClassificationScheme(
      ClassificationScheme scheme) throws JAXRException {
    TModel tm = TModel.Factory.newInstance();
    try {
            /*
             * a fresh scheme might not have a key
             */

            Key k = scheme.getKey();

            if (k != null && k.getId() != null) {
                tm.setTModelKey(k.getId());
            } else {
                tm.setTModelKey("");
            }

            /*
             * There's no reason to believe these are here either
             */

            Slot s = scheme.getSlot("authorizedName");

      if (s != null && s.getName() != null) {
                tm.setAuthorizedName(s.getName());
            }

            s = scheme.getSlot("operator");

      if (s != null && s.getName() != null) {
                tm.setOperator(s.getName());
            }

      InternationalString iname = ((RegistryObject) scheme).getName();
      
      for (LocalizedString locName : iname.getLocalizedStrings()) {
          Name name = tm.addNewName();
          name.setStringValue(locName.getValue());
          name.setLang(locName.getLocale().getLanguage());               
      }
          
      InternationalString idesc = ((RegistryObject) scheme).getDescription();
     
      if (idesc != null) {
          for (LocalizedString locName : idesc.getLocalizedStrings()) {
              Description desc = tm.addNewDescription();
              desc.setStringValue(locName.getValue());
                  desc.setLang(locName.getLocale().getLanguage());               
              }
      }

            IdentifierBag idBag = getIdentifierBagFromExternalIdentifiers(scheme.getExternalIdentifiers());
            if (idBag!=null) {
                tm.setIdentifierBag(idBag);
            }
            CategoryBag catBag = getCategoryBagFromClassifications(scheme.getClassifications());
            if (catBag!=null) {
                tm.setCategoryBag(catBag);
            }
     
      // ToDO: overviewDoc
    } catch (Exception ud) {
            throw new JAXRException("Apache JAXR Impl:", ud);
View Full Code Here

TOP

Related Classes of org.apache.ws.scout.uddi.TModel$Factory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.