| | |
| | | import java.util.List; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | |
| | | import com.vci.common.log.LogType; |
| | | import com.vci.common.objects.UserEntity; |
| | | import com.vci.common.utility.ObjectUtility; |
| | | import com.vci.corba.common.VCIError; |
| | | import com.vci.corba.common.data.UserEntityInfo; |
| | | import com.vci.corba.framework.data.PvolumeInfo; |
| | | import com.vci.corba.log.data.LogType; |
| | | import com.vci.server.base.delegate.BaseDelegate; |
| | | import com.vci.server.base.delegate.UserEntityDelegate; |
| | | import com.vci.server.base.utility.LogRecordUtil; |
| | | import com.vci.server.cache.VolumeCacheProvider; |
| | | import com.vci.server.framework.systemConfig.log.LogRecordUtil; |
| | | import com.vci.server.framework.cache.VolumeCatch; |
| | | import com.vci.server.framework.volume.dao.Pvolume; |
| | | import com.vci.server.framework.volume.service.PvolumeService; |
| | | import com.vci.server.framework.volume.service.VolumeCatch; |
| | | |
| | | public class PvolumeDelegate extends BaseDelegate { |
| | | |
| | |
| | | } |
| | | |
| | | Pvolume pvolume = changePvolumeInfoToPvolume(pvolumeInfo); |
| | | UserEntity userEntity = changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | //UserEntity userEntity = changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | //createFileCabinet(pvolume.getPath()); |
| | | boolean success = pvoSer.savePvolume(pvolume); |
| | | if (success) { |
| | | VolumeCatch.setVolume(pvolumeInfo); |
| | | } |
| | | LogRecordUtil.writeLog(userEntity, "添加", success ? "添加成功" : "添加失败", pvolume.getLogInfo(),LogType.GeneralOperation,pvolume.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "添加", success ? "添加成功" : "添加失败", pvolume.getLogInfo(),LogType.General,pvolume.getId()); |
| | | } catch (Exception e) { |
| | | throw new VCIError("310100",new String[0]); |
| | | } |
| | |
| | | |
| | | UserEntityDelegate.setUserEntityToService(pvoSer, userEntityInfo); |
| | | Pvolume pvolume = changePvolumeInfoToPvolume(pvoInfo); |
| | | UserEntity userEntity = changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | //UserEntity userEntity = changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try{ |
| | | Pvolume pvolumeBefore = pvoSer.getProlumeById(pvolume.getId()); |
| | | boolean success = pvoSer.updatePvolume(pvolume); |
| | |
| | | StringBuilder logres = new StringBuilder(); |
| | | logres.append("更新前:"+pvolumeBefore.getLogInfo()); |
| | | logres.append("更新后:"+pvolume.getLogInfo()); |
| | | LogRecordUtil.writeLog(userEntity, "更新", success ? "修改成功" : "修改失败", logres.toString(), LogType.GeneralOperation,pvolumeBefore.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "更新", success ? "修改成功" : "修改失败", logres.toString(), LogType.General,pvolumeBefore.getId()); |
| | | }catch(Exception e){ |
| | | LogRecordUtil.writeLog(userEntity, "更新", "修改失败", e.getMessage(), LogType.GeneralOperation, pvoInfo.id); |
| | | LogRecordUtil.writeLog(userEntityInfo, "更新", "修改失败", e.getMessage(), LogType.General, pvoInfo.id); |
| | | throw new VCIError("310103", new String[0]); |
| | | } |
| | | |
| | |
| | | */ |
| | | public boolean deletePvolume(String[] ids, UserEntityInfo userEntityInfo) throws VCIError { |
| | | UserEntityDelegate.setUserEntityToService(pvoSer, userEntityInfo); |
| | | UserEntity userEntity = changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | //UserEntity userEntity = changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | try { |
| | | |
| | | List<Pvolume> list = new ArrayList<Pvolume>(); |
| | |
| | | for (Pvolume vol : list) { |
| | | String volId = vol.getId(); |
| | | VolumeCatch.delVolume(vol.getName()); |
| | | LogRecordUtil.writeLog(userEntity, "删除", "删除成功", volId, LogType.GeneralOperation, vol.getLogInfo()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "删除", "删除成功", volId, LogType.General, vol.getLogInfo()); |
| | | } |
| | | } catch (Exception e) { |
| | | throw new VCIError("310104", new String[0]); |
| | |
| | | public void updatePvolumeInvalid(UserEntityInfo userEntityInfo)throws VCIError{ |
| | | |
| | | UserEntityDelegate.setUserEntityToService(pvoSer, userEntityInfo); |
| | | UserEntity userEntity = changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | //UserEntity userEntity = changeUserEntityInfoToUserEntity(userEntityInfo); |
| | | Pvolume pvo = pvoSer.getIsvalidVolumeName(); |
| | | try{ |
| | | |
| | |
| | | logres.append("更新前:"+pvo.getLogInfo()+"为首选路径!"); |
| | | pvo.setIsvalid(false); |
| | | logres.append(" 更新后:"+pvo.getLogInfo()+"不为首选路径"); |
| | | LogRecordUtil.writeLog(userEntity, "更新", "修改成功", logres.toString(), LogType.GeneralOperation,pvo.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "更新", "修改成功", logres.toString(), LogType.General,pvo.getId()); |
| | | } |
| | | }catch(Exception e){ |
| | | LogRecordUtil.writeLog(userEntity, "更新", "修改失败", e.getMessage(), LogType.GeneralOperation,pvo.getId()); |
| | | LogRecordUtil.writeLog(userEntityInfo, "更新", "修改失败", e.getMessage(), LogType.General,pvo.getId()); |
| | | throw new VCIError("310105", new String[0]); |
| | | } |
| | | } |