Package javax.xml.registry.infomodel

Examples of javax.xml.registry.infomodel.Organization


       login();
       try
       {
           getJAXREssentials();
           Collection orgs = new ArrayList();
           Organization org = createOrganization("JBOSS");

           orgs.add(org);
           BulkResponse br = blm.saveOrganizations(orgs);
           if (br.getStatus() == JAXRResponse.STATUS_SUCCESS)
           {
View Full Code Here


        login();
        try
        {
            getJAXREssentials();
            Collection orgs = new ArrayList();
            Organization org = createOrganization("JBOSS");

            orgs.add(org);
            BulkResponse br = blm.saveOrganizations(orgs);
            if (br.getStatus() == JAXRResponse.STATUS_SUCCESS)
            {
View Full Code Here

         Connection con2 = loginSecondUser();
         RegistryService rs2 = con2.getRegistryService();
         blm2 = rs2.getBusinessLifeCycleManager();
         bqm2 = rs2.getBusinessQueryManager();

         Organization source = blm.createOrganization(blm.createInternationalString(orgSource));
         Organization target = blm2.createOrganization(blm.createInternationalString(orgTarget));

         // publish the source organization
         Collection orgs = new ArrayList();
         orgs.add(source);
         br = blm.saveOrganizations(orgs);
         if (br.getExceptions() != null)
         {
            fail(" Source:Save Orgs failed");
         }

         sourceKeys = br.getCollection();
         Iterator iter = sourceKeys.iterator();
         while (iter.hasNext())
         {
            savekey = (Key)iter.next();
         }
         sourceId = savekey.getId();
         String objectType = LifeCycleManager.ORGANIZATION;
         Organization pubSource = (Organization)bqm.getRegistryObject(sourceId, objectType);
         assertNotNull(pubSource.getName().getValue());

         // publish the target
         orgs.clear();
         orgs.add(target);
         br = blm2.saveOrganizations(orgs);
         if (br.getExceptions() != null)
         {
            fail(" Target:Save Orgs failed");
         }
         targetKeys = br.getCollection();
         iter = targetKeys.iterator();
         while (iter.hasNext())
         {
            savekey = (Key)iter.next();
         }
         targetId = savekey.getId();
         Organization pubTarget = (Organization)bqm2.getRegistryObject(targetId, objectType);

         Concept associationType = getAssociationConcept(type);
         if (associationType == null)
            fail(" getAssociationConcept returned null associationType");

         Association a = blm.createAssociation(pubTarget, associationType);
         a.setSourceObject(pubSource);

         blm.confirmAssociation(a); //First user
         blm2.confirmAssociation(a); //Second user

         // publish Association
         Collection associations = new ArrayList();
         associations.add(a);
         // Second user saves the association.
         br = blm2.saveAssociations(associations, false);

         if (br.getExceptions() != null)
         {
            fail("Error:Save Associations failed \n");
         }
         BulkResponse targetAssoc = bqm.findCallerAssociations(null,
                 new Boolean(true),
                 new Boolean(true),
                 null);

         if (targetAssoc.getExceptions() == null)
         {
            Collection targetCol = targetAssoc.getCollection();
            if (targetCol.size() > 0)
            {
               iter = targetCol.iterator();
               while (iter.hasNext())
               {
                  Association a1 = (Association)iter.next();
                  Organization o = (Organization)a1.getSourceObject();
                  o = (Organization)a1.getTargetObject();
                  Concept atype = a1.getAssociationType();
                  assertNotNull("Concept Type stored in Association", atype);
               }
            }
View Full Code Here

            Connection con2 = loginSecondUser();
            RegistryService rs2 = con2.getRegistryService();
            blm2 = rs2.getBusinessLifeCycleManager();
            bqm2 = rs2.getBusinessQueryManager();

            Organization target = blm2.createOrganization(blm.createInternationalString(orgTarget));
            Organization source = blm.createOrganization(blm.createInternationalString(orgSource));

            Collection orgs = new ArrayList();
            orgs.add(source);
            br = blm.saveOrganizations(orgs);
            if (br.getExceptions() != null)
            {
                fail(" Source:Save Orgs failed");
            }

            sourceKeys = br.getCollection();
            Iterator iter = sourceKeys.iterator();
            while (iter.hasNext())
            {
                savekey = (Key) iter.next();
            }
            sourceId = savekey.getId();

            String objectType = LifeCycleManager.ORGANIZATION;
            Organization pubSource = (Organization) bqm.getRegistryObject(sourceId, objectType);
            assertNotNull("Source retrieved: ", pubSource.getName().getValue());

            orgs.clear();
            orgs.add(target);
            br = blm2.saveOrganizations(orgs);
            if (br.getExceptions() != null)
            {
                fail("Target:Save Orgs failed");
            }
            targetKeys = br.getCollection();
            iter = targetKeys.iterator();
            while (iter.hasNext())
            {
                savekey = (Key) iter.next();
            }
            targetId = savekey.getId();

            Organization pubTarget = (Organization) bqm2.getRegistryObject(targetId, objectType);
            assertNotNull("Target: ", pubTarget.getName().getValue());

            Concept associationType = getAssociationConcept(type);
            if (associationType == null)
                fail(" getAssociationConcept returned null");
View Full Code Here

public class ScoutUtil
{
   public static void validateAssociation(Association a, String sourceOrgName)
           throws Exception
   {
      Organization o = (Organization)a.getSourceObject();
      if(o.getName() == null || o.getName().getValue() == null)
        throw new Exception("Source OrgName in association is null");
      if (!o.getName().getValue().equals(sourceOrgName))
      {
         throw new Exception("Invalid Source Org in Association");
      }
      o = (Organization)a.getTargetObject();
      if(o.getName()== null || o.getName().getValue() == null)
         throw new Exception("Target OrgName in association is null");;
      Concept atype = a.getAssociationType();
      if(atype.getName() == null || atype.getName().getValue() ==null)
       throw new Exception("Concept stored in Association" );
   }
View Full Code Here

            Connection conn = getConnection();
            conn.setCredentials(creds);
            RegistryService rs = conn.getRegistryService();
            blm = rs.getBusinessLifeCycleManager();
            Collection orgs = new ArrayList();
            Organization org = blm.createOrganization(getIString("USA"));
            org.setDescription(getIString("Apache Software Foundation"));
            Service service = blm.createService(getIString("Apache JAXR Service"));
            service.setDescription(getIString("Services of UDDI Registry"));
            User user = blm.createUser();
            org.setPrimaryContact(user);
            PersonName personName = blm.createPersonName("Steve Viens");
            TelephoneNumber telephoneNumber = blm.createTelephoneNumber();
            telephoneNumber.setNumber("410-666-7777");
            telephoneNumber.setType(null);
            PostalAddress address
                    = blm.createPostalAddress("1901",
                            "Munsey Drive", "Forest Hill",
                            "MD", "USA", "21050-2747", "");
            Collection postalAddresses = new ArrayList();
            postalAddresses.add(address);
            Collection emailAddresses = new ArrayList();
            EmailAddress emailAddress = blm.createEmailAddress("sviens@apache.org");
            emailAddresses.add(emailAddress);
            Collection numbers = new ArrayList();
            numbers.add(telephoneNumber);
            user.setPersonName(personName);
            user.setPostalAddresses(postalAddresses);
            user.setEmailAddresses(emailAddresses);
            user.setTelephoneNumbers(numbers);

            //Concepts for NAICS and computer          
            ClassificationScheme cScheme = getClassificationScheme("ntis-gov:naics", "");
            Key cKey = blm.createKey("uuid:C0B9FE13-324F-413D-5A5B-2004DB8E5CC2");
            cScheme.setKey(cKey);
            Classification classification = blm.createClassification(cScheme,
                    "Computer Systems Design and Related Services",
                    "5415");
            org.addClassification(classification);
            ClassificationScheme cScheme1 = getClassificationScheme("D-U-N-S", "");
            Key cKey1 = blm.createKey("uuid:3367C81E-FF1F-4D5A-B202-3EB13AD02423");
            cScheme1.setKey(cKey1);
            ExternalIdentifier ei =
                    blm.createExternalIdentifier(cScheme1, "D-U-N-S number",
                            "08-146-6849");
            org.addExternalIdentifier(ei);
            org.addService(service);
            orgs.add(org);
            BulkResponse br = blm.saveOrganizations(orgs);
            if (br.getStatus() == JAXRResponse.STATUS_SUCCESS) {
                System.out.println("Organization Saved");
                Collection coll = br.getCollection();
View Full Code Here

                        "name pattern: \"" + match + "\"");
                Collection orgs = br.getCollection();
                System.out.println("Results found: " + orgs.size() + "\n");
                Iterator iter = orgs.iterator();
                while (iter.hasNext()) {
                    Organization org = (Organization) iter.next();
                    keys.add(org.getKey());
                }
            } else {
                System.err.println("One or more JAXRExceptions " +
                        "occurred during the query operation:");
                Collection exceptions = br.getExceptions();
View Full Code Here

                        "name pattern: \"" + qname + "\"");
                Collection orgs = br.getCollection();
                System.out.println("Results found: " + orgs.size() + "\n");
                Iterator iter = orgs.iterator();
                while (iter.hasNext()) {
                    Organization org = (Organization) iter.next();
                    System.out.println("Organization Name: " +
                            getName(org));
                    System.out.println("Organization Key: " +
                            org.getKey().getId());
                    System.out.println("Organization Description: " +
                            getDescription(org));
                    Collection services = org.getServices();
                    Iterator siter = services.iterator();
                    while (siter.hasNext()) {
                        Service service = (Service) siter.next();
                        System.out.println("\tService Name: " +
                                getName(service));
View Full Code Here

  public static Organization getOrganization(BusinessEntity businessEntity,
      LifeCycleManager lifeCycleManager)
  throws JAXRException
  {
    Organization org = new OrganizationImpl(lifeCycleManager);
    List<Name> namesList = businessEntity.getName();
    if ((namesList != null) && (namesList.size() > 0)) {
      InternationalString is = null;
      for (Name n : namesList)  {
        if (is == null) {
          is = getIString(n.getLang(), n.getValue(), lifeCycleManager);
        } else {
          is.setValue(getLocale(n.getLang()), n.getValue());
        }
      }
      org.setName(is);
    }

    List<Description> descriptionList = businessEntity.getDescription();
    if ((descriptionList != null) && (descriptionList.size() > 0)) {
      InternationalString is = null;
      for (Description desc : descriptionList)  {
        if (is == null) {
          is = getIString(desc.getLang(), desc.getValue(), lifeCycleManager);
        } else {
          is.setValue(getLocale(desc.getLang()), desc.getValue());
        }
      }
      org.setDescription(is);
    }
    org.setKey(lifeCycleManager.createKey(businessEntity.getBusinessKey()));

    //Set Services also
    BusinessServices services = businessEntity.getBusinessServices();
    if(services != null)
    {
      List<BusinessService> bizServiceList = services.getBusinessService();
      for (BusinessService businessService : bizServiceList) {
        org.addService(getService(businessService, lifeCycleManager));
      }
    }

    /*
     *  Users
     *
     *  we need to take the first contact and designate as the
     *  'primary contact'.  Currently, the OrganizationImpl
     *  class does that automatically as a safety in case
     *  user forgets to set - lets be explicit here as to not
     *  depend on that behavior
     */

    Contacts contacts = businessEntity.getContacts();
    if(contacts != null)
    {
      List<Contact> contactList = contacts.getContact();
      if (contactList!=null) {
        boolean isFirst=true;
        for (Contact contact : contactList) {
          User user = new UserImpl(null);
          List<PersonName> pname = contact.getPersonName();
          if (pname != null && pname.size() > 0) {
            String name = pname.get(0).getValue();
            user.setPersonName(new PersonNameImpl(name));           
          }
          if (isFirst) {
            isFirst=false;
            org.setPrimaryContact(user);
          } else {
            org.addUser(user);
          }
        }
      }
    }

    //External Links
    DiscoveryURLs durls = businessEntity.getDiscoveryURLs();
    if (durls != null)
    {
      List<DiscoveryURL> discoveryURL_List = durls.getDiscoveryURL();
      for (DiscoveryURL discoveryURL : discoveryURL_List) {
        ExternalLink link = new ExternalLinkImpl(lifeCycleManager);
        link.setExternalURI(discoveryURL.getValue());
        org.addExternalLink(link);
      }
    }

    org.addExternalIdentifiers(getExternalIdentifiers(businessEntity.getIdentifierBag(), lifeCycleManager));
    org.addClassifications(getClassifications(businessEntity.getCategoryBag(), lifeCycleManager));

    return org;
  }
View Full Code Here

  public static Organization getOrganization(BusinessDetail bizdetail,
      LifeCycleManager lifeCycleManager)
  throws JAXRException
  {
    List<BusinessEntity> bizEntityList = bizdetail.getBusinessEntity();
    Organization org = new OrganizationImpl(lifeCycleManager);
    if (bizEntityList.size() != 1) {
      throw new JAXRException("Unexpected count of organizations in BusinessDetail: " + bizEntityList.size());
    }
    BusinessEntity entity = bizEntityList.get(0);
    List<Name> namesList = entity.getName();
    if ((namesList != null) && (namesList.size() > 0)) {
      InternationalString is = null;
      for (Name n : namesList)  {
        if (is == null) {
          is = getIString(n.getLang(), n.getValue(), lifeCycleManager);
        } else {
          is.setValue(getLocale(n.getLang()), n.getValue());
        }
      }
      org.setName(is);
    }

    List<Description> descriptionList = entity.getDescription();
    if ((descriptionList != null) && (descriptionList.size() > 0)) {
      InternationalString is = null;
      for (Description desc : descriptionList)  {
        if (is == null) {
          is = getIString(desc.getLang(), desc.getValue(), lifeCycleManager);
        } else {
          is.setValue(getLocale(desc.getLang()), desc.getValue());
        }
      }
      org.setDescription(is);
    }
    org.setKey(lifeCycleManager.createKey(entity.getBusinessKey()));

    //Set Services also
    BusinessServices services = entity.getBusinessServices();
    if (services != null) {
      List<BusinessService> bizServiceList = services.getBusinessService();
      for (BusinessService businessService : bizServiceList) {
        org.addService(getService(businessService, lifeCycleManager));
      }
    }
     
    /*
     *  Users
     *
     *  we need to take the first contact and designate as the
     *  'primary contact'.  Currently, the OrganizationImpl
     *  class does that automatically as a safety in case
     *  user forgets to set - lets be explicit here as to not
     *  depend on that behavior
     */
    Contacts contacts = entity.getContacts();
    if (contacts != null) {
      List<Contact> contactList = contacts.getContact();
      boolean isFirst=true;
      for (Contact contact : contactList) {
        User user = new UserImpl(null);
        List<PersonName> pnames = (List<PersonName>) contact.getPersonName();
        String pname = null;
        if (pnames != null && pnames.size() > 0) {
          PersonName personname = pnames.get(0);
          pname = personname.getValue();
        }
        user.setType(contact.getUseType());
        user.setPersonName(new PersonNameImpl(pname));
 
        List<Email> emailList = contact.getEmail();
        ArrayList<EmailAddress> tempEmails = new ArrayList<EmailAddress>();
        for (Email email : emailList) {
          tempEmails.add(new EmailAddressImpl(email.getValue(), null));
        }
        user.setEmailAddresses(tempEmails);
 
        List<Address> addressList = contact.getAddress();
        ArrayList<PostalAddress> tempAddresses = new ArrayList<PostalAddress>();
        for (Address address : addressList) {
          ArrayList<AddressLine> addressLineList = new ArrayList<AddressLine>(address.getAddressLine());
          AddressLine[] alines = new AddressLine[addressLineList.size()];
          addressLineList.toArray(alines);
 
          PostalAddress pa = getPostalAddress(alines);
          tempAddresses.add(pa);
        }
        user.setPostalAddresses(tempAddresses);
 
        List<Phone> phoneList = contact.getPhone();
        ArrayList<TelephoneNumber> tempPhones = new ArrayList<TelephoneNumber>();
        for (Phone phone : phoneList) {
          TelephoneNumberImpl tni = new TelephoneNumberImpl();
          tni.setType(phone.getUseType());
          tni.setNumber(phone.getValue());
          tempPhones.add(tni);
        }
        user.setTelephoneNumbers(tempPhones);
        if (isFirst) {
          isFirst=false;
          org.setPrimaryContact(user);
        } else {
          org.addUser(user);
        }
      }
    }
    //External Links
    DiscoveryURLs durls = entity.getDiscoveryURLs();
    if (durls != null)
    {
      List<DiscoveryURL> discoveryURL_List = durls.getDiscoveryURL();
      for (DiscoveryURL discoveryURL : discoveryURL_List) {
        ExternalLink link = new ExternalLinkImpl(lifeCycleManager);
        link.setExternalURI(discoveryURL.getValue());
        org.addExternalLink(link);
      }
    }

    org.addExternalIdentifiers(getExternalIdentifiers(entity.getIdentifierBag(), lifeCycleManager));
    org.addClassifications(getClassifications(entity.getCategoryBag(), lifeCycleManager));

    return org;
  }
View Full Code Here

TOP

Related Classes of javax.xml.registry.infomodel.Organization

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.