Java Code Examples for org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.ReturnType.Type#COMPLEX

The following examples show how to use org.apache.olingo.odata2.api.annotation.edm.EdmFunctionImport.ReturnType.Type#COMPLEX . 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: UserService.java    From cloud-sfsf-benefits-ext with Apache License 2.0 6 votes vote down vote up
@EdmFunctionImport(name = FunctionImportNames.USER_INFO, entitySet = FunctionImportNames.USER_INFO, returnType = @ReturnType(type = Type.COMPLEX, isCollection = true))
public List<UserInfo> getInfoProfile() throws AppODataException {
	User currentUser = getLoggedInSfUser();
	UserInfo userInfo = new UserInfo();
	UserInfo hrInfo = new UserInfo();
	List<UserInfo> users = new ArrayList<>();

	try {
		userInfo = ECAPIConnector.getInstance().getUserInfoProfile(currentUser.getUserId());
		users.add(userInfo);
		if (currentUser.getHrManager() != null) {
			hrInfo = ECAPIConnector.getInstance().getUserInfoProfile(currentUser.getHrManager().getUserId());
			users.add(hrInfo);
		}
	} catch (IOException | InvalidResponseException ex) {
		throw new AppODataException("Cannot get information about the user", ex); //$NON-NLS-1$
	}

	return users;
}
 
Example 2
Source File: SalesOrderHeaderProcessor.java    From olingo-odata2 with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@EdmFunctionImport(returnType = @ReturnType(type = Type.COMPLEX))
public Address getAddress(
    @EdmFunctionImportParameter(name = "SoID", facets = @EdmFacets(nullable = false)) final Long soID) {
  Query q = em
      .createQuery("SELECT E1 from SalesOrderHeader E1 WHERE E1.soId = "
          + soID + "l");
  List<SalesOrderHeader> soList = (List<SalesOrderHeader>) q
      .getResultList();
  if (!soList.isEmpty()) {
    return soList.get(0).getCustomer().getAddress();
  } else {
    return null;
  }
}
 
Example 3
Source File: AdministrationService.java    From cloud-sfsf-benefits-ext with Apache License 2.0 5 votes vote down vote up
@EdmFunctionImport(name = UI_CONFIG, returnType = @ReturnType(type = Type.COMPLEX, isCollection = false), httpMethod = HttpMethod.GET)
public UIConfig getUIConfigurationData() {
	final UIConfig config = new UIConfig();
	if (UserManager.getIsUserAdmin()) {
		config.initAdminConfiguration();
	} else {
		config.initEmployeeConfiguration();
	}

	return config;
}
 
Example 4
Source File: JPACustomProcessorNegativeMock.java    From olingo-odata2 with Apache License 2.0 4 votes vote down vote up
@EdmFunctionImport(returnType = @ReturnType(type = Type.COMPLEX))
public JPACustomProcessorNegativeMock method11() {
  return null;
}
 
Example 5
Source File: JPACustomProcessorNegativeMock.java    From olingo-odata2 with Apache License 2.0 4 votes vote down vote up
@EdmFunctionImport(returnType = @ReturnType(type = Type.COMPLEX))
public void method17(@EdmFunctionImportParameter(name = "") final int y) {
  return;
}
 
Example 6
Source File: JPACustomProcessorMock.java    From olingo-odata2 with Apache License 2.0 4 votes vote down vote up
@EdmFunctionImport(returnType = @ReturnType(type = Type.COMPLEX,
    isCollection = false))
public JPACustomProcessorMock method9() {
  return null;
}
 
Example 7
Source File: JPACustomProcessorMock.java    From olingo-odata2 with Apache License 2.0 4 votes vote down vote up
@EdmFunctionImport(returnType = @ReturnType(type = Type.COMPLEX,
    isCollection = true))
public List<JPACustomProcessorMock> method10() {
  return null;
}
 
Example 8
Source File: JPACustomProcessorMock.java    From olingo-odata2 with Apache License 2.0 4 votes vote down vote up
@EdmFunctionImport(returnType = @ReturnType(type = Type.COMPLEX,
    isCollection = false))
public JPANonComplexTestMock method18() {
  return null;
}
 
Example 9
Source File: BenefitAmountService.java    From cloud-sfsf-benefits-ext with Apache License 2.0 4 votes vote down vote up
@EdmFunctionImport(name = FunctionImportNames.BENEFIT_AMOUNT, returnType = @ReturnType(type = Type.COMPLEX))
public BenefitsAmount obtainUserBenefitsAmount(@EdmFunctionImportParameter(name = USER_ID, type = EdmType.STRING) String userId) {
	return odataConnector.getUserBenefitsAmount(userId);
}