Package buri.ddmsence.ddms.security.ism

Examples of buri.ddmsence.ddms.security.ism.SecurityAttributes$Builder


      // Null in component list
      try {
        List<IDDMSComponent> components = new ArrayList<IDDMSComponent>(TEST_NO_OPTIONAL_COMPONENTS);
        components.add(null);
        SecurityAttributes attributes = isAtLeast50 ? null : SecurityAttributesTest.getFixture();
        new Resource(components, getTestResourceElement(), getTestCreateDate(), null, getTestIsmDesVersion(),
          getTestNtkDesVersion(), attributes, null, null);
      }
      catch (InvalidDDMSException e) {
        checkConstructorFailure(false, e);
View Full Code Here


        if (Organization.getName(getDDMSVersion()).equals(entityType))
          _entity = new Organization(entityElement);
        if (Person.getName(getDDMSVersion()).equals(entityType))
          _entity = new Person(entityElement);
      }
      _securityAttributes = new SecurityAttributes(element);
      validate();
    }
    catch (InvalidDDMSException e) {
      e.setLocator(getQualifiedName());
      throw (e);
View Full Code Here

   * @param element the XOM element
   * @param validateNow true if the component should be validated here
   */
  protected AbstractSimpleString(Element element, boolean validateNow) throws InvalidDDMSException {
    try {
      _securityAttributes = new SecurityAttributes(element);
      setXOMElement(element, validateNow);
    }
    catch (InvalidDDMSException e) {
      e.setLocator(getQualifiedName());
      throw (e);
View Full Code Here

      }
    });
    CONSTRUCTOR_BUILDERS.put(Description.class, new IConstructorBuilder() {
      public IDDMSComponent build() throws IOException, InvalidDDMSException {
        String text = readString("the description text [testDescription]");
        SecurityAttributes attr = buildSecurityAttributes("description");
        return (new Description(text, attr));
      }
    });
    CONSTRUCTOR_BUILDERS.put(Dates.class, new IConstructorBuilder() {
      public IDDMSComponent build() throws IOException, InvalidDDMSException {
        String created = readString("the created date [2010]");
        String posted = readString("the posted date [2010]");
        String validTil = readString("the validTil date [2010]");
        String infoCutOff = readString("the infoCutOff date [2010]");
        String approvedOn = readString("the approvedOn date [2010]");
        String receivedOn = readString("the receivedOn date [2010]");
        return (new Dates(null, created, posted, validTil, infoCutOff, approvedOn, receivedOn));
      }
    });
    CONSTRUCTOR_BUILDERS.put(AbstractProducerRole.class, new IConstructorBuilder() {
      public IDDMSComponent build() throws IOException, InvalidDDMSException {
        DDMSVersion version = DDMSVersion.getCurrentVersion();
        String producerType = readString("the producer type [creator]");
        String entityType = readString("the entity type [organization]");
        String pocTypes = readString("the pocType [DoD-Dist-B]");
        SecurityAttributes attr = buildSecurityAttributes("producer");

        IRoleEntity entity = null;
        if (Person.getName(version).equals(entityType))
          entity = (Person) inputLoop(Person.class);
        else if (Organization.getName(version).equals(entityType))
          entity = (Organization) inputLoop(Organization.class);
        else if (Service.getName(version).equals(entityType))
          entity = (Service) inputLoop(Service.class);
        else if (Unknown.getName(version).equals(entityType))
          entity = (Unknown) inputLoop(Unknown.class);

        if (Creator.getName(version).equals(producerType))
          return (new Creator(entity, null, attr));
        if (Contributor.getName(version).equals(producerType))
          return (new Creator(entity, null, attr));
        if (Publisher.getName(version).equals(producerType))
          return (new Publisher(entity, null, attr));
        if (PointOfContact.getName(version).equals(producerType))
          return (new PointOfContact(entity, Util.getXsListAsList(pocTypes), attr));
        throw new InvalidDDMSException("Unknown producerType: " + producerType);
      }
    });
    CONSTRUCTOR_BUILDERS.put(Person.class, new IConstructorBuilder() {
      public IDDMSComponent build() throws IOException, InvalidDDMSException {
        int numNames = readInt("the number of names this person has [1]");
        if (numNames == 0) {
          println("At least 1 name is required. Defaulting to 1 name.");
          numNames = 1;
        }
        int numPhones = readInt("the number of phone numbers this person has [0]");
        int numEmails = readInt("the number of email addresses this person has [0]");

        List<String> names = new ArrayList<String>();
        for (int i = 0; i < numNames; i++) {
          names.add(readString("entity name #" + (i + 1) + " [testName" + (i + 1) + "]"));
        }
        List<String> phones = new ArrayList<String>();
        for (int i = 0; i < numPhones; i++) {
          phones.add(readString("entity phone number #" + (i + 1) + " [testPhone" + (i + 1) + "]"));
        }
        List<String> emails = new ArrayList<String>();
        for (int i = 0; i < numEmails; i++) {
          emails.add(readString("entity email #" + (i + 1) + " [testEmail" + (i + 1) + "]"));
        }
        String surname = readString("the person surname [testSurname]");
        String userID = readString("the person userID [testID]");
        String affiliation = readString("the person affiliation [testOrg]");

        // Skip optional extensible attributes.

        return (new Person(names, surname, phones, emails, userID, Util.getXsListAsList(affiliation)));
      }
    });
    CONSTRUCTOR_BUILDERS.put(Organization.class, new IConstructorBuilder() {
      public IDDMSComponent build() throws IOException, InvalidDDMSException {
        int numNames = readInt("the number of names this organization has [1]");
        if (numNames == 0) {
          println("At least 1 name is required. Defaulting to 1 name.");
          numNames = 1;
        }
        int numPhones = readInt("the number of phone numbers this organization has [0]");
        int numEmails = readInt("the number of email addresses this organization has [0]");
        int numSubs = readInt("the number of suborganizations to include [0]");
        List<String> names = new ArrayList<String>();
        for (int i = 0; i < numNames; i++) {
          names.add(readString("entity name #" + (i + 1) + " [testName" + (i + 1) + "]"));
        }
        List<String> phones = new ArrayList<String>();
        for (int i = 0; i < numPhones; i++) {
          phones.add(readString("entity phone number #" + (i + 1) + " [testPhone" + (i + 1) + "]"));
        }
        List<String> emails = new ArrayList<String>();
        for (int i = 0; i < numEmails; i++) {
          emails.add(readString("entity email #" + (i + 1) + " [testEmail" + (i + 1) + "]"));
        }
        List<SubOrganization> subOrgs = new ArrayList<SubOrganization>();
        for (int i = 0; i < numSubs; i++) {
          println("* SubOrganization #" + (i + 1));
          subOrgs.add((SubOrganization) inputLoop(SubOrganization.class));
        }
        String acronym = readString("the Organization acronym [testAcronym]");

        // Skip optional extensible attributes.

        return (new Organization(names, phones, emails, subOrgs, acronym));
      }
    });
    CONSTRUCTOR_BUILDERS.put(SubOrganization.class, new IConstructorBuilder() {
      public IDDMSComponent build() throws IOException, InvalidDDMSException {
        String value = readString("the value [testSubOrganization]");
        SecurityAttributes attr = buildSecurityAttributes("suborganization");
        return (new SubOrganization(value, attr));
      }
    });
    CONSTRUCTOR_BUILDERS.put(Service.class, new IConstructorBuilder() {
      public IDDMSComponent build() throws IOException, InvalidDDMSException {
        int numNames = readInt("the number of names this service has [1]");
        if (numNames == 0) {
          println("At least 1 name is required. Defaulting to 1 name.");
          numNames = 1;
        }
        int numPhones = readInt("the number of phone numbers this service has [0]");
        int numEmails = readInt("the number of email addresses this service has [0]");
        List<String> names = new ArrayList<String>();
        for (int i = 0; i < numNames; i++) {
          names.add(readString("entity name #" + (i + 1) + " [testName" + (i + 1) + "]"));
        }
        List<String> phones = new ArrayList<String>();
        for (int i = 0; i < numPhones; i++) {
          phones.add(readString("entity phone number #" + (i + 1) + " [testPhone" + (i + 1) + "]"));
        }
        List<String> emails = new ArrayList<String>();
        for (int i = 0; i < numEmails; i++) {
          emails.add(readString("entity email #" + (i + 1) + " [testEmail" + (i + 1) + "]"));
        }

        // Skip optional extensible attributes.

        return (new Service(names, phones, emails));
      }
    });
    CONSTRUCTOR_BUILDERS.put(Unknown.class, new IConstructorBuilder() {
      public IDDMSComponent build() throws IOException, InvalidDDMSException {
        int numNames = readInt("the number of names this unknown entity has [1]");
        if (numNames == 0) {
          println("At least 1 name is required. Defaulting to 1 name.");
          numNames = 1;
        }
        int numPhones = readInt("the number of phone numbers this unknown entity has [0]");
        int numEmails = readInt("the number of email addresses this unknown entity has [0]");
        List<String> names = new ArrayList<String>();
        for (int i = 0; i < numNames; i++) {
          names.add(readString("entity name #" + (i + 1) + " [testName" + (i + 1) + "]"));
        }
        List<String> phones = new ArrayList<String>();
        for (int i = 0; i < numPhones; i++) {
          phones.add(readString("entity phone number #" + (i + 1) + " [testPhone" + (i + 1) + "]"));
        }
        List<String> emails = new ArrayList<String>();
        for (int i = 0; i < numEmails; i++) {
          emails.add(readString("entity email #" + (i + 1) + " [testEmail" + (i + 1) + "]"));
        }

        // Skip optional extensible attributes.

        return (new Unknown(names, phones, emails));
      }
    });
    CONSTRUCTOR_BUILDERS.put(Keyword.class, new IConstructorBuilder() {
      public IDDMSComponent build() throws IOException, InvalidDDMSException {
        String keyword = readString("the keyword value [testValue]");
        SecurityAttributes attr = buildSecurityAttributes("keyword");

        // Skip optional extensible attributes.

        return (new Keyword(keyword, attr));
      }
    });
    CONSTRUCTOR_BUILDERS.put(Category.class, new IConstructorBuilder() {
      public IDDMSComponent build() throws IOException, InvalidDDMSException {
        String qualifier = readString("the qualifier [testQualifier]");
        String code = readString("the code [testCode]");
        String label = readString("the label [testLabel]");

        // Skip optional extensible attributes.

        return (new Category(qualifier, code, label, buildSecurityAttributes("category")));
      }
    });
    CONSTRUCTOR_BUILDERS.put(ProductionMetric.class, new IConstructorBuilder() {
      public IDDMSComponent build() throws IOException, InvalidDDMSException {
        String subject = readString("the subject [testSubject]");
        String coverage = readString("the coverage [testCoverage]");
        return (new ProductionMetric(subject, coverage, buildSecurityAttributes("productionMetric")));
      }
    });
    CONSTRUCTOR_BUILDERS.put(NonStateActor.class, new IConstructorBuilder() {
      public IDDMSComponent build() throws IOException, InvalidDDMSException {
        String value = readString("the value [testValue]");
        int order = readInt("the order [1]");
        String qualifier = readString("the qualifier [testQualifier]");
        SecurityAttributes attr = buildSecurityAttributes("nonStateActor");
        return (new NonStateActor(value, Integer.valueOf(order), qualifier, attr));
      }
    });
    CONSTRUCTOR_BUILDERS.put(SubjectCoverage.class, new IConstructorBuilder() {
      public IDDMSComponent build() throws IOException, InvalidDDMSException {
View Full Code Here

  private SecurityAttributes buildSecurityAttributes(String elementName) throws IOException, InvalidDDMSException {
    String classification = getUseDummySecurityAttributes() ? "U" : readString("the " + elementName
      + "'s classification [U]");
    String ownerProducers = getUseDummySecurityAttributes() ? "USA" : readString("the " + elementName
      + "'s ownerProducers as a space-delimited string [USA]");
    return (new SecurityAttributes(classification, Util.getXsListAsList(ownerProducers), null));
  }
View Full Code Here

  public AbstractAccessEntity(Element element) throws InvalidDDMSException {
    setXOMElement(element, false);
    Element systemElement = element.getFirstChildElement(SystemName.getName(getDDMSVersion()), getNamespace());
    if (systemElement != null)
      _systemName = new SystemName(systemElement);
    _securityAttributes = new SecurityAttributes(element);
  }
View Full Code Here

   */
  protected AbstractNtkString(boolean tokenBased, Element element) throws InvalidDDMSException {
    try {
      setXOMElement(element, false);
      _tokenBased = tokenBased;
      _securityAttributes = new SecurityAttributes(element);
      validate();
    }
    catch (InvalidDDMSException e) {
      e.setLocator(getQualifiedName());
      throw (e)
View Full Code Here

   * @param element the XOM element representing this
   * @throws InvalidDDMSException if any required information is missing or malformed
   */
  public Keyword(Element element) throws InvalidDDMSException {
    try {
      _securityAttributes = new SecurityAttributes(element);
      _extensibleAttributes = new ExtensibleAttributes(element);
      setXOMElement(element, true);
    }
    catch (InvalidDDMSException e) {
      e.setLocator(getQualifiedName());
View Full Code Here

        if (Unknown.getName(getDDMSVersion()).equals(entityType))
          _entity = new Unknown(entityElement);
      }
      String pocTypes = element.getAttributeValue(POC_TYPE_NAME, getDDMSVersion().getIsmNamespace());
      _pocTypes = Util.getXsListAsList(pocTypes);
      _securityAttributes = new SecurityAttributes(element);
      validate();
    }
    catch (InvalidDDMSException e) {
      e.setLocator(getQualifiedName());
      throw (e);
View Full Code Here

   * @param element the XOM element representing this
   * @throws InvalidDDMSException if any required information is missing or malformed
   */
  public Category(Element element) throws InvalidDDMSException {
    try {
      _securityAttributes = new SecurityAttributes(element);
      _extensibleAttributes = new ExtensibleAttributes(element);
      setXOMElement(element, true);
    }
    catch (InvalidDDMSException e) {
      e.setLocator(getQualifiedName());
View Full Code Here

TOP

Related Classes of buri.ddmsence.ddms.security.ism.SecurityAttributes$Builder

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.