Package com.agiletec.aps.system.common.entity.model

Examples of com.agiletec.aps.system.common.entity.model.IApsEntity


   
    public JAXBMessageType getMessageType(Properties properties) throws ApiException, Throwable {
        JAXBMessageType jaxbMessageType = null;
        try {
            String typeCode = properties.getProperty("typeCode");
            IApsEntity masterMessageType = this.getMessageManager().getEntityPrototype(typeCode);
            if (null == masterMessageType) {
                throw new ApiException(IApiErrorCodes.API_VALIDATION_ERROR,
            "Message type with code '" + typeCode + "' does not exist", Response.Status.CONFLICT);
            }
            jaxbMessageType = new JAXBMessageType(masterMessageType);
View Full Code Here


   
    public StringApiResponse addMessageType(JAXBMessageType jaxbMessageType) throws Throwable {
        StringApiResponse response = new StringApiResponse();
        try {
            String typeCode = jaxbMessageType.getTypeCode();
            IApsEntity masterMessageType = this.getMessageManager().getEntityPrototype(typeCode);
            if (null != masterMessageType) {
                throw new ApiException(IApiErrorCodes.API_VALIDATION_ERROR,
            "Message type with code '" + typeCode + "' already exists", Response.Status.CONFLICT);
            }
            if (typeCode == null || typeCode.length() != 3) {
                throw new ApiException(IApiErrorCodes.API_VALIDATION_ERROR,
            "Invalid type code - '" + typeCode + "'", Response.Status.CONFLICT);
            }
            Map<String, AttributeInterface> attributes = this.getMessageManager().getEntityAttributePrototypes();
            IApsEntity messageType = jaxbMessageType.buildEntityType(this.getMessageManager().getEntityClass(), attributes);
            ((IEntityTypesConfigurer) this.getMessageManager()).addEntityPrototype(messageType);
            response.setResult(IResponseBuilder.SUCCESS, null);
        } catch (ApiException ae) {
            response.addErrors(ae.getErrors());
            response.setResult(IResponseBuilder.FAILURE, null);
View Full Code Here

   
    public StringApiResponse updateMessageType(JAXBMessageType jaxbMessageType) throws Throwable {
        StringApiResponse response = new StringApiResponse();
        try {
            String typeCode = jaxbMessageType.getTypeCode();
            IApsEntity masterMessageType = this.getMessageManager().getEntityPrototype(typeCode);
            if (null == masterMessageType) {
                throw new ApiException(IApiErrorCodes.API_VALIDATION_ERROR,
            "Message type with code '" + typeCode + "' doesn't exist", Response.Status.CONFLICT);
            }
            Map<String, AttributeInterface> attributes = this.getMessageManager().getEntityAttributePrototypes();
            IApsEntity messageType = jaxbMessageType.buildEntityType(this.getMessageManager().getEntityClass(), attributes);
            ((IEntityTypesConfigurer) this.getMessageManager()).updateEntityPrototype(messageType);
            response.setResult(IResponseBuilder.SUCCESS, null);
        } catch (ApiException ae) {
            response.addErrors(ae.getErrors());
            response.setResult(IResponseBuilder.FAILURE, null);
View Full Code Here

    }
   
    public void deleteMessageType(Properties properties) throws ApiException, Throwable {
        try {
            String typeCode = properties.getProperty("typeCode");
            IApsEntity masterMessageType = this.getMessageManager().getEntityPrototype(typeCode);
            if (null == masterMessageType) {
                throw new ApiException(IApiErrorCodes.API_VALIDATION_ERROR,
            "Message type with code '" + typeCode + "' doesn't exist", Response.Status.CONFLICT);
            }
            EntitySearchFilter filter = new EntitySearchFilter(IEntityManager.ENTITY_TYPE_CODE_FILTER_KEY, false, typeCode, false);
View Full Code Here

            String username = jaxbMessage.getId();
            if (null != this.getMessageManager().getMessage(username)) {
                throw new ApiException(IApiErrorCodes.API_PARAMETER_VALIDATION_ERROR,
            "Message of user '" + username + "' already exist", Response.Status.CONFLICT);
            }
            IApsEntity profilePrototype = this.getMessageManager().getEntityPrototype(jaxbMessage.getTypeCode());
            if (null == profilePrototype) {
                throw new ApiException(IApiErrorCodes.API_VALIDATION_ERROR,
            "User Message type with code '" + jaxbMessage.getTypeCode() + "' does not exist", Response.Status.CONFLICT);
            }
            Message message = (Message) jaxbMessage.buildEntity(profilePrototype, null);
View Full Code Here

    super.validate();
    try {
      String mailAttrName = this.getMailAttrName();
      boolean hasMailAddress = mailAttrName != null && mailAttrName.length() > 0;
      if (hasMailAddress) {
        IApsEntity prototype = this.getMessageManager().getEntityPrototype(this.getTypeCode());
        Object attribute = prototype.getAttribute(mailAttrName);
        if (attribute == null || !(attribute instanceof ITextAttribute)) {
          this.addFieldError("mailAttrName", this.getText("Errors.mailAttrName.notValid"));
        }
      }
      boolean isNotifiable = this.getNotifiable() != null && this.getNotifiable().booleanValue();
View Full Code Here

  }
 
  public List<AttributeInterface> getTextAttributes() {
    if (this._textAttributes == null) {
      this._textAttributes = new ArrayList<AttributeInterface>();
      IApsEntity prototype = this.getMessageManager().getEntityPrototype(this.getTypeCode());
      for (AttributeInterface attribute : prototype.getAttributeList()) {
        if (attribute instanceof ITextAttribute) {
          this._textAttributes.add(attribute);
        }
      }
    }
View Full Code Here

   */
  protected void initSmallMessageTypes() {
    Map<String, SmallMessageType> smallMessageTypes = new HashMap<String, SmallMessageType>(this.getEntityTypes().size());
    List<IApsEntity> types = new ArrayList<IApsEntity>(this.getEntityTypes().values());
    for (int i=0; i<types.size(); i++) {
      IApsEntity type = types.get(i);
      SmallMessageType smallMessageType = new SmallMessageType();
      smallMessageType.setCode(type.getTypeCode());
      smallMessageType.setDescr(type.getTypeDescr());
      smallMessageTypes.put(smallMessageType.getCode(), smallMessageType);
    }
    this.setSmallMessageTypesMap(smallMessageTypes);
  }
View Full Code Here

    super.validate();
    try {
      boolean validType = false;
      String typeCode = this.getTypeCode();
      if (typeCode!=null) {
        IApsEntity entity = this.getUserProfileManager().getProfileType(typeCode);
        if (entity!=null && entity.getAttributeByRole(SystemConstants.USER_PROFILE_ATTRIBUTE_ROLE_MAIL)!=null) {
          validType = true;
        }
      }
      if (!validType) {
        this.addFieldError("typeCode", this.getText("jpuserreg.error.typeCode.required"));
View Full Code Here

  public List<IApsEntity> getProfileTypes() {
    if (this._profileTypes==null) {
      this._profileTypes = new ArrayList<IApsEntity>();
      Iterator<IApsEntity> prototypesIter = this.getUserProfileManager().getEntityPrototypes().values().iterator();
      while (prototypesIter.hasNext()) {
        IApsEntity profile = prototypesIter.next();
        if (profile.getAttributeByRole(SystemConstants.USER_PROFILE_ATTRIBUTE_ROLE_MAIL)!=null) {
          this._profileTypes.add(profile);
        }
      }
    }
    return this._profileTypes;
View Full Code Here

TOP

Related Classes of com.agiletec.aps.system.common.entity.model.IApsEntity

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.