Package org.apache.juddi.error

Examples of org.apache.juddi.error.ErrorMessage


 
  public void validateDeleteTModel(EntityManager em, DeleteTModel body) throws DispositionReportFaultMessage {

    // No null input
    if (body == null)
      throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
   
    // No null or empty list
    List<String> entityKeyList = body.getTModelKey();
    if (entityKeyList == null || entityKeyList.size() == 0)
      throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));

    HashSet<String> dupCheck = new HashSet<String>();
    for (String entityKey : entityKeyList) {
      boolean inserted = dupCheck.add(entityKey);
      if (!inserted)
        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
     
      Object obj = em.find(org.apache.juddi.model.Tmodel.class, entityKey);
      if (obj == null)
        throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.TModelNotFound", entityKey));
     
      if (!publisher.isOwner((UddiEntity)obj))
        throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
     
    }
  }
View Full Code Here


  public void validateDeletePublisherAssertions(EntityManager em, DeletePublisherAssertions body) throws DispositionReportFaultMessage {

    // No null input
    if (body == null)
      throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
   
    // No null or empty list
    List<org.uddi.api_v3.PublisherAssertion> entityList = body.getPublisherAssertion();
    if (entityList == null || entityList.size() == 0)
      throw new AssertionNotFoundException(new ErrorMessage("errors.pubassertion.NoPubAssertions"));

    for (org.uddi.api_v3.PublisherAssertion entity : entityList) {
     
      validatePublisherAssertion(em, entity);
     
      org.apache.juddi.model.PublisherAssertionId pubAssertionId = new org.apache.juddi.model.PublisherAssertionId(entity.getFromKey(), entity.getToKey());
      Object obj = em.find(org.apache.juddi.model.PublisherAssertion.class, pubAssertionId);
      if (obj == null)
        throw new AssertionNotFoundException(new ErrorMessage("errors.pubassertion.AssertionNotFound", entity.getFromKey() + ", " + entity.getToKey()));
      else {
        org.apache.juddi.model.PublisherAssertion pubAssertion = (org.apache.juddi.model.PublisherAssertion)obj;
        org.uddi.api_v3.KeyedReference keyedRef = entity.getKeyedReference();
        if (keyedRef == null)
          throw new AssertionNotFoundException(new ErrorMessage("errors.pubassertion.AssertionNotFound", entity.getFromKey() + ", " + entity.getToKey()));

        if (!pubAssertion.getTmodelKey().equalsIgnoreCase(keyedRef.getTModelKey()) ||
          !pubAssertion.getKeyName().equalsIgnoreCase(keyedRef.getKeyName()) ||
          !pubAssertion.getKeyValue().equalsIgnoreCase(keyedRef.getKeyValue()))
          throw new AssertionNotFoundException(new ErrorMessage("errors.pubassertion.AssertionNotFound", entity.getFromKey() + ", " + entity.getToKey()));

      }
     
    }
  }
View Full Code Here

 
  public void validateSaveBusiness(EntityManager em, SaveBusiness body) throws DispositionReportFaultMessage {

    // No null input
    if (body == null)
      throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
   
    // No null or empty list
    List<org.uddi.api_v3.BusinessEntity> entityList = body.getBusinessEntity();
    if (entityList == null || entityList.size() == 0)
      throw new ValueNotAllowedException(new ErrorMessage("errors.savebusiness.NoInput"));
   
    for (org.uddi.api_v3.BusinessEntity entity : entityList) {
      validateBusinessEntity(em, entity);
    }
  }
View Full Code Here

 
  public void validateSaveService(EntityManager em, SaveService body) throws DispositionReportFaultMessage {

    // No null input
    if (body == null)
      throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
   
    // No null or empty list
    List<org.uddi.api_v3.BusinessService> entityList = body.getBusinessService();
    if (entityList == null || entityList.size() == 0)
      throw new ValueNotAllowedException(new ErrorMessage("errors.saveservice.NoInput"));
   
    for (org.uddi.api_v3.BusinessService entity : entityList) {
      // Entity specific data validation
      validateBusinessService(em, entity, null);
    }
View Full Code Here

 
  public void validateSaveBinding(EntityManager em, SaveBinding body) throws DispositionReportFaultMessage {

    // No null input
    if (body == null)
      throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
   
    // No null or empty list
    List<org.uddi.api_v3.BindingTemplate> entityList = body.getBindingTemplate();
    if (entityList == null || entityList.size() == 0)
      throw new ValueNotAllowedException(new ErrorMessage("errors.savebinding.NoInput"));
   
    for (org.uddi.api_v3.BindingTemplate entity : entityList) {
      validateBindingTemplate(em, entity, null);
    }
  }
View Full Code Here

  public void validateSaveTModel(EntityManager em, SaveTModel body) throws DispositionReportFaultMessage {

    // No null input
    if (body == null)
      throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
   
    // No null or empty list
    List<org.uddi.api_v3.TModel> entityList = body.getTModel();
    if (entityList == null || entityList.size() == 0)
      throw new ValueNotAllowedException(new ErrorMessage("errors.savetmodel.NoInput"));
   
    for (org.uddi.api_v3.TModel entity : entityList) {
      validateTModel(em, entity);
    }
  }
View Full Code Here

  public void validateAddPublisherAssertions(EntityManager em, AddPublisherAssertions body) throws DispositionReportFaultMessage {

    // No null input
    if (body == null)
      throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
   
    // No null or empty list
    List<org.uddi.api_v3.PublisherAssertion> entityList = body.getPublisherAssertion();
    if (entityList == null || entityList.size() == 0)
      throw new ValueNotAllowedException(new ErrorMessage("errors.addpublisherassertions.NoInput"));
   
    for (org.uddi.api_v3.PublisherAssertion entity : entityList) {
      validatePublisherAssertion(em, entity);
    }
  }
View Full Code Here

 
  public void validateSetPublisherAssertions(EntityManager em, Holder<List<org.uddi.api_v3.PublisherAssertion>> body) throws DispositionReportFaultMessage {

    // No null input
    if (body == null)
      throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
   
    // Assertion list can be null or empty - it signifies that publisher is deleting all their assertions
    List<org.uddi.api_v3.PublisherAssertion> entityList = body.value;
    if (entityList != null && entityList.size() > 0) {
   
View Full Code Here

 
  public void validateBusinessEntity(EntityManager em, org.uddi.api_v3.BusinessEntity businessEntity) throws DispositionReportFaultMessage {
   
    // A supplied businessEntity can't be null
    if (businessEntity == null)
      throw new ValueNotAllowedException(new ErrorMessage("errors.businessentity.NullInput"));
   
    boolean entityExists = false;
    String entityKey = businessEntity.getBusinessKey();
    if (entityKey == null || entityKey.length() == 0) {
      KeyGenerator keyGen = KeyGeneratorFactory.getKeyGenerator();
      entityKey = keyGen.generate();
      businessEntity.setBusinessKey(entityKey);
    }
    else {
      // Per section 4.4: keys must be case-folded
      entityKey = entityKey.toLowerCase();
      businessEntity.setBusinessKey(entityKey);
     
      Object obj = em.find(org.apache.juddi.model.BusinessEntity.class, entityKey);
      if (obj != null) {
        entityExists = true;

        // Make sure publisher owns this entity.
        if (!publisher.isOwner((UddiEntity)obj))
          throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner", entityKey));
      }
      else {
        // Inside this block, we have a key proposed by the publisher on a new entity

        // Validate key and then check to see that the proposed key is valid for this publisher
        ValidateUDDIKey.validateUDDIv3Key(entityKey);
        if (!publisher.isValidPublisherKey(em, entityKey))
          throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.BadPartition", entityKey));

      }
    }

    if (!entityExists) {
      // Check to make sure key isn't used by another entity.
      if (!isUniqueKey(em, entityKey))
        throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.KeyExists", entityKey));
    }
   
    // TODO: validate "checked" categories or category groups (see section 5.2.3 of spec)? optional to support
   
    validateNames(businessEntity.getName());
View Full Code Here

    if (businessServices == null)
      return;
   
    List<org.uddi.api_v3.BusinessService> businessServiceList = businessServices.getBusinessService();
    if (businessServiceList == null || businessServiceList.size() == 0)
      throw new ValueNotAllowedException(new ErrorMessage("errors.businessservices.NoInput"));
   
    for (org.uddi.api_v3.BusinessService businessService : businessServiceList) {
      validateBusinessService(em, businessService, parent);
    }
     
View Full Code Here

TOP

Related Classes of org.apache.juddi.error.ErrorMessage

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.