Package org.apache.ws.scout.registry.infomodel

Examples of org.apache.ws.scout.registry.infomodel.OrganizationImpl


  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

        List<Name> names = bizInfo.getName();
       
        List<Description> descriptions = bizInfo.getDescription();
        List<ServiceInfo> serviceInfos = bizInfo.getServiceInfos().getServiceInfo();
       
        OrganizationImpl org = new OrganizationImpl(this);
        org.setKey(createKey(key));
        if (names != null && names.size() > 0) {
            org.setName(createInternationalString(names.get(0).getValue()));
        }
        if (descriptions != null && descriptions.size() > 0) {
            org.setDescription(createInternationalString(descriptions.get(0).getValue()));
        }
        if (serviceInfos != null && serviceInfos.size() > 0) {
            List<Service> services = new ArrayList<Service>(serviceInfos.size());
            for (int i = 0; i < serviceInfos.size(); i++) {
                ServiceInfo serviceInfo = serviceInfos.get(i);
                services.add(createService(serviceInfo));
            }
            org.addServices(services);
        }

        return org;
    }
View Full Code Here

        List<Name> names = bizInfo.getName();
       
        List<Description> descriptions = bizInfo.getDescription();
        List<ServiceInfo> serviceInfos = bizInfo.getServiceInfos().getServiceInfo();
       
        OrganizationImpl org = new OrganizationImpl(this);
        org.setKey(createKey(key));
        if (names != null && names.size() > 0) {
            org.setName(createInternationalString(names.get(0).getValue()));
        }
        if (descriptions != null && descriptions.size() > 0) {
            org.setDescription(createInternationalString(descriptions.get(0).getValue()));
        }
        if (serviceInfos != null && serviceInfos.size() > 0) {
            List<Service> services = new ArrayList<Service>(serviceInfos.size());
            for (int i = 0; i < serviceInfos.size(); i++) {
                ServiceInfo serviceInfo = serviceInfos.get(i);
                services.add(createService(serviceInfo));
            }
            org.addServices(services);
        }

        return org;
    }
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

        }
        else if (LifeCycleManager.LOCALIZED_STRING.equals(interfaceName)) {
            return new LocalizedStringImpl();
        }
        else if (LifeCycleManager.ORGANIZATION.equals(interfaceName)) {
            return new OrganizationImpl(this);
        }
        else if (LifeCycleManager.PERSON_NAME.equals(interfaceName)) {
            return new PersonNameImpl();
        }
        else if (LifeCycleManager.POSTAL_ADDRESS.equals(interfaceName)) {
View Full Code Here

        }
        else if (LifeCycleManager.LOCALIZED_STRING.equals(interfaceName)) {
            return new LocalizedStringImpl();
        }
        else if (LifeCycleManager.ORGANIZATION.equals(interfaceName)) {
            return new OrganizationImpl(this);
        }
        else if (LifeCycleManager.PERSON_NAME.equals(interfaceName)) {
            return new PersonNameImpl();
        }
        else if (LifeCycleManager.POSTAL_ADDRESS.equals(interfaceName)) {
View Full Code Here

    Organization createOrganization(BusinessInfo info) throws JAXRException {
        String key = info.getBusinessKey();
        Name[] names = info.getNameArray();
        Description[] descriptions = info.getDescriptionArray();
        ServiceInfo[] serviceInfos = info.getServiceInfos().getServiceInfoArray();
        OrganizationImpl org = new OrganizationImpl(this);
        org.setKey(createKey(key));
        if (names != null && names.length > 0) {
            org.setName(createInternationalString(((Name) names[0]).getStringValue()));
        }
        if (descriptions != null && descriptions.length > 0) {
            org.setDescription(createInternationalString(((Description) descriptions[0]).getStringValue()));
        }
        if (serviceInfos != null && serviceInfos.length > 0) {
            List<Service> services = new ArrayList<Service>(serviceInfos.length);
            for (int i = 0; i < serviceInfos.length; i++) {
                ServiceInfo serviceInfo = (ServiceInfo) serviceInfos[i];
                services.add(createService(serviceInfo));
            }
            org.addServices(services);
        }

        return org;
    }
View Full Code Here

      Name n = namearray != null && namearray.length > 0 ? namearray[0] : null;
      String name = n != null ? n.getStringValue() : null;
      Description[] descarray = entity.getDescriptionArray();
      Description desc = descarray != null && descarray.length > 0 ? descarray[0]: null;

      Organization org = new OrganizationImpl(lcm);
      if(name != null ) {
          org.setName(getIString(n.getLang(), name, lcm));
      }
      if( desc != null) {
          org.setDescription(getIString(desc.getLang(), desc.getStringValue(), lcm));
      }
      org.setKey(lcm.createKey(entity.getBusinessKey()));

      //Set Services also
      BusinessServices services = entity.getBusinessServices();
      BusinessService[] sarr = services != null ? services.getBusinessServiceArray() : null;
      for (int i = 0; sarr != null && i < sarr.length; i++)
      {
         BusinessService s = (BusinessService)sarr[i];
         org.addService(getService(s, lcm));
      }

      /*
       *  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();
      Contact[] carr = contacts != null ? contacts.getContactArray() : null;

      for (int i = 0; carr != null && i < carr.length; i++)
      {
         Contact contact = (Contact)carr[i];
         User user = new UserImpl(null);
         String pname = contact.getPersonName();
         user.setPersonName(new PersonNameImpl(pname));
         if (i == 0)
         {
            org.setPrimaryContact(user);
         }
         else
         {
            org.addUser(user);
         }
      }

      //External Links
      DiscoveryURLs durls = entity.getDiscoveryURLs();
      if (durls != null)
      {
         DiscoveryURL[] darr = durls.getDiscoveryURLArray();
         for (int j = 0; darr != null && j < darr.length; j++)
         {
            DiscoveryURL durl = (DiscoveryURL)darr[j];
            ExternalLink link = new ExternalLinkImpl(lcm);
            link.setExternalURI(durl.getStringValue());
            org.addExternalLink(link);
         }
      }

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

TOP

Related Classes of org.apache.ws.scout.registry.infomodel.OrganizationImpl

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.