/* (non-Javadoc)
@see org.apereo.portal.portlet.registry.IPortletDefinitionRegistry#getParentPortletApplicationDescriptor(org.apereo.portal.portlet.om.IPortletDefinitionId)
972845
@Override
    public PortletApplicationDefinition getParentPortletApplicationDescriptor(
            IPortletDefinitionId portletDefinitionId) {
        final IPortletDefinition portletDefinition = this.getPortletDefinition(portletDefinitionId);
        if (portletDefinition == null) {
            return null;
        }

        final Tuple<String, String> portletDescriptorKeys =
                this.getPortletDescriptorKeys(portletDefinition);

        final PortletRegistryService portletRegistryService =
                this.portalDriverContainerServices.getPortletRegistryService();
        try {
            return portletRegistryService.getPortletApplication(portletDescriptorKeys.first);
        } catch (PortletContainerException e) {
            this.logger.warn(
                    "No portlet application descriptor could be found likely not deployed. For portlet definition: "
                            + portletDefinition,
                    e);
            return null;
        }
    }
445972
PropertyMap getPrimaryParent() {
    if (parentSource == null) {
      return null;
    }
    ObjectType iProto = parentSource.getImplicitPrototype();
    return iProto == null ? null : iProto.getPropertyMap();
  }
28209
@Override
    public IPortletEntity getPortletEntity(IPortletEntityId portletEntityId) {
        final IPortletEntity portletEntity =
                this.delegatePortletEntityDao.getPortletEntity(portletEntityId);
        return this.wrapEntity(portletEntity);
    }
797612
@Override
    public String getDescription()
    {
        if (tc.isEntryEnabled())
            SibTr.entry(tc, "getDescription");

        String desc = _definition.getDescription();

        if (tc.isEntryEnabled())
            SibTr.exit(tc, "getDescription", desc);

        return desc;
    }
779030
public Constituent getParent() {
    if (Constituent_Type.featOkTst && ((Constituent_Type)jcasType).casFeat_parent == null)
      jcasType.jcas.throwFeatMissing("parent", "de.julielab.jules.types.Constituent");
    return (Constituent)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((Constituent_Type)jcasType).casFeatCode_parent)));}
134984
@Override
    public IPortletWindowId getDefaultPortletWindowId(
            HttpServletRequest request, IPortletEntityId portletEntityId) {
        final IPortletWindowId portletWindowId = this.createPortletWindowId(null, portletEntityId);
        logger.trace(
                "Determined default portlet window id {} for portlet entity {}",
                portletWindowId,
                portletEntityId);
        return portletWindowId;
    }
1329108
private PortletApplicationDefinition createDefinition(
            ServletContext servletContext, String name, String contextPath)
            throws PortletContainerException {
        PortletApplicationDefinition portletApp = null;
        try {
            InputStream paIn = servletContext.getResourceAsStream(PORTLET_XML);
            InputStream webIn = servletContext.getResourceAsStream(WEB_XML);
            if (paIn == null) {
                throw new PortletContainerException(
                        "Cannot find '"
                                + PORTLET_XML
                                + "'. Are you sure it is in the deployed package?");
            }
            if (webIn == null) {
                throw new PortletContainerException(
                        "Cannot find '"
                                + WEB_XML
                                + "'. Are you sure it is in the deployed package?");
            }
            portletApp = this.portletAppDescriptorService.read(name, contextPath, paIn);
            this.portletAppDescriptorService.mergeWebDescriptor(portletApp, webIn);
        } catch (Exception ex) {
            throw new PortletContainerException(
                    "Exception loading portlet descriptor for: "
                            + servletContext.getServletContextName(),
                    ex);
        }
        return portletApp;
    }
226639
public PortletType<PortletDescriptor> getOrCreatePortlet()
   {
      List<Node> nodeList = model.get("portlet");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new PortletTypeImpl<PortletDescriptor>(this, "portlet", model, nodeList.get(0));
      }
      return createPortlet();
   }
544691
public void setChannelPublishingDefinition(PortletPublishingDefinition cpd) {

        // Set appName/portletName if a descriptor is present.  If a framework
        // portlet, the applicationId is /uPortal.
        if (cpd.getPortletDescriptor() != null) {
            final PortletDescriptor pDesc = cpd.getPortletDescriptor();
            // PortletDescriptor is a class generated from XSD.  The value of
            // isIsFramework() will commonly be null.
            final boolean isFramework =
                    pDesc.isIsFramework() != null ? pDesc.isIsFramework() : false;
            applicationId = isFramework ? FRAMEWORK_PORTLET_URL : pDesc.getWebAppName();
            portletName = pDesc.getPortletName();
        }

        // set default values for all portlet parameters
        for (Step step : cpd.getSteps()) {
            if (step.getParameters() != null) {
                for (Parameter param : step.getParameters()) {
                    // if this parameter doesn't currently have a value, check
                    // for a default in the CPD
                    Attribute attribute = parameters.get(param.getName());
                    if (attribute == null
                            || attribute.getValue() == null
                            || attribute.getValue().trim().equals("")) {

                        // use the default value if one exists
                        ParameterInputType input = param.getParameterInput().getValue();
                        if (input != null) {
                            parameters.put(param.getName(), new Attribute(input.getDefault()));
                        }
                    }
                }
            }
            if (step.getPreferences() != null) {
                for (Preference pref : step.getPreferences()) {
                    // if this parameter doesn't currently have a value, check
                    // for a default in the CPD
                    if (!portletPreferences.containsKey(pref.getName())
                            || portletPreferences.get(pref.getName()).getValue().size() == 0
                            || (portletPreferences.get(pref.getName()).getValue().size() == 1
                                    && portletPreferences
                                            .get(pref.getName())
                                            .getValue()
                                            .get(0)
                                            .trim()
                                            .equals(""))) {

                        if (!portletPreferences.containsKey(pref.getName())) {
                            portletPreferences.put(pref.getName(), new StringListAttribute());
                        }

                        // use the default value if one exists
                        PreferenceInputType input = pref.getPreferenceInput().getValue();
                        if (input instanceof SingleValuedPreferenceInputType) {
                            SingleValuedPreferenceInputType singleValued =
                                    (SingleValuedPreferenceInputType) input;
                            if (singleValued.getDefault() != null) {
                                portletPreferences
                                        .get(pref.getName())
                                        .getValue()
                                        .add(singleValued.getDefault());
                            }
                        } else if (input instanceof MultiValuedPreferenceInputType) {
                            MultiValuedPreferenceInputType multiValued =
                                    (MultiValuedPreferenceInputType) input;
                            if (multiValued.getDefaults() != null) {
                                portletPreferences
                                        .get(pref.getName())
                                        .getValue()
                                        .addAll(multiValued.getDefaults());
                            }
                        }
                    }
                }
            }
        }
    }
652667
public Type getParentType()
    {
        Type ret = null;
        if (this.parentTypeId != null && this.parentTypeId != 0) {
            try {
                ret = Type.get(this.parentTypeId);
            } catch (final CacheReloadException e) {
                Type.LOG.error("Could not read parentType for id: {}", this.parentTypeId);
            }
        }
        return ret;
    }
996645
@Override
  public Key getParent() {
    List<PathElement> ancestors = getAncestors();
    if (ancestors.isEmpty()) {
      return null;
    }
    PathElement parent = ancestors.get(ancestors.size() - 1);
    Key.Builder keyBuilder;
    if (parent.hasName()) {
      keyBuilder = Key.newBuilder(getProjectId(), parent.getKind(), parent.getName());
    } else {
      keyBuilder = Key.newBuilder(getProjectId(), parent.getKind(), parent.getId());
    }
    String namespace = getNamespace();
    if (namespace != null) {
      keyBuilder.setNamespace(namespace);
    }
    return keyBuilder.addAncestors(ancestors.subList(0, ancestors.size() - 1)).build();
  }
88503
private WebServiceFeature[] getWebServiceFeaturesOnPortComponentRef(Class serviceEndpointInterface) {

        WebServiceFeature[] returnArray = {};

        if (serviceEndpointInterface != null && wsrInfo != null) {
            String seiName = serviceEndpointInterface.getName();
            PortComponentRefInfo pcr = wsrInfo.getPortComponentRefInfo(seiName);

            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "SEI name = " + seiName);
                Tr.debug(tc, "PortComponentRefInfo found = " + pcr);
            }

            if (pcr != null) {
                List<WebServiceFeatureInfo> featureInfoList = pcr.getWebServiceFeatureInfos();
                if (tc.isDebugEnabled()) {
                    Tr.debug(tc, "List of WebServiceFeatureInfo from PortComponentRefInfo = " + featureInfoList);
                }
                if (!featureInfoList.isEmpty()) {
                    returnArray = new WebServiceFeature[featureInfoList.size()];
                    for (int i = 0; i < featureInfoList.size(); i++) {
                        WebServiceFeatureInfo featureInfo = featureInfoList.get(i);
                        WebServiceFeature wsf = featureInfo.getWebServiceFeature();
                        returnArray[i] = wsf;
                        if (tc.isDebugEnabled()) {
                            Tr.debug(tc, "Added WebServiceFeature " + wsf);
                        }
                    }
                }
            }
        }

        return returnArray;
    }
1155532
@Override
    public Tuple<String, String> getPortletDescriptorKeys(IPortletDefinition portletDefinition) {

        final String portletApplicationId;
        if (portletDefinition.getPortletDescriptorKey().isFrameworkPortlet()) {
            portletApplicationId = this.servletContext.getContextPath();
        } else {
            portletApplicationId = portletDefinition.getPortletDescriptorKey().getWebAppName();
        }

        final String portletName = portletDefinition.getPortletDescriptorKey().getPortletName();

        return new Tuple<String, String>(portletApplicationId, portletName);
    }
748497
JcrPropertyDefinition getPropertyDefinition( PropertyDefinitionId definitionId ) {
        if (definitionId == null) return null;
        return nodeTypes().getPropertyDefinition(definitionId);
    }
241076
private IScriptReporter getParentScriptReporter()
    {
        Tag parent = getParent();
        if (parent == null)
            return null;
        return (IScriptReporter) SimpleTagSupport.findAncestorWithClass(parent, IScriptReporter.class);
    }
173492
public CmsClientSitemapEntry getParentEntry(CmsClientSitemapEntry entry) {

        String path = entry.getSitePath();
        String parentPath = CmsResource.getParentFolder(path);
        if (parentPath == null) {
            return null;
        }
        return getEntry(parentPath);
    }
520361
function getParent(type, id, parentType, root) {
		return _client.retrieve({
			type: type,
			id: id,
			properties: ['parent']
		})
		.then(function(obj) {
			
			if (obj.length > 0) {
				
				obj  = _.first(obj);
				type = _.get(obj, 'parent.type');
				id   = _.get(obj, 'parent.id');
				
				// if there is no parent type or id, the parent could not be found, throw an error
				if (!type || !id) {
					throw {
						errorCode: 404,
						message: 'could not find parent type'
					};
				}
				
				// if the parent is a match
				if (type === parentType) {
					
					// if a root search, keep looking for parent objects of the same type
					if (root === true) {
						return _client.retrieve({
							type: type,
							id: id,
							properties: ['parent']
						})
						.then(function(parent) {
							if (_.get(parent, 'parent.type') === parentType) {
								return getParent(type, id, parentType, root);
							}
							return {
								id: id,
								type: parentType
							};
						});
					}
					return {
						id: id,
						type: parentType
					};
				}
				
				return getParent(type, id, parentType, root);
			}
			
			throw {
				errorCode: 404,
				message: 'Object not found'
			};
		});
	}