📄 cwmexample.java
字号:
nonKeyAttribute.setType( integerType );
nonKeyAttribute.setNamespace( timeDimension );
featureList.add( nonKeyAttribute );
// Create the Customer Dimension and add it to the Schema
Dimension customerDimension = dimensionClass.createDimension();
customerDimension.setName( "Customer" );
dimCol.add( customerDimension );
customerDimension.setSchema( schema );
// Create the primary key of the Customer Dimension using the
// "surrogate key" pattern
keyAttribute = attributeClass.createAttribute();
keyAttribute.setName( "CustomerID" );
keyAttribute.setType( integerType );
keyAttribute.setNamespace( customerDimension );
featureList = customerDimension.getFeature();
featureList.add( keyAttribute );
uniqueKey = uniqueKeyClass.createUniqueKey();
uniqueKey.setName( "CustomerUK" );
keyFeatureList = uniqueKey.getFeature();
keyFeatureList.add( keyAttribute );
uniqueKey.setNamespace( customerDimension );
ownedElements = customerDimension.getOwnedElement();
ownedElements.add( uniqueKey );
// Note that the stereotype is reused...
extendedElements.add( uniqueKey );
// Create the non-key attributes and add them to the Customer Dimension.
// Note that the data types created previously are re-used.
nonKeyAttribute = attributeClass.createAttribute();
nonKeyAttribute.setName( "CustomerType" );
nonKeyAttribute.setType( stringType );
nonKeyAttribute.setNamespace( customerDimension );
featureList.add( nonKeyAttribute );
nonKeyAttribute = attributeClass.createAttribute();
nonKeyAttribute.setName( "ISP" );
nonKeyAttribute.setType( stringType );
nonKeyAttribute.setNamespace( customerDimension );
featureList.add( nonKeyAttribute );
nonKeyAttribute = attributeClass.createAttribute();
nonKeyAttribute.setName( "CookieID" );
nonKeyAttribute.setType( integerType );
nonKeyAttribute.setNamespace( customerDimension );
featureList.add( nonKeyAttribute );
// ...
nonKeyAttribute = attributeClass.createAttribute();
nonKeyAttribute.setName( "Region" );
nonKeyAttribute.setType( stringType );
nonKeyAttribute.setNamespace( customerDimension );
featureList.add( nonKeyAttribute );
nonKeyAttribute = attributeClass.createAttribute();
nonKeyAttribute.setName( "Country" );
nonKeyAttribute.setType( stringType );
nonKeyAttribute.setNamespace( customerDimension );
featureList.add( nonKeyAttribute );
// Create the Product Dimension and add it to the Schema
Dimension productDimension = dimensionClass.createDimension();
productDimension.setName( "Product" );
dimCol.add( productDimension );
productDimension.setSchema( schema );
// Create the primary key of the Product Dimension using the
// "surrogate key" pattern
keyAttribute = attributeClass.createAttribute();
keyAttribute.setName( "ProductID" );
keyAttribute.setType( integerType );
keyAttribute.setNamespace( productDimension );
featureList = productDimension.getFeature();
featureList.add( keyAttribute );
uniqueKey = uniqueKeyClass.createUniqueKey();
uniqueKey.setName( "ProductUK" );
keyFeatureList = uniqueKey.getFeature();
keyFeatureList.add( keyAttribute );
uniqueKey.setNamespace( productDimension );
ownedElements = productDimension.getOwnedElement();
ownedElements.add( uniqueKey );
// Note that the stereotype is reused...
extendedElements.add( uniqueKey );
// Create the non-key attributes and add them to the Product Dimension.
// Note that the data types created previously are re-used.
nonKeyAttribute = attributeClass.createAttribute();
nonKeyAttribute.setName( "ProductType" );
nonKeyAttribute.setType( stringType );
nonKeyAttribute.setNamespace( productDimension );
featureList.add( nonKeyAttribute );
nonKeyAttribute = attributeClass.createAttribute();
nonKeyAttribute.setName( "SKU" );
nonKeyAttribute.setType( stringType );
nonKeyAttribute.setNamespace( productDimension );
featureList.add( nonKeyAttribute );
nonKeyAttribute = attributeClass.createAttribute();
nonKeyAttribute.setName( "Description" );
nonKeyAttribute.setType( stringType );
nonKeyAttribute.setNamespace( productDimension );
featureList.add( nonKeyAttribute );
// ...
nonKeyAttribute = attributeClass.createAttribute();
nonKeyAttribute.setName( "Weight" );
nonKeyAttribute.setType( integerType );
nonKeyAttribute.setNamespace( productDimension );
featureList.add( nonKeyAttribute );
// ...
nonKeyAttribute = attributeClass.createAttribute();
nonKeyAttribute.setName( "Buyer" );
nonKeyAttribute.setType( stringType );
nonKeyAttribute.setNamespace( productDimension );
featureList.add( nonKeyAttribute );
// Create the Page Dimension and add it to the Schema
Dimension pageDimension = dimensionClass.createDimension();
pageDimension.setName( "Page" );
dimCol.add( pageDimension );
pageDimension.setSchema( schema );
// Create the primary key of the Page Dimension using the
// "surrogate key" pattern
keyAttribute = attributeClass.createAttribute();
keyAttribute.setName( "PageID" );
keyAttribute.setType( integerType );
keyAttribute.setNamespace( pageDimension );
featureList = pageDimension.getFeature();
featureList.add( keyAttribute );
uniqueKey = uniqueKeyClass.createUniqueKey();
uniqueKey.setName( "PageUK" );
keyFeatureList = uniqueKey.getFeature();
keyFeatureList.add( keyAttribute );
uniqueKey.setNamespace( pageDimension );
ownedElements = pageDimension.getOwnedElement();
ownedElements.add( uniqueKey );
// Note that the stereotype is reused...
extendedElements.add( uniqueKey );
// Create the non-key attributes and add them to the Page Dimension.
// Note that the data types created previously are re-used.
nonKeyAttribute = attributeClass.createAttribute();
nonKeyAttribute.setName( "Source" );
nonKeyAttribute.setType( stringType );
nonKeyAttribute.setNamespace( pageDimension );
featureList.add( nonKeyAttribute );
nonKeyAttribute = attributeClass.createAttribute();
nonKeyAttribute.setName( "Function" );
nonKeyAttribute.setType( stringType );
nonKeyAttribute.setNamespace( pageDimension );
featureList.add( nonKeyAttribute );
nonKeyAttribute = attributeClass.createAttribute();
nonKeyAttribute.setName( "Template" );
nonKeyAttribute.setType( stringType );
nonKeyAttribute.setNamespace( pageDimension );
featureList.add( nonKeyAttribute );
// ...
nonKeyAttribute = attributeClass.createAttribute();
nonKeyAttribute.setName( "Buyer" );
nonKeyAttribute.setType( stringType );
nonKeyAttribute.setNamespace( pageDimension );
featureList.add( nonKeyAttribute );
// Create the Event Dimension and add it to the Schema
Dimension eventDimension = dimensionClass.createDimension();
eventDimension.setName( "Event" );
dimCol.add( eventDimension );
eventDimension.setSchema( schema );
// Create the primary key of the Event Dimension using the
// "surrogate key" pattern
keyAttribute = attributeClass.createAttribute();
keyAttribute.setName( "EventID" );
keyAttribute.setType( integerType );
keyAttribute.setNamespace( eventDimension );
featureList = eventDimension.getFeature();
featureList.add( keyAttribute );
uniqueKey = uniqueKeyClass.createUniqueKey();
uniqueKey.setName( "EventUK" );
keyFeatureList = uniqueKey.getFeature();
keyFeatureList.add( keyAttribute );
uniqueKey.setNamespace( eventDimension );
ownedElements = eventDimension.getOwnedElement();
ownedElements.add( uniqueKey );
// Note that the stereotype is reused...
extendedElements.add( uniqueKey );
// Create the non-key attributes and add them to the Event Dimension.
// Note that the data types created previously are re-used.
nonKeyAttribute = attributeClass.createAttribute();
nonKeyAttribute.setName( "EventType" );
nonKeyAttribute.setType( stringType );
nonKeyAttribute.setNamespace( eventDimension );
featureList.add( nonKeyAttribute );
nonKeyAttribute = attributeClass.createAttribute();
nonKeyAttribute.setName( "EventContent" );
nonKeyAttribute.setType( stringType );
nonKeyAttribute.setNamespace( eventDimension );
featureList.add( nonKeyAttribute );
// Create the Session Dimension and add it to the Schema
Dimension sessionDimension = dimensionClass.createDimension();
sessionDimension.setName( "Session" );
dimCol.add( sessionDimension );
sessionDimension.setSchema( schema );
// Create the primary key of the Session Dimension using the
// "surrogate key" pattern
keyAttribute = attributeClass.createAttribute();
keyAttribute.setName( "SessionID" );
keyAttribute.setType( integerType );
keyAttribute.setNamespace( sessionDimension );
featureList = sessionDimension.getFeature();
featureList.add( keyAttribute );
uniqueKey = uniqueKeyClass.createUniqueKey();
uniqueKey.setName( "SessionUK" );
keyFeatureList = uniqueKey.getFeature();
keyFeatureList.add( keyAttribute );
uniqueKey.setNamespace( sessionDimension );
ownedElements = sessionDimension.getOwnedElement();
ownedElements.add( uniqueKey );
// Note that the stereotype is reused...
extendedElements.add( uniqueKey );
// Create the non-key attributes and add them to the Session Dimension.
// Note that the data types created previously are re-used.
nonKeyAttribute = attributeClass.createAttribute();
nonKeyAttribute.setName( "SessionType" );
nonKeyAttribute.setType( stringType );
nonKeyAttribute.setNamespace( sessionDimension );
featureList.add( nonKeyAttribute );
nonKeyAttribute = attributeClass.createAttribute();
nonKeyAttribute.setName( "LocalContext" );
nonKeyAttribute.setType( stringType );
nonKeyAttribute.setNamespace( sessionDimension );
featureList.add( nonKeyAttribute );
nonKeyAttribute = attributeClass.createAttribute();
nonKeyAttribute.setName( "SessionContext" );
nonKeyAttribute.setType( stringType );
nonKeyAttribute.setNamespace( sessionDimension );
featureList.add( nonKeyAttribute );
// ...
nonKeyAttribute = attributeClass.createAttribute();
nonKeyAttribute.setName( "CustomerStatus" );
nonKeyAttribute.setType( stringType );
nonKeyAttribute.setNamespace( sessionDimension );
featureList.add( nonKeyAttribute );
// Create the Referral Dimension and add it to the Schema
Dimension referralDimension = dimensionClass.createDimension();
referralDimension.setName( "Referral" );
dimCol.add( referralDimension );
referralDimension.setSchema( schema );
// Create the primary key of the Referral Dimension using the
// "surrogate key" pattern
keyAttribute = attributeClass.createAttribute();
keyAttribute.setName( "ReferralID" );
keyAttribute.setType( integerType );
keyAttribute.setNamespace( referralDimension );
featureList = referralDimension.getFeature();
featureList.add( keyAttribute );
uniqueKey = uniqueKeyClass.createUniqueKey();
uniqueKey.setName( "ReferralUK" );
keyFeatureList = uniqueKey.getFeature();
keyFeatureList.add( keyAttribute );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -