Search in sources :

Example 1 with Definition

use of org.eclipse.xtext.linking.lazy.bug311337.Definition in project uPortal by Jasig.

the class SoffitRendererController method render.

@RequestMapping(value = "/{module}", method = RequestMethod.GET)
public ModelAndView render(final HttpServletRequest req, final HttpServletResponse res, @PathVariable final String module) {
    logger.debug("Rendering for request URI '{}'", req.getRequestURI());
    // Soffit Object Model
    final PortalRequest portalRequest = getPortalRequest(req);
    final Bearer bearer = getBearer(req);
    final Preferences preferences = getPreferences(req);
    final Definition definition = getDefinition(req);
    // Select a view
    final String viewName = selectView(req, module, portalRequest);
    final Map<String, Object> model = modelAttributeService.gatherModelAttributes(viewName, req, res, portalRequest, bearer, preferences, definition);
    model.put(PORTAL_REQUEST_MODEL_NAME, portalRequest);
    model.put(BEARER_MODEL_NAME, bearer);
    model.put(PREFERENCES_MODEL_NAME, preferences);
    model.put(DEFINITION_MODEL_NAME, definition);
    // Set up cache headers appropriately
    configureCacheHeaders(res, module);
    return new ModelAndView(viewName, model);
}
Also used : Definition(org.apereo.portal.soffit.model.v1_0.Definition) ModelAndView(org.springframework.web.servlet.ModelAndView) Preferences(org.apereo.portal.soffit.model.v1_0.Preferences) Bearer(org.apereo.portal.soffit.model.v1_0.Bearer) PortalRequest(org.apereo.portal.soffit.model.v1_0.PortalRequest) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with Definition

use of org.eclipse.xtext.linking.lazy.bug311337.Definition in project uPortal by Jasig.

the class ModelAttributeServiceTest method testGetModelAttributeFromMethod.

@Test
public void testGetModelAttributeFromMethod() {
    final ModelAttributeService modelAttributeService = new ModelAttributeService();
    final Class[] parameterClasses = new Class[] { HttpServletRequest.class, PortalRequest.class, Bearer.class };
    final Method method;
    try {
        method = getClass().getMethod("soffitModelAttributeMethod", parameterClasses);
    } catch (NoSuchMethodException e) {
        throw new RuntimeException(e);
    }
    // Object Model
    final HttpServletRequest req = Mockito.mock(HttpServletRequest.class);
    final HttpServletResponse res = Mockito.mock(HttpServletResponse.class);
    final PortalRequest portalRequest = Mockito.mock(PortalRequest.class);
    final Bearer bearer = Mockito.mock(Bearer.class);
    final Preferences preferences = Mockito.mock(Preferences.class);
    final Definition definition = Mockito.mock(Definition.class);
    final Object modelAttribute = modelAttributeService.getModelAttributeFromMethod(this, method, req, res, portalRequest, bearer, preferences, definition);
    assertEquals("Incorrect modelAttribute", modelAttribute, returnValue);
    final Method brokenMethod;
    try {
        brokenMethod = getClass().getMethod("brokenSoffitModelAttributeMethod", parameterClasses);
    } catch (NoSuchMethodException e) {
        throw new RuntimeException(e);
    }
    try {
        modelAttributeService.getModelAttributeFromMethod(this, brokenMethod, req, res, portalRequest, bearer, preferences, definition);
        fail("Expected IllegalStateException for void-declaring method");
    } catch (IllegalStateException e) {
    // Expected;  fall through...
    }
}
Also used : Definition(org.apereo.portal.soffit.model.v1_0.Definition) HttpServletResponse(javax.servlet.http.HttpServletResponse) Method(java.lang.reflect.Method) PortalRequest(org.apereo.portal.soffit.model.v1_0.PortalRequest) HttpServletRequest(javax.servlet.http.HttpServletRequest) Preferences(org.apereo.portal.soffit.model.v1_0.Preferences) Bearer(org.apereo.portal.soffit.model.v1_0.Bearer) Test(org.junit.Test)

Example 3 with Definition

use of org.eclipse.xtext.linking.lazy.bug311337.Definition in project uPortal by Jasig.

the class DefinitionService method parseDefinition.

public Definition parseDefinition(String definitionToken) {
    final Jws<Claims> claims = parseEncrypteToken(definitionToken, Definition.class);
    final String username = claims.getBody().getSubject();
    // Title
    final String title = (String) claims.getBody().get(JwtClaims.TITLE.getName());
    // FName
    final String fname = (String) claims.getBody().get(JwtClaims.FNAME.getName());
    // Description
    final String description = (String) claims.getBody().get(JwtClaims.DESCRIPTION.getName());
    // Categories
    @SuppressWarnings("unchecked") final List<String> categories = (List<String>) claims.getBody().get(JwtClaims.CATEGORIES.getName());
    // Parameters
    @SuppressWarnings("unchecked") final Map<String, List<String>> parameters = (Map<String, List<String>>) claims.getBody().get(JwtClaims.PARAMETERS.getName());
    Definition rslt = new Definition(definitionToken, title, fname, description, categories, parameters);
    logger.debug("Produced the following Definition for user '{}':  {}", username, rslt);
    return rslt;
}
Also used : Claims(io.jsonwebtoken.Claims) Definition(org.apereo.portal.soffit.model.v1_0.Definition) List(java.util.List) Map(java.util.Map)

Example 4 with Definition

use of org.eclipse.xtext.linking.lazy.bug311337.Definition in project xtext-core by eclipse.

the class ChildImpl method setLink.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setLink(Definition newLink) {
    Definition oldLink = link;
    link = newLink;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, Bug311337Package.CHILD__LINK, oldLink, link));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) Definition(org.eclipse.xtext.linking.lazy.bug311337.Definition)

Example 5 with Definition

use of org.eclipse.xtext.linking.lazy.bug311337.Definition in project xtext-core by eclipse.

the class Bug311337TestLanguageSemanticSequencer method sequence.

@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
    EPackage epackage = semanticObject.eClass().getEPackage();
    ParserRule rule = context.getParserRule();
    Action action = context.getAssignedAction();
    Set<Parameter> parameters = context.getEnabledBooleanParameters();
    if (epackage == Bug311337Package.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case Bug311337Package.CHILD:
                sequence_Child(context, (Child) semanticObject);
                return;
            case Bug311337Package.DEFINITION:
                sequence_Definition(context, (Definition) semanticObject);
                return;
            case Bug311337Package.MODEL:
                sequence_Model(context, (Model) semanticObject);
                return;
            case Bug311337Package.NESTED_REF:
                sequence_Reference(context, (NestedRef) semanticObject);
                return;
            case Bug311337Package.REFERENCE:
                sequence_Reference(context, (Reference) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) NestedRef(org.eclipse.xtext.linking.lazy.bug311337.NestedRef) Action(org.eclipse.xtext.Action) Reference(org.eclipse.xtext.linking.lazy.bug311337.Reference) Definition(org.eclipse.xtext.linking.lazy.bug311337.Definition) Model(org.eclipse.xtext.linking.lazy.bug311337.Model) Parameter(org.eclipse.xtext.Parameter) Child(org.eclipse.xtext.linking.lazy.bug311337.Child) EPackage(org.eclipse.emf.ecore.EPackage)

Aggregations

Definition (org.apereo.portal.soffit.model.v1_0.Definition)6 HttpServletRequest (javax.servlet.http.HttpServletRequest)3 Bearer (org.apereo.portal.soffit.model.v1_0.Bearer)3 PortalRequest (org.apereo.portal.soffit.model.v1_0.PortalRequest)3 Preferences (org.apereo.portal.soffit.model.v1_0.Preferences)3 Claims (io.jsonwebtoken.Claims)2 Method (java.lang.reflect.Method)2 List (java.util.List)2 HttpServletResponse (javax.servlet.http.HttpServletResponse)2 Definition (org.eclipse.xtext.linking.lazy.bug311337.Definition)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Locale (java.util.Locale)1 Map (java.util.Map)1 Header (org.apache.http.Header)1 BasicHeader (org.apache.http.message.BasicHeader)1 MarketplacePortletDefinition (org.apereo.portal.portlet.marketplace.MarketplacePortletDefinition)1 IPortletDefinition (org.apereo.portal.portlet.om.IPortletDefinition)1 IPortletDefinitionParameter (org.apereo.portal.portlet.om.IPortletDefinitionParameter)1