Package javax.xml.registry.infomodel

Examples of javax.xml.registry.infomodel.Organization


  throws JAXRException
  {
    List<Name> namesList = businessEntity.getName();
    List<Description> descriptionList = businessEntity.getDescription();

    Organization org = new OrganizationImpl(lifeCycleManager);
    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);
    }
    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);
          String pname = contact.getPersonName();
          user.setPersonName(new PersonNameImpl(pname));
          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


    }
    BusinessEntity entity = bizEntityList.get(0);
    List<Name> namesList = entity.getName();
    List<Description> descriptionList = entity.getDescription();

    Organization org = new OrganizationImpl(lifeCycleManager);
    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);
    }
    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();
    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();
    List<Contact> contactList = contacts.getContact();
    boolean isFirst=true;
    for (Contact contact : contactList) {
      User user = new UserImpl(null);
      String pname = contact.getPersonName();
      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

          
            InternationalString idesc = service.getDescription();
   
           addDescriptions(bs.getDescription(), idesc);

            Organization o = service.getProvidingOrganization();

            /*
             * there may not always be a key...
             */
            if (o != null) {
                Key k = o.getKey();

        if (k != null && k.getId() != null) {
                    bs.setBusinessKey(k.getId());
                }
                   
View Full Code Here

          
            InternationalString idesc = service.getDescription();
   
           addDescriptions(bs.getDescription(), idesc);

            Organization o = service.getProvidingOrganization();

            /*
             * there may not always be a key...
             */
            if (o != null) {
                Key k = o.getKey();

        if (k != null && k.getId() != null) {
                    bs.setBusinessKey(k.getId());
                }
                   
View Full Code Here

            return super.getSubmittingOrganization();
          } else {
            RegistryService rs = super.getLifeCycleManager().getRegistryService();
            BusinessQueryManager bqm = rs.getBusinessQueryManager();
            if (orgKey==null) return null;
                Organization o = (Organization) bqm.getRegistryObject(orgKey,
                        LifeCycleManager.ORGANIZATION);
                setProvidingOrganization(o)
                return o;
          }
        }
View Full Code Here

            bqm = rs.getBusinessQueryManager();
            Creator creator = new Creator(blm);
            Finder finder = new Finder(bqm, uddiversion);
           
            Collection<Organization> orgs = new ArrayList<Organization>();
            Organization organization = creator.createOrganization(this.getClass().getName());
//          Add a Service
            Service service = creator.createService(this.getClass().getName());
            ServiceBinding serviceBinding = creator.createServiceBinding();
            service.addServiceBinding(serviceBinding);
            organization.addService(service);
            //Add a classification
            ClassificationScheme cs = finder.findClassificationSchemeByName(this.getClass().getName());
            Classification classification = creator.createClassification(cs);
            organization.addClassification(classification);
           
            User user = blm.createUser();
            PersonName personName = blm.createPersonName(PERSON_NAME);
            TelephoneNumber telephoneNumber = blm.createTelephoneNumber();
            telephoneNumber.setNumber(PHONE_NUMBER);
            telephoneNumber.setType(null);
            PostalAddress address = blm.createPostalAddress(STREET_NUMBER,
                STREET, CITY, STATE, COUNTRY, POSTAL_CODE, "");

            Collection<PostalAddress> postalAddresses = new ArrayList<PostalAddress>();
            postalAddresses.add(address);
            Collection<EmailAddress> emailAddresses = new ArrayList<EmailAddress>();
            EmailAddress emailAddress = blm.createEmailAddress(EMAIL);
            emailAddresses.add(emailAddress);

            Collection<TelephoneNumber> numbers = new ArrayList<TelephoneNumber>();
            numbers.add(telephoneNumber);
            user.setPersonName(personName);
            user.setPostalAddresses(postalAddresses);
            user.setEmailAddresses(emailAddresses);
            user.setTelephoneNumbers(numbers);
            organization.setPrimaryContact(user);

            orgs.add(organization);           
           
            //Now save the Organization along with a Service, ServiceBinding and Classification
            BulkResponse br = blm.saveOrganizations(orgs);
View Full Code Here

            } else {
                assertEquals(1,orgs.size());
                // then step through them
                for (Iterator orgIter = orgs.iterator(); orgIter.hasNext();)
                {
                    Organization org = (Organization) orgIter.next();
                    System.out.println("Org name: " + printer.getName(org));
                    System.out.println("Org description: " + printer.getDescription(org));
                    System.out.println("Org key id: " + printer.getKey(org));

                    User user = org.getPrimaryContact();
                    System.out.println("Primary Contact Full Name : " + user.getPersonName().getFullName());
          assertEquals("User name does not match", user.getPersonName().getFullName(), PERSON_NAME);
         
                    Collection<EmailAddress> emailAddresses = user.getEmailAddresses();
          System.out.println("Found " + emailAddresses.size() + " email addresses.");
View Full Code Here

            Finder finder = new Finder(bqm, uddiversion);
            Remover remover = new Remover(blm);
            Collection orgs = finder.findOrganizationsByName(this.getClass().getName());
            for (Iterator orgIter = orgs.iterator(); orgIter.hasNext();)
            {
                Organization org = (Organization) orgIter.next();
                remover.removeOrganization(org);
            }
           
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

    public LocalizedString createLocalizedString(Locale locale, String value, String charsetName) throws JAXRException {
        return new LocalizedStringImpl(locale, value, charsetName);
    }

    public Organization createOrganization(InternationalString name) throws JAXRException {
        Organization org = (Organization) this.createObject(LifeCycleManager.ORGANIZATION);
        org.setName(name);
        return org;
    }
View Full Code Here

        org.setName(name);
        return org;
    }

    public Organization createOrganization(String name) throws JAXRException {
        Organization org = (Organization) this.createObject(LifeCycleManager.ORGANIZATION);
        org.setName(this.createInternationalString(name));
        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.