Java Code Examples for org.apache.olingo.commons.api.edm.FullQualifiedName#equals()

The following examples show how to use org.apache.olingo.commons.api.edm.FullQualifiedName#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MetadataDocumentXmlSerializerTest.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Override
public List<CsdlFunction> getFunctions(final FullQualifiedName functionName) throws ODataException {
  if (functionName.equals(nameUFNRTInt16)) {
    return Collections.singletonList(
        new CsdlFunction()
        .setName("UFNRTInt16")
        .setParameters(Collections.<CsdlParameter> emptyList())
        .setReturnType(new CsdlReturnType().setType(nameInt16)));
  } else if (functionName.equals(nameUFNRTETAllPrim)) {
    return Collections.singletonList(
        new CsdlFunction()
        .setName("UFNRTETAllPrim")
        .setParameters(Collections.<CsdlParameter> emptyList())
        .setReturnType(new CsdlReturnType().setType(nameETAbstractBase)));
  }
  return null;
}
 
Example 2
Source File: ProductsEdmProvider.java    From syndesis with Apache License 2.0 6 votes vote down vote up
@Override
public CsdlEnumType getEnumType(FullQualifiedName enumTypeName) {
    if (enumTypeName.equals(ET_POWER_TYPE_FQN)) {
        CsdlEnumMember twoForty = new CsdlEnumMember();
        twoForty.setName("240V");
        twoForty.setValue("0");

        CsdlEnumMember oneTen = new CsdlEnumMember();
        oneTen.setName("110V");
        oneTen.setValue("1");

        CsdlEnumType powerTypeEnum = new CsdlEnumType();
        powerTypeEnum.setName(ET_POWER_TYPE_NAME);
        powerTypeEnum.setMembers(Arrays.asList(twoForty, oneTen));
        return powerTypeEnum;
    }

    return null;
}
 
Example 3
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Override
public List<CsdlAction> getActions(final FullQualifiedName actionName) {
   if(actionName.equals(ACTION_RESET_FQN)) {
     // It is allowed to overload actions, so we have to provide a list of Actions for each action name
     final List<CsdlAction> actions = new ArrayList<CsdlAction>();
     
     // Create parameters
     final List<CsdlParameter> parameters = new ArrayList<CsdlParameter>();
     final CsdlParameter parameter = new CsdlParameter();
     parameter.setName(PARAMETER_AMOUNT);
     parameter.setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
     parameters.add(parameter);
     
     // Create the Csdl Action
     final CsdlAction action = new CsdlAction();
     action.setName(ACTION_RESET_FQN.getName());
     action.setParameters(parameters);
     actions.add(action);
     
     return actions;
   }
   
   return null;
 }
 
Example 4
Source File: ObservationCsdlEdmProvider.java    From arctic-sea with Apache License 2.0 6 votes vote down vote up
@Override
public CsdlComplexType getComplexType(FullQualifiedName name) throws ODataException {
    if (name.equals(FQN.ABSTRACT_TIME_OBJECT)) {
        return newAbstractComplexType(FQN.ABSTRACT_TIME_OBJECT);
    } else if (name.equals(FQN.TIME_INSTANT)) {
        return newComplexType(FQN.TIME_INSTANT, FQN.ABSTRACT_TIME_OBJECT);
    } else if (name.equals(FQN.TIME_PERIOD)) {
        return newComplexType(FQN.TIME_PERIOD,
                              FQN.ABSTRACT_TIME_OBJECT,
                              newProperty(Prop.EN_BEGIN_POSITION, FQN.DATE_TIME),
                              newProperty(Prop.EN_END_POSITION, FQN.DATE_TIME));
    } else if (name.equals(FQN.FEATURE_OF_INTEREST)) {
        return newComplexType(FQN.FEATURE_OF_INTEREST,
                              newProperty(Prop.ID, FQN.STRING),
                              newProperty(Prop.SHAPE, FQN.GEOMETRY_POINT));
    } else if (name.equals(FQN.RESULT)) {
        return newAbstractComplexType(FQN.RESULT);
    } else {
        return super.getComplexType(name);
    }
}
 
Example 5
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Override
public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) {

  // this method is called for one of the EntityTypes that are configured in the Schema
  if(entityTypeName.equals(ET_PRODUCT_FQN)){

    //create EntityType properties
    CsdlProperty id = new CsdlProperty().setName("ID").setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
    CsdlProperty name = new CsdlProperty().setName("Name").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
    CsdlProperty  description = new CsdlProperty().setName("Description").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());

    // create CsdlPropertyRef for Key element
    CsdlPropertyRef propertyRef = new CsdlPropertyRef();
    propertyRef.setName("ID");

    // configure EntityType
    CsdlEntityType entityType = new CsdlEntityType();
    entityType.setName(ET_PRODUCT_NAME);
    entityType.setProperties(Arrays.asList(id, name , description));
    entityType.setKey(Collections.singletonList(propertyRef));

    return entityType;
  }

  return null;
}
 
Example 6
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainerName) {

  // This method is invoked when displaying the service document at
  // e.g. http://localhost:8080/DemoService/DemoService.svc
  if (entityContainerName == null || entityContainerName.equals(CONTAINER)) {
    CsdlEntityContainerInfo entityContainerInfo = new CsdlEntityContainerInfo();
    entityContainerInfo.setContainerName(CONTAINER);
    return entityContainerInfo;
  }
  return null;
}
 
Example 7
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainerName) {

  // This method is invoked when displaying the service document at
  // e.g. http://localhost:8080/DemoService/DemoService.svc
  if (entityContainerName == null || entityContainerName.equals(CONTAINER)) {
    CsdlEntityContainerInfo entityContainerInfo = new CsdlEntityContainerInfo();
    entityContainerInfo.setContainerName(CONTAINER);
    return entityContainerInfo;
  }

  return null;
}
 
Example 8
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) {
  // this method is called for one of the EntityTypes that are configured in the Schema
  if(entityTypeName.equals(ET_PRODUCT_FQN)){

    //create EntityType properties
    CsdlProperty id = new CsdlProperty().setName("ID")
            .setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
    CsdlProperty name = new CsdlProperty().setName("Name")
            .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
    CsdlProperty  description = new CsdlProperty().setName("Description")
            .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());

    // create CsdlPropertyRef for Key element
    CsdlPropertyRef propertyRef = new CsdlPropertyRef();
    propertyRef.setName("ID");

    // configure EntityType
    CsdlEntityType entityType = new CsdlEntityType();
    entityType.setName(ET_PRODUCT_NAME);
    entityType.setProperties(Arrays.asList(id, name, description));
    entityType.setKey(Collections.singletonList(propertyRef));

    return entityType;
  }

  return null;

}
 
Example 9
Source File: EdmProviderImpl.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public EdmAction createBoundAction(final FullQualifiedName actionName,
    final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection) {

  try {
    List<CsdlAction> actions = actionsMap.get(actionName);
    if (actions == null) {
      actions = provider.getActions(actionName);
      if (actions == null) {
        return null;
      } else {
        actionsMap.put(actionName, actions);
      }
    }
    // Search for bound action where binding parameter matches
    for (CsdlAction action : actions) {
      if (action.isBound()) {
        final List<CsdlParameter> parameters = action.getParameters();
        final CsdlParameter parameter = parameters.get(0);
        if ((bindingParameterTypeName.equals(parameter.getTypeFQN()) || 
            isEntityPreviousTypeCompatibleToBindingParam(bindingParameterTypeName, parameter) ||
            isComplexPreviousTypeCompatibleToBindingParam(bindingParameterTypeName, parameter, 
                isBindingParameterCollection))
            && isBindingParameterCollection.booleanValue() == parameter.isCollection()) {
          addOperationsAnnotations(action, actionName);
          return new EdmActionImpl(this, actionName, action);
        }

      }
    }
    return null;
  } catch (ODataException e) {
    throw new EdmException(e);
  }
}
 
Example 10
Source File: ContainerProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
public CsdlSingleton getSingleton(final FullQualifiedName entityContainer, final String name) throws ODataException {
  if (entityContainer.equals(nameContainer)) {

    if (name.equals("SI")) {
      return new CsdlSingleton()
          .setName("SI")
          .setTitle("Simple Singleton")
          .setType(EntityTypeProvider.nameETTwoPrim);

    } else if (name.equals("SINav")) {
      return new CsdlSingleton()
          .setName("SINav")
          .setType(EntityTypeProvider.nameETTwoKeyNav)
          .setNavigationPropertyBindings(Arrays.asList(
              new CsdlNavigationPropertyBinding()
                  .setPath("NavPropertyETTwoKeyNavMany")
                  .setTarget("ESTwoKeyNav"),
              new CsdlNavigationPropertyBinding()
                  .setPath("NavPropertyETTwoKeyNavOne")
                  .setTarget("ESTwoKeyNav"),
              new CsdlNavigationPropertyBinding()
                  .setPath("NavPropertyETKeyNavOne")
                  .setTarget("ESKeyNav")));

    } else if (name.equals("SIMedia")) {
      return new CsdlSingleton()
          .setName("SIMedia")
          .setType(EntityTypeProvider.nameETMedia);
    }
  }
  return null;
}
 
Example 11
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlActionImport getActionImport(final FullQualifiedName entityContainer, final String actionImportName) {
  if(entityContainer.equals(CONTAINER)) {
    if(actionImportName.equals(ACTION_RESET_FQN.getName())) {
      return new CsdlActionImport()
          .setName(actionImportName)
          .setAction(ACTION_RESET_FQN);
    }
  }
  
  return null;
}
 
Example 12
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainerName) {

  // This method is invoked when displaying the service document at
  // e.g. http://localhost:8080/DemoService/DemoService.svc
  if (entityContainerName == null || entityContainerName.equals(CONTAINER)) {
    CsdlEntityContainerInfo entityContainerInfo = new CsdlEntityContainerInfo();
    entityContainerInfo.setContainerName(CONTAINER);
    return entityContainerInfo;
  }

  return null;
}
 
Example 13
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainerName) {
  // This method is invoked when displaying the service document at 
  // e.g. http://localhost:8080/DemoService/DemoService.svc
  if(entityContainerName == null || entityContainerName.equals(CONTAINER)){
    CsdlEntityContainerInfo entityContainerInfo = new CsdlEntityContainerInfo();
    entityContainerInfo.setContainerName(CONTAINER);
    return entityContainerInfo;
  }

  return null;

}
 
Example 14
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlFunctionImport getFunctionImport(FullQualifiedName entityContainer, String functionImportName) {
  if(entityContainer.equals(CONTAINER)) {
    if(functionImportName.equals(FUNCTION_COUNT_CATEGORIES_FQN.getName())) {
      return new CsdlFunctionImport()
                    .setName(functionImportName)
                    .setFunction(FUNCTION_COUNT_CATEGORIES_FQN)
                    .setEntitySet(ES_CATEGORIES_NAME)
                    .setIncludeInServiceDocument(true);
    }
  }
  
  return null;
}
 
Example 15
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainerName) {
  // This method is invoked when displaying the service document 
  // at e.g. http://localhost:8080/DemoService/DemoService.svc
  if(entityContainerName == null || entityContainerName.equals(CONTAINER)){
    CsdlEntityContainerInfo entityContainerInfo = new CsdlEntityContainerInfo();
    entityContainerInfo.setContainerName(CONTAINER);
    return entityContainerInfo;
  }

  return null;

}
 
Example 16
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainerName) {

  // This method is invoked when displaying the service document at
  // e.g. http://localhost:8080/DemoService/DemoService.svc
  if (entityContainerName == null || entityContainerName.equals(CONTAINER)) {
    CsdlEntityContainerInfo entityContainerInfo = new CsdlEntityContainerInfo();
    entityContainerInfo.setContainerName(CONTAINER);
    return entityContainerInfo;
  }

  return null;
}
 
Example 17
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainerName) {
  // This method is invoked when displaying the service document at
  // e.g. http://localhost:8080/DemoService/DemoService.svc
  if (entityContainerName == null || entityContainerName.equals(CONTAINER)) {
    CsdlEntityContainerInfo entityContainerInfo = new CsdlEntityContainerInfo();
    entityContainerInfo.setContainerName(CONTAINER);
    return entityContainerInfo;
  }

  return null;

}
 
Example 18
Source File: DemoEdmProvider.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlActionImport getActionImport(final FullQualifiedName entityContainer, final String actionImportName) {
  if(entityContainer.equals(CONTAINER)) {
    if(actionImportName.equals(ACTION_RESET_FQN.getName())) {
      return new CsdlActionImport()
          .setName(actionImportName)
          .setAction(ACTION_RESET_FQN);
    }
  }
  
  return null;
}
 
Example 19
Source File: ProductsEdmProvider.java    From syndesis with Apache License 2.0 5 votes vote down vote up
@Override
public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) {
    // this method is called for one of the EntityTypes that are configured in the Schema
    if (entityTypeName.equals(ET_PRODUCT_FQN)) {

        //create EntityType properties
        CsdlProperty id = new CsdlProperty().setName(PRODUCT_ID).setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
        CsdlProperty name = new CsdlProperty().setName(PRODUCT_NAME).setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
        CsdlProperty description = new CsdlProperty().setName(PRODUCT_DESCRIPTION).setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
        CsdlProperty serialNums = new CsdlProperty()
            .setName(PRODUCT_SERIALS)
            .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName())
            .setCollection(true);
        CsdlProperty specification = new CsdlProperty()
            .setName(PRODUCT_SPEC)
            .setType(ET_SPEC_FQN);

        // create CsdlPropertyRef for Key element
        CsdlPropertyRef propertyRef = new CsdlPropertyRef();
        propertyRef.setName(PRODUCT_ID);

        // configure EntityType
        CsdlEntityType entityType = new CsdlEntityType();
        entityType.setName(ET_PRODUCT_NAME);
        entityType.setProperties(Arrays.asList(id, name, description, serialNums, specification));
        entityType.setKey(Collections.singletonList(propertyRef));

        return entityType;
    }

    return null;
}
 
Example 20
Source File: MetadataDocumentJsonSerializerTest.java    From olingo-odata4 with Apache License 2.0 4 votes vote down vote up
@Override
public List<CsdlAction> getActions(final FullQualifiedName actionName) throws ODataException {
  if (actionName.equals(nameUARTPrimParam)) {
    return Collections.singletonList(
        new CsdlAction().setName("UARTPrimParam")
        .setParameters(Collections.singletonList(
            new CsdlParameter().setName("ParameterInt16").setType(nameInt16)))
            .setReturnType(new CsdlReturnType().setType(nameString)));
  }
  if (actionName.equals(nameBAETTwoKeyNavRTETTwoKeyNavParam)) {
    return Arrays.asList(
        new CsdlAction().setName("BAETTwoKeyNavRTETTwoKeyNavParam")
        .setParameters(Arrays.asList(
            new CsdlParameter().setName("BindingParam").setType(nameETTwoKeyNav),
            new CsdlParameter().setName("PropertyComp").setType(nameCTPrimComp)))
        .setReturnType(new CsdlReturnType().setType(nameETTwoKeyNav).setCollection(true))
        .setEntitySetPath("BindingParam/NavPropertyETTwoKeyNavOne")
        .setBound(true),
        new CsdlAction().setName("BAETTwoKeyNavRTETTwoKeyNavParam")
        .setParameters(Arrays.asList(
            new CsdlParameter().setName("BindingParam").setType(nameET)))
        .setReturnType(new CsdlReturnType().setNullable(false).setType(nameET))
        .setBound(true)
        .setEntitySetPath("BindingParam/NavPropertyET"),
        new CsdlAction().setName("BAETTwoKeyNavRTETTwoKeyNavParam")
        .setParameters(Arrays.asList(
            new CsdlParameter().setName("PropertyComp").setType(nameCTPrimComp)))
        .setReturnType(new CsdlReturnType().setNullable(false).setType(nameET)));
  }
  if (actionName.equals(nameBAProp)) {
    return Collections.singletonList(new CsdlAction().setName("BAProp")
    .setParameters(Arrays.asList(
        new CsdlParameter().setName("BindingParam").setType(nameET),
        new CsdlParameter().setName("PropertyInt").setType(nameInt16).
        setPrecision(10).setScale(3).setMaxLength(10).setNullable(false).setCollection(true)))
    .setReturnType(new CsdlReturnType().setNullable(true).setType(nameInt16)
        .setPrecision(10).setScale(3).setMaxLength(10))
    .setBound(true)
    .setEntitySetPath("BindingParam/NavPropertyET"));
  }
  return null;
}