Package it.eng.spagobi.analiticalmodel.document.bo

Examples of it.eng.spagobi.analiticalmodel.document.bo.ObjNote


      String visibility = this.getAttributeAsString(VISIBILITY);
      logger.debug("Parameter [" + VISIBILITY + "] is equal to [" + visibility + "]");
     
      String resultStr = null;
     
      ObjNote objnote = null;
     
      SessionContainer sessCont = getSessionContainer();
      SessionContainer permCont = sessCont.getPermanentContainer();
      IEngUserProfile  profile = (IEngUserProfile)permCont.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
     
      String owner = (String)((UserProfile)profile).getUserId();
      try {
        objnote = DAOFactory.getObjNoteDAO().getExecutionNotesByOwner(obj.getId(), execIdentifier, owner);
      } catch (Exception e) {
        logger.error("Cannot load notes for document [id: " + obj.getId() + ", label: " + obj.getLabel() + ", name: " + obj.getName() + "]", e);
        throw new SpagoBIServiceException(SERVICE_NAME, "Cannot load notes", e);
      }
      String currentNotes = "";
      if (objnote != null) {
        logger.debug("Existing notes found with the same execution identifier");
        byte[] content = objnote.getContent();
        currentNotes = new String(content);
      }
      if (!"INSERT_NOTE".equalsIgnoreCase(MESSAGE) && !currentNotes.equals(previousNotes)) {
        logger.debug("Notes have been created by another user");
        resultStr = "conflict";
View Full Code Here


        objnote.setContent(notes.getBytes());
        objnote.setIsPublic((visibility.equalsIgnoreCase("PUBLIC")?true:false));
        objNoteDAO.modifyExecutionNotes(objnote);
      } else {
        //Insert new note
        objnote = new ObjNote();
        objnote.setContent(notes.getBytes());
        objnote.setExecReq(execIdentifier);
        objnote.setIsPublic((visibility.equalsIgnoreCase("PUBLIC")?true:false));
        objnote.setOwner(owner);
        objNoteDAO.saveExecutionNotes(objectId, objnote);
View Full Code Here

    try {
      // dates are sent to the client using a fixed format, the one returned by GeneralUtilities.getServerDateFormat()
      SimpleDateFormat dateFormat =  new SimpleDateFormat();
      dateFormat.applyPattern(GeneralUtilities.getServerTimeStampFormat());
     
      ObjNote note = (ObjNote) o;
      result = new JSONObject();
      result.put(ID, note.getId() );
      result.put(BIN_ID, note.getBinId() );
      result.put(BIOBJ_ID, note.getBiobjId() );
      result.put(NOTES, note.getNotes() );
      result.put(OWNER, note.getOwner() );
      Date creationDate = note.getCreationDate();
      String creationDateStr = dateFormat.format(creationDate);
      result.put(CREATION_DATE, creationDateStr );
      Date lastChangeDate = note.getLastChangeDate();
      String lastChangeDateStr = dateFormat.format(lastChangeDate);
      result.put(LAST_MODIFICATION_DATE, lastChangeDateStr );
      result.put(VISIBILITY, note.getIsPublic() );
      result.put(DELETABLE, note.getIsDeletable() );
     
    } catch (Throwable t) {
      throw new SerializationException("An error occurred while serializing object: " + o, t);
    } finally {
     
View Full Code Here

      logger.debug("Parameter [" + OWNER + "] is equal to [" + owner + "]");
     
      logger.debug("Deleting notes...");
      String resultStr = null;
      try {
        ObjNote objnote = null;
        try {
          objnote = DAOFactory.getObjNoteDAO().getExecutionNotesByOwner(obj.getId(), execIdentifier, owner);
        } catch (Exception e) {
          logger.error("Cannot load notes for document [id: " + obj.getId() + ", label: " + obj.getLabel() + ", name: " + obj.getName() + "]", e);
          throw new SpagoBIServiceException(SERVICE_NAME, "Cannot erase notes", e);
View Full Code Here

      JSONArray notesListJSON = new JSONArray();
      if (notesList != null){
        updatedNotesList = new ArrayList();
        //define isDeletable flag if the user is equal owner
        for (int i=0; i<notesList.size(); i++){
          ObjNote objNote = (ObjNote)notesList.get(i);
          if (objNote.getOwner().equals(owner)){
            objNote.setIsDeletable(true);
            updatedNotesList.add(objNote);
          }
          else if (objNote.getIsPublic()){           
            objNote.setIsDeletable(false);
            updatedNotesList.add(objNote);
          }                 
        }
         
        notesListJSON = (JSONArray) SerializerFactory.getSerializer("application/json").serialize( updatedNotesList,null );
View Full Code Here

      throw new SpagoBIServiceException(SERVICE_NAME, "Cannot serialize objects into a JSON object", e);
    }
  }
 
  private void getDetailNote(BIObject obj, String execIdentifier, String owner){
    ObjNote objnote = null;
   
    try {
      objnote = DAOFactory.getObjNoteDAO().getExecutionNotesByOwner(obj.getId(), execIdentifier, owner);
    } catch (Exception e) {
      logger.error("Cannot load notes for document [id: " + obj.getId() + ", label: " + obj.getLabel() + ", name: " + obj.getName() + "]", e);
View Full Code Here

 
  /* (non-Javadoc)
   * @see it.eng.spagobi.analiticalmodel.document.dao.IObjNoteDAO#getExecutionNotes(java.lang.Integer, java.lang.String)
   */
  public ObjNote getExecutionNotes(Integer biobjId, String execIdentif) throws Exception {
    ObjNote objNote = null;
    Session aSession = null;
    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
View Full Code Here

 
  /* (non-Javadoc)
   * @see it.eng.spagobi.analiticalmodel.document.dao.IObjNoteDAO#getExecutionNotesByOwner(java.lang.Integer, java.lang.String, java.lang.String)
   */
  public ObjNote getExecutionNotesByOwner(Integer biobjId, String execIdentif, String owner) throws Exception {
    ObjNote objNote = null;
    Session aSession = null;
    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
View Full Code Here

  }

 
 
  private ObjNote toObjNote(SbiObjNotes hibnotes) {
    ObjNote objNote = new ObjNote();
    objNote.setBinId(hibnotes.getSbiBinContents().getId());
    objNote.setBiobjId(hibnotes.getSbiObject().getBiobjId());
    byte[] content = hibnotes.getSbiBinContents().getContent();
    String notes = new String(content);
    objNote.setNotes((notes == null)?"":notes);
    objNote.setContent( hibnotes.getSbiBinContents().getContent());
    objNote.setExecReq(hibnotes.getExecReq());
    objNote.setId(hibnotes.getObjNoteId());
    objNote.setOwner((hibnotes.getOwner()==null)?"":hibnotes.getOwner());
    objNote.setIsPublic((hibnotes.getIsPublic()==null)?true:hibnotes.getIsPublic());
    objNote.setCreationDate(hibnotes.getCreationDate());
    objNote.setLastChangeDate(hibnotes.getLastChangeDate());
    return objNote;
  }
View Full Code Here

   
       String notes = "";
      try
       
        IObjNoteDAO objNoteDAO = DAOFactory.getObjNoteDAO();
        ObjNote objnotes = objNoteDAO.getExecutionNotes(new Integer(objectid), execIdentifier);
       
        if(objnotes!=null){
          byte[] notestemp = objnotes.getContent();
          notes = new BASE64Encoder().encode(notestemp);
          //notes = new String(objnotes.getContent());
        }
       
      } catch (Exception e) {
View Full Code Here

TOP

Related Classes of it.eng.spagobi.analiticalmodel.document.bo.ObjNote

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.