Package org.apache.geronimo.jee.naming

Examples of org.apache.geronimo.jee.naming.PersistenceContextRef


            Relationships relationships = openejb.getRelationships();
            if (relationships != null && relationships.getEjbRelation().size() == 0) {
                openejb.setRelationships(null);
            }
        } else if (source instanceof PersistenceContextRef) {
            PersistenceContextRef contextRef = (PersistenceContextRef)source;
            if (contextRef.getPattern() != null && isEmpty(contextRef.getPattern())) {
                contextRef.setPattern(null);
            }
        } else if (source instanceof EjbRelationshipRole) {
            EjbRelationshipRole role = (EjbRelationshipRole)source;
            if (role.getRoleMapping() != null && role.getRoleMapping().getCmrFieldMapping().size() == 0) {
                role.setRoleMapping(null);
View Full Code Here


    public ILabelProvider getLabelProvider() {
        return new LabelProvider() {
            @Override
            public String getText(Object element) {
                if (JAXBElement.class.isInstance(element)) {
                    PersistenceContextRef contextRef = (PersistenceContextRef)((JAXBElement)element).getValue();
                    String temp = "Persistence Context Ref: name = \"" + contextRef.getPersistenceContextRefName() +
                                  "\", type = \"" + contextRef.getPersistenceContextType().value();
                    if (contextRef.getPersistenceUnitName() != null)
                        temp += "\", unit name = \"" + contextRef.getPersistenceUnitName();
                    if (contextRef.getPattern() != null && contextRef.getPattern().getName() != null)
                        temp += "\", pattern name = \"" + contextRef.getPattern().getName();
                    if (contextRef.getPattern() != null && contextRef.getPattern().getGroupId() != null)
                        temp += "\", pattern group = \"" + contextRef.getPattern().getGroupId();
                    if (contextRef.getPattern() != null && contextRef.getPattern().getArtifactId() != null)
                        temp += "\", pattern artifact = \"" + contextRef.getPattern().getArtifactId();
                    if (contextRef.getPattern() != null && contextRef.getPattern().getVersion() != null)
                        temp += "\", pattern version = \"" + contextRef.getPattern().getVersion();
                    if (contextRef.getPattern() != null && contextRef.getPattern().getModule() != null)
                        temp += "\", pattern module = \"" + contextRef.getPattern().getModule();
                    temp += "\"";
                    return temp;
                }
                else if (Property.class.isInstance(element)) {
                    Property property = (Property)element;
View Full Code Here

        }
    }

    @Override
    public boolean performFinish() {
        PersistenceContextRef contextRef;
        if (element.getText().equals(elementTypes[CONTEXT])) {
            if (isEmpty(textList.get(0).getText()) ||
                isEmpty(textList.get(2).getText()) && isEmpty(textList.get(3).getText())) {
                return false;
            }
            contextRef = (PersistenceContextRef)eObject;
            ObjectFactory objectFactory = new ObjectFactory();
            if (contextRef == null) {
                contextRef = (PersistenceContextRef)getEFactory().create(PersistenceContextRef.class);
                JAXBElement plan = section.getPlan();

                // add the JAXBElement of the PersistenceContextRef
                JAXBModelUtils.getGbeanRefs(plan).add(objectFactory.createPersistenceContextRef(contextRef));
                section.getObjectContainer().add(objectFactory.createPersistenceContextRef(contextRef));
            }
            contextRef.setPersistenceContextRefName(textList.get(0).getText());
            contextRef.setPersistenceContextType(PersistenceContextType.fromValue(contextType.getText()));
            if (specifyUnit.getSelection() == true) {
                contextRef.setPersistenceUnitName(textList.get(2).getText());
                contextRef.setPattern(null);
            }
            else {
                contextRef.setPersistenceUnitName(null);
                Pattern pattern = contextRef.getPattern();
                if (pattern == null) {
                    pattern = objectFactory.createPattern();
                }
                pattern.setName(textList.get(3).getText());
                pattern.setGroupId(textList.get(4).getText());
                pattern.setArtifactId(textList.get(5).getText());
                pattern.setVersion(textList.get(6).getText());
                pattern.setModule(textList.get(7).getText());
                contextRef.setPattern(pattern);
            }
        }
        else if (element.getText().equals(elementTypes[PROPERTY])) {
            if (isEmpty(textList.get(0).getText())) {
                return false;
            }
            Property property = (Property)eObject;
            if (property == null) {
                property = (Property)getEFactory().create(Property.class);
                contextRef = (PersistenceContextRef)section.getSelectedObject();
                contextRef.getProperty().add(property);
            }
            property.setKey(textList.get(0).getText());
            property.setValue(textList.get(2).getText());
        }
        return true;
View Full Code Here

        }

        protected void initControl () {
            if (eObject == null) {
                element.select(CONTEXT);
                PersistenceContextRef contextRef = (PersistenceContextRef)section.getSelectedObject();
                if (contextRef == null) {
                    element.setEnabled(false);
                }
            }
            else {
                if (JAXBElement.class.isInstance(eObject)) {
                    eObject = ((JAXBElement)eObject).getValue();
                    PersistenceContextRef contextRef = (PersistenceContextRef)eObject;
                    textList.get(0).setText(contextRef .getPersistenceContextRefName());
                    contextType.setText(contextRef .getPersistenceContextType().value());
                    if (contextRef .getPersistenceUnitName() != null)
                        textList.get(2).setText(contextRef .getPersistenceUnitName());
                    if (contextRef .getPattern() != null) {
                        specifyPattern.setSelection(true);
                        textList.get(3).setText(contextRef.getPattern().getName());
                        if (contextRef .getPattern().getGroupId() != null)
                            textList.get(4).setText(contextRef .getPattern().getGroupId());
                        if (contextRef .getPattern().getArtifactId() != null)
                            textList.get(5).setText(contextRef .getPattern().getArtifactId());
                        if (contextRef .getPattern().getVersion() != null)
                            textList.get(6).setText(contextRef .getPattern().getVersion());
                        if (contextRef .getPattern().getModule() != null)
                            textList.get(7).setText(contextRef .getPattern().getModule());
                    }
                    element.select(CONTEXT);
                }
                else if (Property.class.isInstance(eObject)) {
                    textList.get(0).setText(((Property)eObject).getKey());
View Full Code Here

TOP

Related Classes of org.apache.geronimo.jee.naming.PersistenceContextRef

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.