Package com.esri.gpt.catalog.arcims

Examples of com.esri.gpt.catalog.arcims.ImsMetadataAdminDao


* If an existing record is not located, a new UUID is generated.
* @param schema the evaluated schema for the document being published
* @throws SQLException if a database exception occurs
*/
protected void determineUuid(Schema schema) throws SQLException {
  ImsMetadataAdminDao imsDao = null;
  PublicationRecord rec = getPublicationRecord();
  rec.setFileIdentifier(schema.getMeaning().getFileIdentifier());
 
  if (rec.getUuid().length() == 0) {
    String sEsriDocID = schema.getMeaning().getEsriDocID();
    if (UuidUtil.isUuid(sEsriDocID)) {
      rec.setUuid(sEsriDocID);
    }
  }
 
  if (rec.getUuid().length() == 0) {
    if (imsDao == null) imsDao = new ImsMetadataAdminDao(getRequestContext());
    String sUuid = imsDao.findExistingUuid(rec.getFileIdentifier(),null);
    if (sUuid.length() > 0) {
      rec.setUuid(sUuid);
    }
  }
 
  if (rec.getUuid().length() == 0) {
    String sFile = rec.getSourceFileName();
    if (sFile.endsWith(".xml")) {
      sFile = sFile.substring(0,sFile.length()-4);
      if (UuidUtil.isUuid(sFile)) {
        rec.setUuid(sFile);
      }
    }
  }
 
  if (rec.getUuid().length() == 0) {
    if (imsDao == null) imsDao = new ImsMetadataAdminDao(getRequestContext());
    String sUuid = imsDao.findExistingUuid(null,rec.getSourceUri());
    if (sUuid.length()>0) {
      rec.setUuid(sUuid);
    } else if (UuidUtil.isUuid(rec.getSourceUri())) {
      rec.setUuid(rec.getSourceUri());
    } else {
View Full Code Here


      getPublicationRecord().setApprovalStatus("approved");
    }
  }
 
  // update the administrative table
  ImsMetadataAdminDao imsDao = new ImsMetadataAdminDao(getRequestContext());
  imsDao.setUpdateIndex(getUpdateIndex());
  imsDao.updateRecord(schema,getPublicationRecord());
}
View Full Code Here

   * @throws CatalogIndexException if an exception occurs during delete
   * @throws IOException if accessing index fails
   */
  protected void deleteSourceURIs(Publisher publisher, Iterable<Map.Entry<String,String>> sourceURIs, CatalogRecordListener listener)
      throws ImsServiceException, SQLException, CatalogIndexException, IOException {
    ImsMetadataAdminDao adminDao = new ImsMetadataAdminDao(getRequestContext());
    DeleteMetadataRequest delRequest = new DeleteMetadataRequest(
        this.getRequestContext(),publisher);
    for (Map.Entry<String,String> entry: sourceURIs) {
      if (Thread.currentThread().isInterrupted()) break;
      String uri = entry.getKey();
View Full Code Here

       CSW discovery servlet -> check credentials before returning xml
       Rest -> credentials
       */
     
      // determine the acl
      ImsMetadataAdminDao adminDao = new ImsMetadataAdminDao(getRequestContext());
      String acl = adminDao.queryAclByUUID(uuid);
     
      // determine the xml and update date
      GetDocumentRequest ims = new GetDocumentRequest(getRequestContext(),publisher);
      ims.executeGet(uuid);
      Timestamp updateDate = ims.getUpdateDate();
View Full Code Here

      }
    }
   
    // determine the document uuid (the supplied id could be a gpt uuid or file identifier)
    if (id.length() > 0) {
      ImsMetadataAdminDao dao = new ImsMetadataAdminDao(context);
      uuid = dao.findUuid(id);
      if (!force && ((uuid == null) || (uuid.length() == 0))) {
        String tmpId = UuidUtil.addCurlies(id);
        if (tmpId.length() == 38) {
          uuid = tmpId;
        }
View Full Code Here

    throws Exception {
    if ((ids == null) || (ids.length == 0)) return;
   
    TransactionOptions tOptions = context.getRequestOptions().getTransactionOptions();
    TransactionSummary tSummary = tOptions.getSummary();
    ImsMetadataAdminDao dao = new ImsMetadataAdminDao(context.getRequestContext());
    MmdActionCriteria actionCriteria = new MmdActionCriteria();
    actionCriteria.setActionKey("delete");
    for (String id: ids) {
      String uuid = Val.chkStr(dao.findUuid(id));
      if (uuid.length() == 0) {
        // TODO: throw an exception here?
      } else {
        actionCriteria.getSelectedRecordIdSet().add(uuid);
      }
View Full Code Here

   */
  public String provideOriginalXml(OperationContext context, String id) throws Exception {
    RequestContext reqContext = context.getRequestContext();
   
    // if a file-identifier was passed, determine it's associated uuid
    ImsMetadataAdminDao dao = new ImsMetadataAdminDao(reqContext);
    String docUuid = dao.findUuid(id);
    if (docUuid.length() > 0) {
      id = docUuid;
    } else {
      return "";
    }

    // ensure access to the document
    MetadataAcl acl = new MetadataAcl(reqContext);
    boolean bHasAccess = acl.hasReadAccess(reqContext.getUser(),id);
    if (!bHasAccess) {
      throw new NotAuthorizedException("Access denied.");
    }

    // read and return the xml
    return dao.readXml(id);
  }
View Full Code Here

    String sMsg = "Programming error: The openDocumentUuid was not specified.";
    throw new SchemaException(sMsg);
  }
 
  // determine the owner
  ImsMetadataAdminDao adminDao = new ImsMetadataAdminDao(context);
  setOnBehalfOf(adminDao.queryOwnerDN(sOpenDocumentUuid));
  getLogger().finer("Opening editor for document="+sOpenDocumentUuid+", ownerDn="+getOnBehalfOf());
   
  // prepare the publisher
  getSelectablePublishers().setSelectedKey(getOnBehalfOf());
  Publisher publisher = getSelectablePublishers().selectedAsPublisher(context,false);
View Full Code Here

*/
public void execute() throws Exception {
  int nRows = 0;
  String sAction = getActionCriteria().getActionKey();
  StringSet uuids = getActionCriteria().getSelectedRecordIdSet();
  ImsMetadataAdminDao adminDao = new ImsMetadataAdminDao(getRequestContext());

  // check for approval status updates
  if (sAction.equalsIgnoreCase("setPosted")) {
    nRows = adminDao.updateApprovalStatus(getPublisher(),uuids,MmdEnums.ApprovalStatus.posted);
  } else if (sAction.equalsIgnoreCase("setApproved")) {
    nRows = adminDao.updateApprovalStatus(getPublisher(),uuids,MmdEnums.ApprovalStatus.approved);
  } else if (sAction.equalsIgnoreCase("setIncomplete")) {
    nRows = adminDao.updateApprovalStatus(getPublisher(),uuids,MmdEnums.ApprovalStatus.incomplete);
  } else if (sAction.equalsIgnoreCase("setDisapproved")) {
    nRows = adminDao.updateApprovalStatus(getPublisher(),uuids,MmdEnums.ApprovalStatus.disapproved);
  } else if (sAction.equalsIgnoreCase("setReviewed")) {
    nRows = adminDao.updateApprovalStatus(getPublisher(),uuids,MmdEnums.ApprovalStatus.reviewed);
  }
  getActionResult().setNumberOfRecordsModified(nRows);
  this.hadUnalteredDraftDocuments = adminDao.hadUnalteredDraftDocuments();

  // check for access policy updates
  if (sAction.equalsIgnoreCase("setPolicyPrivate")) {
  } else if (sAction.equalsIgnoreCase("setPolicyPublic")) {
  }
View Full Code Here

* @throws Exception if executing request fails
*/
public void execute(MmdQueryCriteria queryCriteria) throws Exception {
  int nRows = 0;
  String sAction = getActionCriteria().getActionKey();
  ImsMetadataAdminDao adminDao = new ImsMetadataAdminDao(getRequestContext());

  // check for approval status updates
  if (sAction.equalsIgnoreCase("setPosted")) {
    nRows = adminDao.updateApprovalStatus(getPublisher(),queryCriteria,MmdEnums.ApprovalStatus.posted);
  } else if (sAction.equalsIgnoreCase("setApproved")) {
    nRows = adminDao.updateApprovalStatus(getPublisher(),queryCriteria,MmdEnums.ApprovalStatus.approved);
  } else if (sAction.equalsIgnoreCase("setIncomplete")) {
    nRows = adminDao.updateApprovalStatus(getPublisher(),queryCriteria,MmdEnums.ApprovalStatus.incomplete);
  } else if (sAction.equalsIgnoreCase("setDisapproved")) {
    nRows = adminDao.updateApprovalStatus(getPublisher(),queryCriteria,MmdEnums.ApprovalStatus.disapproved);
  } else if (sAction.equalsIgnoreCase("setReviewed")) {
    nRows = adminDao.updateApprovalStatus(getPublisher(),queryCriteria,MmdEnums.ApprovalStatus.reviewed);
  }
  this.hadUnalteredDraftDocuments = adminDao.hadUnalteredDraftDocuments();

  // check for a delete request
  if (sAction.equalsIgnoreCase("delete")) {
    nRows = adminDao.deleteRecord(getPublisher(), queryCriteria);
  }

  // check for an ownership transfer request
  if (sAction.equalsIgnoreCase("transfer")) {
    String sNewOwner = getActionCriteria().getTransferToOwner();
    if (sNewOwner.length() > 0) {
      Publisher newOwner = new Publisher(getRequestContext(), sNewOwner);
      nRows = adminDao.transferOwnership(getPublisher(), queryCriteria, newOwner.getLocalID());
    }
  }

  // check for an assign Acl request
  if (sAction.equalsIgnoreCase("assignAcl")) {
    ArrayList<String> selectedGroups = getActionCriteria().getMetadataAccessPolicy();
    Groups groups = Publisher.buildSelectableGroups(getRequestContext());
    if (selectedGroups != null && selectedGroups.size() > 0) {
      MetadataAcl acl = new MetadataAcl(getRequestContext());
      nRows = adminDao.updateAcl(getPublisher(), queryCriteria, acl.buildAclGroups(groups, selectedGroups));
    } else {
      nRows = adminDao.updateAcl(getPublisher(), queryCriteria, null);
    }
  }

  getActionResult().setNumberOfRecordsModified(nRows);
}
View Full Code Here

TOP

Related Classes of com.esri.gpt.catalog.arcims.ImsMetadataAdminDao

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.