Package com.woorea.openstack.keystone.v3.model

Examples of com.woorea.openstack.keystone.v3.model.Group


    StructureDefinition retVal = new StructureDefinition();
    retVal.setName(theStructure.getName());

    if (theStructure instanceof Group) {
      retVal.setSegment(false);
      Group group = (Group) theStructure;
      int index = 0;
      List<String> childNames = Arrays.asList(group.getNames());
     
      /*
       * For SuperStructures, which can hold more than one type of structure,
       * we only actually bring in the child names that are actually a part
       * of the structure we are trying to parse
       */
      if (theStructure instanceof SuperStructure) {
        String struct = theStructureName;
        Map<String, String> evtMap = new DefaultModelClassFactory().getEventMapForVersion(Version.versionOf(theStructure.getMessage().getVersion()));
        if (evtMap.containsKey(struct)) {
          struct = evtMap.get(struct);
        }
        childNames = ((SuperStructure) theStructure).getChildNamesForStructure(struct);
      }
     
      for (String nextName : childNames) {
        Structure nextChild = group.get(nextName);
        StructureDefinition structureDefinition = createStructureDefinition(nextChild, thePreviousLeaf, theStructureName);
        structureDefinition.setNameAsItAppearsInParent(nextName);
        structureDefinition.setRepeating(group.isRepeating(nextName));
        structureDefinition.setRequired(group.isRequired(nextName));
        structureDefinition.setChoiceElement(group.isChoiceElement(nextName));
        structureDefinition.setPosition(index++);
        structureDefinition.setParent(retVal);
        retVal.addChild(structureDefinition);
      }
    } else {
View Full Code Here


        StructureDefinition retVal = new StructureDefinition();
        retVal.setName(theStructure.getName());

        if (theStructure instanceof Group) {
            retVal.setSegment(false);
            Group group = (Group) theStructure;
            int index = 0;
            for (String nextName : group.getNames()) {
                Structure nextChild = group.get(nextName);
                StructureDefinition structureDefinition = createStructureDefinition(nextChild, thePreviousLeaf);
                structureDefinition.setNameAsItAppearsInParent(nextName);
                structureDefinition.setRepeating(group.isRepeating(nextName));
                structureDefinition.setRequired(group.isRequired(nextName));
                structureDefinition.setPosition(index++);
                structureDefinition.setParent(retVal);
                retVal.addChild(structureDefinition);
            }
        } else {
View Full Code Here

    private void addNonStandardSegmentAtCurrentPosition() throws Error {
        if (log.isDebugEnabled()) {
            log.debug("Creating non standard segment on group: " + getCurrentPosition().getStructureDefinition().getParent().getName());
        }
        List<Position> parentDefinitionPath = new ArrayList<Position>(myCurrentDefinitionPath.subList(0, myCurrentDefinitionPath.size() - 1));
        Group parentStructure = (Group) navigateToStructure(parentDefinitionPath);

        int index = getCurrentPosition().getStructureDefinition().getPosition() + 1;
        String newSegmentName;
        try {
            newSegmentName = parentStructure.addNonstandardSegment(myDirection, index);
        } catch (HL7Exception e) {
            throw new Error("Unable to add nonstandard segment " + myDirection + ": ", e);
        }
        IStructureDefinition previousSibling = getCurrentPosition().getStructureDefinition();
        IStructureDefinition parentStructureDefinition = parentDefinitionPath.get(parentDefinitionPath.size() - 1).getStructureDefinition();
View Full Code Here

            if (currentStructure == null) {
                currentStructure = myMessage;
            } else {
                try {
                    IStructureDefinition structureDefinition = next.getStructureDefinition();
                    Group currentStructureGroup = (Group) currentStructure;
                    String nextStructureName = structureDefinition.getNameAsItAppearsInParent();
                    currentStructure = currentStructureGroup.get(nextStructureName, next.getRepNumber());
                } catch (HL7Exception e) {
                    throw new Error("Failed to retrieve structure: ", e);
                }
            }
        }
View Full Code Here

        boolean has = true;
        if (next == null) {
            if (Group.class.isAssignableFrom(currentStructure.getClass())) {
                groupNext((Group) currentStructure);
            } else {
                Group parent = currentStructure.getParent();
                Index i = getIndex(parent, currentStructure);
                Position currentPosition = new Position(parent, i);
               
                try {                   
                    if (parent.isRepeating(i.name) && currentStructure.getName().equals(direction)) {
                        nextRep(currentPosition);
                    } else {
                        has = nextPosition(currentPosition, this.direction, this.handleUnexpectedSegments);
                    }
                } catch (HL7Exception e) {
View Full Code Here

        // i.e. trying to avoid calling matchExistsAfterCurrentPosition
       
        if (!makeNewSegmentIfNeeded && Message.class.isAssignableFrom(currPos.parent.getClass())) {
            nextExists = false;
        } else if (!makeNewSegmentIfNeeded || matchExistsAfterPosition(currPos, direction, false, true)) {    
            Group grandparent = currPos.parent.getParent();
            Index parentIndex = getIndex(grandparent, currPos.parent);
            Position parentPos = new Position(grandparent, parentIndex);
           
            try {
                boolean parentRepeats = parentPos.parent.isRepeating(parentPos.index.name);               
View Full Code Here

            }
        }
       
        //recurse to parent (if parent is not message root)
        if (!matchExists && !Message.class.isAssignableFrom(pos.parent.getClass())) {
            Group grandparent = pos.parent.getParent();
            Position parentPos = new Position(grandparent, getIndex(grandparent, pos.parent));
            matchExists = matchExistsAfterPosition(parentPos, name, firstDescendentsOnly, upToFirstRequired);
        }
        log.debug("Match exists after position {} for {}? {}", new Object[] {pos, name, matchExists});
        return matchExists;
View Full Code Here

    public static boolean contains(Structure s, String name, boolean firstDescendentsOnly, boolean upToFirstRequired) {
        boolean contains = false;
        if (Segment.class.isAssignableFrom(s.getClass())) {
            if (s.getName().equals(name)) contains = true;           
        } else {
            Group g = (Group) s;
            String[] names = g.getNames();
            for (int i = 0; i < names.length && !contains; i++) {
                try {
                    contains = contains(g.get(names[i], 0), name, firstDescendentsOnly, upToFirstRequired);               
                    if (firstDescendentsOnly) break;
                    if (upToFirstRequired && g.isRequired(names[i])) break;
                } catch (HL7Exception e) {
                    throw new Error("HL7Exception due to bad index: " + e.getMessage());
                }
            }
        }
View Full Code Here

    StructureDefinition retVal = new StructureDefinition();
    retVal.setName(theStructure.getName());

    if (theStructure instanceof Group) {
      retVal.setSegment(false);
      Group group = (Group) theStructure;
      int index = 0;
      List<String> childNames = Arrays.asList(group.getNames());
     
      /*
       * For SuperStructures, which can hold more than one type of structure,
       * we only actually bring in the child names that are actually a part
       * of the structure we are trying to parse
       */
      if (theStructure instanceof SuperStructure) {
        String struct = theStructureName;
        Map<String, String> evtMap = new DefaultModelClassFactory().getEventMapForVersion(Version.versionOf(theStructure.getMessage().getVersion()));
        if (evtMap.containsKey(struct)) {
          struct = evtMap.get(struct);
        }
        childNames = ((SuperStructure) theStructure).getChildNamesForStructure(struct);
      }
     
      for (String nextName : childNames) {
        Structure nextChild = group.get(nextName);
        StructureDefinition structureDefinition = createStructureDefinition(nextChild, thePreviousLeaf, theStructureName);
        structureDefinition.setNameAsItAppearsInParent(nextName);
        structureDefinition.setRepeating(group.isRepeating(nextName));
        structureDefinition.setRequired(group.isRequired(nextName));
        structureDefinition.setChoiceElement(group.isChoiceElement(nextName));
        structureDefinition.setPosition(index++);
        structureDefinition.setParent(retVal);
        retVal.addChild(structureDefinition);
      }
    } else {
View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) {
    Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL);
   
    Authentication auth = new Authentication();
    auth.setIdentity(Identity.password(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD));
   
    OpenStackResponse response = keystone.tokens().authenticate(auth).request();
   
    String tokenId = response.header("X-Subject-Token");
   
    Token token = response.getEntity(Token.class);
   
View Full Code Here

TOP

Related Classes of com.woorea.openstack.keystone.v3.model.Group

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.