public static List<String> makeHierarchy ( final Item item ) { final ItemInformation info = item.getInformation (); if ( info == null ) { return Collections.emptyList (); } return info.getHierarchy (); } }
public static List<String> makeHierarchy ( final Item item ) { final ItemInformation info = item.getInformation (); if ( info == null ) { return Collections.emptyList (); } return info.getHierarchy (); } }
public boolean isType ( final DataType... dataTypes ) { if ( this.item.getInformation () == null ) { return false; } if ( this.item.getInformation ().getDataType () == null ) { return false; } for ( final DataType dataType : dataTypes ) { if ( this.item.getInformation ().getDataType ().equals ( dataType ) ) { return true; } } return false; }
@Override public <T extends Item> CreationRequest<T> addItem ( final T item ) { List<String> hier; if ( this.component != null ) { hier = Components.makeHierarchy ( this.component ); } else if ( item.getInformation () != null ) { hier = item.getInformation ().getHierarchy (); } else { throw new IllegalStateException ( String.format ( "Unable to add item %s since it neither has a component nor a hiearchy set.", item ) ); } return new AbstractCreationRequest<T> ( this.component, hier ) { @Override public T create () { return addItem ( item, buildRequest ( item ), getMasterListeners () ); } }; }
@Override public <T extends Item> CreationRequest<T> addItem ( final T item ) { List<String> hier; if ( this.component != null ) { hier = Components.makeHierarchy ( this.component ); } else if ( item.getInformation () != null ) { hier = item.getInformation ().getHierarchy (); } else { throw new IllegalStateException ( String.format ( "Unable to add item %s since it neither has a component nor a hiearchy set.", item ) ); } return new AbstractCreationRequest<T> ( this.component, hier ) { @Override public T create () { return addItem ( item, buildRequest ( item ), getMasterListeners () ); } }; }
private void processItem ( final MasterServer app, final Item item ) { if ( item.getInformation () == null ) { return; } final EList<String> hier = item.getInformation ().getHierarchy (); if ( hier.isEmpty () ) { return; } final SummaryGroup group = getSummaryGroup ( null, app.getSummaryGroups (), new LinkedList<> ( hier ) ); if ( group == null ) { return; } group.getItems ().add ( item ); }
public static Map<String, String> createInfoAttributes ( final Item item ) { final Map<String, String> attributes = new HashMap<> (); Configurations.fillAttributesWithHierarchy ( attributes, Names.makeHierarchy ( item ) ); attributes.put ( "item", item.getName () ); if ( item.getInformation () != null ) { addAttribute ( attributes, "system", item.getInformation ().getSystem () ); addAttribute ( attributes, "unit", item.getInformation ().getUnit () ); addAttribute ( attributes, "itemDescription", item.getInformation ().getDescription () ); } return attributes; }
public static Map<String, String> createInfoAttributes ( final Item item ) { final Map<String, String> attributes = new HashMap<> (); Configurations.fillAttributesWithHierarchy ( attributes, Names.makeHierarchy ( item ) ); attributes.put ( "item", item.getName () ); if ( item.getInformation () != null ) { addAttribute ( attributes, "system", item.getInformation ().getSystem () ); addAttribute ( attributes, "unit", item.getInformation ().getUnit () ); addAttribute ( attributes, "itemDescription", item.getInformation ().getDescription () ); } return attributes; }
@Override public CreationRequest<T> request ( final CustomizationRequest request ) { customizationTags ( request.getCustomizationTags () ); localTags ( request.getLocalTags () ); this.globalizationLevel = request.getGlobalizationLevel (); if ( request.getItem ().getInformation () != null ) { this.itemInformation.setDataType ( request.getItem ().getInformation ().getDataType () ); this.itemInformation.setDescription ( request.getItem ().getInformation ().getDescription () ); this.itemInformation.setSystem ( request.getItem ().getInformation ().getSystem () ); } return this; }
@Override public CreationRequest<T> request ( final CustomizationRequest request ) { customizationTags ( request.getCustomizationTags () ); localTags ( request.getLocalTags () ); this.globalizationLevel = request.getGlobalizationLevel (); if ( request.getItem ().getInformation () != null ) { this.itemInformation.setDataType ( request.getItem ().getInformation ().getDataType () ); this.itemInformation.setDescription ( request.getItem ().getInformation ().getDescription () ); this.itemInformation.setSystem ( request.getItem ().getInformation ().getSystem () ); } return this; }
protected <T extends Item> T addItem ( final T item, final CustomizationRequest customizationRequest, final Set<MasterListener<T>> masterListeners ) { final List<String> originalLocalTags = new ArrayList<> ( customizationRequest.getLocalTags () ); // we do need a copy customizeItem ( item, customizationRequest ); // set the name after customizing final List<String> hier = new LinkedList<> (); hier.addAll ( customizationRequest.getHierarchy () ); hier.addAll ( customizationRequest.getLocalTags () ); item.setName ( Names.makeHierarchy ( hier ) ); // FIXME: should allow a different naming scheme logger.debug ( "Setting item name: {}", item.getName () ); if ( item.getInformation () == null ) { item.setInformation ( OsgiFactory.eINSTANCE.createItemInformation () ); } // apply the hierarchy afterwards ... overriding! ECollections.setEList ( item.getInformation ().getHierarchy (), customizationRequest.getHierarchy () ); itemAdded ( item, customizationRequest, originalLocalTags, masterListeners ); return item; }
protected <T extends Item> T addItem ( final T item, final CustomizationRequest customizationRequest, final Set<MasterListener<T>> masterListeners ) { final List<String> originalLocalTags = new ArrayList<> ( customizationRequest.getLocalTags () ); // we do need a copy customizeItem ( item, customizationRequest ); // set the name after customizing final List<String> hier = new LinkedList<> (); hier.addAll ( customizationRequest.getHierarchy () ); hier.addAll ( customizationRequest.getLocalTags () ); item.setName ( Names.makeHierarchy ( hier ) ); // FIXME: should allow a different naming scheme logger.debug ( "Setting item name: {}", item.getName () ); if ( item.getInformation () == null ) { item.setInformation ( OsgiFactory.eINSTANCE.createItemInformation () ); } // apply the hierarchy afterwards ... overriding! ECollections.setEList ( item.getInformation ().getHierarchy (), customizationRequest.getHierarchy () ); itemAdded ( item, customizationRequest, originalLocalTags, masterListeners ); return item; }
if ( item.getInformation () == null ) buildMarker ( item, itemGroups, new LinkedList<> ( item.getInformation ().getHierarchy () ) );
private void processExporter ( final DataAccessExporter exporter ) { for ( final ItemExport export : exporter.getExports () ) { final String masterId = Items.makeMasterId ( export.getItem () ); final ItemInformation info = export.getItem ().getInformation (); final String description = info != null ? info.getDescription () : null; addAlias ( Names.makeName ( exporter ) + "/" + export.getExportName (), export.getExportName (), masterId, info.getIoDirections (), description ); } }
private void processExporter ( final DataAccessExporter exporter ) { for ( final ItemExport export : exporter.getExports () ) { final String masterId = Items.makeMasterId ( export.getItem () ); final ItemInformation info = export.getItem ().getInformation (); final String description = info != null ? info.getDescription () : null; addAlias ( Names.makeName ( exporter ) + "/" + export.getExportName (), export.getExportName (), masterId, info.getIoDirections (), description ); } }
private SourceItem createGlobalItem ( final Global global, final Local local, final Item item, final DataAccessConnection da ) { final SourceItem sourceItem = OsgiFactory.eINSTANCE.createSourceItem (); sourceItem.setInformation ( EcoreUtil.copy ( item.getInformation () ) ); sourceItem.setSourceName ( item.getName () ); sourceItem.setConnection ( da ); if ( item instanceof SummaryItem ) { sourceItem.setName ( makeGlobalSummaryName ( global, local, item ) ); } else { sourceItem.setName ( item.getName () ); } // FIXME: customize global item final int level = findAttributesHierarchyLevel ( item ) + 1; DefaultFeatures.ASUM ( level ).customize ( sourceItem ); this.hierarchyLevelMap.put ( sourceItem, level ); return sourceItem; }