All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ksc.mission.base.codegen.ModelView Maven / Gradle / Ivy

package com.ksc.mission.base.codegen;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ksc.mission.base.interfaces.Initializable;
import com.ksc.mission.base.relatedobjects.OwnedObject;

public class ModelView extends OwnedObject implements Initializable {
	private static final long serialVersionUID = 1L;
	protected String type;
	final protected List templateTypes = new ArrayList();

	@Override
	public ModelView initializeFromStrings(Iterator iterator) {
		id = type = iterator.next();
		while(iterator.hasNext()) {
			TemplateType tempType = getModel().getApplication().templateTypes.basicAtId(iterator.next());
			if(tempType != null)
				templateTypes.add(tempType);   // one or more template names
		}
		return this;
	}
	
	@JsonIgnore
	Model getModel() {
		return getOwner();
	}
	
	@JsonIgnore
	public List getProperties() {
		return getModel().getProperties().stream()                
                .filter(property -> property.get("ModelsViews").contains(this.type))    
                .collect(Collectors.toList());
	}

	public String getType() {
		return type;
	}
	
	public void setType(String type) {
		this.type = type;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy