From: <pka...@us...> - 2009-07-24 13:58:30
|
Revision: 367 http://cse-ip.svn.sourceforge.net/cse-ip/?rev=367&view=rev Author: pkasprzak Date: 2009-07-24 13:58:14 +0000 (Fri, 24 Jul 2009) Log Message: ----------- * EntityManager: expose updateAttributes() as WS * RelationManager: new methods for relation management Modified Paths: -------------- trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/EntityManagerImpl.java trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/EntityManagerWS.java trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/RelationManager.java trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/RelationManagerImpl.java Modified: trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/EntityManagerImpl.java =================================================================== --- trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/EntityManagerImpl.java 2009-07-24 11:58:32 UTC (rev 366) +++ trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/EntityManagerImpl.java 2009-07-24 13:58:14 UTC (rev 367) @@ -119,11 +119,6 @@ } // ---------------------------------------------------------------------------------------------------------------- - public int test(de.campussource.cse.core.cdm.EntityType entity) { - return 1; - } - - // ---------------------------------------------------------------------------------------------------------------- public int createProxy(String type) { Entity entity = createProxy(); @@ -152,6 +147,7 @@ } Entity entity = em.find(Entity.class, xmlEntity.getBusId()); + entity.setProxy(false); /* Check for changes (value changed, attribute deleted) */ LinkedList<Attribute> newAttributes = new LinkedList<Attribute>(); Modified: trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/EntityManagerWS.java =================================================================== --- trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/EntityManagerWS.java 2009-07-24 11:58:32 UTC (rev 366) +++ trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/EntityManagerWS.java 2009-07-24 13:58:14 UTC (rev 367) @@ -22,29 +22,33 @@ private EntityManager ejbRef; @WebMethod(operationName = "exists") - public int exists( @WebParam(name = "system") String system, - @WebParam(name = "systemId") String systemId) { + public int exists( @WebParam(name = "system") String system, + @WebParam(name = "systemId") String systemId) { return ejbRef.exists(system, systemId); } @WebMethod(operationName = "persistAccount") - public int persistAccount( @WebParam(name = "account") AccountType account) { + public int persistAccount( @WebParam(name = "account") AccountType account) { return ejbRef.createAccount(account); } @WebMethod(operationName = "persistCourse") - public int persistCourse( @WebParam(name = "course") CourseType course) { + public int persistCourse( @WebParam(name = "course") CourseType course) { return ejbRef.createCourse(course); } @WebMethod(operationName = "persistCategory") - public int persistCategory( @WebParam(name = "category") CategoryType category) { + public int persistCategory( @WebParam(name = "category") CategoryType category) { return ejbRef.createCategory(category); } @WebMethod(operationName = "persistProxy") - public int persistProxy( @WebParam(name = "type") String type) { + public int persistProxy( @WebParam(name = "type") String type) { return ejbRef.createProxy(type); } + @WebMethod(operationName = "updateAttributes") + public boolean updateAttributes(@WebParam(name = "entity") EntityType entity) { + return ejbRef.updateAttributes(entity); + } } Modified: trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/RelationManager.java =================================================================== --- trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/RelationManager.java 2009-07-24 11:58:32 UTC (rev 366) +++ trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/RelationManager.java 2009-07-24 13:58:14 UTC (rev 367) @@ -5,6 +5,9 @@ package de.campussource.cse.core; +import de.campussource.cse.core.pdm.Relation; +import de.campussource.cse.core.pdm.RelationType; +import java.util.List; import javax.ejb.Local; /** @@ -14,9 +17,21 @@ @Local public interface RelationManager { - public void createRelationsFromAccount(int cseId, de.campussource.cse.core.cdm.AccountType account, String system); + public List<Relation> getByParentId(int parentId); - public void createRelationsFromCourse(int cseId, de.campussource.cse.core.cdm.CourseType course, String system); + public List<Relation> getByParentIdAndType(int parentId, RelationType type); - public void createRelationsFromCategory(int cseId, de.campussource.cse.core.cdm.CategoryType category, String system); + public List<Relation> getByChildId(int childId); + + public List<Relation> getByChildIdAndType(int childId, RelationType type); + + public void deleteByChildId(int childId); + + public void deleteByParentId(int parentId); + + public void createRelationsFromAccount(int cseId, de.campussource.cse.core.cdm.AccountType account, String system); + + public void createRelationsFromCourse(int cseId, de.campussource.cse.core.cdm.CourseType course, String system); + + public void createRelationsFromCategory(int cseId, de.campussource.cse.core.cdm.CategoryType category, String system); } Modified: trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/RelationManagerImpl.java =================================================================== --- trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/RelationManagerImpl.java 2009-07-24 11:58:32 UTC (rev 366) +++ trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/RelationManagerImpl.java 2009-07-24 13:58:14 UTC (rev 367) @@ -7,6 +7,7 @@ import de.campussource.cse.core.pdm.EntityType; import de.campussource.cse.core.pdm.Relation; import de.campussource.cse.core.pdm.RelationType; +import java.util.List; import java.util.logging.Logger; import javax.ejb.EJB; import javax.ejb.Stateless; @@ -96,4 +97,53 @@ } } + + // ---------------------------------------------------------------------------------------------------------------- + public List<Relation> getByParentId(int parentId) { + + List<Relation> relations = em.createNamedQuery(Relation.QUERY_getByParentId). setParameter("parentId", parentId). + getResultList(); + return relations; + } + + // ---------------------------------------------------------------------------------------------------------------- + public List<Relation> getByParentIdAndType(int parentId, RelationType type) { + + List<Relation> relations = em.createNamedQuery(Relation.QUERY_getByParentIdAndType).setParameter("parentId", parentId). + getResultList(); + return relations; + } + + // ---------------------------------------------------------------------------------------------------------------- + public List<Relation> getByChildId(int childId) { + + List<Relation> relations = em.createNamedQuery(Relation.QUERY_getByChildId). setParameter("childId", childId). + getResultList(); + return relations; + + } + + // ---------------------------------------------------------------------------------------------------------------- + public List<Relation> getByChildIdAndType(int childId, RelationType type) { + + List<Relation> relations = em.createNamedQuery(Relation.QUERY_getByChildIdAndType). setParameter("childId", childId). + getResultList(); + return relations; + + } + + // ---------------------------------------------------------------------------------------------------------------- + public void deleteByChildId(int childId) { + + em.createNamedQuery(Relation.QUERY_deleteByChildId). setParameter("childId", childId). + executeUpdate(); + } + + // ---------------------------------------------------------------------------------------------------------------- + public void deleteByParentId(int parentId) { + + em.createNamedQuery(Relation.QUERY_deleteByParentId). setParameter("parentId", parentId). + executeUpdate(); + + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |