Projects >> IRIS >>2ce3d2cf5987f3f48007122cb0fde5e706bbb56c

Chunk
Conflicting content
	
	/**
<<<<<<< HEAD
=======
	 * Generate project artefacts from OData4j metadata
	 * @param edmxFile EDMX file
	 * @param edmDataServices odata4j metadata 
	 * @param srcOutputPath Path to output directory
	 * @param configOutputPath Path to configuration files directory
	 * @return true if successful, false otherwise
	 */
	public boolean generateArtifacts(String edmxFile, EdmDataServices edmDataServices, File srcOutputPath, File configOutputPath) {
		//Make sure we have at least one entity container
		boolean ok = true;
		if(edmDataServices.getSchemas().size() == 0 || edmDataServices.getSchemas().get(0).getEntityContainers().size() == 0) {
			return false;
		}
		String entityContainerNamespace = edmDataServices.getSchemas().get(0).getEntityContainers().get(0).getName();

		//Create interaction model
		InteractionModel interactionModel = new InteractionModel(edmDataServices);
		Map linkPropertyMap = new HashMap();
		for (EdmEntitySet entitySet : edmDataServices.getEntitySets()) {
			EdmEntityType entityType = entitySet.getType();
			String entityName = entityType.getName();
			IMResourceStateMachine rsm = interactionModel.findResourceStateMachine(entityName);
			//Use navigation properties to define state transitions
			if(entityType.getNavigationProperties() != null) {
				for (EdmNavigationProperty np : entityType.getNavigationProperties()) {
					EdmAssociationEnd targetEnd = np.getToRole();
					boolean isTargetCollection = targetEnd.getMultiplicity().equals(EdmMultiplicity.MANY);
					EdmEntityType targetEntityType = targetEnd.getType();
					String targetEntityName = targetEntityType.getName();
					IMResourceStateMachine targetRsm = interactionModel.findResourceStateMachine(targetEntityName);
					
					EdmAssociation association = np.getRelationship();
					String linkProperty = getLinkProperty(association.getName(), edmxFile);
					linkPropertyMap.put(association.getName(), linkProperty);

					//Reciprocal link state name
					String reciprocalLinkState = "";
					for(EdmNavigationProperty npTarget : targetEntityType.getNavigationProperties()) {
						String targetNavPropTargetEntityName = npTarget.getToRole().getType().getName();
						if(targetNavPropTargetEntityName.equals(entityName)) {
							reciprocalLinkState = npTarget.getName();
						}
					}
					String filter = null;
					if(isTargetCollection) {
						String linkPropertyOrigin = getLinkPropertyOrigin(association.getName(), edmxFile);
						filter = linkProperty + " eq '{" + linkPropertyOrigin + "}'";
					}
					String linkTitle = np.getName();
					rsm.addTransition(targetEntityName, linkProperty, np.getName(), isTargetCollection, reciprocalLinkState, targetRsm, filter, linkTitle);
				}
			}			
		}
		
		//Create the entity model
		EntityModel entityModel = new EntityModel(entityContainerNamespace);
		for (EdmEntityType entityType : edmDataServices.getEntityTypes()) {
			List keys = entityType.getKeys();
			EMEntity emEntity = new EMEntity(entityType.getName());
			for (EdmProperty prop : entityType.getProperties()) {
				EMProperty emProp = createEMProperty(prop);
				if(keys.contains(prop.getName())) {
					emProp.addVocabularyTerm(new EMTerm(TermIdField.TERM_NAME, "true"));
				}
				emEntity.addProperty(emProp);
			}
			entityModel.addEntity(emEntity);
		}
		
		//Create commands
		Commands commands = getDefaultCommands(interactionModel);
		for(IMResourceStateMachine rsm : interactionModel.getResourceStateMachines()) {
			for(IMTransition transition : rsm.getTransitions()) {
				if(!transition.isCollectionState()) {
					String cmdId = Commands.GET_NAV_PROPERTY + transition.getTargetStateName();
					commands.addCommand(cmdId, "com.temenos.interaction.commands.odata.GETNavPropertyCommand", cmdId, COMMAND_METADATA_SOURCE_ODATAPRODUCER);
				}
			}
		}
		
		//Obtain resource information
		List entitiesInfo = new ArrayList();
		for (EdmEntityType t : edmDataServices.getEntityTypes()) {
			EntityInfo entityInfo = createEntityInfoFromEdmEntityType(t, linkPropertyMap);
			addNavPropertiesToEntityInfo(entityInfo, interactionModel);
			entitiesInfo.add(entityInfo);
		}
		
		//Write other artefacts
		if(!writeArtefacts(entityContainerNamespace, entitiesInfo, commands, entityModel, interactionModel, srcOutputPath, configOutputPath, true)) {
			ok = false;
		}
		
		
		return ok;
	}

	/**
>>>>>>> b4890467e1c396b8c48f23fc9bc3fa9a05cead24
	 * Generate project artefacts from conceptual interaction and metadata models.
	 * @param metadata metadata model
	 * @param interactionModel Conceptual interaction model
Solution content
	
	/**
	 * Generate project artefacts from conceptual interaction and metadata models.
	 * @param metadata metadata model
	 * @param interactionModel Conceptual interaction model
File
JPAResponderGen.java
Developer's decision
Version 1
Kind of conflict
Comment
Method declaration
Chunk
Conflicting content
	/**
	 * @param targetEntityName name of entity associated to target state
	 * @param targetResourceStateMachine target resource state machine
	 */
<<<<<<< HEAD
	public void addTransitionToCollectionResource(String targetStateName, String targetEntityName, IMResourceStateMachine targetResourceStateMachine, String filter) {
		addTransition(targetEntityName, targetStateName, targetStateName, true, "", targetResourceStateMachine, filter, null, null, null, false);
=======
	public void addTransitionToCollectionResource(String targetStateName, String targetEntityName, IMResourceStateMachine targetResourceStateMachine, String filter, String title) {
		addTransition(targetEntityName, targetStateName, targetStateName, true, "", targetResourceStateMachine, filter, title);
>>>>>>> b4890467e1c396b8c48f23fc9bc3fa9a05cead24
	}
Solution content
	 * @param targetEntityName name of entity associated to target state
	 * @param targetResourceStateMachine target resource state machine
	 */
	public void addTransitionToCollectionResource(String targetStateName, String targetEntityName, IMResourceStateMachine targetResourceStateMachine, String filter, String title) {
		addTransition(targetEntityName, targetStateName, targetStateName, true, "", targetResourceStateMachine, filter, title, null, null, null, false);
	}

	/**
File
IMResourceStateMachine.java
Developer's decision
Manual
Kind of conflict
Method invocation
Method signature
Chunk
Conflicting content
	 * @param targetResourceStateMachine target resource state machine
	 */
	public void addTransitionToEntityResource(String targetStateName, String linkProperty, String targetEntityName, IMResourceStateMachine targetResourceStateMachine) {
<<<<<<< HEAD
		addTransition(targetEntityName, linkProperty, targetStateName, false, "", targetResourceStateMachine, null, null, null, null, false);
=======
		addTransition(targetEntityName, linkProperty, targetStateName, false, "", targetResourceStateMachine, null, null);
>>>>>>> b4890467e1c396b8c48f23fc9bc3fa9a05cead24
	}
	
	/**
Solution content
	 * @param targetResourceStateMachine target resource state machine
	 */
	public void addTransitionToEntityResource(String targetStateName, String linkProperty, String targetEntityName, IMResourceStateMachine targetResourceStateMachine) {
		addTransition(targetEntityName, linkProperty, targetStateName, false, "", targetResourceStateMachine, null, null, null, null, null, false);
	}
	
	/**
File
IMResourceStateMachine.java
Developer's decision
Manual
Kind of conflict
Method invocation
Chunk
Conflicting content
	 * @param targetResourceStateMachine Target RSM
	 */
	public void addTransition(String targetEntityName, String linkProperty, String targetStateName, boolean isCollectionState, String reciprocalLinkState, IMResourceStateMachine targetResourceStateMachine) {
<<<<<<< HEAD
		addTransition(targetEntityName, linkProperty, targetStateName, isCollectionState, reciprocalLinkState, targetResourceStateMachine, null, null, null, null, false);
=======
		addTransition(targetEntityName, linkProperty, targetStateName, isCollectionState, reciprocalLinkState, targetResourceStateMachine, null, null);
>>>>>>> b4890467e1c396b8c48f23fc9bc3fa9a05cead24
	}
	
	/**
Solution content
	 * @param targetResourceStateMachine Target RSM
	 */
	public void addTransition(String targetEntityName, String linkProperty, String targetStateName, boolean isCollectionState, String reciprocalLinkState, IMResourceStateMachine targetResourceStateMachine) {
		addTransition(targetEntityName, linkProperty, targetStateName, isCollectionState, reciprocalLinkState, targetResourceStateMachine, null, null, null, null, null, false);
	}
	
	/**
File
IMResourceStateMachine.java
Developer's decision
Manual
Kind of conflict
Method invocation
Chunk
Conflicting content
	 * @param targetResourceStateMachine Target RSM
	 * @param filter Filter for transitions to collection states
	 */
<<<<<<< HEAD
	public void addTransition(String targetEntityName, String linkProperty, String targetStateName, boolean isCollectionState, String reciprocalLinkState, IMResourceStateMachine targetResourceStateMachine, String filter) {
		addTransition(targetEntityName, linkProperty, targetStateName, isCollectionState, reciprocalLinkState, targetResourceStateMachine, filter, null, null, null, false);
	}

	protected void addTransition(String targetEntityName, String linkProperty, String targetStateName, boolean isCollectionState, String reciprocalLinkState, IMResourceStateMachine targetResourceStateMachine, String filter, String method, String action, String relations, boolean boundToCollection) {
		IMTransition transition = new IMTransition(targetEntityName, 
				linkProperty, 
				targetStateName, 
				isCollectionState, 
				reciprocalLinkState, 
				targetResourceStateMachine, 
				filter != null ? filter : "",
				method,
				action,
				relations,
				boundToCollection);
=======
	public void addTransition(String targetEntityName, String linkProperty, String targetStateName, boolean isCollectionState, String reciprocalLinkState, IMResourceStateMachine targetResourceStateMachine, String filter, String title) {
		IMTransition transition = new IMTransition(targetEntityName, linkProperty, targetStateName, isCollectionState, reciprocalLinkState, targetResourceStateMachine, filter != null ? filter : "", title);
>>>>>>> b4890467e1c396b8c48f23fc9bc3fa9a05cead24
		
		//Workaround - if there are multiple transitions to the same state => create intermediate 'navigation' states 
		for(IMTransition t : transitions) {
Solution content
	 * @param targetResourceStateMachine Target RSM
	 * @param filter Filter for transitions to collection states
	 */
	public void addTransition(String targetEntityName, String linkProperty, String targetStateName, boolean isCollectionState, String reciprocalLinkState, IMResourceStateMachine targetResourceStateMachine, String filter, String title) {
		addTransition(targetEntityName, linkProperty, targetStateName, isCollectionState, reciprocalLinkState, targetResourceStateMachine, filter, title, null, null, null, false);
	}

	protected void addTransition(String targetEntityName, String linkProperty, String targetStateName, boolean isCollectionState, String reciprocalLinkState, IMResourceStateMachine targetResourceStateMachine, String filter, String title, String method, String action, String relations, boolean boundToCollection) {
		IMTransition transition = new IMTransition(targetEntityName, 
				linkProperty, 
				targetStateName, 
				isCollectionState, 
				reciprocalLinkState, 
				targetResourceStateMachine, 
				filter != null ? filter : "",
				title,
				method,
				action,
				relations,
				boundToCollection);
		
		//Workaround - if there are multiple transitions to the same state => create intermediate 'navigation' states 
		for(IMTransition t : transitions) {
File
IMResourceStateMachine.java
Developer's decision
Manual
Kind of conflict
Method declaration
Method invocation
Method signature
Variable
Chunk
Conflicting content
	private String reciprocalLinkState;		//State which leads a target state back to the current state
	private IMResourceStateMachine targetResourceStateMachine;	//Resource state machine of target state
	private String filter;					//Filter expression for transitions to collection resources
<<<<<<< HEAD
	private String method;					// the method for transition to pseudo state
	private String action;					// the action for a pseudo state
	private String relations;				// the link relations for state
	private boolean boundToCollection;		// the pseudo state is to be bound to the collection path 
	
	public IMTransition(String targetEntityName, String linkProperty, String targetStateName, boolean isCollectionState, String reciprocalLinkState, IMResourceStateMachine targetResourceStateMachine, String filter, String method, String action, String relations, boolean boundToCollection) {
=======
	private String title;					//Transition label

	public IMTransition(String targetEntityName, String linkProperty, String targetStateName, boolean isCollectionState, String reciprocalLinkState, IMResourceStateMachine targetResourceStateMachine, String filter, String title) {
>>>>>>> b4890467e1c396b8c48f23fc9bc3fa9a05cead24
		this.targetEntityName = targetEntityName;
		this.linkProperty = linkProperty;
		this.targetStateName = targetStateName;
Solution content
	private String reciprocalLinkState;		//State which leads a target state back to the current state
	private IMResourceStateMachine targetResourceStateMachine;	//Resource state machine of target state
	private String filter;					//Filter expression for transitions to collection resources
	private String title;					//Transition label
	private String method;					// the method for transition to pseudo state
	private String action;					// the action for a pseudo state
	private String relations;				// the link relations for state
	private boolean boundToCollection;		// the pseudo state is to be bound to the collection path 
	
	public IMTransition(String targetEntityName, String linkProperty, String targetStateName, boolean isCollectionState, String reciprocalLinkState, IMResourceStateMachine targetResourceStateMachine, String filter, String title, String method, String action, String relations, boolean boundToCollection) {
		this.targetEntityName = targetEntityName;
		this.linkProperty = linkProperty;
		this.targetStateName = targetStateName;
File
IMTransition.java
Developer's decision
Manual
Kind of conflict
Attribute
Comment
Method signature
Chunk
Conflicting content
		this.boundToCollection = boundToCollection;
=======
		this.title = title;
		this.reciprocalLinkState = reciprocalLinkState;
		this.targetResourceStateMachine = targetResourceStateMachine;
		this.filter = filter;
<<<<<<< HEAD
		this.method = method;
		this.action = action;
		this.relations = relations;
>>>>>>> b4890467e1c396b8c48f23fc9bc3fa9a05cead24
	}
	
	public String getTargetEntityName() {
Solution content
		this.reciprocalLinkState = reciprocalLinkState;
		this.targetResourceStateMachine = targetResourceStateMachine;
		this.filter = filter;
		this.title = title;
		this.method = method;
		this.action = action;
		this.relations = relations;
		this.boundToCollection = boundToCollection;
	}
	
	public String getTargetEntityName() {
File
IMTransition.java
Developer's decision
Concatenation
Kind of conflict
Attribute
Chunk
Conflicting content
	public boolean isPseudoState() {
		return filter != null && !filter.equals("") ? filter : "1 eq 1";
	}
	
<<<<<<< HEAD
		return action != null;
	}
	
	public String getMethod() {
		return method;
	}
	
	public String getAction() {
		return action;
	}

	public String getRelations() {
		return relations;
	}
	
	public boolean hasRelations() {
		return relations != null;		
	}
	
	public boolean isBoundToCollection() {
		return boundToCollection;
=======
	public String getTitle() {
		return title;
	}
	
	public String getTitleAssignment() {
		String title = "";
		if(getTitle() != null) {
			title = "title=\"" + getTitle() + "\" ";
		}
		return title;
>>>>>>> b4890467e1c396b8c48f23fc9bc3fa9a05cead24
	}
	
	/**
Solution content
		return filter != null && !filter.equals("") ? filter : "1 eq 1";
	}
	
	public String getTitle() {
		return title;
	}
	
	public String getTitleAssignment() {
		String title = "";
		if(getTitle() != null) {
			title = "title=\"" + getTitle() + "\" ";
		}
		return title;
	}

	public boolean isPseudoState() {
		return action != null;
	}
	
	public String getMethod() {
		return method;
	}
	
	public String getAction() {
		return action;
	}

	public String getRelations() {
		return relations;
	}
	
	public boolean hasRelations() {
		return relations != null;		
	}
	
	public boolean isBoundToCollection() {
		return boundToCollection;
	}
	
	/**
File
IMTransition.java
Developer's decision
Concatenation
Kind of conflict
Attribute
If statement
Method declaration
Method signature
Return statement
Variable