org.apache.olingo.odata2.api.edm.EdmTargetPath Java Examples

The following examples show how to use org.apache.olingo.odata2.api.edm.EdmTargetPath. 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: ItemEntitySet.java    From DataHubSystem with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public EntityType getEntityType ()
{
   List<Property> properties = new ArrayList<Property> ();
   properties.add (new SimpleProperty ().setName (ID)
      .setType (EdmSimpleTypeKind.String)
      .setFacets (new Facets ().setNullable (false)));
   properties.add (new SimpleProperty ()
      .setName (NAME)
      .setType (EdmSimpleTypeKind.String)
      .setCustomizableFeedMappings (
         new CustomizableFeedMappings ()
            .setFcTargetPath (EdmTargetPath.SYNDICATION_TITLE)));
   properties.add (new SimpleProperty ().setName (CONTENT_TYPE).setType (
      EdmSimpleTypeKind.String));
   properties.add (new SimpleProperty ().setName (CONTENT_LENGTH).setType (
      EdmSimpleTypeKind.Int64));

   // Key
   Key key =
      new Key ().setKeys (Collections.singletonList (new PropertyRef ()
         .setName (ID)));

   // TODO (OData v3) setOpenType(true) setAbstract(true)
   return new EntityType ().setName (ENTITY_NAME).setProperties (properties)
      .setKey (key);
}
 
Example #2
Source File: NetworkEntitySet.java    From DataHubSystem with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public EntityType getEntityType ()
{
   // Properties
   List<Property> properties = new ArrayList<Property> ();

   properties.add (new SimpleProperty ()
   .setName (ID)
   .setType (EdmSimpleTypeKind.Int64)
   .setFacets (new Facets ().setNullable (false))
   .setCustomizableFeedMappings (
      new CustomizableFeedMappings ()
         .setFcTargetPath (EdmTargetPath.SYNDICATION_TITLE)));

   // Key
   Key key =
      new Key ().setKeys (Collections.singletonList (new PropertyRef ()
         .setName (ID)));

   // Navigation Properties
   List<NavigationProperty> navigationProperties =
      new ArrayList<NavigationProperty> ();

   if (Security.currentUserHasRole(Role.STATISTICS))
   {
      navigationProperties.add (new NavigationProperty ()
         .setName ("NetworkStatistic")
         .setRelationship (ASSO_NETWORK_NETWORKSTATISTIC)
         .setFromRole (ROLE_NETWORKSTATISTIC_NETWORK)
         .setToRole (ROLE_NETWORK_NETWORKSTATISTIC));
   }

   return new EntityType ().setName (ENTITY_NAME).setProperties (properties)
      .setKey (key).setNavigationProperties (navigationProperties);
}
 
Example #3
Source File: RestrictionEntitySet.java    From DataHubSystem with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public EntityType getEntityType ()
{
   List<Property> properties = new ArrayList<> ();

   SimpleProperty uuid = new SimpleProperty ();
   uuid.setName (UUID);
   uuid.setType (EdmSimpleTypeKind.String);
   uuid.setFacets (new Facets ().setNullable (false));
   uuid.setCustomizableFeedMappings (new CustomizableFeedMappings ()
         .setFcTargetPath (EdmTargetPath.SYNDICATION_TITLE));
   properties.add (uuid);

   SimpleProperty restriction_type = new SimpleProperty ();
   restriction_type.setName (RESTRICTION_TYPE);
   restriction_type.setType (EdmSimpleTypeKind.String);
   restriction_type.setFacets (new Facets ().setNullable (false));
   properties.add (restriction_type);

   SimpleProperty reason = new SimpleProperty ();
   reason.setName (REASON);
   reason.setType (EdmSimpleTypeKind.String);
   reason.setFacets (new Facets ().setNullable (false));
   properties.add (reason);

   Key key = new Key ();
   List<PropertyRef> propertyRefs = Collections.singletonList (
         new PropertyRef ().setName (UUID));
   key.setKeys (propertyRefs);

   EntityType entityType = new EntityType ();
   entityType.setName (ENTITY_NAME);
   entityType.setProperties (properties);
   entityType.setKey (key);

   return entityType;
}
 
Example #4
Source File: NetworkStatisticEntitySet.java    From DataHubSystem with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public EntityType getEntityType ()
{
   // Properties
   List<Property> properties = new ArrayList<Property> ();

   properties.add (new SimpleProperty ()
   .setName (ID)
   .setType (EdmSimpleTypeKind.Int64)
   .setFacets (new Facets ().setNullable (false))
   .setCustomizableFeedMappings (
      new CustomizableFeedMappings ()
         .setFcTargetPath (EdmTargetPath.SYNDICATION_TITLE)));

   properties.add (new SimpleProperty ()
      .setName (ACTIVITYPERIOD)
      .setType (EdmSimpleTypeKind.Int64));

   properties.add (new SimpleProperty ()
      .setName (CONNECTIONNUMBER)
      .setType (EdmSimpleTypeKind.Int64));
   // Key
   Key key =
      new Key ().setKeys (Collections.singletonList (new PropertyRef ()
         .setName (ID)));

   return new EntityType ().setName (ENTITY_NAME).setProperties (properties)
      .setKey (key);
}
 
Example #5
Source File: CollectionEntitySet.java    From DataHubSystem with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public EntityType getEntityType ()
{
   List<Property> properties = new ArrayList<>();
   properties.add (new SimpleProperty ()
      .setName (NAME)
      .setType (EdmSimpleTypeKind.String)
      .setFacets (new Facets ().setNullable (false))
      .setCustomizableFeedMappings (
         new CustomizableFeedMappings ()
            .setFcTargetPath (EdmTargetPath.SYNDICATION_TITLE)));
   properties.add (new SimpleProperty ().setName (DESCRIPTION).setType (
      EdmSimpleTypeKind.String));

   // Navigation Properties
   List<NavigationProperty> navigationProperties =
      Collections.singletonList(new NavigationProperty()
         .setName(Model.PRODUCT.getName())
         .setRelationship(ASSO_COLLECTION_PRODUCT)
         .setFromRole(ROLE_PRODUCT_COLLECTIONS)
         .setToRole(ROLE_COLLECTION_PRODUCTS));

   // Key
   Key key =
      new Key ().setKeys (Collections.singletonList (new PropertyRef ()
         .setName (NAME)));

   return new EntityType ().setName (ENTITY_NAME).setProperties (properties)
      .setKey (key).setNavigationProperties (navigationProperties);
}
 
Example #6
Source File: ClassEntitySet.java    From DataHubSystem with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public EntityType getEntityType ()
{
   List<Property> properties = new ArrayList<Property> ();
   properties.add (new SimpleProperty ()
   .setName (ID)
   .setType (EdmSimpleTypeKind.String)
   .setFacets (new Facets ().setNullable (false))
   .setCustomizableFeedMappings (
      new CustomizableFeedMappings ()
         .setFcTargetPath (EdmTargetPath.SYNDICATION_TITLE)));
   
   properties.add (new SimpleProperty ().setName (URI).setType (
      EdmSimpleTypeKind.String));
  
   // Navigation Properties
   List<NavigationProperty> navigationProperties =
      new ArrayList<NavigationProperty> ();
   // TODO (OData v3) setContainsTarget(true)
   navigationProperties.add (new NavigationProperty ().setName (getName ())
      .setRelationship (ASSO_CLASS_CLASS).setFromRole (ROLE_CLASS_PARENT)
      .setToRole (ROLE_CLASS_CLASSES));

   // Key
   Key key =
      new Key ().setKeys (Collections.singletonList (new PropertyRef ()
         .setName (ID)));

   return new EntityType ().setName (ENTITY_NAME).setProperties (properties)
      .setKey (key).setNavigationProperties (navigationProperties);
}
 
Example #7
Source File: SystemRoleEntitySet.java    From DataHubSystem with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public EntityType getEntityType ()
{
   Key key = new Key ();
   List<PropertyRef> property_refs =
         Collections.singletonList (new PropertyRef ().setName (NAME));
   key.setKeys (property_refs);

   SimpleProperty name = new SimpleProperty ();
   name.setName (NAME);
   name.setType (EdmSimpleTypeKind.String);
   name.setFacets (new Facets ().setNullable (false));
   name.setCustomizableFeedMappings (new CustomizableFeedMappings ()
         .setFcTargetPath (EdmTargetPath.SYNDICATION_TITLE));

   SimpleProperty description = new SimpleProperty ();
   description.setName (DESCRIPTION);
   description.setType (EdmSimpleTypeKind.String);
   description.setFacets (new Facets ().setNullable (false));

   List<Property> properties = new ArrayList<> ();
   properties.add (name);
   properties.add (description);

   EntityType entityType = new EntityType ();
   entityType.setName (ENTITY_NAME);
   entityType.setProperties (properties);
   entityType.setKey (key);

   return entityType;
}
 
Example #8
Source File: TombstoneProducer.java    From olingo-odata2 with Apache License 2.0 5 votes vote down vote up
private void appendWhenAttribute(final XMLStreamWriter writer, final EntityInfoAggregator eia,
    final Map<String, Object> deletedEntry) throws XMLStreamException, EdmSimpleTypeException {
  Object updateDate = null;
  EntityPropertyInfo updatedInfo = eia.getTargetPathInfo(EdmTargetPath.SYNDICATION_UPDATED);
  if (updatedInfo != null) {
    updateDate = deletedEntry.get(updatedInfo.getName());
  }

  if (updateDate == null) {
    appendDefaultWhenAttribute(writer);
  } else {
    appendCustomWhenAttribute(writer, updateDate, updatedInfo);
  }
}
 
Example #9
Source File: AtomEntryProducerTest.java    From olingo-odata2 with Apache License 2.0 5 votes vote down vote up
@Test
public void serializeEmployeeAndCheckKeepInContentFalse() throws IOException, XpathException, SAXException,
    XMLStreamException, FactoryConfigurationError, ODataException {
  AtomEntityProvider ser = createAtomEntityProvider();
  EntityProviderWriteProperties properties =
      EntityProviderWriteProperties.serviceRoot(BASE_URI).build();
  EdmEntitySet employeeEntitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");

  // set "keepInContent" to false for EntryDate
  EdmCustomizableFeedMappings employeeUpdatedMappings = mock(EdmCustomizableFeedMappings.class);
  when(employeeUpdatedMappings.getFcTargetPath()).thenReturn(EdmTargetPath.SYNDICATION_UPDATED);
  when(employeeUpdatedMappings.isFcKeepInContent()).thenReturn(Boolean.FALSE);
  EdmTyped employeeEntryDateProperty = employeeEntitySet.getEntityType().getProperty("EntryDate");
  when(((EdmProperty) employeeEntryDateProperty).getCustomizableFeedMappings()).thenReturn(employeeUpdatedMappings);

  ODataResponse response = ser.writeEntry(employeeEntitySet, employeeData, properties);
  String xmlString = verifyResponse(response);

  assertXpathExists("/a:entry", xmlString);
  assertXpathExists("/a:entry/a:content", xmlString);
  // verify properties
  assertXpathExists("/a:entry/m:properties", xmlString);
  assertXpathEvaluatesTo("8", "count(/a:entry/m:properties/*)", xmlString);
  //
  assertXpathNotExists("/a:entry/m:properties/d:EntryDate", xmlString);

  // verify order of tags
  List<String> expectedPropertyNamesFromEdm =
      new ArrayList<String>(employeeEntitySet.getEntityType().getPropertyNames());
  expectedPropertyNamesFromEdm.remove(String.valueOf("EntryDate"));
  verifyTagOrdering(xmlString, expectedPropertyNamesFromEdm.toArray(new String[0]));
}
 
Example #10
Source File: AtomEntrySerializerTest.java    From olingo-odata2 with Apache License 2.0 5 votes vote down vote up
@Test
public void serializeEmployeeAndCheckKeepInContentFalse() throws IOException, XpathException, SAXException,
    XMLStreamException, FactoryConfigurationError, ODataException {
  AtomSerializerDeserializer ser = createAtomEntityProvider();
  EntitySerializerProperties properties =
      EntitySerializerProperties.serviceRoot(BASE_URI).includeMetadata(true).build();
  EdmEntitySet employeeEntitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");

  // set "keepInContent" to false for EntryDate
  EdmCustomizableFeedMappings employeeUpdatedMappings = mock(EdmCustomizableFeedMappings.class);
  when(employeeUpdatedMappings.getFcTargetPath()).thenReturn(EdmTargetPath.SYNDICATION_UPDATED);
  when(employeeUpdatedMappings.isFcKeepInContent()).thenReturn(Boolean.FALSE);
  EdmTyped employeeEntryDateProperty = employeeEntitySet.getEntityType().getProperty("EntryDate");
  when(((EdmProperty) employeeEntryDateProperty).getCustomizableFeedMappings()).thenReturn(employeeUpdatedMappings);
  employeeData.setWriteProperties(properties);
  ODataResponse response = ser.writeEntry(employeeEntitySet, employeeData);
  String xmlString = verifyResponse(response);

  assertXpathExists("/a:entry", xmlString);
  assertXpathExists("/a:entry/a:content", xmlString);
  // verify properties
  assertXpathExists("/a:entry/m:properties", xmlString);
  assertXpathEvaluatesTo("7", "count(/a:entry/m:properties/*)", xmlString);
  //
  assertXpathNotExists("/a:entry/m:properties/d:EntryDate", xmlString);

  // verify order of tags
  List<String> expectedPropertyNamesFromEdm =
      new ArrayList<String>(employeeEntitySet.getEntityType().getPropertyNames());
  expectedPropertyNamesFromEdm.remove(String.valueOf("EntryDate"));
  expectedPropertyNamesFromEdm.remove(String.valueOf("ImageUrl"));
  verifyTagOrdering(xmlString, expectedPropertyNamesFromEdm.toArray(new String[0]));
}
 
Example #11
Source File: UserEntitySet.java    From DataHubSystem with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public EntityType getEntityType ()
{
   // Properties
   List<Property> properties = new ArrayList<Property> ();

   properties.add (new SimpleProperty ()
      .setName (USERNAME)
      .setType (EdmSimpleTypeKind.String)
      .setFacets (new Facets ().setNullable (false))
      .setCustomizableFeedMappings (
         new CustomizableFeedMappings ()
            .setFcTargetPath (EdmTargetPath.SYNDICATION_TITLE)));

   properties.add (new SimpleProperty ().setName (EMAIL).setType (
      EdmSimpleTypeKind.String));
   properties.add (new SimpleProperty ().setName (FIRSTNAME).setType (
      EdmSimpleTypeKind.String));
   properties.add (new SimpleProperty ().setName (LASTNAME).setType (
      EdmSimpleTypeKind.String));
   properties.add (new SimpleProperty ().setName (COUNTRY).setType (
      EdmSimpleTypeKind.String));
   properties.add (new SimpleProperty ().setName (PHONE).setType (
      EdmSimpleTypeKind.String));
   properties.add (new SimpleProperty ().setName (ADDRESS).setType (
      EdmSimpleTypeKind.String));
   properties.add (new SimpleProperty ().setName (DOMAIN).setType (
      EdmSimpleTypeKind.String));
   properties.add (new SimpleProperty ().setName (SUBDOMAIN).setType (
      EdmSimpleTypeKind.String));
   properties.add (new SimpleProperty ().setName (USAGE).setType (
      EdmSimpleTypeKind.String));
   properties.add (new SimpleProperty ().setName (SUBUSAGE).setType (
      EdmSimpleTypeKind.String));
   properties.add(new SimpleProperty().setName(HASH)
         .setType(EdmSimpleTypeKind.String));
   properties.add(new SimpleProperty().setName(PASSWORD)
         .setType(EdmSimpleTypeKind.String));
   properties.add(new SimpleProperty().setName(CREATED)
         .setType(EdmSimpleTypeKind.DateTime)
         .setCustomizableFeedMappings(new CustomizableFeedMappings()
               .setFcTargetPath(EdmTargetPath.SYNDICATION_UPDATED)));

   // Navigation Properties
   List<NavigationProperty> navigationProperties =
      new ArrayList<NavigationProperty> ();

   if (Security.currentUserHasRole(Role.SYSTEM_MANAGER, Role.STATISTICS))
   {
      navigationProperties.add (new NavigationProperty ()
         .setName(Model.CONNECTION.getName())
         .setRelationship(ASSO_USER_CONNECTION)
         .setFromRole(ROLE_CONNECTION_USER)
         .setToRole(ROLE_USER_CONNECTIONS));
   }

   // navigate to user restrictions
   navigationProperties.add (new NavigationProperty ()
         .setName(Model.RESTRICTION.getName())
         .setRelationship (ASSO_USER_RESTRICTION)
         .setFromRole (ROLE_RESTRICTION_USER)
         .setToRole (ROLE_USER_RESTRICTIONS));

   // navigate to user roles
   navigationProperties.add (new NavigationProperty ()
         .setName(Model.SYSTEM_ROLE.getName())
         .setRelationship (ASSO_USER_SYSTEMROLE)
         .setFromRole (ROLE_SYSTEMROLE_USER)
         .setToRole (ROLE_USER_SYSTEMROLES));

   // navigate to Products (user cart)
   navigationProperties.add(new NavigationProperty()
         .setName(CART)
         .setRelationship(ASSO_USER_PRODUCT)
         .setFromRole(ROLE_PRODUCTS_USER)
         .setToRole(ROLE_USER_PRODUCTS));

   // Key
   Key key =
      new Key ().setKeys (Collections.singletonList (new PropertyRef ()
         .setName (USERNAME)));

   return new EntityType ().setName (ENTITY_NAME).setProperties (properties)
      .setKey (key).setNavigationProperties (navigationProperties);
}
 
Example #12
Source File: ProductEntitySet.java    From DataHubSystem with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public EntityType getEntityType ()
{
   EntityType res = Model.NODE.getEntityType();

   // Properties
   List<Property> properties = res.getProperties ();

   properties.add (new SimpleProperty ().setName (CREATION_DATE)
      .setType (EdmSimpleTypeKind.DateTime)
      .setFacets (new Facets ().setNullable (false)));
   properties.add (new SimpleProperty ()
      .setName (INGESTION_DATE)
      .setType (EdmSimpleTypeKind.DateTime)
      .setCustomizableFeedMappings (
         new CustomizableFeedMappings ()
            .setFcTargetPath (EdmTargetPath.SYNDICATION_UPDATED)));
   properties.add (new SimpleProperty ().setName (EVICTION_DATE).setType (
      EdmSimpleTypeKind.DateTime));
   properties.add(new ComplexProperty().setName(CONTENT_DATE).setType(Model.TIME_RANGE));
   properties.add(new ComplexProperty().setName(CHECKSUM).setType(Model.CHECKSUM));
   properties.add (new SimpleProperty ().setName (CONTENT_GEOMETRY).setType (
      EdmSimpleTypeKind.String));
   properties.add (new SimpleProperty ().setName (METALINK).setType (
      EdmSimpleTypeKind.String));

   if (Security.currentUserHasRole(Role.ARCHIVE_MANAGER))
   {
      properties.add (new SimpleProperty ().setName (LOCAL_PATH).setType (
         EdmSimpleTypeKind.String));
   }

   // Navigation Properties
   List<NavigationProperty> navigationProperties =
      new ArrayList<NavigationProperty> ();

   navigationProperties.add (new NavigationProperty ().setName (getName ())
      .setRelationship (ASSO_PRODUCT_PRODUCT)
      .setFromRole (ROLE_PRODUCT_PRODUCT).setToRole (ROLE_PRODUCT_PRODUCTS));
   navigationProperties.add (new NavigationProperty ()
      .setName(Model.NODE.getName()).setRelationship(ASSO_PRODUCT_NODE)
      .setFromRole (ROLE_NODE_PRODUCT).setToRole (ROLE_PRODUCT_NODES));
   navigationProperties.add (new NavigationProperty ()
      .setName(Model.ATTRIBUTE.getName())
      .setRelationship (ASSO_PRODUCT_ATTRIBUTE)
      .setFromRole (ROLE_ATTRIBUTE_PRODUCT)
      .setToRole (ROLE_PRODUCT_ATTRIBUTES));
   navigationProperties.add (new NavigationProperty ().setName ("Class")
      .setRelationship (ASSO_PRODUCT_CLASS)
      .setFromRole (ROLE_CLASS_PRODUCTS).setToRole (ROLE_PRODUCT_CLASS));

   // TODO (OData v3) setContainsTarget(true) setBaseType(ENTITY_ITEM)
   return res.setName (ENTITY_NAME).setProperties (properties)
      .setHasStream (true).setNavigationProperties (navigationProperties);
}
 
Example #13
Source File: ConnectionEntitySet.java    From DataHubSystem with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public EntityType getEntityType ()
{
   // Properties
   List<Property> properties = new ArrayList<Property> ();

   properties.add (new SimpleProperty ()
      .setName (ID)
      .setType (EdmSimpleTypeKind.String)
      .setFacets (new Facets ().setNullable (false))
      .setCustomizableFeedMappings (
         new CustomizableFeedMappings ()
            .setFcTargetPath (EdmTargetPath.SYNDICATION_TITLE)));

   properties.add (new SimpleProperty ().setName (DATE).setType (
      EdmSimpleTypeKind.DateTime));
   properties.add (new SimpleProperty ().setName (REMOTEIP).setType (
      EdmSimpleTypeKind.String));
   properties.add (new SimpleProperty ().setName (REQUEST).setType (
      EdmSimpleTypeKind.String));
   properties.add (new SimpleProperty ().setName (DURATION).setType (
      EdmSimpleTypeKind.Double));
   properties.add (new SimpleProperty ().setName (CONTENT_LENGTH).setType (
      EdmSimpleTypeKind.Int64));
   properties.add (new SimpleProperty ().setName (WRITTEN_CONTENT_LENGTH).
      setType (EdmSimpleTypeKind.Int64));
   properties.add (new SimpleProperty ().setName (STATUS).setType (
         EdmSimpleTypeKind.String));
   properties.add (new SimpleProperty ().setName (STATUS_MESSAGE).setType (
         EdmSimpleTypeKind.String).
         setFacets (new Facets ().setNullable (true)));

   // Navigation Properties
   List<NavigationProperty> navigationProperties =
      new ArrayList<NavigationProperty> ();

   if (Security.currentUserHasRole(Role.SYSTEM_MANAGER))
   {
   navigationProperties.add (new NavigationProperty ().setName ("User")
      .setRelationship (ASSO_CONNECTION_USER)
      .setFromRole (ROLE_USER_CONNECTIONS).setToRole (ROLE_CONNECTION_USER));
   }

   // Key
   Key key =
      new Key ().setKeys (Collections.singletonList (new PropertyRef ()
         .setName (ID)));

   return new EntityType ().setName (ENTITY_NAME).setProperties (properties)
      .setKey (key).setNavigationProperties (navigationProperties);
}
 
Example #14
Source File: UserSynchronizerEntitySet.java    From DataHubSystem with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public EntityType getEntityType()
{
   List<Property> properties = new ArrayList<>();

   properties.add(new SimpleProperty().setName(ID)
         .setType(EdmSimpleTypeKind.Int64)
         .setFacets(new Facets().setNullable(false))
         .setCustomizableFeedMappings(
               new CustomizableFeedMappings().setFcTargetPath(EdmTargetPath.SYNDICATION_TITLE)));

   properties.add(new SimpleProperty().setName(LABEL)
         .setType(EdmSimpleTypeKind.String));

   properties.add(new SimpleProperty().setName(CREATION_DATE)
         .setType(EdmSimpleTypeKind.DateTime)
         .setFacets(new Facets().setNullable(false)));

   properties.add(new SimpleProperty().setName(MODIFICATION_DATE)
         .setType(EdmSimpleTypeKind.DateTime)
         .setFacets(new Facets().setNullable(false))
         .setCustomizableFeedMappings(
               new CustomizableFeedMappings().setFcTargetPath(EdmTargetPath.SYNDICATION_UPDATED)));

   properties.add(new SimpleProperty().setName(REQUEST)
         .setType(EdmSimpleTypeKind.String)
         .setFacets(
            new Facets()
               .setNullable(false)
               .setDefaultValue("stop")
         )
   );

   properties.add(new SimpleProperty().setName(SCHEDULE)
         .setType(EdmSimpleTypeKind.String)
         .setFacets(new Facets().setNullable(false)));

   properties.add(new SimpleProperty().setName(STATUS)
         .setType(EdmSimpleTypeKind.String)
         .setFacets(new Facets().setNullable(false)));

   properties.add(new SimpleProperty().setName(STATUS_DATE)
         .setType(EdmSimpleTypeKind.DateTime));

   properties.add(new SimpleProperty().setName(STATUS_MESSAGE)
         .setType(EdmSimpleTypeKind.String));

   properties.add(new SimpleProperty().setName(SERVICE_URL)
         .setType(EdmSimpleTypeKind.String)
         .setFacets(new Facets().setNullable(false)));

   properties.add(new SimpleProperty().setName(SERVICE_LOGIN)
         .setType(EdmSimpleTypeKind.String));

   properties.add(new SimpleProperty().setName(SERVICE_PASSWORD)
         .setType(EdmSimpleTypeKind.String));

   properties.add(new SimpleProperty().setName(CURSOR)
         .setType(EdmSimpleTypeKind.Int64)
         .setFacets(
               new Facets()
                     .setNullable(false)
                     .setDefaultValue("0")
         )
   );

   properties.add(new SimpleProperty().setName(PAGE_SIZE)
         .setType(EdmSimpleTypeKind.Int64)
         .setFacets(
               new Facets()
                     .setNullable(false)
                     .setDefaultValue("500")
         )
   );

   properties.add(new SimpleProperty().setName(FORCE)
         .setType(EdmSimpleTypeKind.Boolean)
         .setFacets(
               new Facets()
                     .setDefaultValue("false")
         )
   );

   // Key
   Key key = new Key().setKeys(Collections.singletonList(new PropertyRef().setName(ID)));

   return new EntityType().setName(ENTITY_NAME).setProperties(properties).setKey(key);
}
 
Example #15
Source File: IngestEntitySet.java    From DataHubSystem with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public EntityType getEntityType()
{
   // Properties
   List<Property> properties = new ArrayList<>();
   properties.add(new SimpleProperty().setName(ID)
         .setType(EdmSimpleTypeKind.Int64)
         .setFacets(new Facets().setNullable(false))
         .setCustomizableFeedMappings(
               new CustomizableFeedMappings().setFcTargetPath(EdmTargetPath.SYNDICATION_TITLE)));

   properties.add(new SimpleProperty().setName(STATUS)
         .setType(EdmSimpleTypeKind.String)
         .setFacets(new Facets().setNullable(false)));

   properties.add(new SimpleProperty().setName(STATUS_DATE)
         .setType(EdmSimpleTypeKind.DateTime)
         .setCustomizableFeedMappings(
               new CustomizableFeedMappings().setFcTargetPath(EdmTargetPath.SYNDICATION_UPDATED)));

   properties.add(new SimpleProperty().setName(STATUS_MESSAGE)
         .setType(EdmSimpleTypeKind.String));


   properties.add(new SimpleProperty().setName(FILENAME)
         .setType(EdmSimpleTypeKind.String));

   properties.add(new SimpleProperty().setName(MD5)
         .setType(EdmSimpleTypeKind.String)
         .setFacets(new Facets().setNullable(false)));

   // Key
   Key key = new Key().setKeys(
         Collections.singletonList(new PropertyRef().setName(ID)));

   // Navigation Properties
   List<NavigationProperty> navigationProperties = new ArrayList<>(2);
   navigationProperties.add(
         new NavigationProperty()
         .setName(TARGET_COLLECTIONS)
         .setRelationship(ASSO_INGEST_COLLECTION)
         .setToRole(ROLE_INGEST_COLLECTIONS)
         .setFromRole(ROLE_COLLECTION_INGESTS)
   );
   navigationProperties.add(
         new NavigationProperty()
         .setName(UPLOADER)
         .setRelationship(ASSO_INGEST_USER)
         .setToRole(ROLE_INGEST_USER)
         .setFromRole(ROLE_USER_INGEST)
   );

   return new EntityType()
         .setName(ENTITY_NAME)
         .setProperties(properties)
         .setKey(key)
         .setNavigationProperties(navigationProperties)
         .setHasStream(true);
}