Author: DavidK Date: 2010-02-25 14:57:07 +0100 (Thu, 25 Feb 2010) New Revision: 1871 Modified: trunk/server/elvysCommons/src/elvys/server/bl/permTypesRel/PermittedSchedulingBL.java trunk/server/elvysCommons/src/elvys/server/bl/permTypesRel/PermittedSchedulingBLImpl.java trunk/server/elvysCommons/src/elvys/server/bl/permTypesRel/PermittedSchedulingBLImplTest.java trunk/server/elvysCommons/src/elvys/server/bl/planning/PlanningBL.java trunk/server/elvysCommons/src/elvys/server/bl/planning/PlanningBLImpl.java trunk/server/elvysCommons/src/elvys/server/bl/planning/PlanningBLTest.java Log: updated Business Logic - for permitted types & for planning Modified: trunk/server/elvysCommons/src/elvys/server/bl/permTypesRel/PermittedSchedulingBL.java =================================================================== --- trunk/server/elvysCommons/src/elvys/server/bl/permTypesRel/PermittedSchedulingBL.java 2010-02-25 13:54:38 UTC (rev 1870) +++ trunk/server/elvysCommons/src/elvys/server/bl/permTypesRel/PermittedSchedulingBL.java 2010-02-25 13:57:07 UTC (rev 1871) @@ -36,6 +36,20 @@ public List<LayoutPosition> getListOfFullyPermittedLayoutPositions(Integer compId, Integer permTypeCount) throws ExecuteException; /** + * Returns list of LayoutPosition, that contain given content type as permitted + * @param compId company id + * @param contType id of content type + * @return list of layouts + * @throws ExecuteException + */ + public List<LayoutPosition> getListOfPositionsHavingContentTypeMakeSession(Integer compId, Integer contType) throws ExecuteException; + + /** + * @see PermittedSchedulingBL#getListOfPositionsHavingContentTypeMakeSession(Integer, Integer) + */ + public List<LayoutPosition> getListOfPositionsHavingContentType(Integer compId, Integer contType, Session sess) throws ExecuteException; + + /** * Returns permitted types to the company set by given companyID * @param compId id of the company * @return list of ContentType object Modified: trunk/server/elvysCommons/src/elvys/server/bl/permTypesRel/PermittedSchedulingBLImpl.java =================================================================== --- trunk/server/elvysCommons/src/elvys/server/bl/permTypesRel/PermittedSchedulingBLImpl.java 2010-02-25 13:54:38 UTC (rev 1870) +++ trunk/server/elvysCommons/src/elvys/server/bl/permTypesRel/PermittedSchedulingBLImpl.java 2010-02-25 13:57:07 UTC (rev 1871) @@ -3,6 +3,7 @@ import java.util.List; import org.apache.log4j.Logger; +import org.bouncycastle.asn1.ess.ContentIdentifier; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.Transaction; @@ -10,11 +11,16 @@ import cz.elvys.commons.utils.CommonUtils; import cz.elvys.commons.utils.HibUtils; +import cz.elvys.webServer.HIBgen.Category; import cz.elvys.webServer.HIBgen.Company; import cz.elvys.webServer.HIBgen.ContentType; +import cz.elvys.webServer.HIBgen.FrameContent; import cz.elvys.webServer.HIBgen.LayoutPosition; +import cz.elvys.webServer.HIBgen.Timeline; import cz.elvys.webServer.db.InitSessionFactory; import cz.elvys.webServer.toSpring.exception.ExecuteException; +import elvys.server.bl.Fact; +import elvys.server.bl.planning.PlanningBL; public class PermittedSchedulingBLImpl implements PermittedSchedulingBL { @@ -27,6 +33,7 @@ private static final String CANNOT_DELETE_TYPE_FROM_COMPANY = "Cannot forbid the company to use chosen type."; private static final String CANNOT_LIST_COMPANY_REQ_TYPES = "Cannot list permitted types of the company."; private static final String CANNOT_GET_COUNT_FULL_POS = "Cannot get list of positions with all permitted types"; + private static final String CANNOT_GET_POS_WITH_CT = "Cannot get list of positions having permitted specified content type"; static { log = Logger.getLogger(PermittedSchedulingBLImpl.class); } @@ -37,11 +44,10 @@ public void addCompanyPermittedType(Integer compId, Integer ctId) throws ExecuteException { // company permitted types - // !!!! this uses new session, but i think, it's OK :)) List<ContentType> types = this.getCompanyPermittedTypesMakeSession(compId); Integer countOfTypes = types.size(); - // check that company can't use this content yet + // check that company doesn't use this content yet for(ContentType type: types) { if (type.getId().equals(ctId)) { String message = CommonUtils.prepareErrorMessage( @@ -89,21 +95,55 @@ @Override public void removeCompanyPermittedType(Integer compId, Integer ctId) throws ExecuteException { + + // start transaction Session sess = InitSessionFactory.getInstance().getCurrentSession(); Transaction tx = HibUtils.startTx(sess); - // TODO, slozite - // zahrne to take mozne mazani timelines, ... try { + //////////////////// + // 1. delete each planning in the company which is of this type + PlanningBL bl = Fact.getPlanningBL(); + List<Timeline> timelines = bl.listTimelinesOfTypeForCompany(compId, ctId, sess); + // TODO az bude optimalizacni iterace, tak optimalizovat + // ikdyz stejne se to bude volat jednou za rok... + for (Timeline tl: timelines) { + FrameContent ctnt = tl.getFrameContent(); + sess.delete(tl); + sess.delete(ctnt); + } + + ///////////////////// + // 2. upgrade all layouts + Query q = sess.createQuery("from ContentType where id=:id"); + q.setInteger("id", ctId); + ContentType ctToRemove = (ContentType) q.list().get(0); + + List<LayoutPosition> positions = getListOfPositionsHavingContentType(compId, ctId, sess); + for (LayoutPosition lp: positions) { + lp.getContentTypes().remove(ctToRemove); + } + + + ///////////////////// + // 3. delete files ? disabled now + + ///////////////////// + // 4. add to company + // add new ContentType to the company + q = sess.createQuery("from Company where id=:id"); + q.setInteger("id", compId); + Company comp = (Company) q.list().get(0); + comp.getContentTypes().remove(ctToRemove); + tx.commit(); } catch (Exception e) { tx.rollback(); String message = CommonUtils.prepareErrorMessage( - CANNOT_DELETE_TYPE_FROM_COMPANY, - "company", compId, "typeID", ctId); - log.error(message,e); + CANNOT_DELETE_TYPE_FROM_COMPANY, "company", compId, "typeID", ctId); + log.error(message, e); throw new ExecuteException(message,e); } } @@ -113,17 +153,14 @@ @Override public List<ContentType> getCompanyPermittedTypesMakeSession(Integer compId) throws ExecuteException { Session sess= InitSessionFactory.getInstance().getCurrentSession(); - Transaction tx = sess.beginTransaction(); + Transaction tx = HibUtils.startTx(sess); List<ContentType> types = null; try { types = getCompanyPermittedTypes(compId, sess); tx.commit(); } catch (Exception e) { tx.rollback(); - String message = CommonUtils.prepareErrorMessage( - CANNOT_LIST_COMPANY_REQ_TYPES, "companyID", compId); - log.error(message,e); - throw new ExecuteException(message,e); + throw new ExecuteException(e); } return types; } @@ -145,7 +182,9 @@ query.setInteger("id", compId); types = query.list(); } catch(Exception e) { - throw new ExecuteException(e); + String message = CommonUtils.prepareErrorMessage( + CANNOT_LIST_COMPANY_REQ_TYPES, "companyID", compId); + throw new ExecuteException(message,e); } return types; @@ -197,7 +236,7 @@ /** - * @see elvys.server.bl.permTypesRel.PermittedSchedulingBLImpl#getListOfFullyPermittedLayoutPositions(java.lang.Integer, java.lang.Integer) + * @see elvys.server.bl.permTypesRel.PermittedSchedulingBL#getListOfFullyPermittedLayoutPositions(java.lang.Integer, java.lang.Integer) */ private List<LayoutPosition> getListOfFullyPermittedLayoutPositions(Integer compId, Integer permTypeCount, Session sess, Transaction tx) throws ExecuteException { List<LayoutPosition> positions = null; @@ -218,9 +257,7 @@ return positions; } - /* (non-Javadoc) - * @see elvys.server.bl.permTypesRel.PermittedSchedulingBL#asPermitted(java.lang.String, int) - */ + @Override public ContentType asPermitted(String type, int compId) throws ExecuteException { List<ContentType> types = getCompanyPermittedTypesMakeSession(compId); for (ContentType ct: types) { @@ -232,4 +269,42 @@ } + + @Override + public List<LayoutPosition> getListOfPositionsHavingContentTypeMakeSession( + Integer compId, Integer contType) throws ExecuteException { + Session sess= InitSessionFactory.getInstance().getCurrentSession(); + Transaction tx = HibUtils.startTx(sess); + List<LayoutPosition> positions = null; + try { + positions = getListOfPositionsHavingContentType(compId, contType, sess); + tx.commit(); + } catch (Exception e) { + tx.rollback(); + throw new ExecuteException(e); + } + return positions; + } + + + + @Override + public List<LayoutPosition> getListOfPositionsHavingContentType( + Integer compId, Integer contType, Session sess) throws ExecuteException { + List<LayoutPosition> positions = null; + try { + Query query = sess.createQuery( + "FROM LayoutPosition as pos " + + "where pos.layout.company.id = :companyId " + + " and :contentTypeId in elements(pos.contentTypes)"); + query.setInteger("companyId", compId); + query.setInteger("contentTypeId", contType); + positions = query.list(); + } catch (Exception e) { + String message = CommonUtils.prepareErrorMessage( + CANNOT_GET_POS_WITH_CT, "compId", compId, "conType", contType); + throw new ExecuteException(message,e); + } + return positions; + } } \ No newline at end of file Modified: trunk/server/elvysCommons/src/elvys/server/bl/permTypesRel/PermittedSchedulingBLImplTest.java =================================================================== --- trunk/server/elvysCommons/src/elvys/server/bl/permTypesRel/PermittedSchedulingBLImplTest.java 2010-02-25 13:54:38 UTC (rev 1870) +++ trunk/server/elvysCommons/src/elvys/server/bl/permTypesRel/PermittedSchedulingBLImplTest.java 2010-02-25 13:57:07 UTC (rev 1871) @@ -1,13 +1,17 @@ package elvys.server.bl.permTypesRel; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + import java.util.List; import org.junit.Ignore; import org.junit.Test; -import static org.junit.Assert.*; import cz.elvys.webServer.HIBgen.ContentType; import cz.elvys.webServer.HIBgen.LayoutPosition; +import elvys.server.bl.Factory; public class PermittedSchedulingBLImplTest { private static final Integer compId = 4; @@ -47,9 +51,24 @@ + permTypeCount + " permitted types: "+ positions.size()); } - //@Ignore @Test - public void addOneType() throws Exception { + public void testGetListOfPositionsHavingContentType() throws Exception { + int found = 0; + + // content types + PermittedSchedulingBL bl = Factory.getPermittedSchedulingBL(); + List<ContentType> types = bl.getCompanyPermittedTypesMakeSession(compId); + for (ContentType ct: types) { + List<LayoutPosition> positions = bl.getListOfPositionsHavingContentTypeMakeSession(compId, ct.getId()); + assertLayoutPositions(positions); + found+=positions.size(); + } + assertTrue(found > 0); + } + + @Ignore + @Test + public void WRITINGaddOneType() throws Exception { PermittedSchedulingBLImpl impl = new PermittedSchedulingBLImpl(); List<ContentType> types = impl.getCompanyPermittedTypesMakeSession(compId); impl.addCompanyPermittedType(compId, contentIdToAdd); @@ -59,7 +78,7 @@ @Ignore @Test - public void remOneType() throws Exception { + public void WRITINGremOneType() throws Exception { PermittedSchedulingBLImpl impl = new PermittedSchedulingBLImpl(); List<ContentType> types = impl.getCompanyPermittedTypesMakeSession(compId); impl.removeCompanyPermittedType(compId, contentIdToAdd); @@ -67,10 +86,45 @@ printCompPermTypes(types); } + + + + + + private void printCompPermTypes(List<ContentType> types) { for (ContentType ct : types) { System.out.print(ct.getType()+"; "); } System.out.println(); } + + + + + + private void assertLayoutPositions(List<LayoutPosition> positions) { + assertTrue(positions != null && positions.size() > 0); + for (LayoutPosition pos: positions) { + assertLayoutPosition(pos); + } + } + + private void assertLayoutPositionsEmtyable(List<LayoutPosition> positions) { + assertTrue(positions != null); + for (LayoutPosition pos: positions) { + assertLayoutPosition(pos); + } + } + + private void assertLayoutPosition(LayoutPosition pos) { + assertTrue(pos != null); + assertTrue(pos.getId() != null ); + assertTrue(pos.getHeight() >= 0 ); + assertTrue(pos.getWidth() >= 0 ); + assertTrue(pos.getXpos() >= 0 ); + assertTrue(pos.getYpos() >= 0 ); + } + + } Modified: trunk/server/elvysCommons/src/elvys/server/bl/planning/PlanningBL.java =================================================================== --- trunk/server/elvysCommons/src/elvys/server/bl/planning/PlanningBL.java 2010-02-25 13:54:38 UTC (rev 1870) +++ trunk/server/elvysCommons/src/elvys/server/bl/planning/PlanningBL.java 2010-02-25 13:57:07 UTC (rev 1871) @@ -123,7 +123,25 @@ public List<Timeline> listFutureTimelinesForCatPlan(Integer planningId, Session sess) throws ExecuteException; + /** + * Returns list of company plannings, that are of given contet_type + * Fetches: type-specific frame_content (not file, not modif. user) + * @param companyId id of the company + * @param contentId id of the content + * @return List of timelines + * @throws ExecuteException + */ + public List<Timeline> listTimelinesOfTypeForCompanyMakeSession(Integer companyId, Integer contentId) throws ExecuteException; + + /** + * @see PlanningBL#listTimelinesOfTypeForCompanyMakeSession(Integer, Integer) + */ + public List<Timeline> listTimelinesOfTypeForCompany(Integer companyId, Integer contentId, Session sess) throws ExecuteException; + + + + /** * Returns actual planning for the selected categoryPlanning. <br/> * Fetches type-specific frame_content, file, user(modif.). * @param catPlanningId id of the CategoryPlanning object. Modified: trunk/server/elvysCommons/src/elvys/server/bl/planning/PlanningBLImpl.java =================================================================== --- trunk/server/elvysCommons/src/elvys/server/bl/planning/PlanningBLImpl.java 2010-02-25 13:54:38 UTC (rev 1870) +++ trunk/server/elvysCommons/src/elvys/server/bl/planning/PlanningBLImpl.java 2010-02-25 13:57:07 UTC (rev 1871) @@ -13,6 +13,7 @@ import cz.elvys.commons.utils.CommonUtils; import cz.elvys.commons.utils.HibUtils; +import cz.elvys.webServer.HIBgen.CategoryPlanning; import cz.elvys.webServer.HIBgen.ContentType; import cz.elvys.webServer.HIBgen.FrameContent; import cz.elvys.webServer.HIBgen.Layout; @@ -230,8 +231,14 @@ List<Timeline> timelines = getTimelinesGeneric( - scheduleFrom, scheduleTo, panelPlanning, panelOrderNum, - pos, sess); + scheduleFrom, + scheduleTo, + panelPlanning, + panelOrderNum, + pos, + true, /*fetch user*/ + null, /*contentTypeId*/ + sess); return timelines; } @@ -263,7 +270,14 @@ // actual timelines of selected panel List<Timeline> timelines = getTimelinesGeneric( - now, now, panelPlanningId, panelOrd, null, sess); + now, + now, + panelPlanningId, + panelOrd, + null, + true, /*fetch user*/ + null, /*contentTypeId*/ + sess); // layout position count Layout layout = lbl.getLayoutByCategoryPlanningId(panelPlanningId, sess); @@ -329,7 +343,14 @@ // actual timelines of selected panel timelines = getTimelinesGeneric( - now, null, planningId, panelOrd, null, sess); + now, + null, + planningId, + panelOrd, + null, + true, /*fetch user*/ + null, /*contentTypeId*/ + sess); } catch (Exception e) { String message = CommonUtils.prepareErrorMessage( @@ -366,7 +387,14 @@ Date now = new Date(); // actual timelines of selected panel timelines = getTimelinesGeneric( - now, null, planningId, null, null, sess); + now, + null, + planningId, + null, + null, + true, /*fetch user*/ + null, /*contentTypeId*/ + sess); } catch (Exception e) { String message = CommonUtils.prepareErrorMessage( CANNOT_LIST_FUTURE_TIMELINES, "planningId", planningId); @@ -376,6 +404,57 @@ } + + @Override + public List<Timeline> listTimelinesOfTypeForCompanyMakeSession( + Integer companyId, Integer contentId) throws ExecuteException { + Session sess = InitSessionFactory.getInstance().getCurrentSession(); + Transaction tx = HibUtils.startTx(sess); + List<Timeline> timelines = null; + try { + timelines = listTimelinesOfTypeForCompany(companyId, contentId, sess); + tx.commit(); + } catch (Exception e) { + tx.rollback(); + throw new ExecuteException(e); + } + return timelines; + } + + + @Override + public List<Timeline> listTimelinesOfTypeForCompany(Integer companyId, + Integer contentId, Session sess) throws ExecuteException { + List<Timeline> timelines = new ArrayList<Timeline>(); + try { + // list all plannings + List<CategoryPlanning> plannings = cbl.listCatPlanningsForCompany(companyId, sess); + + // get timelines for each category plannings + for (CategoryPlanning cp: plannings) { + List<Timeline> cpTimelines = + getTimelinesGeneric( + null, /*from*/ + null, /*to*/ + cp.getId(), /*categoryPlanning*/ + null, /*panelOrderNum*/ + null, /*position*/ + false, /*fetch user*/ + contentId, /*contentTypeId*/ + sess); + timelines.addAll(cpTimelines); + } + + } catch (Exception e) { + String message = CommonUtils.prepareErrorMessage( + CANNOT_LIST_FUTURE_TIMELINES, "contentId", contentId, + "companyId", companyId); + throw new ExecuteException(message,e); + } + return timelines; + } + + @Override public List<Map<Integer,Timeline>> getActualPlanningForCategoryMakeSession( @@ -403,7 +482,14 @@ // actual timelines of selected panel List<Timeline> timelines = getTimelinesGeneric( - now, now, catPlanningId, null, null, sess); + now, + now, + catPlanningId, + null, + null, + true, /*fetch user*/ + null, /*contentTypeId*/ + sess); // layout position count Layout layout = lbl.getLayoutByCategoryPlanningId(catPlanningId, sess); @@ -470,7 +556,14 @@ try { // actual timelines of selected panel List<Timeline> timelines = getTimelinesGeneric( - from, to, catPlanningId, null, null, sess); + from, + to, + catPlanningId, + null, + null, + true, /*fetch user*/ + null, /*contentTypeId*/ + sess); // layout position count Layout layout = lbl.getLayoutByCategoryPlanningId(catPlanningId, sess); @@ -513,16 +606,24 @@ * Fetches: frame_content, content_type, some frame_content child, may fetch Document, Video when needed * @param scheduleFrom timelines in the result end all after scheduleFrom. CAN be NULL - then there is no "from" boundary * @param scheduleTo timelines in the result begin before scheduleTo. CAN be NULL - then there is no "to" boundary - * @param panelPlanning id of the planning - NOT NULL + * @param panelPlanning id of the planning - CAN be NULL * @param panelOrderNum id of the panel order position - CAN be NULL - then returns timelines for the whole cat. planning * @param pos id of the layout position - returns only timelines for the specified position + * @param fetchUser whether fetch user or not - true/false + * @param contentTypeId id of the content type to load - CAN be NULL * @param sess hibernate session * @return list of timelines.. * @throws ExecuteException exception */ - private List<Timeline> getTimelinesGeneric(Date scheduleFrom, - Date scheduleTo, Integer panelPlanning, Integer panelOrderNum, - Integer pos, Session sess) throws ExecuteException { + private List<Timeline> getTimelinesGeneric( + Date scheduleFrom, + Date scheduleTo, + Integer panelPlanning, + Integer panelOrderNum, + Integer pos, + Boolean fetchUser, + Integer contentTypeId, + Session sess) throws ExecuteException { if (panelPlanning == null) throw new NullPointerException("panelPlanning"); @@ -532,8 +633,11 @@ "from Timeline timeline " + "inner join fetch timeline.frameContent frc " + "inner join fetch timeline.frameContent.contentType ctype " + - "inner join fetch timeline.user user " + - "where timeline.panel.id.planning=:panelPlanning " + + ( fetchUser ? + "inner join fetch timeline.user user " : "") + + "where 1=1 and " + + ( panelPlanning != null ? + " timeline.panel.id.planning=:panelPlanning " : "") + ( scheduleFrom != null ? " and :start < timeline.showEnd " : "") + ( scheduleTo != null ? @@ -542,8 +646,12 @@ " and timeline.layoutPos=:pos " : "") + ( panelOrderNum != null ? " and timeline.panel.id.orderNum=:panelOrder " : "" ) + + ( contentTypeId != null ? + " and ctype.id = :contentTypeId " : "") + "order by timeline.showStart "); - q.setInteger("panelPlanning", panelPlanning); + if (panelPlanning != null) { + q.setInteger("panelPlanning", panelPlanning); + } if (pos != null) { q.setInteger("pos", pos); } @@ -556,6 +664,9 @@ if (scheduleTo != null) { q.setTimestamp("end", scheduleTo); } + if (contentTypeId != null) { + q.setInteger("contentTypeId", contentTypeId); + } timelines = q.list(); } catch (Exception e) { String message = CommonUtils.prepareErrorMessage(CANT_LOAD_PLANNING_LIST, Modified: trunk/server/elvysCommons/src/elvys/server/bl/planning/PlanningBLTest.java =================================================================== --- trunk/server/elvysCommons/src/elvys/server/bl/planning/PlanningBLTest.java 2010-02-25 13:54:38 UTC (rev 1870) +++ trunk/server/elvysCommons/src/elvys/server/bl/planning/PlanningBLTest.java 2010-02-25 13:57:07 UTC (rev 1871) @@ -14,15 +14,18 @@ import cz.elvys.webServer.HIBgen.Category; import cz.elvys.webServer.HIBgen.CategoryPlanning; import cz.elvys.webServer.HIBgen.ContentType; +import cz.elvys.webServer.HIBgen.Elvys; import cz.elvys.webServer.HIBgen.ElvysGroup; import cz.elvys.webServer.HIBgen.Layout; import cz.elvys.webServer.HIBgen.Panel; import cz.elvys.webServer.HIBgen.Timeline; import elvys.server.bl.Fact; +import elvys.server.bl.Factory; import elvys.server.bl.categrel.CategoryBL; import elvys.server.bl.elvysrel.ElvysBL; import elvys.server.bl.layoutrel.LayoutBL; +import elvys.server.bl.permTypesRel.PermittedSchedulingBL; import static org.junit.Assert.*; public class PlanningBLTest { @@ -35,6 +38,7 @@ private static CategoryBL cbl; private static ElvysBL ebl; private static LayoutBL lbl; + private static PermittedSchedulingBL psbl; @BeforeClass public static void init() { @@ -42,6 +46,7 @@ cbl = Fact.getCategoryBL(); ebl = Fact.getElvysBL(); lbl = Fact.getLayoutBL(); + psbl = Factory.getPermittedSchedulingBL(); } @@ -164,6 +169,22 @@ assertTrue(foundCount > 0); } + @Test + public void testListTimelinesOfTypeForCompany() throws Exception { + int found = 0; + + List<ContentType> companyTypes = psbl.getCompanyPermittedTypesMakeSession(companyId); + for (ContentType ct: companyTypes) { + List<Timeline> timelines = pbl.listTimelinesOfTypeForCompanyMakeSession(companyId, ct.getId()); + + assertTimelinesEmtyable(timelines, false); + found+=timelines.size(); + } + assertTrue(found >0); + } + + + @Test public void testGetActualCategoryPlanning() throws Exception { // number of existing "now-planned" timelines @@ -283,4 +304,39 @@ } + + + + + + + + + + private void assertTimelines(List<Timeline> timelines, boolean checkUser) { + assertTrue(timelines != null && timelines.size() > 0); + for (Timeline tl: timelines) { + assertTimeline(tl, checkUser); + } + } + + private void assertTimelinesEmtyable(List<Timeline> timelines, boolean checkUser) { + assertTrue(timelines != null); + for (Timeline tl: timelines) { + assertTimeline(tl, checkUser); + } + } + + private void assertTimeline(Timeline tl, boolean checkUser) { + assertTrue(tl != null); + assertTrue(tl.getId() != 0 ); + assertTrue(tl.getFrameContent().getId() != null); + assertTrue(tl.getFrameContent().getContentType().getId() != null); + assertTrue(tl.getFrameContent().getContentType().getType() != null); + if (checkUser) { + assertTrue(tl.getUser().getId() != null); + assertTrue(tl.getUser().getUsername() != null); + assertTrue(tl.getUser().getEmail() != null); + } + } }