Package it.eng.spagobi.tools.objmetadata.dao

Examples of it.eng.spagobi.tools.objmetadata.dao.IObjMetacontentDAO


      SubObject subObject = (SubObject)iter.next();
      insertSubObject(biobj,subObject,session);

      //  insert metadata associated to subObject
      logger.debug("search for metadata associate to subobject wit ID "+subObject.getId());
      IObjMetacontentDAO objMetacontentDAO = DAOFactory.getObjMetacontentDAO();
      //  get metacontents associated to object
      List metacontents = objMetacontentDAO.loadObjOrSubObjMetacontents(biobj.getId(), subObject.getId());
      for (Iterator iterator = metacontents.iterator(); iterator.hasNext();) {
        ObjMetacontent metacontent = (ObjMetacontent) iterator.next();
        insertObjMetacontent(metacontent, session);
      }
View Full Code Here


      exporter.insertEngine(engine, session);  
      exporter.insertBIObject(biobj, session, false); // do not insert dataset


      logger.debug("Export metadata associated to the object");
      IObjMetacontentDAO objMetacontentDAO = DAOFactory.getObjMetacontentDAO();
      //  get metacontents associated to object
      List metacontents = objMetacontentDAO.loadObjOrSubObjMetacontents(biobj.getId(), null);
      for (Iterator iterator = metacontents.iterator(); iterator.hasNext();) {
        ObjMetacontent metacontent = (ObjMetacontent) iterator.next();
        exporter.insertObjMetacontent(metacontent, session);
      }
View Full Code Here

            for (int i = 0; i < metadatas.size(); i++) {
              // look for binary content mimetype
              ObjMetadata metadata = metadatas.get(i);
              Integer metaId = metadata.getObjMetaId()
              String metaName = metadata.getName();
              IObjMetacontentDAO metacontentDAO = DAOFactory.getObjMetacontentDAO();
              ObjMetacontent metacontent = metacontentDAO.loadObjMetacontent(metaId, biObjId, null);
              //indexes biobject+metadata -->document uid is of type biObjId+"_"+binId
              if(metacontent != null){
                hasMetacontent = true;
                Integer idDomain = metadata.getDataType();
                Domain domain = DAOFactory.getDomainDAO().loadDomainById(idDomain);
View Full Code Here

        IObjNoteDAO objNoteDAO = DAOFactory.getObjNoteDAO();
        objNoteDAO.eraseNotes(obj.getId());

        //delete metadata eventually associated
        List metadata = DAOFactory.getObjMetadataDAO().loadAllObjMetadata();
        IObjMetacontentDAO objMetaContentDAO = DAOFactory.getObjMetacontentDAO();
        if (metadata != null && !metadata.isEmpty()) {
          Iterator it = metadata.iterator();
          while (it.hasNext()) {
            ObjMetadata objMetadata = (ObjMetadata) it.next();
            ObjMetacontent objMetacontent = (ObjMetacontent) DAOFactory.getObjMetacontentDAO().loadObjMetacontent(objMetadata.getObjMetaId(), obj.getId(), null);
            if(objMetacontent!=null){
              objMetaContentDAO.eraseObjMetadata(objMetacontent);
            }
          }
        }     

View Full Code Here

  private static Logger logger = Logger.getLogger(SaveMetadataAction.class);
 
  public void doService() {
    logger.debug("IN");
    try {
      IObjMetacontentDAO dao=DAOFactory.getObjMetacontentDAO();
      dao.setUserProfile(getUserProfile());
      Integer biobjectId = this.getAttributeAsInteger(OBJECT_ID);
      logger.debug("Object id = " + biobjectId);
      Integer subobjectId = null;
      try {
        subobjectId = this.getAttributeAsInteger(SUBOBJECT_ID);
      } catch (NumberFormatException e) {}
      logger.debug("Subobject id = " + subobjectId);
      String jsonEncodedMetadata = getAttributeAsString( METADATA );
      try {
        CharsetDecoder decoder=Charset.forName("UTF-8").newDecoder();
        jsonEncodedMetadata=decoder.decode(ByteBuffer.wrap(jsonEncodedMetadata.getBytes())).toString();
      } catch(Throwable t) {
        // firefox
      }

     
      logger.debug(METADATA + " = [" + jsonEncodedMetadata + "]");
      JSONArray metadata = new JSONArray(jsonEncodedMetadata);
      for (int i = 0; i < metadata.length(); i++) {         
        JSONObject aMetadata = metadata.getJSONObject(i);
        Integer metadataId = aMetadata.getInt(MetadataJSONSerializer.METADATA_ID);
        String text = aMetadata.getString(MetadataJSONSerializer.TEXT);
        ObjMetacontent aObjMetacontent = dao.loadObjMetacontent(metadataId, biobjectId, subobjectId);
        if (aObjMetacontent == null) {
          logger.debug("ObjMetacontent for metadata id = " + metadataId + ", biobject id = " + biobjectId +
              ", subobject id = " + subobjectId + " was not found, creating a new one...");
          aObjMetacontent = new ObjMetacontent();
          aObjMetacontent.setObjmetaId(metadataId);
          aObjMetacontent.setBiobjId(biobjectId);
          aObjMetacontent.setSubobjId(subobjectId);
          aObjMetacontent.setContent(text.getBytes("UTF-8"));
          aObjMetacontent.setCreationDate(new Date());
          aObjMetacontent.setLastChangeDate(new Date());
          dao.insertObjMetacontent(aObjMetacontent);
        } else {
          logger.debug("ObjMetacontent for metadata id = " + metadataId + ", biobject id = " + biobjectId +
              ", subobject id = " + subobjectId + " was found, it will be modified...");
          aObjMetacontent.setContent(text.getBytes("UTF-8"));
          aObjMetacontent.setLastChangeDate(new Date());
          dao.modifyObjMetacontent(aObjMetacontent);
        }

      }   
      /*
      *indexes biobject by modifying document in index
View Full Code Here

      SbiSubObjects hibSubobject = (SbiSubObjects)aSession.load(SbiSubObjects.class, idSub);
      SbiBinContents hibBinCont = hibSubobject.getSbiBinContents();
     
      //delete metadata eventually associated
      List metadata = DAOFactory.getObjMetadataDAO().loadAllObjMetadata();
      IObjMetacontentDAO objMetaContentDAO = DAOFactory.getObjMetacontentDAO();
      if (metadata != null && !metadata.isEmpty()) {
        Iterator it = metadata.iterator();
        while (it.hasNext()) {
          ObjMetadata objMetadata = (ObjMetadata) it.next();
          ObjMetacontent objMetacontent = (ObjMetacontent) DAOFactory.getObjMetacontentDAO().loadObjMetacontent(objMetadata.getObjMetaId(), hibSubobject.getSbiObject().getBiobjId(), hibSubobject.getSubObjId());
          if(objMetacontent!=null){
            objMetaContentDAO.eraseObjMetadata(objMetacontent);
          }
        }
      }     
     
      aSession.delete(hibSubobject);
View Full Code Here

TOP

Related Classes of it.eng.spagobi.tools.objmetadata.dao.IObjMetacontentDAO

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.